55 #include <QGraphicsLineItem>
56 #include <QGraphicsPathItem>
57 #include <QGuiApplication>
59 #include <QPainterPath>
60 #include <QSharedPointer>
62 #include <QtAlgorithms>
65 #include "../vmisc/diagnostic.h"
66 #include "../vgeometry/vabstractcurve.h"
67 #include "../vgeometry/varc.h"
68 #include "../vgeometry/vcubicbezier.h"
69 #include "../vgeometry/vcubicbezierpath.h"
70 #include "../vgeometry/vellipticalarc.h"
71 #include "../vgeometry/vgeometrydef.h"
72 #include "../vgeometry/vgobject.h"
73 #include "../vgeometry/vpointf.h"
74 #include "../vgeometry/vspline.h"
75 #include "../vgeometry/vsplinepath.h"
76 #include "../vmisc/vabstractapplication.h"
77 #include "../vpatterndb/vcontainer.h"
78 #include "../vwidgets/vmaingraphicsscene.h"
101 QT_WARNING_DISABLE_GCC(
"-Wswitch-default")
105 if (objects.isEmpty())
117 DrawPoint(point,
static_cast<QPointF
>(*origin), supportColor2);
124 if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
126 rLine.setAngle(CorrectAngle(rLine.angle()));
129 rLine.setP2(Ray(
static_cast<QPointF
>(*origin), rLine.angle()));
130 tempAngle = rLine.angle();
134 rLine = QLineF(
static_cast<QPointF
>(*origin), Ray(
static_cast<QPointF
>(*origin), angle));
138 DrawLine(
this, rLine, supportColor2, lineWeight, Qt::DashLine);
139 DrawLine(xAxis, QLineF(
static_cast<QPointF
>(*origin), Ray(
static_cast<QPointF
>(*origin), 0)), supportColor2,
140 lineWeight, Qt::DashLine);
143 DrawPath(angleArc, arc.
GetPath(), supportColor2, Qt::SolidLine, lineWeight, Qt::RoundCap);
146 "<b>Mouse click</b> - finish creation").arg(tempAngle);
151 for (
int i = 0; i < objects.size(); ++i)
153 const quint32
id = objects.at(i);
157 Q_STATIC_ASSERT_X(
static_cast<int>(
GOType::Unknown) == 7,
"Not all objects was handled.");
159 switch(
static_cast<GOType>(obj->getType()))
166 VScaledEllipse *point = GetPoint(
static_cast<quint32
>(iPoint), supportColor2);
167 DrawPoint(point,
static_cast<QPointF
>(*p), supportColor2);
170 point = GetPoint(
static_cast<quint32
>(iPoint), supportColor);
174 DrawPoint(point,
static_cast<QPointF
>(p->Rotate(
static_cast<QPointF
>(*origin), tempAngle)),
181 iCurve = AddCurve<VArc>(tempAngle,
static_cast<QPointF
>(*origin),
id, iCurve);
186 iCurve = AddCurve<VEllipticalArc>(tempAngle,
static_cast<QPointF
>(*origin),
id, iCurve);
191 iCurve = AddCurve<VSpline>(tempAngle,
static_cast<QPointF
>(*origin),
id, iCurve);
196 iCurve = AddCurve<VSplinePath>(tempAngle,
static_cast<QPointF
>(*origin),
id, iCurve);
201 iCurve = AddCurve<VCubicBezier>(tempAngle,
static_cast<QPointF
>(*origin),
id, iCurve);
206 iCurve = AddCurve<VCubicBezierPath>(tempAngle,
static_cast<QPointF
>(*origin),
id, iCurve);
229 return QString::number(line().
angle());
239 template <
class Item>
253 const Item rotated = curve->Rotate(origin,
angle);
virtual QPainterPath GetPath() const
VArc class for anticlockwise arc.
The VContainer class container of all variables.
const QSharedPointer< VGObject > GetGObject(quint32 id) const
GetGObject returns a point by id.
const QSharedPointer< T > GeometricObject(const quint32 &id) const
The VPointF class keep data of point.
VCurvePathItem * GetCurve(quint32 i, const QColor &color)
void DrawPath(VCurvePathItem *pathItem, const QPainterPath &path, const QColor &color, Qt::PenStyle style=Qt::SolidLine, const qreal &weight=0.35, Qt::PenCapStyle cap=Qt::SquareCap)
VScaledEllipse * InitPoint(const QColor &color, QGraphicsItem *parent, qreal z=0) const
static qreal FindVal(const QString &expression, const QHash< QString, QSharedPointer< VInternalVariable > > *vars)
static Q_REQUIRED_RESULT bool VFuzzyComparePossibleNulls(double p1, double p2)
const qreal defPointRadiusPixel