23 m_stateGuideline (stateGuideline),
25 m_transformation (nullptr)
40 QVector<CentipedeStateAbstractBase*>::iterator itr;
41 for (itr = m_states.begin (); itr != m_states.end (); itr++) {
49 delete m_transformation;
52void CentipedeStateContext::completeRequestedStateTransitionIfExists ()
54 if (m_currentState != m_requestedState) {
61 m_states [m_currentState]->end ();
65 m_currentState = m_requestedState;
66 m_states [m_requestedState]->begin ();
73 m_stateGuideline.createGuidelineCommand (selectedXT,
78 bool atLeastOneSelectedItem)
80 m_states [m_currentState]->handleKeyPress (key,
81 atLeastOneSelectedItem);
83 completeRequestedStateTransitionIfExists();
89 m_states [m_currentState]->handleMouseMove (pos);
91 completeRequestedStateTransitionIfExists();
104 if (!clickedOnItem) {
111 m_posClickScreen = pos;
113 m_states [m_currentState]->handleMousePress (pos);
115 completeRequestedStateTransitionIfExists();
121 m_states [m_currentState]->handleMouseRelease (pos);
123 completeRequestedStateTransitionIfExists();
128 return m_modelCoords;
133 return m_modelGuideline;
138 return m_posClickScreen;
143 m_requestedState = centipedeState;
148 m_requestedState = centipedeState;
149 completeRequestedStateTransitionIfExists();
159 return *m_transformation;
CentipedeState
Set of possible states of Centipede construction.
@ CENTIPEDE_STATE_BUILD_CARTESIAN
@ CENTIPEDE_STATE_PREBUILD
@ CENTIPEDE_STATE_BUILD_POLAR
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT.
Base class for CentipedePair states.
Class for period while building cartesian centipedes.
Class for period while building polar centipedes.
DocumentModelCoords modelCoords() const
Get method for forwarded DocumentModelCoords.
GraphicsScene & scene() const
Get method for forwarded GraphicsScene.
CentipedeStateContext(DigitizeStateGuideline &stateGuideline)
Single constructor.
virtual void handleMouseMove(QPointF posScreen)
DocumentModelGuideline modelGuideline() const
Get method for forwarded DocumentModelGuideline.
virtual void handleMousePress(GraphicsScene *scene, const Transformation &transformation, const DocumentModelGuideline &modelGuideline, const DocumentModelCoords &modelCoords, QPointF posScreen, bool clickedOnItem)
QPointF posClickScreen() const
Get method for forwarded click point.
Transformation transformation() const
Get method for forwarded Transformation.
virtual ~CentipedeStateContext()
virtual void handleMouseRelease(QPointF posScreen)
void requestDelayedStateTransition(CentipedeState centipedeState)
Initiate state transition to be performed later, when CentipedeState is off the stack.
void createGuidelineCommand(bool selectedXTFinal, double valueFinal)
Create a command for creating a Guideline.
void requestImmediateStateTransition(CentipedeState centipedeState)
Perform immediate state transition for immediate action. Called when states are off the stack.
virtual void handleKeyPress(Qt::Key key, bool atLeastOneSelectedItem)
Class for period between build states.
Digitizing state for creating, moving and removing guidelines.
Model for DlgSettingsCoords and CmdSettingsCoords.
Model for managing the coordinate values corresponding Guidelines.
Add point and line handling to generic QGraphicsScene.