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

Compute geometry for deployed constant y Guideline. More...

#include <GuidelineStateDeployedConstantYAbstract.h>

Inheritance diagram for GuidelineStateDeployedConstantYAbstract:
Inheritance graph
Collaboration diagram for GuidelineStateDeployedConstantYAbstract:
Collaboration graph

Public Member Functions

 GuidelineStateDeployedConstantYAbstract (GuidelineStateContext &context)
 Single constructor.
virtual ~GuidelineStateDeployedConstantYAbstract ()
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 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 void updateWithLatestTransformation ()
 Update given Transformation in GuidelineStateContext.
Public Member Functions inherited from GuidelineStateDeployedAbstract
 GuidelineStateDeployedAbstract (GuidelineStateContext &context)
 Single constructor.
virtual ~GuidelineStateDeployedAbstract ()
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 void handleTimeout ()
 Handle timeout from Appearing state.
Public Member Functions inherited from GuidelineStateAbstractBase
 GuidelineStateAbstractBase (GuidelineStateContext &context)
 Single constructor.
virtual ~GuidelineStateAbstractBase ()
virtual void begin ()=0
 Transition into state.
virtual bool doPaint () const =0
 Allow/skip painting of the owner Guideline.
virtual void handleActiveChange (bool active)=0
 DigitizeState change so active status may (or may not) be toggled.
virtual void handleGuidelineMode (bool visibility, bool locked)=0
 User toggled Guideline visibility and/or locked mode.
virtual void handleHoverEnterEvent ()=0
 If transparent then make visible when hover starts.
virtual void handleHoverLeaveEvent ()=0
 If previously transparent before hover enter then make transparent again.
virtual void handleMousePress (const QPointF &posScene)=0
 At the start of dragging, convert the Guideline into an invisible handle and visible slaved deployed Guideline.
virtual QString stateName () const =0
 Name of state as a string for debugging only.

Additional Inherited Members

Protected Member Functions inherited from GuidelineStateDeployedAbstract
void beginCommon (bool hovering, bool locked)
 Initialization common to all states.
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

Compute geometry for deployed constant y Guideline.

Definition at line 13 of file GuidelineStateDeployedConstantYAbstract.h.

Constructor & Destructor Documentation

◆ GuidelineStateDeployedConstantYAbstract()

GuidelineStateDeployedConstantYAbstract::GuidelineStateDeployedConstantYAbstract ( GuidelineStateContext & context)

Single constructor.

Definition at line 15 of file GuidelineStateDeployedConstantYAbstract.cpp.

15 :
17{
18}
GuidelineStateContext & context() const
Context in charge of the state classes.
GuidelineStateDeployedAbstract(GuidelineStateContext &context)
Single constructor.

◆ ~GuidelineStateDeployedConstantYAbstract()

GuidelineStateDeployedConstantYAbstract::~GuidelineStateDeployedConstantYAbstract ( )
virtual

Definition at line 20 of file GuidelineStateDeployedConstantYAbstract.cpp.

21{
22}

Member Function Documentation

◆ convertGraphCoordinateToScreenPoint()

QPointF GuidelineStateDeployedConstantYAbstract::convertGraphCoordinateToScreenPoint ( double valueGraph) const
virtual

Convert single graph coordinate into screen point pair.

Implements GuidelineStateAbstractBase.

Definition at line 24 of file GuidelineStateDeployedConstantYAbstract.cpp.

25{
26 const double ARBITRARY_X = 1.0; // Value that is legal in all cases, including log scaling
27 QPointF posScreen;
28 context().transformation().transformRawGraphToScreen (QPointF (ARBITRARY_X,
29 valueGraph),
30 posScreen);
31
32 LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateDeployedConstantYAbstract::convertGraphCoordinateToScreenPoint"
33 << " pos=(" << posScreen.x() << ", " << posScreen.y() << ")";
34
35 return posScreen;
36}
log4cpp::Category * mainCat
Definition Logger.cpp:14
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 GuidelineStateDeployedConstantYAbstract::convertScreenPointToGraphCoordinate ( const QPointF & posScreen) const
virtual

Convert screen point pair into single graph coordinate.

Implements GuidelineStateAbstractBase.

Definition at line 38 of file GuidelineStateDeployedConstantYAbstract.cpp.

39{
40 QPointF posGraph;
42 posGraph);
43
44 LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateDeployedConstantYAbstract::convertScreenPointToGraphCoordinate"
45 << " pos=(" << posGraph.x() << ", " << posGraph.y() << ")";
46
47 return posGraph.y();
48}
void transformScreenToRawGraph(const QPointF &coordScreen, QPointF &coordGraph) const
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.

◆ pointToEllipse()

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

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

Implements GuidelineStateAbstractBase.

Definition at line 50 of file GuidelineStateDeployedConstantYAbstract.cpp.

51{
52 // pointToLine applies in this state
53 return EllipseParameters();
54}

◆ pointToLine()

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

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

Implements GuidelineStateAbstractBase.

Definition at line 56 of file GuidelineStateDeployedConstantYAbstract.cpp.

57{
58 GuidelineProjectorConstantY projector;
59
60 return projector.fromPosScreen (context().transformation(),
61 sceneRect (),
62 posScreen);
63}
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)

◆ updateWithLatestTransformation()

void GuidelineStateDeployedConstantYAbstract::updateWithLatestTransformation ( )
virtual

Update given Transformation in GuidelineStateContext.

Implements GuidelineStateAbstractBase.

Definition at line 65 of file GuidelineStateDeployedConstantYAbstract.cpp.

66{
67 LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateDeployedConstantYAbstract::updateWithLatestTransformation";
68
69 if (!context().transformation().transformIsDefined()) {
70 // Discard this Guideline immediately if the transformation transitions to undefined
72 } else {
73
74 GuidelineProjectorConstantY projector;
75
76 GuidelineLine *line = dynamic_cast<GuidelineLine*> (&context().guideline());
77 line->setLine (projector.fromCoordinateY (context().transformation(),
78 sceneRect (),
79 context().posCursorGraph ().y()));
80 }
81}
@ GUIDELINE_STATE_DISCARDED
QLineF fromCoordinateY(const Transformation &transformation, const QRectF &sceneRect, double yGraph)
Return line through y in graph coordinates.
GuidelineAbstract & guideline()
Guideline that owns this context class.
void requestStateTransition(GuidelineState guidelineState)
Request a state transition.

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