34 #include <QGraphicsScene>
35 #include <QGuiApplication>
39 #include "../ifc/ifcdef.h"
40 #include "../vgeometry/vgobject.h"
41 #include "../vmisc/vabstractapplication.h"
42 #include "../vmisc/vmath.h"
43 #include "../vpatterndb/vcontainer.h"
59 ang = angle - 360.0 * qFloor(angle/360);
62 switch (qFloor((qAbs(ang)+22.5)/45))
85 QPointF
VisLine::Ray(
const QPointF &firstPoint,
const qreal &angle)
const
87 if (this->scene() ==
nullptr)
94 QRectF scRect = this->scene()->sceneRect();
97 QLineF line1 = QLineF(scRect.topLeft(), scRect.bottomRight());
100 QLineF line2 = QLineF(scRect.bottomRight(), scRect.topLeft());
103 scRect = QRectF(line1.p2(), line2.p2());
105 if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
119 return Ray(firstPoint, line.angle());
125 QPointF endP1 =
Ray(p, angle+180);
126 QPointF endP2 =
Ray(p, angle);
127 return QLineF(endP1, endP2);
134 return Axis(p1, line.angle());
160 const qreal angle = QLineF(p, pTangent).angle();
161 const QPointF endRay =
Ray(p, angle);
163 DrawLine(lineItem, tangent, color, 0.35, style);
The VContainer class container of all variables.
static QPointF BuildRay(const QPointF &firstPoint, const qreal &angle, const QRectF &scRect)
static QLineF BuildLine(const QPointF &p1, const qreal &length, const qreal &angle)
VisLine(const VContainer *data, QGraphicsItem *parent=nullptr)
virtual void initPen() Q_DECL_OVERRIDE
static qreal CorrectAngle(const qreal &angle)
void DrawRay(VScaledLine *lineItem, const QPointF &p, const QPointF &pTangent, const QColor &color, Qt::PenStyle style)
virtual void AddOnScene() Q_DECL_OVERRIDE
QLineF Axis(const QPointF &p, const qreal &angle) const
QPointF Ray(const QPointF &firstPoint, const qreal &angle) const
virtual void DrawLine(VScaledLine *lineItem, const QLineF &line, const QColor &color, const qreal &lineWeight, Qt::PenStyle style=Qt::SolidLine)