49 #include <QSharedPointer>
50 #include <QStaticStringData>
51 #include <QStringData>
52 #include <QStringDataPtr>
56 #include "../../../dialogs/tools/dialogtool.h"
57 #include "../../../dialogs/tools/dialogellipticalarc.h"
58 #include "../../../visualization/path/vistoolellipticalarc.h"
59 #include "../../../visualization/visualization.h"
60 #include "../ifc/exception/vexception.h"
61 #include "../ifc/xml/vdomdocument.h"
62 #include "../ifc/ifcdef.h"
63 #include "../vgeometry/vellipticalarc.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(*elArc);
109 dialogTool->SetCenter(elArc->GetCenter().id());
110 dialogTool->SetF1(elArc->GetFormulaF1());
111 dialogTool->SetF2(elArc->GetFormulaF2());
112 dialogTool->SetRadius1(elArc->GetFormulaRadius1());
113 dialogTool->SetRadius2(elArc->GetFormulaRadius2());
114 dialogTool->SetRotationAngle(elArc->GetFormulaRotationAngle());
115 dialogTool->setLineColor(elArc->getLineColor());
116 dialogTool->setLineWeight(elArc->getLineWeight());
117 dialogTool->setPenStyle(elArc->GetPenStyle());
135 const quint32 center = dialogTool->GetCenter();
136 QString radius1 = dialogTool->GetRadius1();
137 QString radius2 = dialogTool->GetRadius2();
138 QString f1 = dialogTool->GetF1();
139 QString f2 = dialogTool->GetF2();
140 QString rotationAngle = dialogTool->GetRotationAngle();
141 const QString color = dialogTool->getLineColor();
142 const QString penStyle = dialogTool->getPenStyle();
143 const QString lineWeight = dialogTool->getLineWeight();
144 VToolEllipticalArc* point =
Create(0, center, radius1, radius2, f1, f2, rotationAngle, color, penStyle, lineWeight,
146 if (point !=
nullptr)
171 QString &radius2, QString &f1, QString &f2, QString &rotationAngle,
172 const QString &color,
const QString &penStyle,
const QString &lineWeight,
176 qreal calcRadius1 = 0, calcRadius2 = 0, calcF1 = 0, calcF2 = 0, calcRotationAngle = 0;
187 calcRotationAngle, rotationAngle);
188 elArc->setLineColor(color);
189 elArc->SetPenStyle(penStyle);
190 elArc->setLineWeight(lineWeight);
211 scene->addItem(toolEllipticalArc);
215 return toolEllipticalArc;
238 return elArc->GetCenter().id();
250 elArc->SetCenter(*point.data());
262 radius1.setCheckZero(
true);
263 radius1.setToolId(
m_id);
271 if (value.
error() ==
false)
290 radius2.setCheckZero(
true);
291 radius2.setToolId(
m_id);
299 if (value.
error() ==
false)
318 f1.setCheckZero(
false);
327 if (value.
error() ==
false)
347 f2.setCheckZero(
false);
356 if (value.
error() ==
false)
375 rotationAngle.setCheckZero(
false);
376 rotationAngle.setToolId(
m_id);
378 return rotationAngle;
384 if (value.
error() ==
false)
396 ShowToolVisualization<VisToolEllipticalArc>(show);
410 ContextMenu<DialogEllipticalArc>(event);
469 if (not
vis.isNull())
476 visual->setObject1Id(elArc->GetCenter().id());
477 visual->setRadius1(trVars->
FormulaToUser(elArc->GetFormulaRadius1(),
qApp->Settings()->GetOsSeparator()));
478 visual->setRadius2(trVars->
FormulaToUser(elArc->GetFormulaRadius2(),
qApp->Settings()->GetOsSeparator()));
479 visual->setF1(trVars->
FormulaToUser(elArc->GetFormulaF1(),
qApp->Settings()->GetOsSeparator()));
480 visual->setF2(trVars->
FormulaToUser(elArc->GetFormulaF2(),
qApp->Settings()->GetOsSeparator()));
481 visual->setRotationAngle(trVars->
FormulaToUser(elArc->GetFormulaRotationAngle(),
482 qApp->Settings()->GetOsSeparator()));
484 visual->setLineWeight(elArc->getLineWeight());
485 visual->RefreshGeometry();
494 const QString toolTip = QString(
"<table>"
495 "<tr> <td><b>%12:</b> %13</td> </tr>"
496 "<tr> <td><b>%1:</b> %2 %3</td> </tr>"
497 "<tr> <td><b>%4:</b> %5 %3</td> </tr>"
498 "<tr> <td><b>%6:</b> %7 %3</td> </tr>"
499 "<tr> <td><b>%8:</b> %9°</td> </tr>"
500 "<tr> <td><b>%10:</b> %11°</td> </tr>"
503 .arg(
qApp->fromPixel(elArc->GetLength()))
505 .arg(tr(
" Radius") + QLatin1String(
"1"))
506 .arg(
qApp->fromPixel(elArc->GetRadius1()))
507 .arg(tr(
" Radius") + QLatin1String(
"2"))
508 .arg(
qApp->fromPixel(elArc->GetRadius2()))
509 .arg(tr(
"Start angle"))
510 .arg(
qApp->fromPixel(elArc->GetStartAngle()))
511 .arg(tr(
" End angle"))
512 .arg(
qApp->fromPixel(elArc->GetEndAngle()))
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 const QString TagElArc
virtual void DecrementReferens(quint32 id) const =0
virtual void SaveOptions(QDomElement &tag, QSharedPointer< VGObject > &obj) Q_DECL_OVERRIDE
static void InitElArcToolConnections(VMainGraphicsScene *scene, T *tool)
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
const QString AttrRadius2
const QString AttrRotationAngle
const QString AttrRadius1
Qt::PenStyle lineTypeToPenStyle(const QString &lineType)
LineStyle return pen style for current line style.