23 const QPointF &posScreen) :
24 m_modelGuideline (modelGuideline),
25 m_centipedeXT (nullptr),
26 m_centipedeYR (nullptr),
27 m_posScreenStart (posScreen),
28 m_selectedXTFinal (true),
56 QPointF delta = posScreen - m_posScreenStart;
57 double distanceFromCenter =
magnitude (delta);
59 return (distanceFromCenter > m_modelGuideline.creationCircleRadius ());
64 QPointF delta = posScreen - m_posScreenStart;
65 double distanceFromCenter =
magnitude (delta);
67 if (updateFinalValues (posScreen)) {
68 m_centipedeXT->updateRadius (m_modelGuideline.creationCircleRadius () + distanceFromCenter);
69 m_centipedeYR->updateRadius (m_modelGuideline.creationCircleRadius () - distanceFromCenter);
71 m_centipedeXT->updateRadius (m_modelGuideline.creationCircleRadius () - distanceFromCenter);
72 m_centipedeYR->updateRadius (m_modelGuideline.creationCircleRadius () + distanceFromCenter);
78 return m_selectedXTFinal;
81bool CentipedePairPolar::updateFinalValues (
const QPointF &posScreen)
86 m_selectedXTFinal = (distXT < distYR);
89 if (m_selectedXTFinal) {
90 m_valueFinal = m_posGraphStart.x();
92 m_valueFinal = m_posGraphStart.y();
95 return m_selectedXTFinal;
void move(const QPointF &posScreen)
Follow cursor move.
CentipedePairPolar(GraphicsScene &scene, const Transformation &transformation, const DocumentModelGuideline &modelGuideline, const DocumentModelCoords &modelCoords, const QPointF &posScreen)
Constructor with individual coordinates.
bool selectedXTFinal() const
True if XT is final selection, otherwise false if YR is final selection.
double valueFinal() const
Final XT or YT (depending on selectedXTFinal) value.
bool done(const QPointF &posScreen)
True if cursor has moved far enough that the CentipedePairPolar has finished and should be removed.
virtual ~CentipedePairPolar()
virtual double distanceToClosestEndpoint(const QPointF &posScreen) const =0
Return distance to closest endpoint.
Centipede for constant R.
Centipede for constant T radial using QGraphicsLineItem.
Model for DlgSettingsCoords and CmdSettingsCoords.
Model for managing the coordinate values corresponding Guidelines.
Add point and line handling to generic QGraphicsScene.
double magnitude(const QPointF &vec)
Norm of vector.