Engauge Digitizer 2
Loading...
Searching...
No Matches
GuidelineStateHandleX Class Reference

GuidelineStateHandleAbstract instantiated for coordinate X guideline. More...

#include <GuidelineStateHandleX.h>

Inheritance diagram for GuidelineStateHandleX:
Inheritance graph
Collaboration diagram for GuidelineStateHandleX:
Collaboration graph

Public Member Functions

 GuidelineStateHandleX (GuidelineStateContext &context)
 Single constructor.
virtual ~GuidelineStateHandleX ()
virtual void begin ()
 Transition into state.
virtual QPointF convertGraphCoordinateToScreenPoint (double valueGraph) const
 Convert single graph coordinate into screen point pair.
virtual double convertScreenPointToGraphCoordinate (const QPointF &posScreen) const
 Convert screen point pair into single graph coordinate.
virtual void end ()
 Transition out of state.
virtual void handleMouseRelease (const QPointF &posScene)
 At the end of dragging, clone the Guideline that owns the state machine where these states live.
virtual EllipseParameters pointToEllipse (const QPointF &posScreen) const
 Return ellipse representing constant range, that passes through the specified point.
virtual QLineF pointToLine (const QPointF &posScreen) const
 Return line parallel to an axis line, that passes through the specified point.
virtual QString stateName () const
 Name of state as a string for debugging only.
Public Member Functions inherited from GuidelineStateHandleAbstract
 GuidelineStateHandleAbstract (GuidelineStateContext &context)
 Single constructor.
virtual ~GuidelineStateHandleAbstract ()
virtual bool doPaint () const
 Allow/skip painting of the owner Guideline.
virtual void handleActiveChange (bool active)
 DigitizeState change so active status may (or may not) be toggled.
virtual void handleGuidelineMode (bool visible, bool locked)
 User toggled Guideline visibility and/or locked mode.
virtual void handleHoverEnterEvent ()
 If transparent then make visible when hover starts.
virtual void handleHoverLeaveEvent ()
 If previously transparent before hover enter then make transparent again.
virtual void handleMousePress (const QPointF &posScene)
 At the start of dragging, convert the Guideline into an invisible handle and visible slaved deployed Guideline.
virtual void handleTimeout ()
 Handle timeout from Appearing state.
virtual void updateWithLatestTransformation ()
 Update given Transformation in GuidelineStateContext.
Public Member Functions inherited from GuidelineStateAbstractBase
 GuidelineStateAbstractBase (GuidelineStateContext &context)
 Single constructor.
virtual ~GuidelineStateAbstractBase ()

Additional Inherited Members

Protected Member Functions inherited from GuidelineStateHandleAbstract
void beginCommon ()
Protected Member Functions inherited from GuidelineStateAbstractBase
GuidelineStateContextcontext () const
 Context in charge of the state classes.
void handleMousePressCommon (const QPointF &posAbsolute, GuidelineState stateHandle, GuidelineState stateDeployed)
 Common mouse press handling.
QRectF sceneRect () const
 Scene rectangle in screen coordinates (=pixels)

Detailed Description

GuidelineStateHandleAbstract instantiated for coordinate X guideline.

Definition at line 13 of file GuidelineStateHandleX.h.

Constructor & Destructor Documentation

◆ GuidelineStateHandleX()

GuidelineStateHandleX::GuidelineStateHandleX ( GuidelineStateContext & context)

Single constructor.

Definition at line 17 of file GuidelineStateHandleX.cpp.

17 :
19{
20}
GuidelineStateContext & context() const
Context in charge of the state classes.
GuidelineStateHandleAbstract(GuidelineStateContext &context)
Single constructor.

◆ ~GuidelineStateHandleX()

GuidelineStateHandleX::~GuidelineStateHandleX ( )
virtual

Definition at line 22 of file GuidelineStateHandleX.cpp.

23{
24}

Member Function Documentation

◆ begin()

void GuidelineStateHandleX::begin ( )
virtual

Transition into state.

Implements GuidelineStateAbstractBase.

Definition at line 26 of file GuidelineStateHandleX.cpp.

27{
28 LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateHandleX::begin"
29 << " identifier=" << context().guideline().identifier().toLatin1().data();
30
31 beginCommon ();
32}
log4cpp::Category * mainCat
Definition Logger.cpp:14
virtual QString identifier() const =0
Unique identifier from QGraphicsItem.
GuidelineAbstract & guideline()
Guideline that owns this context class.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

◆ convertGraphCoordinateToScreenPoint()

QPointF GuidelineStateHandleX::convertGraphCoordinateToScreenPoint ( double valueGraph) const
virtual

Convert single graph coordinate into screen point pair.

Implements GuidelineStateAbstractBase.

Definition at line 34 of file GuidelineStateHandleX.cpp.

35{
36 const double ARBITRARY_Y = 1; // Value that is legal in all cases including log
37 QPointF posScreen;
38 context().transformation().transformRawGraphToScreen (QPointF (valueGraph,
39 ARBITRARY_Y),
40 posScreen);
41
42 LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateHandleX::convertGraphCoordinateToScreenPoint"
43 << " pos=(" << posScreen.x() << ", " << posScreen.y() << ")";
44
45 return posScreen;
46}
Transformation transformation() const
Return copy of transformation owned by MainWindow.
void transformRawGraphToScreen(const QPointF &pointRaw, QPointF &pointScreen) const
Transform from raw graph coordinates to linear cartesian graph coordinates, then to screen coordinate...
#define LOG4CPP_DEBUG_S(logger)
Definition convenience.h:20

◆ convertScreenPointToGraphCoordinate()

double GuidelineStateHandleX::convertScreenPointToGraphCoordinate ( const QPointF & posScreen) const
virtual

Convert screen point pair into single graph coordinate.

Implements GuidelineStateAbstractBase.

Definition at line 48 of file GuidelineStateHandleX.cpp.

49{
50 QPointF posGraph;
52 posGraph);
53
54 LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateHandleX::convertScreenPointToGraphCoordinate"
55 << " pos=(" << posGraph.x() << ", " << posGraph.y() << ")";
56
57 return posGraph.x();
58}
void transformScreenToRawGraph(const QPointF &coordScreen, QPointF &coordGraph) const
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.

◆ end()

void GuidelineStateHandleX::end ( )
virtual

Transition out of state.

Implements GuidelineStateAbstractBase.

Definition at line 60 of file GuidelineStateHandleX.cpp.

61{
62 LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateHandleX::end";
63}

◆ handleMouseRelease()

void GuidelineStateHandleX::handleMouseRelease ( const QPointF & posScene)
virtual

At the end of dragging, clone the Guideline that owns the state machine where these states live.

Implements GuidelineStateAbstractBase.

Definition at line 65 of file GuidelineStateHandleX.cpp.

66{
67 LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateHandleX::handleMouseRelease";
68
72}
@ GUIDELINE_STATE_DISCARDED
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_X_SELECT_EDIT
void sacrificeHandleAndVisibleGuidelines(const QPointF &posScene, GuidelineState guidelineStateForReplacement)
Replace visible and handle Guidelines after click and drag.
void requestStateTransition(GuidelineState guidelineState)
Request a state transition.

◆ pointToEllipse()

EllipseParameters GuidelineStateHandleX::pointToEllipse ( const QPointF & posScreen) const
virtual

Return ellipse representing constant range, that passes through the specified point.

Implements GuidelineStateAbstractBase.

Definition at line 74 of file GuidelineStateHandleX.cpp.

75{
76 // pointToLine applies in this state
77 return EllipseParameters();
78}

◆ pointToLine()

QLineF GuidelineStateHandleX::pointToLine ( const QPointF & posScreen) const
virtual

Return line parallel to an axis line, that passes through the specified point.

Implements GuidelineStateAbstractBase.

Definition at line 80 of file GuidelineStateHandleX.cpp.

81{
82 GuidelineProjectorConstantX projector;
83
84 return projector.fromPosScreen (context().transformation(),
85 sceneRect (),
86 posScreen);
87}
QLineF fromPosScreen(const Transformation &transformation, const QRectF &sceneRect, const QPointF &posScreen)
Return line through point in screen coordinates.
QRectF sceneRect() const
Scene rectangle in screen coordinates (=pixels)

◆ stateName()

QString GuidelineStateHandleX::stateName ( ) const
virtual

Name of state as a string for debugging only.

Implements GuidelineStateAbstractBase.

Definition at line 89 of file GuidelineStateHandleX.cpp.

90{
92}
QString guidelineStateAsString(GuidelineState state)
@ GUIDELINE_STATE_HANDLE_X

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