Engauge Digitizer 2
Loading...
Searching...
No Matches
CentipedeStateContext.h
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2020 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
7#ifndef CENTIPEDE_STATE_CONTEXT_H
8#define CENTIPEDE_STATE_CONTEXT_H
9
10#include "CentipedeState.h"
11#include "DocumentModelCoords.h"
13#include <QPointF>
14#include <QVector>
15
17class CmdMediator;
19class GraphicsScene;
20class MainWindow;
21class Transformation;
22
26{
27public:
30 virtual ~CentipedeStateContext ();
31
33 void createGuidelineCommand (bool selectedXTFinal,
34 double valueFinal);
35
38
39 virtual void handleKeyPress (Qt::Key key,
40 bool atLeastOneSelectedItem);
41 virtual void handleMouseMove (QPointF posScreen);
46 QPointF posScreen,
47 bool clickedOnItem);
48 virtual void handleMouseRelease (QPointF posScreen);
49
52
55
57 QPointF posClickScreen () const;
58
61
64
66 GraphicsScene &scene () const;
67
70
71private:
72
73 void completeRequestedStateTransitionIfExists ();
74
75 // State machine
76 QVector<CentipedeStateAbstractBase*> m_states;
77 CentipedeState m_currentState;
78 CentipedeState m_requestedState; // Same as m_currentState until requestDelayedStateTransition is called
79
80 // Owning state
81 DigitizeStateGuideline &m_stateGuideline;
82
83 // Variables for creating graphics items. Values are forwarded through handleKeyPress
84 GraphicsScene *m_scene;
85 Transformation *m_transformation;
86 DocumentModelGuideline m_modelGuideline;
87 DocumentModelCoords m_modelCoords;
88 QPointF m_posClickScreen;
89};
90
91#endif // CENTIPEDE_STATE_CONTEXT_H
CentipedeState
Set of possible states of Centipede construction.
Base class for CentipedePair states.
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)
GraphicsScene * graphicsScene() const
Get method for forwarded GraphicsScene.
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 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)
Command queue stack.
Definition CmdMediator.h:24
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.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition MainWindow.h:95
Affine transformation between screen and graph coordinates, based on digitized axis points.