50 #include <QSharedPointer>
51 #include <QStaticStringData>
52 #include <QStringData>
53 #include <QStringDataPtr>
57 #include "../../../dialogs/tools/dialogtool.h"
58 #include "../../../dialogs/tools/dialogarcwithlength.h"
59 #include "../../../visualization/visualization.h"
60 #include "../../../visualization/path/vistoolarcwithlength.h"
61 #include "../ifc/exception/vexception.h"
62 #include "../ifc/xml/vdomdocument.h"
63 #include "../ifc/ifcdef.h"
64 #include "../vgeometry/varc.h"
65 #include "../vgeometry/vgobject.h"
66 #include "../vgeometry/vpointf.h"
67 #include "../vmisc/vabstractapplication.h"
68 #include "../vmisc/vcommonsettings.h"
69 #include "../vpatterndb/vcontainer.h"
70 #include "../vpatterndb/vformula.h"
71 #include "../vpatterndb/vtranslatevars.h"
72 #include "../vwidgets/vmaingraphicsscene.h"
73 #include "../../vabstracttool.h"
74 #include "../vdrawtool.h"
81 QGraphicsItem *parent)
86 this->setFlag(QGraphicsItem::ItemIsFocusable,
true);
98 dialogTool->setArc(*arc);
99 dialogTool->SetCenter(arc->GetCenter().id());
100 dialogTool->SetF1(arc->GetFormulaF1());
101 dialogTool->SetLength(arc->GetFormulaLength());
102 dialogTool->SetRadius(arc->GetFormulaRadius());
103 dialogTool->setLineColor(arc->getLineColor());
104 dialogTool->setLineWeight(arc->getLineWeight());
105 dialogTool->setPenStyle(arc->GetPenStyle());
115 const quint32 center = dialogTool->GetCenter();
116 QString radius = dialogTool->GetRadius();
117 QString f1 = dialogTool->GetF1();
118 QString length = dialogTool->GetLength();
119 const QString color = dialogTool->getLineColor();
120 const QString penStyle = dialogTool->getPenStyle();
121 const QString lineWeight = dialogTool->getLineWeight();
123 VToolArcWithLength* point =
Create(0, center, radius, f1, length, color, penStyle, lineWeight, scene,
doc,
data,
125 if (point !=
nullptr)
134 QString &length,
const QString &color,
const QString &penStyle,
138 qreal calcRadius = 0, calcF1 = 0, calcLength = 0;
145 VArc *arc =
new VArc(calcLength, length, c, calcRadius, radius, calcF1, f1);
146 arc->setLineColor(color);
147 arc->SetPenStyle(penStyle);
148 arc->setLineWeight(lineWeight);
169 scene->addItem(toolArc);
196 return arc->GetCenter().id();
208 arc->SetCenter(*point.data());
220 radius.setCheckZero(
true);
221 radius.setToolId(
m_id);
229 if (value.
error() ==
false)
248 f1.setCheckZero(
false);
257 if (value.
error() ==
false)
277 radius.setCheckZero(
true);
278 radius.setToolId(
m_id);
286 if (value.
error() ==
false)
298 ShowToolVisualization<VisToolArcWithLength>(show);
308 ContextMenu<DialogArcWithLength>(event);
357 if (not
vis.isNull())
364 visual->setObject1Id(arc->GetCenter().id());
365 visual->setRadius(trVars->
FormulaToUser(arc->GetFormulaRadius(),
qApp->Settings()->GetOsSeparator()));
366 visual->setF1(trVars->
FormulaToUser(arc->GetFormulaF1(),
qApp->Settings()->GetOsSeparator()));
367 visual->setLength(trVars->
FormulaToUser(arc->GetFormulaLength(),
qApp->Settings()->GetOsSeparator()));
369 visual->setLineWeight(arc->getLineWeight());
370 visual->RefreshGeometry();
379 const QString toolTip = QString(
"<table>"
381 "<td align ='right'><b>%12: </b></td>"
382 "<td align ='left'>%13</td>"
385 "<td align ='right'><b>%10: </b></td>"
386 "<td align ='left'>%11</td>"
389 "<td align ='right'><b>%1: </b></td>"
390 "<td align ='left'>%2 %3</td>"
393 "<td align ='right'><b>%4: </b></td>"
394 "<td align ='left'>%5 %3</td>"
397 "<td align ='right'><b>%6: </b></td>"
398 "<td align ='left'>%7</td>"
401 "<td align ='right'><b>%8: </b></td>"
402 "<td align ='left'>%9</td>"
406 .arg(
qApp->fromPixel(arc->GetLength()))
409 .arg(
qApp->fromPixel(arc->GetRadius()))
410 .arg(tr(
"Start angle"))
411 .arg(arc->GetStartAngle())
412 .arg(tr(
" End angle"))
413 .arg(arc->GetEndAngle())
417 .arg(tr(
"Arc - Radius and Length"));
virtual void UpdateToolData(const quint32 &id, VContainer *data)=0
static const QString TagArc
virtual void IncrementReferens(quint32 id) const =0
static void AddTool(quint32 id, VDataTool *tool)
AddTool add tool to list tools.
virtual void DecrementReferens(quint32 id) const =0
virtual void SaveOptions(QDomElement &tag, QSharedPointer< VGObject > &obj) Q_DECL_OVERRIDE
static void InitArcToolConnections(VMainGraphicsScene *scene, T *tool)
VArc class for anticlockwise arc.
The VContainer class container of all variables.
void AddArc(const QSharedPointer< VAbstractCurve > &arc, const quint32 &id, const quint32 &parentId=null_id)
const QSharedPointer< VGObject > GetGObject(quint32 id) const
GetGObject returns a point by id.
const QSharedPointer< T > GeometricObject(const quint32 &id) const
quint32 AddGObject(VGObject *obj)
AddGObject add new GObject to container.
void UpdateGObject(quint32 id, T *obj)
UpdateGObject update GObject by id.
void SetAttribute(QDomElement &domElement, const QString &name, const T &value) const
SetAttribute set attribute in pattern file. Replace "," by ".".
quint32 getIdTool() const
The VMainGraphicsScene class main scene.
The VPointF class keep data of point.
QString FormulaToUser(const QString &formula, bool osSeparator) const
FormulaToUser replace all known tokens in formula to user look. Also change decimal separator in numb...
const QString degreeSymbol
QString UnitsToStr(const Unit &unit, const bool translate)
UnitsToStr translate unit to string.
static Q_REQUIRED_RESULT bool VFuzzyComparePossibleNulls(double p1, double p2)
const QString AttrLineWeight
const QString AttrPenStyle
Qt::PenStyle lineTypeToPenStyle(const QString &lineType)
LineStyle return pen style for current line style.