21void GuidelineProjectorConstantX::addSide (
const Transformation &transformation,
25 QList<QPointF> &intersections)
35 double num = x - p1.x();
36 double den = p2.x () - p1.x ();
40 bool okForDenPositive = (den >= 0) && (0.0 * den <= num) && (num < den);
41 bool okForDenNegative = (den < 0) && (0.0 * den >= num) && (num > 1.0 * den);
43 if (okForDenPositive || okForDenNegative) {
44 double sIntercept = num / den;
45 QPointF pIntercept ((1.0 - sIntercept) * p1 + sIntercept * p2);
50 intersections.push_back (posScreen);
55 const QRectF &sceneRect,
58 QLineF line (0, 0, 0, 0);
59 QPointF posGraphBL, posGraphTL, posGraphTR, posGraphBR;
68 QList<QPointF> intersections;
70 addSide (transformation, xGraph, posGraphBL, posGraphTL, intersections);
71 addSide (transformation, xGraph, posGraphTL, posGraphTR, intersections);
72 addSide (transformation, xGraph, posGraphTR, posGraphBR, intersections);
73 addSide (transformation, xGraph, posGraphBR, posGraphBL, intersections);
75 if (intersections.size() == 2) {
76 line = QLineF (intersections.at (0),
77 intersections.at (1));
84 const QRectF &sceneRect,
85 const QPointF &posScreen)
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.
QLineF fromCoordinateX(const Transformation &transformation, const QRectF &sceneRect, double xGraph)
Return line through x in graph coordinates.
QLineF fromPosScreen(const Transformation &transformation, const QRectF &sceneRect, const QPointF &posScreen)
Return line through point in screen coordinates.
GuidelineProjectorConstantX()
Single constructor.
~GuidelineProjectorConstantX()