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

Project a point along the tangential direction in graph coordinates to produce a curve along the constant-range direction, passing through a specified point. More...

#include <GuidelineProjectorConstantR.h>

Inheritance diagram for GuidelineProjectorConstantR:
Inheritance graph
Collaboration diagram for GuidelineProjectorConstantR:
Collaboration graph

Public Member Functions

 GuidelineProjectorConstantR ()
 Single constructor.
 ~GuidelineProjectorConstantR ()
EllipseParameters fromCoordinateR (const Transformation &transformation, const QRectF &sceneRect, double rGraph)
 Return line through y in graph coordinates.
EllipseParameters fromPosScreen (const Transformation &transformation, const QRectF &sceneRect, const QPointF &posScreen)
 Return line through point in screen coordinates.
Public Member Functions inherited from GuidelineProjectorAbstract
 GuidelineProjectorAbstract ()
 Single constructor.
 ~GuidelineProjectorAbstract ()

Additional Inherited Members

Protected Member Functions inherited from GuidelineProjectorAbstract
void calculateCorners (const Transformation &transformation, const QRectF &sceneRect, QPointF &posGraphBL, QPointF &posGraphTL, QPointF &posGraphTR, QPointF &posGraphBR) const
 Conpute four corners of scene in graph coordinates.
bool isOutside (const QRectF &sceneRect, const QPointF &posScreen) const
 Return true if point is outside of the scene.

Detailed Description

Project a point along the tangential direction in graph coordinates to produce a curve along the constant-range direction, passing through a specified point.

Definition at line 21 of file GuidelineProjectorConstantR.h.

Constructor & Destructor Documentation

◆ GuidelineProjectorConstantR()

GuidelineProjectorConstantR::GuidelineProjectorConstantR ( )

Single constructor.

Definition at line 17 of file GuidelineProjectorConstantR.cpp.

18{
19}

◆ ~GuidelineProjectorConstantR()

GuidelineProjectorConstantR::~GuidelineProjectorConstantR ( )

Definition at line 21 of file GuidelineProjectorConstantR.cpp.

22{
23}

Member Function Documentation

◆ fromCoordinateR()

EllipseParameters GuidelineProjectorConstantR::fromCoordinateR ( const Transformation & transformation,
const QRectF & sceneRect,
double rGraph )

Return line through y in graph coordinates.

Definition at line 25 of file GuidelineProjectorConstantR.cpp.

28{
29 QPointF posGraphCenter (0, 0);
30 if (transformation.modelCoords().coordScaleYRadius() == COORD_SCALE_LOG) {
31 posGraphCenter = QPointF (0,
32 transformation.modelCoords().originRadius());
33 }
34
35 // Points at 45, 135, 225 and 315 degrees at range rGraph
36 QPointF posScreenOrigin, posScreen0, posScreen90, posScreen180;
37 transformation.transformRawGraphToScreen (posGraphCenter,
38 posScreenOrigin);
39 transformation.transformRawGraphToScreen (QPointF (0, rGraph),
40 posScreen0);
41 transformation.transformRawGraphToScreen (QPointF (90, rGraph),
42 posScreen90);
43 transformation.transformRawGraphToScreen (QPointF (180, rGraph),
44 posScreen180);
45
46 QPointF centerTo90 = posScreen90 - posScreenOrigin;
47
48 // Corners of parallelogram circumscribing the ellipse
49 QPointF posScreenTL = posScreen180 + centerTo90;
50 QPointF posScreenTR = posScreen0 + centerTo90;
51 QPointF posScreenBR = posScreen0 - centerTo90;
52
53 double angleRadians = 0, aAligned = 0, bAligned = 0;
54 ellipseFromParallelogram (posScreenTL.x() - posScreenOrigin.x(),
55 posScreenTL.y() - posScreenOrigin.y(),
56 posScreenTR.x() - posScreenOrigin.x(),
57 posScreenTR.y() - posScreenOrigin.y(),
58 posScreenBR.x() - posScreenOrigin.x(),
59 posScreenBR.y() - posScreenOrigin.y(),
60 angleRadians,
61 aAligned,
62 bAligned);
63
64 return EllipseParameters (posScreenOrigin,
65 angleRadians,
66 aAligned,
67 bAligned);
68}
@ COORD_SCALE_LOG
Definition CoordScale.h:14
CoordScale coordScaleYRadius() const
Get method for linear/log scale on y/radius.
double originRadius() const
Get method for origin radius in polar mode.
void transformRawGraphToScreen(const QPointF &pointRaw, QPointF &pointScreen) const
Transform from raw graph coordinates to linear cartesian graph coordinates, then to screen coordinate...
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
void ellipseFromParallelogram(double xTL, double yTL, double xTR, double yTR, double xBR, double yBR, double &angleRadians, double &aAligned, double &bAligned)
Calculate ellipse parameters that is incribed in a parallelogram centered at the origin,...
Definition mmsubs.cpp:70

◆ fromPosScreen()

EllipseParameters GuidelineProjectorConstantR::fromPosScreen ( const Transformation & transformation,
const QRectF & sceneRect,
const QPointF & posScreen )

Return line through point in screen coordinates.

Definition at line 70 of file GuidelineProjectorConstantR.cpp.

73{
74 QPointF posGraph;
75 transformation.transformScreenToRawGraph (posScreen, posGraph);
76
77 double rGraph = posGraph.y();
78
79 if ((transformation.modelCoords().coordScaleYRadius() == COORD_SCALE_LOG) &&
80 (rGraph <= 0)) {
81
82 // Range enforcement on the range values with log scale should have prevented this branch
83 LOG4CPP_ERROR_S ((*mainCat)) << "GuidelineProjectorConstantR::fromPosScreen out of bounds range " << rGraph;
84
85 }
86
87 return fromCoordinateR (transformation,
88 sceneRect,
89 rGraph);
90}
log4cpp::Category * mainCat
Definition Logger.cpp:14
EllipseParameters fromCoordinateR(const Transformation &transformation, const QRectF &sceneRect, double rGraph)
Return line through y in graph coordinates.
void transformScreenToRawGraph(const QPointF &coordScreen, QPointF &coordGraph) const
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.
#define LOG4CPP_ERROR_S(logger)
Definition convenience.h:12

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