Engauge Digitizer 2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
GuidelineStateDeployedConstantTAbstract Class Reference

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

#include <GuidelineStateDeployedConstantTAbstract.h>

Inheritance diagram for GuidelineStateDeployedConstantTAbstract:
Inheritance graph
Collaboration diagram for GuidelineStateDeployedConstantTAbstract:
Collaboration graph

Public Member Functions

 GuidelineStateDeployedConstantTAbstract (GuidelineStateContext &context)
 Single constructor.
 
virtual ~GuidelineStateDeployedConstantTAbstract ()
 
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 (GuidelineFormat::HoverOption hoverOption, 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 theta Guideline.

Definition at line 13 of file GuidelineStateDeployedConstantTAbstract.h.

Constructor & Destructor Documentation

◆ GuidelineStateDeployedConstantTAbstract()

GuidelineStateDeployedConstantTAbstract::GuidelineStateDeployedConstantTAbstract ( GuidelineStateContext & context)

Single constructor.

Definition at line 16 of file GuidelineStateDeployedConstantTAbstract.cpp.

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

◆ ~GuidelineStateDeployedConstantTAbstract()

GuidelineStateDeployedConstantTAbstract::~GuidelineStateDeployedConstantTAbstract ( )
virtual

Definition at line 21 of file GuidelineStateDeployedConstantTAbstract.cpp.

22{
23}

Member Function Documentation

◆ convertGraphCoordinateToScreenPoint()

QPointF GuidelineStateDeployedConstantTAbstract::convertGraphCoordinateToScreenPoint ( double valueGraph) const
virtual

Convert single graph coordinate into screen point pair.

Implements GuidelineStateAbstractBase.

Definition at line 25 of file GuidelineStateDeployedConstantTAbstract.cpp.

26{
27 // Selecting an arbitrary range value is tricky for the constant T case when log scaling is in effect, since
28 // we cannot pick:
29 // - the origin radius since we are creating a second point which will be later combined with the origin
30 // to fully define the Guideline line
31 // - any negative number (log only accepts positive values)
32 // - any value between 0 (exclusive) and the origin radius (exclusive) since there is no corresponding point
33 // in the graph when the log scale is increasing while moving away from the origin
34 // - any value between the origin radius (exclusive) and infinity since there is no corresponding point
35 // in the graph when the log scale is decreasing while moving away from the origin
36 // The strategy is to pick the four corners of the screen and use one of their coordinates
37 const QGraphicsScene &scene = context().guideline().scene();
38 QRectF sceneRect = scene.sceneRect();
48 double arbitraryRange = qMax (posGraphTL.y(), qMax (posGraphTR.y(), qMax (posGraphBL.y(), posGraphBR.y())));
49
50 QPointF posScreen;
53 posScreen);
54
55 LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateDeployedConstantTAbstract::convertGraphCoordinateToScreenPoint"
56 << " pos=(" << posScreen.x() << ", " << posScreen.y() << ")";
57
58 return posScreen;
59}
const int INNER_RADIUS_MIN
log4cpp::Category * mainCat
Definition Logger.cpp:14
QGraphicsScene & scene()
GraphicsScene that owns this class.
QRectF sceneRect() const
Scene rectangle in screen coordinates (=pixels)
Transformation transformation() const
Return copy of transformation owned by MainWindow.
GuidelineAbstract & guideline()
Guideline that owns this context class.
void transformRawGraphToScreen(const QPointF &pointRaw, QPointF &pointScreen) const
Transform from raw graph coordinates to linear cartesian graph coordinates, then to screen coordinate...
void transformScreenToRawGraph(const QPointF &coordScreen, QPointF &coordGraph) const
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.
#define LOG4CPP_DEBUG_S(logger)
Definition convenience.h:20

◆ convertScreenPointToGraphCoordinate()

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

Convert screen point pair into single graph coordinate.

Implements GuidelineStateAbstractBase.

Definition at line 61 of file GuidelineStateDeployedConstantTAbstract.cpp.

62{
63 QPointF posGraph;
65 posGraph);
66
67 LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateDeployedConstantTAbstract::convertScreenPointToGraphCoordinate"
68 << " pos=(" << posGraph.x() << ", " << posGraph.y() << ")";
69
70 return posGraph.x();
71}

◆ pointToEllipse()

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

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

Implements GuidelineStateAbstractBase.

Definition at line 73 of file GuidelineStateDeployedConstantTAbstract.cpp.

74{
75 // pointToLine applies in this state
76 return EllipseParameters();
77}
Parameters that define an ellipse about the specified center, at the specified angle from alignment w...

◆ pointToLine()

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

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

Implements GuidelineStateAbstractBase.

Definition at line 79 of file GuidelineStateDeployedConstantTAbstract.cpp.

80{
82
83 return projector.fromPosScreen (context().transformation(),
84 sceneRect (),
85 posScreen);
86}
Project a point along the radial direction in graph coordinates to produce a curve along the constant...
QLineF fromPosScreen(const Transformation &transformation, const QRectF &sceneRect, const QPointF &posScreen)
Return line through point in screen coordinates.

◆ updateWithLatestTransformation()

void GuidelineStateDeployedConstantTAbstract::updateWithLatestTransformation ( )
virtual

Update given Transformation in GuidelineStateContext.

Implements GuidelineStateAbstractBase.

Definition at line 88 of file GuidelineStateDeployedConstantTAbstract.cpp.

89{
90 LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateDeployedConstantTAbstract::updateWithLatestTransformation";
91
92 if (!context().transformation().transformIsDefined()) {
93 // Discard this Guideline immediately if the transformation transitions to undefined
95 } else {
96
98
99 GuidelineLine *line = dynamic_cast<GuidelineLine*> (&context().guideline());
100 line->setLine (projector.fromCoordinateT (context().transformation(),
101 sceneRect (),
102 context().posCursorGraph().x ()));
103 }
104}
@ GUIDELINE_STATE_DISCARDED
Line version of GuidelineAbstract.
void requestStateTransition(GuidelineState guidelineState)
Request a state transition.

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