50 #include <QSharedPointer>
51 #include <QStaticStringData>
52 #include <QStringData>
53 #include <QStringDataPtr>
57 #include "../../../dialogs/tools/dialogtool.h"
58 #include "../../../dialogs/tools/dialogarc.h"
59 #include "../../../visualization/path/vistoolarc.h"
60 #include "../../../visualization/visualization.h"
61 #include "../ifc/exception/vexception.h"
62 #include "../ifc/xml/vdomdocument.h"
63 #include "../ifc/ifcdef.h"
64 #include "../vgeometry/vgobject.h"
65 #include "../vgeometry/vpointf.h"
66 #include "../vmisc/vabstractapplication.h"
67 #include "../vmisc/vcommonsettings.h"
68 #include "../vpatterndb/vcontainer.h"
69 #include "../vpatterndb/vformula.h"
70 #include "../vpatterndb/vtranslatevars.h"
71 #include "../vwidgets/vmaingraphicsscene.h"
72 #include "../../vabstracttool.h"
73 #include "../vdrawtool.h"
88 QGraphicsItem *parent)
93 this->setFlag(QGraphicsItem::ItemIsFocusable,
true);
108 dialogTool->setArc(*arc);
109 dialogTool->setCenter(arc->GetCenter().id());
110 dialogTool->setF1(arc->GetFormulaF1());
111 dialogTool->setF2(arc->GetFormulaF2());
112 dialogTool->setRadius(arc->GetFormulaRadius());
113 dialogTool->setLineColor(arc->getLineColor());
114 dialogTool->setLineWeight(arc->getLineWeight());
115 dialogTool->setPenStyle(arc->GetPenStyle());
132 const quint32 center = dialogTool->getCenter();
133 QString radius = dialogTool->getRadius();
134 QString f1 = dialogTool->getF1();
135 QString f2 = dialogTool->getF2();
136 const QString color = dialogTool->getLineColor();
137 const QString penStyle = dialogTool->getPenStyle();
138 const QString lineWeight = dialogTool->getLineWeight();
139 VToolArc* point =
Create(0, center, radius, f1, f2, color, penStyle, lineWeight, scene,
doc,
data,
141 if (point !=
nullptr)
163 const QString &color,
const QString &penStyle,
const QString &lineWeight,
167 qreal calcRadius = 0, calcF1 = 0, calcF2 = 0;
175 VArc *arc =
new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 );
176 arc->setLineColor(color);
177 arc->SetPenStyle(penStyle);
178 arc->setLineWeight(lineWeight);
199 scene->addItem(toolArc);
226 return arc->GetCenter().id();
238 arc->SetCenter(*point.data());
250 radius.setCheckZero(
true);
251 radius.setToolId(
m_id);
259 if (value.
error() ==
false)
278 f1.setCheckZero(
false);
287 if (value.
error() ==
false)
307 f2.setCheckZero(
false);
316 if (value.
error() ==
false)
347 ShowToolVisualization<VisToolArc>(show);
362 ContextMenu<DialogArc>(event);
418 if (not
vis.isNull())
425 visual->setObject1Id(arc->GetCenter().id());
426 visual->setRadius(trVars->
FormulaToUser(arc->GetFormulaRadius(),
qApp->Settings()->GetOsSeparator()));
427 visual->setF1(trVars->
FormulaToUser(arc->GetFormulaF1(),
qApp->Settings()->GetOsSeparator()));
428 visual->setF2(trVars->
FormulaToUser(arc->GetFormulaF2(),
qApp->Settings()->GetOsSeparator()));
430 visual->setLineWeight(arc->getLineWeight());
431 visual->RefreshGeometry();
440 const QString toolTip = QString(
"<table>"
441 "<tr> <td><b>%10:</b> %11</td> </tr>"
442 "<tr> <td><b>%1:</b> %2 %3</td> </tr>"
443 "<tr> <td><b>%4:</b> %5 %3</td> </tr>"
444 "<tr> <td><b>%6:</b> %7°</td> </tr>"
445 "<tr> <td><b>%8:</b> %9°</td> </tr>"
448 .arg(
qApp->fromPixel(arc->GetLength()))
451 .arg(
qApp->fromPixel(arc->GetRadius()))
452 .arg(tr(
"Start angle"))
453 .arg(arc->GetStartAngle())
454 .arg(tr(
" End angle"))
455 .arg(arc->GetEndAngle())
The DialogArc class dialog for ToolArc. Help create arc and edit option.
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.