55 #include <QSharedPointer>
56 #include <QStaticStringData>
57 #include <QStringData>
58 #include <QStringDataPtr>
62 #include "../../../../../dialogs/tools/dialogcutsplinepath.h"
63 #include "../../../../../dialogs/tools/dialogtool.h"
64 #include "../../../../../visualization/visualization.h"
65 #include "../../../../../visualization/path/vistoolcutsplinepath.h"
66 #include "../ifc/exception/vexception.h"
67 #include "../ifc/ifcdef.h"
68 #include "../vgeometry/vabstractcubicbezierpath.h"
69 #include "../vgeometry/vabstractcurve.h"
70 #include "../vgeometry/vpointf.h"
71 #include "../vgeometry/vspline.h"
72 #include "../vgeometry/vsplinepath.h"
73 #include "../vgeometry/vsplinepoint.h"
74 #include "../vmisc/vabstractapplication.h"
75 #include "../vmisc/vcommonsettings.h"
76 #include "../vpatterndb/vcontainer.h"
77 #include "../vpatterndb/vtranslatevars.h"
78 #include "../vwidgets/vmaingraphicsscene.h"
79 #include "../../../../vabstracttool.h"
80 #include "../../../vdrawtool.h"
100 const QString &formula,
const quint32 &splinePathId,
101 const Source &typeCreation, QGraphicsItem *parent)
102 :
VToolCut(doc, data, id, formula, splinePathId, parent)
117 dialogTool->SetFormula(
formula);
119 dialogTool->SetPointName(point->name());
136 const QString pointName = dialogTool->getPointName();
137 QString
formula = dialogTool->GetFormula();
138 const quint32 splinePathId = dialogTool->getSplinePathId();
139 VToolCutSplinePath* point =
Create(0, pointName,
formula, splinePathId, 5, 10,
true, scene,
doc,
data,
141 if (point !=
nullptr)
164 quint32 splinePathId, qreal mx, qreal my,
bool showPointName,
211 scene->addItem(point);
223 ShowToolVisualization<VisToolCutSplinePath>(show);
232 QPointF spl1p2, spl1p3, spl2p2, spl2p3;
233 qint32 p1 = 0, p2 = 0;
235 const QPointF point =
splPath->CutSplinePath(length, p1, p2, spl1p2, spl1p3, spl2p2, spl2p3);
249 for (qint32 i = 0; i < points.size(); i++)
251 if (i <= p1 && i < p2)
256 const QString angle1F = QString().number(angle1);
263 const QString angle2F = QString().number(angle2);
268 (*splPath1)->append(cutPoint);
271 (*splPath1)->append(points.at(i));
278 const QString angle1F = QString().number(angle1);
285 (*splPath2)->append(cutPoint);
288 const QString angle2F = QString().number(angle2);
295 (*splPath2)->append(points.at(i));
311 ContextMenu<DialogCutSplinePath>(event,
id);
354 if (not
vis.isNull())
374 const QString expression =
qApp->TrVars()->FormulaToUser(
formula,
qApp->Settings()->GetOsSeparator());
382 const QString curveStr = tr(
"Curve");
383 const QString lengthStr = tr(
"length");
385 const QString toolTip = QString(
"<table>"
386 "<tr> <td><b>%6:</b> %7</td> </tr>"
387 "<tr> <td><b>%1:</b> %2 %3</td> </tr>"
388 "<tr> <td><b>%8:</b> %9</td> </tr>"
389 "<tr> <td><b>%4:</b> %5 %3</td> </tr>"
391 .arg(curveStr + QLatin1String(
"1 ") + lengthStr)
394 .arg(curveStr + QLatin1String(
"2 ") + lengthStr)
396 .arg(curveStr + QLatin1String(
" 1") + tr(
"label"))
397 .arg(splPath1->
name())
398 .arg(curveStr + QLatin1String(
" 2") + tr(
"label"))
399 .arg(splPath2->
name());
The DialogCutSplinePath class dialog for ToolCutSplinePath.
virtual qreal GetLength() const Q_DECL_OVERRIDE
GetLength return length of spline path.
virtual void UpdateToolData(const quint32 &id, VContainer *data)=0
virtual void IncrementReferens(quint32 id) const =0
static void AddTool(quint32 id, VDataTool *tool)
AddTool add tool to list tools.
static void InitToolConnections(VMainGraphicsScene *scene, T *tool)
The VContainer class container of all variables.
const QSharedPointer< T > GeometricObject(const quint32 &id) const
void AddSpline(const QSharedPointer< VAbstractBezier > &curve, quint32 id, quint32 parentId=null_id)
quint32 AddGObject(VGObject *obj)
AddGObject add new GObject to container.
void UpdateGObject(quint32 id, T *obj)
UpdateGObject update GObject by id.
static QString GetParametrString(const QDomElement &domElement, const QString &name, const QString &defValue=QString())
Returns the string value of the given attribute. RENAME: see above.
static quint32 GetParametrUInt(const QDomElement &domElement, const QString &name, const QString &defValue)
Returns the long long value of the given attribute. RENAME: GetParameterLongLong?
void SetAttribute(QDomElement &domElement, const QString &name, const T &value) const
SetAttribute set attribute in pattern file. Replace "," by ".".
virtual QString name() const
name return name graphical object.
void setName(const QString &name)
setName set name graphical object.
The VMainGraphicsScene class main scene.
The VPointF class keep data of point.
void setMx(qreal mx)
setMx set offset name respect to x
void setMy(qreal my)
setMy set offset name respect to y
void setShowPointName(bool show)
The VSplinePath class keep information about splinePath.
The VSplinePoint class keep information about point in spline path. Each point have two angles and tw...
QString Length1Formula() const
QString Length2Formula() const
VSpline class that implements the spline.
virtual qreal GetC2Length() const Q_DECL_OVERRIDE
QString GetC1LengthFormula() const
virtual qreal GetStartAngle() const Q_DECL_OVERRIDE
GetAngle1 return first angle control line.
QString GetStartAngleFormula() const
QString GetEndAngleFormula() const
virtual qreal GetC1Length() const Q_DECL_OVERRIDE
QString GetC2LengthFormula() const
virtual qreal GetEndAngle() const Q_DECL_OVERRIDE
GetAngle2 return second angle control line.
void setObject1Id(const quint32 &value)
void setLineStyle(const Qt::PenStyle &value)
static qreal FindVal(const QString &expression, const QHash< QString, QSharedPointer< VInternalVariable > > *vars)
QString UnitsToStr(const Unit &unit, const bool translate)
UnitsToStr translate unit to string.
Qt::PenStyle lineTypeToPenStyle(const QString &lineType)
LineStyle return pen style for current line style.