55 #include <qiterator.h>
58 #include <QDomNodeList>
59 #include <QMapIterator>
61 #include <QSharedPointer>
62 #include <QStaticStringData>
63 #include <QStringData>
64 #include <QStringDataPtr>
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"
97 class QGraphicsSceneContextMenuEvent;
99 class QStyleOptionGraphicsItem;
109 QGraphicsItem *parent)
111 , m_originPointId(originPointId)
112 , formulaAngle(angle)
126 dialogTool->setSuffix(
suffix);
136 const quint32 originPointId = dialogTool->getOriginPointId();
137 QString angle = dialogTool->GetAngle();
138 const QString
suffix = dialogTool->getSuffix();
143 if (operation !=
nullptr)
162 const QPointF oPoint =
static_cast<QPointF
>(originPoint);
173 for (
int i = 0; i <
source.size(); ++i)
176 const quint32 objectId = item.
id;
180 Q_STATIC_ASSERT_X(
static_cast<int>(
GOType::Unknown) == 7,
"Not all objects were handled.");
183 QT_WARNING_DISABLE_GCC(
"-Wswitch-default")
184 switch(
static_cast<GOType>(obj->getType()))
190 dest.append(createArc<VArc>(
id, objectId, oPoint, calcAngle,
suffix,
data));
193 dest.append(createArc<VEllipticalArc>(
id, objectId, oPoint, calcAngle,
suffix,
data));
196 dest.append(createCurve<VSpline>(
id, objectId, oPoint, calcAngle,
suffix,
data));
199 dest.append(createCurveWithSegments<VSplinePath>(
id, objectId, oPoint, calcAngle,
suffix,
data));
202 dest.append(createCurve<VCubicBezier>(
id, objectId, oPoint, calcAngle,
suffix,
data));
205 dest.append(createCurveWithSegments<VCubicBezierPath>(
id, objectId, oPoint, calcAngle,
suffix,
220 for (
int i = 0; i <
source.size(); ++i)
223 const quint32 objectId = item.
id;
227 Q_STATIC_ASSERT_X(
static_cast<int>(
GOType::Unknown) == 7,
"Not all objects were handled.");
230 QT_WARNING_DISABLE_GCC(
"-Wswitch-default")
231 switch(
static_cast<GOType>(obj->getType()))
240 updateArc<VArc>(
id, objectId, oPoint, calcAngle,
suffix,
data, dest.at(i).id);
243 updateArc<VEllipticalArc>(
id, objectId, oPoint, calcAngle,
suffix,
data, dest.at(i).id);
246 updateCurve<VSpline>(
id, objectId, oPoint, calcAngle,
suffix,
data, dest.at(i).id);
249 updateCurveWithSegments<VSplinePath>(
id, objectId, oPoint, calcAngle,
suffix,
data, dest.at(i).id);
252 updateCurve<VCubicBezier>(
id, objectId, oPoint, calcAngle,
suffix,
data, dest.at(i).id);
255 updateCurveWithSegments<VCubicBezierPath>(
id, objectId, oPoint, calcAngle,
suffix,
data,
276 scene->addItem(tool);
280 for (
int i = 0; i <
source.size(); ++i)
327 if (value.
error() ==
false)
339 ShowToolVisualization<VisToolRotation>(show);
345 if (not
vis.isNull())
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"))
397 .arg(tr(
"Rotation angle"))
407 ContextMenu<DialogRotation>(event,
id);
422 rotated.setIdObject(idTool);
425 item.
mx = rotated.mx();
426 item.
my = rotated.my();
433 template <
class Item>
438 Item rotated = i->Rotate(origin, angle,
suffix);
439 rotated.setIdObject(idTool);
449 template <
class Item>
459 template <
class Item>
469 template <
class Item>
471 qreal angle,
const QString &suffix,
VContainer *data)
484 rotated.setIdObject(idTool);
485 rotated.setMx(item.
mx);
486 rotated.setMy(item.
my);
492 template <
class Item>
494 const QString &suffix,
VContainer *data, quint32
id)
497 Item rotated = i->Rotate(origin, angle,
suffix);
498 rotated.setIdObject(idTool);
503 template <
class Item>
505 const QString &suffix,
VContainer *data, quint32
id)
507 updateItem<Item>(idTool, idItem, origin, angle,
suffix,
data,
id);
512 template <
class Item>
514 const QString &suffix,
VContainer *data, quint32
id)
516 updateItem<Item>(idTool, idItem, origin, angle,
suffix,
data,
id);
521 template <
class Item>
523 const QString &suffix,
VContainer *data, quint32
id)
525 updateItem<Item>(idTool, idItem, origin, angle,
suffix,
data,
id);
QVector< SourceItem > source
static void initOperationToolConnections(VMainGraphicsScene *scene, T *tool)
void SaveSourceDestination(QDomElement &tag)
void InitOperatedObjects()
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.
The VContainer class container of all variables.
void AddArc(const QSharedPointer< VAbstractCurve > &arc, const quint32 &id, const quint32 &parentId=null_id)
static quint32 getNextId()
getNextId generate next unique id
const QSharedPointer< VGObject > GetGObject(quint32 id) const
GetGObject returns a point by id.
const QSharedPointer< T > GeometricObject(const quint32 &id) const
void AddSpline(const QSharedPointer< VAbstractBezier > &curve, quint32 id, quint32 parentId=null_id)
void AddCurveWithSegments(const QSharedPointer< VAbstractCubicBezierPath > &curve, const quint32 &id, quint32 parentId=null_id)
quint32 AddGObject(VGObject *obj)
AddGObject add new GObject to container.
static const QSharedPointer< VGObject > GetFakeGObject(quint32 id)
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 ".".
The VMainGraphicsScene class main scene.
The VPointF class keep data of point.
void setObjects(QVector< quint32 > objects)
const QString degreeSymbol
QVector< quint32 > sourceToObjects(const QVector< SourceItem > &source)