55 #include <QSharedPointer>
56 #include <QStaticStringData>
57 #include <QStringData>
58 #include <QStringDataPtr>
61 #include "../../../../../dialogs/tools/dialogcutspline.h"
62 #include "../../../../../dialogs/tools/dialogtool.h"
63 #include "../../../../../visualization/visualization.h"
64 #include "../../../../../visualization/path/vistoolcutspline.h"
65 #include "../ifc/exception/vexception.h"
66 #include "../ifc/ifcdef.h"
67 #include "../vgeometry/vabstractcubicbezier.h"
68 #include "../vgeometry/vabstractcurve.h"
69 #include "../vgeometry/vpointf.h"
70 #include "../vgeometry/vspline.h"
71 #include "../vmisc/vabstractapplication.h"
72 #include "../vmisc/vcommonsettings.h"
73 #include "../vpatterndb/vcontainer.h"
74 #include "../vpatterndb/vtranslatevars.h"
75 #include "../vwidgets/vmaingraphicsscene.h"
76 #include "../../../../vabstracttool.h"
77 #include "../../../vdrawtool.h"
97 const quint32 &splineId,
const Source &typeCreation, QGraphicsItem *parent)
98 :
VToolCut(doc, data, id, formula, splineId, parent)
113 dialogTool->SetFormula(
formula);
115 dialogTool->SetPointName(point->name());
132 const QString pointName = dialogTool->getPointName();
133 QString
formula = dialogTool->GetFormula();
134 const quint32 splineId = dialogTool->getSplineId();
135 VToolCutSpline* point =
Create(0, pointName,
formula, splineId, 5, 10,
true, scene,
doc,
data,
Document::FullParse,
137 if (point !=
nullptr)
160 const quint32 &splineId, qreal mx, qreal my,
bool showPointName,
168 QPointF spl1p2, spl1p3, spl2p2, spl2p3;
169 QPointF point = spl->CutSpline(
qApp->toPixel(result), spl1p2, spl1p3, spl2p2, spl2p3);
200 scene->addItem(point);
212 ShowToolVisualization<VisToolCutSpline>(show);
224 ContextMenu<DialogCutSpline>(event,
id);
267 if (not
vis.isNull())
287 const QString expression =
qApp->TrVars()->FormulaToUser(
formula,
qApp->Settings()->GetOsSeparator());
290 QPointF spl1p2, spl1p3, spl2p2, spl2p3;
291 QPointF point = spl->CutSpline(
qApp->toPixel(length), spl1p2, spl1p3, spl2p2, spl2p3);
296 const QString curveStr = tr(
"Curve");
297 const QString lengthStr = tr(
"length");
299 const QString toolTip = QString(
"<table>"
300 "<tr> <td><b>%6:</b> %7</td> </tr>"
301 "<tr> <td><b>%1:</b> %2 %3</td> </tr>"
302 "<tr> <td><b>%8:</b> %9</td> </tr>"
303 "<tr> <td><b>%4:</b> %5 %3</td> </tr>"
305 .arg(curveStr + QLatin1String(
"1 ") + lengthStr)
308 .arg(curveStr + QLatin1String(
"2 ") + lengthStr)
310 .arg(curveStr + QLatin1String(
" 1") + tr(
"label"))
312 .arg(curveStr + QLatin1String(
" 2") + tr(
"label"))
313 .arg(spline2.
name());
The DialogCutSpline class dialog for ToolCutSpline.
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.
The VMainGraphicsScene class main scene.
The VPointF class keep data of point.
void setShowPointName(bool show)
VSpline class that implements the spline.
virtual qreal GetLength() const Q_DECL_OVERRIDE
GetLength return length of spline.
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.