51#include <QGraphicsScene>
59 m_guidelines (guidelines),
60 m_mainWindow (mainWindow)
102 m_nextState = guidelineStateInitial;
104 transitionIfRequested ();
118 return m_guidelines.color ();
125 return m_states[m_currentState]->convertGraphCoordinateToScreenPoint (valueGraph);
132 return m_states[m_currentState]->convertScreenPointToGraphCoordinate (posScreen);
138 return m_guidelines.createGuideline (identifier,
146 return m_states[m_currentState]->doPaint ();
152 transitionIfRequested ();
164 m_states[m_currentState]->handleActiveChange (active);
165 transitionIfRequested ();
171 m_states[m_currentState]->handleHoverEnterEvent ();
172 transitionIfRequested ();
179 m_states[m_currentState]->handleHoverLeaveEvent ();
180 transitionIfRequested ();
187 m_states[m_currentState]->handleMousePress (posScene);
188 transitionIfRequested ();
195 m_states[m_currentState]->handleMouseRelease (posScene);
196 transitionIfRequested ();
204 m_states[m_currentState]->handleGuidelineMode (visible,
206 transitionIfRequested ();
211 return m_mainWindow.cmdMediator ()->document ().modelGuideline ();
218 return m_states[m_currentState]->pointToEllipse (posScreen);
225 return m_states[m_currentState]->pointToLine (posScreen);
230 return m_posCursorGraph;
237 m_nextState = guidelineState;
244 m_posCursorGraph = posGraph;
251 m_states[m_currentState]->handleTimeout ();
252 transitionIfRequested ();
257 return m_guidelines.stateDump ();
264 return m_states[m_currentState]->stateName();
269 return m_guidelines.transformation ();
272void GuidelineStateContext::transitionIfRequested ()
274 if (m_currentState != m_nextState) {
278 m_states[m_currentState]->end ();
281 m_currentState = m_nextState;
284 m_states[m_currentState]->begin();
292 m_states[m_currentState]->updateWithLatestTransformation();
293 transitionIfRequested ();
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT.
GuidelineState
Set of possible Guideline states. See class Guideline for more information.
@ GUIDELINE_STATE_HANDLE_Y
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_T_SELECT_EDIT_HOVER
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_X_SELECT_HIDE
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_UNSELECT_LOCK
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_SELECT_LOCK
@ GUIDELINE_STATE_DISCARDED
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_X_SELECT_EDIT_APPEARING
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_T_UNSELECT_EDIT
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_UNSELECT_EDIT
@ GUIDELINE_STATE_HANDLE_R
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_T_SELECT_EDIT
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_T_UNSELECT_LOCK
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_SELECT_HIDE
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_X_UNSELECT_EDIT
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_T_SELECT_LOCK
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_UNSELECT_HIDE
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_SELECT_EDIT_APPEARING
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_R_SELECT_EDIT_APPEARING
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_X_UNSELECT_HIDE
@ GUIDELINE_STATE_HANDLE_X
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_SELECT_EDIT
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_R_SELECT_EDIT
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_R_SELECT_EDIT_HOVER
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_X_SELECT_LOCK
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_R_UNSELECT_LOCK
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_R_SELECT_HIDE
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_X_UNSELECT_LOCK
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_T_SELECT_EDIT_APPEARING
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_R_SELECT_LOCK
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_X_SELECT_EDIT_HOVER
@ GUIDELINE_STATE_HANDLE_T
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_R_UNSELECT_HIDE
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_T_UNSELECT_HIDE
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_SELECT_EDIT_HOVER
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_R_UNSELECT_EDIT
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_X_SELECT_EDIT
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_T_SELECT_HIDE
Model for managing the coordinate values corresponding Guidelines.
Parameters that define an ellipse about the specified center, at the specified angle from alignment w...
This class is a special case of the standard QGraphicsLineItem for guidelines, and serves as the base...
QPointF convertGraphCoordinateToScreenPoint(double valueGraph) const
Convert single graph coordinate into screen point pair.
bool doPaint() const
Allow/skip painting of the owner Guideline.
Transformation transformation() const
Return copy of transformation owned by MainWindow.
void draggedOffScreen()
Guideline has been dragged off screen so remove it.
QString stateDump() const
Dump state for debugging only.
void handleActiveChange(bool active)
DigitizeState change so active status may (or may not) be toggled.
QPointF posCursorGraph() const
Get method for current cursor coordinate when object was last created/dragged.
void handleHoverLeaveEvent()
If previously transparent before hover enter then make transparent again.
bool cartesian() const
True/false if coordinates are cartesian/polar.
GuidelineAbstract & guideline()
Guideline that owns this context class.
ColorPalette color() const
Color to be used for guidelines.
void setPosCursorGraph(const QPointF &posGraph)
Pass the current cursor coordinate to the state so it can save the relevant coordinate for later adju...
QLineF pointToLine(const QPointF &posScreen) const
Return line parallel to an axis line, that passes through the specified point.
GuidelineStateContext(GuidelineAbstract &guideline, MainWindow &mainWindow, Guidelines &guidelines, GuidelineState guidelineStateInitial)
Single constructor.
double convertScreenPointToGraphCoordinate(const QPointF &posScreen) const
Convert screen point pair into single graph coordinate.
QString stateName() const
State as a string for debugging only.
void requestStateTransition(GuidelineState guidelineState)
Request a state transition.
EllipseParameters pointToEllipse(const QPointF &posScreen) const
Return ellipse representing constant range, that passes through the specified point.
virtual ~GuidelineStateContext()
void handleMousePress(const QPointF &posScene)
At the start of dragging, convert the original Guideline into an invisible handle and visible slaved ...
void handleHoverEnterEvent()
If transparent then make visible when hover starts.
void handleGuidelineMode(bool visibile, bool locked)
User toggled Guideline visibility and/or locked mode.
DocumentModelGuideline modelGuideline() const
Up-to-date guideline settings.
void updateWithLatestTransformation()
Update given Transformation in GuidelineStateContext.
void handleMouseRelease(const QPointF &posScene)
At the end of dragging, clone the Guideline that owns the state machine where these states live.
GuidelineAbstract * createGuideline(const QString &identifier, GuidelineState stateInitial) const
Factory method for creating a new Guideline.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_R_SELECT_EDIT_APPEARING.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_R_SELECT_EDIT_HOVER.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_R_SELECT_EDIT.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_R_SELECT_HIDE.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_R_SELECT_LOCK.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_R_UNSELECT_EDIT.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_R_UNSELECT_HIDE.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_R_UNSELECT_LOCK.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_T_SELECT_EDIT_APPEARING.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_T_SELECT_EDIT_HOVER.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_T_SELECT_EDIT.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_T_SELECT_HIDE.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_T_SELECT_LOCK.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_T_UNSELECT_EDIT.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_T_UNSELECT_HIDE.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_T_UNSELECT_LOCK.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_X_SELECT_EDITAPPEARING.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_X_SELECT_EDIT_HOVER.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_X_SELECT_EDIT.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_X_SELECT_HIDE.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_X_SELECT_LOCK.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_X_UNSELECT_EDIT.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_X_UNSELECT_HIDE.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_X_UNSELECT_LOCK.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_APPEARING.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_SELECT_EDIT_HOVER.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_SELECT_EDIT.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_SELECT_HIDE.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_SELECT_LOCK.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_UNSELECT_EDIT.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_UNSELECT_HIDE.
Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_UNSELECT_LOCK.
Implements guideline behavior for GUIDELINE_STATE_DISCARDED.
GuidelineStateHandleAbstract instantiated for radius R guideline.
GuidelineStateHandleAbstract instantiated for theta R guideline.
GuidelineStateHandleAbstract instantiated for coordinate X guideline.
GuidelineStateHandleAbstract instantiated for coordinate Y guideline.
This class contains all Guideline objects.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...