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

Centipede for constant R. More...

#include <CentipedeSegmentConstantREllipse.h>

Inheritance diagram for CentipedeSegmentConstantREllipse:
Inheritance graph
Collaboration diagram for CentipedeSegmentConstantREllipse:
Collaboration graph

Signals

void signalUpdateAngles (QPointF posTangentialLow, QPointF posTangentialCenter, QPointF posTangentialHigh, double widthToHeight, double scaling)
 Send new geometry for later updating.

Public Member Functions

 CentipedeSegmentConstantREllipse (GraphicsScene &scene, const DocumentModelCoords &modelCoords, const DocumentModelGuideline &modelGuideline, const Transformation &transformation, const QPointF &posClickScreen)
 Constructor with individual coordinates.
virtual ~CentipedeSegmentConstantREllipse ()
virtual double distanceToClosestEndpoint (const QPointF &posScreen) const
 Return distance to closest endpoint.
virtual void updateRadius (double radius)
 Update geometry to reflect cursor movement.
Public Member Functions inherited from CentipedeSegmentAbstract
 CentipedeSegmentAbstract (const DocumentModelGuideline &modelGuideline, const Transformation &transformation, const QPointF &posClickScreen)
 Constructor with individual coordinates.
virtual ~CentipedeSegmentAbstract ()

Additional Inherited Members

Protected Member Functions inherited from CentipedeSegmentAbstract
double closestAngleToCentralAngle (double angleCenter, double angleOld) const
 Loop to find closest angle to angleCenter.
const DocumentModelGuidelinemodelGuideline () const
 Settings.
QPointF posClickScreen () const
 Center of circle in screen coordinates.
Transformation transformation () const
 Transformation which is static through the entire lifetime of the Centipede class instances.

Detailed Description

Centipede for constant R.

Definition at line 19 of file CentipedeSegmentConstantREllipse.h.

Constructor & Destructor Documentation

◆ CentipedeSegmentConstantREllipse()

CentipedeSegmentConstantREllipse::CentipedeSegmentConstantREllipse ( GraphicsScene & scene,
const DocumentModelCoords & modelCoords,
const DocumentModelGuideline & modelGuideline,
const Transformation & transformation,
const QPointF & posClickScreen )

Constructor with individual coordinates.

Definition at line 21 of file CentipedeSegmentConstantREllipse.cpp.

25 :
29{
30 // Radius through click point
31 QPointF posClickGraph;
32 transformation.transformScreenToRawGraph (posClickScreen,
33 posClickGraph);
34 double rGraph = posClickGraph.y();
35
36 // Compute basis vectors that are used here and when by any callback(s)
37 QPointF posOriginGraph (0, 0);
38 if (modelCoords.coordScaleYRadius() == COORD_SCALE_LOG) {
39 posOriginGraph = QPointF (0, modelCoords.originRadius());
40 }
41
42 QPointF posScreen0, posScreen90;
43 transformation.transformRawGraphToScreen (posOriginGraph,
44 m_posOriginScreen);
45 transformation.transformRawGraphToScreen (QPointF (0, rGraph),
46 posScreen0);
47 transformation.transformRawGraphToScreen (QPointF (90, rGraph),
48 posScreen90);
49
50 // Fit the ellipse
51 CentipedeEndpointsPolar endpointsPolar (modelCoords,
55 m_posOriginScreen);
56
57 QRectF rectBounding;
58 CentipedeDebugPolar debugPolar;
59 double angleRotation;
60 endpointsPolar.ellipseScreenConstantRForTHighLowAngles (transformation,
62 angleRotation,
63 rectBounding,
64 debugPolar);;
65
66 debugPolar.display (scene,
67 modelCoords,
69
70 // Compute position and angle values
71 m_posRadialLow = endpointsPolar.posScreenConstantRForLowT (modelGuideline.creationCircleRadius());
72 m_posRadialHigh = endpointsPolar.posScreenConstantRForHighT (modelGuideline.creationCircleRadius());
73 endpointsPolar.posScreenConstantRHighLow (modelGuideline.creationCircleRadius (),
74 m_posTangentialLow,
75 m_posTangentialHigh);
76
77 // Create graphics item and its relay. As explained in GuidelineEllipse::updateGeometry, the correct sequence
78 // of graphical operations is very tricky, and less successful if setTransformOriginPoint is used (e.g. works for
79 // non-shear cases but not shear cases)
80 m_graphicsItem = new GraphicsArcItem (rectBounding);
81 m_graphicsItem->setSpanAngle (0); // Prevent flicker by display before span angle is changed from all-inclusive default
82 m_graphicsItem->setRotation (qRadiansToDegrees (angleRotation));
83 m_graphicsItem->setPos (m_posOriginScreen);
84 m_graphicsItemRelay = new GraphicsArcItemRelay (this,
85 m_graphicsItem);
86 QColor color (ColorPaletteToQColor (modelGuideline.lineColor()));
87 m_graphicsItem->setPen (QPen (color,
88 modelGuideline.lineWidthActive ()));
89 updateRadius (modelGuideline.creationCircleRadius());
90
91 scene.addItem (m_graphicsItem);
92}
@ COORD_SCALE_LOG
Definition CoordScale.h:14
QColor ColorPaletteToQColor(ColorPalette color)
Definition EnumsToQt.cpp:16
void display(QGraphicsScene &scene, const DocumentModelCoords &modelCoords, const Transformation &transformation)
Display member variable values on scene.
QPointF posClickScreen() const
Center of circle in screen coordinates.
CentipedeSegmentAbstract(const DocumentModelGuideline &modelGuideline, const Transformation &transformation, const QPointF &posClickScreen)
Constructor with individual coordinates.
const DocumentModelGuideline & modelGuideline() const
Settings.
Transformation transformation() const
Transformation which is static through the entire lifetime of the Centipede class instances.
virtual void updateRadius(double radius)
Update geometry to reflect cursor movement.
CoordScale coordScaleYRadius() const
Get method for linear/log scale on y/radius.
double originRadius() const
Get method for origin radius in polar mode.

◆ ~CentipedeSegmentConstantREllipse()

CentipedeSegmentConstantREllipse::~CentipedeSegmentConstantREllipse ( )
virtual

Definition at line 94 of file CentipedeSegmentConstantREllipse.cpp.

95{
96 delete m_graphicsItem;
97 delete m_graphicsItemRelay;
98}

Member Function Documentation

◆ distanceToClosestEndpoint()

double CentipedeSegmentConstantREllipse::distanceToClosestEndpoint ( const QPointF & posScreen) const
virtual

Return distance to closest endpoint.

Implements CentipedeSegmentAbstract.

Definition at line 100 of file CentipedeSegmentConstantREllipse.cpp.

101{
102 double distanceLow = magnitude (posScreen - m_posRadialLow);
103 double distanceHigh = magnitude (posScreen - m_posRadialHigh);
104
105 return qMin (distanceLow, distanceHigh);
106}
double magnitude(const QPointF &vec)
Norm of vector.
Definition mmsubs.cpp:193

◆ signalUpdateAngles

void CentipedeSegmentConstantREllipse::signalUpdateAngles ( QPointF posTangentialLow,
QPointF posTangentialCenter,
QPointF posTangentialHigh,
double widthToHeight,
double scaling )
signal

Send new geometry for later updating.

◆ updateRadius()

void CentipedeSegmentConstantREllipse::updateRadius ( double radius)
virtual

Update geometry to reflect cursor movement.

Implements CentipedeSegmentAbstract.

Definition at line 108 of file CentipedeSegmentConstantREllipse.cpp.

109{
110 // Scale up/down the angles, with them converging to center angle as radius goes to zero
111 double scaling = radius / modelGuideline().creationCircleRadius ();
112
113 emit signalUpdateAngles (m_posTangentialLow - m_posOriginScreen,
114 posClickScreen () - m_posOriginScreen,
115 m_posTangentialHigh - m_posOriginScreen,
116 m_graphicsItem->rect().width () / m_graphicsItem->rect().height(),
117 scaling);
118}
void signalUpdateAngles(QPointF posTangentialLow, QPointF posTangentialCenter, QPointF posTangentialHigh, double widthToHeight, double scaling)
Send new geometry for later updating.
double creationCircleRadius() const
Get method for creation circle radius in pixels.

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