From 1488823b34ef8ac23cac3eb7711ba6986fe4d73a Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 26 Sep 2013 21:50:52 +0300 Subject: [PATCH 01/10] Used macros Q_DISABLE_COPY for classes. --HG-- branch : feature --- container/calculator.h | 3 +-- dialogs/dialogalongline.h | 3 +-- dialogs/dialogarc.h | 3 +-- dialogs/dialogbisector.h | 3 +-- dialogs/dialogendline.h | 3 +-- dialogs/dialoghistory.h | 3 +-- dialogs/dialogincrements.h | 3 +-- dialogs/dialogline.h | 3 +-- dialogs/dialoglineintersect.h | 3 +-- dialogs/dialognormal.h | 3 +-- dialogs/dialogpointofcontact.h | 3 +-- dialogs/dialogshoulderpoint.h | 3 +-- dialogs/dialogsinglepoint.h | 3 +-- dialogs/dialogspline.h | 3 +-- dialogs/dialogsplinepath.h | 3 +-- dialogs/dialogtool.h | 3 +-- mainwindow.h | 3 +-- tablewindow.h | 3 +-- tools/vabstracttool.h | 3 +-- tools/vtooldetail.h | 3 +-- widgets/vcontrolpointspline.h | 3 +-- xml/vdomdocument.h | 3 +-- 22 files changed, 22 insertions(+), 44 deletions(-) diff --git a/container/calculator.h b/container/calculator.h index 48031ddd8..20def018f 100644 --- a/container/calculator.h +++ b/container/calculator.h @@ -48,8 +48,7 @@ public: */ qreal eval(QString prog, QString *errorMsg); private: - Calculator(const Calculator &calc); - const Calculator &operator=(const Calculator &calc); + Q_DISABLE_COPY(Calculator) QString *errorMsg; /** * @brief token теперішня лексема. diff --git a/dialogs/dialogalongline.h b/dialogs/dialogalongline.h index a6b9adc3d..5fb247720 100644 --- a/dialogs/dialogalongline.h +++ b/dialogs/dialogalongline.h @@ -52,6 +52,7 @@ public slots: virtual void ChoosedObject(qint64 id, Scene::Type type); virtual void DialogAccepted(); private: + Q_DISABLE_COPY(DialogAlongLine) Ui::DialogAlongLine *ui; qint32 number; QString pointName; @@ -59,8 +60,6 @@ private: QString formula; qint64 firstPointId; qint64 secondPointId; - DialogAlongLine(const DialogAlongLine &dialog); - const DialogAlongLine &operator=(const DialogAlongLine& dialog); }; #endif // DIALOGALONGLINE_H diff --git a/dialogs/dialogarc.h b/dialogs/dialogarc.h index 2ac19ba83..7e83c2851 100644 --- a/dialogs/dialogarc.h +++ b/dialogs/dialogarc.h @@ -61,6 +61,7 @@ public slots: protected: virtual void CheckState(); private: + Q_DISABLE_COPY(DialogArc) Ui::DialogArc *ui; bool flagRadius; bool flagF1; @@ -76,8 +77,6 @@ private: void EvalF1(); void EvalF2(); void ShowLineArcs(); - DialogArc(const DialogArc &dialog); - const DialogArc &operator=(const DialogArc& dialog); }; #endif // DIALOGARC_H diff --git a/dialogs/dialogbisector.h b/dialogs/dialogbisector.h index 90993b90d..9e1b5ae81 100644 --- a/dialogs/dialogbisector.h +++ b/dialogs/dialogbisector.h @@ -58,6 +58,7 @@ public slots: virtual void ChoosedObject(qint64 id, Scene::Type type); virtual void DialogAccepted(); private: + Q_DISABLE_COPY(DialogBisector) Ui::DialogBisector *ui; qint32 number; QString pointName; @@ -66,8 +67,6 @@ private: qint64 firstPointId; qint64 secondPointId; qint64 thirdPointId; - DialogBisector(const DialogBisector &dialog); - const DialogBisector &operator=(const DialogBisector& dialog); }; #endif // DIALOGBISECTOR_H diff --git a/dialogs/dialogendline.h b/dialogs/dialogendline.h index ec1cdb92e..d80ce1e0d 100644 --- a/dialogs/dialogendline.h +++ b/dialogs/dialogendline.h @@ -55,14 +55,13 @@ public slots: virtual void ChoosedObject(qint64 id, Scene::Type type); virtual void DialogAccepted(); private: + Q_DISABLE_COPY(DialogEndLine) Ui::DialogEndLine *ui; QString pointName; QString typeLine; QString formula; qreal angle; qint64 basePointId; - DialogEndLine(const DialogEndLine &dialog); - const DialogEndLine &operator=(const DialogEndLine& dialog); }; #endif // DIALOGENDLINE_H diff --git a/dialogs/dialoghistory.h b/dialogs/dialoghistory.h index e07a7205d..a515a94a2 100644 --- a/dialogs/dialoghistory.h +++ b/dialogs/dialoghistory.h @@ -46,6 +46,7 @@ signals: protected: virtual void closeEvent ( QCloseEvent * event ); private: + Q_DISABLE_COPY(DialogHistory) Ui::DialogHistory *ui; VDomDocument *doc; qint32 cursorRow; @@ -54,8 +55,6 @@ private: QString Record(const VToolRecord &tool); void InitialTable(); void ShowPoint(); - DialogHistory(const DialogHistory &dialog); - const DialogHistory &operator=(const DialogHistory& dialog); }; #endif // DIALOGHISTORY_H diff --git a/dialogs/dialogincrements.h b/dialogs/dialogincrements.h index 409ecf304..0bdd56325 100644 --- a/dialogs/dialogincrements.h +++ b/dialogs/dialogincrements.h @@ -47,6 +47,7 @@ signals: void FullUpdateTree(); void haveLiteChange(); private: + Q_DISABLE_COPY(DialogIncrements) Ui::DialogIncrements *ui; VContainer *data; // need because we must change data VDomDocument *doc; @@ -62,8 +63,6 @@ private: void FillLengthArcs(); void AddIncrementToFile(qint64 id, QString name, qint32 base, qreal ksize, qreal kgrowth, QString description); - DialogIncrements(const DialogIncrements &dialog); - const DialogIncrements &operator=(const DialogIncrements& dialog); }; #endif // DIALOGINCREMENTS_H diff --git a/dialogs/dialogline.h b/dialogs/dialogline.h index 3050ed6b9..63f438d40 100644 --- a/dialogs/dialogline.h +++ b/dialogs/dialogline.h @@ -47,12 +47,11 @@ public slots: void ChoosedObject(qint64 id, Scene::Type type); virtual void DialogAccepted(); private: + Q_DISABLE_COPY(DialogLine) Ui::DialogLine *ui; qint32 number; qint64 firstPoint; qint64 secondPoint; - DialogLine(const DialogLine &dialog); - const DialogLine &operator=(const DialogLine& dialog); }; #endif // DIALOGLINE_H diff --git a/dialogs/dialoglineintersect.h b/dialogs/dialoglineintersect.h index f6234aa53..0739a046d 100644 --- a/dialogs/dialoglineintersect.h +++ b/dialogs/dialoglineintersect.h @@ -53,6 +53,7 @@ public slots: void P1Line2Changed( int index); void P2Line2Changed( int index); private: + Q_DISABLE_COPY(DialogLineIntersect) Ui::DialogLineIntersect *ui; qint32 number; QString pointName; @@ -63,8 +64,6 @@ private: bool flagPoint; virtual void CheckState(); bool CheckIntersecion(); - DialogLineIntersect(const DialogLineIntersect &dialog); - const DialogLineIntersect &operator=(const DialogLineIntersect& dialog); }; #endif // DIALOGLINEINTERSECT_H diff --git a/dialogs/dialognormal.h b/dialogs/dialognormal.h index c09a94a51..497d515cb 100644 --- a/dialogs/dialognormal.h +++ b/dialogs/dialognormal.h @@ -57,6 +57,7 @@ public slots: virtual void ChoosedObject(qint64 id, Scene::Type type); virtual void DialogAccepted(); private: + Q_DISABLE_COPY(DialogNormal) Ui::DialogNormal *ui; qint32 number; QString pointName; @@ -65,8 +66,6 @@ private: qreal angle; qint64 firstPointId; qint64 secondPointId; - DialogNormal(const DialogNormal &dialog); - const DialogNormal &operator=(const DialogNormal& dialog); }; #endif // DIALOGNORMAL_H diff --git a/dialogs/dialogpointofcontact.h b/dialogs/dialogpointofcontact.h index 776b98391..601d1b622 100644 --- a/dialogs/dialogpointofcontact.h +++ b/dialogs/dialogpointofcontact.h @@ -54,6 +54,7 @@ public slots: virtual void ChoosedObject(qint64 id, Scene::Type type); virtual void DialogAccepted(); private: + Q_DISABLE_COPY(DialogPointOfContact) Ui::DialogPointOfContact ui; qint32 number; QString pointName; @@ -61,8 +62,6 @@ private: qint64 center; qint64 firstPoint; qint64 secondPoint; - DialogPointOfContact(const DialogPointOfContact &dialog); - const DialogPointOfContact &operator=(const DialogPointOfContact& dialog); }; #endif // DIALOGPOINTOFCONTACT_H diff --git a/dialogs/dialogshoulderpoint.h b/dialogs/dialogshoulderpoint.h index f7e1510d7..b988632c8 100644 --- a/dialogs/dialogshoulderpoint.h +++ b/dialogs/dialogshoulderpoint.h @@ -54,6 +54,7 @@ public slots: virtual void ChoosedObject(qint64 id, Scene::Type type); virtual void DialogAccepted(); private: + Q_DISABLE_COPY(DialogShoulderPoint) Ui::DialogShoulderPoint *ui; qint32 number; QString pointName; @@ -62,8 +63,6 @@ private: qint64 p1Line; qint64 p2Line; qint64 pShoulder; - DialogShoulderPoint(const DialogShoulderPoint &dialog); - const DialogShoulderPoint &operator=(const DialogShoulderPoint& dialog); }; #endif // DIALOGSHOULDERPOINT_H diff --git a/dialogs/dialogsinglepoint.h b/dialogs/dialogsinglepoint.h index aa68a554e..4d1e187bb 100644 --- a/dialogs/dialogsinglepoint.h +++ b/dialogs/dialogsinglepoint.h @@ -42,11 +42,10 @@ public slots: void mousePress(QPointF scenePos); virtual void DialogAccepted(); private: + Q_DISABLE_COPY(DialogSinglePoint) Ui::DialogSinglePoint *ui; QString name; QPointF point; - DialogSinglePoint(const DialogSinglePoint &dialog); - const DialogSinglePoint &operator=(const DialogSinglePoint& dialog); }; #endif // DIALOGSINGLEPOINT_H diff --git a/dialogs/dialogspline.h b/dialogs/dialogspline.h index 59201461b..7485a3ee3 100644 --- a/dialogs/dialogspline.h +++ b/dialogs/dialogspline.h @@ -54,6 +54,7 @@ public slots: virtual void ChoosedObject(qint64 id, Scene::Type type); virtual void DialogAccepted(); private: + Q_DISABLE_COPY(DialogSpline) Ui::DialogSpline *ui; qint32 number; qint64 p1; // перша точка @@ -63,8 +64,6 @@ private: qreal kAsm1; qreal kAsm2; qreal kCurve; - DialogSpline(const DialogSpline &dialog); - const DialogSpline &operator=(const DialogSpline& dialog); }; #endif // DIALOGSPLINE_H diff --git a/dialogs/dialogsplinepath.h b/dialogs/dialogsplinepath.h index 5c60a1143..de85abf4c 100644 --- a/dialogs/dialogsplinepath.h +++ b/dialogs/dialogsplinepath.h @@ -49,14 +49,13 @@ public slots: void KAsm1Changed(qreal d); void KAsm2Changed(qreal d); private: + Q_DISABLE_COPY(DialogSplinePath) Ui::DialogSplinePath *ui; VSplinePath path; void NewItem(qint64 id, qreal kAsm1, qreal angle, qreal kAsm2); void DataPoint(qint64 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2); void EnableFields(); void SetAngle(qint32 angle); - DialogSplinePath(const DialogSplinePath &dialog); - const DialogSplinePath &operator=(const DialogSplinePath& dialog); }; #endif // DIALOGSPLINEPATH_H diff --git a/dialogs/dialogtool.h b/dialogs/dialogtool.h index 9817a6419..ece39cf5a 100644 --- a/dialogs/dialogtool.h +++ b/dialogs/dialogtool.h @@ -69,6 +69,7 @@ public slots: virtual void ValChenged(int row); void UpdateList(); protected: + Q_DISABLE_COPY(DialogTool) const VContainer *data; bool isInitialized; bool flagName; @@ -102,8 +103,6 @@ protected: void Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label); void setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 &value, const qint64 &id) const; qint64 getCurrentPointId(QComboBox *box) const; - DialogTool(const DialogTool &dialog); - DialogTool &operator=(const DialogTool &dialog); }; #endif // DIALOGTOOL_H diff --git a/mainwindow.h b/mainwindow.h index ca73b9363..bdc65021b 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -111,6 +111,7 @@ protected: virtual void closeEvent( QCloseEvent * event ); void Clear(); private: + Q_DISABLE_COPY(MainWindow) Ui::MainWindow *ui; Tools::Enum tool; VMainGraphicsScene *currentScene; @@ -140,8 +141,6 @@ private: QString fileName; bool changeInFile; Draw::Mode mode; - MainWindow(const MainWindow &window); - const MainWindow &operator=(const MainWindow &window); void ToolBarOption(); void ToolBarDraws(); void CanselTool(); diff --git a/tablewindow.h b/tablewindow.h index 7bbcb4d4d..a8604a8bf 100644 --- a/tablewindow.h +++ b/tablewindow.h @@ -125,6 +125,7 @@ protected: void showEvent ( QShowEvent * event ); void keyPressEvent ( QKeyEvent * event ); private: + Q_DISABLE_COPY(TableWindow) /** * @brief ui Змінна для доступу до об'єктів вікна. */ @@ -181,8 +182,6 @@ private: * @brief sceneRect Мінімальний розмір листа паперу що буде показуватися на сцені. */ QRectF sceneRect; - TableWindow(const TableWindow &window); - const TableWindow &operator=(const TableWindow& window); void SvgFile(const QString &name)const; void PngFile(const QString &name)const; void PsFile(const QString &name)const; diff --git a/tools/vabstracttool.h b/tools/vabstracttool.h index a9a05eb11..53a60f0ad 100644 --- a/tools/vabstracttool.h +++ b/tools/vabstracttool.h @@ -65,7 +65,6 @@ protected: void AddAttribute(QDomElement &domElement, const QString &name, const QString &value); const VContainer *getData() const; private: - VAbstractTool(const VAbstractTool &tool); - const VAbstractTool &operator=(const VAbstractTool &tool); + Q_DISABLE_COPY(VAbstractTool) }; #endif // VABSTRACTTOOL_H diff --git a/tools/vtooldetail.h b/tools/vtooldetail.h index e9ee69b56..88bdac88e 100644 --- a/tools/vtooldetail.h +++ b/tools/vtooldetail.h @@ -60,12 +60,11 @@ protected: QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); private: + Q_DISABLE_COPY(VToolDetail) QSharedPointer dialogDetail; VMainGraphicsScene *sceneDetails; void RefreshGeometry (); void AddNode(QDomElement &domElement, VNodeDetail &node); - VToolDetail(const VToolDetail &tool); - VToolDetail &operator=(const VToolDetail &tool); }; #endif // VTOOLDETAIL_H diff --git a/widgets/vcontrolpointspline.h b/widgets/vcontrolpointspline.h index a114caceb..034dfae3f 100644 --- a/widgets/vcontrolpointspline.h +++ b/widgets/vcontrolpointspline.h @@ -49,8 +49,7 @@ protected: virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); private: - VControlPointSpline(const VControlPointSpline &pSpl); - const VControlPointSpline &operator=(const VControlPointSpline &pSpl); + Q_DISABLE_COPY(VControlPointSpline) qint32 indexSpline; SplinePoint::Position position; qint32 LineIntersectCircle(QPointF center, qreal radius, QLineF line, QPointF &p1, diff --git a/xml/vdomdocument.h b/xml/vdomdocument.h index 1e627c3f5..d7a04f484 100644 --- a/xml/vdomdocument.h +++ b/xml/vdomdocument.h @@ -82,6 +82,7 @@ public slots: void haveLiteChange(); void ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable); private: + Q_DISABLE_COPY(VDomDocument) QMap map; QString nameActivDraw; VContainer *data; @@ -90,8 +91,6 @@ private: qint64 cursor; QComboBox *comboBoxDraws; Draw::Mode *mode; - VDomDocument(const VDomDocument & doc); - const VDomDocument &operator=(const VDomDocument& doc); bool find(QDomElement node, const QString& id); bool CheckNameDraw(const QString& name) const; void SetActivDraw(const QString& name); From b541610f51e3a732630a56fc19e8c677446a13b9 Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 27 Sep 2013 12:17:00 +0300 Subject: [PATCH 02/10] Used QFlags for enums. --HG-- branch : feature --- container/vcontainer.cpp | 24 +++--- container/vcontainer.h | 16 ++-- container/vpointf.cpp | 6 +- container/vpointf.h | 8 +- dialogs/dialogalongline.cpp | 4 +- dialogs/dialogalongline.h | 4 +- dialogs/dialogarc.cpp | 4 +- dialogs/dialogarc.h | 4 +- dialogs/dialogbisector.cpp | 4 +- dialogs/dialogbisector.h | 4 +- dialogs/dialogdetail.cpp | 22 ++--- dialogs/dialogdetail.h | 6 +- dialogs/dialogendline.cpp | 4 +- dialogs/dialogendline.h | 4 +- dialogs/dialoghistory.cpp | 26 +++--- dialogs/dialogline.cpp | 4 +- dialogs/dialogline.h | 4 +- dialogs/dialoglineintersect.cpp | 4 +- dialogs/dialoglineintersect.h | 4 +- dialogs/dialognormal.cpp | 4 +- dialogs/dialognormal.h | 4 +- dialogs/dialogpointofcontact.cpp | 4 +- dialogs/dialogpointofcontact.h | 4 +- dialogs/dialogshoulderpoint.cpp | 4 +- dialogs/dialogshoulderpoint.h | 4 +- dialogs/dialogspline.cpp | 4 +- dialogs/dialogspline.h | 4 +- dialogs/dialogsplinepath.cpp | 4 +- dialogs/dialogsplinepath.h | 4 +- dialogs/dialogtool.cpp | 20 ++--- dialogs/dialogtool.h | 6 +- geometry/varc.cpp | 6 +- geometry/varc.h | 8 +- geometry/vdetail.h | 18 ++-- geometry/vnodedetail.cpp | 16 ++-- geometry/vnodedetail.h | 30 +++---- geometry/vspline.cpp | 8 +- geometry/vspline.h | 10 +-- geometry/vsplinepath.cpp | 6 +- geometry/vsplinepath.h | 8 +- mainwindow.cpp | 86 +++++++++---------- mainwindow.h | 10 +-- options.h | 69 +++++++-------- tools/drawTools/vdrawtool.cpp | 2 +- tools/drawTools/vdrawtool.h | 2 +- tools/drawTools/vtoolalongline.cpp | 4 +- tools/drawTools/vtoolalongline.h | 2 +- tools/drawTools/vtoolarc.cpp | 4 +- tools/drawTools/vtoolarc.h | 2 +- tools/drawTools/vtoolbisector.cpp | 4 +- tools/drawTools/vtoolbisector.h | 3 +- tools/drawTools/vtoolendline.cpp | 4 +- tools/drawTools/vtoolendline.h | 4 +- tools/drawTools/vtoolline.cpp | 4 +- tools/drawTools/vtoolline.h | 4 +- tools/drawTools/vtoollineintersect.cpp | 4 +- tools/drawTools/vtoollineintersect.h | 2 +- tools/drawTools/vtoolnormal.cpp | 4 +- tools/drawTools/vtoolnormal.h | 2 +- tools/drawTools/vtoolpointofcontact.cpp | 4 +- tools/drawTools/vtoolpointofcontact.h | 2 +- tools/drawTools/vtoolshoulderpoint.cpp | 4 +- tools/drawTools/vtoolshoulderpoint.h | 2 +- tools/drawTools/vtoolspline.cpp | 4 +- tools/drawTools/vtoolspline.h | 2 +- tools/drawTools/vtoolsplinepath.cpp | 4 +- tools/drawTools/vtoolsplinepath.h | 2 +- tools/modelingTools/vmodelingalongline.cpp | 2 +- tools/modelingTools/vmodelingalongline.h | 2 +- tools/modelingTools/vmodelingarc.cpp | 2 +- tools/modelingTools/vmodelingarc.h | 2 +- tools/modelingTools/vmodelingbisector.cpp | 2 +- tools/modelingTools/vmodelingbisector.h | 2 +- tools/modelingTools/vmodelingendline.cpp | 2 +- tools/modelingTools/vmodelingendline.h | 2 +- tools/modelingTools/vmodelingline.cpp | 2 +- tools/modelingTools/vmodelingline.h | 2 +- .../modelingTools/vmodelinglineintersect.cpp | 2 +- tools/modelingTools/vmodelinglineintersect.h | 2 +- tools/modelingTools/vmodelingnormal.cpp | 2 +- tools/modelingTools/vmodelingnormal.h | 2 +- .../modelingTools/vmodelingpointofcontact.cpp | 2 +- tools/modelingTools/vmodelingpointofcontact.h | 2 +- .../modelingTools/vmodelingshoulderpoint.cpp | 2 +- tools/modelingTools/vmodelingshoulderpoint.h | 2 +- tools/modelingTools/vmodelingspline.cpp | 2 +- tools/modelingTools/vmodelingspline.h | 2 +- tools/modelingTools/vmodelingsplinepath.cpp | 2 +- tools/modelingTools/vmodelingsplinepath.h | 2 +- tools/nodeDetails/vabstractnode.cpp | 2 +- tools/nodeDetails/vabstractnode.h | 4 +- tools/nodeDetails/vnodearc.cpp | 4 +- tools/nodeDetails/vnodearc.h | 4 +- tools/nodeDetails/vnodepoint.cpp | 4 +- tools/nodeDetails/vnodepoint.h | 4 +- tools/nodeDetails/vnodespline.cpp | 4 +- tools/nodeDetails/vnodespline.h | 4 +- tools/nodeDetails/vnodesplinepath.cpp | 4 +- tools/nodeDetails/vnodesplinepath.h | 4 +- tools/vabstracttool.h | 2 +- tools/vtooldetail.cpp | 72 ++++++++-------- tools/vtooldetail.h | 10 +-- widgets/vmaingraphicsscene.cpp | 2 +- widgets/vmaingraphicsscene.h | 4 +- xml/vdomdocument.cpp | 72 ++++++++-------- xml/vdomdocument.h | 39 ++++----- xml/vtoolrecord.cpp | 8 +- xml/vtoolrecord.h | 9 +- 108 files changed, 427 insertions(+), 445 deletions(-) diff --git a/container/vcontainer.cpp b/container/vcontainer.cpp index c04486c7a..e9b7de59f 100644 --- a/container/vcontainer.cpp +++ b/container/vcontainer.cpp @@ -165,7 +165,7 @@ void VContainer::UpdateId(qint64 newId){ } } -void VContainer::IncrementReferens(qint64 id, Scene::Type obj, Draw::Mode mode){ +void VContainer::IncrementReferens(qint64 id, Scene::Scenes obj, Draw::Draws mode){ switch( obj ){ case(Scene::Line): break; @@ -240,12 +240,12 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{ QVector points; for(qint32 i = 0; i< detail.CountNode(); ++i){ switch(detail[i].getTypeTool()){ - case(Tools::NodePoint):{ + case(Tool::NodePoint):{ VPointF point = GetModelingPoint(detail[i].getId()); points.append(point.toQPointF()); } break; - case(Tools::NodeArc):{ + case(Tool::NodeArc):{ VArc arc = GetModelingArc(detail[i].getId()); qreal len1 = GetLengthContour(points, arc.GetPoints()); qreal lenReverse = GetLengthContour(points, GetReversePoint(arc.GetPoints())); @@ -256,7 +256,7 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{ } } break; - case(Tools::NodeSpline):{ + case(Tool::NodeSpline):{ VSpline spline = GetModelingSpline(detail[i].getId()); qreal len1 = GetLengthContour(points, spline.GetPoints()); qreal lenReverse = GetLengthContour(points, GetReversePoint(spline.GetPoints())); @@ -267,7 +267,7 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{ } } break; - case(Tools::NodeSplinePath):{ + case(Tool::NodeSplinePath):{ VSplinePath splinePath = GetModelingSplinePath(detail[i].getId()); qreal len1 = GetLengthContour(points, splinePath.GetPathPoints()); qreal lenReverse = GetLengthContour(points, GetReversePoint(splinePath.GetPathPoints())); @@ -701,7 +701,7 @@ const QMap *VContainer::DataDetails() const{ return &details; } -void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId, Draw::Mode mode){ +void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId, Draw::Draws mode){ QString nameLine = GetNameLine(firstPointId, secondPointId, mode); VPointF first; VPointF second; @@ -760,7 +760,7 @@ qint64 VContainer::AddModelingArc(const VArc &arc){ return AddObject(modelingArcs, arc); } -QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint, Draw::Mode mode) const{ +QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint, Draw::Draws mode) const{ VPointF first; VPointF second; if(mode == Draw::Calculation){ @@ -774,7 +774,7 @@ QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPo } QString VContainer::GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint, - Draw::Mode mode) const{ + Draw::Draws mode) const{ VPointF first; VPointF second; if(mode == Draw::Calculation){ @@ -788,7 +788,7 @@ QString VContainer::GetNameLineAngle(const qint64 &firstPoint, const qint64 &sec } QString VContainer::GetNameSpline(const qint64 &firstPoint, const qint64 &secondPoint, - Draw::Mode mode) const{ + Draw::Draws mode) const{ VPointF first; VPointF second; if(mode == Draw::Calculation){ @@ -801,7 +801,7 @@ QString VContainer::GetNameSpline(const qint64 &firstPoint, const qint64 &second return QString("Spl_%1_%2").arg(first.name(), second.name()); } -QString VContainer::GetNameSplinePath(const VSplinePath &path, Draw::Mode mode) const{ +QString VContainer::GetNameSplinePath(const VSplinePath &path, Draw::Draws mode) const{ if(path.Count() == 0){ return QString(); } @@ -823,7 +823,7 @@ QString VContainer::GetNameSplinePath(const VSplinePath &path, Draw::Mode mode) return name; } -QString VContainer::GetNameArc(const qint64 ¢er, const qint64 &id, Draw::Mode mode) const{ +QString VContainer::GetNameArc(const qint64 ¢er, const qint64 &id, Draw::Draws mode) const{ VPointF centerPoint; if(mode == Draw::Calculation){ centerPoint = GetPoint(center); @@ -838,7 +838,7 @@ void VContainer::AddLengthLine(const QString &name, const qreal &value){ lengthLines[name] = value; } -void VContainer::AddLengthSpline(const qint64 &firstPointId, const qint64 &secondPointId, Draw::Mode mode){ +void VContainer::AddLengthSpline(const qint64 &firstPointId, const qint64 &secondPointId, Draw::Draws mode){ QString nameLine = GetNameSpline(firstPointId, secondPointId, mode); VPointF first; VPointF second; diff --git a/container/vcontainer.h b/container/vcontainer.h index 5fc419d10..8dd77a356 100644 --- a/container/vcontainer.h +++ b/container/vcontainer.h @@ -75,13 +75,13 @@ public: void AddIncrementTableRow(const QString& name, const VIncrementTableRow &cell); void AddLengthLine(const QString &name, const qreal &value); void AddLengthSpline(const qint64 &firstPointId, const qint64 &secondPointId, - Draw::Mode mode = Draw::Calculation); + Draw::Draws mode = Draw::Calculation); void AddLengthSpline(const QString &name, const qreal &value); void AddLengthArc(const qint64 ¢er, const qint64 &id); void AddLengthArc(const QString &name, const qreal &value); void AddLineAngle(const QString &name, const qreal &value); void AddLine(const qint64 &firstPointId, const qint64 &secondPointId, - Draw::Mode mode = Draw::Calculation); + Draw::Draws mode = Draw::Calculation); qint64 AddSpline(const VSpline& spl); qint64 AddModelingSpline(const VSpline& spl); qint64 AddSplinePath(const VSplinePath& splPath); @@ -89,15 +89,15 @@ public: qint64 AddArc(const VArc& arc); qint64 AddModelingArc(const VArc& arc); QString GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint, - Draw::Mode mode = Draw::Calculation) const; + Draw::Draws mode = Draw::Calculation) const; QString GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint, - Draw::Mode mode = Draw::Calculation) const; + Draw::Draws mode = Draw::Calculation) const; QString GetNameSpline(const qint64 &firstPoint, const qint64 &secondPoint, - Draw::Mode mode = Draw::Calculation) const; + Draw::Draws mode = Draw::Calculation) const; QString GetNameSplinePath(const VSplinePath &path, - Draw::Mode mode = Draw::Calculation) const; + Draw::Draws mode = Draw::Calculation) const; QString GetNameArc(const qint64 ¢er, const qint64 &id, - Draw::Mode mode = Draw::Calculation) const; + Draw::Draws mode = Draw::Calculation) const; void UpdatePoint(qint64 id, const VPointF& point); void UpdateModelingPoint(qint64 id, const VPointF& point); void UpdateDetail(qint64 id, const VDetail& detail); @@ -143,7 +143,7 @@ public: const QMap *DataModelingSplinePaths() const; const QMap *DataDetails() const; static void UpdateId(qint64 newId); - void IncrementReferens(qint64 id, Scene::Type obj, Draw::Mode mode = Draw::Calculation); + void IncrementReferens(qint64 id, Scene::Scenes obj, Draw::Draws mode = Draw::Calculation); QPainterPath ContourPath(qint64 idDetail) const; QPainterPath Equidistant(QVector points, const Detail::Equidistant &eqv, const qreal &width)const; diff --git a/container/vpointf.cpp b/container/vpointf.cpp index f11278871..b99c6fe2f 100644 --- a/container/vpointf.cpp +++ b/container/vpointf.cpp @@ -29,7 +29,7 @@ VPointF::VPointF ( const VPointF & point ):_name(point.name()), _mx(point.mx()), _x(point.x()), _y(point.y()), _referens(0), mode(point.getMode()), idObject(point.getIdObject()){ } -VPointF::VPointF (qreal x, qreal y , QString name, qreal mx, qreal my, Draw::Mode mode, qint64 idObject):_name(name), _mx(mx), +VPointF::VPointF (qreal x, qreal y , QString name, qreal mx, qreal my, Draw::Draws mode, qint64 idObject):_name(name), _mx(mx), _my(my), _x(x), _y(y), _referens(0), mode(mode), idObject(idObject){ } @@ -94,12 +94,12 @@ void VPointF::decrementReferens(){ } } -Draw::Mode VPointF::getMode() const +Draw::Draws VPointF::getMode() const { return mode; } -void VPointF::setMode(const Draw::Mode &value) +void VPointF::setMode(const Draw::Draws &value) { mode = value; } diff --git a/container/vpointf.h b/container/vpointf.h index 32abd7eab..8b164a661 100644 --- a/container/vpointf.h +++ b/container/vpointf.h @@ -31,7 +31,7 @@ class VPointF public: VPointF(); VPointF (const VPointF &point ); - VPointF ( qreal x, qreal y, QString name, qreal mx, qreal my, Draw::Mode mode = Draw::Calculation, + VPointF ( qreal x, qreal y, QString name, qreal mx, qreal my, Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); ~VPointF(); QString name() const; @@ -48,8 +48,8 @@ public: qint32 referens() const; void incrementReferens(); void decrementReferens(); - Draw::Mode getMode() const; - void setMode(const Draw::Mode &value); + Draw::Draws getMode() const; + void setMode(const Draw::Draws &value); qint64 getIdObject() const; void setIdObject(const qint64 &value); @@ -61,7 +61,7 @@ private: qreal _x; qreal _y; qint32 _referens; - Draw::Mode mode; + Draw::Draws mode; qint64 idObject; }; diff --git a/dialogs/dialogalongline.cpp b/dialogs/dialogalongline.cpp index 06f1c1807..7633d0e30 100644 --- a/dialogs/dialogalongline.cpp +++ b/dialogs/dialogalongline.cpp @@ -22,7 +22,7 @@ #include "dialogalongline.h" #include "ui_dialogalongline.h" -DialogAlongLine::DialogAlongLine(const VContainer *data, Draw::Mode mode, QWidget *parent) : +DialogAlongLine::DialogAlongLine(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogTool(data, mode, parent), ui(new Ui::DialogAlongLine), number(0), pointName(QString()), typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0){ ui->setupUi(this); @@ -64,7 +64,7 @@ DialogAlongLine::~DialogAlongLine() delete ui; } -void DialogAlongLine::ChoosedObject(qint64 id, Scene::Type type){ +void DialogAlongLine::ChoosedObject(qint64 id, Scene::Scenes type){ if(idDetail == 0 && mode == Draw::Modeling){ if(type == Scene::Detail){ idDetail = id; diff --git a/dialogs/dialogalongline.h b/dialogs/dialogalongline.h index 5fb247720..d501f6323 100644 --- a/dialogs/dialogalongline.h +++ b/dialogs/dialogalongline.h @@ -35,7 +35,7 @@ class DialogAlongLine : public DialogTool { Q_OBJECT public: - explicit DialogAlongLine(const VContainer *data, Draw::Mode mode = Draw::Calculation, + explicit DialogAlongLine(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); ~DialogAlongLine(); QString getPointName() const; @@ -49,7 +49,7 @@ public: qint64 getSecondPointId() const; void setSecondPointId(const qint64 &value, const qint64 &id); public slots: - virtual void ChoosedObject(qint64 id, Scene::Type type); + virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void DialogAccepted(); private: Q_DISABLE_COPY(DialogAlongLine) diff --git a/dialogs/dialogarc.cpp b/dialogs/dialogarc.cpp index fe765a2d2..cb547949a 100644 --- a/dialogs/dialogarc.cpp +++ b/dialogs/dialogarc.cpp @@ -23,7 +23,7 @@ #include "ui_dialogarc.h" #include "../container/calculator.h" -DialogArc::DialogArc(const VContainer *data, Draw::Mode mode, QWidget *parent) : +DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogTool(data, mode, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false), timerRadius(0), timerF1(0), timerF2(0), center(0), radius(QString()), f1(QString()), f2(QString()){ ui->setupUi(this); @@ -114,7 +114,7 @@ DialogArc::~DialogArc(){ delete ui; } -void DialogArc::ChoosedObject(qint64 id, Scene::Type type){ +void DialogArc::ChoosedObject(qint64 id, Scene::Scenes type){ if(idDetail == 0 && mode == Draw::Modeling){ if(type == Scene::Detail){ idDetail = id; diff --git a/dialogs/dialogarc.h b/dialogs/dialogarc.h index 7e83c2851..8cb7b3c82 100644 --- a/dialogs/dialogarc.h +++ b/dialogs/dialogarc.h @@ -33,7 +33,7 @@ class DialogArc : public DialogTool { Q_OBJECT public: - explicit DialogArc(const VContainer *data, Draw::Mode mode = Draw::Calculation, QWidget *parent = 0); + explicit DialogArc(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); ~DialogArc(); qint64 GetCenter() const; void SetCenter(const qint64 &value); @@ -48,7 +48,7 @@ public: void SetF2(const QString &value); public slots: - virtual void ChoosedObject(qint64 id, Scene::Type type); + virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void DialogAccepted(); virtual void ValChenged(int row); void PutRadius(); diff --git a/dialogs/dialogbisector.cpp b/dialogs/dialogbisector.cpp index e828bfeba..c03837c6a 100644 --- a/dialogs/dialogbisector.cpp +++ b/dialogs/dialogbisector.cpp @@ -22,7 +22,7 @@ #include "dialogbisector.h" #include "ui_dialogbisector.h" -DialogBisector::DialogBisector(const VContainer *data, Draw::Mode mode, QWidget *parent) : +DialogBisector::DialogBisector(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogTool(data, mode, parent), ui(new Ui::DialogBisector), number(0), pointName(QString()), typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0), thirdPointId(0){ ui->setupUi(this); @@ -64,7 +64,7 @@ DialogBisector::~DialogBisector(){ delete ui; } -void DialogBisector::ChoosedObject(qint64 id, Scene::Type type){ +void DialogBisector::ChoosedObject(qint64 id, Scene::Scenes type){ if(idDetail == 0 && mode == Draw::Modeling){ if(type == Scene::Detail){ idDetail = id; diff --git a/dialogs/dialogbisector.h b/dialogs/dialogbisector.h index 9e1b5ae81..3f4c31d4b 100644 --- a/dialogs/dialogbisector.h +++ b/dialogs/dialogbisector.h @@ -39,7 +39,7 @@ class DialogBisector : public DialogTool Q_OBJECT public: - explicit DialogBisector(const VContainer *data, Draw::Mode mode = Draw::Calculation, + explicit DialogBisector(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); ~DialogBisector(); QString getPointName() const; @@ -55,7 +55,7 @@ public: qint64 getThirdPointId() const; void setThirdPointId(const qint64 &value, const qint64 &id); public slots: - virtual void ChoosedObject(qint64 id, Scene::Type type); + virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void DialogAccepted(); private: Q_DISABLE_COPY(DialogBisector) diff --git a/dialogs/dialogdetail.cpp b/dialogs/dialogdetail.cpp index 7e6838350..fc5a36543 100644 --- a/dialogs/dialogdetail.cpp +++ b/dialogs/dialogdetail.cpp @@ -22,7 +22,7 @@ #include "dialogdetail.h" #include -DialogDetail::DialogDetail(const VContainer *data, Draw::Mode mode, QWidget *parent) : +DialogDetail::DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogTool(data, mode, parent), ui(), details(VDetail()){ ui.setupUi(this); bOk = ui.buttonBox->button(QDialogButtonBox::Ok); @@ -32,7 +32,7 @@ DialogDetail::DialogDetail(const VContainer *data, Draw::Mode mode, QWidget *par connect(bCansel, &QPushButton::clicked, this, &DialogDetail::DialogRejected); } -void DialogDetail::ChoosedObject(qint64 id, Scene::Type type){ +void DialogDetail::ChoosedObject(qint64 id, Scene::Scenes type){ if(idDetail == 0 && mode == Draw::Modeling){ if(type == Scene::Detail){ idDetail = id; @@ -47,16 +47,16 @@ void DialogDetail::ChoosedObject(qint64 id, Scene::Type type){ if(type != Scene::Line && type != Scene::Detail){ switch(type){ case(Scene::Arc): - NewItem(id, Tools::NodeArc, mode, NodeDetail::Contour); + NewItem(id, Tool::NodeArc, mode, NodeDetail::Contour); break; case(Scene::Point): - NewItem(id, Tools::NodePoint, mode, NodeDetail::Contour); + NewItem(id, Tool::NodePoint, mode, NodeDetail::Contour); break; case(Scene::Spline): - NewItem(id, Tools::NodeSpline, mode, NodeDetail::Contour); + NewItem(id, Tool::NodeSpline, mode, NodeDetail::Contour); break; case(Scene::SplinePath): - NewItem(id, Tools::NodeSplinePath, mode, NodeDetail::Contour); + NewItem(id, Tool::NodeSplinePath, mode, NodeDetail::Contour); break; default: qWarning()<<"Get wrong scene object. Ignore."; @@ -76,10 +76,10 @@ void DialogDetail::DialogAccepted(){ emit DialogClosed(QDialog::Accepted); } -void DialogDetail::NewItem(qint64 id, Tools::Enum typeTool, Draw::Mode mode, NodeDetail::Type typeNode){ +void DialogDetail::NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode){ QString name; switch(typeTool){ - case(Tools::NodePoint):{ + case(Tool::NodePoint):{ VPointF point; if(mode == Draw::Calculation){ point = data->GetPoint(id); @@ -89,7 +89,7 @@ void DialogDetail::NewItem(qint64 id, Tools::Enum typeTool, Draw::Mode mode, Nod name = point.name(); break; } - case(Tools::NodeArc):{ + case(Tool::NodeArc):{ VArc arc; if(mode == Draw::Calculation){ arc = data->GetArc(id); @@ -99,7 +99,7 @@ void DialogDetail::NewItem(qint64 id, Tools::Enum typeTool, Draw::Mode mode, Nod name = data->GetNameArc(arc.GetCenter(), id, mode); break; } - case(Tools::NodeSpline):{ + case(Tool::NodeSpline):{ VSpline spl; if(mode == Draw::Calculation){ spl = data->GetSpline(id); @@ -109,7 +109,7 @@ void DialogDetail::NewItem(qint64 id, Tools::Enum typeTool, Draw::Mode mode, Nod name = spl.GetName(); break; } - case(Tools::NodeSplinePath):{ + case(Tool::NodeSplinePath):{ VSplinePath splPath; if(mode == Draw::Calculation){ splPath = data->GetSplinePath(id); diff --git a/dialogs/dialogdetail.h b/dialogs/dialogdetail.h index 85e3d5d70..6086318ae 100644 --- a/dialogs/dialogdetail.h +++ b/dialogs/dialogdetail.h @@ -31,17 +31,17 @@ class DialogDetail : public DialogTool { Q_OBJECT public: - explicit DialogDetail(const VContainer *data, Draw::Mode mode, QWidget *parent = 0); + explicit DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent = 0); VDetail getDetails() const; void setDetails(const VDetail &value); public slots: - virtual void ChoosedObject(qint64 id, Scene::Type type); + virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void DialogAccepted(); private: Ui::DialogDetail ui; VDetail details; - void NewItem(qint64 id, Tools::Enum typeTool, Draw::Mode mode, NodeDetail::Type typeNode); + void NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode); }; #endif // DIALOGDETAIL_H diff --git a/dialogs/dialogendline.cpp b/dialogs/dialogendline.cpp index f9b335e1b..def24c322 100644 --- a/dialogs/dialogendline.cpp +++ b/dialogs/dialogendline.cpp @@ -26,7 +26,7 @@ #include "container/vpointf.h" #include "container/calculator.h" -DialogEndLine::DialogEndLine(const VContainer *data, Draw::Mode mode, QWidget *parent) : +DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogTool(data, mode, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()), formula(QString()), angle(0), basePointId(0){ ui->setupUi(this); @@ -79,7 +79,7 @@ DialogEndLine::DialogEndLine(const VContainer *data, Draw::Mode mode, QWidget *p connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogEndLine::FormulaChanged); } -void DialogEndLine::ChoosedObject(qint64 id, Scene::Type type){ +void DialogEndLine::ChoosedObject(qint64 id, Scene::Scenes type){ if(idDetail == 0 && mode == Draw::Modeling){ if(type == Scene::Detail){ idDetail = id; diff --git a/dialogs/dialogendline.h b/dialogs/dialogendline.h index d80ce1e0d..47852b9cf 100644 --- a/dialogs/dialogendline.h +++ b/dialogs/dialogendline.h @@ -38,7 +38,7 @@ class DialogEndLine : public DialogTool { Q_OBJECT public: - explicit DialogEndLine(const VContainer *data, Draw::Mode mode = Draw::Calculation, + explicit DialogEndLine(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); ~DialogEndLine(); QString getPointName() const; @@ -52,7 +52,7 @@ public: qint64 getBasePointId() const; void setBasePointId(const qint64 &value, const qint64 &id); public slots: - virtual void ChoosedObject(qint64 id, Scene::Type type); + virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void DialogAccepted(); private: Q_DISABLE_COPY(DialogEndLine) diff --git a/dialogs/dialoghistory.cpp b/dialogs/dialoghistory.cpp index d45b5ffde..d343e09f6 100644 --- a/dialogs/dialoghistory.cpp +++ b/dialogs/dialoghistory.cpp @@ -144,12 +144,12 @@ QString DialogHistory::Record(const VToolRecord &tool){ qint64 center = 0; QDomElement domElement; switch( tool.getTypeTool() ){ - case Tools::ArrowTool: + case Tool::ArrowTool: break; - case Tools::SinglePointTool: + case Tool::SinglePointTool: record = QString("%1 - Базова точка").arg(data->GetPoint(tool.getId()).name()); break; - case Tools::EndLineTool: + case Tool::EndLineTool: domElement = doc->elementById(QString().setNum(tool.getId())); if(domElement.isElement()){ basePointId = domElement.attribute("basePoint", "").toLongLong(); @@ -157,7 +157,7 @@ QString DialogHistory::Record(const VToolRecord &tool){ record = QString("%1_%2 - Відрізок з точки %1 до точки %2").arg(data->GetPoint(basePointId).name(), data->GetPoint(tool.getId()).name()); break; - case Tools::LineTool: + case Tool::LineTool: domElement = doc->elementById(QString().setNum(tool.getId())); if(domElement.isElement()){ firstPointId = domElement.attribute("firstPoint", "").toLongLong(); @@ -166,7 +166,7 @@ QString DialogHistory::Record(const VToolRecord &tool){ record = QString("%1_%2 - Лінія з точки %1 до точки %2").arg(data->GetPoint(firstPointId).name(), data->GetPoint(secondPointId).name()); break; - case Tools::AlongLineTool: + case Tool::AlongLineTool: domElement = doc->elementById(QString().setNum(tool.getId())); if(domElement.isElement()){ basePointId = domElement.attribute("firstPoint", "").toLongLong(); @@ -176,10 +176,10 @@ QString DialogHistory::Record(const VToolRecord &tool){ data->GetPoint(secondPointId).name(), data->GetPoint(tool.getId()).name()); break; - case Tools::ShoulderPointTool: + case Tool::ShoulderPointTool: record = QString("%1 - Плечева точка").arg(data->GetPoint(tool.getId()).name()); break; - case Tools::NormalTool: + case Tool::NormalTool: domElement = doc->elementById(QString().setNum(tool.getId())); if(domElement.isElement()){ basePointId = domElement.attribute("firstPoint", "").toLongLong(); @@ -189,7 +189,7 @@ QString DialogHistory::Record(const VToolRecord &tool){ data->GetPoint(secondPointId).name(), data->GetPoint(tool.getId()).name()); break; - case Tools::BisectorTool: + case Tool::BisectorTool: domElement = doc->elementById(QString().setNum(tool.getId())); if(domElement.isElement()){ firstPointId = domElement.attribute("firstPoint", "").toLongLong(); @@ -201,7 +201,7 @@ QString DialogHistory::Record(const VToolRecord &tool){ data->GetPoint(thirdPointId).name(), data->GetPoint(tool.getId()).name()); break; - case Tools::LineIntersectTool: + case Tool::LineIntersectTool: domElement = doc->elementById(QString().setNum(tool.getId())); if(domElement.isElement()){ p1Line1 = domElement.attribute("p1Line1", "").toLongLong(); @@ -215,18 +215,18 @@ QString DialogHistory::Record(const VToolRecord &tool){ data->GetPoint(p2Line2).name(), data->GetPoint(tool.getId()).name()); break; - case Tools::SplineTool:{ + case Tool::SplineTool:{ VSpline spl = data->GetSpline(tool.getId()); record = QString("Сплайн %1_%2").arg(data->GetPoint(spl.GetP1()).name(), data->GetPoint(spl.GetP4()).name()); } break; - case Tools::ArcTool:{ + case Tool::ArcTool:{ VArc arc = data->GetArc(tool.getId()); record = QString("Дуга з центром в точці %1").arg(data->GetPoint(arc.GetCenter()).name()); } break; - case Tools::SplinePathTool:{ + case Tool::SplinePathTool:{ VSplinePath splPath = data->GetSplinePath(tool.getId()); QVector points = splPath.GetSplinePath(); if(points.size() != 0 ){ @@ -238,7 +238,7 @@ QString DialogHistory::Record(const VToolRecord &tool){ } } break; - case Tools::PointOfContact: + case Tool::PointOfContact: domElement = doc->elementById(QString().setNum(tool.getId())); if(domElement.isElement()){ center = domElement.attribute("center", "").toLongLong(); diff --git a/dialogs/dialogline.cpp b/dialogs/dialogline.cpp index 0bfcbec89..3c0da94b8 100644 --- a/dialogs/dialogline.cpp +++ b/dialogs/dialogline.cpp @@ -24,7 +24,7 @@ #include #include -DialogLine::DialogLine(const VContainer *data, Draw::Mode mode, QWidget *parent) : +DialogLine::DialogLine(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogTool(data, mode, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0){ ui->setupUi(this); bOk = ui->buttonBox->button(QDialogButtonBox::Ok); @@ -75,7 +75,7 @@ void DialogLine::DialogAccepted(){ DialogClosed(QDialog::Accepted); } -void DialogLine::ChoosedObject(qint64 id, Scene::Type type){ +void DialogLine::ChoosedObject(qint64 id, Scene::Scenes type){ if(idDetail == 0 && mode == Draw::Modeling){ if(type == Scene::Detail){ idDetail = id; diff --git a/dialogs/dialogline.h b/dialogs/dialogline.h index 63f438d40..f5a525294 100644 --- a/dialogs/dialogline.h +++ b/dialogs/dialogline.h @@ -36,7 +36,7 @@ class DialogLine : public DialogTool { Q_OBJECT public: - explicit DialogLine(const VContainer *data, Draw::Mode mode = Draw::Calculation, + explicit DialogLine(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); ~DialogLine(); qint64 getFirstPoint() const; @@ -44,7 +44,7 @@ public: qint64 getSecondPoint() const; void setSecondPoint(const qint64 &value); public slots: - void ChoosedObject(qint64 id, Scene::Type type); + void ChoosedObject(qint64 id, Scene::Scenes type); virtual void DialogAccepted(); private: Q_DISABLE_COPY(DialogLine) diff --git a/dialogs/dialoglineintersect.cpp b/dialogs/dialoglineintersect.cpp index 7f019506a..795a6f132 100644 --- a/dialogs/dialoglineintersect.cpp +++ b/dialogs/dialoglineintersect.cpp @@ -22,7 +22,7 @@ #include "dialoglineintersect.h" #include "ui_dialoglineintersect.h" -DialogLineIntersect::DialogLineIntersect(const VContainer *data, Draw::Mode mode, QWidget *parent) : +DialogLineIntersect::DialogLineIntersect(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogTool(data, mode, parent), ui(new Ui::DialogLineIntersect), number(0), pointName(QString()), p1Line1(0), p2Line1(0), p1Line2(0), p2Line2(0), flagPoint(true){ ui->setupUi(this); @@ -45,7 +45,7 @@ DialogLineIntersect::~DialogLineIntersect() delete ui; } -void DialogLineIntersect::ChoosedObject(qint64 id, Scene::Type type){ +void DialogLineIntersect::ChoosedObject(qint64 id, Scene::Scenes type){ if(idDetail == 0 && mode == Draw::Modeling){ if(type == Scene::Detail){ idDetail = id; diff --git a/dialogs/dialoglineintersect.h b/dialogs/dialoglineintersect.h index 0739a046d..4f2f586b8 100644 --- a/dialogs/dialoglineintersect.h +++ b/dialogs/dialoglineintersect.h @@ -32,7 +32,7 @@ class DialogLineIntersect : public DialogTool { Q_OBJECT public: - explicit DialogLineIntersect(const VContainer *data, Draw::Mode mode = Draw::Calculation, + explicit DialogLineIntersect(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); ~DialogLineIntersect(); qint64 getP1Line1() const; @@ -46,7 +46,7 @@ public: QString getPointName() const; void setPointName(const QString &value); public slots: - virtual void ChoosedObject(qint64 id, Scene::Type type); + virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void DialogAccepted(); void P1Line1Changed( int index); void P2Line1Changed( int index); diff --git a/dialogs/dialognormal.cpp b/dialogs/dialognormal.cpp index 9ed29fdd9..8e79ee9d4 100644 --- a/dialogs/dialognormal.cpp +++ b/dialogs/dialognormal.cpp @@ -23,7 +23,7 @@ #include "ui_dialognormal.h" #include -DialogNormal::DialogNormal(const VContainer *data, Draw::Mode mode, QWidget *parent) : +DialogNormal::DialogNormal(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogTool(data, mode, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()), typeLine(QString()), formula(QString()), angle(0), firstPointId(0), secondPointId(0){ ui->setupUi(this); @@ -82,7 +82,7 @@ DialogNormal::~DialogNormal() delete ui; } -void DialogNormal::ChoosedObject(qint64 id, Scene::Type type){ +void DialogNormal::ChoosedObject(qint64 id, Scene::Scenes type){ if(idDetail == 0 && mode == Draw::Modeling){ if(type == Scene::Detail){ idDetail = id; diff --git a/dialogs/dialognormal.h b/dialogs/dialognormal.h index 497d515cb..b8010fb6b 100644 --- a/dialogs/dialognormal.h +++ b/dialogs/dialognormal.h @@ -38,7 +38,7 @@ class DialogNormal : public DialogTool { Q_OBJECT public: - explicit DialogNormal(const VContainer *data, Draw::Mode mode = Draw::Calculation, + explicit DialogNormal(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); ~DialogNormal(); QString getPointName() const; @@ -54,7 +54,7 @@ public: qint64 getSecondPointId() const; void setSecondPointId(const qint64 &value, const qint64 &id); public slots: - virtual void ChoosedObject(qint64 id, Scene::Type type); + virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void DialogAccepted(); private: Q_DISABLE_COPY(DialogNormal) diff --git a/dialogs/dialogpointofcontact.cpp b/dialogs/dialogpointofcontact.cpp index 2782ad923..2c7151103 100644 --- a/dialogs/dialogpointofcontact.cpp +++ b/dialogs/dialogpointofcontact.cpp @@ -21,7 +21,7 @@ #include "dialogpointofcontact.h" -DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Mode mode, QWidget *parent) : +DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogTool(data, mode, parent), ui(), number(0), pointName(QString()), radius(QString()), center(0), firstPoint(0), secondPoint(0){ ui.setupUi(this); @@ -58,7 +58,7 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Mode mo connect(ui.lineEditFormula, &QLineEdit::textChanged, this, &DialogPointOfContact::FormulaChanged); } -void DialogPointOfContact::ChoosedObject(qint64 id, Scene::Type type){ +void DialogPointOfContact::ChoosedObject(qint64 id, Scene::Scenes type){ if(idDetail == 0 && mode == Draw::Modeling){ if(type == Scene::Detail){ idDetail = id; diff --git a/dialogs/dialogpointofcontact.h b/dialogs/dialogpointofcontact.h index 601d1b622..01b60d737 100644 --- a/dialogs/dialogpointofcontact.h +++ b/dialogs/dialogpointofcontact.h @@ -33,7 +33,7 @@ class DialogPointOfContact : public DialogTool Q_OBJECT public: - explicit DialogPointOfContact(const VContainer *data, Draw::Mode mode = Draw::Calculation, + explicit DialogPointOfContact(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); QString getPointName() const; void setPointName(const QString &value); @@ -51,7 +51,7 @@ public: void setSecondPoint(const qint64 &value, const qint64 &id); public slots: - virtual void ChoosedObject(qint64 id, Scene::Type type); + virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void DialogAccepted(); private: Q_DISABLE_COPY(DialogPointOfContact) diff --git a/dialogs/dialogshoulderpoint.cpp b/dialogs/dialogshoulderpoint.cpp index 62837969a..be28ab325 100644 --- a/dialogs/dialogshoulderpoint.cpp +++ b/dialogs/dialogshoulderpoint.cpp @@ -22,7 +22,7 @@ #include "dialogshoulderpoint.h" #include "ui_dialogshoulderpoint.h" -DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, Draw::Mode mode, QWidget *parent) : +DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogTool(data, mode, parent), ui(new Ui::DialogShoulderPoint), number(0), pointName(QString()), typeLine(QString()), formula(QString()), p1Line(0), p2Line(0), pShoulder(0){ ui->setupUi(this); @@ -66,7 +66,7 @@ DialogShoulderPoint::~DialogShoulderPoint() delete ui; } -void DialogShoulderPoint::ChoosedObject(qint64 id, Scene::Type type){ +void DialogShoulderPoint::ChoosedObject(qint64 id, Scene::Scenes type){ if(idDetail == 0 && mode == Draw::Modeling){ if(type == Scene::Detail){ idDetail = id; diff --git a/dialogs/dialogshoulderpoint.h b/dialogs/dialogshoulderpoint.h index b988632c8..d776062fb 100644 --- a/dialogs/dialogshoulderpoint.h +++ b/dialogs/dialogshoulderpoint.h @@ -35,7 +35,7 @@ class DialogShoulderPoint : public DialogTool { Q_OBJECT public: - explicit DialogShoulderPoint(const VContainer *data, Draw::Mode mode = Draw::Calculation, + explicit DialogShoulderPoint(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); ~DialogShoulderPoint(); QString getPointName() const; @@ -51,7 +51,7 @@ public: qint64 getPShoulder() const; void setPShoulder(const qint64 &value, const qint64 &id); public slots: - virtual void ChoosedObject(qint64 id, Scene::Type type); + virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void DialogAccepted(); private: Q_DISABLE_COPY(DialogShoulderPoint) diff --git a/dialogs/dialogspline.cpp b/dialogs/dialogspline.cpp index 4e435aa98..c264d0424 100644 --- a/dialogs/dialogspline.cpp +++ b/dialogs/dialogspline.cpp @@ -22,7 +22,7 @@ #include "dialogspline.h" #include "ui_dialogspline.h" -DialogSpline::DialogSpline(const VContainer *data, Draw::Mode mode, QWidget *parent) : +DialogSpline::DialogSpline(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogTool(data, mode, parent), ui(new Ui::DialogSpline), number(0), p1(0), p4(0), angle1(0), angle2(0), kAsm1(1), kAsm2(1), kCurve(1){ ui->setupUi(this); @@ -41,7 +41,7 @@ DialogSpline::~DialogSpline(){ delete ui; } -void DialogSpline::ChoosedObject(qint64 id, Scene::Type type){ +void DialogSpline::ChoosedObject(qint64 id, Scene::Scenes type){ if(idDetail == 0 && mode == Draw::Modeling){ if(type == Scene::Detail){ idDetail = id; diff --git a/dialogs/dialogspline.h b/dialogs/dialogspline.h index 7485a3ee3..1f2a6c035 100644 --- a/dialogs/dialogspline.h +++ b/dialogs/dialogspline.h @@ -33,7 +33,7 @@ class DialogSpline : public DialogTool { Q_OBJECT public: - explicit DialogSpline(const VContainer *data, Draw::Mode mode = Draw::Calculation, + explicit DialogSpline(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); ~DialogSpline(); qint64 getP1() const; @@ -51,7 +51,7 @@ public: qreal getKCurve() const; void setKCurve(const qreal &value); public slots: - virtual void ChoosedObject(qint64 id, Scene::Type type); + virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void DialogAccepted(); private: Q_DISABLE_COPY(DialogSpline) diff --git a/dialogs/dialogsplinepath.cpp b/dialogs/dialogsplinepath.cpp index 68de8eb4a..aa889010b 100644 --- a/dialogs/dialogsplinepath.cpp +++ b/dialogs/dialogsplinepath.cpp @@ -23,7 +23,7 @@ #include "ui_dialogsplinepath.h" #include "geometry/vsplinepoint.h" -DialogSplinePath::DialogSplinePath(const VContainer *data, Draw::Mode mode, QWidget *parent) : +DialogSplinePath::DialogSplinePath(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogTool(data, mode, parent), ui(new Ui::DialogSplinePath), path(VSplinePath()){ ui->setupUi(this); bOk = ui->buttonBox->button(QDialogButtonBox::Ok); @@ -68,7 +68,7 @@ void DialogSplinePath::SetPath(const VSplinePath &value){ } -void DialogSplinePath::ChoosedObject(qint64 id, Scene::Type type){ +void DialogSplinePath::ChoosedObject(qint64 id, Scene::Scenes type){ if(idDetail == 0 && mode == Draw::Modeling){ if(type == Scene::Detail){ idDetail = id; diff --git a/dialogs/dialogsplinepath.h b/dialogs/dialogsplinepath.h index de85abf4c..683c44351 100644 --- a/dialogs/dialogsplinepath.h +++ b/dialogs/dialogsplinepath.h @@ -34,13 +34,13 @@ class DialogSplinePath : public DialogTool { Q_OBJECT public: - explicit DialogSplinePath(const VContainer *data, Draw::Mode mode = Draw::Calculation, + explicit DialogSplinePath(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); ~DialogSplinePath(); VSplinePath GetPath() const; void SetPath(const VSplinePath &value); public slots: - virtual void ChoosedObject(qint64 id, Scene::Type type); + virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void DialogAccepted(); void PointChenged(int row); void currentPointChanged( int index ); diff --git a/dialogs/dialogtool.cpp b/dialogs/dialogtool.cpp index 3b39d0b26..2c9db774e 100644 --- a/dialogs/dialogtool.cpp +++ b/dialogs/dialogtool.cpp @@ -26,7 +26,7 @@ #include "geometry/vdetail.h" #include -DialogTool::DialogTool(const VContainer *data, Draw::Mode mode, QWidget *parent):QDialog(parent), data(data), +DialogTool::DialogTool(const VContainer *data, Draw::Draws mode, QWidget *parent):QDialog(parent), data(data), isInitialized(false), flagName(true), flagFormula(true), timerFormula(0), bOk(0), spinBoxAngle(0), lineEditFormula(0), listWidget(0), labelResultCalculation(0), labelDescription(0), radioButtonSizeGrowth(0), radioButtonStandartTable(0), radioButtonIncrements(0), @@ -74,14 +74,14 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const{ } VDetail det = data->GetDetail(idDetail); for(qint32 i = 0; i< det.CountNode(); ++i){ - if(det[i].getTypeTool() == Tools::NodePoint || - det[i].getTypeTool() == Tools::AlongLineTool || - det[i].getTypeTool() == Tools::BisectorTool || - det[i].getTypeTool() == Tools::EndLineTool || - det[i].getTypeTool() == Tools::LineIntersectTool || - det[i].getTypeTool() == Tools::NormalTool || - det[i].getTypeTool() == Tools::PointOfContact || - det[i].getTypeTool() == Tools::ShoulderPointTool){ + if(det[i].getTypeTool() == Tool::NodePoint || + det[i].getTypeTool() == Tool::AlongLineTool || + det[i].getTypeTool() == Tool::BisectorTool || + det[i].getTypeTool() == Tool::EndLineTool || + det[i].getTypeTool() == Tool::LineIntersectTool || + det[i].getTypeTool() == Tool::NormalTool || + det[i].getTypeTool() == Tool::PointOfContact || + det[i].getTypeTool() == Tool::ShoulderPointTool){ if(det[i].getId() != id){ VPointF point = data->GetModelingPoint(det[i].getId()); box->addItem(point.name(), det[i].getId()); @@ -200,7 +200,7 @@ void DialogTool::CheckState(){ } -void DialogTool::ChoosedObject(qint64 id, Scene::Type type){ +void DialogTool::ChoosedObject(qint64 id, Scene::Scenes type){ Q_UNUSED(id); Q_UNUSED(type); } diff --git a/dialogs/dialogtool.h b/dialogs/dialogtool.h index ece39cf5a..0b28920f9 100644 --- a/dialogs/dialogtool.h +++ b/dialogs/dialogtool.h @@ -38,7 +38,7 @@ class DialogTool : public QDialog { Q_OBJECT public: - DialogTool(const VContainer *data, Draw::Mode mode = Draw::Calculation, + DialogTool(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); virtual ~DialogTool(); qint64 getIdDetail() const; @@ -46,7 +46,7 @@ public: signals: void DialogClosed(int result); public slots: - virtual void ChoosedObject(qint64 id, Scene::Type type); + virtual void ChoosedObject(qint64 id, Scene::Scenes type); void NamePointChanged(); virtual void DialogAccepted(); virtual void DialogRejected(); @@ -86,7 +86,7 @@ protected: QRadioButton *radioButtonIncrements; QRadioButton *radioButtonLengthLine; qint64 idDetail; - Draw::Mode mode; + Draw::Draws mode; bool CheckObject(const qint64 &id); virtual void closeEvent ( QCloseEvent * event ); virtual void showEvent( QShowEvent *event ); diff --git a/geometry/varc.cpp b/geometry/varc.cpp index 437f37ad0..a0194bc11 100644 --- a/geometry/varc.cpp +++ b/geometry/varc.cpp @@ -29,7 +29,7 @@ VArc::VArc () : f1(0), formulaF1(QString()), f2(0), formulaF2(QString()), radius } VArc::VArc (const QMap *points, qint64 center, qreal radius, QString formulaRadius, - qreal f1, QString formulaF1, qreal f2, QString formulaF2, Draw::Mode mode, qint64 idObject) + qreal f1, QString formulaF1, qreal f2, QString formulaF2, Draw::Draws mode, qint64 idObject) : f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2), radius(radius), formulaRadius(formulaRadius), center(center), points(points), _referens(0), mode(mode), idObject(idObject){ } @@ -213,12 +213,12 @@ void VArc::decrementReferens(){ } -Draw::Mode VArc::getMode() const +Draw::Draws VArc::getMode() const { return mode; } -void VArc::setMode(const Draw::Mode &value) +void VArc::setMode(const Draw::Draws &value) { mode = value; } diff --git a/geometry/varc.h b/geometry/varc.h index dcfe55abb..2bd06c6b0 100644 --- a/geometry/varc.h +++ b/geometry/varc.h @@ -46,7 +46,7 @@ public: */ VArc (const QMap *points, qint64 center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2 , QString formulaF2, - Draw::Mode mode = Draw::Calculation, qint64 idObject = 0); + Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); VArc(const VArc &arc); VArc& operator= (const VArc &arc); /** @@ -101,8 +101,8 @@ public: qint32 referens() const; void incrementReferens(); void decrementReferens(); - Draw::Mode getMode() const; - void setMode(const Draw::Mode &value); + Draw::Draws getMode() const; + void setMode(const Draw::Draws &value); qint64 getIdObject() const; void setIdObject(const qint64 &value); @@ -129,7 +129,7 @@ private: qint64 center; const QMap *points; qint32 _referens; - Draw::Mode mode; + Draw::Draws mode; qint64 idObject; }; diff --git a/geometry/vdetail.h b/geometry/vdetail.h index c3a50cd06..0c314604a 100644 --- a/geometry/vdetail.h +++ b/geometry/vdetail.h @@ -27,19 +27,15 @@ #include #include -namespace Detail{ - enum Contour - { - OpenContour, - CloseContour - }; +namespace Detail { + enum Contour { OpenContour, CloseContour }; + Q_DECLARE_FLAGS(Contours, Contour) - enum Equidistant - { - OpenEquidistant, - CloseEquidistant - }; + enum Equidistant { OpenEquidistant, CloseEquidistant }; + Q_DECLARE_FLAGS(Equidistants, Equidistant) } +Q_DECLARE_OPERATORS_FOR_FLAGS(Detail::Contours) +Q_DECLARE_OPERATORS_FOR_FLAGS(Detail::Equidistants) class VDetail { diff --git a/geometry/vnodedetail.cpp b/geometry/vnodedetail.cpp index d50ca288d..e1392e22e 100644 --- a/geometry/vnodedetail.cpp +++ b/geometry/vnodedetail.cpp @@ -21,11 +21,11 @@ #include "vnodedetail.h" -VNodeDetail::VNodeDetail():id(0), typeTool(Tools::NodePoint), mode(Draw::Calculation), +VNodeDetail::VNodeDetail():id(0), typeTool(Tool::NodePoint), mode(Draw::Calculation), typeNode(NodeDetail::Contour){ } -VNodeDetail::VNodeDetail(qint64 id, Tools::Enum typeTool, Draw::Mode mode, NodeDetail::Type typeNode):id(id), +VNodeDetail::VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode):id(id), typeTool(typeTool), mode(mode), typeNode(typeNode){ } @@ -33,11 +33,11 @@ VNodeDetail::VNodeDetail(const VNodeDetail &node):id(node.getId()), typeTool(nod mode(node.getMode()), typeNode(node.getTypeNode()){ } -Tools::Enum VNodeDetail::getTypeTool() const{ +Tool::Tools VNodeDetail::getTypeTool() const{ return typeTool; } -void VNodeDetail::setTypeTool(const Tools::Enum &value){ +void VNodeDetail::setTypeTool(const Tool::Tools &value){ typeTool = value; } @@ -49,18 +49,18 @@ void VNodeDetail::setId(const qint64 &value){ id = value; } -Draw::Mode VNodeDetail::getMode() const{ +Draw::Draws VNodeDetail::getMode() const{ return mode; } -void VNodeDetail::setMode(const Draw::Mode &value){ +void VNodeDetail::setMode(const Draw::Draws &value){ mode = value; } -NodeDetail::Type VNodeDetail::getTypeNode() const{ +NodeDetail::NodeDetails VNodeDetail::getTypeNode() const{ return typeNode; } -void VNodeDetail::setTypeNode(const NodeDetail::Type &value){ +void VNodeDetail::setTypeNode(const NodeDetail::NodeDetails &value){ typeNode = value; } diff --git a/geometry/vnodedetail.h b/geometry/vnodedetail.h index eeefc30ae..7ea0da2c3 100644 --- a/geometry/vnodedetail.h +++ b/geometry/vnodedetail.h @@ -26,34 +26,32 @@ #include #include "options.h" -namespace NodeDetail{ - enum Type - { - Contour, - Modeling - }; +namespace NodeDetail { + enum NodeDetail { Contour, Modeling }; + Q_DECLARE_FLAGS(NodeDetails, NodeDetail) } +Q_DECLARE_OPERATORS_FOR_FLAGS(NodeDetail::NodeDetails) class VNodeDetail { public: VNodeDetail(); - VNodeDetail(qint64 id, Tools::Enum typeTool, Draw::Mode mode, NodeDetail::Type typeNode); + VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode); VNodeDetail(const VNodeDetail &node); qint64 getId() const; void setId(const qint64 &value); - Tools::Enum getTypeTool() const; - void setTypeTool(const Tools::Enum &value); - Draw::Mode getMode() const; - void setMode(const Draw::Mode &value); - NodeDetail::Type getTypeNode() const; - void setTypeNode(const NodeDetail::Type &value); + Tool::Tools getTypeTool() const; + void setTypeTool(const Tool::Tools &value); + Draw::Draws getMode() const; + void setMode(const Draw::Draws &value); + NodeDetail::NodeDetails getTypeNode() const; + void setTypeNode(const NodeDetail::NodeDetails &value); private: qint64 id; - Tools::Enum typeTool; - Draw::Mode mode; - NodeDetail::Type typeNode; + Tool::Tools typeTool; + Draw::Draws mode; + NodeDetail::NodeDetails typeNode; }; Q_DECLARE_METATYPE(VNodeDetail) diff --git a/geometry/vspline.cpp b/geometry/vspline.cpp index cd7483189..ad1f1b189 100644 --- a/geometry/vspline.cpp +++ b/geometry/vspline.cpp @@ -35,14 +35,14 @@ VSpline::VSpline ( const VSpline & spline ):p1(spline.GetP1 ()), p2(spline.GetP2 } VSpline::VSpline (const QMap *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2, - qreal kAsm1, qreal kAsm2 , qreal kCurve, Draw::Mode mode, qint64 idObject):p1(p1), p2(QPointF()), p3(QPointF()), + qreal kAsm1, qreal kAsm2 , qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(QPointF()), p3(QPointF()), p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2), kCurve(kCurve), points(points), _referens(0), mode(mode), idObject(idObject){ ModifiSpl ( p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve ); } VSpline::VSpline (const QMap *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4, - qreal kCurve, Draw::Mode mode, qint64 idObject):p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1), kAsm2(1), + qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1), kAsm2(1), kCurve(1), points(points), _referens(0), mode(mode), idObject(idObject){ ModifiSpl ( p1, p2, p3, p4, kCurve); } @@ -768,11 +768,11 @@ qint32 VSpline::Cubic(qreal *x, qreal a, qreal b, qreal c){ // this->ModifiSpl(P1, P2, P3, P4); //} -Draw::Mode VSpline::getMode() const{ +Draw::Draws VSpline::getMode() const{ return mode; } -void VSpline::setMode(const Draw::Mode &value){ +void VSpline::setMode(const Draw::Draws &value){ mode = value; } diff --git a/geometry/vspline.h b/geometry/vspline.h index 9c26862c1..38dff39ab 100644 --- a/geometry/vspline.h +++ b/geometry/vspline.h @@ -53,7 +53,7 @@ public: */ VSpline (const QMap *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve, - Draw::Mode mode = Draw::Calculation, qint64 idObject = 0); + Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); /** * @brief VSpline конструктор. * @param p1 початкова точка сплайну. @@ -62,7 +62,7 @@ public: * @param p4 кінцева точка сплайну. */ VSpline (const QMap *points, qint64 p1, QPointF p2, QPointF p3, - qint64 p4, qreal kCurve, Draw::Mode mode = Draw::Calculation, + qint64 p4, qreal kCurve, Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); /** * @brief ModifiSpl модифікує сплайн. @@ -183,8 +183,8 @@ public: qint32 referens() const; void incrementReferens(); void decrementReferens(); - Draw::Mode getMode() const; - void setMode(const Draw::Mode &value); + Draw::Draws getMode() const; + void setMode(const Draw::Draws &value); static QVector SplinePoints(QPointF p1, QPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve); qint64 getIdObject() const; @@ -230,7 +230,7 @@ private: qreal kCurve; const QMap *points; qint32 _referens; - Draw::Mode mode; + Draw::Draws mode; qint64 idObject; /** * @brief LengthBezier повертає дожину сплайну за його чотирьма точками. diff --git a/geometry/vsplinepath.cpp b/geometry/vsplinepath.cpp index 2cbe50d57..ab1d5da7f 100644 --- a/geometry/vsplinepath.cpp +++ b/geometry/vsplinepath.cpp @@ -25,7 +25,7 @@ VSplinePath::VSplinePath(): path(QVector()), kCurve(1), mode(Draw: _referens(0), idObject(0){ } -VSplinePath::VSplinePath(const QMap *points, qreal kCurve, Draw::Mode mode, qint64 idObject): path(QVector()), +VSplinePath::VSplinePath(const QMap *points, qreal kCurve, Draw::Draws mode, qint64 idObject): path(QVector()), kCurve(kCurve), mode(mode), points(points), _referens(0), idObject(idObject){ } @@ -34,11 +34,11 @@ VSplinePath::VSplinePath(const VSplinePath &splPath): path(*splPath.GetPoint()), idObject(splPath.getIdObject()){ } -Draw::Mode VSplinePath::getMode() const{ +Draw::Draws VSplinePath::getMode() const{ return mode; } -void VSplinePath::setMode(const Draw::Mode &value){ +void VSplinePath::setMode(const Draw::Draws &value){ mode = value; } diff --git a/geometry/vsplinepath.h b/geometry/vsplinepath.h index c8c15a700..b78fabb97 100644 --- a/geometry/vsplinepath.h +++ b/geometry/vsplinepath.h @@ -48,7 +48,7 @@ public: * @brief VSplinePath конструктор по замовчуванню. */ VSplinePath(const QMap *points, qreal kCurve = 1, - Draw::Mode mode = Draw::Calculation, qint64 idObject = 0); + Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); VSplinePath(const VSplinePath& splPath); /** * @brief append додає точку сплайну до шляху. @@ -77,8 +77,8 @@ public: qint32 referens() const; void incrementReferens(); void decrementReferens(); - Draw::Mode getMode() const; - void setMode(const Draw::Mode &value); + Draw::Draws getMode() const; + void setMode(const Draw::Draws &value); qint64 getIdObject() const; void setIdObject(const qint64 &value); @@ -89,7 +89,7 @@ protected: */ QVector path; qreal kCurve; - Draw::Mode mode; + Draw::Draws mode; const QMap *points; qint32 _referens; qint64 idObject; diff --git a/mainwindow.cpp b/mainwindow.cpp index 3c18f6783..3455b67f2 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -37,7 +37,7 @@ #include "exception/vexceptionwrongparameterid.h" MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), ui(new Ui::MainWindow), tool(Tools::ArrowTool), currentScene(0), sceneDraw(0), + QMainWindow(parent), ui(new Ui::MainWindow), tool(Tool::ArrowTool), currentScene(0), sceneDraw(0), sceneDetails(0), mouseCoordinate(0), helpLabel(0), view(0), isInitialized(false), dialogTable(0), dialogEndLine(QSharedPointer()), dialogLine(QSharedPointer()), dialogAlongLine(QSharedPointer()), @@ -152,7 +152,7 @@ void MainWindow::ActionNewDraw(){ connect(spoint, &VToolPoint::ChoosedTool, sceneDraw, &VMainGraphicsScene::ChoosedItem); QMap* tools = doc->getTools(); tools->insert(id, spoint); - VDrawTool::AddRecord(id, Tools::SinglePointTool, doc); + VDrawTool::AddRecord(id, Tool::SinglePointTool, doc); SetEnableTool(true); SetEnableWidgets(true); changeInFile = true; @@ -191,7 +191,7 @@ void MainWindow::OptionDraw(){ } template -void MainWindow::SetToolButton(bool checked, Tools::Enum t, const QString &cursor, +void MainWindow::SetToolButton(bool checked, Tool::Tools t, const QString &cursor, QSharedPointer &dialog, Func closeDialogSlot){ if(checked){ CanselTool(); @@ -211,8 +211,8 @@ void MainWindow::SetToolButton(bool checked, Tools::Enum t, const QString &curso } } -template -void MainWindow::AddToolToDetail(Tool *tool, const qint64 &id, Tools::Enum typeTool, +template +void MainWindow::AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool, const qint64 &idDetail){ QMap* tools = doc->getTools(); VToolDetail *det = qobject_cast(tools->value(idDetail)); @@ -221,7 +221,7 @@ void MainWindow::AddToolToDetail(Tool *tool, const qint64 &id, Tools::Enum typeT } void MainWindow::ToolEndLine(bool checked){ - SetToolButton(checked, Tools::EndLineTool, ":/cursor/endline_cursor.png", dialogEndLine, + SetToolButton(checked, Tool::EndLineTool, ":/cursor/endline_cursor.png", dialogEndLine, &MainWindow::ClosedDialogEndLine); } @@ -231,14 +231,14 @@ void MainWindow::ClosedDialogEndLine(int result){ VToolEndLine::Create(dialogEndLine, currentScene, doc, data); } else { VModelingEndLine *endLine = VModelingEndLine::Create(dialogEndLine, doc, data); - AddToolToDetail(endLine, endLine->getId(), Tools::EndLineTool, dialogEndLine->getIdDetail()); + AddToolToDetail(endLine, endLine->getId(), Tool::EndLineTool, dialogEndLine->getIdDetail()); } } ArrowTool(); } void MainWindow::ToolLine(bool checked){ - SetToolButton(checked, Tools::LineTool, ":/cursor/line_cursor.png", dialogLine, + SetToolButton(checked, Tool::LineTool, ":/cursor/line_cursor.png", dialogLine, &MainWindow::ClosedDialogLine); } @@ -248,14 +248,14 @@ void MainWindow::ClosedDialogLine(int result){ VToolLine::Create(dialogLine, currentScene, doc, data); } else { VModelingLine *line = VModelingLine::Create(dialogLine, doc, data); - AddToolToDetail(line, line->getId(), Tools::LineTool, dialogLine->getIdDetail()); + AddToolToDetail(line, line->getId(), Tool::LineTool, dialogLine->getIdDetail()); } } ArrowTool(); } void MainWindow::ToolAlongLine(bool checked){ - SetToolButton(checked, Tools::AlongLineTool, ":/cursor/alongline_cursor.png", dialogAlongLine, + SetToolButton(checked, Tool::AlongLineTool, ":/cursor/alongline_cursor.png", dialogAlongLine, &MainWindow::ClosedDialogAlongLine); } @@ -265,14 +265,14 @@ void MainWindow::ClosedDialogAlongLine(int result){ VToolAlongLine::Create(dialogAlongLine, currentScene, doc, data); } else{ VModelingAlongLine *point = VModelingAlongLine::Create(dialogAlongLine, doc, data); - AddToolToDetail(point, point->getId(), Tools::AlongLineTool, dialogAlongLine->getIdDetail()); + AddToolToDetail(point, point->getId(), Tool::AlongLineTool, dialogAlongLine->getIdDetail()); } } ArrowTool(); } void MainWindow::ToolShoulderPoint(bool checked){ - SetToolButton(checked, Tools::ShoulderPointTool, ":/cursor/shoulder_cursor.png", dialogShoulderPoint, + SetToolButton(checked, Tool::ShoulderPointTool, ":/cursor/shoulder_cursor.png", dialogShoulderPoint, &MainWindow::ClosedDialogShoulderPoint); } @@ -282,7 +282,7 @@ void MainWindow::ClosedDialogShoulderPoint(int result){ VToolShoulderPoint::Create(dialogShoulderPoint, currentScene, doc, data); } else { VModelingShoulderPoint *point = VModelingShoulderPoint::Create(dialogShoulderPoint, doc, data); - AddToolToDetail(point, point->getId(), Tools::ShoulderPointTool, + AddToolToDetail(point, point->getId(), Tool::ShoulderPointTool, dialogShoulderPoint->getIdDetail()); } } @@ -290,7 +290,7 @@ void MainWindow::ClosedDialogShoulderPoint(int result){ } void MainWindow::ToolNormal(bool checked){ - SetToolButton(checked, Tools::NormalTool, ":/cursor/normal_cursor.png", dialogNormal, + SetToolButton(checked, Tool::NormalTool, ":/cursor/normal_cursor.png", dialogNormal, &MainWindow::ClosedDialogNormal); } @@ -300,14 +300,14 @@ void MainWindow::ClosedDialogNormal(int result){ VToolNormal::Create(dialogNormal, currentScene, doc, data); } else { VModelingNormal *point = VModelingNormal::Create(dialogNormal, doc, data); - AddToolToDetail(point, point->getId(), Tools::NormalTool, dialogNormal->getIdDetail()); + AddToolToDetail(point, point->getId(), Tool::NormalTool, dialogNormal->getIdDetail()); } } ArrowTool(); } void MainWindow::ToolBisector(bool checked){ - SetToolButton(checked, Tools::BisectorTool, ":/cursor/bisector_cursor.png", dialogBisector, + SetToolButton(checked, Tool::BisectorTool, ":/cursor/bisector_cursor.png", dialogBisector, &MainWindow::ClosedDialogBisector); } @@ -317,14 +317,14 @@ void MainWindow::ClosedDialogBisector(int result){ VToolBisector::Create(dialogBisector, currentScene, doc, data); } else { VModelingBisector *point = VModelingBisector::Create(dialogBisector, doc, data); - AddToolToDetail(point, point->getId(), Tools::BisectorTool, dialogBisector->getIdDetail()); + AddToolToDetail(point, point->getId(), Tool::BisectorTool, dialogBisector->getIdDetail()); } } ArrowTool(); } void MainWindow::ToolLineIntersect(bool checked){ - SetToolButton(checked, Tools::LineIntersectTool, ":/cursor/intersect_cursor.png", dialogLineIntersect, + SetToolButton(checked, Tool::LineIntersectTool, ":/cursor/intersect_cursor.png", dialogLineIntersect, &MainWindow::ClosedDialogLineIntersect); } @@ -334,7 +334,7 @@ void MainWindow::ClosedDialogLineIntersect(int result){ VToolLineIntersect::Create(dialogLineIntersect, currentScene, doc, data); } else { VModelingLineIntersect *point = VModelingLineIntersect::Create(dialogLineIntersect, doc, data); - AddToolToDetail(point, point->getId(), Tools::LineIntersectTool, + AddToolToDetail(point, point->getId(), Tool::LineIntersectTool, dialogLineIntersect->getIdDetail()); } } @@ -342,7 +342,7 @@ void MainWindow::ClosedDialogLineIntersect(int result){ } void MainWindow::ToolSpline(bool checked){ - SetToolButton(checked, Tools::SplineTool, ":/cursor/spline_cursor.png", dialogSpline, + SetToolButton(checked, Tool::SplineTool, ":/cursor/spline_cursor.png", dialogSpline, &MainWindow::ClosedDialogSpline); } @@ -352,14 +352,14 @@ void MainWindow::ClosedDialogSpline(int result){ VToolSpline::Create(dialogSpline, currentScene, doc, data); } else { VModelingSpline *spl = VModelingSpline::Create(dialogSpline, doc, data); - AddToolToDetail(spl, spl->getId(), Tools::SplineTool, dialogSpline->getIdDetail()); + AddToolToDetail(spl, spl->getId(), Tool::SplineTool, dialogSpline->getIdDetail()); } } ArrowTool(); } void MainWindow::ToolArc(bool checked){ - SetToolButton(checked, Tools::ArcTool, ":/cursor/arc_cursor.png", dialogArc, + SetToolButton(checked, Tool::ArcTool, ":/cursor/arc_cursor.png", dialogArc, &MainWindow::ClosedDialogArc); } @@ -369,14 +369,14 @@ void MainWindow::ClosedDialogArc(int result){ VToolArc::Create(dialogArc, currentScene, doc, data); } else { VModelingArc *arc = VModelingArc::Create(dialogArc, doc, data); - AddToolToDetail(arc, arc->getId(), Tools::ArcTool, dialogArc->getIdDetail()); + AddToolToDetail(arc, arc->getId(), Tool::ArcTool, dialogArc->getIdDetail()); } } ArrowTool(); } void MainWindow::ToolSplinePath(bool checked){ - SetToolButton(checked, Tools::SplinePathTool, ":/cursor/splinepath_cursor.png", dialogSplinePath, + SetToolButton(checked, Tool::SplinePathTool, ":/cursor/splinepath_cursor.png", dialogSplinePath, &MainWindow::ClosedDialogSplinePath); } @@ -386,14 +386,14 @@ void MainWindow::ClosedDialogSplinePath(int result){ VToolSplinePath::Create(dialogSplinePath, currentScene, doc, data); } else { VModelingSplinePath *spl = VModelingSplinePath::Create(dialogSplinePath, doc, data); - AddToolToDetail(spl, spl->getId(), Tools::SplinePathTool, dialogSplinePath->getIdDetail()); + AddToolToDetail(spl, spl->getId(), Tool::SplinePathTool, dialogSplinePath->getIdDetail()); } } ArrowTool(); } void MainWindow::ToolPointOfContact(bool checked){ - SetToolButton(checked, Tools::PointOfContact, ":/cursor/pointcontact_cursor.png", dialogPointOfContact, + SetToolButton(checked, Tool::PointOfContact, ":/cursor/pointcontact_cursor.png", dialogPointOfContact, &MainWindow::ClosedDialogPointOfContact); } @@ -404,7 +404,7 @@ void MainWindow::ClosedDialogPointOfContact(int result){ } else { VModelingPointOfContact *point = VModelingPointOfContact::Create(dialogPointOfContact, doc, data); - AddToolToDetail(point, point->getId(), Tools::PointOfContact, + AddToolToDetail(point, point->getId(), Tool::PointOfContact, dialogPointOfContact->getIdDetail()); } } @@ -414,7 +414,7 @@ void MainWindow::ClosedDialogPointOfContact(int result){ void MainWindow::ToolDetail(bool checked){ if(checked){ CanselTool(); - tool = Tools::Detail; + tool = Tool::Detail; QPixmap pixmap("://cursor/new_detail_cursor.png"); QCursor cur(pixmap, 2, 3); view->setCursor(cur); @@ -575,79 +575,79 @@ void MainWindow::mouseMove(QPointF scenePos){ void MainWindow::CanselTool(){ switch( tool ) { - case Tools::ArrowTool: + case Tool::ArrowTool: ui->actionArrowTool->setChecked(false); break; - case Tools::SinglePointTool: + case Tool::SinglePointTool: //Nothing to do here because we can't create this tool from main window. break; - case Tools::EndLineTool: + case Tool::EndLineTool: dialogEndLine.clear(); ui->toolButtonEndLine->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tools::LineTool: + case Tool::LineTool: dialogLine.clear(); ui->toolButtonLine->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearFocus(); break; - case Tools::AlongLineTool: + case Tool::AlongLineTool: dialogAlongLine.clear(); ui->toolButtonAlongLine->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tools::ShoulderPointTool: + case Tool::ShoulderPointTool: dialogShoulderPoint.clear(); ui->toolButtonShoulderPoint->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tools::NormalTool: + case Tool::NormalTool: dialogNormal.clear(); ui->toolButtonNormal->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tools::BisectorTool: + case Tool::BisectorTool: dialogBisector.clear(); ui->toolButtonBisector->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tools::LineIntersectTool: + case Tool::LineIntersectTool: dialogLineIntersect.clear(); ui->toolButtonLineIntersect->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tools::SplineTool: + case Tool::SplineTool: dialogSpline.clear(); ui->toolButtonSpline->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tools::ArcTool: + case Tool::ArcTool: dialogArc.clear(); ui->toolButtonArc->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tools::SplinePathTool: + case Tool::SplinePathTool: dialogSplinePath.clear(); ui->toolButtonSplinePath->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tools::PointOfContact: + case Tool::PointOfContact: dialogPointOfContact.clear(); ui->toolButtonPointOfContact->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tools::Detail: + case Tool::Detail: dialogDetail.clear(); ui->toolButtonNewDetail->setChecked(false); break; @@ -660,7 +660,7 @@ void MainWindow::CanselTool(){ void MainWindow::ArrowTool(){ CanselTool(); ui->actionArrowTool->setChecked(true); - tool = Tools::ArrowTool; + tool = Tool::ArrowTool; QCursor cur(Qt::ArrowCursor); view->setCursor(cur); helpLabel->setText(""); diff --git a/mainwindow.h b/mainwindow.h index bdc65021b..3a8cfd037 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -113,7 +113,7 @@ protected: private: Q_DISABLE_COPY(MainWindow) Ui::MainWindow *ui; - Tools::Enum tool; + Tool::Tools tool; VMainGraphicsScene *currentScene; VMainGraphicsScene *sceneDraw; VMainGraphicsScene *sceneDetails; @@ -140,7 +140,7 @@ private: QComboBox *comboBoxDraws; QString fileName; bool changeInFile; - Draw::Mode mode; + Draw::Draws mode; void ToolBarOption(); void ToolBarDraws(); void CanselTool(); @@ -148,12 +148,12 @@ private: void SetEnableWidgets(bool enable); void SetEnableTool(bool enable); template - void SetToolButton(bool checked, Tools::Enum t, const QString &cursor, + void SetToolButton(bool checked, Tool::Tools t, const QString &cursor, QSharedPointer &dialog, Func closeDialogSlot); void MinimumScrollBar(); - template - void AddToolToDetail(Tool *tool, const qint64 &id, Tools::Enum typeTool, + template + void AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool, const qint64 &idDetail); }; diff --git a/options.h b/options.h index 6c0a47f84..4aa46b7aa 100644 --- a/options.h +++ b/options.h @@ -22,7 +22,7 @@ #ifndef OPTIONS_H #define OPTIONS_H -#include +#include #define PrintDPI 96 #define PaperSize 50000 @@ -31,49 +31,40 @@ #define widthMainLine toPixel(0.8) #define widthHairLine widthMainLine/3 - namespace Scene{ - enum Type - { - Point, - Line, - Spline, - Arc, - SplinePath, - Detail - }; +enum Scene { Point, Line, Spline, Arc, SplinePath, Detail }; +Q_DECLARE_FLAGS(Scenes, Scene) } +Q_DECLARE_OPERATORS_FOR_FLAGS( Scene::Scenes ) -namespace Tools{ - enum Enum - { - ArrowTool, - SinglePointTool, - EndLineTool, - LineTool, - AlongLineTool, - ShoulderPointTool, - NormalTool, - BisectorTool, - LineIntersectTool, - SplineTool, - ArcTool, - SplinePathTool, - PointOfContact, - Detail, - NodePoint, - NodeArc, - NodeSpline, - NodeSplinePath - }; +namespace Tool{ +enum Tool {ArrowTool, + SinglePointTool, + EndLineTool, + LineTool, + AlongLineTool, + ShoulderPointTool, + NormalTool, + BisectorTool, + LineIntersectTool, + SplineTool, + ArcTool, + SplinePathTool, + PointOfContact, + Detail, + NodePoint, + NodeArc, + NodeSpline, + NodeSplinePath +}; +Q_DECLARE_FLAGS(Tools, Tool) } +Q_DECLARE_OPERATORS_FOR_FLAGS( Tool::Tools ) -namespace Draw{ - enum Mode - { - Calculation, - Modeling - }; +namespace Draw { + enum Draw { Calculation, Modeling }; + Q_DECLARE_FLAGS(Draws, Draw) } +Q_DECLARE_OPERATORS_FOR_FLAGS(Draw::Draws) #endif // OPTIONS_H diff --git a/tools/drawTools/vdrawtool.cpp b/tools/drawTools/vdrawtool.cpp index f93c2b359..89164341b 100644 --- a/tools/drawTools/vdrawtool.cpp +++ b/tools/drawTools/vdrawtool.cpp @@ -36,7 +36,7 @@ VDrawTool::~VDrawTool(){ void VDrawTool::setDialog(){ } -void VDrawTool::AddRecord(const qint64 id, Tools::Enum toolType, VDomDocument *doc){ +void VDrawTool::AddRecord(const qint64 id, Tool::Tools toolType, VDomDocument *doc){ qint64 cursor = doc->getCursor(); QVector *history = doc->getHistory(); if(cursor <= 0){ diff --git a/tools/drawTools/vdrawtool.h b/tools/drawTools/vdrawtool.h index a95ecfa27..fc6b1e344 100644 --- a/tools/drawTools/vdrawtool.h +++ b/tools/drawTools/vdrawtool.h @@ -32,7 +32,7 @@ public: VDrawTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0); virtual ~VDrawTool(); virtual void setDialog(); - static void AddRecord(const qint64 id, Tools::Enum toolType, VDomDocument *doc); + static void AddRecord(const qint64 id, Tool::Tools toolType, VDomDocument *doc); void ignoreContextMenu(bool enable); public slots: virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); diff --git a/tools/drawTools/vtoolalongline.cpp b/tools/drawTools/vtoolalongline.cpp index 2f9242fcd..b663b640e 100644 --- a/tools/drawTools/vtoolalongline.cpp +++ b/tools/drawTools/vtoolalongline.cpp @@ -112,7 +112,7 @@ void VToolAlongLine::Create(QSharedPointer &dialog, VMainGraphi void VToolAlongLine::Create(const qint64 _id, const QString &pointName, const QString &typeLine, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, Document::Enum parse, Tool::Enum typeCreation){ + VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ VPointF firstPoint = data->GetPoint(firstPointId); VPointF secondPoint = data->GetPoint(secondPointId); QLineF line = QLineF(firstPoint.toQPointF(), secondPoint.toQPointF()); @@ -135,7 +135,7 @@ void VToolAlongLine::Create(const qint64 _id, const QString &pointName, const QS } } } - VDrawTool::AddRecord(id, Tools::AlongLineTool, doc); + VDrawTool::AddRecord(id, Tool::AlongLineTool, doc); data->AddLine(firstPointId, id); data->AddLine(id, secondPointId); if(parse == Document::FullParse){ diff --git a/tools/drawTools/vtoolalongline.h b/tools/drawTools/vtoolalongline.h index 7034ab585..c21b36431 100644 --- a/tools/drawTools/vtoolalongline.h +++ b/tools/drawTools/vtoolalongline.h @@ -38,7 +38,7 @@ public: static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, Document::Enum parse, Tool::Enum typeCreation); + VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolarc.cpp b/tools/drawTools/vtoolarc.cpp index fa23101e0..2883fd33c 100644 --- a/tools/drawTools/vtoolarc.cpp +++ b/tools/drawTools/vtoolarc.cpp @@ -62,7 +62,7 @@ void VToolArc::Create(QSharedPointer &dialog, VMainGraphicsScene *sce void VToolArc::Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1, const QString &f2, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, Document::Enum parse, Tool::Enum typeCreation){ + VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ qreal calcRadius = 0, calcF1 = 0, calcF2 = 0; Calculator cal(data); @@ -100,7 +100,7 @@ void VToolArc::Create(const qint64 _id, const qint64 ¢er, const QString &rad } } data->AddLengthArc(data->GetNameArc(center,id), arc.GetLength()); - VDrawTool::AddRecord(id, Tools::ArcTool, doc); + VDrawTool::AddRecord(id, Tool::ArcTool, doc); if(parse == Document::FullParse){ VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation); scene->addItem(toolArc); diff --git a/tools/drawTools/vtoolarc.h b/tools/drawTools/vtoolarc.h index ad544a45e..fdd47b500 100644 --- a/tools/drawTools/vtoolarc.h +++ b/tools/drawTools/vtoolarc.h @@ -40,7 +40,7 @@ public: VContainer *data); static void Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1, const QString &f2, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, Document::Enum parse, Tool::Enum typeCreation); + VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolbisector.cpp b/tools/drawTools/vtoolbisector.cpp index 19d645981..b3991e942 100644 --- a/tools/drawTools/vtoolbisector.cpp +++ b/tools/drawTools/vtoolbisector.cpp @@ -78,7 +78,7 @@ void VToolBisector::Create(const qint64 _id, const QString &formula, const qint6 const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, - Document::Enum parse, Tool::Enum typeCreation){ + const Document::Documents &parse, Tool::Enum typeCreation){ VPointF firstPoint = data->GetPoint(firstPointId); VPointF secondPoint = data->GetPoint(secondPointId); VPointF thirdPoint = data->GetPoint(thirdPointId); @@ -104,7 +104,7 @@ void VToolBisector::Create(const qint64 _id, const QString &formula, const qint6 } } data->AddLine(firstPointId, id); - VDrawTool::AddRecord(id, Tools::BisectorTool, doc); + VDrawTool::AddRecord(id, Tool::BisectorTool, doc); if(parse == Document::FullParse){ VToolBisector *point = new VToolBisector(doc, data, id, typeLine, formula, firstPointId, secondPointId, thirdPointId, diff --git a/tools/drawTools/vtoolbisector.h b/tools/drawTools/vtoolbisector.h index bc1c45499..2d6e1ad79 100644 --- a/tools/drawTools/vtoolbisector.h +++ b/tools/drawTools/vtoolbisector.h @@ -41,7 +41,8 @@ public: static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, Document::Enum parse, Tool::Enum typeCreation); + VDomDocument *doc, VContainer *data, const Document::Documents &parse, + Tool::Enum typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolendline.cpp b/tools/drawTools/vtoolendline.cpp index b2eeead5e..5f96138b5 100644 --- a/tools/drawTools/vtoolendline.cpp +++ b/tools/drawTools/vtoolendline.cpp @@ -61,7 +61,7 @@ void VToolEndLine::Create(QSharedPointer &dialog, VMainGraphicsSc void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &basePointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, Document::Enum parse, Tool::Enum typeCreation){ + VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ VPointF basePoint = data->GetPoint(basePointId); QLineF line = QLineF(basePoint.toQPointF(), QPointF(basePoint.x()+100, basePoint.y())); @@ -86,7 +86,7 @@ void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QStr } } data->AddLine(basePointId, id); - VDrawTool::AddRecord(id, Tools::EndLineTool, doc); + VDrawTool::AddRecord(id, Tool::EndLineTool, doc); if(parse == Document::FullParse){ VToolEndLine *point = new VToolEndLine(doc, data, id, typeLine, formula, angle, basePointId, typeCreation); diff --git a/tools/drawTools/vtoolendline.h b/tools/drawTools/vtoolendline.h index c52a3fd85..eff270cfb 100644 --- a/tools/drawTools/vtoolendline.h +++ b/tools/drawTools/vtoolendline.h @@ -39,8 +39,8 @@ public: VContainer *data); static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &basePointId, const qreal &mx, const qreal &my, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, Document::Enum parse, - Tool::Enum typeCreation); + VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Enum typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolline.cpp b/tools/drawTools/vtoolline.cpp index 54c288c7b..7320ec4a3 100644 --- a/tools/drawTools/vtoolline.cpp +++ b/tools/drawTools/vtoolline.cpp @@ -53,7 +53,7 @@ void VToolLine::Create(QSharedPointer &dialog, VMainGraphicsScene *s } void VToolLine::Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, Document::Enum parse, + VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ Q_CHECK_PTR(scene); Q_CHECK_PTR(doc); @@ -66,7 +66,7 @@ void VToolLine::Create(const qint64 &id, const qint64 &firstPoint, const qint64 Q_CHECK_PTR(tool); tool->VDataTool::setData(data); } - VDrawTool::AddRecord(id, Tools::LineTool, doc); + VDrawTool::AddRecord(id, Tool::LineTool, doc); if(parse == Document::FullParse){ qint64 id = data->getNextId(); VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeCreation); diff --git a/tools/drawTools/vtoolline.h b/tools/drawTools/vtoolline.h index 0a3b4b23c..ee14cb88b 100644 --- a/tools/drawTools/vtoolline.h +++ b/tools/drawTools/vtoolline.h @@ -36,8 +36,8 @@ public: static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); static void Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, Document::Enum parse, - Tool::Enum typeCreation); + VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Enum typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void ChangedActivDraw(const QString newName); diff --git a/tools/drawTools/vtoollineintersect.cpp b/tools/drawTools/vtoollineintersect.cpp index 4f47d0955..f5d74ae94 100644 --- a/tools/drawTools/vtoollineintersect.cpp +++ b/tools/drawTools/vtoollineintersect.cpp @@ -58,7 +58,7 @@ void VToolLineIntersect::Create(QSharedPointer &dialog, VMa void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id, const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, Document::Enum parse, Tool::Enum typeCreation){ + VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ VPointF p1Line1 = data->GetPoint(p1Line1Id); VPointF p2Line1 = data->GetPoint(p2Line1Id); VPointF p1Line2 = data->GetPoint(p1Line2Id); @@ -87,7 +87,7 @@ void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const data->AddLine(id, p2Line1Id); data->AddLine(p1Line2Id, id); data->AddLine(id, p2Line2Id); - VDrawTool::AddRecord(id, Tools::LineIntersectTool, doc); + VDrawTool::AddRecord(id, Tool::LineIntersectTool, doc); if(parse == Document::FullParse){ VToolLineIntersect *point = new VToolLineIntersect(doc, data, id, p1Line1Id, p2Line1Id, p1Line2Id, diff --git a/tools/drawTools/vtoollineintersect.h b/tools/drawTools/vtoollineintersect.h index 7ec1616dc..61716bdc6 100644 --- a/tools/drawTools/vtoollineintersect.h +++ b/tools/drawTools/vtoollineintersect.h @@ -41,7 +41,7 @@ public: static void Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id, const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, Document::Enum parse, Tool::Enum typeCreation); + VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolnormal.cpp b/tools/drawTools/vtoolnormal.cpp index 155b458a2..22236f3c2 100644 --- a/tools/drawTools/vtoolnormal.cpp +++ b/tools/drawTools/vtoolnormal.cpp @@ -63,7 +63,7 @@ void VToolNormal::Create(QSharedPointer &dialog, VMainGraphicsScen void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const QString typeLine, const QString pointName, const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, Document::Enum parse, Tool::Enum typeCreation){ + VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ VPointF firstPoint = data->GetPoint(firstPointId); VPointF secondPoint = data->GetPoint(secondPointId); Calculator cal(data); @@ -87,7 +87,7 @@ void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 } } data->AddLine(firstPointId, id); - VDrawTool::AddRecord(id, Tools::NormalTool, doc); + VDrawTool::AddRecord(id, Tool::NormalTool, doc); if(parse == Document::FullParse){ VToolNormal *point = new VToolNormal(doc, data, id, typeLine, formula, angle, firstPointId, secondPointId, typeCreation); diff --git a/tools/drawTools/vtoolnormal.h b/tools/drawTools/vtoolnormal.h index 9731cbafe..9f6bdf613 100644 --- a/tools/drawTools/vtoolnormal.h +++ b/tools/drawTools/vtoolnormal.h @@ -41,7 +41,7 @@ public: static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const QString typeLine, const QString pointName, const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, Document::Enum parse, Tool::Enum typeCreation); + VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length, const qreal &angle = 0); public slots: diff --git a/tools/drawTools/vtoolpointofcontact.cpp b/tools/drawTools/vtoolpointofcontact.cpp index 5993729b7..81ee3691e 100644 --- a/tools/drawTools/vtoolpointofcontact.cpp +++ b/tools/drawTools/vtoolpointofcontact.cpp @@ -82,7 +82,7 @@ void VToolPointOfContact::Create(const qint64 _id, const QString &radius, const const qint64 &firstPointId, const qint64 &secondPointId, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, - Document::Enum parse, Tool::Enum typeCreation){ + const Document::Documents &parse, Tool::Enum typeCreation){ VPointF centerP = data->GetPoint(center); VPointF firstP = data->GetPoint(firstPointId); VPointF secondP = data->GetPoint(secondPointId); @@ -107,7 +107,7 @@ void VToolPointOfContact::Create(const qint64 _id, const QString &radius, const } } } - VDrawTool::AddRecord(id, Tools::PointOfContact, doc); + VDrawTool::AddRecord(id, Tool::PointOfContact, doc); if(parse == Document::FullParse){ VToolPointOfContact *point = new VToolPointOfContact(doc, data, id, radius, center, firstPointId, secondPointId, typeCreation); diff --git a/tools/drawTools/vtoolpointofcontact.h b/tools/drawTools/vtoolpointofcontact.h index 8927132d1..7c5a881a7 100644 --- a/tools/drawTools/vtoolpointofcontact.h +++ b/tools/drawTools/vtoolpointofcontact.h @@ -39,7 +39,7 @@ public: static void Create(const qint64 _id, const QString &radius, const qint64 ¢er, const qint64 &firstPointId, const qint64 &secondPointId, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, Document::Enum parse, Tool::Enum typeCreation); + VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolshoulderpoint.cpp b/tools/drawTools/vtoolshoulderpoint.cpp index 9fb730b7e..d1703161d 100644 --- a/tools/drawTools/vtoolshoulderpoint.cpp +++ b/tools/drawTools/vtoolshoulderpoint.cpp @@ -86,7 +86,7 @@ void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const const qint64 &p2Line, const qint64 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, - Document::Enum parse, Tool::Enum typeCreation){ + const Document::Documents &parse, Tool::Enum typeCreation){ VPointF firstPoint = data->GetPoint(p1Line); VPointF secondPoint = data->GetPoint(p2Line); VPointF shoulderPoint = data->GetPoint(pShoulder); @@ -113,7 +113,7 @@ void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const } data->AddLine(p1Line, id); data->AddLine(p2Line, id); - VDrawTool::AddRecord(id, Tools::ShoulderPointTool, doc); + VDrawTool::AddRecord(id, Tool::ShoulderPointTool, doc); if(parse == Document::FullParse){ VToolShoulderPoint *point = new VToolShoulderPoint(doc, data, id, typeLine, formula, p1Line, p2Line, pShoulder, diff --git a/tools/drawTools/vtoolshoulderpoint.h b/tools/drawTools/vtoolshoulderpoint.h index aa75321dd..d604db328 100644 --- a/tools/drawTools/vtoolshoulderpoint.h +++ b/tools/drawTools/vtoolshoulderpoint.h @@ -40,7 +40,7 @@ public: static void Create(const qint64 _id, const QString &formula, const qint64 &p1Line, const qint64 &p2Line, const qint64 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, Document::Enum parse, Tool::Enum typeCreation); + VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolspline.cpp b/tools/drawTools/vtoolspline.cpp index 142f1ad9d..7cab46cee 100644 --- a/tools/drawTools/vtoolspline.cpp +++ b/tools/drawTools/vtoolspline.cpp @@ -89,7 +89,7 @@ void VToolSpline::Create(QSharedPointer &dialog, VMainGraphicsScen void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1, const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, Document::Enum parse, + VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ VSpline spline = VSpline(data->DataPoints(), p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve); qint64 id = _id; @@ -107,7 +107,7 @@ void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, c } } data->AddLengthSpline(data->GetNameSpline(p1, p4), spline.GetLength()); - VDrawTool::AddRecord(id, Tools::SplineTool, doc); + VDrawTool::AddRecord(id, Tool::SplineTool, doc); if(parse == Document::FullParse){ VToolSpline *spl = new VToolSpline(doc, data, id, typeCreation); scene->addItem(spl); diff --git a/tools/drawTools/vtoolspline.h b/tools/drawTools/vtoolspline.h index ce8c24f15..39411fe88 100644 --- a/tools/drawTools/vtoolspline.h +++ b/tools/drawTools/vtoolspline.h @@ -41,7 +41,7 @@ public: VContainer *data); static void Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1, const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, Document::Enum parse, + VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); signals: void RefreshLine ( const qint32 &indexSpline, SplinePoint::Position position, diff --git a/tools/drawTools/vtoolsplinepath.cpp b/tools/drawTools/vtoolsplinepath.cpp index 001df4566..b4a1744c3 100644 --- a/tools/drawTools/vtoolsplinepath.cpp +++ b/tools/drawTools/vtoolsplinepath.cpp @@ -74,7 +74,7 @@ void VToolSplinePath::Create(QSharedPointer &dialog, VMainGrap } void VToolSplinePath::Create(const qint64 _id, const VSplinePath &path, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, Document::Enum parse, + VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ qint64 id = _id; if(typeCreation == Tool::FromGui){ @@ -91,7 +91,7 @@ void VToolSplinePath::Create(const qint64 _id, const VSplinePath &path, VMainGra } } data->AddLengthSpline(data->GetNameSplinePath(path), path.GetLength()); - VDrawTool::AddRecord(id, Tools::SplinePathTool, doc); + VDrawTool::AddRecord(id, Tool::SplinePathTool, doc); if(parse == Document::FullParse){ VToolSplinePath *spl = new VToolSplinePath(doc, data, id, typeCreation); scene->addItem(spl); diff --git a/tools/drawTools/vtoolsplinepath.h b/tools/drawTools/vtoolsplinepath.h index 36e8bcb93..598684d6d 100644 --- a/tools/drawTools/vtoolsplinepath.h +++ b/tools/drawTools/vtoolsplinepath.h @@ -40,7 +40,7 @@ public: static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); static void Create(const qint64 _id, const VSplinePath &path, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, Document::Enum parse, Tool::Enum typeCreation); + VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); signals: void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, const QPointF &controlPoint, const QPointF &splinePoint); diff --git a/tools/modelingTools/vmodelingalongline.cpp b/tools/modelingTools/vmodelingalongline.cpp index 7c957585d..c57b31478 100644 --- a/tools/modelingTools/vmodelingalongline.cpp +++ b/tools/modelingTools/vmodelingalongline.cpp @@ -113,7 +113,7 @@ VModelingAlongLine *VModelingAlongLine::Create(const qint64 _id, const QString & const QString &typeLine, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, VDomDocument *doc, - VContainer *data, Document::Enum parse, + VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ VModelingAlongLine *point = 0; VPointF firstPoint = data->GetModelingPoint(firstPointId); diff --git a/tools/modelingTools/vmodelingalongline.h b/tools/modelingTools/vmodelingalongline.h index f34feac0c..b8e649770 100644 --- a/tools/modelingTools/vmodelingalongline.h +++ b/tools/modelingTools/vmodelingalongline.h @@ -38,7 +38,7 @@ public: static VModelingAlongLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, - VDomDocument *doc, VContainer *data, Document::Enum parse, + VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); public slots: virtual void FullUpdateFromFile(); diff --git a/tools/modelingTools/vmodelingarc.cpp b/tools/modelingTools/vmodelingarc.cpp index 91b00b3fd..a8df5f65c 100644 --- a/tools/modelingTools/vmodelingarc.cpp +++ b/tools/modelingTools/vmodelingarc.cpp @@ -61,7 +61,7 @@ VModelingArc* VModelingArc::Create(QSharedPointer &dialog, VDomDocume VModelingArc* VModelingArc::Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1, const QString &f2, VDomDocument *doc, - VContainer *data, Document::Enum parse, Tool::Enum typeCreation){ + VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ VModelingArc *toolArc = 0; qreal calcRadius = 0, calcF1 = 0, calcF2 = 0; diff --git a/tools/modelingTools/vmodelingarc.h b/tools/modelingTools/vmodelingarc.h index c6f55167e..12fe60a44 100644 --- a/tools/modelingTools/vmodelingarc.h +++ b/tools/modelingTools/vmodelingarc.h @@ -39,7 +39,7 @@ public: static VModelingArc* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); static VModelingArc* Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1, const QString &f2, VDomDocument *doc, VContainer *data, - Document::Enum parse, Tool::Enum typeCreation); + const Document::Documents &parse, Tool::Enum typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingbisector.cpp b/tools/modelingTools/vmodelingbisector.cpp index 03876f63e..ca424180b 100644 --- a/tools/modelingTools/vmodelingbisector.cpp +++ b/tools/modelingTools/vmodelingbisector.cpp @@ -78,7 +78,7 @@ VModelingBisector *VModelingBisector::Create(const qint64 _id, const QString &fo const qint64 &firstPointId, const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, - VDomDocument *doc, VContainer *data, Document::Enum parse, + VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ VModelingBisector *point = 0; VPointF firstPoint = data->GetModelingPoint(firstPointId); diff --git a/tools/modelingTools/vmodelingbisector.h b/tools/modelingTools/vmodelingbisector.h index 76428de7d..e272bc66e 100644 --- a/tools/modelingTools/vmodelingbisector.h +++ b/tools/modelingTools/vmodelingbisector.h @@ -43,7 +43,7 @@ public: const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, - Document::Enum parse, Tool::Enum typeCreation); + const Document::Documents &parse, Tool::Enum typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingendline.cpp b/tools/modelingTools/vmodelingendline.cpp index abc96cd4a..514769e83 100644 --- a/tools/modelingTools/vmodelingendline.cpp +++ b/tools/modelingTools/vmodelingendline.cpp @@ -62,7 +62,7 @@ VModelingEndLine *VModelingEndLine::Create(const qint64 _id, const QString &poin const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &basePointId, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, - Document::Enum parse, Tool::Enum typeCreation){ + const Document::Documents &parse, Tool::Enum typeCreation){ VModelingEndLine *point = 0; VPointF basePoint = data->GetModelingPoint(basePointId); QLineF line = QLineF(basePoint.toQPointF(), QPointF(basePoint.x()+100, basePoint.y())); diff --git a/tools/modelingTools/vmodelingendline.h b/tools/modelingTools/vmodelingendline.h index f615fd2a0..a3b2b2fa0 100644 --- a/tools/modelingTools/vmodelingendline.h +++ b/tools/modelingTools/vmodelingendline.h @@ -40,7 +40,7 @@ public: static VModelingEndLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &basePointId, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, - Document::Enum parse, Tool::Enum typeCreation); + const Document::Documents &parse, Tool::Enum typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingline.cpp b/tools/modelingTools/vmodelingline.cpp index ac10a0a84..6e614ba2a 100644 --- a/tools/modelingTools/vmodelingline.cpp +++ b/tools/modelingTools/vmodelingline.cpp @@ -53,7 +53,7 @@ VModelingLine *VModelingLine::Create(QSharedPointer &dialog, VDomDoc } VModelingLine *VModelingLine::Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint, - VDomDocument *doc, VContainer *data, Document::Enum parse, + VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ VModelingLine *line = 0; Q_CHECK_PTR(doc); diff --git a/tools/modelingTools/vmodelingline.h b/tools/modelingTools/vmodelingline.h index c554260ad..023535fcf 100644 --- a/tools/modelingTools/vmodelingline.h +++ b/tools/modelingTools/vmodelingline.h @@ -35,7 +35,7 @@ public: virtual void setDialog(); static VModelingLine* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); static VModelingLine* Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint, - VDomDocument *doc, VContainer *data, Document::Enum parse, + VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); public slots: virtual void FullUpdateFromFile(); diff --git a/tools/modelingTools/vmodelinglineintersect.cpp b/tools/modelingTools/vmodelinglineintersect.cpp index e1481e7d6..ba920e6ad 100644 --- a/tools/modelingTools/vmodelinglineintersect.cpp +++ b/tools/modelingTools/vmodelinglineintersect.cpp @@ -59,7 +59,7 @@ VModelingLineIntersect *VModelingLineIntersect::Create(const qint64 _id, const q const qint64 &p2Line1Id, const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc, - VContainer *data, Document::Enum parse, + VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ VModelingLineIntersect *point = 0; VPointF p1Line1 = data->GetModelingPoint(p1Line1Id); diff --git a/tools/modelingTools/vmodelinglineintersect.h b/tools/modelingTools/vmodelinglineintersect.h index 227b32f8e..e69c04532 100644 --- a/tools/modelingTools/vmodelinglineintersect.h +++ b/tools/modelingTools/vmodelinglineintersect.h @@ -41,7 +41,7 @@ public: static VModelingLineIntersect* Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id, const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my, - VDomDocument *doc, VContainer *data, Document::Enum parse, + VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); public slots: virtual void FullUpdateFromFile(); diff --git a/tools/modelingTools/vmodelingnormal.cpp b/tools/modelingTools/vmodelingnormal.cpp index 11bc09a06..f914305ab 100644 --- a/tools/modelingTools/vmodelingnormal.cpp +++ b/tools/modelingTools/vmodelingnormal.cpp @@ -64,7 +64,7 @@ VModelingNormal *VModelingNormal::Create(const qint64 _id, const QString &formul const qint64 &firstPointId, const qint64 &secondPointId, const QString typeLine, const QString pointName, const qreal angle, const qreal &mx, const qreal &my, - VDomDocument *doc, VContainer *data, Document::Enum parse, + VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ VModelingNormal *point = 0; VPointF firstPoint = data->GetModelingPoint(firstPointId); diff --git a/tools/modelingTools/vmodelingnormal.h b/tools/modelingTools/vmodelingnormal.h index ac1f3905f..614c59e6d 100644 --- a/tools/modelingTools/vmodelingnormal.h +++ b/tools/modelingTools/vmodelingnormal.h @@ -40,7 +40,7 @@ public: static VModelingNormal* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const QString typeLine, const QString pointName, const qreal angle, const qreal &mx, - const qreal &my, VDomDocument *doc, VContainer *data, Document::Enum parse, + const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length, const qreal &angle = 0); diff --git a/tools/modelingTools/vmodelingpointofcontact.cpp b/tools/modelingTools/vmodelingpointofcontact.cpp index fab1a4e5d..73b294df9 100644 --- a/tools/modelingTools/vmodelingpointofcontact.cpp +++ b/tools/modelingTools/vmodelingpointofcontact.cpp @@ -83,7 +83,7 @@ VModelingPointOfContact *VModelingPointOfContact::Create(const qint64 _id, const const qint64 &secondPointId, const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc, - VContainer *data, Document::Enum parse, + VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ VModelingPointOfContact *point = 0; VPointF centerP = data->GetModelingPoint(center); diff --git a/tools/modelingTools/vmodelingpointofcontact.h b/tools/modelingTools/vmodelingpointofcontact.h index 4df80f62a..4cecbb6e0 100644 --- a/tools/modelingTools/vmodelingpointofcontact.h +++ b/tools/modelingTools/vmodelingpointofcontact.h @@ -40,7 +40,7 @@ public: static VModelingPointOfContact* Create(const qint64 _id, const QString &radius, const qint64 ¢er, const qint64 &firstPointId, const qint64 &secondPointId, const QString &pointName, const qreal &mx, const qreal &my, - VDomDocument *doc, VContainer *data, Document::Enum parse, + VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); public slots: virtual void FullUpdateFromFile(); diff --git a/tools/modelingTools/vmodelingshoulderpoint.cpp b/tools/modelingTools/vmodelingshoulderpoint.cpp index 56885e863..70d539656 100644 --- a/tools/modelingTools/vmodelingshoulderpoint.cpp +++ b/tools/modelingTools/vmodelingshoulderpoint.cpp @@ -87,7 +87,7 @@ VModelingShoulderPoint *VModelingShoulderPoint::Create(const qint64 _id, const Q const qint64 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, - Document::Enum parse, Tool::Enum typeCreation){ + const Document::Documents &parse, Tool::Enum typeCreation){ VModelingShoulderPoint *point = 0; VPointF firstPoint = data->GetModelingPoint(p1Line); VPointF secondPoint = data->GetModelingPoint(p2Line); diff --git a/tools/modelingTools/vmodelingshoulderpoint.h b/tools/modelingTools/vmodelingshoulderpoint.h index f623c9059..f6c2d0a75 100644 --- a/tools/modelingTools/vmodelingshoulderpoint.h +++ b/tools/modelingTools/vmodelingshoulderpoint.h @@ -42,7 +42,7 @@ public: const qint64 &p2Line, const qint64 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc, - VContainer *data, Document::Enum parse, Tool::Enum typeCreation); + VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingspline.cpp b/tools/modelingTools/vmodelingspline.cpp index e007063ad..30ec59df2 100644 --- a/tools/modelingTools/vmodelingspline.cpp +++ b/tools/modelingTools/vmodelingspline.cpp @@ -90,7 +90,7 @@ VModelingSpline *VModelingSpline::Create(QSharedPointer &dialog, V VModelingSpline *VModelingSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1, const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, VDomDocument *doc, - VContainer *data, Document::Enum parse, Tool::Enum typeCreation){ + VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ VModelingSpline *spl = 0; VSpline spline = VSpline(data->DataModelingPoints(), p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve); qint64 id = _id; diff --git a/tools/modelingTools/vmodelingspline.h b/tools/modelingTools/vmodelingspline.h index 094140ae7..094043e53 100644 --- a/tools/modelingTools/vmodelingspline.h +++ b/tools/modelingTools/vmodelingspline.h @@ -42,7 +42,7 @@ public: static VModelingSpline* Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1, const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, VDomDocument *doc, VContainer *data, - Document::Enum parse, Tool::Enum typeCreation); + const Document::Documents &parse, Tool::Enum typeCreation); signals: void RefreshLine ( const qint32 &indexSpline, SplinePoint::Position position, const QPointF &controlPoint, const QPointF &splinePoint ); diff --git a/tools/modelingTools/vmodelingsplinepath.cpp b/tools/modelingTools/vmodelingsplinepath.cpp index 67c42298f..3e80ef419 100644 --- a/tools/modelingTools/vmodelingsplinepath.cpp +++ b/tools/modelingTools/vmodelingsplinepath.cpp @@ -74,7 +74,7 @@ VModelingSplinePath *VModelingSplinePath::Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); static VModelingSplinePath* Create(const qint64 _id, const VSplinePath &path, VDomDocument *doc, - VContainer *data, Document::Enum parse, Tool::Enum typeCreation); + VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); signals: void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, const QPointF &controlPoint, const QPointF &splinePoint); diff --git a/tools/nodeDetails/vabstractnode.cpp b/tools/nodeDetails/vabstractnode.cpp index 65511d0fd..b1df22222 100644 --- a/tools/nodeDetails/vabstractnode.cpp +++ b/tools/nodeDetails/vabstractnode.cpp @@ -23,7 +23,7 @@ #include VAbstractNode::VAbstractNode(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode, - Draw::Mode typeobject, QObject *parent) : + Draw::Draws typeobject, QObject *parent) : VAbstractTool(doc, data, id, parent), idNode(idNode), typeobject(typeobject){ } diff --git a/tools/nodeDetails/vabstractnode.h b/tools/nodeDetails/vabstractnode.h index a8f64ed0d..6b25f52bb 100644 --- a/tools/nodeDetails/vabstractnode.h +++ b/tools/nodeDetails/vabstractnode.h @@ -29,11 +29,11 @@ class VAbstractNode : public VAbstractTool Q_OBJECT public: VAbstractNode(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode, - Draw::Mode typeobject, QObject *parent = 0 ); + Draw::Draws typeobject, QObject *parent = 0 ); virtual ~VAbstractNode(); protected: qint64 idNode; - Draw::Mode typeobject; + Draw::Draws typeobject; void AddToModeling(const QDomElement &domElement); }; diff --git a/tools/nodeDetails/vnodearc.cpp b/tools/nodeDetails/vnodearc.cpp index 4498e50e0..1efae076b 100644 --- a/tools/nodeDetails/vnodearc.cpp +++ b/tools/nodeDetails/vnodearc.cpp @@ -21,7 +21,7 @@ #include "vnodearc.h" -VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, Draw::Mode typeobject, +VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, Draw::Draws typeobject, Tool::Enum typeCreation, QGraphicsItem * parent) : VAbstractNode(doc, data, id, idArc, typeobject), QGraphicsPathItem(parent){ RefreshGeometry(); @@ -35,7 +35,7 @@ VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, } VNodeArc *VNodeArc::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, - Draw::Mode typeobject, Document::Enum parse, Tool::Enum typeCreation){ + Draw::Draws typeobject, const Document::Documents &parse, Tool::Enum typeCreation){ VNodeArc *arc = 0; if(parse == Document::FullParse){ arc = new VNodeArc(doc, data, id, idArc, typeobject, typeCreation); diff --git a/tools/nodeDetails/vnodearc.h b/tools/nodeDetails/vnodearc.h index 071c2ecb5..e62db9c0e 100644 --- a/tools/nodeDetails/vnodearc.h +++ b/tools/nodeDetails/vnodearc.h @@ -29,10 +29,10 @@ class VNodeArc :public VAbstractNode, public QGraphicsPathItem { Q_OBJECT public: - VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, Draw::Mode typeobject, + VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, Draw::Draws typeobject, Tool::Enum typeCreation, QGraphicsItem * parent = 0); static VNodeArc *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, - Draw::Mode typeobject, Document::Enum parse, Tool::Enum typeCreation); + Draw::Draws typeobject, const Document::Documents &parse, Tool::Enum typeCreation); public slots: virtual void FullUpdateFromFile(); protected: diff --git a/tools/nodeDetails/vnodepoint.cpp b/tools/nodeDetails/vnodepoint.cpp index 1a529677c..5f2230a1e 100644 --- a/tools/nodeDetails/vnodepoint.cpp +++ b/tools/nodeDetails/vnodepoint.cpp @@ -22,7 +22,7 @@ #include "vnodepoint.h" VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, - Draw::Mode typeobject, Tool::Enum typeCreation, QGraphicsItem *parent) + Draw::Draws typeobject, Tool::Enum typeCreation, QGraphicsItem *parent) :VAbstractNode(doc, data, id, idPoint, typeobject), QGraphicsEllipseItem(parent), radius(toPixel(1.5)), namePoint(0), lineName(0){ namePoint = new VGraphicsSimpleTextItem(this); @@ -40,7 +40,7 @@ VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 id } VNodePoint *VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, - Draw::Mode typeobject, Document::Enum parse, Tool::Enum typeCreation){ + Draw::Draws typeobject, const Document::Documents &parse, Tool::Enum typeCreation){ VNodePoint *point = 0; if(parse == Document::FullParse){ point = new VNodePoint(doc, data, id, idPoint, typeobject, typeCreation); diff --git a/tools/nodeDetails/vnodepoint.h b/tools/nodeDetails/vnodepoint.h index 805a05303..568442feb 100644 --- a/tools/nodeDetails/vnodepoint.h +++ b/tools/nodeDetails/vnodepoint.h @@ -29,10 +29,10 @@ class VNodePoint: public VAbstractNode, public QGraphicsEllipseItem { Q_OBJECT public: - VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Mode typeobject, + VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Draws typeobject, Tool::Enum typeCreation, QGraphicsItem * parent = 0 ); static VNodePoint *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, - Draw::Mode typeobject, Document::Enum parse, Tool::Enum typeCreation); + Draw::Draws typeobject, const Document::Documents &parse, Tool::Enum typeCreation); public slots: virtual void FullUpdateFromFile(); void NameChangePosition(const QPointF pos); diff --git a/tools/nodeDetails/vnodespline.cpp b/tools/nodeDetails/vnodespline.cpp index 04a54b144..eb9d6fe34 100644 --- a/tools/nodeDetails/vnodespline.cpp +++ b/tools/nodeDetails/vnodespline.cpp @@ -22,7 +22,7 @@ #include "vnodespline.h" VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Mode typeobject, Tool::Enum typeCreation, QGraphicsItem * parent) : + Draw::Draws typeobject, Tool::Enum typeCreation, QGraphicsItem * parent) : VAbstractNode(doc, data, id, idSpline, typeobject), QGraphicsPathItem(parent){ RefreshGeometry(); this->setPen(QPen(baseColor, widthHairLine)); @@ -35,7 +35,7 @@ VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 } VNodeSpline *VNodeSpline::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Mode typeobject, Document::Enum parse, Tool::Enum typeCreation){ + Draw::Draws typeobject, const Document::Documents &parse, Tool::Enum typeCreation){ VNodeSpline *spl = 0; if(parse == Document::FullParse){ spl = new VNodeSpline(doc, data, id, idSpline, typeobject, typeCreation); diff --git a/tools/nodeDetails/vnodespline.h b/tools/nodeDetails/vnodespline.h index 8a4d1f152..d0a430d88 100644 --- a/tools/nodeDetails/vnodespline.h +++ b/tools/nodeDetails/vnodespline.h @@ -29,10 +29,10 @@ class VNodeSpline:public VAbstractNode, public QGraphicsPathItem { Q_OBJECT public: - VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Mode typeobject, + VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject, Tool::Enum typeCreation, QGraphicsItem * parent = 0); static VNodeSpline *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Mode typeobject, Document::Enum parse, Tool::Enum typeCreation); + Draw::Draws typeobject, const Document::Documents &parse, Tool::Enum typeCreation); public slots: virtual void FullUpdateFromFile (); protected: diff --git a/tools/nodeDetails/vnodesplinepath.cpp b/tools/nodeDetails/vnodesplinepath.cpp index 40da323d8..ac7ea617c 100644 --- a/tools/nodeDetails/vnodesplinepath.cpp +++ b/tools/nodeDetails/vnodesplinepath.cpp @@ -22,7 +22,7 @@ #include "vnodesplinepath.h" VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Mode typeobject, Tool::Enum typeCreation, + Draw::Draws typeobject, Tool::Enum typeCreation, QGraphicsItem * parent) : VAbstractNode(doc, data, id, idSpline, typeobject), QGraphicsPathItem(parent){ RefreshGeometry(); @@ -36,7 +36,7 @@ VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, } VNodeSplinePath *VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, - qint64 idSpline, Draw::Mode typeobject, Document::Enum parse, + qint64 idSpline, Draw::Draws typeobject, const Document::Documents &parse, Tool::Enum typeCreation){ VNodeSplinePath *splPath = 0; if(parse == Document::FullParse){ diff --git a/tools/nodeDetails/vnodesplinepath.h b/tools/nodeDetails/vnodesplinepath.h index 3514bbb0e..fafecb5c0 100644 --- a/tools/nodeDetails/vnodesplinepath.h +++ b/tools/nodeDetails/vnodesplinepath.h @@ -30,9 +30,9 @@ class VNodeSplinePath : public VAbstractNode, public QGraphicsPathItem Q_OBJECT public: VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Mode typeobject, Tool::Enum typeCreation, QGraphicsItem * parent = 0); + Draw::Draws typeobject, Tool::Enum typeCreation, QGraphicsItem * parent = 0); static VNodeSplinePath *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Mode typeobject, Document::Enum parse, Tool::Enum typeCreation); + Draw::Draws typeobject, const Document::Documents &parse, Tool::Enum typeCreation); public slots: virtual void FullUpdateFromFile(); protected: diff --git a/tools/vabstracttool.h b/tools/vabstracttool.h index 53a60f0ad..12df54292 100644 --- a/tools/vabstracttool.h +++ b/tools/vabstracttool.h @@ -51,7 +51,7 @@ public slots: virtual void FullUpdateFromFile()=0; signals: void toolhaveChange(); - void ChoosedTool(qint64 id, Scene::Type type); + void ChoosedTool(qint64 id, Scene::Scenes type); void FullUpdateTree(); protected: VDomDocument *doc; diff --git a/tools/vtooldetail.cpp b/tools/vtooldetail.cpp index 874ff1734..22cf34aa7 100644 --- a/tools/vtooldetail.cpp +++ b/tools/vtooldetail.cpp @@ -26,14 +26,14 @@ #include "modelingTools/modelingtools.h" VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, VDetail &oldDetail, - Tool::Enum typeCreation, Document::Enum parse, + Tool::Enum typeCreation, const Document::Documents &parse, VMainGraphicsScene *scene, QGraphicsItem *parent) :VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialogDetail(QSharedPointer()), sceneDetails(scene){ VDetail detail = data->GetDetail(id); for(qint32 i = 0; i< detail.CountNode(); ++i){ switch(detail[i].getTypeTool()){ - case(Tools::NodePoint):{ + case(Tool::NodePoint):{ VNodePoint *point = VNodePoint::Create(doc, data, detail[i].getId(), oldDetail[i].getId(), detail[i].getMode(), parse, typeCreation); connect(point, &VNodePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); @@ -42,7 +42,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, point->setParentItem(this); break; } - case(Tools::NodeArc):{ + case(Tool::NodeArc):{ VNodeArc *arc = VNodeArc::Create(doc, data, detail[i].getId(), oldDetail[i].getId(), detail[i].getMode(), parse, typeCreation); connect(arc, &VNodeArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); @@ -51,7 +51,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, arc->setParentItem(this); break; } - case(Tools::NodeSpline):{ + case(Tool::NodeSpline):{ VNodeSpline *spl = VNodeSpline::Create(doc, data, detail[i].getId(), oldDetail[i].getId(), detail[i].getMode(), parse, typeCreation); connect(spl, &VNodeSpline::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); @@ -60,7 +60,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, spl->setParentItem(this); break; } - case(Tools::NodeSplinePath):{ + case(Tool::NodeSplinePath):{ VNodeSplinePath *splPath = VNodeSplinePath::Create(doc, data, detail[i].getId(), oldDetail[i].getId(), detail[i].getMode(), parse, typeCreation); @@ -70,7 +70,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, splPath->setParentItem(this); break; } - case(Tools::AlongLineTool):{ + case(Tool::AlongLineTool):{ QMap* tools = doc->getTools(); VModelingAlongLine *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); @@ -78,7 +78,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, tool->setParentItem(this); break; } - case(Tools::ArcTool):{ + case(Tool::ArcTool):{ QMap* tools = doc->getTools(); VModelingArc *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); @@ -86,7 +86,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, tool->setParentItem(this); break; } - case(Tools::BisectorTool):{ + case(Tool::BisectorTool):{ QMap* tools = doc->getTools(); VModelingBisector *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); @@ -94,7 +94,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, tool->setParentItem(this); break; } - case(Tools::EndLineTool):{ + case(Tool::EndLineTool):{ QMap* tools = doc->getTools(); VModelingEndLine *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); @@ -102,7 +102,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, tool->setParentItem(this); break; } - case(Tools::LineIntersectTool):{ + case(Tool::LineIntersectTool):{ QMap* tools = doc->getTools(); VModelingLineIntersect *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); @@ -110,7 +110,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, tool->setParentItem(this); break; } - case(Tools::LineTool):{ + case(Tool::LineTool):{ QMap* tools = doc->getTools(); VModelingLine *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); @@ -118,7 +118,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, tool->setParentItem(this); break; } - case(Tools::NormalTool):{ + case(Tool::NormalTool):{ QMap* tools = doc->getTools(); VModelingNormal *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); @@ -126,7 +126,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, tool->setParentItem(this); break; } - case(Tools::PointOfContact):{ + case(Tool::PointOfContact):{ QMap* tools = doc->getTools(); VModelingPointOfContact *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); @@ -134,7 +134,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, tool->setParentItem(this); break; } - case(Tools::ShoulderPointTool):{ + case(Tool::ShoulderPointTool):{ QMap* tools = doc->getTools(); VModelingShoulderPoint *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); @@ -142,7 +142,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, tool->setParentItem(this); break; } - case(Tools::SplinePathTool):{ + case(Tool::SplinePathTool):{ QMap* tools = doc->getTools(); VModelingSplinePath *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); @@ -150,7 +150,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, tool->setParentItem(this); break; } - case(Tools::SplineTool):{ + case(Tool::SplineTool):{ QMap* tools = doc->getTools(); VModelingSpline *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); @@ -188,7 +188,7 @@ void VToolDetail::Create(QSharedPointer &dialog, VMainGraphicsScen for(qint32 i = 0; i< detail.CountNode(); ++i){ qint64 id = 0; switch(detail[i].getTypeTool()){ - case(Tools::NodePoint):{ + case(Tool::NodePoint):{ VPointF point; if(detail[i].getMode() == Draw::Calculation){ point = data->GetPoint(detail[i].getId()); @@ -198,7 +198,7 @@ void VToolDetail::Create(QSharedPointer &dialog, VMainGraphicsScen id = data->AddModelingPoint(point); } break; - case(Tools::NodeArc):{ + case(Tool::NodeArc):{ VArc arc; if(detail[i].getMode() == Draw::Calculation){ arc = data->GetArc(detail[i].getId()); @@ -208,7 +208,7 @@ void VToolDetail::Create(QSharedPointer &dialog, VMainGraphicsScen id = data->AddModelingArc(arc); } break; - case(Tools::NodeSpline):{ + case(Tool::NodeSpline):{ VSpline spline; if(detail[i].getMode() == Draw::Calculation){ spline = data->GetSpline(detail[i].getId()); @@ -218,7 +218,7 @@ void VToolDetail::Create(QSharedPointer &dialog, VMainGraphicsScen id = data->AddModelingSpline(spline); } break; - case(Tools::NodeSplinePath):{ + case(Tool::NodeSplinePath):{ VSplinePath splinePath; if(detail[i].getMode() == Draw::Calculation){ splinePath = data->GetSplinePath(detail[i].getId()); @@ -241,7 +241,7 @@ void VToolDetail::Create(QSharedPointer &dialog, VMainGraphicsScen void VToolDetail::Create(const qint64 _id, VDetail &newDetail, VDetail &oldDetail, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, Document::Enum parse, Tool::Enum typeCreation){ + VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddDetail(newDetail); @@ -333,49 +333,49 @@ void VToolDetail::AddNode(QDomElement &domElement, VNodeDetail &node){ AddAttribute(nod, "nodeType", "Modeling"); } switch(node.getTypeTool()){ - case(Tools::AlongLineTool): + case(Tool::AlongLineTool): AddAttribute(nod, "type", "AlongLineTool"); break; - case(Tools::ArcTool): + case(Tool::ArcTool): AddAttribute(nod, "type", "ArcTool"); break; - case(Tools::BisectorTool): + case(Tool::BisectorTool): AddAttribute(nod, "type", "BisectorTool"); break; - case(Tools::EndLineTool): + case(Tool::EndLineTool): AddAttribute(nod, "type", "EndLineTool"); break; - case(Tools::LineIntersectTool): + case(Tool::LineIntersectTool): AddAttribute(nod, "type", "LineIntersectTool"); break; - case(Tools::LineTool): + case(Tool::LineTool): AddAttribute(nod, "type", "LineTool"); break; - case(Tools::NodeArc): + case(Tool::NodeArc): AddAttribute(nod, "type", "NodeArc"); break; - case(Tools::NodePoint): + case(Tool::NodePoint): AddAttribute(nod, "type", "NodePoint"); break; - case(Tools::NodeSpline): + case(Tool::NodeSpline): AddAttribute(nod, "type", "NodeSpline"); break; - case(Tools::NodeSplinePath): + case(Tool::NodeSplinePath): AddAttribute(nod, "type", "NodeSplinePath"); break; - case(Tools::NormalTool): + case(Tool::NormalTool): AddAttribute(nod, "type", "NormalTool"); break; - case(Tools::PointOfContact): + case(Tool::PointOfContact): AddAttribute(nod, "type", "PointOfContact"); break; - case(Tools::ShoulderPointTool): + case(Tool::ShoulderPointTool): AddAttribute(nod, "type", "ShoulderPointTool"); break; - case(Tools::SplinePathTool): + case(Tool::SplinePathTool): AddAttribute(nod, "type", "SplinePathTool"); break; - case(Tools::SplineTool): + case(Tool::SplineTool): AddAttribute(nod, "type", "SplineTool"); break; default: diff --git a/tools/vtooldetail.h b/tools/vtooldetail.h index 88bdac88e..593517e78 100644 --- a/tools/vtooldetail.h +++ b/tools/vtooldetail.h @@ -31,18 +31,18 @@ class VToolDetail: public VAbstractTool, public QGraphicsPathItem Q_OBJECT public: VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, VDetail &oldDetail, - Tool::Enum typeCreation, Document::Enum parse, VMainGraphicsScene *scene, + Tool::Enum typeCreation, const Document::Documents &parse, VMainGraphicsScene *scene, QGraphicsItem * parent = 0); virtual void setDialog(); static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); static void Create(const qint64 _id, VDetail &newDetail, VDetail &oldDetail, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, Document::Enum parse, Tool::Enum typeCreation); - template - void AddTool(Tool *tool, const qint64 &id, Tools::Enum typeTool){ + VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); + template + void AddTool(T *tool, const qint64 &id, Tool::Tools typeTool){ tool->setParentItem(this); - connect(tool, &Tool::ChoosedTool, sceneDetails, &VMainGraphicsScene::ChoosedItem); + connect(tool, &T::ChoosedTool, sceneDetails, &VMainGraphicsScene::ChoosedItem); VNodeDetail node(id, typeTool, Draw::Modeling, NodeDetail::Modeling); VDetail det = VAbstractTool::data.GetDetail(this->id); det.append(node); diff --git a/widgets/vmaingraphicsscene.cpp b/widgets/vmaingraphicsscene.cpp index d8aa60dcf..74fee4735 100644 --- a/widgets/vmaingraphicsscene.cpp +++ b/widgets/vmaingraphicsscene.cpp @@ -42,7 +42,7 @@ void VMainGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *event){ QGraphicsScene::mousePressEvent(event); } -void VMainGraphicsScene::ChoosedItem(qint64 id, Scene::Type type){ +void VMainGraphicsScene::ChoosedItem(qint64 id, Scene::Scenes type){ emit ChoosedObject(id, type); } diff --git a/widgets/vmaingraphicsscene.h b/widgets/vmaingraphicsscene.h index 02ca05002..41ec68d89 100644 --- a/widgets/vmaingraphicsscene.h +++ b/widgets/vmaingraphicsscene.h @@ -40,7 +40,7 @@ public: void setVerScrollBar(const qint32 &value); public slots: - void ChoosedItem(qint64 id, Scene::Type type); + void ChoosedItem(qint64 id, Scene::Scenes type); void RemoveTool(QGraphicsItem *tool); protected: void mouseMoveEvent(QGraphicsSceneMouseEvent* event); @@ -48,7 +48,7 @@ protected: signals: void mouseMove(QPointF scenePos); void mousePress(QPointF scenePos); - void ChoosedObject(qint64 id, Scene::Type type); + void ChoosedObject(qint64 id, Scene::Scenes type); private: qint32 horScrollBar; qint32 verScrollBar; diff --git a/xml/vdomdocument.cpp b/xml/vdomdocument.cpp index 166e5d292..e1a6b592e 100644 --- a/xml/vdomdocument.cpp +++ b/xml/vdomdocument.cpp @@ -35,21 +35,21 @@ #include "exception/vexceptionobjecterror.h" -VDomDocument::VDomDocument(VContainer *data, QComboBox *comboBoxDraws, Draw::Mode *mode) : QDomDocument(), +VDomDocument::VDomDocument(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode) : QDomDocument(), map(QMap()), nameActivDraw(QString()), data(data), tools(QMap()), history(QVector()), cursor(0), comboBoxDraws(comboBoxDraws), mode(mode){ } VDomDocument::VDomDocument(const QString& name, VContainer *data, QComboBox *comboBoxDraws, - Draw::Mode *mode) : + Draw::Draws *mode) : QDomDocument(name), map(QMap()), nameActivDraw(QString()), data(data), tools(QMap()), history(QVector()), cursor(0), comboBoxDraws(comboBoxDraws), mode(mode){ } VDomDocument::VDomDocument(const QDomDocumentType& doctype, VContainer *data, QComboBox *comboBoxDraws, - Draw::Mode *mode) : + Draw::Draws *mode) : QDomDocument(doctype), map(QMap()), nameActivDraw(QString()), data(data), tools(QMap()), history(QVector()), cursor(0), comboBoxDraws(comboBoxDraws), mode(mode){ @@ -158,7 +158,7 @@ bool VDomDocument::appendDraw(const QString& name){ return false; } -void VDomDocument::ChangeActivDraw(const QString& name, Document::Enum parse){ +void VDomDocument::ChangeActivDraw(const QString& name, Document::Documents parse){ Q_ASSERT_X(!name.isEmpty(), "ChangeActivDraw", "name draw is empty"); if(CheckNameDraw(name) == true){ this->nameActivDraw = name; @@ -250,7 +250,7 @@ bool VDomDocument::GetActivNodeElement(const QString& name, QDomElement &element } } -void VDomDocument::Parse(Document::Enum parse, VMainGraphicsScene *sceneDraw, +void VDomDocument::Parse(Document::Documents parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail){ Q_CHECK_PTR(sceneDraw); Q_CHECK_PTR(sceneDetail); @@ -373,7 +373,7 @@ qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QStri void VDomDocument::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, - const QDomNode& node, Document::Enum parse){ + const QDomNode& node, const Document::Documents &parse){ QDomNode domNode = node.firstChild(); while(!domNode.isNull()){ if(domNode.isElement()){ @@ -396,7 +396,7 @@ void VDomDocument::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphics } void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, - const QDomNode& node, Document::Enum parse, Draw::Mode mode){ + const QDomNode& node, const Document::Documents &parse, Draw::Draws mode){ Q_CHECK_PTR(sceneDraw); Q_CHECK_PTR(sceneDetail); VMainGraphicsScene *scene = 0; @@ -427,7 +427,7 @@ void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsSce } void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, - Document::Enum parse){ + const Document::Documents &parse){ Q_CHECK_PTR(sceneDetail); Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try{ @@ -445,52 +445,52 @@ void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDo if(!element.isNull()){ if(element.tagName() == "node"){ qint64 id = GetParametrLongLong(element, "idObject"); - Tools::Enum tool; - Draw::Mode mode; - NodeDetail::Type nodeType = NodeDetail::Contour; + Tool::Tools tool; + Draw::Draws mode; + NodeDetail::NodeDetails nodeType = NodeDetail::Contour; QString t = GetParametrString(element, "type"); if(t == "NodePoint"){ - tool = Tools::NodePoint; + tool = Tool::NodePoint; VPointF point = data->GetModelingPoint(id); mode = point.getMode(); oldDetail.append(VNodeDetail(point.getIdObject(), tool, mode, NodeDetail::Contour)); } else if(t == "NodeArc"){ - tool = Tools::NodeArc; + tool = Tool::NodeArc; VArc arc = data->GetModelingArc(id); mode = arc.getMode(); oldDetail.append(VNodeDetail(arc.getIdObject(), tool, mode, NodeDetail::Contour)); } else if(t == "NodeSpline"){ - tool = Tools::NodeSpline; + tool = Tool::NodeSpline; VSpline spl = data->GetModelingSpline(id); mode = spl.getMode(); oldDetail.append(VNodeDetail(spl.getIdObject(), tool, mode, NodeDetail::Contour)); } else if(t == "NodeSplinePath"){ - tool = Tools::NodeSplinePath; + tool = Tool::NodeSplinePath; VSplinePath splPath = data->GetModelingSplinePath(id); mode = splPath.getMode(); oldDetail.append(VNodeDetail(splPath.getIdObject(), tool, mode, NodeDetail::Contour)); } else if(t == "AlongLineTool"){ - tool = Tools::AlongLineTool; + tool = Tool::AlongLineTool; } else if(t == "ArcTool"){ - tool = Tools::ArcTool; + tool = Tool::ArcTool; } else if(t == "BisectorTool"){ - tool = Tools::BisectorTool; + tool = Tool::BisectorTool; } else if(t == "EndLineTool"){ - tool = Tools::EndLineTool; + tool = Tool::EndLineTool; } else if(t == "LineIntersectTool"){ - tool = Tools::LineIntersectTool; + tool = Tool::LineIntersectTool; } else if(t == "LineTool"){ - tool = Tools::LineTool; + tool = Tool::LineTool; } else if(t == "NormalTool"){ - tool = Tools::NormalTool; + tool = Tool::NormalTool; } else if(t == "PointOfContact"){ - tool = Tools::PointOfContact; + tool = Tool::PointOfContact; } else if(t == "ShoulderPointTool"){ - tool = Tools::ShoulderPointTool; + tool = Tool::ShoulderPointTool; } else if(t == "SplinePathTool"){ - tool = Tools::SplinePathTool; + tool = Tool::SplinePathTool; } else if(t == "SplineTool"){ - tool = Tools::SplineTool; + tool = Tool::SplineTool; } detail.append(VNodeDetail(id, tool, mode, nodeType)); } @@ -506,7 +506,7 @@ void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDo } void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, - Document::Enum parse){ + const Document::Documents &parse){ Q_CHECK_PTR(sceneDetail); Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); QDomNode domNode = domElement.firstChild(); @@ -524,7 +524,7 @@ void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomEleme } void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement, - Document::Enum parse, const QString& type, Draw::Mode mode){ + const Document::Documents &parse, const QString& type, Draw::Draws mode){ Q_CHECK_PTR(scene); Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(!type.isEmpty(), Q_FUNC_INFO, "type of point is empty"); @@ -538,7 +538,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen qreal my = toPixel(GetParametrDouble(domElement, "my")); data->UpdatePoint(id, VPointF(x, y, name, mx, my)); - VDrawTool::AddRecord(id, Tools::SinglePointTool, this); + VDrawTool::AddRecord(id, Tool::SinglePointTool, this); if(parse != Document::FullParse){ UpdateToolData(id, data); } @@ -759,7 +759,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen qint64 idObject = GetParametrLongLong(domElement, "idObject"); QString tObject = GetParametrString(domElement, "typeObject"); VPointF point; - Draw::Mode typeObject; + Draw::Draws typeObject; if(tObject == "Calculation"){ typeObject = Draw::Calculation; point = data->GetPoint(idObject ); @@ -783,7 +783,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen } void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement, - Document::Enum parse, Draw::Mode mode){ + const Document::Documents &parse, Draw::Draws mode){ Q_CHECK_PTR(scene); Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try{ @@ -806,7 +806,7 @@ void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement } void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &domElement, - Document::Enum parse, const QString &type, Draw::Mode mode){ + const Document::Documents &parse, const QString &type, Draw::Draws mode){ Q_CHECK_PTR(scene); Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(!type.isEmpty(), Q_FUNC_INFO, "type of spline is empty"); @@ -878,7 +878,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme qint64 idObject = GetParametrLongLong(domElement, "idObject"); QString tObject = GetParametrString(domElement, "typeObject"); VSpline spl; - Draw::Mode typeObject; + Draw::Draws typeObject; if(tObject == "Calculation"){ typeObject = Draw::Calculation; spl = data->GetSpline(idObject); @@ -910,7 +910,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme qint64 idObject = GetParametrLongLong(domElement, "idObject"); QString tObject = GetParametrString(domElement, "typeObject"); VSplinePath path; - Draw::Mode typeObject; + Draw::Draws typeObject; if(tObject == "Calculation"){ typeObject = Draw::Calculation; path = data->GetSplinePath(idObject); @@ -940,7 +940,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme } void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &domElement, - Document::Enum parse, const QString &type, Draw::Mode mode){ + const Document::Documents &parse, const QString &type, Draw::Draws mode){ Q_CHECK_PTR(scene); Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(!type.isEmpty(), Q_FUNC_INFO, "type of spline is empty"); @@ -971,7 +971,7 @@ void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement qint64 idObject = GetParametrLongLong(domElement, "idObject"); QString tObject = GetParametrString(domElement, "typeObject"); VArc arc; - Draw::Mode typeObject; + Draw::Draws typeObject; if(tObject == "Calculation"){ typeObject = Draw::Calculation; arc = data->GetArc(idObject); diff --git a/xml/vdomdocument.h b/xml/vdomdocument.h index d7a04f484..14df1b4da 100644 --- a/xml/vdomdocument.h +++ b/xml/vdomdocument.h @@ -24,20 +24,17 @@ #include #include -#include #include #include "container/vcontainer.h" #include "widgets/vmaingraphicsscene.h" #include "tools/vdatatool.h" #include "vtoolrecord.h" -namespace Document{ - enum Enum - { - LiteParse, - FullParse - }; +namespace Document { + enum Document { LiteParse, FullParse}; + Q_DECLARE_FLAGS(Documents, Document) } +Q_DECLARE_OPERATORS_FOR_FLAGS(Document::Documents) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" @@ -45,15 +42,15 @@ class VDomDocument : public QObject, public QDomDocument { Q_OBJECT public: - VDomDocument(VContainer *data,QComboBox *comboBoxDraws, Draw::Mode *mode); + VDomDocument(VContainer *data,QComboBox *comboBoxDraws, Draw::Draws *mode); VDomDocument(const QString& name, VContainer *data, QComboBox *comboBoxDraws, - Draw::Mode *mode); + Draw::Draws *mode); VDomDocument(const QDomDocumentType& doctype, VContainer *data, QComboBox *comboBoxDraws, - Draw::Mode *mode); + Draw::Draws *mode); ~VDomDocument(); QDomElement elementById(const QString& id); void CreateEmptyFile(); - void ChangeActivDraw(const QString& name, Document::Enum parse = Document::FullParse); + void ChangeActivDraw(const QString& name, Document::Documents parse = Document::FullParse); QString GetNameActivDraw() const; bool GetActivDrawElement(QDomElement &element); bool GetActivCalculationElement(QDomElement &element); @@ -61,7 +58,7 @@ public: bool GetActivDetailsElement(QDomElement &element); bool appendDraw(const QString& name); void SetNameDraw(const QString& name); - void Parse(Document::Enum parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail); + void Parse(Document::Documents parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail); QMap* getTools(); QVector *getHistory(); qint64 getCursor() const; @@ -90,27 +87,27 @@ private: QVector history; qint64 cursor; QComboBox *comboBoxDraws; - Draw::Mode *mode; + Draw::Draws *mode; bool find(QDomElement node, const QString& id); bool CheckNameDraw(const QString& name) const; void SetActivDraw(const QString& name); bool GetActivNodeElement(const QString& name, QDomElement& element); void ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, - const QDomNode& node, Document::Enum parse); + const QDomNode& node, const Document::Documents &parse); void ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, - const QDomNode& node, Document::Enum parse, Draw::Mode mode); + const QDomNode& node, const Document::Documents &parse, Draw::Draws mode); void ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, - Document::Enum parse); + const Document::Documents &parse); void ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, - Document::Enum parse); + const Document::Documents &parse); void ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement, - Document::Enum parse, const QString &type, Draw::Mode mode); + const Document::Documents &parse, const QString &type, Draw::Draws mode); void ParseLineElement(VMainGraphicsScene *scene, const QDomElement& domElement, - Document::Enum parse, Draw::Mode mode); + const Document::Documents &parse, Draw::Draws mode); void ParseSplineElement(VMainGraphicsScene *scene, const QDomElement& domElement, - Document::Enum parse, const QString& type, Draw::Mode mode); + const Document::Documents &parse, const QString& type, Draw::Draws mode); void ParseArcElement(VMainGraphicsScene *scene, const QDomElement& domElement, - Document::Enum parse, const QString& type, Draw::Mode mode); + const Document::Documents &parse, const QString& type, Draw::Draws mode); void ParseIncrementsElement(const QDomNode& node); qint64 GetParametrId(const QDomElement& domElement) const; qint64 GetParametrLongLong(const QDomElement& domElement, const QString &name) const; diff --git a/xml/vtoolrecord.cpp b/xml/vtoolrecord.cpp index 178188078..5fe3279b4 100644 --- a/xml/vtoolrecord.cpp +++ b/xml/vtoolrecord.cpp @@ -21,10 +21,10 @@ #include "vtoolrecord.h" -VToolRecord::VToolRecord():id(0), typeTool(Tools::ArrowTool), nameDraw(QString()){ +VToolRecord::VToolRecord():id(0), typeTool(Tool::ArrowTool), nameDraw(QString()){ } -VToolRecord::VToolRecord(const qint64 &id, const Tools::Enum &typeTool, const QString &nameDraw):id(id), +VToolRecord::VToolRecord(const qint64 &id, const Tool::Tools &typeTool, const QString &nameDraw):id(id), typeTool(typeTool), nameDraw(nameDraw){ } @@ -36,11 +36,11 @@ void VToolRecord::setNameDraw(const QString &value){ nameDraw = value; } -Tools::Enum VToolRecord::getTypeTool() const{ +Tool::Tools VToolRecord::getTypeTool() const{ return typeTool; } -void VToolRecord::setTypeTool(const Tools::Enum &value){ +void VToolRecord::setTypeTool(const Tool::Tools &value){ typeTool = value; } diff --git a/xml/vtoolrecord.h b/xml/vtoolrecord.h index b644390f4..6292aab9f 100644 --- a/xml/vtoolrecord.h +++ b/xml/vtoolrecord.h @@ -22,7 +22,6 @@ #ifndef VTOOLRECORD_H #define VTOOLRECORD_H -#include #include #include "options.h" @@ -30,19 +29,19 @@ class VToolRecord { public: VToolRecord(); - VToolRecord(const qint64 &id, const Tools::Enum &typeTool, const QString &nameDraw); + VToolRecord(const qint64 &id, const Tool::Tools &typeTool, const QString &nameDraw); qint64 getId() const; void setId(const qint64 &value); - Tools::Enum getTypeTool() const; - void setTypeTool(const Tools::Enum &value); + Tool::Tools getTypeTool() const; + void setTypeTool(const Tool::Tools &value); QString getNameDraw() const; void setNameDraw(const QString &value); private: qint64 id; - Tools::Enum typeTool; + Tool::Tools typeTool; QString nameDraw; }; From 54a11e5e96d93eb12d307e536be342ebfc195188 Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 27 Sep 2013 12:43:50 +0300 Subject: [PATCH 03/10] Little change in class calculator. --HG-- branch : feature --- container/calculator.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/container/calculator.h b/container/calculator.h index 20def018f..d5ce32891 100644 --- a/container/calculator.h +++ b/container/calculator.h @@ -22,11 +22,9 @@ #ifndef CALCULATOR_H #define CALCULATOR_H -#include #include #include #include -#include #include "vcontainer.h" /** @@ -40,7 +38,7 @@ public: * @brief Calculator конструктор класу. Використовується при розрахунку лекала. * @param data покажчик на контейнер змінних */ - Calculator(const VContainer *data); + explicit Calculator(const VContainer *data); /** * @brief eval виконує розрахунок формули. * @param prog рядко в якому зберігається формула. From 14c8fdeee7ff4024a6980ce7e589801d5b7a3ec3 Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 29 Sep 2013 13:29:29 +0300 Subject: [PATCH 04/10] Fixed error in merging branches. --HG-- branch : feature --- container/calculator.cpp | 1 - container/calculator.h | 2 -- container/vpointf.cpp | 14 +++++++++++++- container/vpointf.h | 3 +-- tools/vabstracttool.h | 3 +-- tools/vdatatool.cpp | 4 ---- tools/vdatatool.h | 12 ++---------- xml/vdomdocument.cpp | 2 -- xml/vdomdocument.h | 2 +- 9 files changed, 18 insertions(+), 25 deletions(-) diff --git a/container/calculator.cpp b/container/calculator.cpp index 928499c18..d161724bb 100644 --- a/container/calculator.cpp +++ b/container/calculator.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "calculator.h" -#include #include #define DELIMITER 1 diff --git a/container/calculator.h b/container/calculator.h index d5ce32891..ad16c7f65 100644 --- a/container/calculator.h +++ b/container/calculator.h @@ -23,8 +23,6 @@ #define CALCULATOR_H #include -#include -#include #include "vcontainer.h" /** diff --git a/container/vpointf.cpp b/container/vpointf.cpp index b99c6fe2f..ae429b3e3 100644 --- a/container/vpointf.cpp +++ b/container/vpointf.cpp @@ -26,13 +26,25 @@ VPointF::VPointF():_name(QString()), _mx(0), _my(0), _x(0), _y(0), _referens(0), } VPointF::VPointF ( const VPointF & point ):_name(point.name()), _mx(point.mx()), _my(point.my()), - _x(point.x()), _y(point.y()), _referens(0), mode(point.getMode()), idObject(point.getIdObject()){ + _x(point.x()), _y(point.y()), _referens(point.referens()), mode(point.getMode()), idObject(point.getIdObject()){ } VPointF::VPointF (qreal x, qreal y , QString name, qreal mx, qreal my, Draw::Draws mode, qint64 idObject):_name(name), _mx(mx), _my(my), _x(x), _y(y), _referens(0), mode(mode), idObject(idObject){ } +VPointF &VPointF::operator =(const VPointF &point){ + _name = point.name(); + _mx = point.mx(); + _my = point.my(); + _x = point.x(); + _y = point.y(); + _referens = point.referens(); + mode = point.getMode(); + idObject = point.getIdObject(); + return *this; +} + VPointF::~VPointF(){ } diff --git a/container/vpointf.h b/container/vpointf.h index ef86307de..8db65792e 100644 --- a/container/vpointf.h +++ b/container/vpointf.h @@ -26,8 +26,7 @@ #include #include "options.h" -class VPointF -{ +class VPointF{ public: VPointF(); VPointF (const VPointF &point ); diff --git a/tools/vabstracttool.h b/tools/vabstracttool.h index 12df54292..390c717fd 100644 --- a/tools/vabstracttool.h +++ b/tools/vabstracttool.h @@ -34,8 +34,7 @@ namespace Tool{ }; } -class VAbstractTool:public VDataTool -{ +class VAbstractTool:public VDataTool{ Q_OBJECT public: VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0); diff --git a/tools/vdatatool.cpp b/tools/vdatatool.cpp index a187cd9cf..c35ad7514 100644 --- a/tools/vdatatool.cpp +++ b/tools/vdatatool.cpp @@ -33,10 +33,6 @@ VDataTool &VDataTool::operator =(const VDataTool &tool){ return *this; } -VContainer VDataTool::getData() const{ - return data; -} - void VDataTool::setData(const VContainer *value){ data = *value; } diff --git a/tools/vdatatool.h b/tools/vdatatool.h index 38b74c978..7e8781c49 100644 --- a/tools/vdatatool.h +++ b/tools/vdatatool.h @@ -22,26 +22,18 @@ #ifndef VDATATOOL_H #define VDATATOOL_H -#include #include "container/vcontainer.h" -class VDataTool : public QObject -{ +class VDataTool : public QObject{ Q_OBJECT public: explicit VDataTool(VContainer *data, QObject *parent = 0); virtual ~VDataTool(); VDataTool& operator= (const VDataTool &tool); - VContainer getData() const; + VContainer getData() const { return data; } void setData(const VContainer *value); - -signals: - -public slots: - protected: VContainer data; - }; #endif // VDATATOOL_H diff --git a/xml/vdomdocument.cpp b/xml/vdomdocument.cpp index 889a28022..94bbe603a 100644 --- a/xml/vdomdocument.cpp +++ b/xml/vdomdocument.cpp @@ -370,8 +370,6 @@ qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QStri return param; } - - void VDomDocument::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, const QDomNode& node, const Document::Documents &parse){ QDomNode domNode = node.firstChild(); diff --git a/xml/vdomdocument.h b/xml/vdomdocument.h index 14df1b4da..9a6d37270 100644 --- a/xml/vdomdocument.h +++ b/xml/vdomdocument.h @@ -112,7 +112,7 @@ private: qint64 GetParametrId(const QDomElement& domElement) const; qint64 GetParametrLongLong(const QDomElement& domElement, const QString &name) const; QString GetParametrString(const QDomElement& domElement, const QString &name) const; - qreal GetParametrDouble(const QDomElement& domElement, const QString &name) const; + qreal GetParametrDouble(const QDomElement& domElement, const QString &name) const; }; #pragma GCC diagnostic pop From 41ae42af4b4552cf8515a5d571638aefd8ce28fa Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 29 Sep 2013 13:58:45 +0300 Subject: [PATCH 05/10] Tool::Enum changed on Tool::Sources --HG-- branch : feature --- options.h | 4 ++++ tools/drawTools/vtoolalongline.cpp | 4 ++-- tools/drawTools/vtoolalongline.h | 4 ++-- tools/drawTools/vtoolarc.cpp | 4 ++-- tools/drawTools/vtoolarc.h | 4 ++-- tools/drawTools/vtoolbisector.cpp | 4 ++-- tools/drawTools/vtoolbisector.h | 4 ++-- tools/drawTools/vtoolendline.cpp | 4 ++-- tools/drawTools/vtoolendline.h | 4 ++-- tools/drawTools/vtoolline.cpp | 4 ++-- tools/drawTools/vtoolline.h | 4 ++-- tools/drawTools/vtoollineintersect.cpp | 4 ++-- tools/drawTools/vtoollineintersect.h | 4 ++-- tools/drawTools/vtoolnormal.cpp | 4 ++-- tools/drawTools/vtoolnormal.h | 4 ++-- tools/drawTools/vtoolpointofcontact.cpp | 4 ++-- tools/drawTools/vtoolpointofcontact.h | 4 ++-- tools/drawTools/vtoolshoulderpoint.cpp | 4 ++-- tools/drawTools/vtoolshoulderpoint.h | 4 ++-- tools/drawTools/vtoolsinglepoint.cpp | 2 +- tools/drawTools/vtoolsinglepoint.h | 2 +- tools/drawTools/vtoolspline.cpp | 4 ++-- tools/drawTools/vtoolspline.h | 4 ++-- tools/drawTools/vtoolsplinepath.cpp | 4 ++-- tools/drawTools/vtoolsplinepath.h | 4 ++-- tools/modelingTools/vmodelingalongline.cpp | 4 ++-- tools/modelingTools/vmodelingalongline.h | 4 ++-- tools/modelingTools/vmodelingarc.cpp | 4 ++-- tools/modelingTools/vmodelingarc.h | 4 ++-- tools/modelingTools/vmodelingbisector.cpp | 4 ++-- tools/modelingTools/vmodelingbisector.h | 4 ++-- tools/modelingTools/vmodelingendline.cpp | 4 ++-- tools/modelingTools/vmodelingendline.h | 4 ++-- tools/modelingTools/vmodelingline.cpp | 4 ++-- tools/modelingTools/vmodelingline.h | 4 ++-- tools/modelingTools/vmodelinglineintersect.cpp | 4 ++-- tools/modelingTools/vmodelinglineintersect.h | 4 ++-- tools/modelingTools/vmodelingnormal.cpp | 4 ++-- tools/modelingTools/vmodelingnormal.h | 4 ++-- tools/modelingTools/vmodelingpointofcontact.cpp | 4 ++-- tools/modelingTools/vmodelingpointofcontact.h | 4 ++-- tools/modelingTools/vmodelingshoulderpoint.cpp | 4 ++-- tools/modelingTools/vmodelingshoulderpoint.h | 4 ++-- tools/modelingTools/vmodelingsinglepoint.cpp | 2 +- tools/modelingTools/vmodelingsinglepoint.h | 2 +- tools/modelingTools/vmodelingspline.cpp | 4 ++-- tools/modelingTools/vmodelingspline.h | 4 ++-- tools/modelingTools/vmodelingsplinepath.cpp | 4 ++-- tools/modelingTools/vmodelingsplinepath.h | 4 ++-- tools/nodeDetails/vnodearc.cpp | 4 ++-- tools/nodeDetails/vnodearc.h | 4 ++-- tools/nodeDetails/vnodepoint.cpp | 4 ++-- tools/nodeDetails/vnodepoint.h | 4 ++-- tools/nodeDetails/vnodespline.cpp | 4 ++-- tools/nodeDetails/vnodespline.h | 4 ++-- tools/nodeDetails/vnodesplinepath.cpp | 4 ++-- tools/nodeDetails/vnodesplinepath.h | 4 ++-- tools/vabstracttool.h | 8 -------- tools/vtooldetail.cpp | 4 ++-- tools/vtooldetail.h | 4 ++-- 60 files changed, 116 insertions(+), 120 deletions(-) diff --git a/options.h b/options.h index 4aa46b7aa..d2620f3dd 100644 --- a/options.h +++ b/options.h @@ -58,8 +58,12 @@ enum Tool {ArrowTool, NodeSplinePath }; Q_DECLARE_FLAGS(Tools, Tool) + +enum Source { FromGui, FromFile }; +Q_DECLARE_FLAGS(Sources, Source) } Q_DECLARE_OPERATORS_FOR_FLAGS( Tool::Tools ) +Q_DECLARE_OPERATORS_FOR_FLAGS( Tool::Sources ) namespace Draw { enum Draw { Calculation, Modeling }; diff --git a/tools/drawTools/vtoolalongline.cpp b/tools/drawTools/vtoolalongline.cpp index eb6efcb53..02c278b73 100644 --- a/tools/drawTools/vtoolalongline.cpp +++ b/tools/drawTools/vtoolalongline.cpp @@ -27,7 +27,7 @@ VToolAlongLine::VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, - const QString &typeLine, Tool::Enum typeCreation, + const QString &typeLine, Tool::Sources typeCreation, QGraphicsItem *parent): VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, 0, parent), secondPointId(secondPointId), dialogAlongLine(QSharedPointer()){ @@ -117,7 +117,7 @@ void VToolAlongLine::Create(QSharedPointer &dialog, VMainGraphi void VToolAlongLine::Create(const qint64 _id, const QString &pointName, const QString &typeLine, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){ VPointF firstPoint = data->GetPoint(firstPointId); VPointF secondPoint = data->GetPoint(secondPointId); QLineF line = QLineF(firstPoint.toQPointF(), secondPoint.toQPointF()); diff --git a/tools/drawTools/vtoolalongline.h b/tools/drawTools/vtoolalongline.h index c21b36431..cbc88828d 100644 --- a/tools/drawTools/vtoolalongline.h +++ b/tools/drawTools/vtoolalongline.h @@ -31,14 +31,14 @@ class VToolAlongLine : public VToolLinePoint public: VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const QString &typeLine, - Tool::Enum typeCreation, QGraphicsItem * parent = 0); + Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolarc.cpp b/tools/drawTools/vtoolarc.cpp index ae57a8e20..1f7350973 100644 --- a/tools/drawTools/vtoolarc.cpp +++ b/tools/drawTools/vtoolarc.cpp @@ -23,7 +23,7 @@ #include #include "container/calculator.h" -VToolArc::VToolArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Enum typeCreation, +VToolArc::VToolArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem *parent):VDrawTool(doc, data, id), QGraphicsPathItem(parent), dialogArc(QSharedPointer()){ VArc arc = data->GetArc(id); @@ -62,7 +62,7 @@ void VToolArc::Create(QSharedPointer &dialog, VMainGraphicsScene *sce void VToolArc::Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1, const QString &f2, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){ qreal calcRadius = 0, calcF1 = 0, calcF2 = 0; Calculator cal(data); diff --git a/tools/drawTools/vtoolarc.h b/tools/drawTools/vtoolarc.h index fdd47b500..43c6ae195 100644 --- a/tools/drawTools/vtoolarc.h +++ b/tools/drawTools/vtoolarc.h @@ -33,14 +33,14 @@ class VToolArc :public VDrawTool, public QGraphicsPathItem { Q_OBJECT public: - VToolArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Enum typeCreation, + VToolArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); static void Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1, const QString &f2, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolbisector.cpp b/tools/drawTools/vtoolbisector.cpp index dced9cbec..ccad2a3b2 100644 --- a/tools/drawTools/vtoolbisector.cpp +++ b/tools/drawTools/vtoolbisector.cpp @@ -24,7 +24,7 @@ VToolBisector::VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Enum typeCreation, + const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Sources typeCreation, QGraphicsItem *parent): VToolLinePoint(doc, data, id, typeLine, formula, secondPointId, 0, parent), firstPointId(0), thirdPointId(0), dialogBisector(QSharedPointer()){ @@ -78,7 +78,7 @@ void VToolBisector::Create(const qint64 _id, const QString &formula, const qint6 const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Enum typeCreation){ + const Document::Documents &parse, Tool::Sources typeCreation){ VPointF firstPoint = data->GetPoint(firstPointId); VPointF secondPoint = data->GetPoint(secondPointId); VPointF thirdPoint = data->GetPoint(thirdPointId); diff --git a/tools/drawTools/vtoolbisector.h b/tools/drawTools/vtoolbisector.h index 2d6e1ad79..c9b23323e 100644 --- a/tools/drawTools/vtoolbisector.h +++ b/tools/drawTools/vtoolbisector.h @@ -31,7 +31,7 @@ class VToolBisector : public VToolLinePoint public: VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Enum typeCreation, + const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0); static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const QPointF &thirdPoint, const qreal& length); @@ -42,7 +42,7 @@ public: const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Enum typeCreation); + Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolendline.cpp b/tools/drawTools/vtoolendline.cpp index ee1348b0d..5b27d4888 100644 --- a/tools/drawTools/vtoolendline.cpp +++ b/tools/drawTools/vtoolendline.cpp @@ -26,7 +26,7 @@ VToolEndLine::VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &basePointId, - Tool::Enum typeCreation, QGraphicsItem *parent): + Tool::Sources typeCreation, QGraphicsItem *parent): VToolLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent), dialogEndLine(QSharedPointer()){ @@ -61,7 +61,7 @@ void VToolEndLine::Create(QSharedPointer &dialog, VMainGraphicsSc void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &basePointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){ VPointF basePoint = data->GetPoint(basePointId); QLineF line = QLineF(basePoint.toQPointF(), QPointF(basePoint.x()+100, basePoint.y())); diff --git a/tools/drawTools/vtoolendline.h b/tools/drawTools/vtoolendline.h index eff270cfb..d2656ed6d 100644 --- a/tools/drawTools/vtoolendline.h +++ b/tools/drawTools/vtoolendline.h @@ -32,7 +32,7 @@ class VToolEndLine : public VToolLinePoint public: VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, - const qint64 &basePointId, Tool::Enum typeCreation, + const qint64 &basePointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, @@ -40,7 +40,7 @@ public: static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &basePointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Enum typeCreation); + const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolline.cpp b/tools/drawTools/vtoolline.cpp index 7320ec4a3..6eca70621 100644 --- a/tools/drawTools/vtoolline.cpp +++ b/tools/drawTools/vtoolline.cpp @@ -24,7 +24,7 @@ #include VToolLine::VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, qint64 secondPoint, - Tool::Enum typeCreation, QGraphicsItem *parent):VDrawTool(doc, data, id), + Tool::Sources typeCreation, QGraphicsItem *parent):VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint), dialogLine(QSharedPointer()){ //Лінія @@ -54,7 +54,7 @@ void VToolLine::Create(QSharedPointer &dialog, VMainGraphicsScene *s void VToolLine::Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Enum typeCreation){ + Tool::Sources typeCreation){ Q_CHECK_PTR(scene); Q_CHECK_PTR(doc); Q_CHECK_PTR(data); diff --git a/tools/drawTools/vtoolline.h b/tools/drawTools/vtoolline.h index ee14cb88b..e39493385 100644 --- a/tools/drawTools/vtoolline.h +++ b/tools/drawTools/vtoolline.h @@ -31,13 +31,13 @@ class VToolLine: public VDrawTool, public QGraphicsLineItem Q_OBJECT public: VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, - qint64 secondPoint, Tool::Enum typeCreation, QGraphicsItem * parent = 0); + qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); static void Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Enum typeCreation); + const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void ChangedActivDraw(const QString newName); diff --git a/tools/drawTools/vtoollineintersect.cpp b/tools/drawTools/vtoollineintersect.cpp index eecbbbf55..9e642db4b 100644 --- a/tools/drawTools/vtoollineintersect.cpp +++ b/tools/drawTools/vtoollineintersect.cpp @@ -24,7 +24,7 @@ VToolLineIntersect::VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2, - const qint64 &p2Line2, Tool::Enum typeCreation, QGraphicsItem *parent): + const qint64 &p2Line2, Tool::Sources typeCreation, QGraphicsItem *parent): VToolPoint(doc, data, id, parent), p1Line1(p1Line1), p2Line1(p2Line1), p1Line2(p1Line2), p2Line2(p2Line2), dialogLineIntersect(QSharedPointer()){ if(typeCreation == Tool::FromGui){ @@ -58,7 +58,7 @@ void VToolLineIntersect::Create(QSharedPointer &dialog, VMa void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id, const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){ VPointF p1Line1 = data->GetPoint(p1Line1Id); VPointF p2Line1 = data->GetPoint(p2Line1Id); VPointF p1Line2 = data->GetPoint(p1Line2Id); diff --git a/tools/drawTools/vtoollineintersect.h b/tools/drawTools/vtoollineintersect.h index 61716bdc6..272cf81cb 100644 --- a/tools/drawTools/vtoollineintersect.h +++ b/tools/drawTools/vtoollineintersect.h @@ -33,7 +33,7 @@ public: const qint64 &id, const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2, - const qint64 &p2Line2, Tool::Enum typeCreation, + const qint64 &p2Line2, Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, @@ -41,7 +41,7 @@ public: static void Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id, const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolnormal.cpp b/tools/drawTools/vtoolnormal.cpp index 70cf295ac..c699b4e30 100644 --- a/tools/drawTools/vtoolnormal.cpp +++ b/tools/drawTools/vtoolnormal.cpp @@ -25,7 +25,7 @@ VToolNormal::VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &firstPointId, - const qint64 &secondPointId, Tool::Enum typeCreation, QGraphicsItem *parent): + const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem *parent): VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, angle, parent), secondPointId(secondPointId), dialogNormal(QSharedPointer()){ @@ -63,7 +63,7 @@ void VToolNormal::Create(QSharedPointer &dialog, VMainGraphicsScen void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const QString typeLine, const QString pointName, const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ + VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){ VPointF firstPoint = data->GetPoint(firstPointId); VPointF secondPoint = data->GetPoint(secondPointId); Calculator cal(data); diff --git a/tools/drawTools/vtoolnormal.h b/tools/drawTools/vtoolnormal.h index 9f6bdf613..4b258f882 100644 --- a/tools/drawTools/vtoolnormal.h +++ b/tools/drawTools/vtoolnormal.h @@ -33,7 +33,7 @@ public: VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &firstPointId, - const qint64 &secondPointId, Tool::Enum typeCreation, + const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, @@ -41,7 +41,7 @@ public: static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const QString typeLine, const QString pointName, const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); + VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length, const qreal &angle = 0); public slots: diff --git a/tools/drawTools/vtoolpointofcontact.cpp b/tools/drawTools/vtoolpointofcontact.cpp index 84b813c5c..2649502e4 100644 --- a/tools/drawTools/vtoolpointofcontact.cpp +++ b/tools/drawTools/vtoolpointofcontact.cpp @@ -24,7 +24,7 @@ VToolPointOfContact::VToolPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &radius, const qint64 ¢er, const qint64 &firstPointId, const qint64 &secondPointId, - Tool::Enum typeCreation, QGraphicsItem *parent) + Tool::Sources typeCreation, QGraphicsItem *parent) : VToolPoint(doc, data, id, parent), radius(radius), center(center), firstPointId(firstPointId), secondPointId(secondPointId), dialogPointOfContact(QSharedPointer()){ @@ -82,7 +82,7 @@ void VToolPointOfContact::Create(const qint64 _id, const QString &radius, const const qint64 &firstPointId, const qint64 &secondPointId, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Enum typeCreation){ + const Document::Documents &parse, Tool::Sources typeCreation){ VPointF centerP = data->GetPoint(center); VPointF firstP = data->GetPoint(firstPointId); VPointF secondP = data->GetPoint(secondPointId); diff --git a/tools/drawTools/vtoolpointofcontact.h b/tools/drawTools/vtoolpointofcontact.h index 7c5a881a7..8da8368ea 100644 --- a/tools/drawTools/vtoolpointofcontact.h +++ b/tools/drawTools/vtoolpointofcontact.h @@ -30,7 +30,7 @@ class VToolPointOfContact : public VToolPoint public: VToolPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &radius, const qint64 ¢er, const qint64 &firstPointId, - const qint64 &secondPointId, Tool::Enum typeCreation, QGraphicsItem * parent = 0); + const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static QPointF FindPoint(const qreal &radius, const QPointF ¢er, const QPointF &firstPoint, const QPointF &secondPoint); @@ -39,7 +39,7 @@ public: static void Create(const qint64 _id, const QString &radius, const qint64 ¢er, const qint64 &firstPointId, const qint64 &secondPointId, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolshoulderpoint.cpp b/tools/drawTools/vtoolshoulderpoint.cpp index 647ea1cff..a3737c402 100644 --- a/tools/drawTools/vtoolshoulderpoint.cpp +++ b/tools/drawTools/vtoolshoulderpoint.cpp @@ -25,7 +25,7 @@ VToolShoulderPoint::VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &p1Line, - const qint64 &p2Line, const qint64 &pShoulder, Tool::Enum typeCreation, + const qint64 &p2Line, const qint64 &pShoulder, Tool::Sources typeCreation, QGraphicsItem * parent): VToolLinePoint(doc, data, id, typeLine, formula, p1Line, 0, parent), p2Line(p2Line), pShoulder(pShoulder), dialogShoulderPoint(QSharedPointer()){ @@ -86,7 +86,7 @@ void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const const qint64 &p2Line, const qint64 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Enum typeCreation){ + const Document::Documents &parse, Tool::Sources typeCreation){ VPointF firstPoint = data->GetPoint(p1Line); VPointF secondPoint = data->GetPoint(p2Line); VPointF shoulderPoint = data->GetPoint(pShoulder); diff --git a/tools/drawTools/vtoolshoulderpoint.h b/tools/drawTools/vtoolshoulderpoint.h index d604db328..82fc40057 100644 --- a/tools/drawTools/vtoolshoulderpoint.h +++ b/tools/drawTools/vtoolshoulderpoint.h @@ -30,7 +30,7 @@ class VToolShoulderPoint : public VToolLinePoint public: VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &p1Line, - const qint64 &p2Line, const qint64 &pShoulder, Tool::Enum typeCreation, + const qint64 &p2Line, const qint64 &pShoulder, Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static QPointF FindPoint(const QPointF &p1Line, const QPointF &p2Line, const QPointF &pShoulder, @@ -40,7 +40,7 @@ public: static void Create(const qint64 _id, const QString &formula, const qint64 &p1Line, const qint64 &p2Line, const qint64 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolsinglepoint.cpp b/tools/drawTools/vtoolsinglepoint.cpp index ee19716e8..46e2c9dcc 100644 --- a/tools/drawTools/vtoolsinglepoint.cpp +++ b/tools/drawTools/vtoolsinglepoint.cpp @@ -30,7 +30,7 @@ #include "options.h" #include "container/vpointf.h" -VToolSinglePoint::VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, Tool::Enum typeCreation, +VToolSinglePoint::VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem * parent ):VToolPoint(doc, data, id, parent), dialogSinglePoint(QSharedPointer()){ this->setFlag(QGraphicsItem::ItemIsMovable, true); diff --git a/tools/drawTools/vtoolsinglepoint.h b/tools/drawTools/vtoolsinglepoint.h index 74756cf3a..ae12a1b7f 100644 --- a/tools/drawTools/vtoolsinglepoint.h +++ b/tools/drawTools/vtoolsinglepoint.h @@ -32,7 +32,7 @@ class VToolSinglePoint : public VToolPoint Q_OBJECT public: VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, - Tool::Enum typeCreation, QGraphicsItem * parent = 0 ); + Tool::Sources typeCreation, QGraphicsItem * parent = 0 ); virtual void setDialog(); public slots: virtual void FullUpdateFromFile(); diff --git a/tools/drawTools/vtoolspline.cpp b/tools/drawTools/vtoolspline.cpp index f1b3cf82a..a657f78a5 100644 --- a/tools/drawTools/vtoolspline.cpp +++ b/tools/drawTools/vtoolspline.cpp @@ -26,7 +26,7 @@ VToolSpline::VToolSpline(VDomDocument *doc, VContainer *data, qint64 id, - Tool::Enum typeCreation, + Tool::Sources typeCreation, QGraphicsItem *parent):VDrawTool(doc, data, id), QGraphicsPathItem(parent), dialogSpline(QSharedPointer()), controlPoints(QVector()){ @@ -90,7 +90,7 @@ void VToolSpline::Create(QSharedPointer &dialog, VMainGraphicsScen void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1, const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Enum typeCreation){ + Tool::Sources typeCreation){ VSpline spline = VSpline(data->DataPoints(), p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve); qint64 id = _id; if(typeCreation == Tool::FromGui){ diff --git a/tools/drawTools/vtoolspline.h b/tools/drawTools/vtoolspline.h index 39411fe88..79580a0fd 100644 --- a/tools/drawTools/vtoolspline.h +++ b/tools/drawTools/vtoolspline.h @@ -35,14 +35,14 @@ class VToolSpline:public VDrawTool, public QGraphicsPathItem Q_OBJECT public: VToolSpline (VDomDocument *doc, VContainer *data, qint64 id, - Tool::Enum typeCreation, QGraphicsItem * parent = 0 ); + Tool::Sources typeCreation, QGraphicsItem * parent = 0 ); virtual void setDialog(); static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); static void Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1, const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Enum typeCreation); + Tool::Sources typeCreation); signals: void RefreshLine ( const qint32 &indexSpline, SplinePoint::Position position, const QPointF &controlPoint, const QPointF &splinePoint ); diff --git a/tools/drawTools/vtoolsplinepath.cpp b/tools/drawTools/vtoolsplinepath.cpp index dee695678..e33e21678 100644 --- a/tools/drawTools/vtoolsplinepath.cpp +++ b/tools/drawTools/vtoolsplinepath.cpp @@ -23,7 +23,7 @@ #include VToolSplinePath::VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id, - Tool::Enum typeCreation, + Tool::Sources typeCreation, QGraphicsItem *parent):VDrawTool(doc, data, id), QGraphicsPathItem(parent), dialogSplinePath(QSharedPointer()), controlPoints(QVector()){ @@ -75,7 +75,7 @@ void VToolSplinePath::Create(QSharedPointer &dialog, VMainGrap void VToolSplinePath::Create(const qint64 _id, const VSplinePath &path, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Enum typeCreation){ + Tool::Sources typeCreation){ qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddSplinePath(path); diff --git a/tools/drawTools/vtoolsplinepath.h b/tools/drawTools/vtoolsplinepath.h index 598684d6d..b96e78105 100644 --- a/tools/drawTools/vtoolsplinepath.h +++ b/tools/drawTools/vtoolsplinepath.h @@ -34,13 +34,13 @@ class VToolSplinePath:public VDrawTool, public QGraphicsPathItem Q_OBJECT public: VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id, - Tool::Enum typeCreation, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); static void Create(const qint64 _id, const VSplinePath &path, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); + VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); signals: void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, const QPointF &controlPoint, const QPointF &splinePoint); diff --git a/tools/modelingTools/vmodelingalongline.cpp b/tools/modelingTools/vmodelingalongline.cpp index c57b31478..ee4049c6b 100644 --- a/tools/modelingTools/vmodelingalongline.cpp +++ b/tools/modelingTools/vmodelingalongline.cpp @@ -28,7 +28,7 @@ VModelingAlongLine::VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const QString &typeLine, - Tool::Enum typeCreation, QGraphicsItem *parent): + Tool::Sources typeCreation, QGraphicsItem *parent): VModelingLinePoint(doc, data, id, typeLine, formula, firstPointId, 0, parent), secondPointId(secondPointId), dialogAlongLine(QSharedPointer()){ @@ -114,7 +114,7 @@ VModelingAlongLine *VModelingAlongLine::Create(const qint64 _id, const QString & const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Enum typeCreation){ + Tool::Sources typeCreation){ VModelingAlongLine *point = 0; VPointF firstPoint = data->GetModelingPoint(firstPointId); VPointF secondPoint = data->GetModelingPoint(secondPointId); diff --git a/tools/modelingTools/vmodelingalongline.h b/tools/modelingTools/vmodelingalongline.h index b8e649770..421594b60 100644 --- a/tools/modelingTools/vmodelingalongline.h +++ b/tools/modelingTools/vmodelingalongline.h @@ -31,7 +31,7 @@ class VModelingAlongLine : public VModelingLinePoint public: VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const QString &typeLine, - Tool::Enum typeCreation, QGraphicsItem * parent = 0); + Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static VModelingAlongLine* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); @@ -39,7 +39,7 @@ public: const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Enum typeCreation); + Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingarc.cpp b/tools/modelingTools/vmodelingarc.cpp index a8df5f65c..8dba9111b 100644 --- a/tools/modelingTools/vmodelingarc.cpp +++ b/tools/modelingTools/vmodelingarc.cpp @@ -23,7 +23,7 @@ #include #include "container/calculator.h" -VModelingArc::VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Enum typeCreation, +VModelingArc::VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem *parent):VModelingTool(doc, data, id), QGraphicsPathItem(parent), dialogArc(QSharedPointer()){ VArc arc = data->GetModelingArc(id); @@ -61,7 +61,7 @@ VModelingArc* VModelingArc::Create(QSharedPointer &dialog, VDomDocume VModelingArc* VModelingArc::Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1, const QString &f2, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){ VModelingArc *toolArc = 0; qreal calcRadius = 0, calcF1 = 0, calcF2 = 0; diff --git a/tools/modelingTools/vmodelingarc.h b/tools/modelingTools/vmodelingarc.h index 12fe60a44..fc077b526 100644 --- a/tools/modelingTools/vmodelingarc.h +++ b/tools/modelingTools/vmodelingarc.h @@ -33,13 +33,13 @@ class VModelingArc :public VModelingTool, public QGraphicsPathItem { Q_OBJECT public: - VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Enum typeCreation, + VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static VModelingArc* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); static VModelingArc* Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1, const QString &f2, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Enum typeCreation); + const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingbisector.cpp b/tools/modelingTools/vmodelingbisector.cpp index ca424180b..835b6ff7a 100644 --- a/tools/modelingTools/vmodelingbisector.cpp +++ b/tools/modelingTools/vmodelingbisector.cpp @@ -24,7 +24,7 @@ VModelingBisector::VModelingBisector(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Enum typeCreation, + const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Sources typeCreation, QGraphicsItem *parent): VModelingLinePoint(doc, data, id, typeLine, formula, secondPointId, 0, parent), firstPointId(0), thirdPointId(0), dialogBisector(QSharedPointer()){ @@ -79,7 +79,7 @@ VModelingBisector *VModelingBisector::Create(const qint64 _id, const QString &fo const qint64 &thirdPointId, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Enum typeCreation){ + Tool::Sources typeCreation){ VModelingBisector *point = 0; VPointF firstPoint = data->GetModelingPoint(firstPointId); VPointF secondPoint = data->GetModelingPoint(secondPointId); diff --git a/tools/modelingTools/vmodelingbisector.h b/tools/modelingTools/vmodelingbisector.h index e272bc66e..74901745c 100644 --- a/tools/modelingTools/vmodelingbisector.h +++ b/tools/modelingTools/vmodelingbisector.h @@ -32,7 +32,7 @@ class VModelingBisector : public VModelingLinePoint public: VModelingBisector(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Enum typeCreation, + const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0); static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const QPointF &thirdPoint, const qreal& length); @@ -43,7 +43,7 @@ public: const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Enum typeCreation); + const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingendline.cpp b/tools/modelingTools/vmodelingendline.cpp index 514769e83..9ed074c6f 100644 --- a/tools/modelingTools/vmodelingendline.cpp +++ b/tools/modelingTools/vmodelingendline.cpp @@ -26,7 +26,7 @@ VModelingEndLine::VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &basePointId, - Tool::Enum typeCreation, QGraphicsItem *parent): + Tool::Sources typeCreation, QGraphicsItem *parent): VModelingLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent), dialogEndLine(QSharedPointer()){ @@ -62,7 +62,7 @@ VModelingEndLine *VModelingEndLine::Create(const qint64 _id, const QString &poin const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &basePointId, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Enum typeCreation){ + const Document::Documents &parse, Tool::Sources typeCreation){ VModelingEndLine *point = 0; VPointF basePoint = data->GetModelingPoint(basePointId); QLineF line = QLineF(basePoint.toQPointF(), QPointF(basePoint.x()+100, basePoint.y())); diff --git a/tools/modelingTools/vmodelingendline.h b/tools/modelingTools/vmodelingendline.h index a3b2b2fa0..27ea0c8c5 100644 --- a/tools/modelingTools/vmodelingendline.h +++ b/tools/modelingTools/vmodelingendline.h @@ -32,7 +32,7 @@ class VModelingEndLine : public VModelingLinePoint public: VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, - const qint64 &basePointId, Tool::Enum typeCreation, + const qint64 &basePointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static VModelingEndLine* Create(QSharedPointer &dialog, VDomDocument *doc, @@ -40,7 +40,7 @@ public: static VModelingEndLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &basePointId, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Enum typeCreation); + const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingline.cpp b/tools/modelingTools/vmodelingline.cpp index 6e614ba2a..958048248 100644 --- a/tools/modelingTools/vmodelingline.cpp +++ b/tools/modelingTools/vmodelingline.cpp @@ -24,7 +24,7 @@ #include VModelingLine::VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, - qint64 secondPoint, Tool::Enum typeCreation, QGraphicsItem *parent): + qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem *parent): VModelingTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint), dialogLine(QSharedPointer()){ //Лінія @@ -54,7 +54,7 @@ VModelingLine *VModelingLine::Create(QSharedPointer &dialog, VDomDoc VModelingLine *VModelingLine::Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint, VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Enum typeCreation){ + Tool::Sources typeCreation){ VModelingLine *line = 0; Q_CHECK_PTR(doc); Q_CHECK_PTR(data); diff --git a/tools/modelingTools/vmodelingline.h b/tools/modelingTools/vmodelingline.h index 023535fcf..30fdf0024 100644 --- a/tools/modelingTools/vmodelingline.h +++ b/tools/modelingTools/vmodelingline.h @@ -31,12 +31,12 @@ class VModelingLine: public VModelingTool, public QGraphicsLineItem Q_OBJECT public: VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, - qint64 secondPoint, Tool::Enum typeCreation, QGraphicsItem * parent = 0); + qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static VModelingLine* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); static VModelingLine* Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint, VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Enum typeCreation); + Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelinglineintersect.cpp b/tools/modelingTools/vmodelinglineintersect.cpp index ba920e6ad..971a0b205 100644 --- a/tools/modelingTools/vmodelinglineintersect.cpp +++ b/tools/modelingTools/vmodelinglineintersect.cpp @@ -24,7 +24,7 @@ VModelingLineIntersect::VModelingLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2, - const qint64 &p2Line2, Tool::Enum typeCreation, QGraphicsItem *parent): + const qint64 &p2Line2, Tool::Sources typeCreation, QGraphicsItem *parent): VModelingPoint(doc, data, id, parent), p1Line1(p1Line1), p2Line1(p2Line1), p1Line2(p1Line2), p2Line2(p2Line2), dialogLineIntersect(QSharedPointer()){ if(typeCreation == Tool::FromGui){ @@ -60,7 +60,7 @@ VModelingLineIntersect *VModelingLineIntersect::Create(const qint64 _id, const q const qint64 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Enum typeCreation){ + Tool::Sources typeCreation){ VModelingLineIntersect *point = 0; VPointF p1Line1 = data->GetModelingPoint(p1Line1Id); VPointF p2Line1 = data->GetModelingPoint(p2Line1Id); diff --git a/tools/modelingTools/vmodelinglineintersect.h b/tools/modelingTools/vmodelinglineintersect.h index e69c04532..599f0cdd7 100644 --- a/tools/modelingTools/vmodelinglineintersect.h +++ b/tools/modelingTools/vmodelinglineintersect.h @@ -33,7 +33,7 @@ public: const qint64 &id, const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2, - const qint64 &p2Line2, Tool::Enum typeCreation, + const qint64 &p2Line2, Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static VModelingLineIntersect* Create(QSharedPointer &dialog, @@ -42,7 +42,7 @@ public: const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Enum typeCreation); + Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingnormal.cpp b/tools/modelingTools/vmodelingnormal.cpp index f914305ab..e2c1a9164 100644 --- a/tools/modelingTools/vmodelingnormal.cpp +++ b/tools/modelingTools/vmodelingnormal.cpp @@ -25,7 +25,7 @@ VModelingNormal::VModelingNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &firstPointId, - const qint64 &secondPointId, Tool::Enum typeCreation, QGraphicsItem *parent): + const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem *parent): VModelingLinePoint(doc, data, id, typeLine, formula, firstPointId, angle, parent), secondPointId(secondPointId), dialogNormal(QSharedPointer()){ @@ -65,7 +65,7 @@ VModelingNormal *VModelingNormal::Create(const qint64 _id, const QString &formul const QString typeLine, const QString pointName, const qreal angle, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Enum typeCreation){ + Tool::Sources typeCreation){ VModelingNormal *point = 0; VPointF firstPoint = data->GetModelingPoint(firstPointId); VPointF secondPoint = data->GetModelingPoint(secondPointId); diff --git a/tools/modelingTools/vmodelingnormal.h b/tools/modelingTools/vmodelingnormal.h index 614c59e6d..a16d0435e 100644 --- a/tools/modelingTools/vmodelingnormal.h +++ b/tools/modelingTools/vmodelingnormal.h @@ -33,7 +33,7 @@ public: VModelingNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &firstPointId, - const qint64 &secondPointId, Tool::Enum typeCreation, + const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static VModelingNormal* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); @@ -41,7 +41,7 @@ public: const qint64 &secondPointId, const QString typeLine, const QString pointName, const qreal angle, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Enum typeCreation); + Tool::Sources typeCreation); static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length, const qreal &angle = 0); public slots: diff --git a/tools/modelingTools/vmodelingpointofcontact.cpp b/tools/modelingTools/vmodelingpointofcontact.cpp index 73b294df9..02aaacef1 100644 --- a/tools/modelingTools/vmodelingpointofcontact.cpp +++ b/tools/modelingTools/vmodelingpointofcontact.cpp @@ -24,7 +24,7 @@ VModelingPointOfContact::VModelingPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &radius, const qint64 ¢er, const qint64 &firstPointId, const qint64 &secondPointId, - Tool::Enum typeCreation, QGraphicsItem *parent) + Tool::Sources typeCreation, QGraphicsItem *parent) : VModelingPoint(doc, data, id, parent), radius(radius), center(center), firstPointId(firstPointId), secondPointId(secondPointId), dialogPointOfContact(QSharedPointer()){ @@ -84,7 +84,7 @@ VModelingPointOfContact *VModelingPointOfContact::Create(const qint64 _id, const const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Enum typeCreation){ + Tool::Sources typeCreation){ VModelingPointOfContact *point = 0; VPointF centerP = data->GetModelingPoint(center); VPointF firstP = data->GetModelingPoint(firstPointId); diff --git a/tools/modelingTools/vmodelingpointofcontact.h b/tools/modelingTools/vmodelingpointofcontact.h index 4cecbb6e0..63fcb02ef 100644 --- a/tools/modelingTools/vmodelingpointofcontact.h +++ b/tools/modelingTools/vmodelingpointofcontact.h @@ -31,7 +31,7 @@ class VModelingPointOfContact : public VModelingPoint public: VModelingPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &radius, const qint64 ¢er, const qint64 &firstPointId, - const qint64 &secondPointId, Tool::Enum typeCreation, QGraphicsItem * parent = 0); + const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static QPointF FindPoint(const qreal &radius, const QPointF ¢er, const QPointF &firstPoint, const QPointF &secondPoint); @@ -41,7 +41,7 @@ public: const qint64 &firstPointId, const qint64 &secondPointId, const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Enum typeCreation); + Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingshoulderpoint.cpp b/tools/modelingTools/vmodelingshoulderpoint.cpp index 70d539656..01e9d3cd8 100644 --- a/tools/modelingTools/vmodelingshoulderpoint.cpp +++ b/tools/modelingTools/vmodelingshoulderpoint.cpp @@ -25,7 +25,7 @@ VModelingShoulderPoint::VModelingShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &p1Line, - const qint64 &p2Line, const qint64 &pShoulder, Tool::Enum typeCreation, + const qint64 &p2Line, const qint64 &pShoulder, Tool::Sources typeCreation, QGraphicsItem * parent): VModelingLinePoint(doc, data, id, typeLine, formula, p1Line, 0, parent), p2Line(p2Line), pShoulder(pShoulder), dialogShoulderPoint(QSharedPointer()){ @@ -87,7 +87,7 @@ VModelingShoulderPoint *VModelingShoulderPoint::Create(const qint64 _id, const Q const qint64 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Enum typeCreation){ + const Document::Documents &parse, Tool::Sources typeCreation){ VModelingShoulderPoint *point = 0; VPointF firstPoint = data->GetModelingPoint(p1Line); VPointF secondPoint = data->GetModelingPoint(p2Line); diff --git a/tools/modelingTools/vmodelingshoulderpoint.h b/tools/modelingTools/vmodelingshoulderpoint.h index f6c2d0a75..165146775 100644 --- a/tools/modelingTools/vmodelingshoulderpoint.h +++ b/tools/modelingTools/vmodelingshoulderpoint.h @@ -31,7 +31,7 @@ class VModelingShoulderPoint : public VModelingLinePoint public: VModelingShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &p1Line, - const qint64 &p2Line, const qint64 &pShoulder, Tool::Enum typeCreation, + const qint64 &p2Line, const qint64 &pShoulder, Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static QPointF FindPoint(const QPointF &p1Line, const QPointF &p2Line, const QPointF &pShoulder, @@ -42,7 +42,7 @@ public: const qint64 &p2Line, const qint64 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingsinglepoint.cpp b/tools/modelingTools/vmodelingsinglepoint.cpp index 702f713e3..df9b1f0f5 100644 --- a/tools/modelingTools/vmodelingsinglepoint.cpp +++ b/tools/modelingTools/vmodelingsinglepoint.cpp @@ -9,7 +9,7 @@ #include "options.h" #include "container/vpointf.h" -VModelingSinglePoint::VModelingSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, Tool::Enum typeCreation, +VModelingSinglePoint::VModelingSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem * parent ):VModelingPoint(doc, data, id, parent), dialogSinglePoint(QSharedPointer()){ this->setFlag(QGraphicsItem::ItemIsMovable, true); diff --git a/tools/modelingTools/vmodelingsinglepoint.h b/tools/modelingTools/vmodelingsinglepoint.h index 95ab9e29a..0695becb3 100644 --- a/tools/modelingTools/vmodelingsinglepoint.h +++ b/tools/modelingTools/vmodelingsinglepoint.h @@ -11,7 +11,7 @@ class VModelingSinglePoint : public VModelingPoint Q_OBJECT public: VModelingSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, - Tool::Enum typeCreation, QGraphicsItem * parent = 0 ); + Tool::Sources typeCreation, QGraphicsItem * parent = 0 ); virtual void setDialog(); public slots: virtual void FullUpdateFromFile(); diff --git a/tools/modelingTools/vmodelingspline.cpp b/tools/modelingTools/vmodelingspline.cpp index 30ec59df2..27c3f043b 100644 --- a/tools/modelingTools/vmodelingspline.cpp +++ b/tools/modelingTools/vmodelingspline.cpp @@ -26,7 +26,7 @@ VModelingSpline::VModelingSpline(VDomDocument *doc, VContainer *data, qint64 id, - Tool::Enum typeCreation, + Tool::Sources typeCreation, QGraphicsItem *parent):VModelingTool(doc, data, id), QGraphicsPathItem(parent), dialogSpline(QSharedPointer()), controlPoints(QVector()){ @@ -90,7 +90,7 @@ VModelingSpline *VModelingSpline::Create(QSharedPointer &dialog, V VModelingSpline *VModelingSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1, const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){ VModelingSpline *spl = 0; VSpline spline = VSpline(data->DataModelingPoints(), p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve); qint64 id = _id; diff --git a/tools/modelingTools/vmodelingspline.h b/tools/modelingTools/vmodelingspline.h index 094043e53..cb0ab88b6 100644 --- a/tools/modelingTools/vmodelingspline.h +++ b/tools/modelingTools/vmodelingspline.h @@ -35,14 +35,14 @@ class VModelingSpline:public VModelingTool, public QGraphicsPathItem Q_OBJECT public: VModelingSpline (VDomDocument *doc, VContainer *data, qint64 id, - Tool::Enum typeCreation, QGraphicsItem * parent = 0 ); + Tool::Sources typeCreation, QGraphicsItem * parent = 0 ); virtual void setDialog(); static VModelingSpline* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); static VModelingSpline* Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1, const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Enum typeCreation); + const Document::Documents &parse, Tool::Sources typeCreation); signals: void RefreshLine ( const qint32 &indexSpline, SplinePoint::Position position, const QPointF &controlPoint, const QPointF &splinePoint ); diff --git a/tools/modelingTools/vmodelingsplinepath.cpp b/tools/modelingTools/vmodelingsplinepath.cpp index 3e80ef419..765e57010 100644 --- a/tools/modelingTools/vmodelingsplinepath.cpp +++ b/tools/modelingTools/vmodelingsplinepath.cpp @@ -23,7 +23,7 @@ #include VModelingSplinePath::VModelingSplinePath(VDomDocument *doc, VContainer *data, qint64 id, - Tool::Enum typeCreation, + Tool::Sources typeCreation, QGraphicsItem *parent):VModelingTool(doc, data, id), QGraphicsPathItem(parent), dialogSplinePath(QSharedPointer()), controlPoints(QVector()){ @@ -75,7 +75,7 @@ VModelingSplinePath *VModelingSplinePath::Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); static VModelingSplinePath* Create(const qint64 _id, const VSplinePath &path, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); signals: void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, const QPointF &controlPoint, const QPointF &splinePoint); diff --git a/tools/nodeDetails/vnodearc.cpp b/tools/nodeDetails/vnodearc.cpp index 1efae076b..e35e9f910 100644 --- a/tools/nodeDetails/vnodearc.cpp +++ b/tools/nodeDetails/vnodearc.cpp @@ -22,7 +22,7 @@ #include "vnodearc.h" VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, Draw::Draws typeobject, - Tool::Enum typeCreation, QGraphicsItem * parent) : + Tool::Sources typeCreation, QGraphicsItem * parent) : VAbstractNode(doc, data, id, idArc, typeobject), QGraphicsPathItem(parent){ RefreshGeometry(); this->setPen(QPen(baseColor, widthHairLine)); @@ -35,7 +35,7 @@ VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, } VNodeArc *VNodeArc::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, - Draw::Draws typeobject, const Document::Documents &parse, Tool::Enum typeCreation){ + Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation){ VNodeArc *arc = 0; if(parse == Document::FullParse){ arc = new VNodeArc(doc, data, id, idArc, typeobject, typeCreation); diff --git a/tools/nodeDetails/vnodearc.h b/tools/nodeDetails/vnodearc.h index e62db9c0e..f82c3d776 100644 --- a/tools/nodeDetails/vnodearc.h +++ b/tools/nodeDetails/vnodearc.h @@ -30,9 +30,9 @@ class VNodeArc :public VAbstractNode, public QGraphicsPathItem Q_OBJECT public: VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, Draw::Draws typeobject, - Tool::Enum typeCreation, QGraphicsItem * parent = 0); + Tool::Sources typeCreation, QGraphicsItem * parent = 0); static VNodeArc *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, - Draw::Draws typeobject, const Document::Documents &parse, Tool::Enum typeCreation); + Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); protected: diff --git a/tools/nodeDetails/vnodepoint.cpp b/tools/nodeDetails/vnodepoint.cpp index 5f2230a1e..b43431789 100644 --- a/tools/nodeDetails/vnodepoint.cpp +++ b/tools/nodeDetails/vnodepoint.cpp @@ -22,7 +22,7 @@ #include "vnodepoint.h" VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, - Draw::Draws typeobject, Tool::Enum typeCreation, QGraphicsItem *parent) + Draw::Draws typeobject, Tool::Sources typeCreation, QGraphicsItem *parent) :VAbstractNode(doc, data, id, idPoint, typeobject), QGraphicsEllipseItem(parent), radius(toPixel(1.5)), namePoint(0), lineName(0){ namePoint = new VGraphicsSimpleTextItem(this); @@ -40,7 +40,7 @@ VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 id } VNodePoint *VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, - Draw::Draws typeobject, const Document::Documents &parse, Tool::Enum typeCreation){ + Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation){ VNodePoint *point = 0; if(parse == Document::FullParse){ point = new VNodePoint(doc, data, id, idPoint, typeobject, typeCreation); diff --git a/tools/nodeDetails/vnodepoint.h b/tools/nodeDetails/vnodepoint.h index 568442feb..336333053 100644 --- a/tools/nodeDetails/vnodepoint.h +++ b/tools/nodeDetails/vnodepoint.h @@ -30,9 +30,9 @@ class VNodePoint: public VAbstractNode, public QGraphicsEllipseItem Q_OBJECT public: VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Draws typeobject, - Tool::Enum typeCreation, QGraphicsItem * parent = 0 ); + Tool::Sources typeCreation, QGraphicsItem * parent = 0 ); static VNodePoint *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, - Draw::Draws typeobject, const Document::Documents &parse, Tool::Enum typeCreation); + Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); void NameChangePosition(const QPointF pos); diff --git a/tools/nodeDetails/vnodespline.cpp b/tools/nodeDetails/vnodespline.cpp index eb9d6fe34..00a7ffe91 100644 --- a/tools/nodeDetails/vnodespline.cpp +++ b/tools/nodeDetails/vnodespline.cpp @@ -22,7 +22,7 @@ #include "vnodespline.h" VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Draws typeobject, Tool::Enum typeCreation, QGraphicsItem * parent) : + Draw::Draws typeobject, Tool::Sources typeCreation, QGraphicsItem * parent) : VAbstractNode(doc, data, id, idSpline, typeobject), QGraphicsPathItem(parent){ RefreshGeometry(); this->setPen(QPen(baseColor, widthHairLine)); @@ -35,7 +35,7 @@ VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 } VNodeSpline *VNodeSpline::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Draws typeobject, const Document::Documents &parse, Tool::Enum typeCreation){ + Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation){ VNodeSpline *spl = 0; if(parse == Document::FullParse){ spl = new VNodeSpline(doc, data, id, idSpline, typeobject, typeCreation); diff --git a/tools/nodeDetails/vnodespline.h b/tools/nodeDetails/vnodespline.h index d0a430d88..5e076f9ec 100644 --- a/tools/nodeDetails/vnodespline.h +++ b/tools/nodeDetails/vnodespline.h @@ -30,9 +30,9 @@ class VNodeSpline:public VAbstractNode, public QGraphicsPathItem Q_OBJECT public: VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject, - Tool::Enum typeCreation, QGraphicsItem * parent = 0); + Tool::Sources typeCreation, QGraphicsItem * parent = 0); static VNodeSpline *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Draws typeobject, const Document::Documents &parse, Tool::Enum typeCreation); + Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile (); protected: diff --git a/tools/nodeDetails/vnodesplinepath.cpp b/tools/nodeDetails/vnodesplinepath.cpp index ac7ea617c..aa0d4b87c 100644 --- a/tools/nodeDetails/vnodesplinepath.cpp +++ b/tools/nodeDetails/vnodesplinepath.cpp @@ -22,7 +22,7 @@ #include "vnodesplinepath.h" VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Draws typeobject, Tool::Enum typeCreation, + Draw::Draws typeobject, Tool::Sources typeCreation, QGraphicsItem * parent) : VAbstractNode(doc, data, id, idSpline, typeobject), QGraphicsPathItem(parent){ RefreshGeometry(); @@ -37,7 +37,7 @@ VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, VNodeSplinePath *VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject, const Document::Documents &parse, - Tool::Enum typeCreation){ + Tool::Sources typeCreation){ VNodeSplinePath *splPath = 0; if(parse == Document::FullParse){ splPath = new VNodeSplinePath(doc, data, id, idSpline, typeobject, typeCreation); diff --git a/tools/nodeDetails/vnodesplinepath.h b/tools/nodeDetails/vnodesplinepath.h index fafecb5c0..542eae3d9 100644 --- a/tools/nodeDetails/vnodesplinepath.h +++ b/tools/nodeDetails/vnodesplinepath.h @@ -30,9 +30,9 @@ class VNodeSplinePath : public VAbstractNode, public QGraphicsPathItem Q_OBJECT public: VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Draws typeobject, Tool::Enum typeCreation, QGraphicsItem * parent = 0); + Draw::Draws typeobject, Tool::Sources typeCreation, QGraphicsItem * parent = 0); static VNodeSplinePath *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Draws typeobject, const Document::Documents &parse, Tool::Enum typeCreation); + Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); protected: diff --git a/tools/vabstracttool.h b/tools/vabstracttool.h index 390c717fd..e9a32167f 100644 --- a/tools/vabstracttool.h +++ b/tools/vabstracttool.h @@ -26,14 +26,6 @@ #include "vdatatool.h" #include "container/vcontainer.h" -namespace Tool{ - enum Enum - { - FromGui, - FromFile - }; -} - class VAbstractTool:public VDataTool{ Q_OBJECT public: diff --git a/tools/vtooldetail.cpp b/tools/vtooldetail.cpp index 22cf34aa7..ff1a6466a 100644 --- a/tools/vtooldetail.cpp +++ b/tools/vtooldetail.cpp @@ -26,7 +26,7 @@ #include "modelingTools/modelingtools.h" VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, VDetail &oldDetail, - Tool::Enum typeCreation, const Document::Documents &parse, + Tool::Sources typeCreation, const Document::Documents &parse, VMainGraphicsScene *scene, QGraphicsItem *parent) :VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialogDetail(QSharedPointer()), sceneDetails(scene){ @@ -241,7 +241,7 @@ void VToolDetail::Create(QSharedPointer &dialog, VMainGraphicsScen void VToolDetail::Create(const qint64 _id, VDetail &newDetail, VDetail &oldDetail, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation){ + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){ qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddDetail(newDetail); diff --git a/tools/vtooldetail.h b/tools/vtooldetail.h index 593517e78..d275996cf 100644 --- a/tools/vtooldetail.h +++ b/tools/vtooldetail.h @@ -31,14 +31,14 @@ class VToolDetail: public VAbstractTool, public QGraphicsPathItem Q_OBJECT public: VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, VDetail &oldDetail, - Tool::Enum typeCreation, const Document::Documents &parse, VMainGraphicsScene *scene, + Tool::Sources typeCreation, const Document::Documents &parse, VMainGraphicsScene *scene, QGraphicsItem * parent = 0); virtual void setDialog(); static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); static void Create(const qint64 _id, VDetail &newDetail, VDetail &oldDetail, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Enum typeCreation); + VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); template void AddTool(T *tool, const qint64 &id, Tool::Tools typeTool){ tool->setParentItem(this); From 66cecc3f3d4f1fdde413edbf561721ad68d57599 Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 29 Sep 2013 14:53:42 +0300 Subject: [PATCH 06/10] Changes in VDataTool. --HG-- branch : feature --- tools/vabstracttool.h | 2 +- tools/vdatatool.cpp | 7 ------- tools/vdatatool.h | 4 ++-- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/tools/vabstracttool.h b/tools/vabstracttool.h index e9a32167f..49b9a9377 100644 --- a/tools/vabstracttool.h +++ b/tools/vabstracttool.h @@ -26,7 +26,7 @@ #include "vdatatool.h" #include "container/vcontainer.h" -class VAbstractTool:public VDataTool{ +class VAbstractTool: public VDataTool{ Q_OBJECT public: VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0); diff --git a/tools/vdatatool.cpp b/tools/vdatatool.cpp index c35ad7514..8d26481cb 100644 --- a/tools/vdatatool.cpp +++ b/tools/vdatatool.cpp @@ -21,13 +21,6 @@ #include "vdatatool.h" -VDataTool::VDataTool(VContainer *data, QObject *parent) : - QObject(parent), data(*data){ -} - -VDataTool::~VDataTool(){ -} - VDataTool &VDataTool::operator =(const VDataTool &tool){ data = tool.getData(); return *this; diff --git a/tools/vdatatool.h b/tools/vdatatool.h index 7e8781c49..11749d364 100644 --- a/tools/vdatatool.h +++ b/tools/vdatatool.h @@ -27,8 +27,8 @@ class VDataTool : public QObject{ Q_OBJECT public: - explicit VDataTool(VContainer *data, QObject *parent = 0); - virtual ~VDataTool(); + explicit VDataTool(VContainer *data, QObject *parent = 0): QObject(parent), data(*data){} + virtual ~VDataTool(){} VDataTool& operator= (const VDataTool &tool); VContainer getData() const { return data; } void setData(const VContainer *value); From b46d1968ba92613dca7f81a1e0540279d9e8d762 Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 29 Sep 2013 15:21:17 +0300 Subject: [PATCH 07/10] New field referens in class VDataTool. --HG-- branch : feature --- tools/vdatatool.cpp | 1 + tools/vdatatool.h | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/vdatatool.cpp b/tools/vdatatool.cpp index 8d26481cb..987c237d8 100644 --- a/tools/vdatatool.cpp +++ b/tools/vdatatool.cpp @@ -23,6 +23,7 @@ VDataTool &VDataTool::operator =(const VDataTool &tool){ data = tool.getData(); + _referens = tool.referens(); return *this; } diff --git a/tools/vdatatool.h b/tools/vdatatool.h index 11749d364..f6c114121 100644 --- a/tools/vdatatool.h +++ b/tools/vdatatool.h @@ -24,16 +24,21 @@ #include "container/vcontainer.h" +//We need QObject class because we use qobject_cast. class VDataTool : public QObject{ Q_OBJECT public: - explicit VDataTool(VContainer *data, QObject *parent = 0): QObject(parent), data(*data){} + explicit VDataTool(VContainer *data, QObject *parent = 0): QObject(parent), data(*data), _referens(0){} virtual ~VDataTool(){} VDataTool& operator= (const VDataTool &tool); VContainer getData() const { return data; } void setData(const VContainer *value); + qint64 referens() const {return _referens;} + void incrementReferens(){++_referens;} + void decrementReferens(){--_referens;} protected: VContainer data; + qint64 _referens; }; #endif // VDATATOOL_H From 3782400aae5136e22f1d3403065f99fb1b97cc78 Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 30 Sep 2013 19:29:03 +0300 Subject: [PATCH 08/10] Added option delete object ( for tools, details ). --HG-- branch : feature --- container/vcontainer.cpp | 70 -------- container/vcontainer.h | 1 - container/vpointf.cpp | 92 ----------- container/vpointf.h | 66 ++++---- geometry/varc.cpp | 36 +---- geometry/varc.h | 5 - geometry/vdetail.h | 6 +- geometry/vnodedetail.h | 1 - geometry/vspline.cpp | 27 +--- geometry/vspline.h | 4 - geometry/vsplinepath.cpp | 40 ++--- geometry/vsplinepath.h | 15 +- geometry/vsplinepoint.h | 1 - mainwindow.cpp | 2 +- tools/drawTools/vdrawtool.h | 13 +- tools/drawTools/vtoolalongline.cpp | 25 ++- tools/drawTools/vtoolalongline.h | 2 +- tools/drawTools/vtoolarc.cpp | 23 ++- tools/drawTools/vtoolarc.h | 1 + tools/drawTools/vtoolbisector.cpp | 26 ++- tools/drawTools/vtoolbisector.h | 1 + tools/drawTools/vtoolendline.cpp | 18 +-- tools/drawTools/vtoolline.cpp | 20 +-- tools/drawTools/vtoolline.h | 1 + tools/drawTools/vtoollineintersect.cpp | 28 ++-- tools/drawTools/vtoollineintersect.h | 33 ++-- tools/drawTools/vtoollinepoint.cpp | 4 + tools/drawTools/vtoollinepoint.h | 13 +- tools/drawTools/vtoolnormal.cpp | 24 ++- tools/drawTools/vtoolnormal.h | 1 + tools/drawTools/vtoolpoint.h | 11 +- tools/drawTools/vtoolpointofcontact.cpp | 26 ++- tools/drawTools/vtoolpointofcontact.h | 1 + tools/drawTools/vtoolshoulderpoint.cpp | 26 ++- tools/drawTools/vtoolshoulderpoint.h | 1 + tools/drawTools/vtoolsinglepoint.cpp | 6 + tools/drawTools/vtoolsinglepoint.h | 1 + tools/drawTools/vtoolspline.cpp | 25 ++- tools/drawTools/vtoolspline.h | 1 + tools/drawTools/vtoolsplinepath.cpp | 27 ++-- tools/drawTools/vtoolsplinepath.h | 15 +- tools/modelingTools/vmodelingalongline.cpp | 19 ++- tools/modelingTools/vmodelingalongline.h | 38 ++--- tools/modelingTools/vmodelingarc.cpp | 17 +- tools/modelingTools/vmodelingarc.h | 18 +-- tools/modelingTools/vmodelingbisector.cpp | 22 +-- tools/modelingTools/vmodelingbisector.h | 45 +++--- tools/modelingTools/vmodelingendline.cpp | 12 +- tools/modelingTools/vmodelingendline.h | 34 ++-- tools/modelingTools/vmodelingline.cpp | 18 +-- tools/modelingTools/vmodelingline.h | 35 ++-- .../modelingTools/vmodelinglineintersect.cpp | 21 ++- tools/modelingTools/vmodelinglineintersect.h | 33 ++-- tools/modelingTools/vmodelinglinepoint.cpp | 4 + tools/modelingTools/vmodelinglinepoint.h | 14 +- tools/modelingTools/vmodelingnormal.cpp | 19 ++- tools/modelingTools/vmodelingnormal.h | 27 ++-- tools/modelingTools/vmodelingpoint.h | 11 +- .../modelingTools/vmodelingpointofcontact.cpp | 22 +-- tools/modelingTools/vmodelingpointofcontact.h | 50 +++--- .../modelingTools/vmodelingshoulderpoint.cpp | 33 ++-- tools/modelingTools/vmodelingshoulderpoint.h | 47 +++--- tools/modelingTools/vmodelingspline.cpp | 14 +- tools/modelingTools/vmodelingspline.h | 19 +-- tools/modelingTools/vmodelingsplinepath.cpp | 23 +-- tools/modelingTools/vmodelingsplinepath.h | 15 +- tools/modelingTools/vmodelingtool.cpp | 17 ++ tools/modelingTools/vmodelingtool.h | 5 +- tools/nodeDetails/vabstractnode.cpp | 20 ++- tools/nodeDetails/vabstractnode.h | 5 +- tools/nodeDetails/vnodearc.cpp | 10 +- tools/nodeDetails/vnodearc.h | 18 +-- tools/nodeDetails/vnodepoint.cpp | 10 +- tools/nodeDetails/vnodepoint.h | 13 +- tools/nodeDetails/vnodespline.cpp | 1 + tools/nodeDetails/vnodesplinepath.cpp | 16 +- tools/nodeDetails/vnodesplinepath.h | 9 +- tools/vabstracttool.cpp | 2 - tools/vabstracttool.h | 3 +- tools/vdatatool.cpp | 6 + tools/vdatatool.h | 21 +-- tools/vtooldetail.cpp | 129 +++++++++------ tools/vtooldetail.h | 27 ++-- xml/vdomdocument.cpp | 153 +++++------------- xml/vdomdocument.h | 2 + 85 files changed, 801 insertions(+), 1015 deletions(-) diff --git a/container/vcontainer.cpp b/container/vcontainer.cpp index e9b7de59f..8f20e2036 100644 --- a/container/vcontainer.cpp +++ b/container/vcontainer.cpp @@ -165,76 +165,6 @@ void VContainer::UpdateId(qint64 newId){ } } -void VContainer::IncrementReferens(qint64 id, Scene::Scenes obj, Draw::Draws mode){ - switch( obj ){ - case(Scene::Line): - break; - case(Scene::Point):{ - VPointF point; - if(mode == Draw::Calculation){ - point = GetPoint(id); - } else { - point = GetModelingPoint(id); - } - point.incrementReferens(); - if(mode == Draw::Calculation){ - UpdatePoint(id, point); - } else { - UpdateModelingPoint(id, point); - } - } - break; - case(Scene::Arc):{ - VArc arc; - if(mode == Draw::Calculation){ - arc = GetArc(id); - } else { - arc = GetModelingArc(id); - } - arc.incrementReferens(); - if(mode == Draw::Calculation){ - UpdateArc(id, arc); - } else { - UpdateModelingArc(id, arc); - } - } - break; - case(Scene::Spline):{ - VSpline spl; - if(mode == Draw::Calculation){ - spl = GetSpline(id); - } else { - spl = GetModelingSpline(id); - } - spl.incrementReferens(); - if(mode == Draw::Calculation){ - UpdateSpline(id, spl); - } else { - UpdateModelingSpline(id, spl); - } - } - break; - case(Scene::SplinePath):{ - VSplinePath splPath; - if(mode == Draw::Calculation){ - splPath = GetSplinePath(id); - } else { - splPath = GetModelingSplinePath(id); - } - splPath.incrementReferens(); - if(mode == Draw::Calculation){ - UpdateSplinePath(id, splPath); - } else { - UpdateModelingSplinePath(id, splPath); - } - } - break; - default: - qWarning()<<"Get wrong scene type."; - break; - } -} - QPainterPath VContainer::ContourPath(qint64 idDetail) const{ VDetail detail = GetDetail(idDetail); QVector points; diff --git a/container/vcontainer.h b/container/vcontainer.h index 8dd77a356..33ed7eede 100644 --- a/container/vcontainer.h +++ b/container/vcontainer.h @@ -143,7 +143,6 @@ public: const QMap *DataModelingSplinePaths() const; const QMap *DataDetails() const; static void UpdateId(qint64 newId); - void IncrementReferens(qint64 id, Scene::Scenes obj, Draw::Draws mode = Draw::Calculation); QPainterPath ContourPath(qint64 idDetail) const; QPainterPath Equidistant(QVector points, const Detail::Equidistant &eqv, const qreal &width)const; diff --git a/container/vpointf.cpp b/container/vpointf.cpp index ae429b3e3..b9ae72544 100644 --- a/container/vpointf.cpp +++ b/container/vpointf.cpp @@ -21,105 +21,13 @@ #include "vpointf.h" -VPointF::VPointF():_name(QString()), _mx(0), _my(0), _x(0), _y(0), _referens(0), mode(Draw::Calculation), - idObject(0){ -} - -VPointF::VPointF ( const VPointF & point ):_name(point.name()), _mx(point.mx()), _my(point.my()), - _x(point.x()), _y(point.y()), _referens(point.referens()), mode(point.getMode()), idObject(point.getIdObject()){ -} - -VPointF::VPointF (qreal x, qreal y , QString name, qreal mx, qreal my, Draw::Draws mode, qint64 idObject):_name(name), _mx(mx), - _my(my), _x(x), _y(y), _referens(0), mode(mode), idObject(idObject){ -} - VPointF &VPointF::operator =(const VPointF &point){ _name = point.name(); _mx = point.mx(); _my = point.my(); _x = point.x(); _y = point.y(); - _referens = point.referens(); mode = point.getMode(); idObject = point.getIdObject(); return *this; } - -VPointF::~VPointF(){ -} - -QString VPointF::name() const{ - return _name; -} - -qreal VPointF::mx() const{ - return _mx; -} - -qreal VPointF::my() const{ - return _my; -} - -void VPointF::setName(const QString& name){ - _name = name; -} - -void VPointF::setMx(qreal mx){ - _mx = mx; -} - -void VPointF::setMy(qreal my){ - _my = my; -} - -QPointF VPointF::toQPointF()const{ - return QPointF(_x, _y); -} - -qreal VPointF::y() const{ - return _y; -} - -void VPointF::setY(const qreal &value){ - _y = value; -} - -qreal VPointF::x() const{ - return _x; -} - -void VPointF::setX(const qreal &value){ - _x = value; -} - -qint32 VPointF::referens() const{ - return _referens; -} - -void VPointF::incrementReferens(){ - ++_referens; -} - -void VPointF::decrementReferens(){ - if(_referens > 0){ - --_referens; - } -} - -Draw::Draws VPointF::getMode() const -{ - return mode; -} - -void VPointF::setMode(const Draw::Draws &value) -{ - mode = value; -} - -qint64 VPointF::getIdObject() const{ - return idObject; -} - -void VPointF::setIdObject(const qint64 &value){ - idObject = value; -} diff --git a/container/vpointf.h b/container/vpointf.h index 8db65792e..cfe7c8f1a 100644 --- a/container/vpointf.h +++ b/container/vpointf.h @@ -28,41 +28,39 @@ class VPointF{ public: - VPointF(); - VPointF (const VPointF &point ); - VPointF ( qreal x, qreal y, QString name, qreal mx, qreal my, Draw::Draws mode = Draw::Calculation, - qint64 idObject = 0); - VPointF &operator=(const VPointF &point); - ~VPointF(); - QString name() const; - qreal mx() const; - qreal my() const; - void setName(const QString &name); - void setMx(qreal mx); - void setMy(qreal my); - QPointF toQPointF()const; - qreal x() const; - void setX(const qreal &value); - qreal y() const; - void setY(const qreal &value); - qint32 referens() const; - void incrementReferens(); - void decrementReferens(); - Draw::Draws getMode() const; - void setMode(const Draw::Draws &value); - - qint64 getIdObject() const; - void setIdObject(const qint64 &value); - + inline VPointF () + :_name(QString()), _mx(0), _my(0), _x(0), _y(0), mode(Draw::Calculation), idObject(0){} + inline VPointF (const VPointF &point ) + :_name(point.name()), _mx(point.mx()), _my(point.my()), _x(point.x()), _y(point.y()), + mode(point.getMode()), idObject(point.getIdObject()){} + inline VPointF ( qreal x, qreal y, QString name, qreal mx, qreal my, + Draw::Draws mode = Draw::Calculation, qint64 idObject = 0) + :_name(name), _mx(mx), _my(my), _x(x), _y(y), mode(mode), idObject(idObject){} + VPointF &operator=(const VPointF &point); + ~VPointF(){} + inline QString name() const { return _name;} + inline qreal mx() const {return _mx;} + inline qreal my() const {return _my;} + inline void setName(const QString &name) {_name = name;} + inline void setMx(qreal mx) {_mx = mx;} + inline void setMy(qreal my) {_my = my;} + inline QPointF toQPointF()const {return QPointF(_x, _y);} + inline qreal x() const {return _x;} + inline void setX(const qreal &value){_x = value;} + inline qreal y() const {return _y;} + inline void setY(const qreal &value){_y = value;} + inline Draw::Draws getMode() const{return mode;} + inline void setMode(const Draw::Draws &value) {mode = value;} + inline qint64 getIdObject() const {return idObject;} + inline void setIdObject(const qint64 &value) {idObject = value;} private: - QString _name; - qreal _mx; - qreal _my; - qreal _x; - qreal _y; - qint32 _referens; - Draw::Draws mode; - qint64 idObject; + QString _name; + qreal _mx; + qreal _my; + qreal _x; + qreal _y; + Draw::Draws mode; + qint64 idObject; }; #endif // VPOINTF_H diff --git a/geometry/varc.cpp b/geometry/varc.cpp index a0194bc11..3ab6180c9 100644 --- a/geometry/varc.cpp +++ b/geometry/varc.cpp @@ -19,24 +19,22 @@ ** ****************************************************************************/ -#define _USE_MATH_DEFINES -#include #include "varc.h" #include VArc::VArc () : f1(0), formulaF1(QString()), f2(0), formulaF2(QString()), radius(0), formulaRadius(QString()), - center(0), points(0), _referens(0), mode(Draw::Calculation), idObject(0){ + center(0), points(0), mode(Draw::Calculation), idObject(0){ } VArc::VArc (const QMap *points, qint64 center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2, QString formulaF2, Draw::Draws mode, qint64 idObject) : f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2), radius(radius), formulaRadius(formulaRadius), - center(center), points(points), _referens(0), mode(mode), idObject(idObject){ + center(center), points(points), mode(mode), idObject(idObject){ } VArc::VArc(const VArc &arc): f1(arc.GetF1()), formulaF1(arc.GetFormulaF1()), f2(arc.GetF2()), formulaF2(arc.GetFormulaF2()), radius(arc.GetRadius()), formulaRadius(arc.GetFormulaRadius()), - center(arc.GetCenter()), points(arc.GetDataPoints()), _referens(0), mode(arc.getMode()), + center(arc.GetCenter()), points(arc.GetDataPoints()), mode(arc.getMode()), idObject(arc.getIdObject()){ } @@ -50,7 +48,6 @@ VArc &VArc::operator =(const VArc &arc){ this->formulaRadius = arc.GetFormulaRadius(); this->center = arc.GetCenter(); this->mode = arc.getMode(); - this->_referens = 0; this->idObject = arc.getIdObject(); return *this; } @@ -198,37 +195,18 @@ QVector VArc::SplOfArc(qint32 number) const{ return QVector(); } -qint32 VArc::referens() const{ - return _referens; -} - -void VArc::incrementReferens(){ - ++_referens; -} - -void VArc::decrementReferens(){ - if(_referens > 0){ - --_referens; - } -} - - -Draw::Draws VArc::getMode() const -{ +Draw::Draws VArc::getMode() const{ return mode; } -void VArc::setMode(const Draw::Draws &value) -{ +void VArc::setMode(const Draw::Draws &value){ mode = value; } -qint64 VArc::getIdObject() const -{ +qint64 VArc::getIdObject() const{ return idObject; } -void VArc::setIdObject(const qint64 &value) -{ +void VArc::setIdObject(const qint64 &value){ idObject = value; } diff --git a/geometry/varc.h b/geometry/varc.h index 2bd06c6b0..f467a15f9 100644 --- a/geometry/varc.h +++ b/geometry/varc.h @@ -98,12 +98,8 @@ public: qint32 NumberSplOfArc () const; QVector GetPoints () const; QVector SplOfArc( qint32 number ) const; - qint32 referens() const; - void incrementReferens(); - void decrementReferens(); Draw::Draws getMode() const; void setMode(const Draw::Draws &value); - qint64 getIdObject() const; void setIdObject(const qint64 &value); @@ -128,7 +124,6 @@ private: */ qint64 center; const QMap *points; - qint32 _referens; Draw::Draws mode; qint64 idObject; }; diff --git a/geometry/vdetail.h b/geometry/vdetail.h index 0c314604a..45cf841fb 100644 --- a/geometry/vdetail.h +++ b/geometry/vdetail.h @@ -37,8 +37,7 @@ namespace Detail { Q_DECLARE_OPERATORS_FOR_FLAGS(Detail::Contours) Q_DECLARE_OPERATORS_FOR_FLAGS(Detail::Equidistants) -class VDetail -{ +class VDetail{ public: VDetail(); VDetail(const QString &name, const QVector &nodes); @@ -49,13 +48,10 @@ public: VNodeDetail & operator[](int indx); QString getName() const; void setName(const QString &value); - qreal getMx() const; void setMx(const qreal &value); - qreal getMy() const; void setMy(const qreal &value); - private: QVector nodes; QString name; diff --git a/geometry/vnodedetail.h b/geometry/vnodedetail.h index 7ea0da2c3..71763a677 100644 --- a/geometry/vnodedetail.h +++ b/geometry/vnodedetail.h @@ -22,7 +22,6 @@ #ifndef VNODEDETAIL_H #define VNODEDETAIL_H -#include #include #include "options.h" diff --git a/geometry/vspline.cpp b/geometry/vspline.cpp index ad1f1b189..69f6ff495 100644 --- a/geometry/vspline.cpp +++ b/geometry/vspline.cpp @@ -19,31 +19,29 @@ ** ****************************************************************************/ -#define _USE_MATH_DEFINES -#include #include "vspline.h" #include VSpline::VSpline():p1(0), p2(QPointF()), p3(QPointF()), p4(0), angle1(0), angle2(0), kAsm1(1), kAsm2(1), - kCurve(1), points(0), _referens(0), mode(Draw::Calculation), idObject(0){ + kCurve(1), points(0), mode(Draw::Calculation), idObject(0){ } VSpline::VSpline ( const VSpline & spline ):p1(spline.GetP1 ()), p2(spline.GetP2 ()), p3(spline.GetP3 ()), p4(spline.GetP4 ()), angle1(spline.GetAngle1 ()), angle2(spline.GetAngle2 ()), kAsm1(spline.GetKasm1()), - kAsm2(spline.GetKasm2()), kCurve(spline.GetKcurve()), points(spline.GetDataPoints()), _referens(0), + kAsm2(spline.GetKasm2()), kCurve(spline.GetKcurve()), points(spline.GetDataPoints()), mode(spline.getMode()), idObject(spline.getIdObject()){ } VSpline::VSpline (const QMap *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2 , qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(QPointF()), p3(QPointF()), p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2), kCurve(kCurve), points(points), - _referens(0), mode(mode), idObject(idObject){ + mode(mode), idObject(idObject){ ModifiSpl ( p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve ); } VSpline::VSpline (const QMap *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4, - qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1), kAsm2(1), - kCurve(1), points(points), _referens(0), mode(mode), idObject(idObject){ + qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), + angle2(0), kAsm1(1), kAsm2(1), kCurve(1), points(points), mode(mode), idObject(idObject){ ModifiSpl ( p1, p2, p3, p4, kCurve); } @@ -629,20 +627,6 @@ QPainterPath VSpline::GetPath() const{ return splinePath; } -qint32 VSpline::referens() const{ - return _referens; -} - -void VSpline::incrementReferens(){ - ++_referens; -} - -void VSpline::decrementReferens(){ - if(_referens > 0){ - --_referens; - } -} - /* Cubic equation solution. Real coefficients case. int Cubic(double *x,double a,double b,double c); @@ -811,7 +795,6 @@ VSpline &VSpline::operator =(const VSpline &spline){ this->kAsm2 = spline.GetKasm2(); this->kCurve = spline.GetKcurve(); this->points = spline.GetDataPoints(); - this->_referens = 0; this->mode = spline.getMode(); this->idObject = spline.getIdObject(); return *this; diff --git a/geometry/vspline.h b/geometry/vspline.h index 38dff39ab..72898a9fb 100644 --- a/geometry/vspline.h +++ b/geometry/vspline.h @@ -180,9 +180,6 @@ public: * @param Pmirror точка відносно якої відбувається вертикальне дзеркалення сплайну. */ // void Mirror(const QPointF Pmirror); - qint32 referens() const; - void incrementReferens(); - void decrementReferens(); Draw::Draws getMode() const; void setMode(const Draw::Draws &value); static QVector SplinePoints(QPointF p1, QPointF p4, qreal angle1, @@ -229,7 +226,6 @@ private: qreal kAsm2; qreal kCurve; const QMap *points; - qint32 _referens; Draw::Draws mode; qint64 idObject; /** diff --git a/geometry/vsplinepath.cpp b/geometry/vsplinepath.cpp index ab1d5da7f..8e3823ee3 100644 --- a/geometry/vsplinepath.cpp +++ b/geometry/vsplinepath.cpp @@ -20,17 +20,18 @@ ****************************************************************************/ #include "vsplinepath.h" +#include "exception/vexception.h" VSplinePath::VSplinePath(): path(QVector()), kCurve(1), mode(Draw::Calculation), points(0), - _referens(0), idObject(0){ + idObject(0){ } VSplinePath::VSplinePath(const QMap *points, qreal kCurve, Draw::Draws mode, qint64 idObject): path(QVector()), - kCurve(kCurve), mode(mode), points(points), _referens(0), idObject(idObject){ + kCurve(kCurve), mode(mode), points(points), idObject(idObject){ } VSplinePath::VSplinePath(const VSplinePath &splPath): path(*splPath.GetPoint()), - kCurve(splPath.getKCurve()), mode(splPath.getMode()), points( splPath.GetDataPoints()), _referens(0), + kCurve(splPath.getKCurve()), mode(splPath.getMode()), points( splPath.GetDataPoints()), idObject(splPath.getIdObject()){ } @@ -60,10 +61,10 @@ qint32 VSplinePath::CountPoint() const{ VSpline VSplinePath::GetSpline(qint32 index) const{ if(Count()<1){ - throw "Недостатня кількість точок для створення сплайну."; + throw VException(tr("Not enough points to create the spline.")); } if(index < 1 || index > Count()){ - throw "Такого сплайну немає."; + throw VException(tr("This spline is not exist.")); } VSpline spl(points, path[index-1].P(), path[index].P(), path[index-1].Angle2(), path[index].Angle1(), path[index-1].KAsm2(), path[index].KAsm1(), this->kCurve); @@ -113,7 +114,7 @@ const QMap *VSplinePath::GetDataPoints() const{ void VSplinePath::UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point){ if(indexSpline < 1 || indexSpline > Count()){ - throw "Такого сплайну немає."; + throw VException(tr("This spline is not exist.")); } if(pos == SplinePoint::FirstPoint){ path[indexSpline-1] = point; @@ -124,7 +125,7 @@ void VSplinePath::UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSp VSplinePoint VSplinePath::GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const{ if(indexSpline < 1 || indexSpline > Count()){ - throw "Такого сплайну немає."; + throw VException(tr("This spline is not exist.")); } if(pos == SplinePoint::FirstPoint){ return path.at(indexSpline-1); @@ -154,7 +155,6 @@ VSplinePath &VSplinePath::operator =(const VSplinePath &path){ this->kCurve = path.getKCurve(); this->mode = path.getMode(); this->points = path.GetDataPoints(); - this->_referens = 0; this->idObject = path.getIdObject(); return *this; } @@ -163,26 +163,10 @@ VSplinePoint & VSplinePath::operator[](int indx){ return path[indx]; } -qint32 VSplinePath::referens() const{ - return _referens; +qint64 VSplinePath::getIdObject() const{ + return idObject; } -void VSplinePath::incrementReferens(){ - ++_referens; -} - -void VSplinePath::decrementReferens(){ - if(_referens > 0){ - --_referens; - } -} - -qint64 VSplinePath::getIdObject() const -{ -return idObject; -} - -void VSplinePath::setIdObject(const qint64 &value) -{ -idObject = value; +void VSplinePath::setIdObject(const qint64 &value){ + idObject = value; } diff --git a/geometry/vsplinepath.h b/geometry/vsplinepath.h index b78fabb97..3170668b7 100644 --- a/geometry/vsplinepath.h +++ b/geometry/vsplinepath.h @@ -23,22 +23,21 @@ #define VSPLINEPATH_H #include "vsplinepoint.h" -#include #include "vspline.h" #include "options.h" +#include namespace SplinePoint{ - enum Position - { - FirstPoint, - LastPoint - }; +enum Position { FirstPoint, LastPoint }; +Q_DECLARE_FLAGS(Positions, Position) } +Q_DECLARE_OPERATORS_FOR_FLAGS( SplinePoint::Positions ) /** * @brief The VSplinePath клас, що розраховує шлях сплайнів. */ class VSplinePath{ + Q_DECLARE_TR_FUNCTIONS(VSplinePath) public: /** * @brief VSplinePath конструктор по замовчуванню. @@ -74,9 +73,6 @@ public: const QVector *GetPoint() const; VSplinePath& operator=(const VSplinePath &path); VSplinePoint & operator[](int indx); - qint32 referens() const; - void incrementReferens(); - void decrementReferens(); Draw::Draws getMode() const; void setMode(const Draw::Draws &value); @@ -91,7 +87,6 @@ protected: qreal kCurve; Draw::Draws mode; const QMap *points; - qint32 _referens; qint64 idObject; }; diff --git a/geometry/vsplinepoint.h b/geometry/vsplinepoint.h index caed526f4..219e9fa96 100644 --- a/geometry/vsplinepoint.h +++ b/geometry/vsplinepoint.h @@ -22,7 +22,6 @@ #ifndef VSPLINEPOINT_H #define VSPLINEPOINT_H -#include "QtGlobal" #include /** diff --git a/mainwindow.cpp b/mainwindow.cpp index 3455b67f2..65cdfb791 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -729,7 +729,7 @@ void MainWindow::ActionSaveAs(){ QString filters("Lekalo files (*.xml);;All files (*.*)"); QString defaultFilter("Lekalo files (*.xml)"); QString fName = QFileDialog::getSaveFileName(this, "Зберегти файл як", QDir::homePath(), - filters, &defaultFilter); + filters, &defaultFilter); if(fName.isEmpty()) return; if(fName.indexOf(".xml",fName.size()-4)<0){ diff --git a/tools/drawTools/vdrawtool.h b/tools/drawTools/vdrawtool.h index 263424814..6f322f33e 100644 --- a/tools/drawTools/vdrawtool.h +++ b/tools/drawTools/vdrawtool.h @@ -25,8 +25,7 @@ #include "../vabstracttool.h" #include -class VDrawTool : public VAbstractTool -{ +class VDrawTool : public VAbstractTool{ Q_OBJECT public: VDrawTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0); @@ -54,9 +53,11 @@ protected: QAction *actionRemove; if(showRemove){ actionRemove = menu.addAction(tr("Delete")); - } else { - actionRemove = menu.addAction(tr("Delete")); - actionRemove->setEnabled(false); + if(_referens > 1){ + actionRemove->setEnabled(false); + } else { + actionRemove->setEnabled(true); + } } QAction *selectedAction = menu.exec(event->screenPos()); if(selectedAction == actionOption){ @@ -73,6 +74,8 @@ protected: dialog->show(); } if(selectedAction == actionRemove){ + //deincrement referens + RemoveReferens(); //remove form xml file QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ diff --git a/tools/drawTools/vtoolalongline.cpp b/tools/drawTools/vtoolalongline.cpp index 02c278b73..c2c59128f 100644 --- a/tools/drawTools/vtoolalongline.cpp +++ b/tools/drawTools/vtoolalongline.cpp @@ -65,12 +65,7 @@ void VToolAlongLine::FullUpdateFromGui(int result){ } void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ - VPointF point = VDrawTool::data.GetPoint(id); - if(point.referens() > 1){ - ContextMenu(dialogAlongLine, this, event, false); - } else { - ContextMenu(dialogAlongLine, this, event); - } + ContextMenu(dialogAlongLine, this, event); } void VToolAlongLine::AddToFile(){ @@ -91,6 +86,11 @@ void VToolAlongLine::AddToFile(){ AddToCalculation(domElement); } +void VToolAlongLine::RemoveReferens(){ + doc->DecrementReferens(secondPointId); + VToolLinePoint::RemoveReferens(); +} + void VToolAlongLine::setDialog(){ Q_ASSERT(!dialogAlongLine.isNull()); if(!dialogAlongLine.isNull()){ @@ -132,12 +132,7 @@ void VToolAlongLine::Create(const qint64 _id, const QString &pointName, const QS } else { data->UpdatePoint(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my)); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - VDataTool *tool = tools->value(id); - if(tool != 0){ - tool->VDataTool::setData(data); - data->IncrementReferens(id, Scene::Point); - } + doc->UpdateToolData(id, data); } } VDrawTool::AddRecord(id, Tool::AlongLineTool, doc); @@ -149,9 +144,9 @@ void VToolAlongLine::Create(const qint64 _id, const QString &pointName, const QS scene->addItem(point); connect(point, &VToolAlongLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(point, &VToolAlongLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - QMap* tools = doc->getTools(); - tools->insert(id,point); - + doc->AddTool(id, point); + doc->IncrementReferens(firstPointId); + doc->IncrementReferens(secondPointId); } } } diff --git a/tools/drawTools/vtoolalongline.h b/tools/drawTools/vtoolalongline.h index cbc88828d..aede99661 100644 --- a/tools/drawTools/vtoolalongline.h +++ b/tools/drawTools/vtoolalongline.h @@ -45,7 +45,7 @@ public slots: protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void AddToFile(); - + virtual void RemoveReferens(); private: qint64 secondPointId; QSharedPointer dialogAlongLine; diff --git a/tools/drawTools/vtoolarc.cpp b/tools/drawTools/vtoolarc.cpp index 1f7350973..d8f1c50be 100644 --- a/tools/drawTools/vtoolarc.cpp +++ b/tools/drawTools/vtoolarc.cpp @@ -91,12 +91,7 @@ void VToolArc::Create(const qint64 _id, const qint64 ¢er, const QString &rad } else { data->UpdateArc(id, arc); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - VDataTool *tool = tools->value(id); - if(tool != 0){ - tool->VDataTool::setData(data); - data->IncrementReferens(id, Scene::Arc); - } + doc->UpdateToolData(id, data); } } data->AddLengthArc(data->GetNameArc(center,id), arc.GetLength()); @@ -106,8 +101,8 @@ void VToolArc::Create(const qint64 _id, const qint64 ¢er, const QString &rad scene->addItem(toolArc); connect(toolArc, &VToolArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(toolArc, &VToolArc::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - QMap* tools = doc->getTools(); - tools->insert(id,toolArc); + doc->AddTool(id, toolArc); + doc->IncrementReferens(center); } } @@ -156,12 +151,7 @@ void VToolArc::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){ } void VToolArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ - VArc arc = VDrawTool::data.GetArc(id); - if(arc.referens() > 1){ - ContextMenu(dialogArc, this, event, false); - } else { - ContextMenu(dialogArc, this, event); - } + ContextMenu(dialogArc, this, event); } void VToolArc::AddToFile(){ @@ -195,6 +185,11 @@ void VToolArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){ this->setPen(QPen(currentColor, widthHairLine)); } +void VToolArc::RemoveReferens(){ + VArc arc = VAbstractTool::data.GetArc(id); + doc->DecrementReferens(arc.GetCenter()); +} + void VToolArc::RefreshGeometry(){ VArc arc = VAbstractTool::data.GetArc(id); QPainterPath path; diff --git a/tools/drawTools/vtoolarc.h b/tools/drawTools/vtoolarc.h index 43c6ae195..00c5a43a3 100644 --- a/tools/drawTools/vtoolarc.h +++ b/tools/drawTools/vtoolarc.h @@ -52,6 +52,7 @@ protected: virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void RemoveReferens(); private: QSharedPointer dialogArc; void RefreshGeometry(); diff --git a/tools/drawTools/vtoolbisector.cpp b/tools/drawTools/vtoolbisector.cpp index ccad2a3b2..65dfd66eb 100644 --- a/tools/drawTools/vtoolbisector.cpp +++ b/tools/drawTools/vtoolbisector.cpp @@ -95,12 +95,7 @@ void VToolBisector::Create(const qint64 _id, const QString &formula, const qint6 } else { data->UpdatePoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - VDataTool *tool = tools->value(id); - if(tool != 0){ - tool->VDataTool::setData(data); - data->IncrementReferens(id, Scene::Point); - } + doc->UpdateToolData(id, data); } } data->AddLine(firstPointId, id); @@ -112,8 +107,10 @@ void VToolBisector::Create(const qint64 _id, const QString &formula, const qint6 scene->addItem(point); connect(point, &VToolBisector::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(point, &VToolBisector::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - QMap* tools = doc->getTools(); - tools->insert(id,point); + doc->AddTool(id, point); + doc->IncrementReferens(firstPointId); + doc->IncrementReferens(secondPointId); + doc->IncrementReferens(thirdPointId); } } } @@ -147,12 +144,7 @@ void VToolBisector::FullUpdateFromGui(int result){ } void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ - VPointF point = VDrawTool::data.GetPoint(id); - if(point.referens() > 1){ - ContextMenu(dialogBisector, this, event, false); - } else { - ContextMenu(dialogBisector, this, event); - } + ContextMenu(dialogBisector, this, event); } void VToolBisector::AddToFile(){ @@ -173,3 +165,9 @@ void VToolBisector::AddToFile(){ AddToCalculation(domElement); } + +void VToolBisector::RemoveReferens(){ + doc->DecrementReferens(firstPointId); + doc->DecrementReferens(thirdPointId); + VToolLinePoint::RemoveReferens(); +} diff --git a/tools/drawTools/vtoolbisector.h b/tools/drawTools/vtoolbisector.h index c9b23323e..2f257fd1e 100644 --- a/tools/drawTools/vtoolbisector.h +++ b/tools/drawTools/vtoolbisector.h @@ -49,6 +49,7 @@ public slots: protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void AddToFile(); + virtual void RemoveReferens(); private: qint64 firstPointId; qint64 thirdPointId; diff --git a/tools/drawTools/vtoolendline.cpp b/tools/drawTools/vtoolendline.cpp index 5b27d4888..a118ba707 100644 --- a/tools/drawTools/vtoolendline.cpp +++ b/tools/drawTools/vtoolendline.cpp @@ -77,11 +77,7 @@ void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QStr } else { data->UpdatePoint(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my)); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - VDataTool *tool = tools->value(id); - Q_CHECK_PTR(tool); - data->IncrementReferens(id, Scene::Point); - tool->VDataTool::setData(data); + doc->UpdateToolData(id, data); } } data->AddLine(basePointId, id); @@ -92,9 +88,8 @@ void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QStr scene->addItem(point); connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(point, &VToolPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - QMap* tools = doc->getTools(); - Q_CHECK_PTR(tools); - tools->insert(id,point); + doc->AddTool(id, point); + doc->IncrementReferens(basePointId); } } } @@ -111,12 +106,7 @@ void VToolEndLine::FullUpdateFromFile(){ } void VToolEndLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ - VPointF point = VDrawTool::data.GetPoint(id); - if(point.referens() > 1){ - ContextMenu(dialogEndLine, this, event, false); - } else { - ContextMenu(dialogEndLine, this, event); - } + ContextMenu(dialogEndLine, this, event); } void VToolEndLine::FullUpdateFromGui(int result){ diff --git a/tools/drawTools/vtoolline.cpp b/tools/drawTools/vtoolline.cpp index 6eca70621..bd83d48c9 100644 --- a/tools/drawTools/vtoolline.cpp +++ b/tools/drawTools/vtoolline.cpp @@ -53,18 +53,14 @@ void VToolLine::Create(QSharedPointer &dialog, VMainGraphicsScene *s } void VToolLine::Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Sources typeCreation){ + VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation){ Q_CHECK_PTR(scene); Q_CHECK_PTR(doc); Q_CHECK_PTR(data); data->AddLine(firstPoint, secondPoint); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - Q_CHECK_PTR(tools); - VDataTool *tool = tools->value(id); - Q_CHECK_PTR(tool); - tool->VDataTool::setData(data); + doc->UpdateToolData(id, data); } VDrawTool::AddRecord(id, Tool::LineTool, doc); if(parse == Document::FullParse){ @@ -74,8 +70,9 @@ void VToolLine::Create(const qint64 &id, const qint64 &firstPoint, const qint64 scene->addItem(line); connect(line, &VToolLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(line, &VToolLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - QMap* tools = doc->getTools(); - tools->insert(id,line); + doc->AddTool(id, line); + doc->IncrementReferens(firstPoint); + doc->IncrementReferens(secondPoint); } } @@ -150,3 +147,8 @@ void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){ this->setPen(QPen(currentColor, widthHairLine)); } +void VToolLine::RemoveReferens(){ + doc->DecrementReferens(firstPoint); + doc->DecrementReferens(secondPoint); +} + diff --git a/tools/drawTools/vtoolline.h b/tools/drawTools/vtoolline.h index e39493385..fa6fbe1db 100644 --- a/tools/drawTools/vtoolline.h +++ b/tools/drawTools/vtoolline.h @@ -48,6 +48,7 @@ protected: virtual void AddToFile(); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void RemoveReferens(); private: qint64 firstPoint; qint64 secondPoint; diff --git a/tools/drawTools/vtoollineintersect.cpp b/tools/drawTools/vtoollineintersect.cpp index 9e642db4b..e1a0abbd0 100644 --- a/tools/drawTools/vtoollineintersect.cpp +++ b/tools/drawTools/vtoollineintersect.cpp @@ -75,12 +75,7 @@ void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const } else { data->UpdatePoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - VDataTool *tool = tools->value(id); - if(tool != 0){ - tool->VDataTool::setData(data); - data->IncrementReferens(id, Scene::Point); - } + doc->UpdateToolData(id, data); } } data->AddLine(p1Line1Id, id); @@ -95,8 +90,11 @@ void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const scene->addItem(point); connect(point, &VToolLineIntersect::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(point, &VToolLineIntersect::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - QMap* tools = doc->getTools(); - tools->insert(id,point); + doc->AddTool(id, point); + doc->IncrementReferens(p1Line1Id); + doc->IncrementReferens(p2Line1Id); + doc->IncrementReferens(p1Line2Id); + doc->IncrementReferens(p2Line2Id); } } } @@ -128,12 +126,7 @@ void VToolLineIntersect::FullUpdateFromGui(int result){ } void VToolLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ - VPointF point = VDrawTool::data.GetPoint(id); - if(point.referens() > 1){ - ContextMenu(dialogLineIntersect, this, event, false); - } else { - ContextMenu(dialogLineIntersect, this, event); - } + ContextMenu(dialogLineIntersect, this, event); } void VToolLineIntersect::AddToFile(){ @@ -153,3 +146,10 @@ void VToolLineIntersect::AddToFile(){ AddToCalculation(domElement); } + +void VToolLineIntersect::RemoveReferens(){ + doc->DecrementReferens(p1Line1); + doc->DecrementReferens(p2Line1); + doc->DecrementReferens(p1Line2); + doc->DecrementReferens(p2Line2); +} diff --git a/tools/drawTools/vtoollineintersect.h b/tools/drawTools/vtoollineintersect.h index 272cf81cb..1c5b36cfd 100644 --- a/tools/drawTools/vtoollineintersect.h +++ b/tools/drawTools/vtoollineintersect.h @@ -25,29 +25,32 @@ #include "vtoolpoint.h" #include "dialogs/dialoglineintersect.h" -class VToolLineIntersect:public VToolPoint -{ +class VToolLineIntersect:public VToolPoint{ Q_OBJECT public: - VToolLineIntersect(VDomDocument *doc, VContainer *data, - const qint64 &id, - const qint64 &p1Line1, - const qint64 &p2Line1, const qint64 &p1Line2, - const qint64 &p2Line2, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - virtual void setDialog(); - static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, - VDomDocument *doc,VContainer *data); - static void Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id, - const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName, - const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + VToolLineIntersect(VDomDocument *doc, VContainer *data, + const qint64 &id, + const qint64 &p1Line1, + const qint64 &p2Line1, const qint64 &p1Line2, + const qint64 &p2Line2, Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + virtual void setDialog(); + static void Create(QSharedPointer &dialog, + VMainGraphicsScene *scene, VDomDocument *doc, + VContainer *data); + static void Create(const qint64 _id, const qint64 &p1Line1Id, + const qint64 &p2Line1Id, const qint64 &p1Line2Id, + const qint64 &p2Line2Id, const QString &pointName, + const qreal &mx, const qreal &my, VMainGraphicsScene *scene, + VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void AddToFile(); + virtual void RemoveReferens(); private: qint64 p1Line1; qint64 p2Line1; diff --git a/tools/drawTools/vtoollinepoint.cpp b/tools/drawTools/vtoollinepoint.cpp index f5088faa5..b7536c1ae 100644 --- a/tools/drawTools/vtoollinepoint.cpp +++ b/tools/drawTools/vtoollinepoint.cpp @@ -60,3 +60,7 @@ void VToolLinePoint::RefreshGeometry(){ mainLine->setVisible(true); } } + +void VToolLinePoint::RemoveReferens(){ + doc->DecrementReferens(basePointId); +} diff --git a/tools/drawTools/vtoollinepoint.h b/tools/drawTools/vtoollinepoint.h index e9ed1562f..a298bc5f1 100644 --- a/tools/drawTools/vtoollinepoint.h +++ b/tools/drawTools/vtoollinepoint.h @@ -24,13 +24,12 @@ #include "vtoolpoint.h" -class VToolLinePoint : public VToolPoint -{ +class VToolLinePoint : public VToolPoint{ Q_OBJECT public: - VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, - const qint64 &basePointId, const qreal &angle, QGraphicsItem * parent = 0); + VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, + const QString &typeLine, const QString &formula, + const qint64 &basePointId, const qreal &angle, QGraphicsItem * parent = 0); public slots: virtual void ChangedActivDraw(const QString newName); protected: @@ -40,9 +39,9 @@ protected: qint64 basePointId; QGraphicsLineItem *mainLine; virtual void RefreshGeometry(); + virtual void RemoveReferens(); private: - VToolLinePoint(const VToolLinePoint &tool); - const VToolLinePoint &operator=(const VToolLinePoint &tool); + Q_DISABLE_COPY(VToolLinePoint) }; #endif // VTOOLLINEPOINT_H diff --git a/tools/drawTools/vtoolnormal.cpp b/tools/drawTools/vtoolnormal.cpp index c699b4e30..701089c16 100644 --- a/tools/drawTools/vtoolnormal.cpp +++ b/tools/drawTools/vtoolnormal.cpp @@ -78,12 +78,7 @@ void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 } else { data->UpdatePoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - VDataTool *tool = tools->value(id); - if(tool != 0){ - tool->VDataTool::setData(data); - data->IncrementReferens(id, Scene::Point); - } + doc->UpdateToolData(id, data); } } data->AddLine(firstPointId, id); @@ -94,8 +89,9 @@ void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 scene->addItem(point); connect(point, &VToolNormal::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(point, &VToolNormal::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - QMap* tools = doc->getTools(); - tools->insert(id,point); + doc->AddTool(id, point); + doc->IncrementReferens(firstPointId); + doc->IncrementReferens(secondPointId); } } } @@ -138,12 +134,7 @@ void VToolNormal::FullUpdateFromGui(int result){ } void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ - VPointF point = VDrawTool::data.GetPoint(id); - if(point.referens() > 1){ - ContextMenu(dialogNormal, this, event, false); - } else { - ContextMenu(dialogNormal, this, event); - } + ContextMenu(dialogNormal, this, event); } void VToolNormal::AddToFile(){ @@ -164,3 +155,8 @@ void VToolNormal::AddToFile(){ AddToCalculation(domElement); } + +void VToolNormal::RemoveReferens(){ + doc->DecrementReferens(secondPointId); + VToolLinePoint::RemoveReferens(); +} diff --git a/tools/drawTools/vtoolnormal.h b/tools/drawTools/vtoolnormal.h index 4b258f882..2410bc163 100644 --- a/tools/drawTools/vtoolnormal.h +++ b/tools/drawTools/vtoolnormal.h @@ -50,6 +50,7 @@ public slots: protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void AddToFile(); + virtual void RemoveReferens(); private: qint64 secondPointId; QSharedPointer dialogNormal; diff --git a/tools/drawTools/vtoolpoint.h b/tools/drawTools/vtoolpoint.h index 4154afc43..1a6a15f4c 100644 --- a/tools/drawTools/vtoolpoint.h +++ b/tools/drawTools/vtoolpoint.h @@ -26,12 +26,12 @@ #include "widgets/vgraphicssimpletextitem.h" #include "options.h" -class VToolPoint: public VDrawTool, public QGraphicsEllipseItem -{ +class VToolPoint: public VDrawTool, public QGraphicsEllipseItem{ Q_OBJECT public: - VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0); - virtual ~VToolPoint(); + VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, + QGraphicsItem * parent = 0); + virtual ~VToolPoint(); public slots: void NameChangePosition(const QPointF pos); virtual void ChangedActivDraw(const QString newName); @@ -48,8 +48,7 @@ protected: virtual void RefreshPointGeometry(const VPointF &point); void RefreshLine(); private: - VToolPoint(const VToolPoint &tool); - const VToolPoint &operator=(const VToolPoint &tool); + Q_DISABLE_COPY(VToolPoint) }; #endif // VTOOLPOINT_H diff --git a/tools/drawTools/vtoolpointofcontact.cpp b/tools/drawTools/vtoolpointofcontact.cpp index 2649502e4..a87391f74 100644 --- a/tools/drawTools/vtoolpointofcontact.cpp +++ b/tools/drawTools/vtoolpointofcontact.cpp @@ -99,12 +99,7 @@ void VToolPointOfContact::Create(const qint64 _id, const QString &radius, const } else { data->UpdatePoint(id,VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - VDataTool *tool = tools->value(id); - if(tool != 0){ - tool->VDataTool::setData(data); - data->IncrementReferens(id, Scene::Point); - } + doc->UpdateToolData(id, data); } } VDrawTool::AddRecord(id, Tool::PointOfContact, doc); @@ -114,8 +109,10 @@ void VToolPointOfContact::Create(const qint64 _id, const QString &radius, const scene->addItem(point); connect(point, &VToolPointOfContact::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(point, &VToolPointOfContact::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - QMap* tools = doc->getTools(); - tools->insert(id,point); + doc->AddTool(id, point); + doc->IncrementReferens(center); + doc->IncrementReferens(firstPointId); + doc->IncrementReferens(secondPointId); } } } @@ -147,12 +144,7 @@ void VToolPointOfContact::FullUpdateFromGui(int result){ } void VToolPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ - VPointF point = VDrawTool::data.GetPoint(id); - if(point.referens() > 1){ - ContextMenu(dialogPointOfContact, this, event, false); - } else { - ContextMenu(dialogPointOfContact, this, event); - } + ContextMenu(dialogPointOfContact, this, event); } void VToolPointOfContact::AddToFile(){ @@ -172,3 +164,9 @@ void VToolPointOfContact::AddToFile(){ AddToCalculation(domElement); } + +void VToolPointOfContact::RemoveReferens(){ + doc->DecrementReferens(center); + doc->DecrementReferens(firstPointId); + doc->DecrementReferens(secondPointId); +} diff --git a/tools/drawTools/vtoolpointofcontact.h b/tools/drawTools/vtoolpointofcontact.h index 8da8368ea..4ed8e0c97 100644 --- a/tools/drawTools/vtoolpointofcontact.h +++ b/tools/drawTools/vtoolpointofcontact.h @@ -46,6 +46,7 @@ public slots: protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void AddToFile(); + virtual void RemoveReferens(); private: QString radius; qint64 center; diff --git a/tools/drawTools/vtoolshoulderpoint.cpp b/tools/drawTools/vtoolshoulderpoint.cpp index a3737c402..bd137bf4a 100644 --- a/tools/drawTools/vtoolshoulderpoint.cpp +++ b/tools/drawTools/vtoolshoulderpoint.cpp @@ -103,12 +103,7 @@ void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const } else { data->UpdatePoint(id,VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - VDataTool *tool = tools->value(id); - if(tool != 0){ - tool->VDataTool::setData(data); - data->IncrementReferens(id, Scene::Point); - } + doc->UpdateToolData(id, data); } } data->AddLine(p1Line, id); @@ -121,8 +116,10 @@ void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const scene->addItem(point); connect(point, &VToolShoulderPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(point, &VToolShoulderPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - QMap* tools = doc->getTools(); - tools->insert(id,point); + doc->AddTool(id, point); + doc->IncrementReferens(p1Line); + doc->IncrementReferens(p2Line); + doc->IncrementReferens(pShoulder); } } } @@ -156,12 +153,7 @@ void VToolShoulderPoint::FullUpdateFromGui(int result){ } void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ - VPointF point = VDrawTool::data.GetPoint(id); - if(point.referens() > 1){ - ContextMenu(dialogShoulderPoint, this, event, false); - } else { - ContextMenu(dialogShoulderPoint, this, event); - } + ContextMenu(dialogShoulderPoint, this, event); } void VToolShoulderPoint::AddToFile(){ @@ -182,3 +174,9 @@ void VToolShoulderPoint::AddToFile(){ AddToCalculation(domElement); } + +void VToolShoulderPoint::RemoveReferens(){ + doc->DecrementReferens(p2Line); + doc->DecrementReferens(pShoulder); + VToolLinePoint::RemoveReferens(); +} diff --git a/tools/drawTools/vtoolshoulderpoint.h b/tools/drawTools/vtoolshoulderpoint.h index 82fc40057..91f682ecb 100644 --- a/tools/drawTools/vtoolshoulderpoint.h +++ b/tools/drawTools/vtoolshoulderpoint.h @@ -47,6 +47,7 @@ public slots: protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void AddToFile(); + virtual void RemoveReferens(); private: qint64 p2Line; qint64 pShoulder; diff --git a/tools/drawTools/vtoolsinglepoint.cpp b/tools/drawTools/vtoolsinglepoint.cpp index 46e2c9dcc..3da725ceb 100644 --- a/tools/drawTools/vtoolsinglepoint.cpp +++ b/tools/drawTools/vtoolsinglepoint.cpp @@ -89,6 +89,12 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change, return QGraphicsItem::itemChange(change, value); } +void VToolSinglePoint::decrementReferens(){ + if(_referens > 1){ + --_referens; + } +} + void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ){ ContextMenu(dialogSinglePoint, this, event, false); } diff --git a/tools/drawTools/vtoolsinglepoint.h b/tools/drawTools/vtoolsinglepoint.h index ae12a1b7f..f2ff140a1 100644 --- a/tools/drawTools/vtoolsinglepoint.h +++ b/tools/drawTools/vtoolsinglepoint.h @@ -44,6 +44,7 @@ protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void AddToFile(); QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); + virtual void decrementReferens(); private: QSharedPointer dialogSinglePoint; }; diff --git a/tools/drawTools/vtoolspline.cpp b/tools/drawTools/vtoolspline.cpp index a657f78a5..30dc78755 100644 --- a/tools/drawTools/vtoolspline.cpp +++ b/tools/drawTools/vtoolspline.cpp @@ -98,12 +98,7 @@ void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, c } else { data->UpdateSpline(id, spline); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - VDataTool *tool = tools->value(id); - if(tool != 0){ - tool->VDataTool::setData(data); - data->IncrementReferens(id, Scene::Spline); - } + doc->UpdateToolData(id, data); } } data->AddLengthSpline(data->GetNameSpline(p1, p4), spline.GetLength()); @@ -113,8 +108,9 @@ void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, c scene->addItem(spl); connect(spl, &VToolSpline::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(spl, &VToolSpline::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - QMap* tools = doc->getTools(); - tools->insert(id,spl); + doc->AddTool(id, spl); + doc->IncrementReferens(p1); + doc->IncrementReferens(p4); } } @@ -177,12 +173,7 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, SplinePo } void VToolSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ - VSpline spl = VDrawTool::data.GetSpline(id); - if(spl.referens() > 1){ - ContextMenu(dialogSpline, this, event, false); - } else { - ContextMenu(dialogSpline, this, event); - } + ContextMenu(dialogSpline, this, event); } void VToolSpline::AddToFile(){ @@ -219,6 +210,12 @@ void VToolSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){ this->setPen(QPen(currentColor, widthHairLine)); } +void VToolSpline::RemoveReferens(){ + VSpline spl = VAbstractTool::data.GetSpline(id); + doc->DecrementReferens(spl.GetP1()); + doc->DecrementReferens(spl.GetP4()); +} + void VToolSpline::RefreshGeometry(){ VSpline spl = VAbstractTool::data.GetSpline(id); QPainterPath path; diff --git a/tools/drawTools/vtoolspline.h b/tools/drawTools/vtoolspline.h index 79580a0fd..74ece8b89 100644 --- a/tools/drawTools/vtoolspline.h +++ b/tools/drawTools/vtoolspline.h @@ -61,6 +61,7 @@ protected: virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void RemoveReferens(); private: QSharedPointer dialogSpline; QVector controlPoints; diff --git a/tools/drawTools/vtoolsplinepath.cpp b/tools/drawTools/vtoolsplinepath.cpp index e33e21678..b862f6815 100644 --- a/tools/drawTools/vtoolsplinepath.cpp +++ b/tools/drawTools/vtoolsplinepath.cpp @@ -70,6 +70,9 @@ void VToolSplinePath::setDialog(){ void VToolSplinePath::Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data){ VSplinePath path = dialog->GetPath(); + for(qint32 i = 0; i < path.CountPoint(); ++i){ + doc->IncrementReferens(path[i].P()); + } Create(0, path, scene, doc, data, Document::FullParse, Tool::FromGui); } @@ -82,12 +85,7 @@ void VToolSplinePath::Create(const qint64 _id, const VSplinePath &path, VMainGra } else { data->UpdateSplinePath(id, path); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - VDataTool *tool = tools->value(id); - if(tool != 0){ - tool->VDataTool::setData(data); - data->IncrementReferens(id, Scene::SplinePath); - } + doc->UpdateToolData(id, data); } } data->AddLengthSpline(data->GetNameSplinePath(path), path.GetLength()); @@ -97,8 +95,7 @@ void VToolSplinePath::Create(const qint64 _id, const VSplinePath &path, VMainGra scene->addItem(spl); connect(spl, &VToolSplinePath::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(spl, &VToolSplinePath::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - QMap* tools = doc->getTools(); - tools->insert(id,spl); + doc->AddTool(id, spl); } } @@ -216,12 +213,7 @@ void VToolSplinePath::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){ } void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ - VSplinePath path = VDrawTool::data.GetSplinePath(id); - if(path.referens() > 1){ - ContextMenu(dialogSplinePath, this, event, false); - } else { - ContextMenu(dialogSplinePath, this, event); - } + ContextMenu(dialogSplinePath, this, event); } void VToolSplinePath::AddToFile(){ @@ -267,6 +259,13 @@ void VToolSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){ this->setPen(QPen(currentColor, widthHairLine)); } +void VToolSplinePath::RemoveReferens(){ + VSplinePath splPath = VAbstractTool::data.GetSplinePath(id); + for(qint32 i = 0; i < splPath.Count(); ++i){ + doc->DecrementReferens(splPath[i].P()); + } +} + void VToolSplinePath::RefreshGeometry(){ VSplinePath splPath = VAbstractTool::data.GetSplinePath(id); QPainterPath path; diff --git a/tools/drawTools/vtoolsplinepath.h b/tools/drawTools/vtoolsplinepath.h index b96e78105..f4559e6ec 100644 --- a/tools/drawTools/vtoolsplinepath.h +++ b/tools/drawTools/vtoolsplinepath.h @@ -29,18 +29,18 @@ #include "widgets/vcontrolpointspline.h" #include "container/vcontainer.h" -class VToolSplinePath:public VDrawTool, public QGraphicsPathItem -{ +class VToolSplinePath:public VDrawTool, public QGraphicsPathItem{ Q_OBJECT public: VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem * parent = 0); - virtual void setDialog(); - static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data); - static void Create(const qint64 _id, const VSplinePath &path, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + virtual void setDialog(); + static void Create(QSharedPointer &dialog, + VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); + static void Create(const qint64 _id, const VSplinePath &path, + VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); signals: void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, const QPointF &controlPoint, const QPointF &splinePoint); @@ -59,6 +59,7 @@ protected: virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void RemoveReferens(); private: QSharedPointer dialogSplinePath; QVector controlPoints; diff --git a/tools/modelingTools/vmodelingalongline.cpp b/tools/modelingTools/vmodelingalongline.cpp index ee4049c6b..3423e2db8 100644 --- a/tools/modelingTools/vmodelingalongline.cpp +++ b/tools/modelingTools/vmodelingalongline.cpp @@ -86,6 +86,11 @@ void VModelingAlongLine::AddToFile(){ AddToModeling(domElement); } +void VModelingAlongLine::RemoveReferens(){ + doc->DecrementReferens(secondPointId); + VModelingLinePoint::RemoveReferens(); +} + void VModelingAlongLine::setDialog(){ Q_ASSERT(!dialogAlongLine.isNull()); if(!dialogAlongLine.isNull()){ @@ -130,24 +135,18 @@ VModelingAlongLine *VModelingAlongLine::Create(const qint64 _id, const QString & } else { data->UpdateModelingPoint(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my)); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - VDataTool *tool = tools->value(id); - if(tool != 0){ - tool->VDataTool::setData(data); - data->IncrementReferens(id, Scene::Point, Draw::Modeling); - } + doc->UpdateToolData(id, data); } } data->AddLine(firstPointId, id); data->AddLine(id, secondPointId); - data->IncrementReferens(firstPointId, Scene::Point, Draw::Modeling); - data->IncrementReferens(secondPointId, Scene::Point, Draw::Modeling); if(parse == Document::FullParse){ point = new VModelingAlongLine(doc, data, id, formula, firstPointId, secondPointId, typeLine, typeCreation); - QMap* tools = doc->getTools(); - tools->insert(id,point); + doc->AddTool(id, point); + doc->IncrementReferens(firstPointId); + doc->IncrementReferens(secondPointId); } } return point; diff --git a/tools/modelingTools/vmodelingalongline.h b/tools/modelingTools/vmodelingalongline.h index 421594b60..c5d88407d 100644 --- a/tools/modelingTools/vmodelingalongline.h +++ b/tools/modelingTools/vmodelingalongline.h @@ -25,30 +25,30 @@ #include "vmodelinglinepoint.h" #include "dialogs/dialogalongline.h" -class VModelingAlongLine : public VModelingLinePoint -{ +class VModelingAlongLine : public VModelingLinePoint{ Q_OBJECT public: - VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula, - const qint64 &firstPointId, const qint64 &secondPointId, const QString &typeLine, - Tool::Sources typeCreation, QGraphicsItem * parent = 0); - virtual void setDialog(); - static VModelingAlongLine* Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data); - static VModelingAlongLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine, - const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const qreal &mx, const qreal &my, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Sources typeCreation); + VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id, + const QString &formula, const qint64 &firstPointId, + const qint64 &secondPointId, const QString &typeLine, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); + virtual void setDialog(); + static VModelingAlongLine* Create(QSharedPointer &dialog, VDomDocument *doc, + VContainer *data); + static VModelingAlongLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine, + const QString &formula, const qint64 &firstPointId, + const qint64 &secondPointId, const qreal &mx, const qreal &my, + VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void RemoveReferens(); private: - qint64 secondPointId; + qint64 secondPointId; QSharedPointer dialogAlongLine; }; diff --git a/tools/modelingTools/vmodelingarc.cpp b/tools/modelingTools/vmodelingarc.cpp index 8dba9111b..a04ed9310 100644 --- a/tools/modelingTools/vmodelingarc.cpp +++ b/tools/modelingTools/vmodelingarc.cpp @@ -91,20 +91,14 @@ VModelingArc* VModelingArc::Create(const qint64 _id, const qint64 ¢er, const } else { data->UpdateModelingArc(id, arc); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - VDataTool *tool = tools->value(id); - if(tool != 0){ - tool->VDataTool::setData(data); - data->IncrementReferens(id, Scene::Arc, Draw::Modeling); - } + doc->UpdateToolData(id, data); } } data->AddLengthArc(data->GetNameArc(center,id, Draw::Modeling), arc.GetLength()); - data->IncrementReferens(center, Scene::Point, Draw::Modeling); if(parse == Document::FullParse){ toolArc = new VModelingArc(doc, data, id, typeCreation); - QMap* tools = doc->getTools(); - tools->insert(id,toolArc); + doc->AddTool(id, toolArc); + doc->IncrementReferens(center); } return toolArc; } @@ -162,6 +156,11 @@ void VModelingArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){ this->setPen(QPen(currentColor, widthHairLine)); } +void VModelingArc::RemoveReferens(){ + VArc arc = VAbstractTool::data.GetModelingArc(id); + doc->DecrementReferens(arc.GetCenter()); +} + void VModelingArc::RefreshGeometry(){ VArc arc = VAbstractTool::data.GetModelingArc(id); QPainterPath path; diff --git a/tools/modelingTools/vmodelingarc.h b/tools/modelingTools/vmodelingarc.h index fc077b526..1ef1807e5 100644 --- a/tools/modelingTools/vmodelingarc.h +++ b/tools/modelingTools/vmodelingarc.h @@ -29,17 +29,16 @@ #include "widgets/vcontrolpointspline.h" #include "container/vcontainer.h" -class VModelingArc :public VModelingTool, public QGraphicsPathItem -{ +class VModelingArc :public VModelingTool, public QGraphicsPathItem{ Q_OBJECT public: - VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - virtual void setDialog(); - static VModelingArc* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); - static VModelingArc* Create(const qint64 _id, const qint64 ¢er, const QString &radius, - const QString &f1, const QString &f2, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Sources typeCreation); + VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); + virtual void setDialog(); + static VModelingArc* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); + static VModelingArc* Create(const qint64 _id, const qint64 ¢er, const QString &radius, + const QString &f1, const QString &f2, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); @@ -49,6 +48,7 @@ protected: virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void RemoveReferens(); private: QSharedPointer dialogArc; void RefreshGeometry(); diff --git a/tools/modelingTools/vmodelingbisector.cpp b/tools/modelingTools/vmodelingbisector.cpp index 835b6ff7a..158b19ad0 100644 --- a/tools/modelingTools/vmodelingbisector.cpp +++ b/tools/modelingTools/vmodelingbisector.cpp @@ -97,23 +97,17 @@ VModelingBisector *VModelingBisector::Create(const qint64 _id, const QString &fo } else { data->UpdateModelingPoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - VDataTool *tool = tools->value(id); - if(tool != 0){ - tool->VDataTool::setData(data); - data->IncrementReferens(id, Scene::Point, Draw::Modeling); - } + doc->UpdateToolData(id, data); } } data->AddLine(firstPointId, id, Draw::Modeling); - data->IncrementReferens(firstPointId, Scene::Point, Draw::Modeling); - data->IncrementReferens(secondPointId, Scene::Point, Draw::Modeling); - data->IncrementReferens(thirdPointId, Scene::Point, Draw::Modeling); if(parse == Document::FullParse){ point = new VModelingBisector(doc, data, id, typeLine, formula, firstPointId, secondPointId, thirdPointId, typeCreation); - QMap* tools = doc->getTools(); - tools->insert(id,point); + doc->AddTool(id, point); + doc->IncrementReferens(firstPointId); + doc->IncrementReferens(secondPointId); + doc->IncrementReferens(thirdPointId); } } return point; @@ -169,3 +163,9 @@ void VModelingBisector::AddToFile(){ AddToModeling(domElement); } + +void VModelingBisector::RemoveReferens(){ + doc->DecrementReferens(firstPointId); + doc->DecrementReferens(thirdPointId); + VModelingLinePoint::RemoveReferens(); +} diff --git a/tools/modelingTools/vmodelingbisector.h b/tools/modelingTools/vmodelingbisector.h index 74901745c..dd8180b13 100644 --- a/tools/modelingTools/vmodelingbisector.h +++ b/tools/modelingTools/vmodelingbisector.h @@ -26,33 +26,34 @@ #include "vmodelinglinepoint.h" #include "dialogs/dialogbisector.h" -class VModelingBisector : public VModelingLinePoint -{ +class VModelingBisector : public VModelingLinePoint{ Q_OBJECT public: - VModelingBisector(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, - const QPointF &thirdPoint, const qreal& length); - virtual void setDialog(); - static VModelingBisector* Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data); - static VModelingBisector* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const qint64 &thirdPointId, - const QString &typeLine, const QString &pointName, const qreal &mx, - const qreal &my, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Sources typeCreation); + VModelingBisector(VDomDocument *doc, VContainer *data, const qint64 &id, + const QString &typeLine, const QString &formula, + const qint64 &firstPointId, const qint64 &secondPointId, + const qint64 &thirdPointId, Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, + const QPointF &thirdPoint, const qreal& length); + virtual void setDialog(); + static VModelingBisector* Create(QSharedPointer &dialog, VDomDocument *doc, + VContainer *data); + static VModelingBisector* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, + const qint64 &secondPointId, const qint64 &thirdPointId, + const QString &typeLine, const QString &pointName, const qreal &mx, + const qreal &my, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void RemoveReferens(); private: - qint64 firstPointId; - qint64 thirdPointId; + qint64 firstPointId; + qint64 thirdPointId; QSharedPointer dialogBisector; }; diff --git a/tools/modelingTools/vmodelingendline.cpp b/tools/modelingTools/vmodelingendline.cpp index 9ed074c6f..17021859d 100644 --- a/tools/modelingTools/vmodelingendline.cpp +++ b/tools/modelingTools/vmodelingendline.cpp @@ -78,20 +78,14 @@ VModelingEndLine *VModelingEndLine::Create(const qint64 _id, const QString &poin } else { data->UpdateModelingPoint(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my)); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - VDataTool *tool = tools->value(id); - if(tool != 0){ - tool->VDataTool::setData(data); - data->IncrementReferens(id, Scene::Point, Draw::Modeling); - } + doc->UpdateToolData(id, data); } } data->AddLine(basePointId, id, Draw::Modeling); - data->IncrementReferens(basePointId, Scene::Point, Draw::Modeling); if(parse == Document::FullParse){ point = new VModelingEndLine(doc, data, id, typeLine, formula, angle, basePointId, typeCreation); - QMap* tools = doc->getTools(); - tools->insert(id,point); + doc->AddTool(id, point); + doc->IncrementReferens(basePointId); } } return point; diff --git a/tools/modelingTools/vmodelingendline.h b/tools/modelingTools/vmodelingendline.h index 27ea0c8c5..0708e9a75 100644 --- a/tools/modelingTools/vmodelingendline.h +++ b/tools/modelingTools/vmodelingendline.h @@ -26,27 +26,27 @@ #include "vmodelinglinepoint.h" #include "dialogs/dialogendline.h" -class VModelingEndLine : public VModelingLinePoint -{ +class VModelingEndLine : public VModelingLinePoint{ Q_OBJECT public: - VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, const qreal &angle, - const qint64 &basePointId, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - virtual void setDialog(); - static VModelingEndLine* Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data); - static VModelingEndLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine, - const QString &formula, const qreal &angle, const qint64 &basePointId, - const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Sources typeCreation); + VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, + const QString &typeLine, const QString &formula, + const qreal &angle, const qint64 &basePointId, + Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + virtual void setDialog(); + static VModelingEndLine* Create(QSharedPointer &dialog, VDomDocument *doc, + VContainer *data); + static VModelingEndLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine, + const QString &formula, const qreal &angle, const qint64 &basePointId, + const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); private: QSharedPointer dialogEndLine; }; diff --git a/tools/modelingTools/vmodelingline.cpp b/tools/modelingTools/vmodelingline.cpp index 958048248..b434adfbb 100644 --- a/tools/modelingTools/vmodelingline.cpp +++ b/tools/modelingTools/vmodelingline.cpp @@ -59,20 +59,15 @@ VModelingLine *VModelingLine::Create(const qint64 &id, const qint64 &firstPoint, Q_CHECK_PTR(doc); Q_CHECK_PTR(data); data->AddLine(firstPoint, secondPoint, Draw::Modeling); - data->IncrementReferens(firstPoint, Scene::Point, Draw::Modeling); - data->IncrementReferens(secondPoint, Scene::Point, Draw::Modeling); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - Q_CHECK_PTR(tools); - VDataTool *tool = tools->value(id); - Q_CHECK_PTR(tool); - tool->VDataTool::setData(data); + doc->UpdateToolData(id, data); } if(parse == Document::FullParse){ qint64 id = data->getNextId(); line = new VModelingLine(doc, data, id, firstPoint, secondPoint, typeCreation); - QMap* tools = doc->getTools(); - tools->insert(id,line); + doc->AddTool(id, line); + doc->IncrementReferens(firstPoint); + doc->IncrementReferens(secondPoint); } return line; } @@ -122,3 +117,8 @@ void VModelingLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){ Q_UNUSED(event); this->setPen(QPen(currentColor, widthHairLine)); } + +void VModelingLine::RemoveReferens(){ + doc->DecrementReferens(firstPoint); + doc->DecrementReferens(secondPoint); +} diff --git a/tools/modelingTools/vmodelingline.h b/tools/modelingTools/vmodelingline.h index 30fdf0024..9ffe7e440 100644 --- a/tools/modelingTools/vmodelingline.h +++ b/tools/modelingTools/vmodelingline.h @@ -26,28 +26,29 @@ #include "QGraphicsLineItem" #include "dialogs/dialogline.h" -class VModelingLine: public VModelingTool, public QGraphicsLineItem -{ +class VModelingLine: public VModelingTool, public QGraphicsLineItem{ Q_OBJECT public: - VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, - qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem * parent = 0); - virtual void setDialog(); - static VModelingLine* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); - static VModelingLine* Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Sources typeCreation); + VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, + qint64 secondPoint, Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + virtual void setDialog(); + static VModelingLine* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); + static VModelingLine* Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint, + VDomDocument *doc, VContainer *data, const Document::Documents &parse, + Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void RemoveReferens(); private: - qint64 firstPoint; - qint64 secondPoint; + qint64 firstPoint; + qint64 secondPoint; QSharedPointer dialogLine; }; diff --git a/tools/modelingTools/vmodelinglineintersect.cpp b/tools/modelingTools/vmodelinglineintersect.cpp index 971a0b205..d7d473194 100644 --- a/tools/modelingTools/vmodelinglineintersect.cpp +++ b/tools/modelingTools/vmodelinglineintersect.cpp @@ -78,12 +78,7 @@ VModelingLineIntersect *VModelingLineIntersect::Create(const qint64 _id, const q } else { data->UpdateModelingPoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - VDataTool *tool = tools->value(id); - if(tool != 0){ - tool->VDataTool::setData(data); - data->IncrementReferens(id, Scene::Point, Draw::Modeling); - } + doc->UpdateToolData(id, data); } } data->AddLine(p1Line1Id, id, Draw::Modeling); @@ -93,8 +88,11 @@ VModelingLineIntersect *VModelingLineIntersect::Create(const qint64 _id, const q if(parse == Document::FullParse){ point = new VModelingLineIntersect(doc, data, id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, typeCreation); - QMap* tools = doc->getTools(); - tools->insert(id,point); + doc->AddTool(id, point); + doc->IncrementReferens(p1Line1Id); + doc->IncrementReferens(p2Line1Id); + doc->IncrementReferens(p1Line2Id); + doc->IncrementReferens(p2Line2Id); } } return point; @@ -147,3 +145,10 @@ void VModelingLineIntersect::AddToFile(){ AddToModeling(domElement); } + +void VModelingLineIntersect::RemoveReferens(){ + doc->DecrementReferens(p1Line1); + doc->DecrementReferens(p2Line1); + doc->DecrementReferens(p1Line2); + doc->DecrementReferens(p2Line2); +} diff --git a/tools/modelingTools/vmodelinglineintersect.h b/tools/modelingTools/vmodelinglineintersect.h index 599f0cdd7..e2af48470 100644 --- a/tools/modelingTools/vmodelinglineintersect.h +++ b/tools/modelingTools/vmodelinglineintersect.h @@ -25,30 +25,31 @@ #include "vmodelingpoint.h" #include "dialogs/dialoglineintersect.h" -class VModelingLineIntersect:public VModelingPoint -{ +class VModelingLineIntersect:public VModelingPoint{ Q_OBJECT public: - VModelingLineIntersect(VDomDocument *doc, VContainer *data, - const qint64 &id, - const qint64 &p1Line1, - const qint64 &p2Line1, const qint64 &p1Line2, - const qint64 &p2Line2, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - virtual void setDialog(); - static VModelingLineIntersect* Create(QSharedPointer &dialog, - VDomDocument *doc,VContainer *data); - static VModelingLineIntersect* Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id, - const qint64 &p1Line2Id, const qint64 &p2Line2Id, - const QString &pointName, const qreal &mx, const qreal &my, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Sources typeCreation); + VModelingLineIntersect(VDomDocument *doc, VContainer *data, + const qint64 &id, const qint64 &p1Line1, + const qint64 &p2Line1, const qint64 &p1Line2, + const qint64 &p2Line2, + Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + virtual void setDialog(); + static VModelingLineIntersect* Create(QSharedPointer &dialog, + VDomDocument *doc,VContainer *data); + static VModelingLineIntersect* Create(const qint64 _id, const qint64 &p1Line1Id, + const qint64 &p2Line1Id, const qint64 &p1Line2Id, + const qint64 &p2Line2Id, const QString &pointName, + const qreal &mx, const qreal &my, VDomDocument *doc, + VContainer *data, const Document::Documents &parse, + Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void AddToFile(); + virtual void RemoveReferens(); private: qint64 p1Line1; qint64 p2Line1; diff --git a/tools/modelingTools/vmodelinglinepoint.cpp b/tools/modelingTools/vmodelinglinepoint.cpp index 36b3239a7..c326a4079 100644 --- a/tools/modelingTools/vmodelinglinepoint.cpp +++ b/tools/modelingTools/vmodelinglinepoint.cpp @@ -50,3 +50,7 @@ void VModelingLinePoint::RefreshGeometry(){ mainLine->setVisible(true); } } + +void VModelingLinePoint::RemoveReferens(){ + doc->DecrementReferens(basePointId); +} diff --git a/tools/modelingTools/vmodelinglinepoint.h b/tools/modelingTools/vmodelinglinepoint.h index d72920bf4..762ce1fc5 100644 --- a/tools/modelingTools/vmodelinglinepoint.h +++ b/tools/modelingTools/vmodelinglinepoint.h @@ -24,13 +24,13 @@ #include "vmodelingpoint.h" -class VModelingLinePoint : public VModelingPoint -{ +class VModelingLinePoint : public VModelingPoint{ Q_OBJECT public: - VModelingLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, - const qint64 &basePointId, const qreal &angle, QGraphicsItem * parent = 0); + VModelingLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, + const QString &typeLine, const QString &formula, + const qint64 &basePointId, const qreal &angle, + QGraphicsItem * parent = 0); protected: QString typeLine; QString formula; @@ -38,9 +38,9 @@ protected: qint64 basePointId; QGraphicsLineItem *mainLine; virtual void RefreshGeometry(); + virtual void RemoveReferens(); private: - VModelingLinePoint(const VModelingLinePoint &tool); - const VModelingLinePoint &operator=(const VModelingLinePoint &tool); + Q_DISABLE_COPY(VModelingLinePoint) }; #endif // VMODELINGLINEPOINT_H diff --git a/tools/modelingTools/vmodelingnormal.cpp b/tools/modelingTools/vmodelingnormal.cpp index e2c1a9164..d7c7a3274 100644 --- a/tools/modelingTools/vmodelingnormal.cpp +++ b/tools/modelingTools/vmodelingnormal.cpp @@ -81,22 +81,16 @@ VModelingNormal *VModelingNormal::Create(const qint64 _id, const QString &formul } else { data->UpdateModelingPoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - VDataTool *tool = tools->value(id); - if(tool != 0){ - tool->VDataTool::setData(data); - data->IncrementReferens(id, Scene::Point, Draw::Modeling); - } + doc->UpdateToolData(id, data); } } data->AddLine(firstPointId, id, Draw::Modeling); - data->IncrementReferens(firstPointId, Scene::Point, Draw::Modeling); - data->IncrementReferens(secondPointId, Scene::Point, Draw::Modeling); if(parse == Document::FullParse){ point = new VModelingNormal(doc, data, id, typeLine, formula, angle, firstPointId, secondPointId, typeCreation); - QMap* tools = doc->getTools(); - tools->insert(id,point); + doc->AddTool(id, point); + doc->IncrementReferens(firstPointId); + doc->IncrementReferens(secondPointId); } } return point; @@ -161,3 +155,8 @@ void VModelingNormal::AddToFile(){ AddToModeling(domElement); } + +void VModelingNormal::RemoveReferens(){ + doc->DecrementReferens(secondPointId); + VModelingLinePoint::RemoveReferens(); +} diff --git a/tools/modelingTools/vmodelingnormal.h b/tools/modelingTools/vmodelingnormal.h index a16d0435e..97c2c71aa 100644 --- a/tools/modelingTools/vmodelingnormal.h +++ b/tools/modelingTools/vmodelingnormal.h @@ -26,22 +26,22 @@ #include "vmodelinglinepoint.h" #include "dialogs/dialognormal.h" -class VModelingNormal : public VModelingLinePoint -{ +class VModelingNormal : public VModelingLinePoint{ Q_OBJECT public: VModelingNormal(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, - const qreal &angle, const qint64 &firstPointId, - const qint64 &secondPointId, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - virtual void setDialog(); - static VModelingNormal* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); - static VModelingNormal* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const QString typeLine, - const QString pointName, const qreal angle, const qreal &mx, - const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Sources typeCreation); + const QString &typeLine, const QString &formula, + const qreal &angle, const qint64 &firstPointId, + const qint64 &secondPointId, Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + virtual void setDialog(); + static VModelingNormal* Create(QSharedPointer &dialog, VDomDocument *doc, + VContainer *data); + static VModelingNormal* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, + const qint64 &secondPointId, const QString typeLine, + const QString pointName, const qreal angle, const qreal &mx, + const qreal &my, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length, const qreal &angle = 0); public slots: @@ -50,6 +50,7 @@ public slots: protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void AddToFile(); + virtual void RemoveReferens(); private: qint64 secondPointId; QSharedPointer dialogNormal; diff --git a/tools/modelingTools/vmodelingpoint.h b/tools/modelingTools/vmodelingpoint.h index df931a155..c851f3d6b 100644 --- a/tools/modelingTools/vmodelingpoint.h +++ b/tools/modelingTools/vmodelingpoint.h @@ -26,12 +26,12 @@ #include "widgets/vgraphicssimpletextitem.h" #include "options.h" -class VModelingPoint: public VModelingTool, public QGraphicsEllipseItem -{ +class VModelingPoint: public VModelingTool, public QGraphicsEllipseItem{ Q_OBJECT public: - VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0); - virtual ~VModelingPoint(); + VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id, + QGraphicsItem * parent = 0); + virtual ~VModelingPoint(); public slots: void NameChangePosition(const QPointF pos); virtual void FullUpdateFromGui(int result) = 0; @@ -46,8 +46,7 @@ protected: virtual void RefreshPointGeometry(const VPointF &point); void RefreshLine(); private: - VModelingPoint(const VModelingPoint &tool); - const VModelingPoint &operator=(const VModelingPoint &tool); + Q_DISABLE_COPY(VModelingPoint) }; #endif // VMODELINGPOINT_H diff --git a/tools/modelingTools/vmodelingpointofcontact.cpp b/tools/modelingTools/vmodelingpointofcontact.cpp index 02aaacef1..35d6e9c2e 100644 --- a/tools/modelingTools/vmodelingpointofcontact.cpp +++ b/tools/modelingTools/vmodelingpointofcontact.cpp @@ -102,22 +102,16 @@ VModelingPointOfContact *VModelingPointOfContact::Create(const qint64 _id, const } else { data->UpdateModelingPoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - VDataTool *tool = tools->value(id); - if(tool != 0){ - tool->VDataTool::setData(data); - data->IncrementReferens(id, Scene::Point, Draw::Modeling); - } + doc->UpdateToolData(id, data); } } - data->IncrementReferens(center, Scene::Point, Draw::Modeling); - data->IncrementReferens(firstPointId, Scene::Point, Draw::Modeling); - data->IncrementReferens(secondPointId, Scene::Point, Draw::Modeling); if(parse == Document::FullParse){ point = new VModelingPointOfContact(doc, data, id, radius, center, firstPointId, secondPointId, typeCreation); - QMap* tools = doc->getTools(); - tools->insert(id,point); + doc->AddTool(id, point); + doc->IncrementReferens(center); + doc->IncrementReferens(firstPointId); + doc->IncrementReferens(secondPointId); } } return point; @@ -170,3 +164,9 @@ void VModelingPointOfContact::AddToFile(){ AddToModeling(domElement); } + +void VModelingPointOfContact::RemoveReferens(){ + doc->DecrementReferens(center); + doc->DecrementReferens(firstPointId); + doc->DecrementReferens(secondPointId); +} diff --git a/tools/modelingTools/vmodelingpointofcontact.h b/tools/modelingTools/vmodelingpointofcontact.h index 63fcb02ef..02302bc45 100644 --- a/tools/modelingTools/vmodelingpointofcontact.h +++ b/tools/modelingTools/vmodelingpointofcontact.h @@ -25,34 +25,38 @@ #include "vmodelingpoint.h" #include "dialogs/dialogpointofcontact.h" -class VModelingPointOfContact : public VModelingPoint -{ +class VModelingPointOfContact : public VModelingPoint{ Q_OBJECT public: - VModelingPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &radius, const qint64 ¢er, const qint64 &firstPointId, - const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0); - virtual void setDialog(); - static QPointF FindPoint(const qreal &radius, const QPointF ¢er, const QPointF &firstPoint, - const QPointF &secondPoint); - static VModelingPointOfContact* Create(QSharedPointer &dialog, - VDomDocument *doc, VContainer *data); - static VModelingPointOfContact* Create(const qint64 _id, const QString &radius, const qint64 ¢er, - const qint64 &firstPointId, const qint64 &secondPointId, - const QString &pointName, const qreal &mx, const qreal &my, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Sources typeCreation); + VModelingPointOfContact(VDomDocument *doc, VContainer *data, + const qint64 &id, const QString &radius, + const qint64 ¢er, + const qint64 &firstPointId, + const qint64 &secondPointId, + Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + virtual void setDialog(); + static QPointF FindPoint(const qreal &radius, const QPointF ¢er, + const QPointF &firstPoint, const QPointF &secondPoint); + static VModelingPointOfContact* Create(QSharedPointer &dialog, + VDomDocument *doc, VContainer *data); + static VModelingPointOfContact* Create(const qint64 _id, const QString &radius, const qint64 ¢er, + const qint64 &firstPointId, const qint64 &secondPointId, + const QString &pointName, const qreal &mx, const qreal &my, + VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void RemoveReferens(); private: - QString radius; - qint64 center; - qint64 firstPointId; - qint64 secondPointId; + QString radius; + qint64 center; + qint64 firstPointId; + qint64 secondPointId; QSharedPointer dialogPointOfContact; }; diff --git a/tools/modelingTools/vmodelingshoulderpoint.cpp b/tools/modelingTools/vmodelingshoulderpoint.cpp index 01e9d3cd8..c67f92427 100644 --- a/tools/modelingTools/vmodelingshoulderpoint.cpp +++ b/tools/modelingTools/vmodelingshoulderpoint.cpp @@ -83,11 +83,12 @@ VModelingShoulderPoint *VModelingShoulderPoint::Create(QSharedPointerGetModelingPoint(p1Line); VPointF secondPoint = data->GetModelingPoint(p2Line); @@ -105,24 +106,18 @@ VModelingShoulderPoint *VModelingShoulderPoint::Create(const qint64 _id, const Q } else { data->UpdateModelingPoint(id,VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - VDataTool *tool = tools->value(id); - if(tool != 0){ - tool->VDataTool::setData(data); - data->IncrementReferens(id, Scene::Point, Draw::Modeling); - } + doc->UpdateToolData(id, data); } } data->AddLine(p1Line, id, Draw::Modeling); data->AddLine(p2Line, id, Draw::Modeling); - data->IncrementReferens(p1Line, Scene::Point, Draw::Modeling); - data->IncrementReferens(p2Line, Scene::Point, Draw::Modeling); - data->IncrementReferens(pShoulder, Scene::Point, Draw::Modeling); if(parse == Document::FullParse){ point = new VModelingShoulderPoint(doc, data, id, typeLine, formula, p1Line, p2Line, pShoulder, typeCreation); - QMap* tools = doc->getTools(); - tools->insert(id,point); + doc->AddTool(id, point); + doc->IncrementReferens(p1Line); + doc->IncrementReferens(p2Line); + doc->IncrementReferens(pShoulder); } } return point; @@ -178,3 +173,9 @@ void VModelingShoulderPoint::AddToFile(){ AddToModeling(domElement); } + +void VModelingShoulderPoint::RemoveReferens(){ + doc->DecrementReferens(p2Line); + doc->DecrementReferens(pShoulder); + VModelingLinePoint::RemoveReferens(); +} diff --git a/tools/modelingTools/vmodelingshoulderpoint.h b/tools/modelingTools/vmodelingshoulderpoint.h index 165146775..399c95868 100644 --- a/tools/modelingTools/vmodelingshoulderpoint.h +++ b/tools/modelingTools/vmodelingshoulderpoint.h @@ -25,33 +25,36 @@ #include "vmodelinglinepoint.h" #include "dialogs/dialogshoulderpoint.h" -class VModelingShoulderPoint : public VModelingLinePoint -{ +class VModelingShoulderPoint : public VModelingLinePoint{ Q_OBJECT public: - VModelingShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, const qint64 &p1Line, - const qint64 &p2Line, const qint64 &pShoulder, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - virtual void setDialog(); - static QPointF FindPoint(const QPointF &p1Line, const QPointF &p2Line, const QPointF &pShoulder, - const qreal &length); - static VModelingShoulderPoint* Create(QSharedPointer &dialog, - VDomDocument *doc, VContainer *data); - static VModelingShoulderPoint* Create(const qint64 _id, const QString &formula, const qint64 &p1Line, - const qint64 &p2Line, const qint64 &pShoulder, - const QString &typeLine, const QString &pointName, - const qreal &mx, const qreal &my, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + VModelingShoulderPoint(VDomDocument *doc, VContainer *data, + const qint64 &id, const QString &typeLine, + const QString &formula, const qint64 &p1Line, + const qint64 &p2Line, const qint64 &pShoulder, + Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + virtual void setDialog(); + static QPointF FindPoint(const QPointF &p1Line, const QPointF &p2Line, + const QPointF &pShoulder, const qreal &length); + static VModelingShoulderPoint* Create(QSharedPointer &dialog, + VDomDocument *doc, VContainer *data); + static VModelingShoulderPoint* Create(const qint64 _id, const QString &formula, const qint64 &p1Line, + const qint64 &p2Line, const qint64 &pShoulder, + const QString &typeLine, const QString &pointName, + const qreal &mx, const qreal &my, VDomDocument *doc, + VContainer *data, const Document::Documents &parse, + const Tool::Sources &typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void RemoveReferens(); private: - qint64 p2Line; - qint64 pShoulder; + qint64 p2Line; + qint64 pShoulder; QSharedPointer dialogShoulderPoint; }; diff --git a/tools/modelingTools/vmodelingspline.cpp b/tools/modelingTools/vmodelingspline.cpp index 27c3f043b..ddefbc81d 100644 --- a/tools/modelingTools/vmodelingspline.cpp +++ b/tools/modelingTools/vmodelingspline.cpp @@ -100,16 +100,14 @@ VModelingSpline *VModelingSpline::Create(const qint64 _id, const qint64 &p1, con data->UpdateModelingSpline(id, spline); if(parse != Document::FullParse){ doc->UpdateToolData(id, data); - data->IncrementReferens(id, Scene::Spline, Draw::Modeling); } } data->AddLengthSpline(data->GetNameSpline(p1, p4, Draw::Modeling), spline.GetLength()); - data->IncrementReferens(p1, Scene::Point, Draw::Modeling); - data->IncrementReferens(p4, Scene::Point, Draw::Modeling); if(parse == Document::FullParse){ spl = new VModelingSpline(doc, data, id, typeCreation); - QMap* tools = doc->getTools(); - tools->insert(id,spl); + doc->AddTool(id, spl); + doc->IncrementReferens(p1); + doc->IncrementReferens(p4); } return spl; } @@ -211,6 +209,12 @@ void VModelingSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){ this->setPen(QPen(currentColor, widthHairLine)); } +void VModelingSpline::RemoveReferens(){ + VSpline spl = VAbstractTool::data.GetModelingSpline(id); + doc->DecrementReferens(spl.GetP1()); + doc->DecrementReferens(spl.GetP4()); +} + void VModelingSpline::RefreshGeometry(){ VSpline spl = VAbstractTool::data.GetModelingSpline(id); QPainterPath path; diff --git a/tools/modelingTools/vmodelingspline.h b/tools/modelingTools/vmodelingspline.h index cb0ab88b6..09a7251d1 100644 --- a/tools/modelingTools/vmodelingspline.h +++ b/tools/modelingTools/vmodelingspline.h @@ -30,19 +30,19 @@ #include "container/vcontainer.h" #include "geometry/vsplinepath.h" -class VModelingSpline:public VModelingTool, public QGraphicsPathItem -{ +class VModelingSpline:public VModelingTool, public QGraphicsPathItem{ Q_OBJECT public: VModelingSpline (VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem * parent = 0 ); - virtual void setDialog(); - static VModelingSpline* Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data); - static VModelingSpline* Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1, - const qreal kAsm2, const qreal &angle1, const qreal &angle2, - const qreal &kCurve, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Sources typeCreation); + virtual void setDialog(); + static VModelingSpline* Create(QSharedPointer &dialog, VDomDocument *doc, + VContainer *data); + static VModelingSpline* Create(const qint64 _id, const qint64 &p1, const qint64 &p4, + const qreal &kAsm1, const qreal kAsm2, const qreal &angle1, + const qreal &angle2, const qreal &kCurve, VDomDocument *doc, + VContainer *data, const Document::Documents &parse, + Tool::Sources typeCreation); signals: void RefreshLine ( const qint32 &indexSpline, SplinePoint::Position position, const QPointF &controlPoint, const QPointF &splinePoint ); @@ -59,6 +59,7 @@ protected: virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void RemoveReferens(); private: QSharedPointer dialogSpline; QVector controlPoints; diff --git a/tools/modelingTools/vmodelingsplinepath.cpp b/tools/modelingTools/vmodelingsplinepath.cpp index 765e57010..2b024389a 100644 --- a/tools/modelingTools/vmodelingsplinepath.cpp +++ b/tools/modelingTools/vmodelingsplinepath.cpp @@ -70,6 +70,9 @@ void VModelingSplinePath::setDialog(){ VModelingSplinePath *VModelingSplinePath::Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data){ VSplinePath path = dialog->GetPath(); + for(qint32 i = 0; i < path.CountPoint(); ++i){ + doc->IncrementReferens(path[i].P()); + } return Create(0, path, doc, data, Document::FullParse, Tool::FromGui); } @@ -83,22 +86,13 @@ VModelingSplinePath * VModelingSplinePath::Create(const qint64 _id, const VSplin } else { data->UpdateModelingSplinePath(id, path); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - VDataTool *tool = tools->value(id); - if(tool != 0){ - tool->VDataTool::setData(data); - data->IncrementReferens(id, Scene::SplinePath, Draw::Modeling); - } + doc->UpdateToolData(id, data); } } - for(qint32 i = 0; i < path.CountPoint(); ++i){ - data->IncrementReferens(path.getIdObject(), Scene::Point, Draw::Modeling); - } data->AddLengthSpline(data->GetNameSplinePath(path), path.GetLength()); if(parse == Document::FullParse){ spl = new VModelingSplinePath(doc, data, id, typeCreation); - QMap* tools = doc->getTools(); - tools->insert(id,spl); + doc->AddTool(id, spl); } return spl; } @@ -235,6 +229,13 @@ void VModelingSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){ this->setPen(QPen(currentColor, widthHairLine)); } +void VModelingSplinePath::RemoveReferens(){ + VSplinePath splPath = VAbstractTool::data.GetModelingSplinePath(id); + for(qint32 i = 0; i < splPath.Count(); ++i){ + doc->DecrementReferens(splPath[i].P()); + } +} + void VModelingSplinePath::RefreshGeometry(){ VSplinePath splPath = VAbstractTool::data.GetModelingSplinePath(id); QPainterPath path; diff --git a/tools/modelingTools/vmodelingsplinepath.h b/tools/modelingTools/vmodelingsplinepath.h index ba6e0961a..75494a2ea 100644 --- a/tools/modelingTools/vmodelingsplinepath.h +++ b/tools/modelingTools/vmodelingsplinepath.h @@ -29,18 +29,18 @@ #include "widgets/vcontrolpointspline.h" #include "container/vcontainer.h" -class VModelingSplinePath:public VModelingTool, public QGraphicsPathItem -{ +class VModelingSplinePath:public VModelingTool, public QGraphicsPathItem{ Q_OBJECT public: VModelingSplinePath(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem * parent = 0); - virtual void setDialog(); - static VModelingSplinePath* Create(QSharedPointer &dialog, - VDomDocument *doc, VContainer *data); - static VModelingSplinePath* Create(const qint64 _id, const VSplinePath &path, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + virtual void setDialog(); + static VModelingSplinePath* Create(QSharedPointer &dialog, + VDomDocument *doc, VContainer *data); + static VModelingSplinePath* Create(const qint64 _id, const VSplinePath &path, VDomDocument *doc, + VContainer *data, const Document::Documents &parse, + Tool::Sources typeCreation); signals: void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, const QPointF &controlPoint, const QPointF &splinePoint); @@ -57,6 +57,7 @@ protected: virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void RemoveReferens(); private: QSharedPointer dialogSplinePath; QVector controlPoints; diff --git a/tools/modelingTools/vmodelingtool.cpp b/tools/modelingTools/vmodelingtool.cpp index 0b2d84194..c651880dd 100644 --- a/tools/modelingTools/vmodelingtool.cpp +++ b/tools/modelingTools/vmodelingtool.cpp @@ -24,6 +24,7 @@ VModelingTool::VModelingTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent): VAbstractTool(doc, data, id, parent), ignoreContextMenuEvent(false){ + _referens = 0; } VModelingTool::~VModelingTool(){ @@ -46,3 +47,19 @@ void VModelingTool::AddToModeling(const QDomElement &domElement){ } emit toolhaveChange(); } + +void VModelingTool::decrementReferens(){ + if(_referens > 0){ + --_referens; + } + if(_referens <= 0){ + RemoveReferens(); + QDomElement domElement = doc->elementById(QString().setNum(id)); + if(domElement.isElement()){ + QDomNode element = domElement.parentNode(); + if(!element.isNull()){ + element.removeChild(domElement); + } + } + } +} diff --git a/tools/modelingTools/vmodelingtool.h b/tools/modelingTools/vmodelingtool.h index a7d85d984..f5bb4bbc7 100644 --- a/tools/modelingTools/vmodelingtool.h +++ b/tools/modelingTools/vmodelingtool.h @@ -35,9 +35,12 @@ public: void ignoreContextMenu(bool enable); public slots: virtual void FullUpdateFromGui(int result)=0; +signals: + void RemoveTool(QGraphicsItem *tool); protected: bool ignoreContextMenuEvent; void AddToModeling(const QDomElement &domElement); + virtual void decrementReferens(); template void ContextMenu(QSharedPointer &dialog, Tool *tool, QGraphicsSceneContextMenuEvent *event, bool showRemove = true){ @@ -73,7 +76,7 @@ protected: //update xml file emit FullUpdateTree(); //remove form scene - //emit RemoveTool(tool); + emit RemoveTool(tool); } } } diff --git a/tools/nodeDetails/vabstractnode.cpp b/tools/nodeDetails/vabstractnode.cpp index b1df22222..ddd667825 100644 --- a/tools/nodeDetails/vabstractnode.cpp +++ b/tools/nodeDetails/vabstractnode.cpp @@ -25,9 +25,7 @@ VAbstractNode::VAbstractNode(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode, Draw::Draws typeobject, QObject *parent) : VAbstractTool(doc, data, id, parent), idNode(idNode), typeobject(typeobject){ -} - -VAbstractNode::~VAbstractNode(){ + _referens = 0; } void VAbstractNode::AddToModeling(const QDomElement &domElement){ @@ -40,3 +38,19 @@ void VAbstractNode::AddToModeling(const QDomElement &domElement){ } emit toolhaveChange(); } + +void VAbstractNode::decrementReferens(){ + if(_referens > 0){ + --_referens; + } + if(_referens <= 0){ + doc->DecrementReferens(idNode); + QDomElement domElement = doc->elementById(QString().setNum(id)); + if(domElement.isElement()){ + QDomNode element = domElement.parentNode(); + if(!element.isNull()){ + element.removeChild(domElement); + } + } + } +} diff --git a/tools/nodeDetails/vabstractnode.h b/tools/nodeDetails/vabstractnode.h index 6b25f52bb..3cd1a63cc 100644 --- a/tools/nodeDetails/vabstractnode.h +++ b/tools/nodeDetails/vabstractnode.h @@ -30,11 +30,12 @@ class VAbstractNode : public VAbstractTool public: VAbstractNode(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode, Draw::Draws typeobject, QObject *parent = 0 ); - virtual ~VAbstractNode(); + virtual ~VAbstractNode() {} protected: qint64 idNode; - Draw::Draws typeobject; + Draw::Draws typeobject; void AddToModeling(const QDomElement &domElement); + virtual void decrementReferens(); }; #endif // VABSTRACTNODE_H diff --git a/tools/nodeDetails/vnodearc.cpp b/tools/nodeDetails/vnodearc.cpp index e35e9f910..ea755e7f5 100644 --- a/tools/nodeDetails/vnodearc.cpp +++ b/tools/nodeDetails/vnodearc.cpp @@ -34,16 +34,16 @@ VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, } } -VNodeArc *VNodeArc::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, - Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation){ - VNodeArc *arc = 0; +void VNodeArc::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, + Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation){ if(parse == Document::FullParse){ - arc = new VNodeArc(doc, data, id, idArc, typeobject, typeCreation); + VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeobject, typeCreation); + Q_CHECK_PTR(arc); doc->AddTool(id, arc); + doc->IncrementReferens(idArc); } else { doc->UpdateToolData(id, data); } - return arc; } void VNodeArc::FullUpdateFromFile(){ diff --git a/tools/nodeDetails/vnodearc.h b/tools/nodeDetails/vnodearc.h index f82c3d776..6776776ad 100644 --- a/tools/nodeDetails/vnodearc.h +++ b/tools/nodeDetails/vnodearc.h @@ -29,19 +29,19 @@ class VNodeArc :public VAbstractNode, public QGraphicsPathItem { Q_OBJECT public: - VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, Draw::Draws typeobject, - Tool::Sources typeCreation, QGraphicsItem * parent = 0); - static VNodeArc *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, - Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation); + VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, Draw::Draws typeobject, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); + static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, + Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); + virtual void FullUpdateFromFile(); protected: - virtual void AddToFile(); - virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); + virtual void AddToFile(); + virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); private: - void RefreshGeometry(); + void RefreshGeometry(); }; -#endif // VNODEARC_H +#endif // VNODEARC_H4 diff --git a/tools/nodeDetails/vnodepoint.cpp b/tools/nodeDetails/vnodepoint.cpp index b43431789..21426313f 100644 --- a/tools/nodeDetails/vnodepoint.cpp +++ b/tools/nodeDetails/vnodepoint.cpp @@ -39,16 +39,16 @@ VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 id } } -VNodePoint *VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, - Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation){ - VNodePoint *point = 0; +void VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, + Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation){ if(parse == Document::FullParse){ - point = new VNodePoint(doc, data, id, idPoint, typeobject, typeCreation); + VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeobject, typeCreation); + Q_CHECK_PTR(point); doc->AddTool(id, point); + doc->IncrementReferens(idPoint); } else { doc->UpdateToolData(id, data); } - return point; } void VNodePoint::FullUpdateFromFile(){ diff --git a/tools/nodeDetails/vnodepoint.h b/tools/nodeDetails/vnodepoint.h index 336333053..f7e963a97 100644 --- a/tools/nodeDetails/vnodepoint.h +++ b/tools/nodeDetails/vnodepoint.h @@ -29,10 +29,12 @@ class VNodePoint: public VAbstractNode, public QGraphicsEllipseItem { Q_OBJECT public: - VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Draws typeobject, - Tool::Sources typeCreation, QGraphicsItem * parent = 0 ); - static VNodePoint *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, - Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation); + VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, + Draw::Draws typeobject, Tool::Sources typeCreation, + QGraphicsItem * parent = 0 ); + static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, + Draw::Draws typeobject, const Document::Documents &parse, + Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); void NameChangePosition(const QPointF pos); @@ -48,8 +50,7 @@ protected: virtual void RefreshPointGeometry(const VPointF &point); void RefreshLine(); private: - VNodePoint(const VNodePoint &point); - const VNodePoint &operator=(const VNodePoint &point); + Q_DISABLE_COPY(VNodePoint) }; #endif // VNODEPOINT_H diff --git a/tools/nodeDetails/vnodespline.cpp b/tools/nodeDetails/vnodespline.cpp index 00a7ffe91..cf4960b6f 100644 --- a/tools/nodeDetails/vnodespline.cpp +++ b/tools/nodeDetails/vnodespline.cpp @@ -40,6 +40,7 @@ VNodeSpline *VNodeSpline::Create(VDomDocument *doc, VContainer *data, qint64 id, if(parse == Document::FullParse){ spl = new VNodeSpline(doc, data, id, idSpline, typeobject, typeCreation); doc->AddTool(id, spl); + doc->IncrementReferens(idSpline); } else { doc->UpdateToolData(id, data); } diff --git a/tools/nodeDetails/vnodesplinepath.cpp b/tools/nodeDetails/vnodesplinepath.cpp index aa0d4b87c..493f5a397 100644 --- a/tools/nodeDetails/vnodesplinepath.cpp +++ b/tools/nodeDetails/vnodesplinepath.cpp @@ -35,17 +35,21 @@ VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, } } -VNodeSplinePath *VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, - qint64 idSpline, Draw::Draws typeobject, const Document::Documents &parse, - Tool::Sources typeCreation){ - VNodeSplinePath *splPath = 0; +void VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, + Draw::Draws typeobject, const Document::Documents &parse, + Tool::Sources typeCreation){ if(parse == Document::FullParse){ - splPath = new VNodeSplinePath(doc, data, id, idSpline, typeobject, typeCreation); + VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeobject, typeCreation); + Q_CHECK_PTR(splPath); doc->AddTool(id, splPath); + VSplinePath path = data->GetModelingSplinePath(id); + const QVector *points = path.GetPoint(); + for(qint32 i = 0; isize(); ++i){ + doc->IncrementReferens(points->at(i).P()); + } } else { doc->UpdateToolData(id, data); } - return splPath; } void VNodeSplinePath::FullUpdateFromFile(){ diff --git a/tools/nodeDetails/vnodesplinepath.h b/tools/nodeDetails/vnodesplinepath.h index 542eae3d9..21b09dd36 100644 --- a/tools/nodeDetails/vnodesplinepath.h +++ b/tools/nodeDetails/vnodesplinepath.h @@ -29,10 +29,11 @@ class VNodeSplinePath : public VAbstractNode, public QGraphicsPathItem { Q_OBJECT public: - VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Draws typeobject, Tool::Sources typeCreation, QGraphicsItem * parent = 0); - static VNodeSplinePath *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation); + VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, + Draw::Draws typeobject, Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, + Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); protected: diff --git a/tools/vabstracttool.cpp b/tools/vabstracttool.cpp index 5bcc0ab8c..50838f4d7 100644 --- a/tools/vabstracttool.cpp +++ b/tools/vabstracttool.cpp @@ -24,8 +24,6 @@ VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent): VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black){ - this->doc = doc; - this->id = id; connect(this, &VAbstractTool::toolhaveChange, this->doc, &VDomDocument::haveLiteChange); connect(this->doc, &VDomDocument::FullUpdateFromFile, this, &VAbstractTool::FullUpdateFromFile); diff --git a/tools/vabstracttool.h b/tools/vabstracttool.h index 49b9a9377..22fe67dfe 100644 --- a/tools/vabstracttool.h +++ b/tools/vabstracttool.h @@ -46,7 +46,7 @@ signals: void FullUpdateTree(); protected: VDomDocument *doc; - qint64 id; + const qint64 id; const Qt::GlobalColor baseColor; Qt::GlobalColor currentColor; virtual void AddToFile()=0; @@ -55,6 +55,7 @@ protected: void AddAttribute(QDomElement &domElement, const QString &name, const qreal &value); void AddAttribute(QDomElement &domElement, const QString &name, const QString &value); const VContainer *getData() const; + virtual void RemoveReferens(){} private: Q_DISABLE_COPY(VAbstractTool) }; diff --git a/tools/vdatatool.cpp b/tools/vdatatool.cpp index 987c237d8..eb5d6cf20 100644 --- a/tools/vdatatool.cpp +++ b/tools/vdatatool.cpp @@ -30,3 +30,9 @@ VDataTool &VDataTool::operator =(const VDataTool &tool){ void VDataTool::setData(const VContainer *value){ data = *value; } + +void VDataTool::decrementReferens(){ + if(_referens > 0){ + --_referens; + } +} diff --git a/tools/vdatatool.h b/tools/vdatatool.h index f6c114121..eed3f4e60 100644 --- a/tools/vdatatool.h +++ b/tools/vdatatool.h @@ -28,17 +28,18 @@ class VDataTool : public QObject{ Q_OBJECT public: - explicit VDataTool(VContainer *data, QObject *parent = 0): QObject(parent), data(*data), _referens(0){} - virtual ~VDataTool(){} - VDataTool& operator= (const VDataTool &tool); - VContainer getData() const { return data; } - void setData(const VContainer *value); - qint64 referens() const {return _referens;} - void incrementReferens(){++_referens;} - void decrementReferens(){--_referens;} + explicit VDataTool(VContainer *data, QObject *parent = 0) + : QObject(parent), data(*data), _referens(1){} + virtual ~VDataTool(){} + VDataTool &operator= (const VDataTool &tool); + inline VContainer getData() const { return data; } + void setData(const VContainer *value); + virtual inline qint64 referens() const {return _referens;} + virtual inline void incrementReferens(){++_referens;} + virtual void decrementReferens(); protected: - VContainer data; - qint64 _referens; + VContainer data; + qint64 _referens; }; #endif // VDATATOOL_H diff --git a/tools/vtooldetail.cpp b/tools/vtooldetail.cpp index ff1a6466a..06b9d8da7 100644 --- a/tools/vtooldetail.cpp +++ b/tools/vtooldetail.cpp @@ -25,136 +25,128 @@ #include "modelingTools/vmodelingtool.h" #include "modelingTools/modelingtools.h" -VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, VDetail &oldDetail, - Tool::Sources typeCreation, const Document::Documents &parse, +VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, Tool::Sources typeCreation, VMainGraphicsScene *scene, QGraphicsItem *parent) - :VAbstractTool(doc, data, id), QGraphicsPathItem(parent), - dialogDetail(QSharedPointer()), sceneDetails(scene){ + :VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialogDetail(QSharedPointer()), + sceneDetails(scene){ VDetail detail = data->GetDetail(id); + QMap* tools = doc->getTools(); + Q_CHECK_PTR(tools); for(qint32 i = 0; i< detail.CountNode(); ++i){ switch(detail[i].getTypeTool()){ case(Tool::NodePoint):{ - VNodePoint *point = VNodePoint::Create(doc, data, detail[i].getId(), oldDetail[i].getId(), - detail[i].getMode(), parse, typeCreation); - connect(point, &VNodePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - QMap* tools = doc->getTools(); - tools->insert(detail[i].getId(),point); + VNodePoint *point = qobject_cast(tools->value(detail[i].getId())); + Q_CHECK_PTR(point); + connect(point, &VNodePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); point->setParentItem(this); break; } case(Tool::NodeArc):{ - VNodeArc *arc = VNodeArc::Create(doc, data, detail[i].getId(), oldDetail[i].getId(), - detail[i].getMode(), parse, typeCreation); + VNodeArc *arc = qobject_cast(tools->value(detail[i].getId())); + Q_CHECK_PTR(arc); connect(arc, &VNodeArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - QMap* tools = doc->getTools(); - tools->insert(detail[i].getId(), arc); arc->setParentItem(this); break; } case(Tool::NodeSpline):{ - VNodeSpline *spl = VNodeSpline::Create(doc, data, detail[i].getId(), oldDetail[i].getId(), - detail[i].getMode(), parse, typeCreation); + VNodeSpline *spl = qobject_cast(tools->value(detail[i].getId())); + Q_CHECK_PTR(spl); connect(spl, &VNodeSpline::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - QMap* tools = doc->getTools(); - tools->insert(detail[i].getId(), spl); spl->setParentItem(this); break; } case(Tool::NodeSplinePath):{ - VNodeSplinePath *splPath = VNodeSplinePath::Create(doc, data, detail[i].getId(), - oldDetail[i].getId(), - detail[i].getMode(), parse, typeCreation); + VNodeSplinePath *splPath = qobject_cast(tools->value(detail[i].getId())); + Q_CHECK_PTR(splPath); connect(splPath, &VNodeSplinePath::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - QMap* tools = doc->getTools(); - tools->insert(detail[i].getId(), splPath); splPath->setParentItem(this); break; } case(Tool::AlongLineTool):{ - QMap* tools = doc->getTools(); VModelingAlongLine *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); connect(tool, &VModelingAlongLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(tool, &VModelingAlongLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); break; } case(Tool::ArcTool):{ - QMap* tools = doc->getTools(); VModelingArc *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); connect(tool, &VModelingArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(tool, &VModelingArc::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); break; } case(Tool::BisectorTool):{ - QMap* tools = doc->getTools(); VModelingBisector *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); connect(tool, &VModelingBisector::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(tool, &VModelingBisector::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); break; } case(Tool::EndLineTool):{ - QMap* tools = doc->getTools(); VModelingEndLine *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); connect(tool, &VModelingEndLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(tool, &VModelingEndLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); break; } case(Tool::LineIntersectTool):{ - QMap* tools = doc->getTools(); VModelingLineIntersect *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); connect(tool, &VModelingLineIntersect::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(tool, &VModelingLineIntersect::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); break; } case(Tool::LineTool):{ - QMap* tools = doc->getTools(); VModelingLine *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); connect(tool, &VModelingLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(tool, &VModelingLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); break; } case(Tool::NormalTool):{ - QMap* tools = doc->getTools(); VModelingNormal *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); connect(tool, &VModelingNormal::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(tool, &VModelingNormal::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); break; } case(Tool::PointOfContact):{ - QMap* tools = doc->getTools(); VModelingPointOfContact *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); connect(tool, &VModelingPointOfContact::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(tool, &VModelingPointOfContact::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); break; } case(Tool::ShoulderPointTool):{ - QMap* tools = doc->getTools(); VModelingShoulderPoint *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); connect(tool, &VModelingShoulderPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(tool, &VModelingShoulderPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); break; } case(Tool::SplinePathTool):{ - QMap* tools = doc->getTools(); VModelingSplinePath *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); connect(tool, &VModelingSplinePath::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(tool, &VModelingSplinePath::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); break; } case(Tool::SplineTool):{ - QMap* tools = doc->getTools(); VModelingSpline *tool = qobject_cast(tools->value(detail[i].getId())); Q_CHECK_PTR(tool); connect(tool, &VModelingSpline::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(tool, &VModelingSpline::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); break; } @@ -162,6 +154,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, qWarning()<<"Get wrong tool type. Ignore."; break; } + doc->IncrementReferens(detail[i].getId()); } this->setFlag(QGraphicsItem::ItemIsMovable, true); this->setFlag(QGraphicsItem::ItemIsSelectable, true); @@ -236,11 +229,10 @@ void VToolDetail::Create(QSharedPointer &dialog, VMainGraphicsScen det.append(node); } det.setName(detail.getName()); - Create(0, det, detail, scene, doc, data, Document::FullParse, Tool::FromGui); + Create(0, det, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolDetail::Create(const qint64 _id, VDetail &newDetail, VDetail &oldDetail, - VMainGraphicsScene *scene, VDomDocument *doc, +void VToolDetail::Create(const qint64 _id, VDetail &newDetail, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){ qint64 id = _id; if(typeCreation == Tool::FromGui){ @@ -248,25 +240,14 @@ void VToolDetail::Create(const qint64 _id, VDetail &newDetail, VDetail &oldDetai } else { data->UpdateDetail(id, newDetail); if(parse != Document::FullParse){ - QMap* tools = doc->getTools(); - VDataTool *tool = tools->value(id); - if(tool != 0){ - tool->VDataTool::setData(data); - } - - for(qint32 i = 0; i< newDetail.CountNode(); ++i){ - VDataTool *tool = tools->value(newDetail[i].getId()); - if(tool != 0){ - tool->VDataTool::setData(data); - } - } + doc->UpdateToolData(id, data); } } if(parse == Document::FullParse){ - VToolDetail *detail = new VToolDetail(doc, data, id, oldDetail, typeCreation, parse, scene); + VToolDetail *detail = new VToolDetail(doc, data, id, typeCreation, scene); scene->addItem(detail); connect(detail, &VToolDetail::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - //connect(detail, &VToolBisector::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); + connect(detail, &VToolDetail::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); QMap* tools = doc->getTools(); tools->insert(id, detail); } @@ -323,6 +304,54 @@ void VToolDetail::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){ QGraphicsItem::mouseReleaseEvent(event); } +void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ + QMenu menu; + //QAction *actionOption = menu.addAction(tr("Options")); + QAction *actionRemove = menu.addAction(tr("Delete")); + if(_referens > 1){ + actionRemove->setEnabled(false); + } else { + actionRemove->setEnabled(true); + } + QAction *selectedAction = menu.exec(event->screenPos()); +// if(selectedAction == actionOption){ +// dialog = QSharedPointer(new Dialog(getData())); + +// connect(qobject_cast< VMainGraphicsScene * >(tool->scene()), &VMainGraphicsScene::ChoosedObject, +// dialog.data(), &Dialog::ChoosedObject); +// connect(dialog.data(), &Dialog::DialogClosed, tool, +// &Tool::FullUpdateFromGui); +// connect(doc, &VDomDocument::FullUpdateFromFile, dialog.data(), &Dialog::UpdateList); + +// tool->setDialog(); + +// dialog->show(); +// } + if(selectedAction == actionRemove){ + //deincrement referens + RemoveReferens(); + //remove form xml file + QDomElement domElement = doc->elementById(QString().setNum(id)); + if(domElement.isElement()){ + QDomNode element = domElement.parentNode(); + if(!element.isNull()){ + element.removeChild(domElement); + //update xml file + emit FullUpdateTree(); + //remove form scene + emit RemoveTool(this); + } + } + } +} + +void VToolDetail::RemoveReferens(){ + VDetail detail = VAbstractTool::data.GetDetail(id); + for(qint32 i = 0; i< detail.CountNode(); ++i){ + doc->DecrementReferens(detail[i].getId()); + } +} + void VToolDetail::AddNode(QDomElement &domElement, VNodeDetail &node){ QDomElement nod = doc->createElement("node"); diff --git a/tools/vtooldetail.h b/tools/vtooldetail.h index d275996cf..a0441e48f 100644 --- a/tools/vtooldetail.h +++ b/tools/vtooldetail.h @@ -26,19 +26,18 @@ #include #include "dialogs/dialogdetail.h" -class VToolDetail: public VAbstractTool, public QGraphicsPathItem -{ +class VToolDetail: public VAbstractTool, public QGraphicsPathItem{ Q_OBJECT public: - VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, VDetail &oldDetail, - Tool::Sources typeCreation, const Document::Documents &parse, VMainGraphicsScene *scene, - QGraphicsItem * parent = 0); - virtual void setDialog(); - static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data); - static void Create(const qint64 _id, VDetail &newDetail, VDetail &oldDetail, - VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, + Tool::Sources typeCreation, VMainGraphicsScene *scene, + QGraphicsItem * parent = 0); + virtual void setDialog(); + static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, + VDomDocument *doc, VContainer *data); + static void Create(const qint64 _id, VDetail &newDetail, VMainGraphicsScene *scene, + VDomDocument *doc, VContainer *data, const Document::Documents &parse, + Tool::Sources typeCreation); template void AddTool(T *tool, const qint64 &id, Tool::Tools typeTool){ tool->setParentItem(this); @@ -55,16 +54,20 @@ public: public slots: virtual void FullUpdateFromFile (); virtual void FullUpdateFromGui(int result); +signals: + void RemoveTool(QGraphicsItem *tool); protected: virtual void AddToFile (); QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void RemoveReferens(); private: Q_DISABLE_COPY(VToolDetail) QSharedPointer dialogDetail; VMainGraphicsScene *sceneDetails; void RefreshGeometry (); - void AddNode(QDomElement &domElement, VNodeDetail &node); + void AddNode(QDomElement &domElement, VNodeDetail &node); }; #endif // VTOOLDETAIL_H diff --git a/xml/vdomdocument.cpp b/xml/vdomdocument.cpp index 94bbe603a..151a6b522 100644 --- a/xml/vdomdocument.cpp +++ b/xml/vdomdocument.cpp @@ -494,7 +494,7 @@ void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDo } } } - VToolDetail::Create(id, detail, oldDetail, sceneDetail, this, data, parse, Tool::FromFile); + VToolDetail::Create(id, detail, sceneDetail, this, data, parse, Tool::FromFile); } catch(const VExceptionBadId &e){ VExceptionObjectError excep(tr("Error creating or updating detail"), domElement); @@ -565,7 +565,6 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen QString formula = GetParametrString(domElement, "length"); qint64 basePointId = GetParametrLongLong(domElement, "basePoint"); qreal angle = GetParametrDouble(domElement, "angle"); - data->IncrementReferens(basePointId, Scene::Point, mode); if(mode == Draw::Calculation){ VToolEndLine::Create(id, name, typeLine, formula, angle, basePointId, mx, my, scene, this, data, parse, Tool::FromFile); @@ -591,8 +590,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen QString formula = GetParametrString(domElement, "length"); qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint"); qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint"); - data->IncrementReferens(firstPointId, Scene::Point, mode); - data->IncrementReferens(secondPointId, Scene::Point, mode); + if(mode == Draw::Calculation){ VToolAlongLine::Create(id, name, typeLine, formula, firstPointId, secondPointId, mx, my, scene, this, data, parse, Tool::FromFile); @@ -619,9 +617,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen qint64 p1Line = GetParametrLongLong(domElement, "p1Line"); qint64 p2Line = GetParametrLongLong(domElement, "p2Line"); qint64 pShoulder = GetParametrLongLong(domElement, "pShoulder"); - data->IncrementReferens(p1Line, Scene::Point, mode); - data->IncrementReferens(p2Line, Scene::Point, mode); - data->IncrementReferens(pShoulder, Scene::Point, mode); + if(mode == Draw::Calculation){ VToolShoulderPoint::Create(id, formula, p1Line, p2Line, pShoulder, typeLine, name, mx, my, scene, this, data, parse, Tool::FromFile); @@ -648,8 +644,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint"); qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint"); qreal angle = GetParametrDouble(domElement, "angle"); - data->IncrementReferens(firstPointId, Scene::Point, mode); - data->IncrementReferens(secondPointId, Scene::Point, mode); + if(mode == Draw::Calculation){ VToolNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, angle, mx, my, scene, this, data, parse, Tool::FromFile); @@ -676,9 +671,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint"); qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint"); qint64 thirdPointId = GetParametrLongLong(domElement, "thirdPoint"); - data->IncrementReferens(firstPointId, Scene::Point, mode); - data->IncrementReferens(secondPointId, Scene::Point, mode); - data->IncrementReferens(thirdPointId, Scene::Point, mode); + if(mode == Draw::Calculation){ VToolBisector::Create(id, formula, firstPointId, secondPointId, thirdPointId, typeLine, name, mx, my, scene, this, data, parse, Tool::FromFile); @@ -704,10 +697,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen qint64 p2Line1Id = GetParametrLongLong(domElement, "p2Line1"); qint64 p1Line2Id = GetParametrLongLong(domElement, "p1Line2"); qint64 p2Line2Id = GetParametrLongLong(domElement, "p2Line2"); - data->IncrementReferens(p1Line1Id, Scene::Point, mode); - data->IncrementReferens(p2Line1Id, Scene::Point, mode); - data->IncrementReferens(p1Line2Id, Scene::Point, mode); - data->IncrementReferens(p2Line2Id, Scene::Point, mode); + if(mode == Draw::Calculation){ VToolLineIntersect::Create(id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, name, mx, my, scene, this, data, parse, Tool::FromFile); @@ -733,9 +723,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen qint64 center = GetParametrLongLong(domElement, "center"); qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint"); qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint"); - data->IncrementReferens(center, Scene::Point, mode); - data->IncrementReferens(firstPointId, Scene::Point, mode); - data->IncrementReferens(secondPointId, Scene::Point, mode); + if(mode == Draw::Calculation){ VToolPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, mx, my, scene, this, data, parse, Tool::FromFile); @@ -769,7 +757,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen qreal my = toPixel(GetParametrDouble(domElement, "my")); data->UpdateModelingPoint(id, VPointF(point.x(), point.y(), point.name(), mx, my, typeObject, idObject )); - data->IncrementReferens(idObject, Scene::Point, typeObject); + VNodePoint::Create(this, data, id, idObject, mode, parse, Tool::FromFile); return; } catch(const VExceptionBadId &e){ @@ -788,8 +776,7 @@ void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement qint64 id = GetParametrId(domElement); qint64 firstPoint = GetParametrLongLong(domElement, "firstPoint"); qint64 secondPoint = GetParametrLongLong(domElement, "secondPoint"); - data->IncrementReferens(firstPoint, Scene::Point, mode); - data->IncrementReferens(secondPoint, Scene::Point, mode); + if(mode == Draw::Calculation){ VToolLine::Create(id, firstPoint, secondPoint, scene, this, data, parse, Tool::FromFile); } else { @@ -805,7 +792,8 @@ void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement } void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &domElement, - const Document::Documents &parse, const QString &type, Draw::Draws mode){ + const Document::Documents &parse, const QString &type, + Draw::Draws mode){ Q_CHECK_PTR(scene); Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(!type.isEmpty(), Q_FUNC_INFO, "type of spline is empty"); @@ -819,8 +807,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme qreal kAsm1 = GetParametrDouble(domElement, "kAsm1"); qreal kAsm2 = GetParametrDouble(domElement, "kAsm2"); qreal kCurve = GetParametrDouble(domElement, "kCurve"); - data->IncrementReferens(point1, Scene::Point, mode); - data->IncrementReferens(point4, Scene::Point, mode); + if(mode == Draw::Calculation){ VToolSpline::Create(id, point1, point4, kAsm1, kAsm2, angle1, angle2, kCurve, scene, this, data, parse, Tool::FromFile); @@ -855,7 +842,9 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme qint64 pSpline = GetParametrLongLong(element, "pSpline"); VSplinePoint splPoint(pSpline, kAsm1, angle, kAsm2); path.append(splPoint); - data->IncrementReferens(pSpline, Scene::Point, mode); + if(parse == Document::FullParse){ + IncrementReferens(pSpline); + } } } } @@ -888,14 +877,8 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme } spl.setMode(typeObject); spl.setIdObject(idObject); - if(typeObject == Draw::Calculation){ - data->IncrementReferens(spl.GetP1(), Scene::Point, Draw::Calculation); - data->IncrementReferens(spl.GetP4(), Scene::Point, Draw::Calculation); - } else { - data->IncrementReferens(spl.GetP1(), Scene::Point, Draw::Modeling); - data->IncrementReferens(spl.GetP4(), Scene::Point, Draw::Modeling); - } data->UpdateModelingSpline(id, spl); + VNodeSpline::Create(this, data, id, idObject,mode, parse, Tool::FromFile); return; } catch(const VExceptionBadId &e){ @@ -921,14 +904,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme path.setMode(typeObject); path.setIdObject(idObject); data->UpdateModelingSplinePath(id, path); - const QVector *points = path.GetPoint(); - for(qint32 i = 0; isize(); ++i){ - if(typeObject == Draw::Calculation){ - data->IncrementReferens(points->at(i).P(), Scene::Point, Draw::Calculation); - } else { - data->IncrementReferens(points->at(i).P(), Scene::Point, Draw::Modeling); - } - } + VNodeSplinePath::Create(this, data, id, idObject, mode, parse, Tool::FromFile); return; } catch(const VExceptionBadId &e){ @@ -951,7 +927,7 @@ void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement QString radius = GetParametrString(domElement, "radius"); QString f1 = GetParametrString(domElement, "angle1"); QString f2 = GetParametrString(domElement, "angle2"); - data->IncrementReferens(center, Scene::Point, mode); + if(mode == Draw::Calculation){ VToolArc::Create(id, center, radius, f1, f2, scene, this, data, parse, Tool::FromFile); } else { @@ -983,7 +959,7 @@ void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement arc.setMode(typeObject); arc.setIdObject(idObject); data->UpdateModelingArc(id, arc); - data->IncrementReferens(idObject, Scene::Point, mode); + VNodeArc::Create(this, data, id, idObject, mode, parse, Tool::FromFile); return; } catch(const VExceptionBadId &e){ @@ -1059,73 +1035,18 @@ void VDomDocument::setCurrentData(){ } void VDomDocument::GarbageCollector(){ - const QMap *points = data->DataPoints(); - Q_CHECK_PTR(points); - QMapIterator p(*points); - while (p.hasNext()) { - p.next(); - VPointF point = p.value(); - if(point.referens() <= 0){ - QDomElement domElement = elementById(QString().setNum(p.key())); + QMapIterator t(tools); + while (t.hasNext()) { + t.next(); + VDataTool *tool = t.value(); + if(tool->referens() <= 0){ + QDomElement domElement = elementById(QString().setNum(t.key())); if(domElement.isElement()){ - QDomElement element; - bool ok = GetActivModelingElement(element); - if(ok){ - element.removeChild(domElement); - } - } - } - } - - const QMap *arc = data->DataArcs(); - Q_CHECK_PTR(arc); - QMapIterator a(*arc); - while (a.hasNext()) { - a.next(); - VArc arc = a.value(); - if(arc.referens() <= 0){ - QDomElement domElement = elementById(QString().setNum(a.key())); - if(domElement.isElement()){ - QDomElement element; - bool ok = GetActivModelingElement(element); - if(ok){ - element.removeChild(domElement); - } - } - } - } - - const QMap *spl = data->DataSplines(); - Q_CHECK_PTR(spl); - QMapIterator s(*spl); - while (s.hasNext()) { - s.next(); - VSpline spl = s.value(); - if(spl.referens() <= 0){ - QDomElement domElement = elementById(QString().setNum(s.key())); - if(domElement.isElement()){ - QDomElement element; - bool ok = GetActivModelingElement(element); - if(ok){ - element.removeChild(domElement); - } - } - } - } - - const QMap *splPath = data->DataSplinePaths(); - Q_CHECK_PTR(splPath); - QMapIterator q(*splPath); - while (q.hasNext()) { - q.next(); - VSplinePath splPath = q.value(); - if(splPath.referens() <= 0){ - QDomElement domElement = elementById(QString().setNum(q.key())); - if(domElement.isElement()){ - QDomElement element; - bool ok = GetActivModelingElement(element); - if(ok){ - element.removeChild(domElement); + QDomNode parent = domElement.parentNode(); + if(!parent.isNull()){ + parent.removeChild(domElement); + } else { + qWarning()<VDataTool::setData(data); } + +void VDomDocument::IncrementReferens(qint64 id) const{ + Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); + VDataTool *tool = tools.value(id); + Q_CHECK_PTR(tool); + tool->incrementReferens(); +} + +void VDomDocument::DecrementReferens(qint64 id) const{ + Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); + VDataTool *tool = tools.value(id); + Q_CHECK_PTR(tool); + tool->decrementReferens(); +} diff --git a/xml/vdomdocument.h b/xml/vdomdocument.h index 9a6d37270..62bbb275b 100644 --- a/xml/vdomdocument.h +++ b/xml/vdomdocument.h @@ -67,6 +67,8 @@ public: void GarbageCollector(); void AddTool(const qint64 &id, VDataTool *tool); void UpdateToolData(const qint64 &id, VContainer *data); + void IncrementReferens(qint64 id) const; + void DecrementReferens(qint64 id) const; signals: void ChangedActivDraw(const QString newName); void ChangedNameDraw(const QString oldName, const QString newName); From 1a678ab2e2ec51e47d647235e835b4fcb81d1324 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 1 Oct 2013 15:14:34 +0300 Subject: [PATCH 09/10] Updated translation. --HG-- branch : feature --- translations/valentina_ru.ts | 794 +++++++++++++++++++++++------------ translations/valentina_uk.ts | 794 +++++++++++++++++++++++------------ 2 files changed, 1032 insertions(+), 556 deletions(-) diff --git a/translations/valentina_ru.ts b/translations/valentina_ru.ts index b2831ec45..f828a3d13 100644 --- a/translations/valentina_ru.ts +++ b/translations/valentina_ru.ts @@ -4,78 +4,78 @@ DialogAlongLine - + Point along line Точка вдоль линии - + Length Длина - - + + ... - + _ - + Name new point Имя новой точки - + First point Первая точка - + Second point Вторая точка - + Type line Тип линии - + Input data Входные данные - + Size and growth Размер и рост - + Standart table Стандартная таблица - + Increments Прибавки - + Length of lines Длина линий - + Length of arcs Длина дуг - + Length of curves Длина кривых @@ -83,80 +83,80 @@ DialogArc - + Arc Дуга - + Radius Радиус - - - - - - + + + + + + ... - - - + + + _ - + First angle degree Первый угол градусы - + Second angle degree Второй угол градусы - + Center point Центральная точка - + Input data Входные данные - + Size and growth Размер и рост - + Standart table Стандартная таблица - + Increments Прибавки - + Length of lines Длина линий - - + + Length of arcs Длина дуг - + Angle of lines Уголы линий @@ -164,83 +164,83 @@ DialogBisector - + Bisector Бисектриса - + Length Длина - - + + ... - + _ - + Name new point Имя новой точки - + First point Первая точка - + Second point Вторая точка - + Third point Треться точка - + Type line Тип линии - + Input data Входные данные - + Size and growth Размер и рост - + Standart table Стандартная таблица - + Increments Прибавки - + Length of lines Длина линий - + Length of arcs Длина дуг - + Length of curves Длина кривых @@ -248,17 +248,17 @@ DialogDetail - + Detail Деталь - + Name detail Имя детали - + Closed Замкнутая @@ -266,86 +266,86 @@ DialogEndLine - + Point in the end of line Точка на конце линии - + Length Длина - - - - - - - - - - + + + + + + + + + + ... - + _ - + Base point Базовая точка - + Name new point Имя новой точки - + Angle degree Угол градусы - + Type line Тип линии - + Input data Входные данные - + Size and growth Размер и рост - + Standart table Стандартная таблица - + Increments Прибавки - + Length of lines Длина линий - + Length of arcs Длина дуг - + Length of curves Длина кривых @@ -353,12 +353,12 @@ DialogHistory - + History История - + Tool Инструмент @@ -366,108 +366,108 @@ DialogIncrements - - + + Increments Прибавки - + Table sizes Таблица размеров - - + + Denotation Обозначение - - + + The calculated value Расчитаное значение - - + + Base value Базовое значение - + In sizes В размерах - + In growths В ростах - - + + Description Опис - + In size В размерах - + In growth В ростах - - + + ... - + Lines Линии - + Line Линия - + Length of the line Длина линии - + Curves Кривые - + Curve Кривая - + Length of the curve Длина кривой - + Arcs Дуги - + Arc Дуга - + Length of arc Длина дуги @@ -475,17 +475,17 @@ DialogLine - + Line Линия - + First point Первая точка - + Second point Вторая точка @@ -493,34 +493,34 @@ DialogLineIntersect - + Point of line intersection Точка пересичения линий - + Name new point Имя новой точки - + First line Первая линия - - + + First point Первая точка - - + + Second point Вторая точка - + Second line Вторая линия @@ -528,91 +528,91 @@ DialogNormal - + Normal Перпендикуляр - + Length Длина - - - - - - - - - - + + + + + + + + + + ... - + _ - + Name new point Имя новой точки - + First point Первая точка - + Second point Вторая точка - + Additional angle degrees Дополнительные угол градусы - + Type line Тип линии - + Input data Входные данные - + Size and growth Размер и рост - + Standart table Стандартная таблица - + Increments Прибавки - + Length of lines Длина линий - + Length of arcs Длина дуг - + Length of curves Длина кривых @@ -620,78 +620,78 @@ DialogPointOfContact - + Point of contact Точка касания - + Radius Радиус - - + + ... - + _ - + Name new point Имя новой точки - + Center of arc Центр дуги - + Top of the line Начало линии - + End of the line Конец линии - + Input data Входные данные - + Size and growth Размер и рост - + Standart table Стандартная таблица - + Increments Прибавки - + Length of lines Длина линий - + Length of arcs Длина дуг - + Length of curves Длина кривых @@ -699,75 +699,75 @@ DialogShoulderPoint - - + + Point of shoulder Точка плеча - + Length Длина - - + + ... - + _ - + Name new point Имя новой точки - + First point Первая точка - + Second point Вторая точка - + Type of line Тип линии - + Input data Входные данные - + Size and growth Размер и рост - + Standart table Стандартная таблица - + Increments Прибавки - - + + Length of lines Длина линий - + Length of curves Длина кривых @@ -775,27 +775,27 @@ DialogSinglePoint - + Single point Одиночная точка - + Координати Координаты - + Y coordinate Y координата - + X coordinate Х координата - + Point name Имя точки @@ -803,42 +803,42 @@ DialogSpline - + Curve Кривая - + First point Первая точка - + Length ratio of the first control point Коефициент длины первой контрольной точки - + The angle of the first control point Угол первой контрольной точки - + Second point Вторая точка - + Length ratio of the second control point Коефициент длины второй контрольной точки - + The angle of the second control point Угол второй контрольной точки - + Coefficient of curvature of the curve Коефициент кривизные кривой @@ -846,37 +846,37 @@ DialogSplinePath - + Curve path Сложная кривая - + Point of curve Точка кривой - + Length ratio of the first control point Коефициент длины первой контрольной точки - + The angle of the first control point Угол первой контрольной точки - + Length ratio of the second control point Коефициент длины второй контрольной точки - + The angle of the second control point Угол второй контрольной точки - + Coefficient of curvature of the curve Коефициент кривизные кривой @@ -884,330 +884,568 @@ MainWindow - + Valentina Valentina - + Point Точка - - - - - - - - - - - - + + + + + + + + + + + + ... - + Line Линия - + Curve Кривая - + Arc Дуга - + Detail Деталь - + toolBar - + toolBar_2 - + toolBar_3 - + New Новое - + Create a new pattern Создать новое лекало - + Open Открыть - + Open file with pattern Открыть файл с лекалом - + Save Сохранить - + Save pattern Сохранить лекало - + Save as Сохранить как - + Save not yet saved pattern Сохранить еще не сохраненное лекало - + Draw Рисование - + Draw mode Режим рисования - + Details Детали - + Deatils mode Режим деталей - - + + Tools pointer Инструмент указатель - + New drawing Новый чертеж - + Add new drawing Добавить новый чертеж - - + + Change the name of drawing Изменить имя чертежа - + Table of variables Таблица переменных - + Tables of variables Таблици переменных - + History История - + Layout Роскладка - + Create layout Создать раскладку - + Drawing %1 Чертеж %1 - - + + Drawing: Чертеж: - + Enter a name for the drawing. Введите имя чертежа. - - + + Error. Drawing of same name already exists. Ошибка. Чертеж с таким именем уже существует. - + Error creating drawing with the name Ошибка создания чертежа с именем - + Enter a new name for the drawing. Введите новое имя для чертежа. - + Growth: Рост: - + Size: Размер: - + Drawing: Чертеж: - + Lekalo files (*.xml) Файл лекала (*.xml) - + Open file Открыть файл + + + Can't open pattern file. File name empty + Не могу открыть файл лекала. Пустое имя файла + + + + + + + + Error! + Ошибка! + + + + Error parsing file. + Ошибка парсинга файла. + + + + Error can't convert value. + Ошибка, не могу конвертовать значение. + + + + Error empty parameter. + Ошибка, пустой параметр. + + + + Error wrong id. + Ошибка, неправильный id. + + + + Error parsing pattern file. + Ошибка парсинга файла лекала. + + + + Error in line %1 column %2 + Ошибка в линии %1 столбец %2 + TableWindow - + Create a layout Создать раскладку - + toolBar toolBar - + Save Сохранить - + Save layout Создать раскладку - + Next Следующая - + Next detail Следующая деталь - + Turn Перевернуть - + Turn the detail 180 degrees Перевернуть детальна на 180 градусов - + Stop laying Прекратить укладку - + Enlarge letter Увеличить лист - + Enlarge the length of sheet Увеличить длину листа - + Reduce sheet Уменьшить лист - + Reduce the length of the sheet Уменьшить длину листа - - + + Mirroring Отражение - - + + Zoom In Увеличить - - + + Zoom Out Уменьшить - + Stop Стоп - + SVG Generator Example Drawing SVG Generator Example Drawing - + An SVG drawing created by the SVG Generator Example provided with Qt. An SVG drawing created by the SVG Generator Example provided with Qt. + + VApplication + + + + + + + Error! + Ошибка! + + + + Error parsing file. Program will be terminated. + Ошибка парсинга файла. Програма будет закрыта. + + + + Error bad id. Program will be terminated. + Ошибка, неправильный id. Програма будет закрыта. + + + + Error can't convert value. Program will be terminated. + Ошибка не могу конвертировать значение. Програма будет закрыта. + + + + Error empty parameter. Program will be terminated. + Ошибка пустой параметр. Програма будет закрыта. + + + + Error wrong id. Program will be terminated. + Ошибка неправельный id. Програма будет закрыта. + + + + VContainer + + + Can't find object + Не могу найти объект + + + + VDomDocument + + + Got wrong parameter id. Need only id > 0. + Получен неправельный параметр id. Допустимы только id > 0. + + + + Can't convert toLongLong parameter + Не могу конвертировать toLongLong параметр + + + + Got empty parameter + Получен пустой параметр + + + + Can't convert toDouble parameter + Не могу конвертировать toDouble параметр + + + + Error creating or updating detail + Ошибка создания или обновления детали + + + + Error creating or updating single point + Ошибка создания или обновления базовой точки + + + + Error creating or updating point of end line + Ошибка создания или обновления точки на конце линии + + + + Error creating or updating point along line + Ошибка создания или обновления точки вдоль линии + + + + Error creating or updating point of shoulder + Ошибка создания или обновления точки плеча + + + + Error creating or updating point of normal + Ошибка создания или обновления точки нормали + + + + Error creating or updating point of bisector + Ошибка создания или обновления точки бисектрисы + + + + Error creating or updating point of lineintersection + Ошибка создания или обновления точки пересичения линий + + + + Error creating or updating point of contact + Ошибка создания или обновления точки прикосновения + + + + Error creating or updating modeling point + Ошибка создания или обновления точки + + + + Error creating or updating line + Ошибка создания или обновления линии + + + + Error creating or updating simple curve + Ошибка создания или обновления кривой + + + + Error creating or updating curve path + Ошибка создания или обновления сложной кривой + + + + Error creating or updating modeling simple curve + Ошибка создания или обновления модельной кривой + + + + Error creating or updating modeling curve path + Ошибка создания или обновления сложной модельной кривой + + + + Error creating or updating simple arc + Ошибка создания или обновления дуги + + + + Error creating or updating modeling arc + Ошибка создания или обновления модельной дуги + + + + Can't get parent for object id = %1 + Не могу получить родителя объекта id = %1 + + + + VDrawTool + + + Options + Параметры + + + + Delete + Удалить + + + + VSplinePath + + + Not enough points to create the spline. + Не достаточно точок для создания кривой. + + + + + + This spline is not exist. + Такой кривой не существует. + + + + VToolDetail + + + Delete + Удалить + + diff --git a/translations/valentina_uk.ts b/translations/valentina_uk.ts index 324f31031..ce7eedba7 100644 --- a/translations/valentina_uk.ts +++ b/translations/valentina_uk.ts @@ -4,78 +4,78 @@ DialogAlongLine - + Point along line Точка вздовж лінії - + Length Довжина - - + + ... - + _ - + Name new point Ім'я нової точки - + First point Перша точка - + Second point Друга точка - + Type line Тип лінії - + Input data Вхідні данні - + Size and growth Розмір і зріст - + Standart table Стандартна таблиця - + Increments Прибавки - + Length of lines Довжина ліній - + Length of arcs Довжина дуг - + Length of curves Довжина кривих @@ -83,80 +83,80 @@ DialogArc - + Arc Дуга - + Radius Радіус - - - - - - + + + + + + ... - - - + + + _ - + First angle degree Перший кут градуси - + Second angle degree Другий кут градуси - + Center point Точка центру - + Input data Вхідні данні - + Size and growth Розмір і зріст - + Standart table Стандартна таблиця - + Increments Прибавки - + Length of lines Довжина ліній - - + + Length of arcs Довжина дуг - + Angle of lines Кут ліній @@ -164,83 +164,83 @@ DialogBisector - + Bisector Бісектриса - + Length Довжина - - + + ... - + _ - + Name new point Ім'я нової точки - + First point Перша точка - + Second point Друга точка - + Third point Третя точка - + Type line Тип лінії - + Input data Вхідні данні - + Size and growth Розмір і зріст - + Standart table Стандартна таблиця - + Increments Прибавки - + Length of lines Довжина ліній - + Length of arcs Довжина дуг - + Length of curves Довжина кривих @@ -248,17 +248,17 @@ DialogDetail - + Detail Деталь - + Name detail Ім'я деталі - + Closed Замкнена @@ -266,86 +266,86 @@ DialogEndLine - + Point in the end of line Точка на кінці відрізку - + Length Довжина - - - - - - - - - - + + + + + + + + + + ... - + _ - + Base point Базова точка - + Name new point Ім'я нової точки - + Angle degree Кут градуси - + Type line Тип лінії - + Input data Вхідні данні - + Size and growth Розмір і зріст - + Standart table Стандартна таблиця - + Increments Прибавки - + Length of lines Довжина ліній - + Length of arcs Довжина дуг - + Length of curves Довжина кривих @@ -353,12 +353,12 @@ DialogHistory - + History Історія - + Tool Інструмент @@ -366,108 +366,108 @@ DialogIncrements - - + + Increments Прибавки - + Table sizes Таблиця розмірів - - + + Denotation Позначення - - + + The calculated value Розраховане значення - - + + Base value Базове значення - + In sizes В розмірах - + In growths В ростах - - + + Description Опис - + In size В розмірах - + In growth В ростах - - + + ... - + Lines Лінії - + Line Лінія - + Length of the line Довжина лінії - + Curves Криві - + Curve Крива - + Length of the curve Довжина кривої - + Arcs Дуги - + Arc Дуга - + Length of arc Довжина дуги @@ -475,17 +475,17 @@ DialogLine - + Line Лінія - + First point Перша точка - + Second point Друга точка @@ -493,34 +493,34 @@ DialogLineIntersect - + Point of line intersection Точка перетину ліній - + Name new point Ім'я нової точки - + First line Перша лінія - - + + First point Перша точка - - + + Second point Друга точка - + Second line Друга лінія @@ -528,91 +528,91 @@ DialogNormal - + Normal Перпендикуляр - + Length Довжина - - - - - - - - - - + + + + + + + + + + ... - + _ - + Name new point Ім'я нової точки - + First point Перша точка - + Second point Друга точка - + Additional angle degrees Додатковий кут градуси - + Type line Тип лінії - + Input data Вхідні данні - + Size and growth Розмір і зріст - + Standart table Стандартна таблиця - + Increments Прибавки - + Length of lines Довжини ліній - + Length of arcs Довжини дуг - + Length of curves Довжини кривих @@ -620,78 +620,78 @@ DialogPointOfContact - + Point of contact Точка дотику - + Radius Радіус - - + + ... - + _ - + Name new point Ім'я нової точки - + Center of arc Центер дуги - + Top of the line Початок лінії - + End of the line Кінець лінії - + Input data Вхідні данні - + Size and growth Розмір і зріст - + Standart table Стандартна таблиця - + Increments Прибавки - + Length of lines Довжини ліній - + Length of arcs Довжини дуг - + Length of curves Довжини кривих @@ -699,75 +699,75 @@ DialogShoulderPoint - - + + Point of shoulder Точка плеча - + Length Довжина - - + + ... - + _ - + Name new point Ім'я нової точки - + First point Перша точка - + Second point Друга точка - + Type of line Тип лінії - + Input data Вхідні данні - + Size and growth Розмір і зріст - + Standart table Стандартна таблиця - + Increments Прибавки - - + + Length of lines Довжини лінії - + Length of curves Довжни кривих @@ -775,27 +775,27 @@ DialogSinglePoint - + Single point Точка - + Координати Координати - + Y coordinate Y координата - + X coordinate Х координата - + Point name Ім'я точки @@ -803,42 +803,42 @@ DialogSpline - + Curve Крива - + First point Перша точка - + Length ratio of the first control point Коефіцієнт довжини першої контрольної точки - + The angle of the first control point Кут першої контрольної точки - + Second point Друга точка - + Length ratio of the second control point Коефіцієнт довжини другої контрольної точки - + The angle of the second control point Кут другої контрольної точки - + Coefficient of curvature of the curve Коефіцієнт кривизни кривої @@ -846,37 +846,37 @@ DialogSplinePath - + Curve path Складна крива - + Point of curve Точка кривої - + Length ratio of the first control point Коефіцієнт довжини першої контрольної точки - + The angle of the first control point Кут першої контрольної точки - + Length ratio of the second control point Коефіцієнт довжини другої контрольної точки - + The angle of the second control point Кут другої контрольної точки - + Coefficient of curvature of the curve Коефіцієнт кривизни кривої @@ -884,330 +884,568 @@ MainWindow - + Valentina Valentina - + Point Точка - - - - - - - - - - - - + + + + + + + + + + + + ... - + Line Лінія - + Curve Крива - + Arc Дуга - + Detail Деталь - + toolBar - + toolBar_2 - + toolBar_3 - + New Новий - + Create a new pattern Створити нове лекало - + Open Відкрити - + Open file with pattern Відкрити файл з лекалами - + Save Зберегти - + Save pattern Зберегти лекало - + Save as Зберегти як - + Save not yet saved pattern Зберегти ще не збережене лекало - + Draw Малювання - + Draw mode Режим малювання - + Details Деталь - + Deatils mode Режим деталей - - + + Tools pointer Інструмент вказівник - + New drawing Нове креслення - + Add new drawing Додати нове креслення - - + + Change the name of drawing Змінити ім'я креслення - + Table of variables Таблиця змінних - + Tables of variables Таблиці змінних - + History Історія - + Layout Розкладки - + Create layout Створити розкладку - + Drawing %1 Креслення %1 - - + + Drawing: Креслення: - + Enter a name for the drawing. Введіть ім'я креслення. - - + + Error. Drawing of same name already exists. Помилка. Креслення з таким ім'ям вже існує. - + Error creating drawing with the name Помилка створення креслення з ім'ям - + Enter a new name for the drawing. Введіть нове ім'я креслення. - + Growth: Зріст: - + Size: Розмір: - + Drawing: Креслення: - + Lekalo files (*.xml) Файл лекала (*.xml) - + Open file Відкрити файл + + + Can't open pattern file. File name empty + Не можу відкрити файл лекала. Пусте ім'я файлу + + + + + + + + Error! + Помилка! + + + + Error parsing file. + Помилка парсингу файла. + + + + Error can't convert value. + Помилка, не можу конвертувати значення. + + + + Error empty parameter. + Помилка, пустий параметр. + + + + Error wrong id. + Помикла, неправильний id. + + + + Error parsing pattern file. + Помилка парсінгу файлу лекала. + + + + Error in line %1 column %2 + Помилка в лінії %1 стовпчик %2 + TableWindow - + Create a layout Створити розкладку - + toolBar - + Save Зберегти - + Save layout Зберегти розкладку - + Next Наступний - + Next detail Наступна деталь - + Turn Повернути - + Turn the detail 180 degrees Повернути деталь на 180 градусів - + Stop laying Припинити укладання - + Enlarge letter Збільшити аркуш - + Enlarge the length of sheet Збільшити довжину аркушу - + Reduce sheet Зменшити аркуш - + Reduce the length of the sheet Зменшити довжину аркушу - - + + Mirroring Дзеркальне відображення - - + + Zoom In Збільшити - - + + Zoom Out Зменшити - + Stop Зупинити - + SVG Generator Example Drawing - + An SVG drawing created by the SVG Generator Example provided with Qt. + + VApplication + + + + + + + Error! + Помилка! + + + + Error parsing file. Program will be terminated. + Помилка парсінгу файла. Програма буде закрита. + + + + Error bad id. Program will be terminated. + Помилка неправильний id. Програма буде закрита. + + + + Error can't convert value. Program will be terminated. + Помилка конвертації значення. Програма буде закрита. + + + + Error empty parameter. Program will be terminated. + Помилка пустий параметр. Програма буде закрита. + + + + Error wrong id. Program will be terminated. + Помилка неправильний id. Програма буде закрита. + + + + VContainer + + + Can't find object + Не можу знайти об'єкт + + + + VDomDocument + + + Got wrong parameter id. Need only id > 0. + Отримано неправильний id. Допускаються тільки id > 0. + + + + Can't convert toLongLong parameter + Не можу конвертувати toLongLong параметру + + + + Got empty parameter + Отримано пустий параметр + + + + Can't convert toDouble parameter + Не можу конвертувати toDouble параметру + + + + Error creating or updating detail + Помилка створення чи оновлення деталі + + + + Error creating or updating single point + Помилка створення чи оновлення простої точки + + + + Error creating or updating point of end line + Помилка створення чи оновлення точки кінця відрізку + + + + Error creating or updating point along line + Помилка створення чи оновлення точки вздовж лінії + + + + Error creating or updating point of shoulder + Помилка створення чи оновлення точки плеча + + + + Error creating or updating point of normal + Помилка створення чи оновлення точки нормалі + + + + Error creating or updating point of bisector + Помилка створення чи оновлення точки бісектриси + + + + Error creating or updating point of lineintersection + Помилка створення чи оновлення точки перетину ліній + + + + Error creating or updating point of contact + Помилка створення чи оновлення точки дотику + + + + Error creating or updating modeling point + Помилка створення чи оновлення модельної точки + + + + Error creating or updating line + Помилка створення чи оновлення лінії + + + + Error creating or updating simple curve + Помилка створення чи оновлення кривої + + + + Error creating or updating curve path + Помилка створення чи оновлення шляху кривих + + + + Error creating or updating modeling simple curve + Помилка створення чи оновлення модельної кривої + + + + Error creating or updating modeling curve path + Помилка створення чи оновлення модельного шляху кривих + + + + Error creating or updating simple arc + Помилка створення чи оновлення дуги + + + + Error creating or updating modeling arc + Помилка створення чи оновлення модельної дуги + + + + Can't get parent for object id = %1 + Не можу отримати батька для об'єкту id = %1 + + + + VDrawTool + + + Options + Параметри + + + + Delete + Видалити + + + + VSplinePath + + + Not enough points to create the spline. + Не достатньо точок для створення кривої. + + + + + + This spline is not exist. + Такий сплайн не існує. + + + + VToolDetail + + + Delete + Видалити + + From aa6778427cb7405d95876bf21ed315bb140c2f63 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 1 Oct 2013 21:15:59 +0300 Subject: [PATCH 10/10] Used new compilator GCC 4.8 and key -Og. Optimization included files. Deleted key -Wsign-conversion. --HG-- branch : feature --- Valentina.pro | 23 ++++++++++---- container/vcontainer.h | 4 --- dialogs/dialogalongline.h | 2 -- dialogs/dialogarc.h | 1 - dialogs/dialogbisector.h | 4 --- dialogs/dialogdetail.h | 4 +-- dialogs/dialogendline.h | 4 --- dialogs/dialogincrements.h | 2 -- dialogs/dialogline.h | 4 --- dialogs/dialognormal.h | 4 --- dialogs/dialogpointofcontact.h | 2 -- dialogs/dialogshoulderpoint.h | 2 -- dialogs/dialogsinglepoint.h | 1 - dialogs/dialogspline.h | 1 - dialogs/dialogsplinepath.h | 1 - dialogs/dialogtool.h | 4 +-- exception/vexceptionemptyparameter.h | 2 +- geometry/varc.h | 4 --- geometry/vspline.h | 1 - geometry/vsplinepath.h | 1 - main.cpp | 4 +-- mainwindow.h | 2 -- tablewindow.cpp | 31 +------------------ tools/drawTools/vdrawtool.h | 2 +- tools/drawTools/vtoolalongline.cpp | 1 - tools/drawTools/vtoolarc.cpp | 1 - tools/drawTools/vtoolarc.h | 21 ++++++------- tools/drawTools/vtoolbisector.cpp | 1 - tools/drawTools/vtoolbisector.h | 4 +-- tools/drawTools/vtoolendline.h | 4 +-- tools/drawTools/vtoolline.cpp | 1 - tools/drawTools/vtoolline.h | 3 +- tools/drawTools/vtoolnormal.cpp | 1 - tools/drawTools/vtoolnormal.h | 1 - tools/drawTools/vtoolpoint.cpp | 1 - tools/drawTools/vtoolpoint.h | 1 - tools/drawTools/vtoolshoulderpoint.cpp | 1 - tools/drawTools/vtoolsinglepoint.cpp | 4 --- tools/drawTools/vtoolsinglepoint.h | 2 -- tools/drawTools/vtoolspline.cpp | 1 - tools/drawTools/vtoolspline.h | 2 -- tools/drawTools/vtoolsplinepath.h | 2 -- tools/modelingTools/vmodelingalongline.cpp | 1 - tools/modelingTools/vmodelingarc.h | 2 -- tools/modelingTools/vmodelingbisector.h | 1 - tools/modelingTools/vmodelingendline.h | 1 - tools/modelingTools/vmodelingline.cpp | 1 - .../modelingTools/vmodelinglineintersect.cpp | 1 - tools/modelingTools/vmodelingnormal.cpp | 1 - tools/modelingTools/vmodelingnormal.h | 1 - tools/modelingTools/vmodelingpoint.h | 1 - .../modelingTools/vmodelingshoulderpoint.cpp | 1 - tools/modelingTools/vmodelingspline.h | 2 -- tools/modelingTools/vmodelingsplinepath.h | 2 -- tools/vabstracttool.h | 1 - widgets/vcontrolpointspline.h | 1 - xml/vdomdocument.h | 1 - 57 files changed, 37 insertions(+), 143 deletions(-) diff --git a/Valentina.pro b/Valentina.pro index bcdc56024..14e0c70e0 100644 --- a/Valentina.pro +++ b/Valentina.pro @@ -6,7 +6,7 @@ # Use out-of-source builds (shadow builds) -QT += core gui widgets xml svg printsupport +QT += core gui widgets xml svg TARGET = Valentina TEMPLATE = app @@ -234,10 +234,10 @@ CONFIG(debug, debug|release){ # Debug QMAKE_CXXFLAGS += -isystem "/usr/include/qt5" -isystem "/usr/include/qt5/QtWidgets" \ -isystem "/usr/include/qt5/QtXml" -isystem "/usr/include/qt5/QtGui" \ - -isystem "/usr/include/qt5/QtCore" -O0 -Wall -Wextra -pedantic -Weffc++ \ - -isystem "$$OUT_PWD/uic" \ - -Woverloaded-virtual -Wctor-dtor-privacy -Wnon-virtual-dtor -Wold-style-cast \ - -Wconversion -Wsign-conversion -Winit-self -Wunreachable-code + -isystem "/usr/include/qt5/QtCore" -isystem "$$OUT_PWD/uic" -isystem "$$OUT_PWD/moc/" \ + -Og -Wall -Wextra -pedantic -Weffc++ -Woverloaded-virtual -Wctor-dtor-privacy \ + -Wnon-virtual-dtor -Wold-style-cast -Wconversion -Winit-self \ + -Wunreachable-code }else{ # Release QMAKE_CXXFLAGS += -O1 @@ -249,6 +249,17 @@ CONFIG(debug, debug|release){ lrelease.CONFIG += no_link target_predeps } - +message(Qt version: $$[QT_VERSION]) +message(Qt is installed in $$[QT_INSTALL_PREFIX]) +message(Qt resources can be found in the following locations:) +message(Documentation: $$[QT_INSTALL_DOCS]) +message(Header files: $$[QT_INSTALL_HEADERS]) +message(Libraries: $$[QT_INSTALL_LIBS]) +message(Binary files (executables): $$[QT_INSTALL_BINS]) +message(Plugins: $$[QT_INSTALL_PLUGINS]) +message(Data files: $$[QT_INSTALL_DATA]) +message(Translation files: $$[QT_INSTALL_TRANSLATIONS]) +message(Settings: $$[QT_INSTALL_SETTINGS]) +message(Examples: $$[QT_INSTALL_EXAMPLES]) diff --git a/container/vcontainer.h b/container/vcontainer.h index 33ed7eede..fce8a378a 100644 --- a/container/vcontainer.h +++ b/container/vcontainer.h @@ -22,13 +22,9 @@ #ifndef VCONTAINER_H #define VCONTAINER_H -#include #include -#include "options.h" -#include "vpointf.h" #include "vstandarttablecell.h" #include "vincrementtablerow.h" -#include "geometry/vspline.h" #include "geometry/varc.h" #include "geometry/vsplinepath.h" #include "geometry/vdetail.h" diff --git a/dialogs/dialogalongline.h b/dialogs/dialogalongline.h index d501f6323..3f004fb52 100644 --- a/dialogs/dialogalongline.h +++ b/dialogs/dialogalongline.h @@ -23,8 +23,6 @@ #define DIALOGALONGLINE_H #include "dialogtool.h" -#include "options.h" -#include "container/vcontainer.h" #include "container/calculator.h" namespace Ui { diff --git a/dialogs/dialogarc.h b/dialogs/dialogarc.h index 8cb7b3c82..00f23e8e5 100644 --- a/dialogs/dialogarc.h +++ b/dialogs/dialogarc.h @@ -23,7 +23,6 @@ #define DIALOGARC_H #include "dialogtool.h" -#include "container/vcontainer.h" namespace Ui { class DialogArc; diff --git a/dialogs/dialogbisector.h b/dialogs/dialogbisector.h index 3f4c31d4b..aa7f529f2 100644 --- a/dialogs/dialogbisector.h +++ b/dialogs/dialogbisector.h @@ -23,11 +23,7 @@ #define DIALOGBISECTOR_H #include "dialogtool.h" -#include #include -#include -#include "options.h" -#include "container/vcontainer.h" #include "container/calculator.h" namespace Ui { diff --git a/dialogs/dialogdetail.h b/dialogs/dialogdetail.h index 6086318ae..79cc1b55e 100644 --- a/dialogs/dialogdetail.h +++ b/dialogs/dialogdetail.h @@ -24,11 +24,9 @@ #include "ui_dialogdetail.h" #include "dialogtool.h" -#include "container/vcontainer.h" #include "geometry/vdetail.h" -class DialogDetail : public DialogTool -{ +class DialogDetail : public DialogTool{ Q_OBJECT public: explicit DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent = 0); diff --git a/dialogs/dialogendline.h b/dialogs/dialogendline.h index 47852b9cf..5053e6462 100644 --- a/dialogs/dialogendline.h +++ b/dialogs/dialogendline.h @@ -23,11 +23,7 @@ #define DIALOGENDLINE_H #include "dialogtool.h" -#include #include -#include -#include "options.h" -#include "container/vcontainer.h" #include "container/calculator.h" namespace Ui { diff --git a/dialogs/dialogincrements.h b/dialogs/dialogincrements.h index 0bdd56325..b7569b787 100644 --- a/dialogs/dialogincrements.h +++ b/dialogs/dialogincrements.h @@ -23,9 +23,7 @@ #define DIALOGINCREMENTS_H #include "dialogtool.h" -#include #include "xml/vdomdocument.h" -#include "container/vcontainer.h" namespace Ui { class DialogIncrements; diff --git a/dialogs/dialogline.h b/dialogs/dialogline.h index f5a525294..dca627eaa 100644 --- a/dialogs/dialogline.h +++ b/dialogs/dialogline.h @@ -23,10 +23,6 @@ #define DIALOGLINE_H #include "dialogtool.h" -#include -#include "container/vcontainer.h" -#include "options.h" - namespace Ui { class DialogLine; diff --git a/dialogs/dialognormal.h b/dialogs/dialognormal.h index b8010fb6b..5586ae825 100644 --- a/dialogs/dialognormal.h +++ b/dialogs/dialognormal.h @@ -23,11 +23,7 @@ #define DIALOGNORMAL_H #include "dialogtool.h" -#include #include -#include -#include "options.h" -#include "container/vcontainer.h" #include "container/calculator.h" namespace Ui { diff --git a/dialogs/dialogpointofcontact.h b/dialogs/dialogpointofcontact.h index 01b60d737..7d85ddcb3 100644 --- a/dialogs/dialogpointofcontact.h +++ b/dialogs/dialogpointofcontact.h @@ -24,8 +24,6 @@ #include "ui_dialogpointofcontact.h" #include "dialogtool.h" -#include "options.h" -#include "container/vcontainer.h" #include "container/calculator.h" class DialogPointOfContact : public DialogTool diff --git a/dialogs/dialogshoulderpoint.h b/dialogs/dialogshoulderpoint.h index d776062fb..49df44255 100644 --- a/dialogs/dialogshoulderpoint.h +++ b/dialogs/dialogshoulderpoint.h @@ -23,8 +23,6 @@ #define DIALOGSHOULDERPOINT_H #include "dialogtool.h" -#include "options.h" -#include "container/vcontainer.h" #include "container/calculator.h" namespace Ui { diff --git a/dialogs/dialogsinglepoint.h b/dialogs/dialogsinglepoint.h index 4d1e187bb..02c064386 100644 --- a/dialogs/dialogsinglepoint.h +++ b/dialogs/dialogsinglepoint.h @@ -23,7 +23,6 @@ #define DIALOGSINGLEPOINT_H #include "dialogtool.h" -#include "container/vcontainer.h" namespace Ui { class DialogSinglePoint; diff --git a/dialogs/dialogspline.h b/dialogs/dialogspline.h index 1f2a6c035..180f3a455 100644 --- a/dialogs/dialogspline.h +++ b/dialogs/dialogspline.h @@ -23,7 +23,6 @@ #define DIALOGSPLINE_H #include "dialogtool.h" -#include "container/vcontainer.h" namespace Ui { class DialogSpline; diff --git a/dialogs/dialogsplinepath.h b/dialogs/dialogsplinepath.h index 683c44351..41cfeb0c2 100644 --- a/dialogs/dialogsplinepath.h +++ b/dialogs/dialogsplinepath.h @@ -23,7 +23,6 @@ #define DIALOGSPLINEPATH_H #include "dialogtool.h" -#include "container/vcontainer.h" #include "geometry/vsplinepath.h" namespace Ui { diff --git a/dialogs/dialogtool.h b/dialogs/dialogtool.h index 0b28920f9..a6168934b 100644 --- a/dialogs/dialogtool.h +++ b/dialogs/dialogtool.h @@ -32,10 +32,8 @@ #include #include #include "container/vcontainer.h" -#include "options.h" -class DialogTool : public QDialog -{ +class DialogTool : public QDialog{ Q_OBJECT public: DialogTool(const VContainer *data, Draw::Draws mode = Draw::Calculation, diff --git a/exception/vexceptionemptyparameter.h b/exception/vexceptionemptyparameter.h index 286b0bfac..5e2ad973f 100644 --- a/exception/vexceptionemptyparameter.h +++ b/exception/vexceptionemptyparameter.h @@ -23,7 +23,7 @@ #define VEXCEPTIONEMPTYPARAMETER_H #include "vexception.h" -#include "QDomElement" +#include class VExceptionEmptyParameter : public VException { diff --git a/geometry/varc.h b/geometry/varc.h index f467a15f9..d0f0b1285 100644 --- a/geometry/varc.h +++ b/geometry/varc.h @@ -22,10 +22,6 @@ #ifndef VARC_H #define VARC_H -#include -#include -#include -#include "container/vpointf.h" #include "vspline.h" /** diff --git a/geometry/vspline.h b/geometry/vspline.h index 72898a9fb..6c7cf59c0 100644 --- a/geometry/vspline.h +++ b/geometry/vspline.h @@ -28,7 +28,6 @@ #include #include #include "container/vpointf.h" -#include "options.h" /** * @brief VSpline клас, що реалізує сплайн. diff --git a/geometry/vsplinepath.h b/geometry/vsplinepath.h index 3170668b7..c6d6330f9 100644 --- a/geometry/vsplinepath.h +++ b/geometry/vsplinepath.h @@ -24,7 +24,6 @@ #include "vsplinepoint.h" #include "vspline.h" -#include "options.h" #include namespace SplinePoint{ diff --git a/main.cpp b/main.cpp index 5561ab56e..6ed51ac57 100644 --- a/main.cpp +++ b/main.cpp @@ -20,7 +20,7 @@ ****************************************************************************/ #include "mainwindow.h" -#include +#include "widgets/vapplication.h" #include #include "tablewindow.h" @@ -48,7 +48,7 @@ void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QS int main(int argc, char *argv[]){ qInstallMessageHandler(myMessageOutput); - QApplication app(argc, argv); + VApplication app(argc, argv); QTranslator qtTranslator; qtTranslator.load("qt_" + QLocale::system().name(), diff --git a/mainwindow.h b/mainwindow.h index 3a8cfd037..00cf115f8 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -35,8 +35,6 @@ #include "tools/drawTools/drawtools.h" #include "tools/modelingTools/modelingtools.h" #include "xml/vdomdocument.h" -#include "container/vcontainer.h" -#include "options.h" #include "tools/vtooldetail.h" namespace Ui { diff --git a/tablewindow.cpp b/tablewindow.cpp index 61924f115..3189b9845 100644 --- a/tablewindow.cpp +++ b/tablewindow.cpp @@ -27,8 +27,6 @@ #include #include "options.h" #include -#undef PaperSize -#include TableWindow::TableWindow(QWidget *parent) : QMainWindow(parent), numberDetal(0), colission(0), ui(new Ui::TableWindow), @@ -143,7 +141,7 @@ void TableWindow::StopTable(){ } void TableWindow::saveScene(){ - QString name = QFileDialog::getSaveFileName(0, "Зберегти розкладку", "", "Images (*.png);;Svg files (*.svg);;Ps files (*.ps)"); + QString name = QFileDialog::getSaveFileName(0, "Зберегти розкладку", "", "Images (*.png);;Svg files (*.svg)"); if(name.isNull()){ return; } @@ -164,8 +162,6 @@ void TableWindow::saveScene(){ SvgFile(name); } else if(fi.suffix() == "png"){ PngFile(name); - } else if(fi.suffix() == "ps"){ - PsFile(name); } // if(name.indexOf(".svg",name.size()-4)<0){ // name.append(".svg"); @@ -348,28 +344,3 @@ void TableWindow::PngFile(const QString &name) const{ currentScene->render(&painter); image.save(name); } - -void TableWindow::PsFile(const QString &name) const{ - - QPrinter printer(QPrinter::HighResolution); - //printer.setOutputFormat(QPrinter::PostScriptFormat); - - printer.setOutputFileName(name); - QRectF r = paper->rect(); - qreal x=0, y=0, w=0, h=0; - r.getRect(&x,&y,&w,&h); - printer.setResolution(PrintDPI); - qDebug()<render(&painter); - painter.end(); -} diff --git a/tools/drawTools/vdrawtool.h b/tools/drawTools/vdrawtool.h index 6f322f33e..513ca12cd 100644 --- a/tools/drawTools/vdrawtool.h +++ b/tools/drawTools/vdrawtool.h @@ -50,7 +50,7 @@ protected: if(!ignoreContextMenuEvent){ QMenu menu; QAction *actionOption = menu.addAction(tr("Options")); - QAction *actionRemove; + QAction *actionRemove = 0; if(showRemove){ actionRemove = menu.addAction(tr("Delete")); if(_referens > 1){ diff --git a/tools/drawTools/vtoolalongline.cpp b/tools/drawTools/vtoolalongline.cpp index c2c59128f..e0237cbdd 100644 --- a/tools/drawTools/vtoolalongline.cpp +++ b/tools/drawTools/vtoolalongline.cpp @@ -21,7 +21,6 @@ #include "vtoolalongline.h" #include -#include #include #include "container/calculator.h" diff --git a/tools/drawTools/vtoolarc.cpp b/tools/drawTools/vtoolarc.cpp index d8f1c50be..84d453f8e 100644 --- a/tools/drawTools/vtoolarc.cpp +++ b/tools/drawTools/vtoolarc.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "vtoolarc.h" -#include #include "container/calculator.h" VToolArc::VToolArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, diff --git a/tools/drawTools/vtoolarc.h b/tools/drawTools/vtoolarc.h index 00c5a43a3..f78f26bbc 100644 --- a/tools/drawTools/vtoolarc.h +++ b/tools/drawTools/vtoolarc.h @@ -23,24 +23,23 @@ #define VTOOLARC_H #include "vdrawtool.h" -#include "xml/vdomdocument.h" #include #include "dialogs/dialogarc.h" #include "widgets/vcontrolpointspline.h" -#include "container/vcontainer.h" -class VToolArc :public VDrawTool, public QGraphicsPathItem -{ +class VToolArc :public VDrawTool, public QGraphicsPathItem{ Q_OBJECT public: - VToolArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - virtual void setDialog(); - static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, + VToolArc(VDomDocument *doc, VContainer *data, qint64 id, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); + virtual void setDialog(); + static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, + VDomDocument *doc, VContainer *data); - static void Create(const qint64 _id, const qint64 ¢er, const QString &radius, - const QString &f1, const QString &f2, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static void Create(const qint64 _id, const qint64 ¢er, const QString &radius, + const QString &f1, const QString &f2, VMainGraphicsScene *scene, + VDomDocument *doc, VContainer *data, const Document::Documents &parse, + Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolbisector.cpp b/tools/drawTools/vtoolbisector.cpp index 65dfd66eb..80ee7453d 100644 --- a/tools/drawTools/vtoolbisector.cpp +++ b/tools/drawTools/vtoolbisector.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "vtoolbisector.h" -#include VToolBisector::VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &firstPointId, diff --git a/tools/drawTools/vtoolbisector.h b/tools/drawTools/vtoolbisector.h index 2f257fd1e..1c88f670d 100644 --- a/tools/drawTools/vtoolbisector.h +++ b/tools/drawTools/vtoolbisector.h @@ -22,12 +22,10 @@ #ifndef VTOOLBISECTOR_H #define VTOOLBISECTOR_H -#include #include "vtoollinepoint.h" #include "dialogs/dialogbisector.h" -class VToolBisector : public VToolLinePoint -{ +class VToolBisector : public VToolLinePoint{ public: VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &firstPointId, diff --git a/tools/drawTools/vtoolendline.h b/tools/drawTools/vtoolendline.h index d2656ed6d..4cd89b31b 100644 --- a/tools/drawTools/vtoolendline.h +++ b/tools/drawTools/vtoolendline.h @@ -22,12 +22,10 @@ #ifndef VTOOLENDLINE_H #define VTOOLENDLINE_H -#include #include "vtoollinepoint.h" #include "dialogs/dialogendline.h" -class VToolEndLine : public VToolLinePoint -{ +class VToolEndLine : public VToolLinePoint{ Q_OBJECT public: VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, diff --git a/tools/drawTools/vtoolline.cpp b/tools/drawTools/vtoolline.cpp index bd83d48c9..fc5cc7577 100644 --- a/tools/drawTools/vtoolline.cpp +++ b/tools/drawTools/vtoolline.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "vtoolline.h" -#include #include VToolLine::VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, qint64 secondPoint, diff --git a/tools/drawTools/vtoolline.h b/tools/drawTools/vtoolline.h index fa6fbe1db..799f09c8b 100644 --- a/tools/drawTools/vtoolline.h +++ b/tools/drawTools/vtoolline.h @@ -26,8 +26,7 @@ #include "QGraphicsLineItem" #include "dialogs/dialogline.h" -class VToolLine: public VDrawTool, public QGraphicsLineItem -{ +class VToolLine: public VDrawTool, public QGraphicsLineItem{ Q_OBJECT public: VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, diff --git a/tools/drawTools/vtoolnormal.cpp b/tools/drawTools/vtoolnormal.cpp index 701089c16..2fd033e3c 100644 --- a/tools/drawTools/vtoolnormal.cpp +++ b/tools/drawTools/vtoolnormal.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "vtoolnormal.h" -#include VToolNormal::VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, diff --git a/tools/drawTools/vtoolnormal.h b/tools/drawTools/vtoolnormal.h index 2410bc163..217328744 100644 --- a/tools/drawTools/vtoolnormal.h +++ b/tools/drawTools/vtoolnormal.h @@ -22,7 +22,6 @@ #ifndef VTOOLNORMAL_H #define VTOOLNORMAL_H -#include #include "vtoollinepoint.h" #include "dialogs/dialognormal.h" diff --git a/tools/drawTools/vtoolpoint.cpp b/tools/drawTools/vtoolpoint.cpp index 5afae933e..afd581fd4 100644 --- a/tools/drawTools/vtoolpoint.cpp +++ b/tools/drawTools/vtoolpoint.cpp @@ -24,7 +24,6 @@ #include #include #include -#include "container/vpointf.h" VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, diff --git a/tools/drawTools/vtoolpoint.h b/tools/drawTools/vtoolpoint.h index 1a6a15f4c..4b740bd74 100644 --- a/tools/drawTools/vtoolpoint.h +++ b/tools/drawTools/vtoolpoint.h @@ -24,7 +24,6 @@ #include "vdrawtool.h" #include "widgets/vgraphicssimpletextitem.h" -#include "options.h" class VToolPoint: public VDrawTool, public QGraphicsEllipseItem{ Q_OBJECT diff --git a/tools/drawTools/vtoolshoulderpoint.cpp b/tools/drawTools/vtoolshoulderpoint.cpp index bd137bf4a..3b41fe3ef 100644 --- a/tools/drawTools/vtoolshoulderpoint.cpp +++ b/tools/drawTools/vtoolshoulderpoint.cpp @@ -21,7 +21,6 @@ #include "vtoolshoulderpoint.h" #include -#include VToolShoulderPoint::VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &p1Line, diff --git a/tools/drawTools/vtoolsinglepoint.cpp b/tools/drawTools/vtoolsinglepoint.cpp index 3da725ceb..f244d0104 100644 --- a/tools/drawTools/vtoolsinglepoint.cpp +++ b/tools/drawTools/vtoolsinglepoint.cpp @@ -24,11 +24,7 @@ #include #include #include -#include #include -#include -#include "options.h" -#include "container/vpointf.h" VToolSinglePoint::VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem * parent ):VToolPoint(doc, data, id, parent), diff --git a/tools/drawTools/vtoolsinglepoint.h b/tools/drawTools/vtoolsinglepoint.h index f2ff140a1..f5b2dad67 100644 --- a/tools/drawTools/vtoolsinglepoint.h +++ b/tools/drawTools/vtoolsinglepoint.h @@ -22,8 +22,6 @@ #ifndef VTOOLSINGLEPOINT_H #define VTOOLSINGLEPOINT_H -#include "container/vcontainer.h" -#include "xml/vdomdocument.h" #include "dialogs/dialogsinglepoint.h" #include "vtoolpoint.h" diff --git a/tools/drawTools/vtoolspline.cpp b/tools/drawTools/vtoolspline.cpp index 30dc78755..85d80d197 100644 --- a/tools/drawTools/vtoolspline.cpp +++ b/tools/drawTools/vtoolspline.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "vtoolspline.h" -#include #include #include "geometry/vspline.h" diff --git a/tools/drawTools/vtoolspline.h b/tools/drawTools/vtoolspline.h index 74ece8b89..b421b35a0 100644 --- a/tools/drawTools/vtoolspline.h +++ b/tools/drawTools/vtoolspline.h @@ -23,11 +23,9 @@ #define VTOOLSPLINE_H #include "vdrawtool.h" -#include "xml/vdomdocument.h" #include #include "dialogs/dialogspline.h" #include "widgets/vcontrolpointspline.h" -#include "container/vcontainer.h" #include "geometry/vsplinepath.h" class VToolSpline:public VDrawTool, public QGraphicsPathItem diff --git a/tools/drawTools/vtoolsplinepath.h b/tools/drawTools/vtoolsplinepath.h index f4559e6ec..b880bdfd2 100644 --- a/tools/drawTools/vtoolsplinepath.h +++ b/tools/drawTools/vtoolsplinepath.h @@ -23,11 +23,9 @@ #define VTOOLSPLINEPATH_H #include "vdrawtool.h" -#include "xml/vdomdocument.h" #include #include "dialogs/dialogsplinepath.h" #include "widgets/vcontrolpointspline.h" -#include "container/vcontainer.h" class VToolSplinePath:public VDrawTool, public QGraphicsPathItem{ Q_OBJECT diff --git a/tools/modelingTools/vmodelingalongline.cpp b/tools/modelingTools/vmodelingalongline.cpp index 3423e2db8..76d448dad 100644 --- a/tools/modelingTools/vmodelingalongline.cpp +++ b/tools/modelingTools/vmodelingalongline.cpp @@ -21,7 +21,6 @@ #include "vmodelingalongline.h" #include -#include #include #include "container/calculator.h" diff --git a/tools/modelingTools/vmodelingarc.h b/tools/modelingTools/vmodelingarc.h index 1ef1807e5..e452f59e1 100644 --- a/tools/modelingTools/vmodelingarc.h +++ b/tools/modelingTools/vmodelingarc.h @@ -23,11 +23,9 @@ #define VMODELINGARC_H #include "vmodelingtool.h" -#include "xml/vdomdocument.h" #include #include "dialogs/dialogarc.h" #include "widgets/vcontrolpointspline.h" -#include "container/vcontainer.h" class VModelingArc :public VModelingTool, public QGraphicsPathItem{ Q_OBJECT diff --git a/tools/modelingTools/vmodelingbisector.h b/tools/modelingTools/vmodelingbisector.h index dd8180b13..8795d90de 100644 --- a/tools/modelingTools/vmodelingbisector.h +++ b/tools/modelingTools/vmodelingbisector.h @@ -22,7 +22,6 @@ #ifndef VMODELINGBISECTOR_H #define VMODELINGBISECTOR_H -#include #include "vmodelinglinepoint.h" #include "dialogs/dialogbisector.h" diff --git a/tools/modelingTools/vmodelingendline.h b/tools/modelingTools/vmodelingendline.h index 0708e9a75..6bd9d110b 100644 --- a/tools/modelingTools/vmodelingendline.h +++ b/tools/modelingTools/vmodelingendline.h @@ -22,7 +22,6 @@ #ifndef VMODELINGENDLINE_H #define VMODELINGENDLINE_H -#include #include "vmodelinglinepoint.h" #include "dialogs/dialogendline.h" diff --git a/tools/modelingTools/vmodelingline.cpp b/tools/modelingTools/vmodelingline.cpp index b434adfbb..06614bf09 100644 --- a/tools/modelingTools/vmodelingline.cpp +++ b/tools/modelingTools/vmodelingline.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "vmodelingline.h" -#include #include VModelingLine::VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, diff --git a/tools/modelingTools/vmodelinglineintersect.cpp b/tools/modelingTools/vmodelinglineintersect.cpp index d7d473194..51a45e7d0 100644 --- a/tools/modelingTools/vmodelinglineintersect.cpp +++ b/tools/modelingTools/vmodelinglineintersect.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "vmodelinglineintersect.h" -#include VModelingLineIntersect::VModelingLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2, diff --git a/tools/modelingTools/vmodelingnormal.cpp b/tools/modelingTools/vmodelingnormal.cpp index d7c7a3274..55edddd10 100644 --- a/tools/modelingTools/vmodelingnormal.cpp +++ b/tools/modelingTools/vmodelingnormal.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "vmodelingnormal.h" -#include VModelingNormal::VModelingNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, diff --git a/tools/modelingTools/vmodelingnormal.h b/tools/modelingTools/vmodelingnormal.h index 97c2c71aa..906aa797f 100644 --- a/tools/modelingTools/vmodelingnormal.h +++ b/tools/modelingTools/vmodelingnormal.h @@ -22,7 +22,6 @@ #ifndef VMODELINGNORMAL_H #define VMODELINGNORMAL_H -#include #include "vmodelinglinepoint.h" #include "dialogs/dialognormal.h" diff --git a/tools/modelingTools/vmodelingpoint.h b/tools/modelingTools/vmodelingpoint.h index c851f3d6b..e3bef5073 100644 --- a/tools/modelingTools/vmodelingpoint.h +++ b/tools/modelingTools/vmodelingpoint.h @@ -24,7 +24,6 @@ #include "vmodelingtool.h" #include "widgets/vgraphicssimpletextitem.h" -#include "options.h" class VModelingPoint: public VModelingTool, public QGraphicsEllipseItem{ Q_OBJECT diff --git a/tools/modelingTools/vmodelingshoulderpoint.cpp b/tools/modelingTools/vmodelingshoulderpoint.cpp index c67f92427..d96b5ccdf 100644 --- a/tools/modelingTools/vmodelingshoulderpoint.cpp +++ b/tools/modelingTools/vmodelingshoulderpoint.cpp @@ -21,7 +21,6 @@ #include "vmodelingshoulderpoint.h" #include -#include VModelingShoulderPoint::VModelingShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &p1Line, diff --git a/tools/modelingTools/vmodelingspline.h b/tools/modelingTools/vmodelingspline.h index 09a7251d1..bffdb148b 100644 --- a/tools/modelingTools/vmodelingspline.h +++ b/tools/modelingTools/vmodelingspline.h @@ -23,11 +23,9 @@ #define VMODELINGSPLINE_H #include "vmodelingtool.h" -#include "xml/vdomdocument.h" #include #include "dialogs/dialogspline.h" #include "widgets/vcontrolpointspline.h" -#include "container/vcontainer.h" #include "geometry/vsplinepath.h" class VModelingSpline:public VModelingTool, public QGraphicsPathItem{ diff --git a/tools/modelingTools/vmodelingsplinepath.h b/tools/modelingTools/vmodelingsplinepath.h index 75494a2ea..de3ea52c8 100644 --- a/tools/modelingTools/vmodelingsplinepath.h +++ b/tools/modelingTools/vmodelingsplinepath.h @@ -23,11 +23,9 @@ #define VMODELINGSPLINEPATH_H #include "vmodelingtool.h" -#include "xml/vdomdocument.h" #include #include "dialogs/dialogsplinepath.h" #include "widgets/vcontrolpointspline.h" -#include "container/vcontainer.h" class VModelingSplinePath:public VModelingTool, public QGraphicsPathItem{ Q_OBJECT diff --git a/tools/vabstracttool.h b/tools/vabstracttool.h index 22fe67dfe..2391e053b 100644 --- a/tools/vabstracttool.h +++ b/tools/vabstracttool.h @@ -24,7 +24,6 @@ #include "xml/vdomdocument.h" #include "vdatatool.h" -#include "container/vcontainer.h" class VAbstractTool: public VDataTool{ Q_OBJECT diff --git a/widgets/vcontrolpointspline.h b/widgets/vcontrolpointspline.h index 034dfae3f..231f8220a 100644 --- a/widgets/vcontrolpointspline.h +++ b/widgets/vcontrolpointspline.h @@ -25,7 +25,6 @@ #include #include #include -#include "options.h" #include "geometry/vsplinepath.h" class VControlPointSpline : public QObject, public QGraphicsEllipseItem diff --git a/xml/vdomdocument.h b/xml/vdomdocument.h index 62bbb275b..192bee821 100644 --- a/xml/vdomdocument.h +++ b/xml/vdomdocument.h @@ -25,7 +25,6 @@ #include #include #include -#include "container/vcontainer.h" #include "widgets/vmaingraphicsscene.h" #include "tools/vdatatool.h" #include "vtoolrecord.h"