Seamly2D
Code documentation
vtoolrotation.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * *
3  * Copyright (C) 2017 Seamly, LLC *
4  * *
5  * https://github.com/fashionfreedom/seamly2d *
6  * *
7  ***************************************************************************
8  **
9  ** Seamly2D is free software: you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation, either version 3 of the License, or
12  ** (at your option) any later version.
13  **
14  ** Seamly2D is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** You should have received a copy of the GNU General Public License
20  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
21  **
22  **************************************************************************
23 
24  ************************************************************************
25  **
26  ** @file vtoolrotation.cpp
27  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
28  ** @date 12 4, 2016
29  **
30  ** @brief
31  ** @copyright
32  ** This source code is part of the Valentine project, a pattern making
33  ** program, whose allow create and modeling patterns of clothing.
34  ** Copyright (C) 2016 Seamly2D project
35  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
36  **
37  ** Seamly2D is free software: you can redistribute it and/or modify
38  ** it under the terms of the GNU General Public License as published by
39  ** the Free Software Foundation, either version 3 of the License, or
40  ** (at your option) any later version.
41  **
42  ** Seamly2D is distributed in the hope that it will be useful,
43  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
44  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45  ** GNU General Public License for more details.
46  **
47  ** You should have received a copy of the GNU General Public License
48  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
49  **
50  *************************************************************************/
51 
52 #include "vtoolrotation.h"
53 
54 #include <limits.h>
55 #include <qiterator.h>
56 #include <QColor>
57 #include <QDomNode>
58 #include <QDomNodeList>
59 #include <QMapIterator>
60 #include <QPoint>
61 #include <QSharedPointer>
62 #include <QStaticStringData>
63 #include <QStringData>
64 #include <QStringDataPtr>
65 #include <QUndoStack>
66 #include <new>
67 
68 #include "../../../dialogs/tools/dialogtool.h"
69 #include "../../../dialogs/tools/dialogrotation.h"
70 #include "../../../visualization/line/operation/vistoolrotation.h"
71 #include "../../../visualization/visualization.h"
72 #include "../vgeometry/vabstractcurve.h"
73 #include "../vgeometry/varc.h"
74 #include "../vgeometry/vellipticalarc.h"
75 #include "../vgeometry/vcubicbezier.h"
76 #include "../vgeometry/vcubicbezierpath.h"
77 #include "../vgeometry/vgobject.h"
78 #include "../vgeometry/vpointf.h"
79 #include "../vgeometry/vspline.h"
80 #include "../vgeometry/vsplinepath.h"
81 #include "../vpatterndb/vtranslatevars.h"
82 #include "../vmisc/vabstractapplication.h"
83 #include "../vmisc/vcommonsettings.h"
84 #include "../vmisc/diagnostic.h"
85 #include "../vmisc/logging.h"
86 #include "../vpatterndb/vcontainer.h"
87 #include "../vpatterndb/vformula.h"
88 #include "../ifc/ifcdef.h"
89 #include "../ifc/exception/vexception.h"
90 #include "../vwidgets/vabstractsimple.h"
91 #include "../vwidgets/vmaingraphicsscene.h"
92 #include "../../vabstracttool.h"
93 #include "../../vdatatool.h"
94 #include "../vdrawtool.h"
95 
96 class QDomElement;
97 class QGraphicsSceneContextMenuEvent;
98 class QPainter;
99 class QStyleOptionGraphicsItem;
100 class QWidget;
101 template <class T> class QSharedPointer;
102 
103 const QString VToolRotation::ToolType = QStringLiteral("rotation");
104 
105 //---------------------------------------------------------------------------------------------------------------------
106 VToolRotation::VToolRotation(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 originPointId,
107  const QString &angle, const QString &suffix, const QVector<SourceItem> &source,
108  const QVector<DestinationItem> &destination, const Source &typeCreation,
109  QGraphicsItem *parent)
110  : VAbstractOperation(doc, data, id, suffix, source, destination, parent)
111  , m_originPointId(originPointId)
112  , formulaAngle(angle)
113 {
115  ToolCreation(typeCreation);
116 }
117 
118 //---------------------------------------------------------------------------------------------------------------------
120 {
121  SCASSERT(not m_dialog.isNull())
122  QSharedPointer<DialogRotation> dialogTool = m_dialog.objectCast<DialogRotation>();
123  SCASSERT(not dialogTool.isNull())
124  dialogTool->setOriginPointId(m_originPointId);
125  dialogTool->SetAngle(formulaAngle);
126  dialogTool->setSuffix(suffix);
127 }
128 
129 //---------------------------------------------------------------------------------------------------------------------
131  VAbstractPattern *doc, VContainer *data)
132 {
133  SCASSERT(not dialog.isNull())
134  QSharedPointer<DialogRotation> dialogTool = dialog.objectCast<DialogRotation>();
135  SCASSERT(not dialogTool.isNull())
136  const quint32 originPointId = dialogTool->getOriginPointId();
137  QString angle = dialogTool->GetAngle();
138  const QString suffix = dialogTool->getSuffix();
139  const QVector<SourceItem> source = dialogTool->getSourceObjects();
140 
141  VToolRotation* operation = Create(0, originPointId, angle, suffix, source, QVector<DestinationItem>(),
143  if (operation != nullptr)
144  {
145  operation->m_dialog = dialogTool;
146  }
147  return operation;
148 }
149 
150 //---------------------------------------------------------------------------------------------------------------------
151 VToolRotation *VToolRotation::Create(const quint32 _id, const quint32 &origin, QString &angle, const QString &suffix,
152  const QVector<SourceItem> &source,
153  const QVector<DestinationItem> &destination,
154  VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
155  const Document &parse, const Source &typeCreation)
156 {
157  qreal calcAngle = 0;
158 
159  calcAngle = CheckFormula(_id, angle, data);
160 
161  const auto originPoint = *data->GeometricObject<VPointF>(origin);
162  const QPointF oPoint = static_cast<QPointF>(originPoint);
163 
165 
166  quint32 id = _id;
167  if (typeCreation == Source::FromGui)
168  {
169  dest.clear();// Try to avoid mistake, value must be empty
170 
171  id = VContainer::getNextId();//Just reserve id for tool
172 
173  for (int i = 0; i < source.size(); ++i)
174  {
175  const SourceItem item = source.at(i);
176  const quint32 objectId = item.id;
177  const QSharedPointer<VGObject> obj = data->GetGObject(objectId);
178 
179  // This check helps to find missed objects in the switch
180  Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 7, "Not all objects were handled.");
181 
182 QT_WARNING_PUSH
183 QT_WARNING_DISABLE_GCC("-Wswitch-default")
184  switch(static_cast<GOType>(obj->getType()))
185  {
186  case GOType::Point:
187  dest.append(createPoint(id, objectId, oPoint, calcAngle, suffix, data));
188  break;
189  case GOType::Arc:
190  dest.append(createArc<VArc>(id, objectId, oPoint, calcAngle, suffix, data));
191  break;
193  dest.append(createArc<VEllipticalArc>(id, objectId, oPoint, calcAngle, suffix, data));
194  break;
195  case GOType::Spline:
196  dest.append(createCurve<VSpline>(id, objectId, oPoint, calcAngle, suffix, data));
197  break;
198  case GOType::SplinePath:
199  dest.append(createCurveWithSegments<VSplinePath>(id, objectId, oPoint, calcAngle, suffix, data));
200  break;
201  case GOType::CubicBezier:
202  dest.append(createCurve<VCubicBezier>(id, objectId, oPoint, calcAngle, suffix, data));
203  break;
205  dest.append(createCurveWithSegments<VCubicBezierPath>(id, objectId, oPoint, calcAngle, suffix,
206  data));
207  break;
208  case GOType::Unknown:
209  case GOType::Curve:
210  case GOType::Path:
211  case GOType::AllCurves:
212  default:
213  break;
214  }
216  }
217  }
218  else
219  {
220  for (int i = 0; i < source.size(); ++i)
221  {
222  const SourceItem item = source.at(i);
223  const quint32 objectId = item.id;
224  const QSharedPointer<VGObject> obj = data->GetGObject(objectId);
225 
226  // This check helps to find missed objects in the switch
227  Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 7, "Not all objects were handled.");
228 
229 QT_WARNING_PUSH
230 QT_WARNING_DISABLE_GCC("-Wswitch-default")
231  switch(static_cast<GOType>(obj->getType()))
232  {
233  case GOType::Point:
234  {
235  const DestinationItem &item = dest.at(i);
236  updatePoint(id, objectId, oPoint, calcAngle, suffix, data, item);
237  break;
238  }
239  case GOType::Arc:
240  updateArc<VArc>(id, objectId, oPoint, calcAngle, suffix, data, dest.at(i).id);
241  break;
243  updateArc<VEllipticalArc>(id, objectId, oPoint, calcAngle, suffix, data, dest.at(i).id);
244  break;
245  case GOType::Spline:
246  updateCurve<VSpline>(id, objectId, oPoint, calcAngle, suffix, data, dest.at(i).id);
247  break;
248  case GOType::SplinePath:
249  updateCurveWithSegments<VSplinePath>(id, objectId, oPoint, calcAngle, suffix, data, dest.at(i).id);
250  break;
251  case GOType::CubicBezier:
252  updateCurve<VCubicBezier>(id, objectId, oPoint, calcAngle, suffix, data, dest.at(i).id);
253  break;
255  updateCurveWithSegments<VCubicBezierPath>(id, objectId, oPoint, calcAngle, suffix, data,
256  dest.at(i).id);
257  break;
258  case GOType::Unknown:
259  case GOType::Curve:
260  case GOType::Path:
261  case GOType::AllCurves:
262  break;
263  }
265  }
266  if (parse != Document::FullParse)
267  {
268  doc->UpdateToolData(id, data);
269  }
270  }
271 
272  if (parse == Document::FullParse)
273  {
275  VToolRotation *tool = new VToolRotation(doc, data, id, origin, angle, suffix, source, dest, typeCreation);
276  scene->addItem(tool);
277  initOperationToolConnections(scene, tool);
278  VAbstractPattern::AddTool(id, tool);
279  doc->IncrementReferens(originPoint.getIdTool());
280  for (int i = 0; i < source.size(); ++i)
281  {
282  const SourceItem item = source.at(i);
283  doc->IncrementReferens(data->GetGObject(item.id)->getIdTool());
284  }
285  return tool;
286  }
287  return nullptr;
288 }
289 
290 //---------------------------------------------------------------------------------------------------------------------
292 {
294 }
295 
296 //---------------------------------------------------------------------------------------------------------------------
298 {
299  return m_originPointId;
300 }
301 
302 //---------------------------------------------------------------------------------------------------------------------
303 void VToolRotation::setOriginPointId(const quint32 &value)
304 {
305  if (value != NULL_ID)
306  {
307  m_originPointId = value;
308 
310  SaveOption(obj);
311  }
312 }
313 
314 //---------------------------------------------------------------------------------------------------------------------
316 {
317  VFormula fAngle(formulaAngle, getData());
318  fAngle.setCheckZero(false);
319  fAngle.setToolId(m_id);
320  fAngle.setPostfix(degreeSymbol);
321  return fAngle;
322 }
323 
324 //---------------------------------------------------------------------------------------------------------------------
326 {
327  if (value.error() == false)
328  {
330 
332  SaveOption(obj);
333  }
334 }
335 
336 //---------------------------------------------------------------------------------------------------------------------
338 {
339  ShowToolVisualization<VisToolRotation>(show);
340 }
341 
342 //---------------------------------------------------------------------------------------------------------------------
344 {
345  if (not vis.isNull())
346  {
347  VisToolRotation *visual = qobject_cast<VisToolRotation *>(vis);
348  SCASSERT(visual != nullptr)
349 
352  visual->SetAngle(qApp->TrVars()->FormulaToUser(formulaAngle, qApp->Settings()->GetOsSeparator()));
353  visual->RefreshGeometry();
354  }
355 }
356 
357 //---------------------------------------------------------------------------------------------------------------------
358 void VToolRotation::SaveDialog(QDomElement &domElement)
359 {
360  SCASSERT(not m_dialog.isNull())
361  QSharedPointer<DialogRotation> dialogTool = m_dialog.objectCast<DialogRotation>();
362  SCASSERT(not dialogTool.isNull())
363 
364  doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->getOriginPointId()));
365  doc->SetAttribute(domElement, AttrAngle, dialogTool->GetAngle());
366  doc->SetAttribute(domElement, AttrSuffix, dialogTool->getSuffix());
367 }
368 
369 //---------------------------------------------------------------------------------------------------------------------
370 void VToolRotation::ReadToolAttributes(const QDomElement &domElement)
371 {
373  formulaAngle = doc->GetParametrString(domElement, AttrAngle, "0");
374  suffix = doc->GetParametrString(domElement, AttrSuffix);
375 }
376 
377 //---------------------------------------------------------------------------------------------------------------------
379 {
380  VDrawTool::SaveOptions(tag, obj);
381 
383  doc->SetAttribute(tag, AttrCenter, QString().setNum(m_originPointId));
386 
388 }
389 
390 //---------------------------------------------------------------------------------------------------------------------
392 {
393  const QString toolTipStr = QString("<tr> <td><b>%1:</b> %2</td> </tr>"
394  "<tr> <td><b>%3:</b> %4°</td> </tr>")
395  .arg(tr(" Origin point"))
396  .arg(getOriginPointName())
397  .arg(tr("Rotation angle"))
398  .arg(GetFormulaAngle().getDoubleValue());
399  return toolTipStr;
400 }
401 
402 //---------------------------------------------------------------------------------------------------------------------
403 void VToolRotation::showContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
404 {
405  try
406  {
407  ContextMenu<DialogRotation>(event, id);
408  }
409  catch(const VExceptionToolWasDeleted &e)
410  {
411  Q_UNUSED(e)
412  return;//Leave this method immediately!!!
413  }
414 }
415 
416 //---------------------------------------------------------------------------------------------------------------------
417 DestinationItem VToolRotation::createPoint(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle,
418  const QString &suffix, VContainer *data)
419 {
420  const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(idItem);
421  VPointF rotated = point->Rotate(origin, angle, suffix);
422  rotated.setIdObject(idTool);
423 
424  DestinationItem item;
425  item.mx = rotated.mx();
426  item.my = rotated.my();
427  item.showPointName = rotated.isShowPointName();
428  item.id = data->AddGObject(new VPointF(rotated));
429  return item;
430 }
431 
432 //---------------------------------------------------------------------------------------------------------------------
433 template <class Item>
434 DestinationItem VToolRotation::createItem(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle,
435  const QString &suffix, VContainer *data)
436 {
437  const QSharedPointer<Item> i = data->GeometricObject<Item>(idItem);
438  Item rotated = i->Rotate(origin, angle, suffix);
439  rotated.setIdObject(idTool);
440 
441  DestinationItem item;
442  item.mx = INT_MAX;
443  item.my = INT_MAX;
444  item.id = data->AddGObject(new Item(rotated));
445  return item;
446 }
447 
448 //---------------------------------------------------------------------------------------------------------------------
449 template <class Item>
450 DestinationItem VToolRotation::createArc(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle,
451  const QString &suffix, VContainer *data)
452 {
453  const DestinationItem item = createItem<Item>(idTool, idItem, origin, angle, suffix, data);
454  data->AddArc(data->GeometricObject<Item>(item.id), item.id);
455  return item;
456 }
457 
458 //---------------------------------------------------------------------------------------------------------------------
459 template <class Item>
460 DestinationItem VToolRotation::createCurve(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle,
461  const QString &suffix, VContainer *data)
462 {
463  const DestinationItem item = createItem<Item>(idTool, idItem, origin, angle, suffix, data);
464  data->AddSpline(data->GeometricObject<Item>(item.id), item.id);
465  return item;
466 }
467 
468 //---------------------------------------------------------------------------------------------------------------------
469 template <class Item>
470 DestinationItem VToolRotation::createCurveWithSegments(quint32 idTool, quint32 idItem, const QPointF &origin,
471  qreal angle, const QString &suffix, VContainer *data)
472 {
473  const DestinationItem item = createItem<Item>(idTool, idItem, origin, angle, suffix, data);
475  return item;
476 }
477 
478 //---------------------------------------------------------------------------------------------------------------------
479 void VToolRotation::updatePoint(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle,
480  const QString &suffix, VContainer *data, const DestinationItem &item)
481 {
482  const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(idItem);
483  VPointF rotated = point->Rotate(origin, angle, suffix);
484  rotated.setIdObject(idTool);
485  rotated.setMx(item.mx);
486  rotated.setMy(item.my);
487  rotated.setShowPointName(item.showPointName);
488  data->UpdateGObject(item.id, new VPointF(rotated));
489 }
490 
491 //---------------------------------------------------------------------------------------------------------------------
492 template <class Item>
493 void VToolRotation::updateItem(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle,
494  const QString &suffix, VContainer *data, quint32 id)
495 {
496  const QSharedPointer<Item> i = data->GeometricObject<Item>(idItem);
497  Item rotated = i->Rotate(origin, angle, suffix);
498  rotated.setIdObject(idTool);
499  data->UpdateGObject(id, new Item(rotated));
500 }
501 
502 //---------------------------------------------------------------------------------------------------------------------
503 template <class Item>
504 void VToolRotation::updateArc(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle,
505  const QString &suffix, VContainer *data, quint32 id)
506 {
507  updateItem<Item>(idTool, idItem, origin, angle, suffix, data, id);
508  data->AddArc(data->GeometricObject<Item>(id), id);
509 }
510 
511 //---------------------------------------------------------------------------------------------------------------------
512 template <class Item>
513 void VToolRotation::updateCurve(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle,
514  const QString &suffix, VContainer *data, quint32 id)
515 {
516  updateItem<Item>(idTool, idItem, origin, angle, suffix, data, id);
517  data->AddSpline(data->GeometricObject<Item>(id), id);
518 }
519 
520 //---------------------------------------------------------------------------------------------------------------------
521 template <class Item>
522 void VToolRotation::updateCurveWithSegments(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle,
523  const QString &suffix, VContainer *data, quint32 id)
524 {
525  updateItem<Item>(idTool, idItem, origin, angle, suffix, data, id);
527 }
QVector< SourceItem > source
static void initOperationToolConnections(VMainGraphicsScene *scene, T *tool)
void SaveSourceDestination(QDomElement &tag)
QVector< DestinationItem > destination
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.
VAbstractPattern * doc
doc dom document container
QPointer< Visualization > vis
const VContainer * getData() const
getData return pointer to data container.
virtual void ToolCreation(const Source &typeCreation)
static void AddRecord(const quint32 id, const Tool &toolType, VAbstractPattern *doc)
AddRecord add record about tool in history.
static qreal CheckFormula(const quint32 &toolId, QString &formula, VContainer *data)
CheckFormula check formula.
const quint32 m_id
id object id.
The VContainer class container of all variables.
Definition: vcontainer.h:141
void AddArc(const QSharedPointer< VAbstractCurve > &arc, const quint32 &id, const quint32 &parentId=null_id)
Definition: vcontainer.cpp:395
static quint32 getNextId()
getNextId generate next unique id
Definition: vcontainer.cpp:251
const QSharedPointer< VGObject > GetGObject(quint32 id) const
GetGObject returns a point by id.
Definition: vcontainer.cpp:150
const QSharedPointer< T > GeometricObject(const quint32 &id) const
Definition: vcontainer.h:266
void AddSpline(const QSharedPointer< VAbstractBezier > &curve, quint32 id, quint32 parentId=null_id)
Definition: vcontainer.cpp:440
void AddCurveWithSegments(const QSharedPointer< VAbstractCubicBezierPath > &curve, const quint32 &id, quint32 parentId=null_id)
Definition: vcontainer.cpp:452
quint32 AddGObject(VGObject *obj)
AddGObject add new GObject to container.
Definition: vcontainer.cpp:216
static const QSharedPointer< VGObject > GetFakeGObject(quint32 id)
Definition: vcontainer.cpp:156
void UpdateGObject(quint32 id, T *obj)
UpdateGObject update GObject by id.
Definition: vcontainer.h:374
VContainer data
data container with data
Definition: vdatatool.h:84
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 ".".
Definition: vdomdocument.h:185
virtual void SaveOptions(QDomElement &tag, QSharedPointer< VGObject > &obj)
Definition: vdrawtool.cpp:163
void SaveOption(QSharedPointer< VGObject > &obj)
Definition: vdrawtool.cpp:142
bool error() const
Definition: vformula.cpp:238
QString GetFormula(FormulaType type=FormulaType::ToUser) const
Definition: vformula.cpp:135
void setToolId(const quint32 &value)
Definition: vformula.cpp:216
void setCheckZero(bool value)
Definition: vformula.cpp:184
void setPostfix(const QString &value)
Definition: vformula.cpp:228
QSharedPointer< DialogTool > m_dialog
m_dialog tool's dialog options.
The VMainGraphicsScene class main scene.
The VPointF class keep data of point.
Definition: vpointf.h:75
static VToolRotation * Create(QSharedPointer< DialogTool > dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data)
QString getOriginPointName() const
QString formulaAngle
static DestinationItem createCurveWithSegments(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle, const QString &suffix, VContainer *data)
void SetFormulaAngle(const VFormula &value)
VFormula GetFormulaAngle() const
virtual void setDialog() Q_DECL_OVERRIDE
setDialog set dialog when user want change tool option.
static void updateCurveWithSegments(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle, const QString &suffix, VContainer *data, quint32 id)
virtual QString makeToolTip() const Q_DECL_OVERRIDE
static DestinationItem createCurve(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle, const QString &suffix, VContainer *data)
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE
quint32 getOriginPointId() const
static DestinationItem createPoint(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle, const QString &suffix, VContainer *data)
void setOriginPointId(const quint32 &value)
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE
static const QString ToolType
Definition: vtoolrotation.h:85
virtual void SaveOptions(QDomElement &tag, QSharedPointer< VGObject > &obj) Q_DECL_OVERRIDE
static void updatePoint(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle, const QString &suffix, VContainer *data, const DestinationItem &item)
static void updateItem(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle, const QString &suffix, VContainer *data, quint32 id)
static DestinationItem createItem(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle, const QString &suffix, VContainer *data)
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE
SaveDialog save options into file after change in dialog.
static void updateCurve(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle, const QString &suffix, VContainer *data, quint32 id)
quint32 m_originPointId
VToolRotation(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 originPointId, const QString &angle, const QString &suffix, const QVector< SourceItem > &source, const QVector< DestinationItem > &destination, const Source &typeCreation, QGraphicsItem *parent=nullptr)
virtual void SetVisualization() Q_DECL_OVERRIDE
virtual void showContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE
static DestinationItem createArc(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle, const QString &suffix, VContainer *data)
static void updateArc(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle, const QString &suffix, VContainer *data, quint32 id)
void setObjects(QVector< quint32 > objects)
void SetAngle(const QString &expression)
void SetOriginPointId(quint32 value)
virtual void RefreshGeometry() Q_DECL_OVERRIDE
const QString degreeSymbol
Definition: def.cpp:196
#define SCASSERT(cond)
Definition: def.h:317
@ Rotation
Source
Definition: def.h:106
const QString AttrAngle
Definition: ifcdef.cpp:103
const QString AttrType
Definition: ifcdef.cpp:73
const QString AttrSuffix
Definition: ifcdef.cpp:147
const QString AttrCenter
Definition: ifcdef.cpp:99
#define NULL_ID
Definition: ifcdef.h:76
#define NULL_ID_STR
Definition: ifcdef.h:77
QVector< quint32 > sourceToObjects(const QVector< SourceItem > &source)
Document
#define qApp
Definition: vapplication.h:67
GOType
Definition: vgeometrydef.h:56
@ CubicBezierPath
@ SplinePath
@ EllipticalArc
@ CubicBezier