Engauge Digitizer 2
|
Context class for state machine that belongs to the Guideline class. More...
#include <GuidelineStateContext.h>
Public Slots | |
void | slotTimeout () |
Public Member Functions | |
GuidelineStateContext (GuidelineAbstract &guideline, MainWindow &mainWindow, Guidelines &guidelines, GuidelineState guidelineStateInitial) | |
Single constructor. | |
virtual | ~GuidelineStateContext () |
bool | cartesian () const |
True/false if coordinates are cartesian/polar. | |
ColorPalette | color () const |
Color to be used for guidelines. | |
QPointF | convertGraphCoordinateToScreenPoint (double valueGraph) const |
Convert single graph coordinate into screen point pair. | |
double | convertScreenPointToGraphCoordinate (const QPointF &posScreen) const |
Convert screen point pair into single graph coordinate. | |
GuidelineAbstract * | createGuideline (const QString &identifier, GuidelineState stateInitial) const |
Factory method for creating a new Guideline. | |
bool | doPaint () const |
Allow/skip painting of the owner Guideline. | |
void | draggedOffScreen () |
Guideline has been dragged off screen so remove it. | |
GuidelineAbstract & | guideline () |
Guideline that owns this context class. | |
void | handleActiveChange (bool active) |
DigitizeState change so active status may (or may not) be toggled. | |
void | handleGuidelineMode (bool visibile, bool locked) |
User toggled Guideline visibility and/or locked mode. | |
void | handleHoverEnterEvent () |
If transparent then make visible when hover starts. | |
void | handleHoverLeaveEvent () |
If previously transparent before hover enter then make transparent again. | |
void | handleMousePress (const QPointF &posScene) |
At the start of dragging, convert the original Guideline into an invisible handle and visible slaved deployed Guideline. | |
void | handleMouseRelease (const QPointF &posScene) |
At the end of dragging, clone the Guideline that owns the state machine where these states live. | |
DocumentModelGuideline | modelGuideline () const |
Up-to-date guideline settings. | |
EllipseParameters | pointToEllipse (const QPointF &posScreen) const |
Return ellipse representing constant range, that passes through the specified point. | |
QLineF | pointToLine (const QPointF &posScreen) const |
Return line parallel to an axis line, that passes through the specified point. | |
QPointF | posCursorGraph () const |
Get method for current cursor coordinate when object was last created/dragged. | |
void | requestStateTransition (GuidelineState guidelineState) |
Request a state transition. | |
void | setPosCursorGraph (const QPointF &posGraph) |
Pass the current cursor coordinate to the state so it can save the relevant coordinate for later adjustement when the transformation changes. | |
QString | stateDump () const |
Dump state for debugging only. | |
QString | stateName () const |
State as a string for debugging only. | |
Transformation | transformation () const |
Return copy of transformation owned by MainWindow. | |
void | updateWithLatestTransformation () |
Update given Transformation in GuidelineStateContext. |
Context class for state machine that belongs to the Guideline class.
The GuidelineAbstract class owns an instance of this class. The base class for all guideline states is GuidelineStateAbstractBase.
While dragging, the Guideline appears to follow a constant-coordinate isocontour during the dragging. The isocontour is along X or Y for cartesian coordinates, or T or R for polar coordinates. This effect is achieved using three GuidelineAbstract instances:
The state machine graph for dragging a Guideline is below:
This class derives from QObject so it can receive timeouts from the Appearing state, and then perform a state transition after each timeout. If the states received those timeouts then they would not be able to (singlehandedly) take themselves off the stack
Definition at line 131 of file GuidelineStateContext.h.
GuidelineStateContext::GuidelineStateContext | ( | GuidelineAbstract & | guideline, |
MainWindow & | mainWindow, | ||
Guidelines & | guidelines, | ||
GuidelineState | guidelineStateInitial ) |
Single constructor.
Definition at line 54 of file GuidelineStateContext.cpp.
|
virtual |
Definition at line 107 of file GuidelineStateContext.cpp.
bool GuidelineStateContext::cartesian | ( | ) | const |
True/false if coordinates are cartesian/polar.
Definition at line 111 of file GuidelineStateContext.cpp.
ColorPalette GuidelineStateContext::color | ( | ) | const |
Color to be used for guidelines.
Definition at line 116 of file GuidelineStateContext.cpp.
QPointF GuidelineStateContext::convertGraphCoordinateToScreenPoint | ( | double | valueGraph | ) | const |
Convert single graph coordinate into screen point pair.
Definition at line 121 of file GuidelineStateContext.cpp.
double GuidelineStateContext::convertScreenPointToGraphCoordinate | ( | const QPointF & | posScreen | ) | const |
Convert screen point pair into single graph coordinate.
Definition at line 128 of file GuidelineStateContext.cpp.
GuidelineAbstract * GuidelineStateContext::createGuideline | ( | const QString & | identifier, |
GuidelineState | stateInitial ) const |
Factory method for creating a new Guideline.
Definition at line 135 of file GuidelineStateContext.cpp.
bool GuidelineStateContext::doPaint | ( | ) | const |
Allow/skip painting of the owner Guideline.
This prevents display of selection markings on otherwise-invisible handle Guideline
Definition at line 142 of file GuidelineStateContext.cpp.
void GuidelineStateContext::draggedOffScreen | ( | ) |
Guideline has been dragged off screen so remove it.
Definition at line 149 of file GuidelineStateContext.cpp.
GuidelineAbstract & GuidelineStateContext::guideline | ( | ) |
Guideline that owns this context class.
Definition at line 155 of file GuidelineStateContext.cpp.
void GuidelineStateContext::handleActiveChange | ( | bool | active | ) |
DigitizeState change so active status may (or may not) be toggled.
Definition at line 160 of file GuidelineStateContext.cpp.
void GuidelineStateContext::handleGuidelineMode | ( | bool | visibile, |
bool | locked ) |
User toggled Guideline visibility and/or locked mode.
Definition at line 199 of file GuidelineStateContext.cpp.
void GuidelineStateContext::handleHoverEnterEvent | ( | ) |
If transparent then make visible when hover starts.
Definition at line 167 of file GuidelineStateContext.cpp.
void GuidelineStateContext::handleHoverLeaveEvent | ( | ) |
If previously transparent before hover enter then make transparent again.
Definition at line 175 of file GuidelineStateContext.cpp.
void GuidelineStateContext::handleMousePress | ( | const QPointF & | posScene | ) |
At the start of dragging, convert the original Guideline into an invisible handle and visible slaved deployed Guideline.
Definition at line 183 of file GuidelineStateContext.cpp.
void GuidelineStateContext::handleMouseRelease | ( | const QPointF & | posScene | ) |
At the end of dragging, clone the Guideline that owns the state machine where these states live.
Definition at line 191 of file GuidelineStateContext.cpp.
DocumentModelGuideline GuidelineStateContext::modelGuideline | ( | ) | const |
Up-to-date guideline settings.
Definition at line 209 of file GuidelineStateContext.cpp.
EllipseParameters GuidelineStateContext::pointToEllipse | ( | const QPointF & | posScreen | ) | const |
Return ellipse representing constant range, that passes through the specified point.
Definition at line 214 of file GuidelineStateContext.cpp.
QLineF GuidelineStateContext::pointToLine | ( | const QPointF & | posScreen | ) | const |
Return line parallel to an axis line, that passes through the specified point.
Definition at line 221 of file GuidelineStateContext.cpp.
QPointF GuidelineStateContext::posCursorGraph | ( | ) | const |
Get method for current cursor coordinate when object was last created/dragged.
Definition at line 228 of file GuidelineStateContext.cpp.
void GuidelineStateContext::requestStateTransition | ( | GuidelineState | guidelineState | ) |
Request a state transition.
Definition at line 233 of file GuidelineStateContext.cpp.
void GuidelineStateContext::setPosCursorGraph | ( | const QPointF & | posGraph | ) |
Pass the current cursor coordinate to the state so it can save the relevant coordinate for later adjustement when the transformation changes.
Definition at line 240 of file GuidelineStateContext.cpp.
|
slot |
Definition at line 247 of file GuidelineStateContext.cpp.
QString GuidelineStateContext::stateDump | ( | ) | const |
Dump state for debugging only.
Definition at line 255 of file GuidelineStateContext.cpp.
QString GuidelineStateContext::stateName | ( | ) | const |
State as a string for debugging only.
Definition at line 260 of file GuidelineStateContext.cpp.
Transformation GuidelineStateContext::transformation | ( | ) | const |
Return copy of transformation owned by MainWindow.
Definition at line 267 of file GuidelineStateContext.cpp.
void GuidelineStateContext::updateWithLatestTransformation | ( | ) |
Update given Transformation in GuidelineStateContext.
Definition at line 288 of file GuidelineStateContext.cpp.