14#include <QGraphicsLineItem>
15#include <QGraphicsRectItem>
28 QPointF posOriginGraph (0, 0);
30 posOriginGraph = QPointF (0, modelCoords.
originRadius());
33 QPointF posOriginScreen;
47 m_graphicsItem =
new QGraphicsLineItem (QLineF (m_posLow,
54 m_graphicsItem->setPen (QPen (color,
57 scene.addItem (m_graphicsItem);
62 delete m_graphicsItem;
63 delete m_graphicsItemRelay;
68 double distanceLow =
magnitude (posScreen - m_posLow);
69 double distanceHigh =
magnitude (posScreen - m_posHigh);
71 return qMin (distanceLow, distanceHigh);
77 QPointF posCenter = (m_posHigh + m_posLow) / 2.0;
78 QPointF delta = m_posHigh - m_posLow;
79 double radiusInitial =
magnitude (delta) / 2.0;
80 double scaling = radius / radiusInitial;
81 QPointF posLow = posCenter - scaling / 2.0 * delta;
82 QPointF posHigh = posCenter + scaling / 2.0 * delta;
QColor ColorPaletteToQColor(ColorPalette color)
Compute endpoints for polar centipedes.
void posScreenConstantTForRHighLow(double radius, QPointF &posLow, QPointF &posHigh) const
Endpoints for radial line segmentin polar coordinates.
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.
void signalUpdateEndpoints(QPointF start, QPointF end)
Send new geometry for later updating.
CentipedeSegmentConstantTRadial(GraphicsScene &scene, const DocumentModelCoords &modelCoords, const DocumentModelGuideline &modelGuideline, const Transformation &transformation, const QPointF &posClickScreen)
Constructor with individual coordinates.
virtual ~CentipedeSegmentConstantTRadial()
virtual double distanceToClosestEndpoint(const QPointF &posScreen) const
Return distance to closest endpoint.
virtual void updateRadius(double radius)
Update geometry to reflect cursor movement.
Model for DlgSettingsCoords and CmdSettingsCoords.
CoordScale coordScaleYRadius() const
Get method for linear/log scale on y/radius.
double originRadius() const
Get method for origin radius in polar mode.
Model for managing the coordinate values corresponding Guidelines.
Enable postponed geometry changes for QGraphicsLineItem, using a signal to trigger this class to upda...
Add point and line handling to generic QGraphicsScene.
double magnitude(const QPointF &vec)
Norm of vector.