Engauge Digitizer 2
Loading...
Searching...
No Matches
DigitizeStateAbstractBase Class Referenceabstract

Base class for all digitizing states. This serves as an interface to DigitizeStateContext. More...

#include <DigitizeStateAbstractBase.h>

Inheritance diagram for DigitizeStateAbstractBase:
Inheritance graph
Collaboration diagram for DigitizeStateAbstractBase:
Collaboration graph

Public Member Functions

 DigitizeStateAbstractBase (DigitizeStateContext &context)
 Single constructor.
virtual ~DigitizeStateAbstractBase ()
virtual QString activeCurve () const =0
 Name of the active Curve. This can include AXIS_CURVE_NAME.
virtual void begin (CmdMediator *cmdMediator, DigitizeState previousState)=0
 Method that is called at the exact moment a state is entered.
virtual bool canPaste (const Transformation &transformation, const QSize &viewSize) const =0
 Return true if there is good data in the clipboard for pasting, and that is compatible with the current state.
DigitizeStateContextcontext ()
 Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses, without const.
const DigitizeStateContextcontext () const
 Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses, without const.
virtual void end ()=0
 Method that is called at the exact moment a state is exited. Typically called just before begin for the next state.
virtual bool guidelinesAreSelectable () const =0
 Enable/disable guidelines according to state.
virtual void handleContextMenuEventAxis (CmdMediator *cmdMediator, const QString &pointIdentifier)=0
 Handle a right click, on an axis point, that was intercepted earlier.
virtual void handleContextMenuEventGraph (CmdMediator *cmdMediator, const QStringList &pointIdentifiers)=0
 Handle a right click, on a graph point, that was intercepted earlier.
virtual void handleCurveChange (CmdMediator *cmdMediator)=0
 Handle the selection of a new curve. At a minimum, DigitizeStateSegment will generate a new set of Segments.
virtual void handleKeyPress (CmdMediator *cmdMediator, Qt::Key key, bool atLeastOneSelectedItem)=0
 Handle a key press that was intercepted earlier.
virtual void handleMouseMove (CmdMediator *cmdMediator, QPointF posScreen)=0
 Handle a mouse move. This is part of an experiment to see if augmenting the cursor in Point Match mode is worthwhile.
virtual void handleMousePress (CmdMediator *cmdMediator, QPointF pos)=0
 Handle a mouse press that was intercepted earlier.
virtual void handleMouseRelease (CmdMediator *cmdMediator, QPointF pos)=0
 Handle a mouse release that was intercepted earlier.
void setCursor (CmdMediator *cmdMediator)
 Update the cursor according to the current state.
virtual QString state () const =0
 State name for debugging.
virtual void updateAfterPointAddition ()=0
 Update graphics attributes after possible new points. This is useful for highlight opacity.
virtual void updateModelDigitizeCurve (CmdMediator *cmdMediator, const DocumentModelDigitizeCurve &modelDigitizeCurve)=0
 Update the digitize curve settings.
virtual void updateModelSegments (const DocumentModelSegments &modelSegments)=0
 Update the segments given the new settings.

Protected Member Functions

bool canPasteProtected (const Transformation &transformation, const QSize &viewSize) const
 Protected version of canPaste method. Some, but not all, leaf classes use this method.
virtual QCursor cursor (CmdMediator *cmdMediator) const =0
 Returns the state-specific cursor shape.
virtual void handleKeyPressArrow (CmdMediator *cmdMediator, Qt::Key key, bool atLeastOneSelectedItem)
 If the key is an arrow (left, right, up, down) then move currently selected items.
QString moveTextDown () const
 Display text for down arrow.
QString moveTextLeft () const
 Display text for left arrow.
QString moveTextRight () const
 Display text for right arrow.
QString moveTextUp () const
 Display text for up arrow.

Detailed Description

Base class for all digitizing states. This serves as an interface to DigitizeStateContext.

Definition at line 24 of file DigitizeStateAbstractBase.h.

Constructor & Destructor Documentation

◆ DigitizeStateAbstractBase()

DigitizeStateAbstractBase::DigitizeStateAbstractBase ( DigitizeStateContext & context)

Single constructor.

Definition at line 34 of file DigitizeStateAbstractBase.cpp.

34 :
35 m_context (context)
36{
37}
DigitizeStateContext & context()
Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses,...

◆ ~DigitizeStateAbstractBase()

DigitizeStateAbstractBase::~DigitizeStateAbstractBase ( )
virtual

Definition at line 39 of file DigitizeStateAbstractBase.cpp.

40{
41}

Member Function Documentation

◆ activeCurve()

virtual QString DigitizeStateAbstractBase::activeCurve ( ) const
pure virtual

◆ begin()

virtual void DigitizeStateAbstractBase::begin ( CmdMediator * cmdMediator,
DigitizeState previousState )
pure virtual

Method that is called at the exact moment a state is entered.

Typically called just after end for the previous state. The previousState value is used by DigitizeStateColorPicker to return to the previous state

Implemented in DigitizeStateAxis, DigitizeStateColorPicker, DigitizeStateCurve, DigitizeStateEmpty, DigitizeStateGuideline, DigitizeStatePointMatch, DigitizeStateScale, DigitizeStateSegment, and DigitizeStateSelect.

◆ canPaste()

virtual bool DigitizeStateAbstractBase::canPaste ( const Transformation & transformation,
const QSize & viewSize ) const
pure virtual

Return true if there is good data in the clipboard for pasting, and that is compatible with the current state.

Implemented in DigitizeStateAxis, DigitizeStateColorPicker, DigitizeStateCurve, DigitizeStateEmpty, DigitizeStateGuideline, DigitizeStatePointMatch, DigitizeStateScale, DigitizeStateSegment, and DigitizeStateSelect.

◆ canPasteProtected()

bool DigitizeStateAbstractBase::canPasteProtected ( const Transformation & transformation,
const QSize & viewSize ) const
protected

Protected version of canPaste method. Some, but not all, leaf classes use this method.

Definition at line 43 of file DigitizeStateAbstractBase.cpp.

45{
46 MimePointsDetector mimePointsDetector;
47
48 return mimePointsDetector.isMimePointsData (transformation,
49 viewSize);
50}
bool isMimePointsData(const Transformation &transforation, const QSize &screenSize) const
Returns true if text is acceptable mime data.

◆ context() [1/2]

DigitizeStateContext & DigitizeStateAbstractBase::context ( )

Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses, without const.

Definition at line 52 of file DigitizeStateAbstractBase.cpp.

53{
54 return m_context;
55}

◆ context() [2/2]

const DigitizeStateContext & DigitizeStateAbstractBase::context ( ) const

Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses, without const.

Definition at line 57 of file DigitizeStateAbstractBase.cpp.

58{
59 return m_context;
60}

◆ cursor()

virtual QCursor DigitizeStateAbstractBase::cursor ( CmdMediator * cmdMediator) const
protectedpure virtual

◆ end()

virtual void DigitizeStateAbstractBase::end ( )
pure virtual

Method that is called at the exact moment a state is exited. Typically called just before begin for the next state.

Implemented in DigitizeStateAxis, DigitizeStateColorPicker, DigitizeStateCurve, DigitizeStateEmpty, DigitizeStateGuideline, DigitizeStatePointMatch, DigitizeStateScale, DigitizeStateSegment, and DigitizeStateSelect.

◆ guidelinesAreSelectable()

virtual bool DigitizeStateAbstractBase::guidelinesAreSelectable ( ) const
pure virtual

◆ handleContextMenuEventAxis()

virtual void DigitizeStateAbstractBase::handleContextMenuEventAxis ( CmdMediator * cmdMediator,
const QString & pointIdentifier )
pure virtual

◆ handleContextMenuEventGraph()

virtual void DigitizeStateAbstractBase::handleContextMenuEventGraph ( CmdMediator * cmdMediator,
const QStringList & pointIdentifiers )
pure virtual

◆ handleCurveChange()

virtual void DigitizeStateAbstractBase::handleCurveChange ( CmdMediator * cmdMediator)
pure virtual

◆ handleKeyPress()

virtual void DigitizeStateAbstractBase::handleKeyPress ( CmdMediator * cmdMediator,
Qt::Key key,
bool atLeastOneSelectedItem )
pure virtual

◆ handleKeyPressArrow()

void DigitizeStateAbstractBase::handleKeyPressArrow ( CmdMediator * cmdMediator,
Qt::Key key,
bool atLeastOneSelectedItem )
protectedvirtual

If the key is an arrow (left, right, up, down) then move currently selected items.

Definition at line 62 of file DigitizeStateAbstractBase.cpp.

65{
66 LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateAbstractBase::handleKeyPressArrow"
67 << " key=" << QKeySequence (key).toString ().toLatin1 ().data ();
68
69 if (atLeastOneSelectedItem) {
70
71 if (key == Qt::Key_Down ||
72 key == Qt::Key_Up ||
73 key == Qt::Key_Left ||
74 key == Qt::Key_Right) {
75
76 keyPressArrow (cmdMediator,
77 key);
78
79 }
80 }
81}
log4cpp::Category * mainCat
Definition Logger.cpp:14
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

◆ handleMouseMove()

virtual void DigitizeStateAbstractBase::handleMouseMove ( CmdMediator * cmdMediator,
QPointF posScreen )
pure virtual

Handle a mouse move. This is part of an experiment to see if augmenting the cursor in Point Match mode is worthwhile.

Implemented in DigitizeStateAxis, DigitizeStateColorPicker, DigitizeStateCurve, DigitizeStateEmpty, DigitizeStateGuideline, DigitizeStatePointMatch, DigitizeStateScale, DigitizeStateSegment, and DigitizeStateSelect.

◆ handleMousePress()

virtual void DigitizeStateAbstractBase::handleMousePress ( CmdMediator * cmdMediator,
QPointF pos )
pure virtual

◆ handleMouseRelease()

virtual void DigitizeStateAbstractBase::handleMouseRelease ( CmdMediator * cmdMediator,
QPointF pos )
pure virtual

◆ moveTextDown()

QString DigitizeStateAbstractBase::moveTextDown ( ) const
protected

Display text for down arrow.

Definition at line 125 of file DigitizeStateAbstractBase.cpp.

126{
127 return MOVE_TEXT_DOWN;
128}
const QString MOVE_TEXT_DOWN(QObject::tr("Move down"))

◆ moveTextLeft()

QString DigitizeStateAbstractBase::moveTextLeft ( ) const
protected

Display text for left arrow.

Definition at line 130 of file DigitizeStateAbstractBase.cpp.

131{
132 return MOVE_TEXT_LEFT;
133}
const QString MOVE_TEXT_LEFT(QObject::tr("Move left"))

◆ moveTextRight()

QString DigitizeStateAbstractBase::moveTextRight ( ) const
protected

Display text for right arrow.

Definition at line 135 of file DigitizeStateAbstractBase.cpp.

136{
137 return MOVE_TEXT_RIGHT;
138}
const QString MOVE_TEXT_RIGHT(QObject::tr("Move right"))

◆ moveTextUp()

QString DigitizeStateAbstractBase::moveTextUp ( ) const
protected

Display text for up arrow.

Definition at line 140 of file DigitizeStateAbstractBase.cpp.

141{
142 return MOVE_TEXT_UP;
143}
const QString MOVE_TEXT_UP(QObject::tr("Move up"))

◆ setCursor()

void DigitizeStateAbstractBase::setCursor ( CmdMediator * cmdMediator)

Update the cursor according to the current state.

Definition at line 145 of file DigitizeStateAbstractBase.cpp.

146{
147 LOG4CPP_DEBUG_S ((*mainCat)) << "DigitizeStateAbstractBase::setCursor";
148
149 // Note that we are setting the QGraphicsView cursor and NOT the QApplication override cursor
150 m_context.view ().setCursor (cursor (cmdMediator));
151}
virtual QCursor cursor(CmdMediator *cmdMediator) const =0
Returns the state-specific cursor shape.
#define LOG4CPP_DEBUG_S(logger)
Definition convenience.h:20

◆ state()

virtual QString DigitizeStateAbstractBase::state ( ) const
pure virtual

◆ updateAfterPointAddition()

virtual void DigitizeStateAbstractBase::updateAfterPointAddition ( )
pure virtual

Update graphics attributes after possible new points. This is useful for highlight opacity.

Implemented in DigitizeStateAxis, DigitizeStateColorPicker, DigitizeStateCurve, DigitizeStateEmpty, DigitizeStateGuideline, DigitizeStatePointMatch, DigitizeStateScale, DigitizeStateSegment, and DigitizeStateSelect.

◆ updateModelDigitizeCurve()

virtual void DigitizeStateAbstractBase::updateModelDigitizeCurve ( CmdMediator * cmdMediator,
const DocumentModelDigitizeCurve & modelDigitizeCurve )
pure virtual

◆ updateModelSegments()

virtual void DigitizeStateAbstractBase::updateModelSegments ( const DocumentModelSegments & modelSegments)
pure virtual

The documentation for this class was generated from the following files: