From 66c9e35e0baacb63fbf29d323c53a774b7ffae48 Mon Sep 17 00:00:00 2001 From: dismine Date: Sat, 21 Dec 2013 13:36:51 +0200 Subject: [PATCH] We no need anymore VModeling* tools. --HG-- branch : feature --- src/container/vcontainer.cpp | 163 ++------ src/container/vcontainer.h | 108 +---- src/container/vpointf.cpp | 1 - src/container/vpointf.h | 24 +- src/dialogs/dialogalongline.cpp | 38 +- src/dialogs/dialogalongline.h | 4 +- src/dialogs/dialogarc.cpp | 37 +- src/dialogs/dialogarc.h | 3 +- src/dialogs/dialogbisector.cpp | 42 +- src/dialogs/dialogbisector.h | 4 +- src/dialogs/dialogcutspline.cpp | 37 +- src/dialogs/dialogcutspline.h | 2 +- src/dialogs/dialogcutsplinepath.cpp | 36 +- src/dialogs/dialogcutsplinepath.h | 2 +- src/dialogs/dialogdetail.cpp | 78 +--- src/dialogs/dialogdetail.h | 7 +- src/dialogs/dialogendline.cpp | 37 +- src/dialogs/dialogendline.h | 3 +- src/dialogs/dialogheight.cpp | 42 +- src/dialogs/dialogheight.h | 4 +- src/dialogs/dialoghistory.cpp | 2 +- src/dialogs/dialogincrements.cpp | 2 +- src/dialogs/dialogline.cpp | 40 +- src/dialogs/dialogline.h | 3 +- src/dialogs/dialoglineintersect.cpp | 45 +-- src/dialogs/dialoglineintersect.h | 4 +- src/dialogs/dialognormal.cpp | 39 +- src/dialogs/dialognormal.h | 3 +- src/dialogs/dialogpointofcontact.cpp | 42 +- src/dialogs/dialogpointofcontact.h | 4 +- src/dialogs/dialogpointofintersection.cpp | 40 +- src/dialogs/dialogpointofintersection.h | 4 +- src/dialogs/dialogshoulderpoint.cpp | 42 +- src/dialogs/dialogshoulderpoint.h | 4 +- src/dialogs/dialogsinglepoint.cpp | 2 +- src/dialogs/dialogspline.cpp | 55 +-- src/dialogs/dialogspline.h | 3 +- src/dialogs/dialogsplinepath.cpp | 36 +- src/dialogs/dialogsplinepath.h | 4 +- src/dialogs/dialogtool.cpp | 177 ++------- src/dialogs/dialogtool.h | 27 +- src/dialogs/dialogtriangle.cpp | 46 +-- src/dialogs/dialogtriangle.h | 3 +- src/geometry/varc.cpp | 10 +- src/geometry/varc.h | 17 +- src/geometry/vnodedetail.cpp | 11 +- src/geometry/vnodedetail.h | 18 +- src/geometry/vspline.cpp | 16 +- src/geometry/vspline.h | 20 +- src/geometry/vsplinepath.cpp | 10 +- src/geometry/vsplinepath.h | 17 +- src/mainwindow.cpp | 48 +-- src/mainwindow.h | 3 +- src/options.h | 4 +- src/tools/drawTools/vtoolcutspline.h | 1 + src/tools/drawTools/vtoolcutsplinepath.cpp | 1 - src/tools/drawTools/vtoolcutsplinepath.h | 1 + src/tools/drawTools/vtooltriangle.cpp | 3 +- src/tools/modelingTools/modelingtools.h | 49 --- .../modelingTools/vmodelingalongline.cpp | 174 --------- src/tools/modelingTools/vmodelingalongline.h | 129 ------ src/tools/modelingTools/vmodelingarc.cpp | 198 ---------- src/tools/modelingTools/vmodelingarc.h | 140 ------- src/tools/modelingTools/vmodelingbisector.cpp | 185 --------- src/tools/modelingTools/vmodelingbisector.h | 137 ------- .../modelingTools/vmodelingcutspline.cpp | 239 ------------ src/tools/modelingTools/vmodelingcutspline.h | 130 ------- .../modelingTools/vmodelingcutsplinepath.cpp | 126 ------ .../modelingTools/vmodelingcutsplinepath.h | 113 ------ src/tools/modelingTools/vmodelingendline.cpp | 161 -------- src/tools/modelingTools/vmodelingendline.h | 121 ------ src/tools/modelingTools/vmodelingheight.cpp | 163 -------- src/tools/modelingTools/vmodelingheight.h | 129 ------ src/tools/modelingTools/vmodelingline.cpp | 156 -------- src/tools/modelingTools/vmodelingline.h | 139 ------- .../modelingTools/vmodelinglineintersect.cpp | 180 --------- .../modelingTools/vmodelinglineintersect.h | 143 ------- .../modelingTools/vmodelinglinepoint.cpp | 67 ---- src/tools/modelingTools/vmodelinglinepoint.h | 88 ----- src/tools/modelingTools/vmodelingnormal.cpp | 175 --------- src/tools/modelingTools/vmodelingnormal.h | 132 ------- src/tools/modelingTools/vmodelingpoint.cpp | 121 ------ src/tools/modelingTools/vmodelingpoint.h | 113 ------ .../modelingTools/vmodelingpointofcontact.cpp | 177 --------- .../modelingTools/vmodelingpointofcontact.h | 144 ------- .../vmodelingpointofintersection.cpp | 152 -------- .../vmodelingpointofintersection.h | 131 ------- .../modelingTools/vmodelingshoulderpoint.cpp | 184 --------- .../modelingTools/vmodelingshoulderpoint.h | 137 ------- src/tools/modelingTools/vmodelingspline.cpp | 273 ------------- src/tools/modelingTools/vmodelingspline.h | 172 -------- .../modelingTools/vmodelingsplinepath.cpp | 310 --------------- src/tools/modelingTools/vmodelingsplinepath.h | 183 --------- src/tools/modelingTools/vmodelingtool.cpp | 72 ---- src/tools/modelingTools/vmodelingtool.h | 157 -------- src/tools/modelingTools/vmodelingtriangle.cpp | 170 -------- src/tools/modelingTools/vmodelingtriangle.h | 142 ------- src/tools/nodeDetails/vabstractnode.cpp | 8 +- src/tools/nodeDetails/vabstractnode.h | 20 +- src/tools/nodeDetails/vnodearc.cpp | 22 +- src/tools/nodeDetails/vnodearc.h | 8 +- src/tools/nodeDetails/vnodepoint.cpp | 26 +- src/tools/nodeDetails/vnodepoint.h | 6 +- src/tools/nodeDetails/vnodespline.cpp | 19 +- src/tools/nodeDetails/vnodespline.h | 7 +- src/tools/nodeDetails/vnodesplinepath.cpp | 21 +- src/tools/nodeDetails/vnodesplinepath.h | 6 +- src/tools/tools.pri | 43 +- src/tools/vtooldetail.cpp | 168 +------- src/widgets/vsimplespline.h | 1 + src/widgets/vsimplesplinepath.h | 1 + src/xml/vdomdocument.cpp | 368 +++--------------- src/xml/vdomdocument.h | 8 +- 113 files changed, 382 insertions(+), 7741 deletions(-) delete mode 100644 src/tools/modelingTools/modelingtools.h delete mode 100644 src/tools/modelingTools/vmodelingalongline.cpp delete mode 100644 src/tools/modelingTools/vmodelingalongline.h delete mode 100644 src/tools/modelingTools/vmodelingarc.cpp delete mode 100644 src/tools/modelingTools/vmodelingarc.h delete mode 100644 src/tools/modelingTools/vmodelingbisector.cpp delete mode 100644 src/tools/modelingTools/vmodelingbisector.h delete mode 100644 src/tools/modelingTools/vmodelingcutspline.cpp delete mode 100644 src/tools/modelingTools/vmodelingcutspline.h delete mode 100644 src/tools/modelingTools/vmodelingcutsplinepath.cpp delete mode 100644 src/tools/modelingTools/vmodelingcutsplinepath.h delete mode 100644 src/tools/modelingTools/vmodelingendline.cpp delete mode 100644 src/tools/modelingTools/vmodelingendline.h delete mode 100644 src/tools/modelingTools/vmodelingheight.cpp delete mode 100644 src/tools/modelingTools/vmodelingheight.h delete mode 100644 src/tools/modelingTools/vmodelingline.cpp delete mode 100644 src/tools/modelingTools/vmodelingline.h delete mode 100644 src/tools/modelingTools/vmodelinglineintersect.cpp delete mode 100644 src/tools/modelingTools/vmodelinglineintersect.h delete mode 100644 src/tools/modelingTools/vmodelinglinepoint.cpp delete mode 100644 src/tools/modelingTools/vmodelinglinepoint.h delete mode 100644 src/tools/modelingTools/vmodelingnormal.cpp delete mode 100644 src/tools/modelingTools/vmodelingnormal.h delete mode 100644 src/tools/modelingTools/vmodelingpoint.cpp delete mode 100644 src/tools/modelingTools/vmodelingpoint.h delete mode 100644 src/tools/modelingTools/vmodelingpointofcontact.cpp delete mode 100644 src/tools/modelingTools/vmodelingpointofcontact.h delete mode 100644 src/tools/modelingTools/vmodelingpointofintersection.cpp delete mode 100644 src/tools/modelingTools/vmodelingpointofintersection.h delete mode 100644 src/tools/modelingTools/vmodelingshoulderpoint.cpp delete mode 100644 src/tools/modelingTools/vmodelingshoulderpoint.h delete mode 100644 src/tools/modelingTools/vmodelingspline.cpp delete mode 100644 src/tools/modelingTools/vmodelingspline.h delete mode 100644 src/tools/modelingTools/vmodelingsplinepath.cpp delete mode 100644 src/tools/modelingTools/vmodelingsplinepath.h delete mode 100644 src/tools/modelingTools/vmodelingtool.cpp delete mode 100644 src/tools/modelingTools/vmodelingtool.h delete mode 100644 src/tools/modelingTools/vmodelingtriangle.cpp delete mode 100644 src/tools/modelingTools/vmodelingtriangle.h diff --git a/src/container/vcontainer.cpp b/src/container/vcontainer.cpp index 5a5a59eed..a30dfe86a 100644 --- a/src/container/vcontainer.cpp +++ b/src/container/vcontainer.cpp @@ -35,14 +35,10 @@ qint64 VContainer::_id = 0; VContainer::VContainer() :base(QHash()), points(QHash()), - pointsModeling(QHash()), - standartTable(QHash()), incrementTable(QHash()), + standartTable(QHash()), incrementTable(QHash()), lengthLines(QHash()), lineAngles(QHash()), splines(QHash()), - splinesModeling(QHash()), - lengthSplines(QHash()), arcs(QHash()), arcsModeling(QHash()), - lengthArcs(QHash()), - splinePaths(QHash()), splinePathsModeling(QHash()), - details(QHash()) + lengthSplines(QHash()), arcs(QHash()), lengthArcs(QHash()), + splinePaths(QHash()), details(QHash()) { SetSize(500); SetGrowth(1760); @@ -57,14 +53,10 @@ VContainer &VContainer::operator =(const VContainer &data) VContainer::VContainer(const VContainer &data) :base(QHash()), points(QHash()), - pointsModeling(QHash()), standartTable(QHash()), incrementTable(QHash()), lengthLines(QHash()), lineAngles(QHash()), splines(QHash()), - splinesModeling(QHash()), - lengthSplines(QHash()), arcs(QHash()), arcsModeling(QHash()), - lengthArcs(QHash()), - splinePaths(QHash()), splinePathsModeling(QHash()), - details(QHash()) + lengthSplines(QHash()), arcs(QHash()), lengthArcs(QHash()), + splinePaths(QHash()), details(QHash()) { setData(data); } @@ -73,19 +65,15 @@ void VContainer::setData(const VContainer &data) { base = *data.DataBase(); points = *data.DataPoints(); - pointsModeling = *data.DataPointsModeling(); standartTable = *data.DataStandartTable(); incrementTable = *data.DataIncrementTable(); lengthLines = *data.DataLengthLines(); lineAngles = *data.DataLineAngles(); splines = *data.DataSplines(); - splinesModeling = *data.DataSplinesModeling(); lengthSplines = *data.DataLengthSplines(); arcs = *data.DataArcs(); - arcsModeling = *data.DataArcsModeling(); lengthArcs = *data.DataLengthArcs(); splinePaths = *data.DataSplinePaths(); - splinePathsModeling = *data.DataSplinePathsModeling(); details = *data.DataDetails(); } @@ -94,11 +82,6 @@ VPointF VContainer::GetPoint(qint64 id) const return GetObject(points, id); } -VPointF VContainer::GetPointModeling(qint64 id) const -{ - return GetObject(pointsModeling, id); -} - template val VContainer::GetObject(const QHash &obj, key id) { @@ -153,31 +136,16 @@ VSpline VContainer::GetSpline(qint64 id) const return GetObject(splines, id); } -VSpline VContainer::GetSplineModeling(qint64 id) const -{ - return GetObject(splinesModeling, id); -} - VArc VContainer::GetArc(qint64 id) const { return GetObject(arcs, id); } -VArc VContainer::GetArcModeling(qint64 id) const -{ - return GetObject(arcsModeling, id); -} - VSplinePath VContainer::GetSplinePath(qint64 id) const { return GetObject(splinePaths, id); } -VSplinePath VContainer::GetSplinePathModeling(qint64 id) const -{ - return GetObject(splinePathsModeling, id); -} - VDetail VContainer::GetDetail(qint64 id) const { return GetObject(details, id); @@ -188,11 +156,6 @@ qint64 VContainer::AddPoint(const VPointF &point) return AddObject(points, point); } -qint64 VContainer::AddPointModeling(const VPointF &point) -{ - return AddObject(pointsModeling, point); -} - qint64 VContainer::AddDetail(const VDetail &detail) { return AddObject(details, detail); @@ -223,7 +186,7 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const { case (Tool::NodePoint): { - VPointF point = GetPointModeling(detail[i].getId()); + VPointF point = GetPoint(detail[i].getId()); points.append(point.toQPointF()); if (detail.getSupplement() == true) { @@ -236,7 +199,7 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const break; case (Tool::NodeArc): { - VArc arc = GetArcModeling(detail[i].getId()); + VArc arc = GetArc(detail[i].getId()); qreal len1 = GetLengthContour(points, arc.GetPoints()); qreal lenReverse = GetLengthContour(points, GetReversePoint(arc.GetPoints())); if (len1 <= lenReverse) @@ -259,7 +222,7 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const break; case (Tool::NodeSpline): { - VSpline spline = GetSplineModeling(detail[i].getId()); + VSpline spline = GetSpline(detail[i].getId()); qreal len1 = GetLengthContour(points, spline.GetPoints()); qreal lenReverse = GetLengthContour(points, GetReversePoint(spline.GetPoints())); if (len1 <= lenReverse) @@ -283,7 +246,7 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const break; case (Tool::NodeSplinePath): { - VSplinePath splinePath = GetSplinePathModeling(detail[i].getId()); + VSplinePath splinePath = GetSplinePath(detail[i].getId()); qreal len1 = GetLengthContour(points, splinePath.GetPathPoints()); qreal lenReverse = GetLengthContour(points, GetReversePoint(splinePath.GetPathPoints())); if (len1 <= lenReverse) @@ -553,21 +516,6 @@ void VContainer::PrepareDetails(QVector &list) const } } -qint64 VContainer::PointConvertToModeling(qint64 id) -{ - QHashIterator pModeling(pointsModeling); - while (pModeling.hasNext()) - { - pModeling.next(); - VPointF p = pModeling.value(); - if(p.getIdObject() == id) - { - return pModeling.key(); - } - } - return 0; -} - template void VContainer::UpdateObject(QHash &obj, const qint64 &id, const val& point) { @@ -626,10 +574,6 @@ void VContainer::Clear() lengthArcs.clear(); lineAngles.clear(); details.clear(); - arcsModeling.clear(); - pointsModeling.clear(); - splinePathsModeling.clear(); - splinesModeling.clear(); ClearObject(); CreateManTableIGroup (); } @@ -684,23 +628,13 @@ qreal VContainer::FindVar(const QString &name, bool *ok)const return 0; } -void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId, const Draw::Draws &mode) +void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId) { - QString nameLine = GetNameLine(firstPointId, secondPointId, mode); - VPointF first; - VPointF second; - if (mode == Draw::Calculation) - { - first = GetPoint(firstPointId); - second = GetPoint(secondPointId); - } - else - { - first = GetPointModeling(firstPointId); - second = GetPointModeling(secondPointId); - } + QString nameLine = GetNameLine(firstPointId, secondPointId); + VPointF first = GetPoint(firstPointId); + VPointF second = GetPoint(secondPointId); AddLengthLine(nameLine, toMM(QLineF(first.toQPointF(), second.toQPointF()).length())); - nameLine = GetNameLineAngle(firstPointId, secondPointId, mode); + nameLine = GetNameLineAngle(firstPointId, secondPointId); AddLineAngle(nameLine, QLineF(first.toQPointF(), second.toQPointF()).angle()); } @@ -709,31 +643,16 @@ qint64 VContainer::AddSpline(const VSpline &spl) return AddObject(splines, spl); } -qint64 VContainer::AddSplineModeling(const VSpline &spl) -{ - return AddObject(splinesModeling, spl); -} - qint64 VContainer::AddSplinePath(const VSplinePath &splPath) { return AddObject(splinePaths, splPath); } -qint64 VContainer::AddSplinePathModeling(const VSplinePath &splPath) -{ - return AddObject(splinePathsModeling, splPath); -} - qint64 VContainer::AddArc(const VArc &arc) { return AddObject(arcs, arc); } -qint64 VContainer::AddArcModeling(const VArc &arc) -{ - return AddObject(arcsModeling, arc); -} - template qint64 VContainer::AddObject(QHash &obj, const val& value) { @@ -742,37 +661,19 @@ qint64 VContainer::AddObject(QHash &obj, const val& value) return id; } -QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint, const Draw::Draws &mode) const +QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint) const { - VPointF first; - VPointF second; - if (mode == Draw::Calculation) - { - first = GetPoint(firstPoint); - second = GetPoint(secondPoint); - } - else - { - first = GetPointModeling(firstPoint); - second = GetPointModeling(secondPoint); - } + VPointF first = GetPoint(firstPoint); + VPointF second = GetPoint(secondPoint); + return QString("Line_%1_%2").arg(first.name(), second.name()); } -QString VContainer::GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint, const Draw::Draws &mode) const +QString VContainer::GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint) const { - VPointF first; - VPointF second; - if (mode == Draw::Calculation) - { - first = GetPoint(firstPoint); - second = GetPoint(secondPoint); - } - else - { - first = GetPointModeling(firstPoint); - second = GetPointModeling(secondPoint); - } + VPointF first = GetPoint(firstPoint); + VPointF second = GetPoint(secondPoint); + return QString("AngleLine_%1_%2").arg(first.name(), second.name()); } @@ -781,11 +682,6 @@ void VContainer::UpdatePoint(qint64 id, const VPointF &point) UpdateObject(points, id, point); } -void VContainer::UpdatePointModeling(qint64 id, const VPointF &point) -{ - UpdateObject(pointsModeling, id, point); -} - void VContainer::UpdateDetail(qint64 id, const VDetail &detail) { UpdateObject(details, id, detail); @@ -796,31 +692,16 @@ void VContainer::UpdateSpline(qint64 id, const VSpline &spl) UpdateObject(splines, id, spl); } -void VContainer::UpdateSplineModeling(qint64 id, const VSpline &spl) -{ - UpdateObject(splinesModeling, id, spl); -} - void VContainer::UpdateSplinePath(qint64 id, const VSplinePath &splPath) { UpdateObject(splinePaths, id, splPath); } -void VContainer::UpdateSplinePathModeling(qint64 id, const VSplinePath &splPath) -{ - UpdateObject(splinePathsModeling, id, splPath); -} - void VContainer::UpdateArc(qint64 id, const VArc &arc) { UpdateObject(arcs, id, arc); } -void VContainer::UpdateArcModeling(qint64 id, const VArc &arc) -{ - UpdateObject(arcsModeling, id, arc); -} - void VContainer::AddLengthLine(const QString &name, const qreal &value) { Q_ASSERT(name.isEmpty() == false); diff --git a/src/container/vcontainer.h b/src/container/vcontainer.h index e6bf775ac..8465a19ae 100644 --- a/src/container/vcontainer.h +++ b/src/container/vcontainer.h @@ -69,12 +69,6 @@ public: * @return point */ VPointF GetPoint(qint64 id) const; - /** - * @brief GetPointModeling return a point modeling by id - * @param id id of point modeling - * @return point modeling - */ - VPointF GetPointModeling(qint64 id) const; /** * @brief GetStandartTableCell return standart table row by name * @param name name of standart table row @@ -117,36 +111,18 @@ public: * @return spline */ VSpline GetSpline(qint64 id) const; - /** - * @brief GetSplineModeling return spline modeling by id - * @param id id of spline modeling - * @return spline modeling - */ - VSpline GetSplineModeling(qint64 id) const; /** * @brief GetArc return arc by id * @param id id of arc * @return arc */ VArc GetArc(qint64 id) const; - /** - * @brief GetArcModeling return arc modeling by id - * @param id id of arc modeling - * @return arc modeling - */ - VArc GetArcModeling(qint64 id) const; /** * @brief GetSplinePath return spline path by id * @param id id of spline path * @return spline path */ VSplinePath GetSplinePath(qint64 id) const; - /** - * @brief GetSplinePathModeling return spline path modeling by id - * @param id id of spline modeling path - * @return spline modeling path - */ - VSplinePath GetSplinePathModeling(qint64 id) const; /** * @brief GetDetail return detail by id * @param id id of detail @@ -164,12 +140,6 @@ public: * @return return id of new point in container */ qint64 AddPoint(const VPointF& point); - /** - * @brief AddPointModeling add new point modeling to container - * @param point new point modeling - * @return return id of new point modeling in container - */ - qint64 AddPointModeling(const VPointF& point); /** * @brief AddDetail add new detail to container * @param detail new detail @@ -225,32 +195,19 @@ public: * @param secondPointId id of second point of line * @param mode mode of line */ - void AddLine(const qint64 &firstPointId, const qint64 &secondPointId, - const Draw::Draws &mode = Draw::Calculation); + void AddLine(const qint64 &firstPointId, const qint64 &secondPointId); /** * @brief AddSpline add spline to container * @param spl new spline * @return id of spline in container */ qint64 AddSpline(const VSpline& spl); - /** - * @brief AddSplineModeling add spline modeling to container - * @param spl new spline modeling - * @return id of spline modeling in container - */ - qint64 AddSplineModeling(const VSpline& spl); /** * @brief AddSplinePath add spline path to container * @param splPath new spline path * @return id of spline path in container */ qint64 AddSplinePath(const VSplinePath& splPath); - /** - * @brief AddSplinePathModeling add spline path modeling to container - * @param splPath new spline path - * @return id of spline path in container - */ - qint64 AddSplinePathModeling(const VSplinePath& splPath); /** * @brief AddArc add arc to container * @param arc new arc @@ -267,32 +224,22 @@ public: * @brief GetNameLine return name of line * @param firstPoint id of first point of line * @param secondPoint id of second point of line - * @param mode mode of line * @return name of line */ - QString GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint, - const Draw::Draws &mode = Draw::Calculation) const; + QString GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint) const; /** * @brief GetNameLineAngle return name of line angle * @param firstPoint id of first point of line * @param secondPoint id of second point of line - * @param mode mode of line * @return name of angle of line */ - QString GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint, - const Draw::Draws &mode = Draw::Calculation) const; + QString GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint) const; /** * @brief UpdatePoint update point by id * @param id id of existing point * @param point point */ void UpdatePoint(qint64 id, const VPointF& point); - /** - * @brief UpdatePointModeling update point modeling by id - * @param id id of existing point modeling - * @param point point modeling - */ - void UpdatePointModeling(qint64 id, const VPointF& point); /** * @brief UpdateDetail update detail by id * @param id id of existing detail @@ -305,24 +252,12 @@ public: * @param spl spline */ void UpdateSpline(qint64 id, const VSpline& spl); - /** - * @brief UpdateSplineModeling update spline modeling by id - * @param id id of existing spline modeling - * @param spl spline modeling - */ - void UpdateSplineModeling(qint64 id, const VSpline& spl); /** * @brief UpdateSplinePath update spline path by id * @param id id of existing spline path * @param splPath spline path */ void UpdateSplinePath(qint64 id, const VSplinePath& splPath); - /** - * @brief UpdateSplinePathModeling update spline path modeling by id - * @param id id of existing spline path modeling - * @param splPath spline path modeling - */ - void UpdateSplinePathModeling(qint64 id, const VSplinePath& splPath); /** * @brief UpdateArc update arc by id * @param id id of existing arc @@ -437,31 +372,16 @@ public: * @return pointer on container of points */ inline const QHash *DataPoints() const {return &points;} - /** - * @brief data container with dataPointsModeling return container of points modeling - * @return pointer on container of points modeling - */ - inline const QHash *DataPointsModeling() const {return &pointsModeling;} /** * @brief data container with dataSplines return container of splines * @return pointer on container of splines */ inline const QHash *DataSplines() const {return &splines;} - /** - * @brief data container with dataSplinesModeling return container of splines modeling - * @return pointer on container of splines modeling - */ - inline const QHash *DataSplinesModeling() const {return &splinesModeling;} /** * @brief data container with dataArcs return container of arcs * @return pointer on container of arcs */ inline const QHash *DataArcs() const {return &arcs;} - /** - * @brief data container with dataArcsModeling return container of arcs modeling - * @return pointer on container of arcs modeling - */ - inline const QHash *DataArcsModeling() const {return &arcsModeling;} /** * @brief data container with dataBase return container of data * @return pointer on container of base data @@ -502,11 +422,6 @@ public: * @return pointer on container of spline paths */ inline const QHash *DataSplinePaths() const {return &splinePaths;} - /** - * @brief data container with dataSplinePathsModeling return container of spline paths modeling - * @return pointer on container of spline paths modeling - */ - inline const QHash *DataSplinePathsModeling() const {return &splinePathsModeling;} /** * @brief data container with dataDetails return container of details * @return pointer on container of details @@ -573,7 +488,6 @@ public: * @param list list of details */ void PrepareDetails(QVector & list) const; - qint64 PointConvertToModeling(qint64 id); private: /** * @brief _id current id. New object will have value +1. For full class equal 0. @@ -587,10 +501,6 @@ private: * @brief points container of points */ QHash points; - /** - * @brief pointsModeling container of points modeling - */ - QHash pointsModeling; /** * @brief standartTable container of standart table rows */ @@ -611,10 +521,6 @@ private: * @brief splines container of splines */ QHash splines; - /** - * @brief splinesModeling container of splines modeling - */ - QHash splinesModeling; /** * @brief lengthSplines container of splines length */ @@ -623,10 +529,6 @@ private: * @brief arcs container of arcs */ QHash arcs; - /** - * @brief arcsModeling container of arcs modeling - */ - QHash arcsModeling; /** * @brief lengthArcs container of arcs length */ @@ -635,10 +537,6 @@ private: * @brief splinePaths container of spline paths */ QHash splinePaths; - /** - * @brief splinePathsModeling container of spline paths modeling - */ - QHash splinePathsModeling; /** * @brief details container of details */ diff --git a/src/container/vpointf.cpp b/src/container/vpointf.cpp index 9bae8f96f..7b2c6187a 100644 --- a/src/container/vpointf.cpp +++ b/src/container/vpointf.cpp @@ -35,7 +35,6 @@ VPointF &VPointF::operator =(const VPointF &point) _my = point.my(); _x = point.x(); _y = point.y(); - mode = point.getMode(); idObject = point.getIdObject(); return *this; } diff --git a/src/container/vpointf.h b/src/container/vpointf.h index 17260a385..39869fb68 100644 --- a/src/container/vpointf.h +++ b/src/container/vpointf.h @@ -43,14 +43,14 @@ public: * @brief VPointF creat empty point */ inline VPointF () - :_name(QString()), _mx(0), _my(0), _x(0), _y(0), mode(Draw::Calculation), idObject(0){} + :_name(QString()), _mx(0), _my(0), _x(0), _y(0), idObject(0){} /** * @brief VPointF copy constructor * @param point */ 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()){} + idObject(point.getIdObject()){} /** * @brief VPointF create new point * @param x x coordinate @@ -58,12 +58,10 @@ public: * @param name name of point * @param mx offset name respect to x * @param my offset name respect to y - * @param mode mode of draw * @param idObject point modeling keep here id of parent point */ - 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){} + inline VPointF ( qreal x, qreal y, QString name, qreal mx, qreal my, qint64 idObject = 0) + :_name(name), _mx(mx), _my(my), _x(x), _y(y), idObject(idObject){} /** * @brief operator = assignment operator * @param point point @@ -126,16 +124,6 @@ public: * @param value y coordinate */ inline void setY(const qreal &value){_y = value;} - /** - * @brief getMode return mode of point - * @return mode - */ - inline Draw::Draws getMode() const{return mode;} - /** - * @brief setMode set mode for point - * @param value mode - */ - inline void setMode(const Draw::Draws &value) {mode = value;} /** * @brief getIdObject return id of parrent. * @return id @@ -167,10 +155,6 @@ private: * @brief _y y coordinate */ qreal _y; - /** - * @brief mode mode of point - */ - Draw::Draws mode; /** * @brief idObject id of parent. Only for point modeling. All another return 0. */ diff --git a/src/dialogs/dialogalongline.cpp b/src/dialogs/dialogalongline.cpp index 46551b3e5..89bb3b174 100644 --- a/src/dialogs/dialogalongline.cpp +++ b/src/dialogs/dialogalongline.cpp @@ -31,8 +31,8 @@ #include -DialogAlongLine::DialogAlongLine(const VContainer *data, Draw::Draws mode, QWidget *parent) - :DialogTool(data, mode, parent), ui(new Ui::DialogAlongLine), number(0), pointName(QString()), +DialogAlongLine::DialogAlongLine(const VContainer *data, QWidget *parent) + :DialogTool(data, parent), ui(new Ui::DialogAlongLine), number(0), pointName(QString()), typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0) { ui->setupUi(this); @@ -57,11 +57,8 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, Draw::Draws mode, QWidg connect(bCansel, &QPushButton::clicked, this, &DialogAlongLine::DialogRejected); FillComboBoxTypeLine(ui->comboBoxLineType); ui->comboBoxLineType->setCurrentIndex(1); - if(mode == Draw::Calculation) - { - FillComboBoxPoints(ui->comboBoxFirstPoint); - FillComboBoxPoints(ui->comboBoxSecondPoint); - } + FillComboBoxPoints(ui->comboBoxFirstPoint); + FillComboBoxPoints(ui->comboBoxSecondPoint); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogAlongLine::PutHere); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogAlongLine::PutVal); @@ -86,34 +83,9 @@ DialogAlongLine::~DialogAlongLine() void DialogAlongLine::ChoosedObject(qint64 id, const Scene::Scenes &type) { - if (idDetail == 0 && mode == Draw::Modeling) - { - if (type == Scene::Detail) - { - idDetail = id; - FillComboBoxPoints(ui->comboBoxFirstPoint); - FillComboBoxPoints(ui->comboBoxSecondPoint); - return; - } - } - if (mode == Draw::Modeling) - { - if (CheckObject(id) == false) - { - return; - } - } if (type == Scene::Point) { - VPointF point; - if (mode == Draw::Calculation) - { - point = data->GetPoint(id); - } - else - { - point = data->GetPointModeling(id); - } + VPointF point = data->GetPoint(id); if (number == 0) { qint32 index = ui->comboBoxFirstPoint->findText(point.name()); diff --git a/src/dialogs/dialogalongline.h b/src/dialogs/dialogalongline.h index 67aa5f0a2..33acbc715 100644 --- a/src/dialogs/dialogalongline.h +++ b/src/dialogs/dialogalongline.h @@ -46,11 +46,9 @@ public: /** * @brief DialogAlongLine create dialog * @param data container with data - * @param mode mode of creation tool * @param parent parent widget */ - DialogAlongLine(const VContainer *data, Draw::Draws mode = Draw::Calculation, - QWidget *parent = 0); + DialogAlongLine(const VContainer *data, QWidget *parent = 0); ~DialogAlongLine(); /** * @brief getPointName return name of point diff --git a/src/dialogs/dialogarc.cpp b/src/dialogs/dialogarc.cpp index 9425f17f9..6f8bf2edc 100644 --- a/src/dialogs/dialogarc.cpp +++ b/src/dialogs/dialogarc.cpp @@ -32,8 +32,8 @@ #include #include -DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent) - :DialogTool(data, mode, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false), +DialogArc::DialogArc(const VContainer *data, QWidget *parent) + :DialogTool(data, 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); @@ -52,10 +52,8 @@ DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent) QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); connect(bCansel, &QPushButton::clicked, this, &DialogArc::DialogRejected); - if(mode == Draw::Calculation) - { - FillComboBoxPoints(ui->comboBoxBasePoint); - } + + FillComboBoxPoints(ui->comboBoxBasePoint); CheckState(); @@ -122,33 +120,10 @@ void DialogArc::SetRadius(const QString &value) void DialogArc::ChoosedObject(qint64 id, const Scene::Scenes &type) { - if (idDetail == 0 && mode == Draw::Modeling) - { - if (type == Scene::Detail) - { - idDetail = id; - FillComboBoxPoints(ui->comboBoxBasePoint); - return; - } - } - if (mode == Draw::Modeling) - { - if (CheckObject(id)==false) - { - return; - } - } if (type == Scene::Point) { - VPointF point; - if (mode == Draw::Calculation) - { - point = data->GetPoint(id); - } - else - { - point = data->GetPointModeling(id); - } + VPointF point = data->GetPoint(id); + ChangeCurrentText(ui->comboBoxBasePoint, point.name()); emit ToolTip(""); this->show(); diff --git a/src/dialogs/dialogarc.h b/src/dialogs/dialogarc.h index 27bf820bb..d472ad928 100644 --- a/src/dialogs/dialogarc.h +++ b/src/dialogs/dialogarc.h @@ -46,10 +46,9 @@ public: /** * @brief DialogArc create dialog * @param data container with data - * @param mode mode of creation tool * @param parent parent widget */ - DialogArc(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); + DialogArc(const VContainer *data, QWidget *parent = 0); ~DialogArc(); /** * @brief GetCenter return id of center point diff --git a/src/dialogs/dialogbisector.cpp b/src/dialogs/dialogbisector.cpp index 8bc425a1f..f6c9c6058 100644 --- a/src/dialogs/dialogbisector.cpp +++ b/src/dialogs/dialogbisector.cpp @@ -31,8 +31,8 @@ #include -DialogBisector::DialogBisector(const VContainer *data, Draw::Draws mode, QWidget *parent) - :DialogTool(data, mode, parent), ui(new Ui::DialogBisector), number(0), pointName(QString()), +DialogBisector::DialogBisector(const VContainer *data, QWidget *parent) + :DialogTool(data, parent), ui(new Ui::DialogBisector), number(0), pointName(QString()), typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0), thirdPointId(0) { ui->setupUi(this); @@ -55,12 +55,10 @@ DialogBisector::DialogBisector(const VContainer *data, Draw::Draws mode, QWidget CheckState(); QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); connect(bCansel, &QPushButton::clicked, this, &DialogBisector::DialogRejected); - if(mode == Draw::Calculation) - { - FillComboBoxPoints(ui->comboBoxFirstPoint); - FillComboBoxPoints(ui->comboBoxSecondPoint); - FillComboBoxPoints(ui->comboBoxThirdPoint); - } + + FillComboBoxPoints(ui->comboBoxFirstPoint); + FillComboBoxPoints(ui->comboBoxSecondPoint); + FillComboBoxPoints(ui->comboBoxThirdPoint); FillComboBoxTypeLine(ui->comboBoxLineType); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogBisector::PutHere); @@ -86,35 +84,9 @@ DialogBisector::~DialogBisector() void DialogBisector::ChoosedObject(qint64 id, const Scene::Scenes &type) { - if (idDetail == 0 && mode == Draw::Modeling) - { - if (type == Scene::Detail) - { - idDetail = id; - FillComboBoxPoints(ui->comboBoxFirstPoint); - FillComboBoxPoints(ui->comboBoxSecondPoint); - FillComboBoxPoints(ui->comboBoxThirdPoint); - return; - } - } - if (mode == Draw::Modeling) - { - if (CheckObject(id) == false) - { - return; - } - } if (type == Scene::Point) { - VPointF point; - if (mode == Draw::Calculation) - { - point = data->GetPoint(id); - } - else - { - point = data->GetPointModeling(id); - } + VPointF point = data->GetPoint(id); if (number == 0) { qint32 index = ui->comboBoxFirstPoint->findText(point.name()); diff --git a/src/dialogs/dialogbisector.h b/src/dialogs/dialogbisector.h index dbdb03280..ec4168754 100644 --- a/src/dialogs/dialogbisector.h +++ b/src/dialogs/dialogbisector.h @@ -46,11 +46,9 @@ public: /** * @brief DialogBisector create dialog * @param data container with data - * @param mode mode of creation tool * @param parent parent widget */ - DialogBisector(const VContainer *data, Draw::Draws mode = Draw::Calculation, - QWidget *parent = 0); + DialogBisector(const VContainer *data, QWidget *parent = 0); ~DialogBisector(); /** * @brief getPointName return name of point diff --git a/src/dialogs/dialogcutspline.cpp b/src/dialogs/dialogcutspline.cpp index c077b28e2..be3f83513 100644 --- a/src/dialogs/dialogcutspline.cpp +++ b/src/dialogs/dialogcutspline.cpp @@ -29,9 +29,8 @@ #include "dialogcutspline.h" #include "ui_dialogcutspline.h" -DialogCutSpline::DialogCutSpline(const VContainer *data, Draw::Draws mode, QWidget *parent) - :DialogTool(data, mode, parent), ui(new Ui::DialogCutSpline), pointName(QString()), formula(QString()), - splineId(0) +DialogCutSpline::DialogCutSpline(const VContainer *data, QWidget *parent) + :DialogTool(data, parent), ui(new Ui::DialogCutSpline), pointName(QString()), formula(QString()), splineId(0) { ui->setupUi(this); listWidget = ui->listWidget; @@ -53,10 +52,8 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, Draw::Draws mode, QWidg CheckState(); QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); connect(bCansel, &QPushButton::clicked, this, &DialogCutSpline::DialogRejected); - if(mode == Draw::Calculation) - { - FillComboBoxSplines(ui->comboBoxSpline); - } + + FillComboBoxSplines(ui->comboBoxSpline); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSpline::PutHere); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSpline::PutVal); @@ -98,33 +95,9 @@ void DialogCutSpline::setSplineId(const qint64 &value, const qint64 &id) void DialogCutSpline::ChoosedObject(qint64 id, const Scene::Scenes &type) { - if (idDetail == 0 && mode == Draw::Modeling) - { - if (type == Scene::Detail) - { - idDetail = id; - FillComboBoxSplines(ui->comboBoxSpline); - return; - } - } - if (mode == Draw::Modeling) - { - if (CheckObject(id) == false) - { - return; - } - } if (type == Scene::Spline) { - VSpline spl; - if (mode == Draw::Calculation) - { - spl = data->GetSpline(id); - } - else - { - spl = data->GetSplineModeling(id); - } + VSpline spl = data->GetSpline(id); ChangeCurrentText(ui->comboBoxSpline, spl.name()); emit ToolTip(""); this->show(); diff --git a/src/dialogs/dialogcutspline.h b/src/dialogs/dialogcutspline.h index aaea2bdcd..85209cb24 100644 --- a/src/dialogs/dialogcutspline.h +++ b/src/dialogs/dialogcutspline.h @@ -39,7 +39,7 @@ class DialogCutSpline : public DialogTool { Q_OBJECT public: - DialogCutSpline(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); + DialogCutSpline(const VContainer *data, QWidget *parent = 0); ~DialogCutSpline(); /** * @brief getPointName return name of point diff --git a/src/dialogs/dialogcutsplinepath.cpp b/src/dialogs/dialogcutsplinepath.cpp index 2febc4d22..dff368e47 100644 --- a/src/dialogs/dialogcutsplinepath.cpp +++ b/src/dialogs/dialogcutsplinepath.cpp @@ -29,8 +29,8 @@ #include "dialogcutsplinepath.h" #include "ui_dialogcutsplinepath.h" -DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, Draw::Draws mode, QWidget *parent) - :DialogTool(data, mode, parent), ui(new Ui::DialogCutSplinePath), pointName(QString()), formula(QString()), +DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, QWidget *parent) + :DialogTool(data, parent), ui(new Ui::DialogCutSplinePath), pointName(QString()), formula(QString()), splinePathId(0) { ui->setupUi(this); @@ -53,10 +53,8 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, Draw::Draws mod CheckState(); QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); connect(bCansel, &QPushButton::clicked, this, &DialogCutSplinePath::DialogRejected); - if(mode == Draw::Calculation) - { - FillComboBoxSplinesPath(ui->comboBoxSplinePath); - } + + FillComboBoxSplinesPath(ui->comboBoxSplinePath); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSplinePath::PutHere); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSplinePath::PutVal); @@ -98,33 +96,9 @@ void DialogCutSplinePath::setSplinePathId(const qint64 &value, const qint64 &id) void DialogCutSplinePath::ChoosedObject(qint64 id, const Scene::Scenes &type) { - if (idDetail == 0 && mode == Draw::Modeling) - { - if (type == Scene::Detail) - { - idDetail = id; - FillComboBoxSplines(ui->comboBoxSplinePath); - return; - } - } - if (mode == Draw::Modeling) - { - if (CheckObject(id) == false) - { - return; - } - } if (type == Scene::SplinePath) { - VSplinePath splPath; - if (mode == Draw::Calculation) - { - splPath = data->GetSplinePath(id); - } - else - { - splPath = data->GetSplinePathModeling(id); - } + VSplinePath splPath = data->GetSplinePath(id); ChangeCurrentText(ui->comboBoxSplinePath, splPath.name()); emit ToolTip(""); this->show(); diff --git a/src/dialogs/dialogcutsplinepath.h b/src/dialogs/dialogcutsplinepath.h index 96a434932..5069688f6 100644 --- a/src/dialogs/dialogcutsplinepath.h +++ b/src/dialogs/dialogcutsplinepath.h @@ -39,7 +39,7 @@ class DialogCutSplinePath : public DialogTool { Q_OBJECT public: - DialogCutSplinePath(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); + DialogCutSplinePath(const VContainer *data, QWidget *parent = 0); ~DialogCutSplinePath(); /** * @brief getPointName return name of point diff --git a/src/dialogs/dialogdetail.cpp b/src/dialogs/dialogdetail.cpp index 711f9a9be..29a1bdcd1 100644 --- a/src/dialogs/dialogdetail.cpp +++ b/src/dialogs/dialogdetail.cpp @@ -31,8 +31,8 @@ #include #include -DialogDetail::DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent) - :DialogTool(data, mode, parent), ui(), details(VDetail()), supplement(true), closed(true) +DialogDetail::DialogDetail(const VContainer *data, QWidget *parent) + :DialogTool(data, parent), ui(), details(VDetail()), supplement(true), closed(true) { ui.setupUi(this); labelEditNamePoint = ui.labelEditNameDetail; @@ -55,37 +55,21 @@ DialogDetail::DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *pa void DialogDetail::ChoosedObject(qint64 id, const Scene::Scenes &type) { - if (idDetail == 0 && mode == Draw::Modeling) - { - if (type == Scene::Detail) - { - idDetail = id; - return; - } - } - if (mode == Draw::Modeling) - { - if (CheckObject(id) == false) - { - qDebug()<<"false"; - return; - } - } if (type != Scene::Line && type != Scene::Detail) { switch (type) { case (Scene::Arc): - NewItem(id, Tool::NodeArc, mode, NodeDetail::Contour); + NewItem(id, Tool::NodeArc, NodeDetail::Contour); break; case (Scene::Point): - NewItem(id, Tool::NodePoint, mode, NodeDetail::Contour); + NewItem(id, Tool::NodePoint, NodeDetail::Contour); break; case (Scene::Spline): - NewItem(id, Tool::NodeSpline, mode, NodeDetail::Contour); + NewItem(id, Tool::NodeSpline, NodeDetail::Contour); break; case (Scene::SplinePath): - NewItem(id, Tool::NodeSplinePath, mode, NodeDetail::Contour); + NewItem(id, Tool::NodeSplinePath, NodeDetail::Contour); break; default: qWarning()<GetPoint(id); - } - else - { - point = data->GetPointModeling(id); - } + VPointF point = data->GetPoint(id); name = point.name(); break; } case (Tool::NodeArc): { - VArc arc; - if (mode == Draw::Calculation) - { - arc = data->GetArc(id); - } - else - { - arc = data->GetArcModeling(id); - } + VArc arc = data->GetArc(id); name = arc.name(); break; } case (Tool::NodeSpline): { - VSpline spl; - if (mode == Draw::Calculation) - { - spl = data->GetSpline(id); - } - else - { - spl = data->GetSplineModeling(id); - } + VSpline spl = data->GetSpline(id); name = spl.GetName(); break; } case (Tool::NodeSplinePath): { - VSplinePath splPath; - if (mode == Draw::Calculation) - { - splPath = data->GetSplinePath(id); - } - else - { - splPath = data->GetSplinePathModeling(id); - } + VSplinePath splPath = data->GetSplinePath(id); name = splPath.name(); break; } @@ -180,7 +132,7 @@ void DialogDetail::NewItem(qint64 id, const Tool::Tools &typeTool, const Draw::D QListWidgetItem *item = new QListWidgetItem(name); item->setFont(QFont("Times", 12, QFont::Bold)); - VNodeDetail node(id, typeTool, mode, typeNode, mx, my); + VNodeDetail node(id, typeTool, typeNode, mx, my); item->setData(Qt::UserRole, QVariant::fromValue(node)); ui.listWidget->addItem(item); disconnect(ui.doubleSpinBoxBiasX, static_cast(&QDoubleSpinBox::valueChanged), @@ -201,8 +153,8 @@ void DialogDetail::setDetails(const VDetail &value) ui.listWidget->clear(); for (ptrdiff_t i = 0; i < details.CountNode(); ++i) { - NewItem(details[i].getId(), details[i].getTypeTool(), details[i].getMode(), details[i].getTypeNode(), - details[i].getMx(), details[i].getMy()); + NewItem(details[i].getId(), details[i].getTypeTool(), details[i].getTypeNode(), details[i].getMx(), + details[i].getMy()); } ui.lineEditNameDetail->setText(details.getName()); ui.checkBoxSeams->setChecked(details.getSupplement()); diff --git a/src/dialogs/dialogdetail.h b/src/dialogs/dialogdetail.h index 3253422cd..476b7cc90 100644 --- a/src/dialogs/dialogdetail.h +++ b/src/dialogs/dialogdetail.h @@ -42,10 +42,9 @@ public: /** * @brief DialogDetail create dialog * @param data container with data - * @param mode mode of creation tool * @param parent parent widget */ - DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent = 0); + DialogDetail(const VContainer *data, QWidget *parent = 0); /** * @brief getDetails return detail * @return detail @@ -118,8 +117,8 @@ private: * @param mx offset respect to x * @param my offset respect to y */ - void NewItem(qint64 id, const Tool::Tools &typeTool, const Draw::Draws &mode, - const NodeDetail::NodeDetails &typeNode, qreal mx = 0, qreal my = 0); + void NewItem(qint64 id, const Tool::Tools &typeTool, const NodeDetail::NodeDetails &typeNode, + qreal mx = 0, qreal my = 0); }; #endif // DIALOGDETAIL_H diff --git a/src/dialogs/dialogendline.cpp b/src/dialogs/dialogendline.cpp index a3de025b3..8bb4f6592 100644 --- a/src/dialogs/dialogendline.cpp +++ b/src/dialogs/dialogendline.cpp @@ -31,8 +31,8 @@ #include -DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget *parent) - :DialogTool(data, mode, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()), +DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent) + :DialogTool(data, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()), formula(QString()), angle(0), basePointId(0) { ui->setupUi(this); @@ -56,10 +56,9 @@ DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget * CheckState(); QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); connect(bCansel, &QPushButton::clicked, this, &DialogEndLine::DialogRejected); - if(mode == Draw::Calculation) - { - FillComboBoxPoints(ui->comboBoxBasePoint); - } + + FillComboBoxPoints(ui->comboBoxBasePoint); + FillComboBoxTypeLine(ui->comboBoxLineType); connect(ui->toolButtonArrowDown, &QPushButton::clicked, this, @@ -96,33 +95,9 @@ DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget * void DialogEndLine::ChoosedObject(qint64 id, const Scene::Scenes &type) { - if (idDetail == 0 && mode == Draw::Modeling) - { - if (type == Scene::Detail) - { - idDetail = id; - FillComboBoxPoints(ui->comboBoxBasePoint); - return; - } - } - if (mode == Draw::Modeling) - { - if (CheckObject(id) == false) - { - return; - } - } if (type == Scene::Point) { - VPointF point; - if (mode == Draw::Calculation) - { - point = data->GetPoint(id); - } - else - { - point = data->GetPointModeling(id); - } + VPointF point = data->GetPoint(id); ChangeCurrentText(ui->comboBoxBasePoint, point.name()); emit ToolTip(""); this->show(); diff --git a/src/dialogs/dialogendline.h b/src/dialogs/dialogendline.h index 394ad7876..34cadbaf5 100644 --- a/src/dialogs/dialogendline.h +++ b/src/dialogs/dialogendline.h @@ -46,10 +46,9 @@ public: /** * @brief DialogEndLine create dialog * @param data container with data - * @param mode mode of creation tool * @param parent parent widget */ - DialogEndLine(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); + DialogEndLine(const VContainer *data, QWidget *parent = 0); ~DialogEndLine(); /** * @brief getPointName return name of point diff --git a/src/dialogs/dialogheight.cpp b/src/dialogs/dialogheight.cpp index 6ddd95c2e..8b4076411 100644 --- a/src/dialogs/dialogheight.cpp +++ b/src/dialogs/dialogheight.cpp @@ -31,8 +31,8 @@ #include -DialogHeight::DialogHeight(const VContainer *data, Draw::Draws mode, QWidget *parent) - :DialogTool(data, mode, parent), ui(new Ui::DialogHeight), number(0), pointName(QString()), +DialogHeight::DialogHeight(const VContainer *data, QWidget *parent) + :DialogTool(data, parent), ui(new Ui::DialogHeight), number(0), pointName(QString()), typeLine(QString()), basePointId(0), p1LineId(0), p2LineId(0) { ui->setupUi(this); @@ -43,12 +43,10 @@ DialogHeight::DialogHeight(const VContainer *data, Draw::Draws mode, QWidget *pa CheckState(); QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); connect(bCansel, &QPushButton::clicked, this, &DialogHeight::DialogRejected); - if(mode == Draw::Calculation) - { - FillComboBoxPoints(ui->comboBoxBasePoint); - FillComboBoxPoints(ui->comboBoxP1Line); - FillComboBoxPoints(ui->comboBoxP2Line); - } + + FillComboBoxPoints(ui->comboBoxBasePoint); + FillComboBoxPoints(ui->comboBoxP1Line); + FillComboBoxPoints(ui->comboBoxP2Line); FillComboBoxTypeLine(ui->comboBoxLineType); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogHeight::NamePointChanged); } @@ -90,35 +88,9 @@ void DialogHeight::setP2LineId(const qint64 &value, const qint64 &id) void DialogHeight::ChoosedObject(qint64 id, const Scene::Scenes &type) { - if (idDetail == 0 && mode == Draw::Modeling) - { - if (type == Scene::Detail) - { - idDetail = id; - FillComboBoxPoints(ui->comboBoxBasePoint); - FillComboBoxPoints(ui->comboBoxP1Line); - FillComboBoxPoints(ui->comboBoxP2Line); - return; - } - } - if (mode == Draw::Modeling) - { - if (CheckObject(id) == false) - { - return; - } - } if (type == Scene::Point) { - VPointF point; - if (mode == Draw::Calculation) - { - point = data->GetPoint(id); - } - else - { - point = data->GetPointModeling(id); - } + VPointF point = data->GetPoint(id); switch (number) { case (0): diff --git a/src/dialogs/dialogheight.h b/src/dialogs/dialogheight.h index dfa360a9b..4074ba80e 100644 --- a/src/dialogs/dialogheight.h +++ b/src/dialogs/dialogheight.h @@ -46,11 +46,9 @@ public: /** * @brief DialogHeight create dialog * @param data container with data - * @param mode mode of creation tool * @param parent parent widget */ - DialogHeight(const VContainer *data, Draw::Draws mode = Draw::Calculation, - QWidget *parent = 0); + DialogHeight(const VContainer *data, QWidget *parent = 0); ~DialogHeight(); /** * @brief getPointName return name of point diff --git a/src/dialogs/dialoghistory.cpp b/src/dialogs/dialoghistory.cpp index 95c29a52e..565e45a25 100644 --- a/src/dialogs/dialoghistory.cpp +++ b/src/dialogs/dialoghistory.cpp @@ -35,7 +35,7 @@ #include DialogHistory::DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent) - :DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogHistory), doc(doc), cursorRow(0), + :DialogTool(data, parent), ui(new Ui::DialogHistory), doc(doc), cursorRow(0), cursorToolRecordRow(0) { ui->setupUi(this); diff --git a/src/dialogs/dialogincrements.cpp b/src/dialogs/dialogincrements.cpp index 5a26b7848..dc357c9e1 100644 --- a/src/dialogs/dialogincrements.cpp +++ b/src/dialogs/dialogincrements.cpp @@ -34,7 +34,7 @@ #include DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent) - :DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogIncrements), data(data), doc(doc), row(0), column(0) + :DialogTool(data, parent), ui(new Ui::DialogIncrements), data(data), doc(doc), row(0), column(0) { ui->setupUi(this); InitialStandartTable(); diff --git a/src/dialogs/dialogline.cpp b/src/dialogs/dialogline.cpp index 7a083e85b..69fd50d93 100644 --- a/src/dialogs/dialogline.cpp +++ b/src/dialogs/dialogline.cpp @@ -31,19 +31,18 @@ #include -DialogLine::DialogLine(const VContainer *data, Draw::Draws mode, QWidget *parent) - :DialogTool(data, mode, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0) +DialogLine::DialogLine(const VContainer *data, QWidget *parent) + :DialogTool(data, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0) { ui->setupUi(this); bOk = ui->buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogLine::DialogAccepted); QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); connect(bCansel, &QPushButton::clicked, this, &DialogLine::DialogRejected); - if(mode == Draw::Calculation) - { - FillComboBoxPoints(ui->comboBoxFirstPoint); - FillComboBoxPoints(ui->comboBoxSecondPoint); - } + + FillComboBoxPoints(ui->comboBoxFirstPoint); + FillComboBoxPoints(ui->comboBoxSecondPoint); + number = 0; } @@ -86,34 +85,9 @@ void DialogLine::DialogAccepted() void DialogLine::ChoosedObject(qint64 id, const Scene::Scenes &type) { - if (idDetail == 0 && mode == Draw::Modeling) - { - if (type == Scene::Detail) - { - idDetail = id; - FillComboBoxPoints(ui->comboBoxFirstPoint); - FillComboBoxPoints(ui->comboBoxSecondPoint); - return; - } - } - if (mode == Draw::Modeling) - { - if (CheckObject(id) == false) - { - return; - } - } if (type == Scene::Point) { - VPointF point; - if (mode == Draw::Calculation) - { - point = data->GetPoint(id); - } - else - { - point = data->GetPointModeling(id); - } + VPointF point = data->GetPoint(id); if (number == 0) { qint32 index = ui->comboBoxFirstPoint->findText(point.name()); diff --git a/src/dialogs/dialogline.h b/src/dialogs/dialogline.h index 74194b6fd..8f15b232b 100644 --- a/src/dialogs/dialogline.h +++ b/src/dialogs/dialogline.h @@ -46,10 +46,9 @@ public: /** * @brief DialogLine create dialog * @param data container with data - * @param mode mode of creation tool * @param parent parent widget */ - DialogLine(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); + DialogLine(const VContainer *data, QWidget *parent = 0); ~DialogLine(); /** * @brief getFirstPoint return id first point diff --git a/src/dialogs/dialoglineintersect.cpp b/src/dialogs/dialoglineintersect.cpp index 0045f3c1f..e6e4e2e4e 100644 --- a/src/dialogs/dialoglineintersect.cpp +++ b/src/dialogs/dialoglineintersect.cpp @@ -31,8 +31,8 @@ #include -DialogLineIntersect::DialogLineIntersect(const VContainer *data, Draw::Draws mode, QWidget *parent) - :DialogTool(data, mode, parent), ui(new Ui::DialogLineIntersect), number(0), pointName(QString()), +DialogLineIntersect::DialogLineIntersect(const VContainer *data, QWidget *parent) + :DialogTool(data, parent), ui(new Ui::DialogLineIntersect), number(0), pointName(QString()), p1Line1(0), p2Line1(0), p1Line2(0), p2Line2(0), flagPoint(true) { ui->setupUi(this); @@ -43,13 +43,11 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, Draw::Draws mod flagName = false; QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); connect(bCansel, &QPushButton::clicked, this, &DialogLineIntersect::DialogRejected); - if(mode == Draw::Calculation) - { - FillComboBoxPoints(ui->comboBoxP1Line1); - FillComboBoxPoints(ui->comboBoxP2Line1); - FillComboBoxPoints(ui->comboBoxP1Line2); - FillComboBoxPoints(ui->comboBoxP2Line2); - } + + FillComboBoxPoints(ui->comboBoxP1Line1); + FillComboBoxPoints(ui->comboBoxP2Line1); + FillComboBoxPoints(ui->comboBoxP1Line2); + FillComboBoxPoints(ui->comboBoxP2Line2); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogLineIntersect::NamePointChanged); } @@ -61,36 +59,9 @@ DialogLineIntersect::~DialogLineIntersect() void DialogLineIntersect::ChoosedObject(qint64 id, const Scene::Scenes &type) { - if (idDetail == 0 && mode == Draw::Modeling) - { - if (type == Scene::Detail) - { - idDetail = id; - FillComboBoxPoints(ui->comboBoxP1Line1); - FillComboBoxPoints(ui->comboBoxP2Line1); - FillComboBoxPoints(ui->comboBoxP1Line2); - FillComboBoxPoints(ui->comboBoxP2Line2); - return; - } - } - if (mode == Draw::Modeling) - { - if (CheckObject(id) == false) - { - return; - } - } if (type == Scene::Point) { - VPointF point; - if (mode == Draw::Calculation) - { - point = data->GetPoint(id); - } - else - { - point = data->GetPointModeling(id); - } + VPointF point = data->GetPoint(id); if (number == 0) { qint32 index = ui->comboBoxP1Line1->findText(point.name()); diff --git a/src/dialogs/dialoglineintersect.h b/src/dialogs/dialoglineintersect.h index 8fbbb410b..49871348c 100644 --- a/src/dialogs/dialoglineintersect.h +++ b/src/dialogs/dialoglineintersect.h @@ -46,11 +46,9 @@ public: /** * @brief DialogLineIntersect create dialog * @param data container with data - * @param mode mode of creation tool * @param parent parent widget */ - DialogLineIntersect(const VContainer *data, Draw::Draws mode = Draw::Calculation, - QWidget *parent = 0); + DialogLineIntersect(const VContainer *data, QWidget *parent = 0); ~DialogLineIntersect(); /** * @brief getP1Line1 return id first point of first line diff --git a/src/dialogs/dialognormal.cpp b/src/dialogs/dialognormal.cpp index d735eff74..e018ec574 100644 --- a/src/dialogs/dialognormal.cpp +++ b/src/dialogs/dialognormal.cpp @@ -31,8 +31,8 @@ #include -DialogNormal::DialogNormal(const VContainer *data, Draw::Draws mode, QWidget *parent) - :DialogTool(data, mode, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()), +DialogNormal::DialogNormal(const VContainer *data, QWidget *parent) + :DialogTool(data, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()), typeLine(QString()), formula(QString()), angle(0), firstPointId(0), secondPointId(0) { ui->setupUi(this); @@ -56,11 +56,9 @@ DialogNormal::DialogNormal(const VContainer *data, Draw::Draws mode, QWidget *pa CheckState(); QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); connect(bCansel, &QPushButton::clicked, this, &DialogNormal::DialogRejected); - if(mode == Draw::Calculation) - { - FillComboBoxPoints(ui->comboBoxFirstPoint); - FillComboBoxPoints(ui->comboBoxSecondPoint); - } + + FillComboBoxPoints(ui->comboBoxFirstPoint); + FillComboBoxPoints(ui->comboBoxSecondPoint); FillComboBoxTypeLine(ui->comboBoxLineType); connect(ui->toolButtonArrowDown, &QPushButton::clicked, this, @@ -102,34 +100,9 @@ DialogNormal::~DialogNormal() void DialogNormal::ChoosedObject(qint64 id, const Scene::Scenes &type) { - if (idDetail == 0 && mode == Draw::Modeling) - { - if (type == Scene::Detail) - { - idDetail = id; - FillComboBoxPoints(ui->comboBoxFirstPoint); - FillComboBoxPoints(ui->comboBoxSecondPoint); - return; - } - } - if (mode == Draw::Modeling) - { - if (CheckObject(id) == false) - { - return; - } - } if (type == Scene::Point) { - VPointF point; - if (mode == Draw::Calculation) - { - point = data->GetPoint(id); - } - else - { - point = data->GetPointModeling(id); - } + VPointF point = data->GetPoint(id); if (number == 0) { qint32 index = ui->comboBoxFirstPoint->findText(point.name()); diff --git a/src/dialogs/dialognormal.h b/src/dialogs/dialognormal.h index 4d8e97d56..9beb035a1 100644 --- a/src/dialogs/dialognormal.h +++ b/src/dialogs/dialognormal.h @@ -46,10 +46,9 @@ public: /** * @brief DialogNormal create dialog * @param data container with data - * @param mode mode of creation tool * @param parent parent widget */ - DialogNormal(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); + DialogNormal(const VContainer *data, QWidget *parent = 0); ~DialogNormal(); /** * @brief getPointName return name of point diff --git a/src/dialogs/dialogpointofcontact.cpp b/src/dialogs/dialogpointofcontact.cpp index 2fe17f7d1..645634e5a 100644 --- a/src/dialogs/dialogpointofcontact.cpp +++ b/src/dialogs/dialogpointofcontact.cpp @@ -30,8 +30,8 @@ #include -DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Draws mode, QWidget *parent) - :DialogTool(data, mode, parent), ui(), number(0), pointName(QString()), radius(QString()), center(0), +DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *parent) + :DialogTool(data, parent), ui(), number(0), pointName(QString()), radius(QString()), center(0), firstPoint(0), secondPoint(0) { ui.setupUi(this); @@ -54,12 +54,10 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Draws m CheckState(); QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel); connect(bCansel, &QPushButton::clicked, this, &DialogPointOfContact::DialogRejected); - if(mode == Draw::Calculation) - { - FillComboBoxPoints(ui.comboBoxCenter); - FillComboBoxPoints(ui.comboBoxFirstPoint); - FillComboBoxPoints(ui.comboBoxSecondPoint); - } + + FillComboBoxPoints(ui.comboBoxCenter); + FillComboBoxPoints(ui.comboBoxFirstPoint); + FillComboBoxPoints(ui.comboBoxSecondPoint); connect(ui.toolButtonPutHere, &QPushButton::clicked, this, &DialogPointOfContact::PutHere); connect(ui.listWidget, &QListWidget::itemDoubleClicked, this, &DialogPointOfContact::PutVal); @@ -79,35 +77,9 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Draws m void DialogPointOfContact::ChoosedObject(qint64 id, const Scene::Scenes &type) { - if (idDetail == 0 && mode == Draw::Modeling) - { - if (type == Scene::Detail) - { - idDetail = id; - FillComboBoxPoints(ui.comboBoxCenter); - FillComboBoxPoints(ui.comboBoxFirstPoint); - FillComboBoxPoints(ui.comboBoxSecondPoint); - return; - } - } - if (mode == Draw::Modeling) - { - if (CheckObject(id) == false) - { - return; - } - } if (type == Scene::Point) { - VPointF point; - if (mode == Draw::Calculation) - { - point = data->GetPoint(id); - } - else - { - point = data->GetPointModeling(id); - } + VPointF point = data->GetPoint(id); if (number == 0) { qint32 index = ui.comboBoxFirstPoint->findText(point.name()); diff --git a/src/dialogs/dialogpointofcontact.h b/src/dialogs/dialogpointofcontact.h index c8076c74a..d5a610c30 100644 --- a/src/dialogs/dialogpointofcontact.h +++ b/src/dialogs/dialogpointofcontact.h @@ -42,11 +42,9 @@ public: /** * @brief DialogPointOfContact create dialog * @param data container with data - * @param mode mode of creation tool * @param parent parent widget */ - DialogPointOfContact(const VContainer *data, Draw::Draws mode = Draw::Calculation, - QWidget *parent = 0); + DialogPointOfContact(const VContainer *data, QWidget *parent = 0); /** * @brief getPointName return name of point * @return name diff --git a/src/dialogs/dialogpointofintersection.cpp b/src/dialogs/dialogpointofintersection.cpp index 6860ab1eb..d0c5ce633 100644 --- a/src/dialogs/dialogpointofintersection.cpp +++ b/src/dialogs/dialogpointofintersection.cpp @@ -31,8 +31,8 @@ #include -DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, Draw::Draws mode, QWidget *parent) - :DialogTool(data, mode, parent), ui(new Ui::DialogPointOfIntersection), number(0), pointName(QString()), +DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, QWidget *parent) + :DialogTool(data, parent), ui(new Ui::DialogPointOfIntersection), number(0), pointName(QString()), firstPointId(0), secondPointId(0) { ui->setupUi(this); @@ -43,11 +43,10 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, Dra CheckState(); QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); connect(bCansel, &QPushButton::clicked, this, &DialogPointOfIntersection::DialogRejected); - if(mode == Draw::Calculation) - { - FillComboBoxPoints(ui->comboBoxFirstPoint); - FillComboBoxPoints(ui->comboBoxSecondPoint); - } + + FillComboBoxPoints(ui->comboBoxFirstPoint); + FillComboBoxPoints(ui->comboBoxSecondPoint); + connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersection::NamePointChanged); } @@ -64,34 +63,9 @@ void DialogPointOfIntersection::setSecondPointId(const qint64 &value, const qint void DialogPointOfIntersection::ChoosedObject(qint64 id, const Scene::Scenes &type) { - if (idDetail == 0 && mode == Draw::Modeling) - { - if (type == Scene::Detail) - { - idDetail = id; - FillComboBoxPoints(ui->comboBoxFirstPoint); - FillComboBoxPoints(ui->comboBoxSecondPoint); - return; - } - } - if (mode == Draw::Modeling) - { - if (CheckObject(id) == false) - { - return; - } - } if (type == Scene::Point) { - VPointF point; - if (mode == Draw::Calculation) - { - point = data->GetPoint(id); - } - else - { - point = data->GetPointModeling(id); - } + VPointF point = data->GetPoint(id); if (number == 0) { qint32 index = ui->comboBoxFirstPoint->findText(point.name()); diff --git a/src/dialogs/dialogpointofintersection.h b/src/dialogs/dialogpointofintersection.h index 3c4041153..49d7e0f12 100644 --- a/src/dialogs/dialogpointofintersection.h +++ b/src/dialogs/dialogpointofintersection.h @@ -46,11 +46,9 @@ public: /** * @brief DialogPointOfIntersection create dialog * @param data container with data - * @param mode mode of creation tool * @param parent parent widget */ - DialogPointOfIntersection(const VContainer *data, Draw::Draws mode = Draw::Calculation, - QWidget *parent = 0); + DialogPointOfIntersection(const VContainer *data, QWidget *parent = 0); ~DialogPointOfIntersection(); /** * @brief getPointName return name of point diff --git a/src/dialogs/dialogshoulderpoint.cpp b/src/dialogs/dialogshoulderpoint.cpp index fe30645d0..b570adef5 100644 --- a/src/dialogs/dialogshoulderpoint.cpp +++ b/src/dialogs/dialogshoulderpoint.cpp @@ -31,8 +31,8 @@ #include -DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, Draw::Draws mode, QWidget *parent) - :DialogTool(data, mode, parent), ui(new Ui::DialogShoulderPoint), number(0), pointName(QString()), +DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent) + :DialogTool(data, parent), ui(new Ui::DialogShoulderPoint), number(0), pointName(QString()), typeLine(QString()), formula(QString()), p1Line(0), p2Line(0), pShoulder(0) { ui->setupUi(this); @@ -57,12 +57,10 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, Draw::Draws mod QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); connect(bCansel, &QPushButton::clicked, this, &DialogShoulderPoint::DialogRejected); FillComboBoxTypeLine(ui->comboBoxLineType); - if(mode == Draw::Calculation) - { - FillComboBoxPoints(ui->comboBoxP1Line); - FillComboBoxPoints(ui->comboBoxP2Line); - FillComboBoxPoints(ui->comboBoxPShoulder); - } + + FillComboBoxPoints(ui->comboBoxP1Line); + FillComboBoxPoints(ui->comboBoxP2Line); + FillComboBoxPoints(ui->comboBoxPShoulder); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogShoulderPoint::PutHere); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogShoulderPoint::PutVal); @@ -87,35 +85,9 @@ DialogShoulderPoint::~DialogShoulderPoint() void DialogShoulderPoint::ChoosedObject(qint64 id, const Scene::Scenes &type) { - if (idDetail == 0 && mode == Draw::Modeling) - { - if (type == Scene::Detail) - { - idDetail = id; - FillComboBoxPoints(ui->comboBoxP1Line); - FillComboBoxPoints(ui->comboBoxP2Line); - FillComboBoxPoints(ui->comboBoxPShoulder); - return; - } - } - if (mode == Draw::Modeling) - { - if (CheckObject(id) == false) - { - return; - } - } if (type == Scene::Point) { - VPointF point; - if (mode == Draw::Calculation) - { - point = data->GetPoint(id); - } - else - { - point = data->GetPointModeling(id); - } + VPointF point = data->GetPoint(id); if (number == 0) { qint32 index = ui->comboBoxP1Line->findText(point.name()); diff --git a/src/dialogs/dialogshoulderpoint.h b/src/dialogs/dialogshoulderpoint.h index ce01f3235..790aba904 100644 --- a/src/dialogs/dialogshoulderpoint.h +++ b/src/dialogs/dialogshoulderpoint.h @@ -46,11 +46,9 @@ public: /** * @brief DialogShoulderPoint create dialog * @param data container with data - * @param mode mode of creation tool * @param parent parent widget */ - DialogShoulderPoint(const VContainer *data, Draw::Draws mode = Draw::Calculation, - QWidget *parent = 0); + DialogShoulderPoint(const VContainer *data, QWidget *parent = 0); ~DialogShoulderPoint(); /** * @brief getPointName return name of point diff --git a/src/dialogs/dialogsinglepoint.cpp b/src/dialogs/dialogsinglepoint.cpp index 01858fa6d..2ca5baa4a 100644 --- a/src/dialogs/dialogsinglepoint.cpp +++ b/src/dialogs/dialogsinglepoint.cpp @@ -32,7 +32,7 @@ #include DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent) - :DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogSinglePoint), name(QString()), + :DialogTool(data, parent), ui(new Ui::DialogSinglePoint), name(QString()), point(QPointF()) { ui->setupUi(this); diff --git a/src/dialogs/dialogspline.cpp b/src/dialogs/dialogspline.cpp index 64776ed81..03acc8478 100644 --- a/src/dialogs/dialogspline.cpp +++ b/src/dialogs/dialogspline.cpp @@ -31,8 +31,8 @@ #include -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), +DialogSpline::DialogSpline(const VContainer *data, QWidget *parent) + :DialogTool(data, 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,11 +41,9 @@ DialogSpline::DialogSpline(const VContainer *data, Draw::Draws mode, QWidget *pa QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); connect(bCansel, &QPushButton::clicked, this, &DialogSpline::DialogRejected); - if (mode == Draw::Calculation) - { - FillComboBoxPoints(ui->comboBoxP1); - FillComboBoxPoints(ui->comboBoxP4); - } + + FillComboBoxPoints(ui->comboBoxP1); + FillComboBoxPoints(ui->comboBoxP4); } DialogSpline::~DialogSpline() @@ -55,34 +53,9 @@ DialogSpline::~DialogSpline() void DialogSpline::ChoosedObject(qint64 id, const Scene::Scenes &type) { - if (idDetail == 0 && mode == Draw::Modeling) - { - if (type == Scene::Detail) - { - idDetail = id; - FillComboBoxPoints(ui->comboBoxP1); - FillComboBoxPoints(ui->comboBoxP4); - return; - } - } - if (mode == Draw::Modeling) - { - if (CheckObject(id) == false) - { - return; - } - } if (type == Scene::Point) { - VPointF point; - if (mode == Draw::Calculation) - { - point = data->GetPoint(id); - } - else - { - point = data->GetPointModeling(id); - } + VPointF point = data->GetPoint(id); if (number == 0) { qint32 index = ui->comboBoxP1->findText(point.name()); @@ -104,18 +77,10 @@ void DialogSpline::ChoosedObject(qint64 id, const Scene::Scenes &type) emit ToolTip(""); index = ui->comboBoxP1->currentIndex(); qint64 p1Id = qvariant_cast(ui->comboBoxP1->itemData(index)); - QPointF p1; - QPointF p4; - if (mode == Draw::Calculation) - { - p1 = data->GetPoint(p1Id).toQPointF(); - p4 = data->GetPoint(id).toQPointF(); - } - else - { - p1 = data->GetPointModeling(p1Id).toQPointF(); - p4 = data->GetPointModeling(id).toQPointF(); - } + + QPointF p1 = data->GetPoint(p1Id).toQPointF(); + QPointF p4 = data->GetPoint(id).toQPointF(); + ui->spinBoxAngle1->setValue(static_cast(QLineF(p1, p4).angle())); ui->spinBoxAngle2->setValue(static_cast(QLineF(p4, p1).angle())); } diff --git a/src/dialogs/dialogspline.h b/src/dialogs/dialogspline.h index 1df76c69e..1ba4b4179 100644 --- a/src/dialogs/dialogspline.h +++ b/src/dialogs/dialogspline.h @@ -46,10 +46,9 @@ public: /** * @brief DialogSpline create dialog * @param data container with data - * @param mode mode of creation tool * @param parent parent widget */ - DialogSpline(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); + DialogSpline(const VContainer *data, QWidget *parent = 0); ~DialogSpline(); /** * @brief getP1 return id first point of spline diff --git a/src/dialogs/dialogsplinepath.cpp b/src/dialogs/dialogsplinepath.cpp index 9240bf738..9f837cac3 100644 --- a/src/dialogs/dialogsplinepath.cpp +++ b/src/dialogs/dialogsplinepath.cpp @@ -32,8 +32,8 @@ #include -DialogSplinePath::DialogSplinePath(const VContainer *data, Draw::Draws mode, QWidget *parent) - :DialogTool(data, mode, parent), ui(new Ui::DialogSplinePath), path(VSplinePath()) +DialogSplinePath::DialogSplinePath(const VContainer *data, QWidget *parent) + :DialogTool(data, parent), ui(new Ui::DialogSplinePath), path(VSplinePath()) { ui->setupUi(this); bOk = ui->buttonBox->button(QDialogButtonBox::Ok); @@ -41,10 +41,8 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, Draw::Draws mode, QWi QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); connect(bCansel, &QPushButton::clicked, this, &DialogSplinePath::DialogRejected); - if(mode == Draw::Calculation) - { - FillComboBoxPoints(ui->comboBoxPoint); - } + + FillComboBoxPoints(ui->comboBoxPoint); path = VSplinePath(data->DataPoints()); @@ -81,22 +79,6 @@ void DialogSplinePath::SetPath(const VSplinePath &value) void DialogSplinePath::ChoosedObject(qint64 id, const Scene::Scenes &type) { - if (idDetail == 0 && mode == Draw::Modeling) - { - if (type == Scene::Detail) - { - idDetail = id; - FillComboBoxPoints(ui->comboBoxPoint); - return; - } - } - if (mode == Draw::Modeling) - { - if (CheckObject(id) == false) - { - return; - } - } if (type == Scene::Point) { NewItem(id, 1, 0, 1); @@ -172,15 +154,7 @@ void DialogSplinePath::KAsm2Changed(qreal d) void DialogSplinePath::NewItem(qint64 id, qreal kAsm1, qreal angle, qreal kAsm2) { - VPointF point; - if (mode == Draw::Calculation) - { - point = data->GetPoint(id); - } - else - { - point = data->GetPointModeling(id); - } + VPointF point = data->GetPoint(id); QListWidgetItem *item = new QListWidgetItem(point.name()); item->setFont(QFont("Times", 12, QFont::Bold)); VSplinePoint p(id, kAsm1, angle, kAsm2); diff --git a/src/dialogs/dialogsplinepath.h b/src/dialogs/dialogsplinepath.h index 9cf20e16c..5adff5438 100644 --- a/src/dialogs/dialogsplinepath.h +++ b/src/dialogs/dialogsplinepath.h @@ -47,11 +47,9 @@ public: /** * @brief DialogSplinePath create dialog * @param data container with data - * @param mode mode of creation tool * @param parent parent widget */ - DialogSplinePath(const VContainer *data, Draw::Draws mode = Draw::Calculation, - QWidget *parent = 0); + DialogSplinePath(const VContainer *data, QWidget *parent = 0); ~DialogSplinePath(); /** * @brief GetPath return spline path diff --git a/src/dialogs/dialogtool.cpp b/src/dialogs/dialogtool.cpp index 8f2a29485..04e8aa35a 100644 --- a/src/dialogs/dialogtool.cpp +++ b/src/dialogs/dialogtool.cpp @@ -31,12 +31,11 @@ #include -DialogTool::DialogTool(const VContainer *data, Draw::Draws mode, QWidget *parent) +DialogTool::DialogTool(const VContainer *data, 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), labelEditNamePoint(0), labelEditFormula(0), radioButtonSizeGrowth(0), radioButtonStandartTable(0), - radioButtonIncrements(0), radioButtonLengthLine(0), radioButtonLengthArc(0), radioButtonLengthCurve(0), - idDetail(0), mode(mode) + radioButtonIncrements(0), radioButtonLengthLine(0), radioButtonLengthArc(0), radioButtonLengthCurve(0) { Q_ASSERT(data != 0); timerFormula = new QTimer(this); @@ -67,45 +66,15 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const { Q_ASSERT(box != 0); box->clear(); - if (mode == Draw::Calculation) + const QHash *points = data->DataPoints(); + QHashIterator i(*points); + while (i.hasNext()) { - const QHash *points = data->DataPoints(); - QHashIterator i(*points); - while (i.hasNext()) + i.next(); + if (i.key() != id) { - i.next(); - if (i.key() != id) - { - VPointF point = i.value(); - box->addItem(point.name(), i.key()); - } - } - } - else - { - if (idDetail <= 0) - { - qWarning()<GetDetail(idDetail); - for (ptrdiff_t i = 0; i< det.CountNode(); ++i) - { - 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->GetPointModeling(det[i].getId()); - box->addItem(point.name(), det[i].getId()); - } - } + VPointF point = i.value(); + box->addItem(point.name(), i.key()); } } } @@ -114,60 +83,25 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, const qint64 &id, ComboMode { Q_ASSERT(box != 0); box->clear(); - if (mode == Draw::Calculation) + const QHash *spls = data->DataSplines(); + QHashIterator i(*spls); + while (i.hasNext()) { - const QHash *spls = data->DataSplines(); - QHashIterator i(*spls); - while (i.hasNext()) + i.next(); + if(cut == ComboMode::CutSpline) { - i.next(); - if(cut == ComboMode::CutSpline) + if (i.key() != id + 1 && i.key() != id + 2) { - if (i.key() != id + 1 && i.key() != id + 2) - { - VSpline spl = i.value(); - box->addItem(spl.name(), i.key()); - } - } - else - { - if (i.key() != id) - { - VSpline spl = i.value(); - box->addItem(spl.name(), i.key()); - } + VSpline spl = i.value(); + box->addItem(spl.name(), i.key()); } } - } - else - { - if (idDetail <= 0) + else { - qWarning()<GetDetail(idDetail); - for (ptrdiff_t i = 0; i< det.CountNode(); ++i) - { - if (det[i].getTypeTool() == Tool::SplineTool || - det[i].getTypeTool() == Tool::NodeSpline ) + if (i.key() != id) { - if(cut == ComboMode::CutSpline) - { - if (det[i].getId() != id + 1 && det[i].getId() != id + 2) - { - VSpline spl = data->GetSplineModeling(det[i].getId()); - box->addItem(spl.name(), det[i].getId()); - } - } - else - { - if (det[i].getId() != id) - { - VSpline spl = data->GetSplineModeling(det[i].getId()); - box->addItem(spl.name(), det[i].getId()); - } - } + VSpline spl = i.value(); + box->addItem(spl.name(), i.key()); } } } @@ -177,60 +111,25 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const qint64 &id, Combo { Q_ASSERT(box != 0); box->clear(); - if (mode == Draw::Calculation) + const QHash *splPaths = data->DataSplinePaths(); + QHashIterator i(*splPaths); + while (i.hasNext()) { - const QHash *splPaths = data->DataSplinePaths(); - QHashIterator i(*splPaths); - while (i.hasNext()) + i.next(); + if(cut == ComboMode::CutSpline) { - i.next(); - if(cut == ComboMode::CutSpline) + if (i.key() != id + 1 && i.key() != id + 2) { - if (i.key() != id + 1 && i.key() != id + 2) - { - VSplinePath splPath = i.value(); - box->addItem(splPath.name(), i.key()); - } - } - else - { - if (i.key() != id) - { - VSplinePath splPath = i.value(); - box->addItem(splPath.name(), i.key()); - } + VSplinePath splPath = i.value(); + box->addItem(splPath.name(), i.key()); } } - } - else - { - if (idDetail <= 0) + else { - qWarning()<GetDetail(idDetail); - for (ptrdiff_t i = 0; i< det.CountNode(); ++i) - { - if (det[i].getTypeTool() == Tool::SplinePathTool || - det[i].getTypeTool() == Tool::NodeSplinePath ) + if (i.key() != id) { - if(cut == ComboMode::CutSpline) - { - if (det[i].getId() != id + 1 && det[i].getId() != id + 2) - { - VSplinePath splPath = data->GetSplinePathModeling(det[i].getId()); - box->addItem(splPath.name(), det[i].getId()); - } - } - else - { - if (det[i].getId() != id) - { - VSplinePath splPath = data->GetSplinePathModeling(det[i].getId()); - box->addItem(splPath.name(), det[i].getId()); - } - } + VSplinePath splPath = i.value(); + box->addItem(splPath.name(), i.key()); } } } @@ -662,16 +561,6 @@ void DialogTool::UpdateList() } } -bool DialogTool::CheckObject(const qint64 &id) -{ - if (mode == Draw::Calculation || idDetail == 0) - { - return false; - } - VDetail det = data->GetDetail(idDetail); - return det.Containes(id); -} - template void DialogTool::ShowVariable(const QHash *var) { diff --git a/src/dialogs/dialogtool.h b/src/dialogs/dialogtool.h index 44cad4263..f16318dea 100644 --- a/src/dialogs/dialogtool.h +++ b/src/dialogs/dialogtool.h @@ -57,21 +57,10 @@ public: /** * @brief DialogTool create dialog * @param data container with data - * @param mode mode of creation tool * @param parent parent widget */ - DialogTool(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); + DialogTool(const VContainer *data, QWidget *parent = 0); virtual ~DialogTool() {} - /** - * @brief getIdDetail return id detail - * @return id - */ - inline qint64 getIdDetail() const {return idDetail;} - /** - * @brief setIdDetail set id detail - * @param value id - */ - inline void setIdDetail(const qint64 &value) {idDetail = value;} signals: /** * @brief DialogClosed signal dialog closed @@ -262,20 +251,6 @@ protected: * @brief radioButtonLengthCurve radio button for lengths of curves variables */ QRadioButton *radioButtonLengthCurve; - /** - * @brief idDetail id detail - */ - qint64 idDetail; - /** - * @brief mode mode - */ - Draw::Draws mode; - /** - * @brief CheckObject check if object belongs to detail - * @param id id of object (point, arc, spline, spline path) - * @return true - belons, false - don't - */ - bool CheckObject(const qint64 &id); /** * @brief closeEvent handle when dialog cloded * @param event event diff --git a/src/dialogs/dialogtriangle.cpp b/src/dialogs/dialogtriangle.cpp index ef097efa6..e9b4a3bc1 100644 --- a/src/dialogs/dialogtriangle.cpp +++ b/src/dialogs/dialogtriangle.cpp @@ -31,8 +31,8 @@ #include -DialogTriangle::DialogTriangle(const VContainer *data, Draw::Draws mode, QWidget *parent) - :DialogTool(data, mode, parent), ui(new Ui::DialogTriangle), number(0), pointName(QString()), axisP1Id(0), +DialogTriangle::DialogTriangle(const VContainer *data, QWidget *parent) + :DialogTool(data, parent), ui(new Ui::DialogTriangle), number(0), pointName(QString()), axisP1Id(0), axisP2Id(0), firstPointId(0), secondPointId(0) { ui->setupUi(this); @@ -43,13 +43,12 @@ DialogTriangle::DialogTriangle(const VContainer *data, Draw::Draws mode, QWidget CheckState(); QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); connect(bCansel, &QPushButton::clicked, this, &DialogTriangle::DialogRejected); - if(mode == Draw::Calculation) - { - FillComboBoxPoints(ui->comboBoxAxisP1); - FillComboBoxPoints(ui->comboBoxAxisP2); - FillComboBoxPoints(ui->comboBoxFirstPoint); - FillComboBoxPoints(ui->comboBoxSecondPoint); - } + + FillComboBoxPoints(ui->comboBoxAxisP1); + FillComboBoxPoints(ui->comboBoxAxisP2); + FillComboBoxPoints(ui->comboBoxFirstPoint); + FillComboBoxPoints(ui->comboBoxSecondPoint); + connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogTriangle::NamePointChanged); } @@ -60,36 +59,9 @@ DialogTriangle::~DialogTriangle() void DialogTriangle::ChoosedObject(qint64 id, const Scene::Scenes &type) { - if (idDetail == 0 && mode == Draw::Modeling) - { - if (type == Scene::Detail) - { - idDetail = id; - FillComboBoxPoints(ui->comboBoxAxisP1); - FillComboBoxPoints(ui->comboBoxAxisP2); - FillComboBoxPoints(ui->comboBoxFirstPoint); - FillComboBoxPoints(ui->comboBoxSecondPoint); - return; - } - } - if (mode == Draw::Modeling) - { - if (CheckObject(id) == false) - { - return; - } - } if (type == Scene::Point) { - VPointF point; - if (mode == Draw::Calculation) - { - point = data->GetPoint(id); - } - else - { - point = data->GetPointModeling(id); - } + VPointF point = data->GetPoint(id); switch (number) { case (0): diff --git a/src/dialogs/dialogtriangle.h b/src/dialogs/dialogtriangle.h index 68f9cbbcb..e75d83a8c 100644 --- a/src/dialogs/dialogtriangle.h +++ b/src/dialogs/dialogtriangle.h @@ -46,10 +46,9 @@ public: /** * @brief DialogTriangle create dialog * @param data container with data - * @param mode mode of creation tool * @param parent parent widget */ - DialogTriangle(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); + DialogTriangle(const VContainer *data, QWidget *parent = 0); ~DialogTriangle(); /** * @brief getAxisP1Id return id first point of axis diff --git a/src/geometry/varc.cpp b/src/geometry/varc.cpp index 2dfd52a70..8f1951938 100644 --- a/src/geometry/varc.cpp +++ b/src/geometry/varc.cpp @@ -33,12 +33,12 @@ class QRectF; VArc::VArc () : f1(0), formulaF1(QString()), f2(0), formulaF2(QString()), radius(0), formulaRadius(QString()), - center(0), points(QHash()), mode(Draw::Calculation), idObject(0), _name(QString()){} + center(0), points(QHash()), idObject(0), _name(QString()){} VArc::VArc (const QHash *points, qint64 center, qreal radius, QString formulaRadius, - qreal f1, QString formulaF1, qreal f2, QString formulaF2, Draw::Draws mode, qint64 idObject) + qreal f1, QString formulaF1, qreal f2, QString formulaF2, qint64 idObject) : f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2), radius(radius), formulaRadius(formulaRadius), - center(center), points(*points), mode(mode), idObject(idObject), _name(QString()) + center(center), points(*points), idObject(idObject), _name(QString()) { /** * @todo Change name of arc in formula. Name now not unique. @@ -49,8 +49,7 @@ VArc::VArc (const QHash *points, qint64 center, qreal radius, Q 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()), mode(arc.getMode()), - idObject(arc.getIdObject()), _name(arc.name()){} + center(arc.GetCenter()), points(arc.GetDataPoints()), idObject(arc.getIdObject()), _name(arc.name()){} VArc &VArc::operator =(const VArc &arc) { @@ -62,7 +61,6 @@ VArc &VArc::operator =(const VArc &arc) this->radius = arc.GetRadius(); this->formulaRadius = arc.GetFormulaRadius(); this->center = arc.GetCenter(); - this->mode = arc.getMode(); this->idObject = arc.getIdObject(); this->_name = arc.name(); return *this; diff --git a/src/geometry/varc.h b/src/geometry/varc.h index 890e2db80..754e4ddea 100644 --- a/src/geometry/varc.h +++ b/src/geometry/varc.h @@ -56,8 +56,7 @@ public: * @param f2 кінцевий кут в градусах. */ VArc (const QHash *points, qint64 center, qreal radius, QString formulaRadius, - qreal f1, QString formulaF1, qreal f2, QString formulaF2, - Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); + qreal f1, QString formulaF1, qreal f2, QString formulaF2, qint64 idObject = 0); /** * @brief VArc * @param arc @@ -160,16 +159,6 @@ public: * @return */ QVector SplOfArc( qint32 number ) const; - /** - * @brief getMode - * @return - */ - inline Draw::Draws getMode() const {return mode;} - /** - * @brief setMode - * @param value - */ - inline void setMode(const Draw::Draws &value) {mode = value;} /** * @brief getIdObject * @return @@ -223,10 +212,6 @@ private: * @brief points */ QHash points; - /** - * @brief mode - */ - Draw::Draws mode; /** * @brief idObject */ diff --git a/src/geometry/vnodedetail.cpp b/src/geometry/vnodedetail.cpp index b7b09a005..45bc99e92 100644 --- a/src/geometry/vnodedetail.cpp +++ b/src/geometry/vnodedetail.cpp @@ -29,21 +29,18 @@ #include "vnodedetail.h" VNodeDetail::VNodeDetail() - :id(0), typeTool(Tool::NodePoint), mode(Draw::Modeling), typeNode(NodeDetail::Contour), mx(0), my(0){} + :id(0), typeTool(Tool::NodePoint), typeNode(NodeDetail::Contour), mx(0), my(0){} -VNodeDetail::VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode, - qreal mx, qreal my) - :id(id), typeTool(typeTool), mode(mode), typeNode(typeNode), mx(mx), my(my){} +VNodeDetail::VNodeDetail(qint64 id, Tool::Tools typeTool, NodeDetail::NodeDetails typeNode, qreal mx, qreal my) + :id(id), typeTool(typeTool), typeNode(typeNode), mx(mx), my(my){} VNodeDetail::VNodeDetail(const VNodeDetail &node) - :id(node.getId()), typeTool(node.getTypeTool()), mode(node.getMode()), typeNode(node.getTypeNode()), - mx(node.getMx()), my(node.getMy()){} + :id(node.getId()), typeTool(node.getTypeTool()), typeNode(node.getTypeNode()), mx(node.getMx()), my(node.getMy()){} VNodeDetail &VNodeDetail::operator =(const VNodeDetail &node) { id = node.getId(); typeTool = node.getTypeTool(); - mode = node.getMode(); typeNode = node.getTypeNode(); mx = node.getMx(); my = node.getMy(); diff --git a/src/geometry/vnodedetail.h b/src/geometry/vnodedetail.h index 14e3dbc31..fdb5f5337 100644 --- a/src/geometry/vnodedetail.h +++ b/src/geometry/vnodedetail.h @@ -61,8 +61,8 @@ public: * @param mx * @param my */ - VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode, - qreal mx = 0, qreal my = 0); + VNodeDetail(qint64 id, Tool::Tools typeTool, NodeDetail::NodeDetails typeNode, qreal mx = 0, + qreal my = 0); /** * @brief VNodeDetail * @param node @@ -94,16 +94,6 @@ public: * @param value */ inline void setTypeTool(const Tool::Tools &value) {typeTool = value;} - /** - * @brief getMode - * @return - */ - inline Draw::Draws getMode() const {return mode;} - /** - * @brief setMode - * @param value - */ - inline void setMode(const Draw::Draws &value) {mode = value;} /** * @brief getTypeNode * @return @@ -143,10 +133,6 @@ private: * @brief typeTool */ Tool::Tools typeTool; - /** - * @brief mode - */ - Draw::Draws mode; /** * @brief typeNode */ diff --git a/src/geometry/vspline.cpp b/src/geometry/vspline.cpp index bd8aaa16a..4f9372bab 100644 --- a/src/geometry/vspline.cpp +++ b/src/geometry/vspline.cpp @@ -32,33 +32,32 @@ VSpline::VSpline() :p1(0), p2(QPointF()), p3(QPointF()), p4(0), angle1(0), angle2(0), kAsm1(1), kAsm2(1), kCurve(1), - points(QHash()), mode(Draw::Calculation), idObject(0), _name(QString()){} + points(QHash()), idObject(0), _name(QString()){} 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()), mode(spline.getMode()), idObject(spline.getIdObject()), _name(spline.name()){} + points(spline.GetDataPoints()), idObject(spline.getIdObject()), _name(spline.name()){} VSpline::VSpline (const QHash *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2, - qreal kAsm1, qreal kAsm2, qreal kCurve, Draw::Draws mode, qint64 idObject) + qreal kAsm1, qreal kAsm2, qreal kCurve, qint64 idObject) :p1(p1), p2(QPointF()), p3(QPointF()), p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2), - kCurve(kCurve), points(*points), mode(mode), idObject(idObject), _name(QString()) + kCurve(kCurve), points(*points), idObject(idObject), _name(QString()) { _name = QString("Spl_%1_%2").arg(this->GetPointP1().name(), this->GetPointP4().name()); ModifiSpl ( p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve ); } VSpline::VSpline (const QHash *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), mode(mode), + qreal kCurve, qint64 idObject) + :p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1), kAsm2(1), kCurve(1), points(*points), idObject(idObject), _name(QString()) { _name = QString("Spl_%1_%2").arg(this->GetPointP1().name(), this->GetPointP4().name()); ModifiSpl ( p1, p2, p3, p4, kCurve); } -void VSpline::ModifiSpl ( qint64 p1, qint64 p4, qreal angle1, qreal angle2, - qreal kAsm1, qreal kAsm2, qreal kCurve) +void VSpline::ModifiSpl ( qint64 p1, qint64 p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve) { this->p1 = p1; this->p4 = p4; @@ -854,7 +853,6 @@ VSpline &VSpline::operator =(const VSpline &spline) this->kAsm2 = spline.GetKasm2(); this->kCurve = spline.GetKcurve(); this->points = spline.GetDataPoints(); - this->mode = spline.getMode(); this->idObject = spline.getIdObject(); this->_name = spline.name(); return *this; diff --git a/src/geometry/vspline.h b/src/geometry/vspline.h index bbe18d89e..aaca1e2ec 100644 --- a/src/geometry/vspline.h +++ b/src/geometry/vspline.h @@ -64,8 +64,8 @@ public: * @param kAsm1 коефіцієнт довжини першої напрямної. * @param kAsm2 коефіцієнт довжини другої напрямної. */ - VSpline (const QHash *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2, - qreal kAsm1, qreal kAsm2, qreal kCurve, Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); + VSpline (const QHash *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2, qreal kAsm1, + qreal kAsm2, qreal kCurve, qint64 idObject = 0); /** * @brief VSpline конструктор. * @param p1 початкова точка сплайну. @@ -74,7 +74,7 @@ public: * @param p4 кінцева точка сплайну. */ VSpline (const QHash *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4, - qreal kCurve, Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); + qreal kCurve, qint64 idObject = 0); /** * @brief ModifiSpl модифікує сплайн. * @param p1 початкова точка сплайну. @@ -225,16 +225,6 @@ public: * @param Pmirror точка відносно якої відбувається вертикальне дзеркалення сплайну. */ // void Mirror(const QPointF Pmirror); - /** - * @brief getMode - * @return - */ - inline Draw::Draws getMode() const {return mode;} - /** - * @brief setMode - * @param value - */ - inline void setMode(const Draw::Draws &value) {mode = value;} /** * @brief SplinePoints * @param p1 @@ -325,10 +315,6 @@ private: * @brief points */ QHash points; - /** - * @brief mode - */ - Draw::Draws mode; /** * @brief idObject */ diff --git a/src/geometry/vsplinepath.cpp b/src/geometry/vsplinepath.cpp index ad6fb1381..57cca8236 100644 --- a/src/geometry/vsplinepath.cpp +++ b/src/geometry/vsplinepath.cpp @@ -30,15 +30,14 @@ #include "../exception/vexception.h" VSplinePath::VSplinePath() - : path(QVector()), kCurve(1), mode(Draw::Calculation), points(QHash()), idObject(0), - _name(QString()){} + : path(QVector()), kCurve(1), points(QHash()), idObject(0), _name(QString()){} -VSplinePath::VSplinePath(const QHash *points, qreal kCurve, Draw::Draws mode, qint64 idObject) - : path(QVector()), kCurve(kCurve), mode(mode), points(*points), idObject(idObject), _name(QString()) +VSplinePath::VSplinePath(const QHash *points, qreal kCurve, qint64 idObject) + : path(QVector()), kCurve(kCurve), points(*points), idObject(idObject), _name(QString()) {} VSplinePath::VSplinePath(const VSplinePath &splPath) - : path(*splPath.GetPoint()), kCurve(splPath.getKCurve()), mode(splPath.getMode()), points(splPath.GetDataPoints()), + : path(*splPath.GetPoint()), kCurve(splPath.getKCurve()), points(splPath.GetDataPoints()), idObject(splPath.getIdObject()), _name(splPath.name()){} void VSplinePath::append(const VSplinePoint &point) @@ -158,7 +157,6 @@ VSplinePath &VSplinePath::operator =(const VSplinePath &path) { this->path = path.GetSplinePath(); this->kCurve = path.getKCurve(); - this->mode = path.getMode(); this->points = path.GetDataPoints(); this->idObject = path.getIdObject(); this->_name = path.name(); diff --git a/src/geometry/vsplinepath.h b/src/geometry/vsplinepath.h index 1149dcbf7..9a428798e 100644 --- a/src/geometry/vsplinepath.h +++ b/src/geometry/vsplinepath.h @@ -58,8 +58,7 @@ public: /** * @brief VSplinePath конструктор по замовчуванню. */ - VSplinePath(const QHash *points, qreal kCurve = 1, - Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); + VSplinePath(const QHash *points, qreal kCurve = 1, qint64 idObject = 0); /** * @brief VSplinePath * @param splPath @@ -156,16 +155,6 @@ public: * @return */ VSplinePoint &operator[](ptrdiff_t indx); - /** - * @brief getMode - * @return - */ - inline Draw::Draws getMode() const {return mode;} - /** - * @brief setMode - * @param value - */ - inline void setMode(const Draw::Draws &value) {mode = value;} /** * @brief getIdObject * @return @@ -208,10 +197,6 @@ protected: * @brief kCurve */ qreal kCurve; - /** - * @brief mode - */ - Draw::Draws mode; /** * @brief points */ diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 07f9519c4..c42e0db7e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -251,7 +251,7 @@ void MainWindow::SetToolButton(bool checked, Tool::Tools t, const QString &curso QCursor cur(pixmap, 2, 3); view->setCursor(cur); helpLabel->setText(toolTip); - dialog = QSharedPointer(new Dialog(data, mode)); + dialog = QSharedPointer(new Dialog(data)); connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialog.data(), &Dialog::ChoosedObject); connect(dialog.data(), &Dialog::DialogClosed, this, closeDialogSlot); connect(dialog.data(), &Dialog::ToolTip, this, &MainWindow::ShowToolTip); @@ -277,20 +277,12 @@ void MainWindow::AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool det->AddTool(tool, id, typeTool); } -template +template void MainWindow::ClosedDialog(QSharedPointer &dialog, int result) { if (result == QDialog::Accepted) { - if (mode == Draw::Calculation) - { - DrawTool::Create(dialog, currentScene, doc, data); - } - else - { - ModelingTool *endLine = ModelingTool::Create(dialog, doc, data); - AddToolToDetail(endLine, endLine->getId(), tool, dialog->getIdDetail()); - } + DrawTool::Create(dialog, currentScene, doc, data); } ArrowTool(); } @@ -303,7 +295,7 @@ void MainWindow::ToolEndLine(bool checked) void MainWindow::ClosedDialogEndLine(int result) { - ClosedDialog(dialogEndLine, result); + ClosedDialog(dialogEndLine, result); } void MainWindow::ToolLine(bool checked) @@ -314,7 +306,7 @@ void MainWindow::ToolLine(bool checked) void MainWindow::ClosedDialogLine(int result) { - ClosedDialog(dialogLine, result); + ClosedDialog(dialogLine, result); } void MainWindow::ToolAlongLine(bool checked) @@ -325,7 +317,7 @@ void MainWindow::ToolAlongLine(bool checked) void MainWindow::ClosedDialogAlongLine(int result) { - ClosedDialog(dialogAlongLine, result); + ClosedDialog(dialogAlongLine, result); } void MainWindow::ToolShoulderPoint(bool checked) @@ -337,7 +329,7 @@ void MainWindow::ToolShoulderPoint(bool checked) void MainWindow::ClosedDialogShoulderPoint(int result) { - ClosedDialog(dialogShoulderPoint, result); + ClosedDialog(dialogShoulderPoint, result); } void MainWindow::ToolNormal(bool checked) @@ -348,7 +340,7 @@ void MainWindow::ToolNormal(bool checked) void MainWindow::ClosedDialogNormal(int result) { - ClosedDialog(dialogNormal, result); + ClosedDialog(dialogNormal, result); } void MainWindow::ToolBisector(bool checked) @@ -359,7 +351,7 @@ void MainWindow::ToolBisector(bool checked) void MainWindow::ClosedDialogBisector(int result) { - ClosedDialog(dialogBisector, result); + ClosedDialog(dialogBisector, result); } void MainWindow::ToolLineIntersect(bool checked) @@ -371,7 +363,7 @@ void MainWindow::ToolLineIntersect(bool checked) void MainWindow::ClosedDialogLineIntersect(int result) { - ClosedDialog(dialogLineIntersect, result); + ClosedDialog(dialogLineIntersect, result); } void MainWindow::ToolSpline(bool checked) @@ -382,7 +374,7 @@ void MainWindow::ToolSpline(bool checked) void MainWindow::ClosedDialogSpline(int result) { - ClosedDialog(dialogSpline, result); + ClosedDialog(dialogSpline, result); } void MainWindow::ToolCutSpline(bool checked) @@ -393,7 +385,7 @@ void MainWindow::ToolCutSpline(bool checked) void MainWindow::ClosedDialogCutSpline(int result) { - ClosedDialog(dialogCutSpline, result); + ClosedDialog(dialogCutSpline, result); } void MainWindow::ToolArc(bool checked) @@ -404,7 +396,7 @@ void MainWindow::ToolArc(bool checked) void MainWindow::ClosedDialogArc(int result) { - ClosedDialog(dialogArc, result); + ClosedDialog(dialogArc, result); } void MainWindow::ToolSplinePath(bool checked) @@ -415,7 +407,7 @@ void MainWindow::ToolSplinePath(bool checked) void MainWindow::ClosedDialogSplinePath(int result) { - ClosedDialog(dialogSplinePath, result); + ClosedDialog(dialogSplinePath, result); } void MainWindow::ToolCutSplinePath(bool checked) @@ -426,7 +418,7 @@ void MainWindow::ToolCutSplinePath(bool checked) void MainWindow::ClosedDialogCutSplinePath(int result) { - ClosedDialog(dialogCutSplinePath, result); + ClosedDialog(dialogCutSplinePath, result); } void MainWindow::ToolPointOfContact(bool checked) @@ -438,7 +430,7 @@ void MainWindow::ToolPointOfContact(bool checked) void MainWindow::ClosedDialogPointOfContact(int result) { - ClosedDialog(dialogPointOfContact, result); + ClosedDialog(dialogPointOfContact, result); } void MainWindow::ToolDetail(bool checked) @@ -451,7 +443,7 @@ void MainWindow::ToolDetail(bool checked) QCursor cur(pixmap, 2, 3); view->setCursor(cur); helpLabel->setText(tr("Select points, arcs, curves clockwise.")); - dialogDetail = QSharedPointer(new DialogDetail(data, mode)); + dialogDetail = QSharedPointer(new DialogDetail(data)); connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogDetail.data(), &DialogDetail::ChoosedObject); connect(dialogDetail.data(), &DialogDetail::DialogClosed, this, &MainWindow::ClosedDialogDetail); @@ -483,7 +475,7 @@ void MainWindow::ToolHeight(bool checked) void MainWindow::ClosedDialogHeight(int result) { - ClosedDialog(dialogHeight, result); + ClosedDialog(dialogHeight, result); } void MainWindow::ToolTriangle(bool checked) @@ -494,7 +486,7 @@ void MainWindow::ToolTriangle(bool checked) void MainWindow::ClosedDialogTriangle(int result) { - ClosedDialog(dialogTriangle, result); + ClosedDialog(dialogTriangle, result); } void MainWindow::ToolPointOfIntersection(bool checked) @@ -506,7 +498,7 @@ void MainWindow::ToolPointOfIntersection(bool checked) void MainWindow::ClosedDialogPointOfIntersection(int result) { - ClosedDialog(dialogPointOfIntersection, result); + ClosedDialog(dialogPointOfIntersection, result); } void MainWindow::About() diff --git a/src/mainwindow.h b/src/mainwindow.h index 63340c050..92fdeb275 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -36,7 +36,6 @@ #include "dialogs/dialogs.h" #include "tools/vtooldetail.h" #include "tools/drawTools/drawtools.h" -#include "tools/modelingTools/modelingtools.h" #include "xml/vdomdocument.h" namespace Ui @@ -555,7 +554,7 @@ private: */ void AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool, const qint64 &idDetail); - template + template /** * @brief ClosedDialog * @param dialog diff --git a/src/options.h b/src/options.h index e0808cbf3..52881be48 100644 --- a/src/options.h +++ b/src/options.h @@ -77,9 +77,7 @@ namespace Tool NodeSplinePath, Height, Triangle, - PointOfIntersection, - SimpleSpline, - SimpleSplinePath + PointOfIntersection }; Q_DECLARE_FLAGS(Tools, Tool) diff --git a/src/tools/drawTools/vtoolcutspline.h b/src/tools/drawTools/vtoolcutspline.h index 37857ae36..795fdd34a 100644 --- a/src/tools/drawTools/vtoolcutspline.h +++ b/src/tools/drawTools/vtoolcutspline.h @@ -121,6 +121,7 @@ protected: virtual void AddToFile(); void RefreshGeometry(); private: + Q_DISABLE_COPY(VToolCutSpline) /** * @brief formula keep formula of length */ diff --git a/src/tools/drawTools/vtoolcutsplinepath.cpp b/src/tools/drawTools/vtoolcutsplinepath.cpp index 054ec0150..92bca9703 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/tools/drawTools/vtoolcutsplinepath.cpp @@ -94,7 +94,6 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons QPointF spl1p2, spl1p3, spl2p2, spl2p3; qint32 p1 = 0, p2 = 0; QPointF point = splPath.CutSplinePath(toPixel(result), p1, p2, spl1p2, spl1p3, spl2p2, spl2p3); - qDebug()<(c*c) == static_cast(a*a + b*b)) + if (qFuzzyCompare(c*c, a*a + b*b)) { QLineF l1(axisP2, firstPoint); QLineF l2(axisP2, secondPoint); @@ -142,6 +142,7 @@ QPointF VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, c } if (c*c < a*a + b*b) { + //Still don't know why this code handled. Need to think about that. qWarning()< - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef MODELINGTOOLS_H -#define MODELINGTOOLS_H - -#include "vmodelingalongline.h" -#include "vmodelingarc.h" -#include "vmodelingbisector.h" -#include "vmodelingendline.h" -#include "vmodelingline.h" -#include "vmodelinglineintersect.h" -#include "vmodelingnormal.h" -#include "vmodelingpointofcontact.h" -#include "vmodelingshoulderpoint.h" -#include "vmodelingspline.h" -#include "vmodelingsplinepath.h" -#include "vmodelingheight.h" -#include "vmodelingtriangle.h" -#include "vmodelingpointofintersection.h" -#include "vmodelingcutspline.h" -#include "vmodelingcutsplinepath.h" - -#endif // MODELINGTOOLS_H diff --git a/src/tools/modelingTools/vmodelingalongline.cpp b/src/tools/modelingTools/vmodelingalongline.cpp deleted file mode 100644 index 2f38aa88a..000000000 --- a/src/tools/modelingTools/vmodelingalongline.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingalongline.cpp - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "vmodelingalongline.h" -#include "../../container/calculator.h" - -const QString VModelingAlongLine::ToolType = QStringLiteral("alongLine"); - -VModelingAlongLine::VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id, - const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const QString &typeLine, - const Tool::Sources &typeCreation, QGraphicsItem *parent) - :VModelingLinePoint(doc, data, id, typeLine, formula, firstPointId, 0, parent), secondPointId(secondPointId), - dialogAlongLine(QSharedPointer()) -{ - if (typeCreation == Tool::FromGui) - { - AddToFile(); - } -} - -void VModelingAlongLine::FullUpdateFromFile() -{ - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - typeLine = domElement.attribute(AttrTypeLine, ""); - formula = domElement.attribute(AttrLength, ""); - basePointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); - secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); - } - RefreshGeometry(); -} - -void VModelingAlongLine::FullUpdateFromGui(int result) -{ - if (result == QDialog::Accepted) - { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute(AttrName, dialogAlongLine->getPointName()); - domElement.setAttribute(AttrTypeLine, dialogAlongLine->getTypeLine()); - domElement.setAttribute(AttrLength, dialogAlongLine->getFormula()); - domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogAlongLine->getFirstPointId())); - domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogAlongLine->getSecondPointId())); - emit FullUpdateTree(); - } - - } - dialogAlongLine.clear(); -} - -void VModelingAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - ContextMenu(dialogAlongLine, this, event); -} - -void VModelingAlongLine::AddToFile() -{ - VPointF point = VAbstractTool::data.GetPointModeling(id); - QDomElement domElement = doc->createElement(TagName); - - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point.name()); - AddAttribute(domElement, AttrMx, toMM(point.mx())); - AddAttribute(domElement, AttrMy, toMM(point.my())); - - AddAttribute(domElement, AttrTypeLine, typeLine); - AddAttribute(domElement, AttrLength, formula); - AddAttribute(domElement, AttrFirstPoint, basePointId); - AddAttribute(domElement, AttrSecondPoint, secondPointId); - - AddToModeling(domElement); -} - -void VModelingAlongLine::RemoveReferens() -{ - doc->DecrementReferens(secondPointId); - VModelingLinePoint::RemoveReferens(); -} - -void VModelingAlongLine::setDialog() -{ - Q_ASSERT(dialogAlongLine.isNull() == false); - VPointF p = VAbstractTool::data.GetPointModeling(id); - dialogAlongLine->setTypeLine(typeLine); - dialogAlongLine->setFormula(formula); - dialogAlongLine->setFirstPointId(basePointId, id); - dialogAlongLine->setSecondPointId(secondPointId, id); - dialogAlongLine->setPointName(p.name()); -} - -VModelingAlongLine *VModelingAlongLine::Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data) -{ - QString formula = dialog->getFormula(); - qint64 firstPointId = dialog->getFirstPointId(); - qint64 secondPointId = dialog->getSecondPointId(); - QString typeLine = dialog->getTypeLine(); - QString pointName = dialog->getPointName(); - return Create(0, pointName, typeLine, formula, firstPointId, secondPointId, 5, 10, doc, data, - Document::FullParse, Tool::FromGui); -} - -VModelingAlongLine *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, - const Tool::Sources &typeCreation) -{ - VModelingAlongLine *point = 0; - VPointF firstPoint = data->GetPointModeling(firstPointId); - VPointF secondPoint = data->GetPointModeling(secondPointId); - QLineF line = QLineF(firstPoint.toQPointF(), secondPoint.toQPointF()); - Calculator cal(data); - QString errorMsg; - qreal result = cal.eval(formula, &errorMsg); - if (errorMsg.isEmpty()) - { - line.setLength(toPixel(result)); - qint64 id = _id; - if (typeCreation == Tool::FromGui) - { - id = data->AddPointModeling(VPointF(line.p2().x(), line.p2().y(), pointName, mx, my)); - } - else - { - data->UpdatePointModeling(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my)); - if (parse != Document::FullParse) - { - doc->UpdateToolData(id, data); - } - } - data->AddLine(firstPointId, id); - data->AddLine(id, secondPointId); - - if (parse == Document::FullParse) - { - point = new VModelingAlongLine(doc, data, id, formula, firstPointId, secondPointId, typeLine, - typeCreation); - doc->AddTool(id, point); - doc->IncrementReferens(firstPointId); - doc->IncrementReferens(secondPointId); - } - } - return point; -} diff --git a/src/tools/modelingTools/vmodelingalongline.h b/src/tools/modelingTools/vmodelingalongline.h deleted file mode 100644 index b5ddd9f8c..000000000 --- a/src/tools/modelingTools/vmodelingalongline.h +++ /dev/null @@ -1,129 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingalongline.h - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef VMODELINGALONGLINE_H -#define VMODELINGALONGLINE_H - -#include "vmodelinglinepoint.h" -#include "../../dialogs/dialogalongline.h" - -/** - * @brief The VModelingAlongLine class - */ -class VModelingAlongLine : public VModelingLinePoint -{ - Q_OBJECT -public: - /** - * @brief VModelingAlongLine - * @param doc dom document container - * @param data - * @param id - * @param formula - * @param firstPointId - * @param secondPointId - * @param typeLine - * @param typeCreation - * @param parent - */ - VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id, - const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const QString &typeLine, - const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); - /** - * @brief setDialog - */ - virtual void setDialog(); - /** - * @brief Create - * @param dialog - * @param doc dom document container - * @param data - * @return - */ - static VModelingAlongLine* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); - /** - * @brief Create - * @param _id - * @param pointName - * @param typeLine - * @param formula - * @param firstPointId - * @param secondPointId - * @param mx - * @param my - * @param doc dom document container - * @param data - * @param parse - * @param typeCreation - * @return - */ - 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, const Tool::Sources &typeCreation); - /** - * @brief ToolType - */ - static const QString ToolType; -public slots: - /** - * @brief FullUpdateFromFile - */ - virtual void FullUpdateFromFile(); - /** - * @brief FullUpdateFromGui - * @param result - */ - virtual void FullUpdateFromGui(int result); -protected: - /** - * @brief contextMenuEvent - * @param event - */ - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - /** - * @brief AddToFile - */ - virtual void AddToFile(); - /** - * @brief RemoveReferens - */ - virtual void RemoveReferens(); -private: - /** - * @brief secondPointId - */ - qint64 secondPointId; - /** - * @brief dialogAlongLine - */ - QSharedPointer dialogAlongLine; -}; - -#endif // VMODELINGALONGLINE_H diff --git a/src/tools/modelingTools/vmodelingarc.cpp b/src/tools/modelingTools/vmodelingarc.cpp deleted file mode 100644 index 676a3c151..000000000 --- a/src/tools/modelingTools/vmodelingarc.cpp +++ /dev/null @@ -1,198 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingarc.cpp - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "vmodelingarc.h" -#include "../../container/calculator.h" - -const QString VModelingArc::TagName = QStringLiteral("arc"); -const QString VModelingArc::ToolType = QStringLiteral("simple"); - -VModelingArc::VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, - QGraphicsItem *parent) - :VModelingTool(doc, data, id), QGraphicsPathItem(parent), dialogArc(QSharedPointer()) -{ - this->setPen(QPen(baseColor, widthHairLine)); - this->setFlag(QGraphicsItem::ItemIsSelectable, true); - this->setAcceptHoverEvents(true); - RefreshGeometry(); - - if (typeCreation == Tool::FromGui) - { - AddToFile(); - } -} - -void VModelingArc::setDialog() -{ - Q_ASSERT(dialogArc.isNull() == false); - VArc arc = VAbstractTool::data.GetArcModeling(id); - dialogArc->SetCenter(arc.GetCenter()); - dialogArc->SetRadius(arc.GetFormulaRadius()); - dialogArc->SetF1(arc.GetFormulaF1()); - dialogArc->SetF2(arc.GetFormulaF2()); -} - -VModelingArc* VModelingArc::Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data) -{ - qint64 center = dialog->GetCenter(); - QString radius = dialog->GetRadius(); - QString f1 = dialog->GetF1(); - QString f2 = dialog->GetF2(); - return Create(0, center, radius, f1, f2, doc, data, Document::FullParse, Tool::FromGui); -} - -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, const Tool::Sources &typeCreation) -{ - VModelingArc *toolArc = 0; - qreal calcRadius = 0, calcF1 = 0, calcF2 = 0; - - Calculator cal(data); - QString errorMsg; - qreal result = cal.eval(radius, &errorMsg); - if (errorMsg.isEmpty()) - { - calcRadius = toPixel(result); - } - - errorMsg.clear(); - result = cal.eval(f1, &errorMsg); - if (errorMsg.isEmpty()) - { - calcF1 = result; - } - - errorMsg.clear(); - result = cal.eval(f2, &errorMsg); - if (errorMsg.isEmpty()) - { - calcF2 = result; - } - - VArc arc = VArc(data->DataPointsModeling(), center, calcRadius, radius, calcF1, f1, calcF2, f2 ); - qint64 id = _id; - if (typeCreation == Tool::FromGui) - { - id = data->AddArcModeling(arc); - } - else - { - data->UpdateArcModeling(id, arc); - if (parse != Document::FullParse) - { - doc->UpdateToolData(id, data); - } - } - data->AddLengthArc(arc.name(), toMM(arc.GetLength())); - if (parse == Document::FullParse) - { - toolArc = new VModelingArc(doc, data, id, typeCreation); - doc->AddTool(id, toolArc); - doc->IncrementReferens(center); - } - return toolArc; -} - -void VModelingArc::FullUpdateFromFile() -{ - RefreshGeometry(); -} - -void VModelingArc::FullUpdateFromGui(int result) -{ - if (result == QDialog::Accepted) - { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute(AttrCenter, QString().setNum(dialogArc->GetCenter())); - domElement.setAttribute(AttrRadius, dialogArc->GetRadius()); - domElement.setAttribute(AttrAngle1, dialogArc->GetF1()); - domElement.setAttribute(AttrAngle2, dialogArc->GetF2()); - emit FullUpdateTree(); - } - } - dialogArc.clear(); -} - -void VModelingArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - ContextMenu(dialogArc, this, event); -} - -void VModelingArc::AddToFile() -{ - VArc arc = VAbstractTool::data.GetArcModeling(id); - QDomElement domElement = doc->createElement(TagName); - - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrCenter, arc.GetCenter()); - AddAttribute(domElement, AttrRadius, arc.GetFormulaRadius()); - AddAttribute(domElement, AttrAngle1, arc.GetFormulaF1()); - AddAttribute(domElement, AttrAngle2, arc.GetFormulaF2()); - - AddToModeling(domElement); -} - -void VModelingArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - if (event->button() == Qt::LeftButton) - { - emit ChoosedTool(id, Scene::Arc); - } - QGraphicsItem::mouseReleaseEvent(event); -} - -void VModelingArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event) -{ - Q_UNUSED(event); - this->setPen(QPen(currentColor, widthMainLine)); -} - -void VModelingArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) -{ - Q_UNUSED(event); - this->setPen(QPen(currentColor, widthHairLine)); -} - -void VModelingArc::RemoveReferens() -{ - VArc arc = VAbstractTool::data.GetArcModeling(id); - doc->DecrementReferens(arc.GetCenter()); -} - -void VModelingArc::RefreshGeometry() -{ - VArc arc = VAbstractTool::data.GetArcModeling(id); - QPainterPath path; - path.addPath(arc.GetPath()); - path.setFillRule( Qt::WindingFill ); - this->setPath(path); -} diff --git a/src/tools/modelingTools/vmodelingarc.h b/src/tools/modelingTools/vmodelingarc.h deleted file mode 100644 index e32f8f6cf..000000000 --- a/src/tools/modelingTools/vmodelingarc.h +++ /dev/null @@ -1,140 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingarc.h - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef VMODELINGARC_H -#define VMODELINGARC_H - -#include "vmodelingtool.h" -#include -#include "../../dialogs/dialogarc.h" -#include "../../widgets/vcontrolpointspline.h" - -/** - * @brief The VModelingArc class - */ -class VModelingArc :public VModelingTool, public QGraphicsPathItem -{ - Q_OBJECT -public: - /** - * @brief VModelingArc - * @param doc dom document container - * @param data - * @param id - * @param typeCreation - * @param parent - */ - VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, - QGraphicsItem * parent = 0); - /** - * @brief setDialog - */ - virtual void setDialog(); - /** - * @brief Create - * @param dialog - * @param doc dom document container - * @param data - * @return - */ - static VModelingArc* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); - /** - * @brief Create - * @param _id - * @param center - * @param radius - * @param f1 - * @param f2 - * @param doc dom document container - * @param data - * @param parse - * @param typeCreation - * @return - */ - 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, const Tool::Sources &typeCreation); - /** - * @brief TagName - */ - static const QString TagName; - /** - * @brief ToolType - */ - static const QString ToolType; -public slots: - /** - * @brief FullUpdateFromFile - */ - virtual void FullUpdateFromFile(); - /** - * @brief FullUpdateFromGui - * @param result - */ - virtual void FullUpdateFromGui(int result); -protected: - /** - * @brief contextMenuEvent - * @param event - */ - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - /** - * @brief AddToFile - */ - virtual void AddToFile(); - /** - * @brief mouseReleaseEvent - * @param event - */ - virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); - /** - * @brief hoverMoveEvent - * @param event - */ - virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); - /** - * @brief hoverLeaveEvent - * @param event - */ - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); - /** - * @brief RemoveReferens - */ - virtual void RemoveReferens(); -private: - /** - * @brief dialogArc - */ - QSharedPointer dialogArc; - /** - * @brief RefreshGeometry - */ - void RefreshGeometry(); -}; - -#endif // VMODELINGARC_H diff --git a/src/tools/modelingTools/vmodelingbisector.cpp b/src/tools/modelingTools/vmodelingbisector.cpp deleted file mode 100644 index ccb3266af..000000000 --- a/src/tools/modelingTools/vmodelingbisector.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingbisector.cpp - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "vmodelingbisector.h" -#include "../drawTools/vtoolbisector.h" -#include "../../container/calculator.h" - -const QString VModelingBisector::ToolType = QStringLiteral("bisector"); - -VModelingBisector::VModelingBisector(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const qint64 &thirdPointId, const Tool::Sources &typeCreation, - QGraphicsItem *parent) - :VModelingLinePoint(doc, data, id, typeLine, formula, secondPointId, 0, parent), firstPointId(0), - thirdPointId(0), dialogBisector(QSharedPointer()) -{ - this->firstPointId = firstPointId; - this->thirdPointId = thirdPointId; - - if (typeCreation == Tool::FromGui) - { - AddToFile(); - } -} - -void VModelingBisector::setDialog() -{ - Q_ASSERT(dialogBisector.isNull() == false); - VPointF p = VAbstractTool::data.GetPointModeling(id); - dialogBisector->setTypeLine(typeLine); - dialogBisector->setFormula(formula); - dialogBisector->setFirstPointId(firstPointId, id); - dialogBisector->setSecondPointId(basePointId, id); - dialogBisector->setThirdPointId(thirdPointId, id); - dialogBisector->setPointName(p.name()); -} - -VModelingBisector *VModelingBisector::Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data) -{ - QString formula = dialog->getFormula(); - qint64 firstPointId = dialog->getFirstPointId(); - qint64 secondPointId = dialog->getSecondPointId(); - qint64 thirdPointId = dialog->getThirdPointId(); - QString typeLine = dialog->getTypeLine(); - QString pointName = dialog->getPointName(); - return Create(0, formula, firstPointId, secondPointId, thirdPointId, typeLine, pointName, 5, 10, doc, - data, Document::FullParse, Tool::FromGui); -} - -VModelingBisector *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, - const Tool::Sources &typeCreation) -{ - VModelingBisector *point = 0; - VPointF firstPoint = data->GetPointModeling(firstPointId); - VPointF secondPoint = data->GetPointModeling(secondPointId); - VPointF thirdPoint = data->GetPointModeling(thirdPointId); - - Calculator cal(data); - QString errorMsg; - qreal result = cal.eval(formula, &errorMsg); - if (errorMsg.isEmpty()) - { - QPointF fPoint = VToolBisector::FindPoint(firstPoint.toQPointF(), secondPoint.toQPointF(), - thirdPoint.toQPointF(), toPixel(result)); - qint64 id = _id; - if (typeCreation == Tool::FromGui) - { - id = data->AddPointModeling(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); - } - else - { - data->UpdatePointModeling(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); - if (parse != Document::FullParse) - { - doc->UpdateToolData(id, data); - } - } - data->AddLine(firstPointId, id, Draw::Modeling); - if (parse == Document::FullParse) - { - point = new VModelingBisector(doc, data, id, typeLine, formula, firstPointId, secondPointId, - thirdPointId, typeCreation); - doc->AddTool(id, point); - doc->IncrementReferens(firstPointId); - doc->IncrementReferens(secondPointId); - doc->IncrementReferens(thirdPointId); - } - } - return point; -} - -void VModelingBisector::FullUpdateFromFile() -{ - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - typeLine = domElement.attribute(AttrTypeLine, ""); - formula = domElement.attribute(AttrLength, ""); - firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); - basePointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); - thirdPointId = domElement.attribute(AttrThirdPoint, "").toLongLong(); - } - RefreshGeometry(); -} - -void VModelingBisector::FullUpdateFromGui(int result) -{ - if (result == QDialog::Accepted) - { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute(AttrName, dialogBisector->getPointName()); - domElement.setAttribute(AttrTypeLine, dialogBisector->getTypeLine()); - domElement.setAttribute(AttrLength, dialogBisector->getFormula()); - domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogBisector->getFirstPointId())); - domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogBisector->getSecondPointId())); - domElement.setAttribute(AttrThirdPoint, QString().setNum(dialogBisector->getThirdPointId())); - emit FullUpdateTree(); - } - } - dialogBisector.clear(); -} - -void VModelingBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - ContextMenu(dialogBisector, this, event); -} - -void VModelingBisector::AddToFile() -{ - VPointF point = VAbstractTool::data.GetPointModeling(id); - QDomElement domElement = doc->createElement(TagName); - - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point.name()); - AddAttribute(domElement, AttrMx, toMM(point.mx())); - AddAttribute(domElement, AttrMy, toMM(point.my())); - - AddAttribute(domElement, AttrTypeLine, typeLine); - AddAttribute(domElement, AttrLength, formula); - AddAttribute(domElement, AttrFirstPoint, firstPointId); - AddAttribute(domElement, AttrSecondPoint, basePointId); - AddAttribute(domElement, AttrThirdPoint, thirdPointId); - - AddToModeling(domElement); -} - -void VModelingBisector::RemoveReferens() -{ - doc->DecrementReferens(firstPointId); - doc->DecrementReferens(thirdPointId); - VModelingLinePoint::RemoveReferens(); -} diff --git a/src/tools/modelingTools/vmodelingbisector.h b/src/tools/modelingTools/vmodelingbisector.h deleted file mode 100644 index 21b83161e..000000000 --- a/src/tools/modelingTools/vmodelingbisector.h +++ /dev/null @@ -1,137 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingbisector.h - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef VMODELINGBISECTOR_H -#define VMODELINGBISECTOR_H - -#include "vmodelinglinepoint.h" -#include "../../dialogs/dialogbisector.h" - -/** - * @brief The VModelingBisector class - */ -class VModelingBisector : public VModelingLinePoint -{ - Q_OBJECT -public: - /** - * @brief VModelingBisector - * @param doc dom document container - * @param data - * @param id - * @param typeLine - * @param formula - * @param firstPointId - * @param secondPointId - * @param thirdPointId - * @param typeCreation - * @param parent - */ - VModelingBisector(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, - const qint64 &firstPointId, const qint64 &secondPointId, - const qint64 &thirdPointId, const Tool::Sources &typeCreation, - QGraphicsItem * parent = 0); - /** - * @brief setDialog - */ - virtual void setDialog(); - /** - * @brief Create - * @param dialog - * @param doc dom document container - * @param data - * @return - */ - static VModelingBisector* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); - /** - * @brief Create - * @param _id - * @param formula - * @param firstPointId - * @param secondPointId - * @param thirdPointId - * @param typeLine - * @param pointName - * @param mx - * @param my - * @param doc dom document container - * @param data - * @param parse - * @param typeCreation - * @return - */ - 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, - const Tool::Sources &typeCreation); - /** - * @brief ToolType - */ - static const QString ToolType; -public slots: - /** - * @brief FullUpdateFromFile - */ - virtual void FullUpdateFromFile(); - /** - * @brief FullUpdateFromGui - * @param result - */ - virtual void FullUpdateFromGui(int result); -protected: - /** - * @brief contextMenuEvent - * @param event - */ - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - /** - * @brief AddToFile - */ - virtual void AddToFile(); - /** - * @brief RemoveReferens - */ - virtual void RemoveReferens(); -private: - /** - * @brief firstPointId - */ - qint64 firstPointId; - /** - * @brief thirdPointId - */ - qint64 thirdPointId; - /** - * @brief dialogBisector - */ - QSharedPointer dialogBisector; -}; - -#endif // VMODELINGBISECTOR_H diff --git a/src/tools/modelingTools/vmodelingcutspline.cpp b/src/tools/modelingTools/vmodelingcutspline.cpp deleted file mode 100644 index b6c0dbc36..000000000 --- a/src/tools/modelingTools/vmodelingcutspline.cpp +++ /dev/null @@ -1,239 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingcutspline.cpp - ** @author Roman Telezhinsky - ** @date 15 12, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "vmodelingcutspline.h" -#include "../../container/calculator.h" - -const QString VModelingCutSpline::ToolType = QStringLiteral("cutSpline"); -const QString VModelingCutSpline::AttrSpline = QStringLiteral("spline"); - -VModelingCutSpline::VModelingCutSpline(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &formula, const qint64 &splineId, const qint64 &spl1id, - const qint64 &spl2id, const Tool::Sources &typeCreation, QGraphicsItem *parent) - :VModelingPoint(doc, data, id, parent), formula(formula), splineId(splineId), - dialogCutSpline(QSharedPointer()), firstSpline(), secondSpline(), spl1id(spl1id), spl2id(spl2id) -{ - Q_ASSERT_X(splineId > 0, Q_FUNC_INFO, "splineId <= 0"); - Q_ASSERT_X(spl1id > 0, Q_FUNC_INFO, "spl1id <= 0"); - Q_ASSERT_X(spl2id > 0, Q_FUNC_INFO, "spl2id <= 0"); - - firstSpline = new VSimpleSpline(spl1id, ¤tColor); - Q_ASSERT(firstSpline != 0); - RefreshSpline(firstSpline, spl1id, SimpleSpline::ForthPoint); - firstSpline->setParentItem(this); - connect(firstSpline, &VSimpleSpline::Choosed, this, &VModelingCutSpline::SplineChoosed); - - secondSpline = new VSimpleSpline(spl2id, ¤tColor); - Q_ASSERT(secondSpline != 0); - RefreshSpline(secondSpline, spl2id, SimpleSpline::FirstPoint); - secondSpline->setParentItem(this); - connect(secondSpline, &VSimpleSpline::Choosed, this, &VModelingCutSpline::SplineChoosed); - if (typeCreation == Tool::FromGui) - { - AddToFile(); - } -} - -void VModelingCutSpline::setDialog() -{ - Q_ASSERT(dialogCutSpline.isNull() == false); - VPointF point = VAbstractTool::data.GetPointModeling(id); - dialogCutSpline->setFormula(formula); - dialogCutSpline->setSplineId(splineId, id); - dialogCutSpline->setPointName(point.name()); -} - -VModelingCutSpline *VModelingCutSpline::Create(QSharedPointer &dialog, - VDomDocument *doc, VContainer *data) -{ - QString pointName = dialog->getPointName(); - QString formula = dialog->getFormula(); - qint64 splineId = dialog->getSplineId(); - return Create(0, pointName, formula, splineId, 5, 10, doc, data, Document::FullParse, Tool::FromGui); -} - -VModelingCutSpline *VModelingCutSpline::Create(const qint64 _id, const QString &pointName, const QString &formula, - const qint64 &splineId, const qreal &mx, const qreal &my, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation) -{ - VModelingCutSpline *cutPoint = 0; - VSpline spl = data->GetSplineModeling(splineId); - Calculator cal(data); - QString errorMsg; - qreal result = cal.eval(formula, &errorMsg); - if (errorMsg.isEmpty()) - { - QPointF spl1p2, spl1p3, spl2p2, spl2p3; - QPointF point = spl.CutSpline(toPixel(result), spl1p2, spl1p3, spl2p2, spl2p3); - - qint64 splP1id, splP4id; - Draw::Draws typeObject = spl.getMode(); - if (typeObject == Draw::Calculation) - { - splP1id = data->PointConvertToModeling(spl.GetP1()); - splP4id = data->PointConvertToModeling(spl.GetP4()); - if (parse == Document::FullParse) - { - doc->IncrementReferens(splP1id); - doc->IncrementReferens(splP4id); - } - } - else - { - splP1id = spl.GetP1(); - splP4id = spl.GetP4(); - } - - qint64 id = _id; - qint64 spl1id = 0; - qint64 spl2id = 0; - if (typeCreation == Tool::FromGui) - { - id = data->AddPointModeling(VPointF(point.x(), point.y(), pointName, mx, my)); - - VSpline spline1 = VSpline(data->DataPointsModeling(), splP1id, spl1p2, spl1p3, id, spl.GetKcurve()); - spl1id = data->AddSplineModeling(spline1); - data->AddLengthSpline(spline1.name(), toMM(spline1.GetLength())); - - VSpline spline2 = VSpline(data->DataPointsModeling(), id, spl2p2, spl2p3, splP4id, spl.GetKcurve()); - spl2id = data->AddSplineModeling(spline2); - data->AddLengthSpline(spline2.name(), toMM(spline2.GetLength())); - } - else - { - data->UpdatePointModeling(id, VPointF(point.x(), point.y(), pointName, mx, my)); - - spl1id = id + 1; - spl2id = id + 2; - - VSpline spline1 = VSpline(data->DataPointsModeling(), splP1id, spl1p2, spl1p3, id, spl.GetKcurve()); - data->UpdateSplineModeling(spl1id, spline1); - data->AddLengthSpline(spline1.name(), toMM(spline1.GetLength())); - - VSpline spline2 = VSpline(data->DataPointsModeling(), id, spl2p2, spl2p3, splP4id, spl.GetKcurve()); - data->UpdateSplineModeling(spl2id, spline2); - data->AddLengthSpline(spline2.name(), toMM(spline2.GetLength())); - - if (parse != Document::FullParse) - { - doc->UpdateToolData(id, data); - } - } - //VDrawTool::AddRecord(id, Tool::CutSplineTool, doc); - if (parse == Document::FullParse) - { - cutPoint = new VModelingCutSpline(doc, data, id, formula, splineId, spl1id, spl2id, typeCreation); - - doc->AddTool(id, cutPoint); - doc->AddTool(spl1id, cutPoint); - doc->AddTool(spl2id, cutPoint); - doc->IncrementReferens(splineId); - } - } - return cutPoint; -} - -void VModelingCutSpline::FullUpdateFromFile() -{ - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - formula = domElement.attribute(AttrLength, ""); - splineId = domElement.attribute(AttrSpline, "").toLongLong(); - } - RefreshGeometry(); -} - -void VModelingCutSpline::FullUpdateFromGui(int result) -{ - if (result == QDialog::Accepted) - { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute(AttrName, dialogCutSpline->getPointName()); - domElement.setAttribute(AttrLength, dialogCutSpline->getFormula()); - domElement.setAttribute(AttrSpline, QString().setNum(dialogCutSpline->getSplineId())); - emit FullUpdateTree(); - } - } - dialogCutSpline.clear(); -} - -void VModelingCutSpline::SplineChoosed(qint64 id) -{ - emit ChoosedTool(id, Scene::Spline); -} - -void VModelingCutSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - ContextMenu(dialogCutSpline, this, event); -} - -void VModelingCutSpline::AddToFile() -{ - VPointF point = VAbstractTool::data.GetPointModeling(id); - QDomElement domElement = doc->createElement(TagName); - - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point.name()); - AddAttribute(domElement, AttrMx, toMM(point.mx())); - AddAttribute(domElement, AttrMy, toMM(point.my())); - - AddAttribute(domElement, AttrLength, formula); - AddAttribute(domElement, AttrSpline, splineId); - - AddToModeling(domElement); -} - -void VModelingCutSpline::RefreshGeometry() -{ - RefreshSpline(firstSpline, spl1id, SimpleSpline::ForthPoint); - RefreshSpline(secondSpline, spl2id, SimpleSpline::FirstPoint); - VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetPointModeling(id)); -} - - -void VModelingCutSpline::RefreshSpline(VSimpleSpline *spline, qint64 splid, SimpleSpline::Translation tr) -{ - VSpline spl = VModelingTool::data.GetSplineModeling(splid); - QPainterPath path; - path.addPath(spl.GetPath()); - path.setFillRule( Qt::WindingFill ); - if(tr == SimpleSpline::FirstPoint) - { - path.translate(-spl.GetPointP1().toQPointF().x(), -spl.GetPointP1().toQPointF().y()); - } - else - { - path.translate(-spl.GetPointP4().toQPointF().x(), -spl.GetPointP4().toQPointF().y()); - } - spline->setPath(path); -} diff --git a/src/tools/modelingTools/vmodelingcutspline.h b/src/tools/modelingTools/vmodelingcutspline.h deleted file mode 100644 index 60d9e4c1a..000000000 --- a/src/tools/modelingTools/vmodelingcutspline.h +++ /dev/null @@ -1,130 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingcutspline.h - ** @author Roman Telezhinsky - ** @date 15 12, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef VMODELINGCUTSPLINE_H -#define VMODELINGCUTSPLINE_H - -#include "vmodelingpoint.h" -#include "../../dialogs/dialogcutspline.h" -#include "../../widgets/vsimplespline.h" - -class VModelingCutSpline: public VModelingPoint -{ - Q_OBJECT -public: - VModelingCutSpline(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &formula, - const qint64 &splineId, const qint64 &spl1id, const qint64 &spl2id, - const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); - /** - * @brief setDialog - */ - virtual void setDialog(); - /** - * @brief Create - * @param dialog - * @param scene - * @param doc dom document container - * @param data - */ - static VModelingCutSpline* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); - /** - * @brief Create - * @param _id - * @param pointName - * @param formula - * @param splineId - * @param mx - * @param my - * @param scene - * @param doc dom document container - * @param data - * @param parse - * @param typeCreation - */ - static VModelingCutSpline* Create(const qint64 _id, const QString &pointName, const QString &formula, - const qint64 &splineId, const qreal &mx, const qreal &my, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation); - /** - * @brief ToolType - */ - static const QString ToolType; - static const QString AttrSpline; -public slots: - /** - * @brief FullUpdateFromFile - */ - virtual void FullUpdateFromFile(); - /** - * @brief FullUpdateFromGui - * @param result - */ - virtual void FullUpdateFromGui(int result); - /** - * @brief SplineChoosed - * @param id - */ - void SplineChoosed(qint64 id); -protected: - /** - * @brief contextMenuEvent - * @param event - */ - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - /** - * @brief AddToFile - */ - virtual void AddToFile(); - void RefreshGeometry(); -private: - /** - * @brief formula keep formula of length - */ - QString formula; - /** - * @brief splineId keep id of spline - */ - qint64 splineId; - /** - * @brief DialogCutSpline pointer to the tool's dialog - */ - QSharedPointer dialogCutSpline; - /** - * @brief firstSpline - */ - VSimpleSpline *firstSpline; - /** - * @brief secondSpline - */ - VSimpleSpline *secondSpline; - const qint64 spl1id; - const qint64 spl2id; - void RefreshSpline(VSimpleSpline *spline, qint64 splid, SimpleSpline::Translation tr); -}; - -#endif // VMODELINGCUTSPLINE_H diff --git a/src/tools/modelingTools/vmodelingcutsplinepath.cpp b/src/tools/modelingTools/vmodelingcutsplinepath.cpp deleted file mode 100644 index e2536de86..000000000 --- a/src/tools/modelingTools/vmodelingcutsplinepath.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingcutsplinepath.cpp - ** @author Roman Telezhinsky - ** @date 15 12, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "vmodelingcutsplinepath.h" - -const QString VModelingCutSplinePath::ToolType = QStringLiteral("cutSplinePath"); -const QString VModelingCutSplinePath::AttrSplinePath = QStringLiteral("splinePath"); - -VModelingCutSplinePath::VModelingCutSplinePath(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &formula, const qint64 &splinePathId, - const Tool::Sources &typeCreation, QGraphicsItem *parent) - :VModelingPoint(doc, data, id, parent), formula(formula), splinePathId(splinePathId), - dialogCutSplinePath(QSharedPointer()) -{ - Q_ASSERT_X(splinePathId > 0, Q_FUNC_INFO, "splinePathId <= 0"); - if (typeCreation == Tool::FromGui) - { - AddToFile(); - } -} - -void VModelingCutSplinePath::setDialog() -{ - Q_ASSERT(dialogCutSplinePath.isNull() == false); - VSplinePath splPath = VAbstractTool::data.GetSplinePath(id); - dialogCutSplinePath->setFormula(formula); - dialogCutSplinePath->setSplinePathId(splinePathId, id); - dialogCutSplinePath->setPointName(splPath.name()); -} - -VModelingCutSplinePath *VModelingCutSplinePath::Create(QSharedPointer &dialog, - VDomDocument *doc, VContainer *data) -{ - QString pointName = dialog->getPointName(); - QString formula = dialog->getFormula(); - qint64 splinePathId = dialog->getSplinePathId(); - return Create(0, pointName, formula, splinePathId, 5, 10, doc, data, Document::FullParse, Tool::FromGui); -} - -VModelingCutSplinePath *VModelingCutSplinePath::Create(const qint64 _id, const QString &pointName, - const QString &formula, const qint64 &splinePathId, - const qreal &mx, const qreal &my, - VDomDocument *doc, VContainer *data, - const Document::Documents &parse, - const Tool::Sources &typeCreation) -{ - -} - -void VModelingCutSplinePath::FullUpdateFromFile() -{ - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - formula = domElement.attribute(AttrLength, ""); - splinePathId = domElement.attribute(AttrSplinePath, "").toLongLong(); - } - RefreshGeometry(); -} - -void VModelingCutSplinePath::FullUpdateFromGui(int result) -{ - if (result == QDialog::Accepted) - { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute(AttrName, dialogCutSplinePath->getPointName()); - domElement.setAttribute(AttrLength, dialogCutSplinePath->getFormula()); - domElement.setAttribute(AttrSplinePath, QString().setNum(dialogCutSplinePath->getSplinePathId())); - emit FullUpdateTree(); - } - } - dialogCutSplinePath.clear(); -} - -void VModelingCutSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - ContextMenu(dialogCutSplinePath, this, event); -} - -void VModelingCutSplinePath::AddToFile() -{ - VPointF point = VAbstractTool::data.GetPointModeling(id); - QDomElement domElement = doc->createElement(TagName); - - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrName, point.name()); - AddAttribute(domElement, AttrMx, toMM(point.mx())); - AddAttribute(domElement, AttrMy, toMM(point.my())); - - AddAttribute(domElement, AttrLength, formula); - AddAttribute(domElement, AttrSplinePath, splinePathId); - - AddToModeling(domElement); -} - -void VModelingCutSplinePath::RefreshGeometry() -{ - VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetPointModeling(id)); -} diff --git a/src/tools/modelingTools/vmodelingcutsplinepath.h b/src/tools/modelingTools/vmodelingcutsplinepath.h deleted file mode 100644 index 10d5e13a1..000000000 --- a/src/tools/modelingTools/vmodelingcutsplinepath.h +++ /dev/null @@ -1,113 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingcutsplinepath.h - ** @author Roman Telezhinsky - ** @date 15 12, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef VMODELINGCUTSPLINEPATH_H -#define VMODELINGCUTSPLINEPATH_H - -#include "vmodelingpoint.h" -#include "../../dialogs/dialogcutsplinepath.h" - -class VModelingCutSplinePath : public VModelingPoint -{ - Q_OBJECT -public: - VModelingCutSplinePath(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &formula, - const qint64 &splinePathId, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); - /** - * @brief setDialog - */ - virtual void setDialog(); - /** - * @brief Create - * @param dialog - * @param scene - * @param doc dom document container - * @param data - */ - static VModelingCutSplinePath* Create(QSharedPointer &dialog, - VDomDocument *doc, VContainer *data); - /** - * @brief Create - * @param _id - * @param pointName - * @param formula - * @param splineId - * @param mx - * @param my - * @param scene - * @param doc dom document container - * @param data - * @param parse - * @param typeCreation - */ - static VModelingCutSplinePath* Create(const qint64 _id, const QString &pointName, const QString &formula, - const qint64 &splinePathId, const qreal &mx, const qreal &my, - VDomDocument *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation); - /** - * @brief ToolType - */ - static const QString ToolType; - static const QString AttrSplinePath; -public slots: - /** - * @brief FullUpdateFromFile - */ - virtual void FullUpdateFromFile(); - /** - * @brief FullUpdateFromGui - * @param result - */ - virtual void FullUpdateFromGui(int result); -protected: - /** - * @brief contextMenuEvent - * @param event - */ - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - /** - * @brief AddToFile - */ - virtual void AddToFile(); - void RefreshGeometry(); -private: - /** - * @brief formula keep formula of length - */ - QString formula; - /** - * @brief splineId keep id of spline - */ - qint64 splinePathId; - /** - * @brief DialogCutSpline pointer to the tool's dialog - */ - QSharedPointer dialogCutSplinePath; -}; - -#endif // VMODELINGCUTSPLINEPATH_H diff --git a/src/tools/modelingTools/vmodelingendline.cpp b/src/tools/modelingTools/vmodelingendline.cpp deleted file mode 100644 index 26ae9ec22..000000000 --- a/src/tools/modelingTools/vmodelingendline.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingendline.cpp - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "vmodelingendline.h" -#include "../../container/calculator.h" - -const QString VModelingEndLine::ToolType = QStringLiteral("endLine"); - -VModelingEndLine::VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, const qreal &angle, - const qint64 &basePointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) - :VModelingLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent), - dialogEndLine(QSharedPointer()) -{ - if (typeCreation == Tool::FromGui) - { - AddToFile(); - } -} - -void VModelingEndLine::setDialog() -{ - Q_ASSERT(dialogEndLine.isNull() == false); - VPointF p = VAbstractTool::data.GetPointModeling(id); - dialogEndLine->setTypeLine(typeLine); - dialogEndLine->setFormula(formula); - dialogEndLine->setAngle(angle); - dialogEndLine->setBasePointId(basePointId, id); - dialogEndLine->setPointName(p.name()); -} - -VModelingEndLine *VModelingEndLine::Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data) -{ - QString pointName = dialog->getPointName(); - QString typeLine = dialog->getTypeLine(); - QString formula = dialog->getFormula(); - qreal angle = dialog->getAngle(); - qint64 basePointId = dialog->getBasePointId(); - return Create(0, pointName, typeLine, formula, angle, basePointId, 5, 10, doc, data, Document::FullParse, - Tool::FromGui); -} - -VModelingEndLine *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, const Tool::Sources &typeCreation) -{ - VModelingEndLine *point = 0; - VPointF basePoint = data->GetPointModeling(basePointId); - QLineF line = QLineF(basePoint.toQPointF(), QPointF(basePoint.x()+100, basePoint.y())); - Calculator cal(data); - QString errorMsg; - qreal result = cal.eval(formula, &errorMsg); - if (errorMsg.isEmpty()) - { - line.setLength(toPixel(result)); - line.setAngle(angle); - qint64 id = _id; - if (typeCreation == Tool::FromGui) - { - id = data->AddPointModeling(VPointF(line.p2().x(), line.p2().y(), pointName, mx, my)); - } - else - { - data->UpdatePointModeling(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my)); - if (parse != Document::FullParse) - { - doc->UpdateToolData(id, data); - } - } - data->AddLine(basePointId, id, Draw::Modeling); - if (parse == Document::FullParse) - { - point = new VModelingEndLine(doc, data, id, typeLine, formula, angle, basePointId, typeCreation); - doc->AddTool(id, point); - doc->IncrementReferens(basePointId); - } - } - return point; -} - -void VModelingEndLine::FullUpdateFromFile() -{ - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - typeLine = domElement.attribute(AttrTypeLine, ""); - formula = domElement.attribute(AttrLength, ""); - basePointId = domElement.attribute(AttrBasePoint, "").toLongLong(); - angle = domElement.attribute(AttrAngle, "").toDouble(); - } - RefreshGeometry(); -} - -void VModelingEndLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - ContextMenu(dialogEndLine, this, event); -} - -void VModelingEndLine::FullUpdateFromGui(int result) -{ - if (result == QDialog::Accepted) - { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute(AttrName, dialogEndLine->getPointName()); - domElement.setAttribute(AttrTypeLine, dialogEndLine->getTypeLine()); - domElement.setAttribute(AttrLength, dialogEndLine->getFormula()); - domElement.setAttribute(AttrAngle, QString().setNum(dialogEndLine->getAngle())); - domElement.setAttribute(AttrBasePoint, QString().setNum(dialogEndLine->getBasePointId())); - emit FullUpdateTree(); - } - } - dialogEndLine.clear(); -} - -void VModelingEndLine::AddToFile() -{ - VPointF point = VAbstractTool::data.GetPointModeling(id); - QDomElement domElement = doc->createElement(TagName); - - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point.name()); - AddAttribute(domElement, AttrMx, toMM(point.mx())); - AddAttribute(domElement, AttrMy, toMM(point.my())); - - AddAttribute(domElement, AttrTypeLine, typeLine); - AddAttribute(domElement, AttrLength, formula); - AddAttribute(domElement, AttrAngle, angle); - AddAttribute(domElement, AttrBasePoint, basePointId); - - AddToModeling(domElement); -} diff --git a/src/tools/modelingTools/vmodelingendline.h b/src/tools/modelingTools/vmodelingendline.h deleted file mode 100644 index f22ab5bf5..000000000 --- a/src/tools/modelingTools/vmodelingendline.h +++ /dev/null @@ -1,121 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingbisector.h - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef VMODELINGENDLINE_H -#define VMODELINGENDLINE_H - -#include "vmodelinglinepoint.h" -#include "../../dialogs/dialogendline.h" - -/** - * @brief The VModelingEndLine class - */ -class VModelingEndLine : public VModelingLinePoint -{ - Q_OBJECT -public: - /** - * @brief VModelingEndLine - * @param doc dom document container - * @param data - * @param id - * @param typeLine - * @param formula - * @param angle - * @param basePointId - * @param typeCreation - * @param parent - */ - VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, const qreal &angle, - const qint64 &basePointId, const Tool::Sources &typeCreation, - QGraphicsItem * parent = 0); - /** - * @brief setDialog - */ - virtual void setDialog(); - /** - * @brief Create - * @param dialog - * @param doc dom document container - * @param data - * @return - */ - static VModelingEndLine* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); - /** - * @brief Create - * @param _id - * @param pointName - * @param typeLine - * @param formula - * @param angle - * @param basePointId - * @param mx - * @param my - * @param doc dom document container - * @param data - * @param parse - * @param typeCreation - * @return - */ - 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, const Tool::Sources &typeCreation); - /** - * @brief ToolType - */ - static const QString ToolType; -public slots: - /** - * @brief FullUpdateFromFile - */ - virtual void FullUpdateFromFile(); - /** - * @brief FullUpdateFromGui - * @param result - */ - virtual void FullUpdateFromGui(int result); -protected: - /** - * @brief contextMenuEvent - * @param event - */ - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - /** - * @brief AddToFile - */ - virtual void AddToFile(); -private: - /** - * @brief dialogEndLine - */ - QSharedPointer dialogEndLine; -}; - -#endif // VMODELINGENDLINE_H diff --git a/src/tools/modelingTools/vmodelingheight.cpp b/src/tools/modelingTools/vmodelingheight.cpp deleted file mode 100644 index 99eeab418..000000000 --- a/src/tools/modelingTools/vmodelingheight.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingheight.cpp - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "vmodelingheight.h" -#include "../drawTools/vtoolheight.h" - -const QString VModelingHeight::ToolType = QStringLiteral("height"); - -VModelingHeight::VModelingHeight(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const qint64 &basePointId, const qint64 &p1LineId, - const qint64 &p2LineId, const Tool::Sources &typeCreation, - QGraphicsItem * parent) - :VModelingLinePoint(doc, data, id, typeLine, QString(), basePointId, 0, parent), - dialogHeight(QSharedPointer()), p1LineId(p1LineId), p2LineId(p2LineId) -{ - ignoreFullUpdate = true; - if (typeCreation == Tool::FromGui) - { - AddToFile(); - } -} - -void VModelingHeight::setDialog() -{ - Q_ASSERT(dialogHeight.isNull() == false); - VPointF p = VAbstractTool::data.GetPointModeling(id); - dialogHeight->setTypeLine(typeLine); - dialogHeight->setBasePointId(basePointId, id); - dialogHeight->setP1LineId(p1LineId, id); - dialogHeight->setP2LineId(p2LineId, id); - dialogHeight->setPointName(p.name()); -} - -VModelingHeight *VModelingHeight::Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data) -{ - disconnect(doc, &VDomDocument::FullUpdateFromFile, dialog.data(), &DialogHeight::UpdateList); - QString pointName = dialog->getPointName(); - QString typeLine = dialog->getTypeLine(); - qint64 basePointId = dialog->getBasePointId(); - qint64 p1LineId = dialog->getP1LineId(); - qint64 p2LineId = dialog->getP2LineId(); - return Create(0, pointName, typeLine, basePointId, p1LineId, p2LineId, 5, 10, doc, data, - Document::FullParse, Tool::FromGui); -} - -VModelingHeight *VModelingHeight::Create(const qint64 _id, const QString &pointName, const QString &typeLine, - const qint64 &basePointId, const qint64 &p1LineId, - const qint64 &p2LineId, const qreal &mx, const qreal &my, - VDomDocument *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation) -{ - VModelingHeight *point = 0; - VPointF basePoint = data->GetPointModeling(basePointId); - VPointF p1Line = data->GetPointModeling(p1LineId); - VPointF p2Line = data->GetPointModeling(p2LineId); - - QPointF pHeight = VToolHeight::FindPoint(QLineF(p1Line.toQPointF(), p2Line.toQPointF()), - basePoint.toQPointF()); - QLineF line = QLineF(basePoint.toQPointF(), pHeight); - qint64 id = _id; - if (typeCreation == Tool::FromGui) - { - id = data->AddPointModeling(VPointF(line.p2().x(), line.p2().y(), pointName, mx, my)); - } - else - { - data->UpdatePointModeling(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my)); - if (parse != Document::FullParse) - { - doc->UpdateToolData(id, data); - } - } - data->AddLine(basePointId, id, Draw::Modeling); - if (parse == Document::FullParse) - { - point = new VModelingHeight(doc, data, id, typeLine, basePointId, p1LineId, p2LineId, typeCreation); - doc->AddTool(id, point); - doc->IncrementReferens(basePointId); - doc->IncrementReferens(p1LineId); - doc->IncrementReferens(p2LineId); - } - return point; -} - -void VModelingHeight::FullUpdateFromFile() -{ - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - typeLine = domElement.attribute(AttrTypeLine, ""); - basePointId = domElement.attribute(AttrBasePoint, "").toLongLong(); - p1LineId = domElement.attribute(AttrP1Line, "").toLongLong(); - p2LineId = domElement.attribute(AttrP2Line, "").toLongLong(); - } - RefreshGeometry(); -} - -void VModelingHeight::FullUpdateFromGui(int result) -{ - if (result == QDialog::Accepted) - { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute(AttrName, dialogHeight->getPointName()); - domElement.setAttribute(AttrTypeLine, dialogHeight->getTypeLine()); - domElement.setAttribute(AttrBasePoint, QString().setNum(dialogHeight->getBasePointId())); - domElement.setAttribute(AttrP1Line, QString().setNum(dialogHeight->getP1LineId())); - domElement.setAttribute(AttrP2Line, QString().setNum(dialogHeight->getP2LineId())); - emit FullUpdateTree(); - } - } - dialogHeight.clear(); -} - -void VModelingHeight::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - ContextMenu(dialogHeight, this, event); -} - -void VModelingHeight::AddToFile() -{ - VPointF point = VAbstractTool::data.GetPointModeling(id); - QDomElement domElement = doc->createElement(TagName); - - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point.name()); - AddAttribute(domElement, AttrMx, toMM(point.mx())); - AddAttribute(domElement, AttrMy, toMM(point.my())); - - AddAttribute(domElement, AttrTypeLine, typeLine); - AddAttribute(domElement, AttrBasePoint, basePointId); - AddAttribute(domElement, AttrP1Line, p1LineId); - AddAttribute(domElement, AttrP2Line, p2LineId); - - AddToModeling(domElement); -} diff --git a/src/tools/modelingTools/vmodelingheight.h b/src/tools/modelingTools/vmodelingheight.h deleted file mode 100644 index d89f5a4d9..000000000 --- a/src/tools/modelingTools/vmodelingheight.h +++ /dev/null @@ -1,129 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingheight.h - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef VMODELINGHEIGHT_H -#define VMODELINGHEIGHT_H - -#include "vmodelinglinepoint.h" -#include "../../dialogs/dialogheight.h" - -/** - * @brief The VModelingHeight class - */ -class VModelingHeight : public VModelingLinePoint -{ - Q_OBJECT -public: - /** - * @brief VModelingHeight - * @param doc dom document container - * @param data - * @param id - * @param typeLine - * @param basePointId - * @param p1LineId - * @param p2LineId - * @param typeCreation - * @param parent - */ - VModelingHeight(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const qint64 &basePointId, const qint64 &p1LineId, - const qint64 &p2LineId, const Tool::Sources &typeCreation, - QGraphicsItem * parent = 0); - /** - * @brief setDialog - */ - virtual void setDialog(); - /** - * @brief Create - * @param dialog - * @param doc dom document container - * @param data - * @return - */ - static VModelingHeight* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); - /** - * @brief Create - * @param _id - * @param pointName - * @param typeLine - * @param basePointId - * @param p1LineId - * @param p2LineId - * @param mx - * @param my - * @param doc dom document container - * @param data - * @param parse - * @param typeCreation - * @return - */ - static VModelingHeight* Create(const qint64 _id, const QString &pointName, const QString &typeLine, - const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, - const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation); - /** - * @brief ToolType - */ - static const QString ToolType; -public slots: - /** - * @brief FullUpdateFromFile - */ - virtual void FullUpdateFromFile(); - /** - * @brief FullUpdateFromGui - * @param result - */ - virtual void FullUpdateFromGui(int result); -protected: - /** - * @brief contextMenuEvent - * @param event - */ - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - /** - * @brief AddToFile - */ - virtual void AddToFile(); -private: - /** - * @brief dialogHeight - */ - QSharedPointer dialogHeight; - /** - * @brief p1LineId - */ - qint64 p1LineId; - /** - * @brief p2LineId - */ - qint64 p2LineId; -}; - -#endif // VMODELINGHEIGHT_H diff --git a/src/tools/modelingTools/vmodelingline.cpp b/src/tools/modelingTools/vmodelingline.cpp deleted file mode 100644 index 3ae98a59f..000000000 --- a/src/tools/modelingTools/vmodelingline.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingline.cpp - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "vmodelingline.h" - -const QString VModelingLine::TagName = QStringLiteral("line"); - -VModelingLine::VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, - qint64 secondPoint, const Tool::Sources &typeCreation, QGraphicsItem *parent): - VModelingTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), - secondPoint(secondPoint), dialogLine(QSharedPointer()) -{ - ignoreFullUpdate = true; - //Лінія - VPointF first = data->GetPointModeling(firstPoint); - VPointF second = data->GetPointModeling(secondPoint); - this->setLine(QLineF(first.toQPointF(), second.toQPointF())); - this->setFlag(QGraphicsItem::ItemStacksBehindParent, true); - this->setFlag(QGraphicsItem::ItemIsSelectable, true); - this->setAcceptHoverEvents(true); - - if (typeCreation == Tool::FromGui) - { - AddToFile(); - } -} - -void VModelingLine::setDialog() -{ - dialogLine->setFirstPoint(firstPoint); - dialogLine->setSecondPoint(secondPoint); -} - -VModelingLine *VModelingLine::Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data) -{ - qint64 firstPoint = dialog->getFirstPoint(); - qint64 secondPoint = dialog->getSecondPoint(); - return Create(0, firstPoint, secondPoint, doc, data, Document::FullParse, Tool::FromGui); -} - -VModelingLine *VModelingLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation) -{ - VModelingLine *line = 0; - Q_ASSERT(doc != 0); - Q_ASSERT(data != 0); - qint64 id = _id; - if (typeCreation == Tool::FromGui) - { - id = data->getNextId(); - } - else - { - if (parse != Document::FullParse) - { - data->UpdateId(id); - doc->UpdateToolData(id, data); - } - } - data->AddLine(firstPoint, secondPoint, Draw::Modeling); - if (parse == Document::FullParse) - { - line = new VModelingLine(doc, data, id, firstPoint, secondPoint, typeCreation); - doc->AddTool(id, line); - doc->IncrementReferens(firstPoint); - doc->IncrementReferens(secondPoint); - } - return line; -} - -void VModelingLine::FullUpdateFromFile() -{ - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - firstPoint = domElement.attribute(AttrFirstPoint, "").toLongLong(); - secondPoint = domElement.attribute(AttrSecondPoint, "").toLongLong(); - } - VPointF first = VAbstractTool::data.GetPointModeling(firstPoint); - VPointF second = VAbstractTool::data.GetPointModeling(secondPoint); - this->setLine(QLineF(first.toQPointF(), second.toQPointF())); -} - -void VModelingLine::FullUpdateFromGui(int result) -{ - if (result == QDialog::Accepted) - { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogLine->getFirstPoint())); - domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogLine->getSecondPoint())); - emit FullUpdateTree(); - } - } - dialogLine.clear(); -} - -void VModelingLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - ContextMenu(dialogLine, this, event); -} - -void VModelingLine::AddToFile() -{ - QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrFirstPoint, firstPoint); - AddAttribute(domElement, AttrSecondPoint, secondPoint); - - AddToModeling(domElement); -} - -void VModelingLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event) -{ - Q_UNUSED(event); - this->setPen(QPen(currentColor, widthMainLine)); -} - -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/src/tools/modelingTools/vmodelingline.h b/src/tools/modelingTools/vmodelingline.h deleted file mode 100644 index bf9729389..000000000 --- a/src/tools/modelingTools/vmodelingline.h +++ /dev/null @@ -1,139 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingline.h - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef VMODELINGLINE_H -#define VMODELINGLINE_H - -#include "vmodelingtool.h" -#include -#include "../../dialogs/dialogline.h" - -/** - * @brief The VModelingLine class - */ -class VModelingLine: public VModelingTool, public QGraphicsLineItem -{ - Q_OBJECT -public: - /** - * @brief VModelingLine - * @param doc dom document container - * @param data - * @param id - * @param firstPoint - * @param secondPoint - * @param typeCreation - * @param parent - */ - VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, - qint64 secondPoint, const Tool::Sources &typeCreation, - QGraphicsItem * parent = 0); - /** - * @brief setDialog - */ - virtual void setDialog(); - /** - * @brief Create - * @param dialog - * @param doc dom document container - * @param data - * @return - */ - static VModelingLine* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); - /** - * @brief Create - * @param _id - * @param firstPoint - * @param secondPoint - * @param doc dom document container - * @param data - * @param parse - * @param typeCreation - * @return - */ - static VModelingLine* Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation); - /** - * @brief TagName - */ - static const QString TagName; - /** - * @brief ToolType - */ - static const QString ToolType; -public slots: - /** - * @brief FullUpdateFromFile - */ - virtual void FullUpdateFromFile(); - /** - * @brief FullUpdateFromGui - * @param result - */ - virtual void FullUpdateFromGui(int result); -protected: - /** - * @brief contextMenuEvent - * @param event - */ - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - /** - * @brief AddToFile - */ - virtual void AddToFile(); - /** - * @brief hoverMoveEvent - * @param event - */ - virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); - /** - * @brief hoverLeaveEvent - * @param event - */ - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); - /** - * @brief RemoveReferens - */ - virtual void RemoveReferens(); -private: - /** - * @brief firstPoint - */ - qint64 firstPoint; - /** - * @brief secondPoint - */ - qint64 secondPoint; - /** - * @brief dialogLine - */ - QSharedPointer dialogLine; -}; - -#endif // VMODELINGLINE_H diff --git a/src/tools/modelingTools/vmodelinglineintersect.cpp b/src/tools/modelingTools/vmodelinglineintersect.cpp deleted file mode 100644 index dd15b7a09..000000000 --- a/src/tools/modelingTools/vmodelinglineintersect.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelinglineintersect.cpp - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "vmodelinglineintersect.h" - -const QString VModelingLineIntersect::ToolType = QStringLiteral("lineIntersect"); - -VModelingLineIntersect::VModelingLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id, - const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2, - const qint64 &p2Line2, const Tool::Sources &typeCreation, QGraphicsItem *parent) - :VModelingPoint(doc, data, id, parent), p1Line1(p1Line1), p2Line1(p2Line1), p1Line2(p1Line2), - p2Line2(p2Line2), dialogLineIntersect(QSharedPointer()) -{ - ignoreFullUpdate = true; - if (typeCreation == Tool::FromGui) - { - AddToFile(); - } -} - -void VModelingLineIntersect::setDialog() -{ - Q_ASSERT(dialogLineIntersect.isNull() == false); - VPointF p = VAbstractTool::data.GetPointModeling(id); - dialogLineIntersect->setP1Line1(p1Line1); - dialogLineIntersect->setP2Line1(p2Line1); - dialogLineIntersect->setP1Line2(p1Line2); - dialogLineIntersect->setP2Line2(p2Line2); - dialogLineIntersect->setPointName(p.name()); -} - -VModelingLineIntersect *VModelingLineIntersect::Create(QSharedPointer &dialog, - VDomDocument *doc, VContainer *data) -{ - qint64 p1Line1Id = dialog->getP1Line1(); - qint64 p2Line1Id = dialog->getP2Line1(); - qint64 p1Line2Id = dialog->getP1Line2(); - qint64 p2Line2Id = dialog->getP2Line2(); - QString pointName = dialog->getPointName(); - return Create(0, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, pointName, 5, 10, doc, data, - Document::FullParse, Tool::FromGui); -} - -VModelingLineIntersect *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, - const Tool::Sources &typeCreation) -{ - VModelingLineIntersect *point = 0; - VPointF p1Line1 = data->GetPointModeling(p1Line1Id); - VPointF p2Line1 = data->GetPointModeling(p2Line1Id); - VPointF p1Line2 = data->GetPointModeling(p1Line2Id); - VPointF p2Line2 = data->GetPointModeling(p2Line2Id); - - QLineF line1(p1Line1.toQPointF(), p2Line1.toQPointF()); - QLineF line2(p1Line2.toQPointF(), p2Line2.toQPointF()); - QPointF fPoint; - QLineF::IntersectType intersect = line1.intersect(line2, &fPoint); - if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection) - { - qint64 id = _id; - if (typeCreation == Tool::FromGui) - { - id = data->AddPointModeling(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); - } - else - { - data->UpdatePointModeling(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); - if (parse != Document::FullParse) - { - doc->UpdateToolData(id, data); - } - } - data->AddLine(p1Line1Id, id, Draw::Modeling); - data->AddLine(id, p2Line1Id, Draw::Modeling); - data->AddLine(p1Line2Id, id, Draw::Modeling); - data->AddLine(id, p2Line2Id, Draw::Modeling); - if (parse == Document::FullParse) - { - point = new VModelingLineIntersect(doc, data, id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, - typeCreation); - doc->AddTool(id, point); - doc->IncrementReferens(p1Line1Id); - doc->IncrementReferens(p2Line1Id); - doc->IncrementReferens(p1Line2Id); - doc->IncrementReferens(p2Line2Id); - } - } - return point; -} - -void VModelingLineIntersect::FullUpdateFromFile() -{ - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - p1Line1 = domElement.attribute(AttrP1Line1, "").toLongLong(); - p2Line1 = domElement.attribute(AttrP2Line1, "").toLongLong(); - p1Line2 = domElement.attribute(AttrP1Line2, "").toLongLong(); - p2Line2 = domElement.attribute(AttrP2Line2, "").toLongLong(); - } - RefreshPointGeometry(VAbstractTool::data.GetPointModeling(id)); -} - -void VModelingLineIntersect::FullUpdateFromGui(int result) -{ - if (result == QDialog::Accepted) - { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute(AttrName, dialogLineIntersect->getPointName()); - domElement.setAttribute(AttrP1Line1, QString().setNum(dialogLineIntersect->getP1Line1())); - domElement.setAttribute(AttrP2Line1, QString().setNum(dialogLineIntersect->getP2Line1())); - domElement.setAttribute(AttrP1Line2, QString().setNum(dialogLineIntersect->getP1Line2())); - domElement.setAttribute(AttrP2Line2, QString().setNum(dialogLineIntersect->getP2Line2())); - emit FullUpdateTree(); - } - } - dialogLineIntersect.clear(); -} - -void VModelingLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - ContextMenu(dialogLineIntersect, this, event); -} - -void VModelingLineIntersect::AddToFile() -{ - VPointF point = VAbstractTool::data.GetPointModeling(id); - QDomElement domElement = doc->createElement(TagName); - - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point.name()); - AddAttribute(domElement, AttrMx, toMM(point.mx())); - AddAttribute(domElement, AttrMy, toMM(point.my())); - - AddAttribute(domElement, AttrP1Line1, p1Line1); - AddAttribute(domElement, AttrP2Line1, p2Line1); - AddAttribute(domElement, AttrP1Line2, p1Line2); - AddAttribute(domElement, AttrP2Line2, p2Line2); - - AddToModeling(domElement); -} - -void VModelingLineIntersect::RemoveReferens() -{ - doc->DecrementReferens(p1Line1); - doc->DecrementReferens(p2Line1); - doc->DecrementReferens(p1Line2); - doc->DecrementReferens(p2Line2); -} diff --git a/src/tools/modelingTools/vmodelinglineintersect.h b/src/tools/modelingTools/vmodelinglineintersect.h deleted file mode 100644 index b0dfd515f..000000000 --- a/src/tools/modelingTools/vmodelinglineintersect.h +++ /dev/null @@ -1,143 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelinglineintersect.h - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef VMODELINGLINEINTERSECT_H -#define VMODELINGLINEINTERSECT_H - -#include "vmodelingpoint.h" -#include "../../dialogs/dialoglineintersect.h" - -/** - * @brief The VModelingLineIntersect class - */ -class VModelingLineIntersect:public VModelingPoint -{ - Q_OBJECT -public: - /** - * @brief VModelingLineIntersect - * @param doc dom document container - * @param data - * @param id - * @param p1Line1 - * @param p2Line1 - * @param p1Line2 - * @param p2Line2 - * @param typeCreation - * @param parent - */ - VModelingLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id, - const qint64 &p1Line1, const qint64 &p2Line1, - const qint64 &p1Line2, const qint64 &p2Line2, - const Tool::Sources &typeCreation, - QGraphicsItem * parent = 0); - /** - * @brief setDialog - */ - virtual void setDialog(); - /** - * @brief Create - * @param dialog - * @param doc dom document container - * @param data - * @return - */ - static VModelingLineIntersect* Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data); - /** - * @brief Create - * @param _id - * @param p1Line1Id - * @param p2Line1Id - * @param p1Line2Id - * @param p2Line2Id - * @param pointName - * @param mx - * @param my - * @param doc dom document container - * @param data - * @param parse - * @param typeCreation - * @return - */ - 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, const Tool::Sources &typeCreation); - /** - * @brief ToolType - */ - static const QString ToolType; -public slots: - /** - * @brief FullUpdateFromFile - */ - virtual void FullUpdateFromFile(); - /** - * @brief FullUpdateFromGui - * @param result - */ - virtual void FullUpdateFromGui(int result); -protected: - /** - * @brief contextMenuEvent - * @param event - */ - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - /** - * @brief AddToFile - */ - virtual void AddToFile(); - /** - * @brief RemoveReferens - */ - virtual void RemoveReferens(); -private: - /** - * @brief p1Line1 - */ - qint64 p1Line1; - /** - * @brief p2Line1 - */ - qint64 p2Line1; - /** - * @brief p1Line2 - */ - qint64 p1Line2; - /** - * @brief p2Line2 - */ - qint64 p2Line2; - /** - * @brief dialogLineIntersect - */ - QSharedPointer dialogLineIntersect; -}; - -#endif // VMODELINGLINEINTERSECT_H diff --git a/src/tools/modelingTools/vmodelinglinepoint.cpp b/src/tools/modelingTools/vmodelinglinepoint.cpp deleted file mode 100644 index b68231cfe..000000000 --- a/src/tools/modelingTools/vmodelinglinepoint.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelinglinepoint.cpp - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "vmodelinglinepoint.h" - -VModelingLinePoint::VModelingLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, const qint64 &basePointId, - const qreal &angle, QGraphicsItem *parent) - :VModelingPoint(doc, data, id, parent), typeLine(typeLine), formula(formula), angle(angle), - basePointId(basePointId), mainLine(0) -{ - //Лінія, що з'єднує дві точки - QPointF point1 = data->GetPointModeling(basePointId).toQPointF(); - QPointF point2 = data->GetPointModeling(id).toQPointF(); - mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this); - mainLine->setPen(QPen(Qt::black, widthHairLine)); - mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true); - if (typeLine == TypeLineNone) - { - mainLine->setVisible(false); - } - else - { - mainLine->setVisible(true); - } -} - -void VModelingLinePoint::RefreshGeometry() -{ - VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetPointModeling(id)); - QPointF point = VModelingTool::data.GetPointModeling(id).toQPointF(); - QPointF basePoint = VModelingTool::data.GetPointModeling(basePointId).toQPointF(); - mainLine->setLine(QLineF(basePoint - point, QPointF())); - if (typeLine == TypeLineNone) - { - mainLine->setVisible(false); - } - else - { - mainLine->setVisible(true); - } -} diff --git a/src/tools/modelingTools/vmodelinglinepoint.h b/src/tools/modelingTools/vmodelinglinepoint.h deleted file mode 100644 index 1ef7ee104..000000000 --- a/src/tools/modelingTools/vmodelinglinepoint.h +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelinglinepoint.h - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef VMODELINGLINEPOINT_H -#define VMODELINGLINEPOINT_H - -#include "vmodelingpoint.h" - -/** - * @brief The VModelingLinePoint class - */ -class VModelingLinePoint : public VModelingPoint -{ - Q_OBJECT -public: - /** - * @brief VModelingLinePoint - * @param doc dom document container - * @param data - * @param id - * @param typeLine - * @param formula - * @param basePointId - * @param angle - * @param parent - */ - VModelingLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, - const QString &formula, const qint64 &basePointId, const qreal &angle, - QGraphicsItem * parent = 0); -protected: - /** - * @brief typeLine - */ - QString typeLine; - /** - * @brief formula - */ - QString formula; - /** - * @brief angle - */ - qreal angle; - /** - * @brief basePointId - */ - qint64 basePointId; - /** - * @brief mainLine - */ - QGraphicsLineItem *mainLine; - /** - * @brief RefreshGeometry - */ - virtual void RefreshGeometry(); - /** - * @brief RemoveReferens - */ - virtual void RemoveReferens() {doc->DecrementReferens(basePointId);} -private: - Q_DISABLE_COPY(VModelingLinePoint) -}; - -#endif // VMODELINGLINEPOINT_H diff --git a/src/tools/modelingTools/vmodelingnormal.cpp b/src/tools/modelingTools/vmodelingnormal.cpp deleted file mode 100644 index 91daea902..000000000 --- a/src/tools/modelingTools/vmodelingnormal.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingnormal.cpp - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "vmodelingnormal.h" -#include "../drawTools/vtoolnormal.h" -#include "../../container/calculator.h" - -const QString VModelingNormal::ToolType = QStringLiteral("normal"); - -VModelingNormal::VModelingNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, - const QString &formula, const qreal &angle, const qint64 &firstPointId, - const qint64 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) - :VModelingLinePoint(doc, data, id, typeLine, formula, firstPointId, angle, parent), - secondPointId(secondPointId), dialogNormal(QSharedPointer()) -{ - if (typeCreation == Tool::FromGui) - { - AddToFile(); - } -} - -void VModelingNormal::setDialog() -{ - Q_ASSERT(dialogNormal.isNull() == false); - VPointF p = VAbstractTool::data.GetPointModeling(id); - dialogNormal->setTypeLine(typeLine); - dialogNormal->setFormula(formula); - dialogNormal->setAngle(angle); - dialogNormal->setFirstPointId(basePointId, id); - dialogNormal->setSecondPointId(secondPointId, id); - dialogNormal->setPointName(p.name()); -} - -VModelingNormal* VModelingNormal::Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data) -{ - QString formula = dialog->getFormula(); - qint64 firstPointId = dialog->getFirstPointId(); - qint64 secondPointId = dialog->getSecondPointId(); - QString typeLine = dialog->getTypeLine(); - QString pointName = dialog->getPointName(); - qreal angle = dialog->getAngle(); - return Create(0, formula, firstPointId, secondPointId, typeLine, pointName, angle, 5, 10, doc, data, - Document::FullParse, Tool::FromGui); -} - -VModelingNormal *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, - const Tool::Sources &typeCreation) -{ - VModelingNormal *point = 0; - VPointF firstPoint = data->GetPointModeling(firstPointId); - VPointF secondPoint = data->GetPointModeling(secondPointId); - Calculator cal(data); - QString errorMsg; - qreal result = cal.eval(formula, &errorMsg); - if (errorMsg.isEmpty()) - { - QPointF fPoint = VToolNormal::FindPoint(firstPoint.toQPointF(), secondPoint.toQPointF(), - toPixel(result), angle); - qint64 id = _id; - if (typeCreation == Tool::FromGui) - { - id = data->AddPointModeling(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); - } - else - { - data->UpdatePointModeling(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); - if (parse != Document::FullParse) - { - doc->UpdateToolData(id, data); - } - } - data->AddLine(firstPointId, id, Draw::Modeling); - if (parse == Document::FullParse) - { - point = new VModelingNormal(doc, data, id, typeLine, formula, angle, firstPointId, secondPointId, - typeCreation); - doc->AddTool(id, point); - doc->IncrementReferens(firstPointId); - doc->IncrementReferens(secondPointId); - } - } - return point; -} - -void VModelingNormal::FullUpdateFromFile() -{ - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - typeLine = domElement.attribute(AttrTypeLine, ""); - formula = domElement.attribute(AttrLength, ""); - basePointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); - secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); - angle = domElement.attribute(AttrAngle, "").toInt(); - } - RefreshGeometry(); -} - -void VModelingNormal::FullUpdateFromGui(int result) -{ - if (result == QDialog::Accepted) - { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute(AttrName, dialogNormal->getPointName()); - domElement.setAttribute(AttrTypeLine, dialogNormal->getTypeLine()); - domElement.setAttribute(AttrLength, dialogNormal->getFormula()); - domElement.setAttribute(AttrAngle, QString().setNum(dialogNormal->getAngle())); - domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogNormal->getFirstPointId())); - domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogNormal->getSecondPointId())); - emit FullUpdateTree(); - } - } - dialogNormal.clear(); -} - -void VModelingNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - ContextMenu(dialogNormal, this, event); -} - -void VModelingNormal::AddToFile() -{ - VPointF point = VAbstractTool::data.GetPointModeling(id); - QDomElement domElement = doc->createElement(TagName); - - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point.name()); - AddAttribute(domElement, AttrMx, toMM(point.mx())); - AddAttribute(domElement, AttrMy, toMM(point.my())); - - AddAttribute(domElement, AttrTypeLine, typeLine); - AddAttribute(domElement, AttrLength, formula); - AddAttribute(domElement, AttrAngle, angle); - AddAttribute(domElement, AttrFirstPoint, basePointId); - AddAttribute(domElement, AttrSecondPoint, secondPointId); - - AddToModeling(domElement); -} - -void VModelingNormal::RemoveReferens() -{ - doc->DecrementReferens(secondPointId); - VModelingLinePoint::RemoveReferens(); -} diff --git a/src/tools/modelingTools/vmodelingnormal.h b/src/tools/modelingTools/vmodelingnormal.h deleted file mode 100644 index 362b4897d..000000000 --- a/src/tools/modelingTools/vmodelingnormal.h +++ /dev/null @@ -1,132 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingnormal.h - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef VMODELINGNORMAL_H -#define VMODELINGNORMAL_H - -#include "vmodelinglinepoint.h" -#include "../../dialogs/dialognormal.h" - -/** - * @brief The VModelingNormal class - */ -class VModelingNormal : public VModelingLinePoint -{ - Q_OBJECT -public: - /** - * @brief VModelingNormal - * @param doc dom document container - * @param data - * @param id - * @param typeLine - * @param formula - * @param angle - * @param firstPointId - * @param secondPointId - * @param typeCreation - * @param parent - */ - VModelingNormal(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, const qreal &angle, - const qint64 &firstPointId, const qint64 &secondPointId, - const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); - /** - * @brief setDialog - */ - virtual void setDialog(); - /** - * @brief Create - * @param dialog - * @param doc dom document container - * @param data - * @return - */ - static VModelingNormal* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); - /** - * @brief Create - * @param _id - * @param formula - * @param firstPointId - * @param secondPointId - * @param typeLine - * @param pointName - * @param angle - * @param mx - * @param my - * @param doc dom document container - * @param data - * @param parse - * @param typeCreation - * @return - */ - 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, - const Tool::Sources &typeCreation); - /** - * @brief ToolType - */ - static const QString ToolType; -public slots: - /** - * @brief FullUpdateFromFile - */ - virtual void FullUpdateFromFile(); - /** - * @brief FullUpdateFromGui - * @param result - */ - virtual void FullUpdateFromGui(int result); -protected: - /** - * @brief contextMenuEvent - * @param event - */ - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - /** - * @brief AddToFile - */ - virtual void AddToFile(); - /** - * @brief RemoveReferens - */ - virtual void RemoveReferens(); -private: - /** - * @brief secondPointId - */ - qint64 secondPointId; - /** - * @brief dialogNormal - */ - QSharedPointer dialogNormal; -}; - -#endif // VMODELINGNORMAL_H diff --git a/src/tools/modelingTools/vmodelingpoint.cpp b/src/tools/modelingTools/vmodelingpoint.cpp deleted file mode 100644 index c13c3951d..000000000 --- a/src/tools/modelingTools/vmodelingpoint.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingpoint.cpp - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "vmodelingpoint.h" -#include "../../container/vpointf.h" - -const QString VModelingPoint::TagName = QStringLiteral("point"); - -VModelingPoint::VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem *parent) - :VModelingTool(doc, data, id), QGraphicsEllipseItem(parent), radius(toPixel(1.5)), namePoint(0), lineName(0) -{ - namePoint = new VGraphicsSimpleTextItem(this); - lineName = new QGraphicsLineItem(this); - connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, - &VModelingPoint::NameChangePosition); - this->setPen(QPen(Qt::black, widthHairLine)); - this->setBrush(QBrush(Qt::NoBrush)); - this->setFlag(QGraphicsItem::ItemIsSelectable, true); - this->setAcceptHoverEvents(true); - RefreshPointGeometry(VAbstractTool::data.GetPointModeling(id)); -} - -void VModelingPoint::NameChangePosition(const QPointF &pos) -{ - VPointF point = VAbstractTool::data.GetPointModeling(id); - QPointF p = pos - this->pos(); - point.setMx(p.x()); - point.setMy(p.y()); - RefreshLine(); - UpdateNamePosition(point.mx(), point.my()); - VAbstractTool::data.UpdatePoint(id, point); -} - -void VModelingPoint::UpdateNamePosition(qreal mx, qreal my) -{ - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute(AttrMx, QString().setNum(toMM(mx))); - domElement.setAttribute(AttrMy, QString().setNum(toMM(my))); - emit toolhaveChange(); - } -} - -void VModelingPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - if (event->button() == Qt::LeftButton) - { - emit ChoosedTool(id, Scene::Point); - } - QGraphicsItem::mouseReleaseEvent(event); -} - -void VModelingPoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event) -{ - Q_UNUSED(event); - this->setPen(QPen(currentColor, widthMainLine)); -} - -void VModelingPoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) -{ - Q_UNUSED(event); - this->setPen(QPen(currentColor, widthHairLine)); -} - -void VModelingPoint::RefreshPointGeometry(const VPointF &point) -{ - QRectF rec = QRectF(0, 0, radius*2, radius*2); - rec.translate(-rec.center().x(), -rec.center().y()); - this->setRect(rec); - this->setPos(point.toQPointF()); - disconnect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, - &VModelingPoint::NameChangePosition); - namePoint->setText(point.name()); - namePoint->setPos(QPointF(point.mx(), point.my())); - connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, - &VModelingPoint::NameChangePosition); - RefreshLine(); -} - -void VModelingPoint::RefreshLine() -{ - QRectF nameRec = namePoint->sceneBoundingRect(); - QPointF p1, p2; - LineIntersectCircle(QPointF(), radius, QLineF(QPointF(), nameRec.center()- scenePos()), p1, p2); - QPointF pRec = LineIntersectRect(nameRec, QLineF(scenePos(), nameRec.center())); - lineName->setLine(QLineF(p1, pRec - scenePos())); - if (QLineF(p1, pRec - scenePos()).length() <= toPixel(4)) - { - lineName->setVisible(false); - } - else - { - lineName->setVisible(true); - } -} diff --git a/src/tools/modelingTools/vmodelingpoint.h b/src/tools/modelingTools/vmodelingpoint.h deleted file mode 100644 index 4a1e88432..000000000 --- a/src/tools/modelingTools/vmodelingpoint.h +++ /dev/null @@ -1,113 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingpoint.h - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef VMODELINGPOINT_H -#define VMODELINGPOINT_H - -#include "vmodelingtool.h" -#include "../../widgets/vgraphicssimpletextitem.h" - -/** - * @brief The VModelingPoint class - */ -class VModelingPoint: public VModelingTool, public QGraphicsEllipseItem -{ - Q_OBJECT -public: - /** - * @brief VModelingPoint - * @param doc dom document container - * @param data - * @param id - * @param parent - */ - VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0); - virtual ~VModelingPoint() {} - /** - * @brief TagName - */ - static const QString TagName; -public slots: - /** - * @brief NameChangePosition - * @param pos - */ - void NameChangePosition(const QPointF &pos); - /** - * @brief FullUpdateFromGui - * @param result - */ - virtual void FullUpdateFromGui(int result) = 0; -protected: - /** - * @brief radius - */ - qreal radius; - /** - * @brief namePoint - */ - VGraphicsSimpleTextItem *namePoint; - /** - * @brief lineName - */ - QGraphicsLineItem *lineName; - /** - * @brief UpdateNamePosition - * @param mx - * @param my - */ - virtual void UpdateNamePosition(qreal mx, qreal my); - /** - * @brief mouseReleaseEvent - * @param event - */ - virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); - /** - * @brief hoverMoveEvent - * @param event - */ - virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); - /** - * @brief hoverLeaveEvent - * @param event - */ - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); - /** - * @brief RefreshPointGeometry - * @param point - */ - virtual void RefreshPointGeometry(const VPointF &point); - /** - * @brief RefreshLine - */ - void RefreshLine(); -private: - Q_DISABLE_COPY(VModelingPoint) -}; - -#endif // VMODELINGPOINT_H diff --git a/src/tools/modelingTools/vmodelingpointofcontact.cpp b/src/tools/modelingTools/vmodelingpointofcontact.cpp deleted file mode 100644 index 43dd485fd..000000000 --- a/src/tools/modelingTools/vmodelingpointofcontact.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingpointofcontact.cpp - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "vmodelingpointofcontact.h" -#include "../drawTools/vtoolpointofcontact.h" -#include "../../container/calculator.h" - -const QString VModelingPointOfContact::ToolType = QStringLiteral("pointOfContact"); - -VModelingPointOfContact::VModelingPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &radius, const qint64 ¢er, - const qint64 &firstPointId, const qint64 &secondPointId, - const Tool::Sources &typeCreation, QGraphicsItem *parent) - : VModelingPoint(doc, data, id, parent), radius(radius), center(center), firstPointId(firstPointId), - secondPointId(secondPointId), dialogPointOfContact(QSharedPointer()) -{ - if (typeCreation == Tool::FromGui) - { - AddToFile(); - } -} - -void VModelingPointOfContact::setDialog() -{ - Q_ASSERT(dialogPointOfContact.isNull() == false); - VPointF p = VAbstractTool::data.GetPointModeling(id); - dialogPointOfContact->setRadius(radius); - dialogPointOfContact->setCenter(center, id); - dialogPointOfContact->setFirstPoint(firstPointId, id); - dialogPointOfContact->setSecondPoint(secondPointId, id); - dialogPointOfContact->setPointName(p.name()); -} - -VModelingPointOfContact *VModelingPointOfContact::Create(QSharedPointer &dialog, - VDomDocument *doc, VContainer *data) -{ - QString radius = dialog->getRadius(); - qint64 center = dialog->getCenter(); - qint64 firstPointId = dialog->getFirstPoint(); - qint64 secondPointId = dialog->getSecondPoint(); - QString pointName = dialog->getPointName(); - return Create(0, radius, center, firstPointId, secondPointId, pointName, 5, 10, doc, data, - Document::FullParse, Tool::FromGui); -} - -VModelingPointOfContact *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, - const Tool::Sources &typeCreation) -{ - VModelingPointOfContact *point = 0; - VPointF centerP = data->GetPointModeling(center); - VPointF firstP = data->GetPointModeling(firstPointId); - VPointF secondP = data->GetPointModeling(secondPointId); - - Calculator cal(data); - QString errorMsg; - qreal result = cal.eval(radius, &errorMsg); - if (errorMsg.isEmpty()) - { - QPointF fPoint = VToolPointOfContact::FindPoint(toPixel(result), centerP.toQPointF(), - firstP.toQPointF(), secondP.toQPointF()); - qint64 id = _id; - if (typeCreation == Tool::FromGui) - { - id = data->AddPointModeling(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); - } - else - { - data->UpdatePointModeling(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); - if (parse != Document::FullParse) - { - doc->UpdateToolData(id, data); - } - } - if (parse == Document::FullParse) - { - point = new VModelingPointOfContact(doc, data, id, radius, center, firstPointId, secondPointId, - typeCreation); - doc->AddTool(id, point); - doc->IncrementReferens(center); - doc->IncrementReferens(firstPointId); - doc->IncrementReferens(secondPointId); - } - } - return point; -} - -void VModelingPointOfContact::FullUpdateFromFile() -{ - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - radius = domElement.attribute(AttrRadius, ""); - center = domElement.attribute(AttrCenter, "").toLongLong(); - firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); - secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); - } - RefreshPointGeometry(VAbstractTool::data.GetPointModeling(id)); -} - -void VModelingPointOfContact::FullUpdateFromGui(int result) -{ - if (result == QDialog::Accepted) - { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute(AttrName, dialogPointOfContact->getPointName()); - domElement.setAttribute(AttrRadius, dialogPointOfContact->getRadius()); - domElement.setAttribute(AttrCenter, QString().setNum(dialogPointOfContact->getCenter())); - domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogPointOfContact->getFirstPoint())); - domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogPointOfContact->getSecondPoint())); - emit FullUpdateTree(); - } - } - dialogPointOfContact.clear(); -} - -void VModelingPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - ContextMenu(dialogPointOfContact, this, event); -} - -void VModelingPointOfContact::AddToFile() -{ - VPointF point = VAbstractTool::data.GetPointModeling(id); - QDomElement domElement = doc->createElement(TagName); - - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point.name()); - AddAttribute(domElement, AttrMx, toMM(point.mx())); - AddAttribute(domElement, AttrMy, toMM(point.my())); - - AddAttribute(domElement, AttrRadius, radius); - AddAttribute(domElement, AttrCenter, center); - AddAttribute(domElement, AttrFirstPoint, firstPointId); - AddAttribute(domElement, AttrSecondPoint, secondPointId); - - AddToModeling(domElement); -} - -void VModelingPointOfContact::RemoveReferens() -{ - doc->DecrementReferens(center); - doc->DecrementReferens(firstPointId); - doc->DecrementReferens(secondPointId); -} diff --git a/src/tools/modelingTools/vmodelingpointofcontact.h b/src/tools/modelingTools/vmodelingpointofcontact.h deleted file mode 100644 index df58ee4f2..000000000 --- a/src/tools/modelingTools/vmodelingpointofcontact.h +++ /dev/null @@ -1,144 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingpointofcontact.h - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef VMODELINGPOINTOFCONTACT_H -#define VMODELINGPOINTOFCONTACT_H - -#include "vmodelingpoint.h" -#include "../../dialogs/dialogpointofcontact.h" - -/** - * @brief The VModelingPointOfContact class - */ -class VModelingPointOfContact : public VModelingPoint -{ - Q_OBJECT -public: - /** - * @brief VModelingPointOfContact - * @param doc dom document container - * @param data - * @param id - * @param radius - * @param center - * @param firstPointId - * @param secondPointId - * @param typeCreation - * @param parent - */ - VModelingPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &radius, const qint64 ¢er, - const qint64 &firstPointId, const qint64 &secondPointId, - const Tool::Sources &typeCreation, - QGraphicsItem * parent = 0); - /** - * @brief setDialog - */ - virtual void setDialog(); - /** - * @brief Create - * @param dialog - * @param doc dom document container - * @param data - * @return - */ - static VModelingPointOfContact* Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data); - /** - * @brief Create - * @param _id - * @param radius - * @param center - * @param firstPointId - * @param secondPointId - * @param pointName - * @param mx - * @param my - * @param doc dom document container - * @param data - * @param parse - * @param typeCreation - * @return - */ - 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, const Tool::Sources &typeCreation); - /** - * @brief ToolType - */ - static const QString ToolType; -public slots: - /** - * @brief FullUpdateFromFile - */ - virtual void FullUpdateFromFile(); - /** - * @brief FullUpdateFromGui - * @param result - */ - virtual void FullUpdateFromGui(int result); -protected: - /** - * @brief contextMenuEvent - * @param event - */ - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - /** - * @brief AddToFile - */ - virtual void AddToFile(); - /** - * @brief RemoveReferens - */ - virtual void RemoveReferens(); -private: - /** - * @brief radius - */ - QString radius; - /** - * @brief center - */ - qint64 center; - /** - * @brief firstPointId - */ - qint64 firstPointId; - /** - * @brief secondPointId - */ - qint64 secondPointId; - /** - * @brief dialogPointOfContact - */ - QSharedPointer dialogPointOfContact; -}; - -#endif // VMODELINGPOINTOFCONTACT_H diff --git a/src/tools/modelingTools/vmodelingpointofintersection.cpp b/src/tools/modelingTools/vmodelingpointofintersection.cpp deleted file mode 100644 index cfa4006d7..000000000 --- a/src/tools/modelingTools/vmodelingpointofintersection.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingpointofintersection.cpp - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "vmodelingpointofintersection.h" - -const QString VModelingPointOfIntersection::ToolType = QStringLiteral("pointOfIntersection"); - -VModelingPointOfIntersection::VModelingPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id, - const qint64 &firstPointId, const qint64 &secondPointId, - const Tool::Sources &typeCreation, QGraphicsItem *parent) - :VModelingPoint(doc, data, id, parent), firstPointId(firstPointId), secondPointId(secondPointId), - dialogPointOfIntersection(QSharedPointer()) -{ - ignoreFullUpdate = true; - if (typeCreation == Tool::FromGui) - { - AddToFile(); - } -} - -void VModelingPointOfIntersection::setDialog() -{ - Q_ASSERT(dialogPointOfIntersection.isNull() == false); - VPointF p = VAbstractTool::data.GetPoint(id); - dialogPointOfIntersection->setFirstPointId(firstPointId, id); - dialogPointOfIntersection->setSecondPointId(secondPointId, id); - dialogPointOfIntersection->setPointName(p.name()); -} - -VModelingPointOfIntersection *VModelingPointOfIntersection::Create(QSharedPointer &dialog, - VDomDocument *doc, VContainer *data) -{ - qint64 firstPointId = dialog->getFirstPointId(); - qint64 secondPointId = dialog->getSecondPointId(); - QString pointName = dialog->getPointName(); - return Create(0, pointName, firstPointId, secondPointId, 5, 10, doc, data, Document::FullParse, Tool::FromGui); -} - -VModelingPointOfIntersection *VModelingPointOfIntersection::Create(const qint64 _id, const QString &pointName, - const qint64 &firstPointId, - const qint64 &secondPointId, const qreal &mx, - const qreal &my, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation) -{ - VModelingPointOfIntersection *tool = 0; - VPointF firstPoint = data->GetPoint(firstPointId); - VPointF secondPoint = data->GetPoint(secondPointId); - - QPointF point(firstPoint.x(), secondPoint.y()); - qint64 id = _id; - if (typeCreation == Tool::FromGui) - { - id = data->AddPoint(VPointF(point.x(), point.y(), pointName, mx, my)); - } - else - { - data->UpdatePoint(id, VPointF(point.x(), point.y(), pointName, mx, my)); - if (parse != Document::FullParse) - { - doc->UpdateToolData(id, data); - } - } - if (parse == Document::FullParse) - { - tool = new VModelingPointOfIntersection(doc, data, id, firstPointId, secondPointId, typeCreation); - doc->AddTool(id, tool); - doc->IncrementReferens(firstPointId); - doc->IncrementReferens(secondPointId); - } - return tool; -} - -void VModelingPointOfIntersection::FullUpdateFromFile() -{ - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); - secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); - } - VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetPoint(id)); -} - -void VModelingPointOfIntersection::FullUpdateFromGui(int result) -{ - if (result == QDialog::Accepted) - { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute(AttrName, dialogPointOfIntersection->getPointName()); - domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogPointOfIntersection->getFirstPointId())); - domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogPointOfIntersection->getSecondPointId())); - emit FullUpdateTree(); - } - } - dialogPointOfIntersection.clear(); -} - -void VModelingPointOfIntersection::RemoveReferens() -{ - doc->DecrementReferens(firstPointId); - doc->DecrementReferens(secondPointId); -} - -void VModelingPointOfIntersection::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - ContextMenu(dialogPointOfIntersection, this, event); -} - -void VModelingPointOfIntersection::AddToFile() -{ - VPointF point = VAbstractTool::data.GetPoint(id); - QDomElement domElement = doc->createElement(TagName); - - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point.name()); - AddAttribute(domElement, AttrMx, toMM(point.mx())); - AddAttribute(domElement, AttrMy, toMM(point.my())); - - AddAttribute(domElement, AttrFirstPoint, firstPointId); - AddAttribute(domElement, AttrSecondPoint, secondPointId); - - AddToModeling(domElement); -} diff --git a/src/tools/modelingTools/vmodelingpointofintersection.h b/src/tools/modelingTools/vmodelingpointofintersection.h deleted file mode 100644 index 30a5b0d8f..000000000 --- a/src/tools/modelingTools/vmodelingpointofintersection.h +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingpointofintersection.h - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef VMODELINGPOINTOFINTERSECTION_H -#define VMODELINGPOINTOFINTERSECTION_H - -#include "vmodelingpoint.h" -#include "../../dialogs/dialogpointofintersection.h" - -/** - * @brief The VModelingPointOfIntersection class - */ -class VModelingPointOfIntersection : public VModelingPoint -{ - Q_OBJECT -public: - /** - * @brief VModelingPointOfIntersection - * @param doc dom document container - * @param data - * @param id - * @param firstPointId - * @param secondPointId - * @param typeCreation - * @param parent - */ - VModelingPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id, - const qint64 &firstPointId, const qint64 &secondPointId, - const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); - /** - * @brief setDialog - */ - virtual void setDialog(); - /** - * @brief Create - * @param dialog - * @param doc dom document container - * @param data - * @return - */ - static VModelingPointOfIntersection* Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data); - /** - * @brief Create - * @param _id - * @param pointName - * @param firstPointId - * @param secondPointId - * @param mx - * @param my - * @param doc dom document container - * @param data - * @param parse - * @param typeCreation - * @return - */ - static VModelingPointOfIntersection* Create(const qint64 _id, const QString &pointName, - const qint64 &firstPointId, const qint64 &secondPointId, - const qreal &mx, const qreal &my, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation); - /** - * @brief ToolType - */ - static const QString ToolType; -public slots: - /** - * @brief FullUpdateFromFile - */ - virtual void FullUpdateFromFile(); - /** - * @brief FullUpdateFromGui - * @param result - */ - virtual void FullUpdateFromGui(int result); -protected: - /** - * @brief RemoveReferens - */ - virtual void RemoveReferens(); - /** - * @brief contextMenuEvent - * @param event - */ - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - /** - * @brief AddToFile - */ - virtual void AddToFile(); -private: - Q_DISABLE_COPY(VModelingPointOfIntersection) - /** - * @brief firstPointId - */ - qint64 firstPointId; - /** - * @brief secondPointId - */ - qint64 secondPointId; - /** - * @brief dialogPointOfIntersection - */ - QSharedPointer dialogPointOfIntersection; -}; - -#endif // VMODELINGPOINTOFINTERSECTION_H diff --git a/src/tools/modelingTools/vmodelingshoulderpoint.cpp b/src/tools/modelingTools/vmodelingshoulderpoint.cpp deleted file mode 100644 index 68320fdd2..000000000 --- a/src/tools/modelingTools/vmodelingshoulderpoint.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingshoulderpoint.cpp - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "vmodelingshoulderpoint.h" -#include "../drawTools/vtoolshoulderpoint.h" -#include "../../container/calculator.h" - -const QString VModelingShoulderPoint::ToolType = QStringLiteral("shoulder"); - -VModelingShoulderPoint::VModelingShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, const qint64 &p1Line, - const qint64 &p2Line, const qint64 &pShoulder, const Tool::Sources &typeCreation, - QGraphicsItem * parent) - :VModelingLinePoint(doc, data, id, typeLine, formula, p1Line, 0, parent), p2Line(p2Line), - pShoulder(pShoulder), dialogShoulderPoint(QSharedPointer()) -{ - if (typeCreation == Tool::FromGui) - { - AddToFile(); - } -} - -void VModelingShoulderPoint::setDialog() -{ - Q_ASSERT(dialogShoulderPoint.isNull() == false); - VPointF p = VAbstractTool::data.GetPointModeling(id); - dialogShoulderPoint->setTypeLine(typeLine); - dialogShoulderPoint->setFormula(formula); - dialogShoulderPoint->setP1Line(basePointId, id); - dialogShoulderPoint->setP2Line(p2Line, id); - dialogShoulderPoint->setPShoulder(pShoulder, id); - dialogShoulderPoint->setPointName(p.name()); -} - -VModelingShoulderPoint *VModelingShoulderPoint::Create(QSharedPointer &dialog, - VDomDocument *doc, VContainer *data) -{ - QString formula = dialog->getFormula(); - qint64 p1Line = dialog->getP1Line(); - qint64 p2Line = dialog->getP2Line(); - qint64 pShoulder = dialog->getPShoulder(); - QString typeLine = dialog->getTypeLine(); - QString pointName = dialog->getPointName(); - return Create(0, formula, p1Line, p2Line, pShoulder, typeLine, pointName, 5, 10, doc, data, - Document::FullParse, Tool::FromGui); -} - -VModelingShoulderPoint *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) -{ - VModelingShoulderPoint *point = 0; - VPointF firstPoint = data->GetPointModeling(p1Line); - VPointF secondPoint = data->GetPointModeling(p2Line); - VPointF shoulderPoint = data->GetPointModeling(pShoulder); - - Calculator cal(data); - QString errorMsg; - qreal result = cal.eval(formula, &errorMsg); - if (errorMsg.isEmpty()) - { - QPointF fPoint = VToolShoulderPoint::FindPoint(firstPoint.toQPointF(), secondPoint.toQPointF(), - shoulderPoint.toQPointF(), toPixel(result)); - qint64 id = _id; - if (typeCreation == Tool::FromGui) - { - id = data->AddPointModeling(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); - } - else - { - data->UpdatePointModeling(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); - if (parse != Document::FullParse) - { - doc->UpdateToolData(id, data); - } - } - data->AddLine(p1Line, id, Draw::Modeling); - data->AddLine(p2Line, id, Draw::Modeling); - if (parse == Document::FullParse) - { - point = new VModelingShoulderPoint(doc, data, id, typeLine, formula, p1Line, p2Line, pShoulder, - typeCreation); - doc->AddTool(id, point); - doc->IncrementReferens(p1Line); - doc->IncrementReferens(p2Line); - doc->IncrementReferens(pShoulder); - } - } - return point; -} - -void VModelingShoulderPoint::FullUpdateFromFile() -{ - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - typeLine = domElement.attribute(AttrTypeLine, ""); - formula = domElement.attribute(AttrLength, ""); - basePointId = domElement.attribute(AttrP1Line, "").toLongLong(); - p2Line = domElement.attribute(AttrP2Line, "").toLongLong(); - pShoulder = domElement.attribute(AttrPShoulder, "").toLongLong(); - } - RefreshGeometry(); -} - -void VModelingShoulderPoint::FullUpdateFromGui(int result) -{ - if (result == QDialog::Accepted) - { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute(AttrName, dialogShoulderPoint->getPointName()); - domElement.setAttribute(AttrTypeLine, dialogShoulderPoint->getTypeLine()); - domElement.setAttribute(AttrLength, dialogShoulderPoint->getFormula()); - domElement.setAttribute(AttrP1Line, QString().setNum(dialogShoulderPoint->getP1Line())); - domElement.setAttribute(AttrP2Line, QString().setNum(dialogShoulderPoint->getP2Line())); - domElement.setAttribute(AttrPShoulder, QString().setNum(dialogShoulderPoint->getPShoulder())); - emit FullUpdateTree(); - } - } - dialogShoulderPoint.clear(); -} - -void VModelingShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - ContextMenu(dialogShoulderPoint, this, event); -} - -void VModelingShoulderPoint::AddToFile() -{ - VPointF point = VAbstractTool::data.GetPointModeling(id); - QDomElement domElement = doc->createElement(TagName); - - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point.name()); - AddAttribute(domElement, AttrMx, toMM(point.mx())); - AddAttribute(domElement, AttrMy, toMM(point.my())); - - AddAttribute(domElement, AttrTypeLine, typeLine); - AddAttribute(domElement, AttrLength, formula); - AddAttribute(domElement, AttrP1Line, basePointId); - AddAttribute(domElement, AttrP2Line, p2Line); - AddAttribute(domElement, AttrPShoulder, pShoulder); - - AddToModeling(domElement); -} - -void VModelingShoulderPoint::RemoveReferens() -{ - doc->DecrementReferens(p2Line); - doc->DecrementReferens(pShoulder); - VModelingLinePoint::RemoveReferens(); -} diff --git a/src/tools/modelingTools/vmodelingshoulderpoint.h b/src/tools/modelingTools/vmodelingshoulderpoint.h deleted file mode 100644 index 5fe6f796e..000000000 --- a/src/tools/modelingTools/vmodelingshoulderpoint.h +++ /dev/null @@ -1,137 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingshoulderpoint.h - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef VMODELINGSHOULDERPOINT_H -#define VMODELINGSHOULDERPOINT_H - -#include "vmodelinglinepoint.h" -#include "../../dialogs/dialogshoulderpoint.h" - -/** - * @brief The VModelingShoulderPoint class - */ -class VModelingShoulderPoint : public VModelingLinePoint -{ - Q_OBJECT -public: - /** - * @brief VModelingShoulderPoint - * @param doc dom document container - * @param data - * @param id - * @param typeLine - * @param formula - * @param p1Line - * @param p2Line - * @param pShoulder - * @param typeCreation - * @param parent - */ - VModelingShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, - const QString &formula, const qint64 &p1Line, const qint64 &p2Line, - const qint64 &pShoulder, const Tool::Sources &typeCreation, - QGraphicsItem * parent = 0); - /** - * @brief setDialog - */ - virtual void setDialog(); - /** - * @brief Create - * @param dialog - * @param doc dom document container - * @param data - * @return - */ - static VModelingShoulderPoint* Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data); - /** - * @brief Create - * @param _id - * @param formula - * @param p1Line - * @param p2Line - * @param pShoulder - * @param typeLine - * @param pointName - * @param mx - * @param my - * @param doc dom document container - * @param data - * @param parse - * @param typeCreation - * @return - */ - 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); - /** - * @brief ToolType - */ - static const QString ToolType; -public slots: - /** - * @brief FullUpdateFromFile - */ - virtual void FullUpdateFromFile(); - /** - * @brief FullUpdateFromGui - * @param result - */ - virtual void FullUpdateFromGui(int result); -protected: - /** - * @brief contextMenuEvent - * @param event - */ - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - /** - * @brief AddToFile - */ - virtual void AddToFile(); - /** - * @brief RemoveReferens - */ - virtual void RemoveReferens(); -private: - /** - * @brief p2Line - */ - qint64 p2Line; - /** - * @brief pShoulder - */ - qint64 pShoulder; - /** - * @brief dialogShoulderPoint - */ - QSharedPointer dialogShoulderPoint; -}; - -#endif // VMODELINGSHOULDERPOINT_H diff --git a/src/tools/modelingTools/vmodelingspline.cpp b/src/tools/modelingTools/vmodelingspline.cpp deleted file mode 100644 index 9c9be55ba..000000000 --- a/src/tools/modelingTools/vmodelingspline.cpp +++ /dev/null @@ -1,273 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingspline.cpp - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "vmodelingspline.h" -#include "../../geometry/vspline.h" - -const QString VModelingSpline::TagName = QStringLiteral("spline"); -const QString VModelingSpline::ToolType = QStringLiteral("simple"); - -VModelingSpline::VModelingSpline(VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, - QGraphicsItem *parent) - :VModelingTool(doc, data, id), QGraphicsPathItem(parent), - dialogSpline(QSharedPointer()), controlPoints(QVector()) -{ - ignoreFullUpdate = true; - VSpline spl = data->GetSplineModeling(id); - QPainterPath path; - path.addPath(spl.GetPath()); - path.setFillRule( Qt::WindingFill ); - this->setPath(path); - this->setPen(QPen(Qt::black, widthHairLine)); - this->setFlag(QGraphicsItem::ItemIsSelectable, true); - this->setAcceptHoverEvents(true); - - VControlPointSpline *controlPoint1 = new VControlPointSpline(1, SplinePoint::FirstPoint, spl.GetP2(), - spl.GetPointP1().toQPointF(), this); - connect(controlPoint1, &VControlPointSpline::ControlPointChangePosition, this, - &VModelingSpline::ControlPointChangePosition); - connect(this, &VModelingSpline::RefreshLine, controlPoint1, &VControlPointSpline::RefreshLine); - connect(this, &VModelingSpline::setEnabledPoint, controlPoint1, &VControlPointSpline::setEnabledPoint); - controlPoints.append(controlPoint1); - - VControlPointSpline *controlPoint2 = new VControlPointSpline(1, SplinePoint::LastPoint, spl.GetP3(), - spl.GetPointP4().toQPointF(), this); - connect(controlPoint2, &VControlPointSpline::ControlPointChangePosition, this, - &VModelingSpline::ControlPointChangePosition); - connect(this, &VModelingSpline::RefreshLine, controlPoint2, &VControlPointSpline::RefreshLine); - connect(this, &VModelingSpline::setEnabledPoint, controlPoint2, &VControlPointSpline::setEnabledPoint); - controlPoints.append(controlPoint2); - - if (typeCreation == Tool::FromGui) - { - AddToFile(); - } -} - -void VModelingSpline::setDialog() -{ - Q_ASSERT(dialogSpline.isNull() == false); - VSpline spl = VAbstractTool::data.GetSplineModeling(id); - dialogSpline->setP1(spl.GetP1()); - dialogSpline->setP4(spl.GetP4()); - dialogSpline->setAngle1(spl.GetAngle1()); - dialogSpline->setAngle2(spl.GetAngle2()); - dialogSpline->setKAsm1(spl.GetKasm1()); - dialogSpline->setKAsm2(spl.GetKasm2()); - dialogSpline->setKCurve(spl.GetKcurve()); -} - -VModelingSpline *VModelingSpline::Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data) -{ - qint64 p1 = dialog->getP1(); - qint64 p4 = dialog->getP4(); - qreal kAsm1 = dialog->getKAsm1(); - qreal kAsm2 = dialog->getKAsm2(); - qreal angle1 = dialog->getAngle1(); - qreal angle2 = dialog->getAngle2(); - qreal kCurve = dialog->getKCurve(); - return Create(0, p1, p4, kAsm1, kAsm2, angle1, angle2, kCurve, doc, data, Document::FullParse, - Tool::FromGui); -} - -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, - const Tool::Sources &typeCreation) -{ - VModelingSpline *spl = 0; - VSpline spline = VSpline(data->DataPointsModeling(), p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve); - qint64 id = _id; - if (typeCreation == Tool::FromGui) - { - id = data->AddSplineModeling(spline); - } - else - { - data->UpdateSplineModeling(id, spline); - if (parse != Document::FullParse) - { - doc->UpdateToolData(id, data); - } - } - data->AddLengthSpline(spline.name(), toMM(spline.GetLength())); - if (parse == Document::FullParse) - { - spl = new VModelingSpline(doc, data, id, typeCreation); - doc->AddTool(id, spl); - doc->IncrementReferens(p1); - doc->IncrementReferens(p4); - } - return spl; -} - -void VModelingSpline::FullUpdateFromFile() -{ - RefreshGeometry(); -} - -void VModelingSpline::FullUpdateFromGui(int result) -{ - if (result == QDialog::Accepted) - { - VSpline spl = VSpline (VAbstractTool::data.DataPointsModeling(), dialogSpline->getP1(), - dialogSpline->getP4(), dialogSpline->getAngle1(), dialogSpline->getAngle2(), - dialogSpline->getKAsm1(), dialogSpline->getKAsm2(), dialogSpline->getKCurve()); - - disconnect(controlPoints[0], &VControlPointSpline::ControlPointChangePosition, this, - &VModelingSpline::ControlPointChangePosition); - disconnect(controlPoints[1], &VControlPointSpline::ControlPointChangePosition, this, - &VModelingSpline::ControlPointChangePosition); - controlPoints[0]->setPos(spl.GetP2()); - controlPoints[1]->setPos(spl.GetP3()); - connect(controlPoints[0], &VControlPointSpline::ControlPointChangePosition, this, - &VModelingSpline::ControlPointChangePosition); - connect(controlPoints[1], &VControlPointSpline::ControlPointChangePosition, this, - &VModelingSpline::ControlPointChangePosition); - - spl = VSpline (VAbstractTool::data.DataPointsModeling(), dialogSpline->getP1(), - controlPoints[0]->pos(), controlPoints[1]->pos(), dialogSpline->getP4(), - dialogSpline->getKCurve()); - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute(AttrPoint1, QString().setNum(spl.GetP1())); - domElement.setAttribute(AttrPoint4, QString().setNum(spl.GetP4())); - domElement.setAttribute(AttrAngle1, QString().setNum(spl.GetAngle1())); - domElement.setAttribute(AttrAngle2, QString().setNum(spl.GetAngle2())); - domElement.setAttribute(AttrKAsm1, QString().setNum(spl.GetKasm1())); - domElement.setAttribute(AttrKAsm2, QString().setNum(spl.GetKasm2())); - domElement.setAttribute(AttrKCurve, QString().setNum(spl.GetKcurve())); - emit FullUpdateTree(); - } - } - dialogSpline.clear(); -} - -void VModelingSpline::ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position, - const QPointF &pos) -{ - Q_UNUSED(indexSpline); - VSpline spl = VAbstractTool::data.GetSplineModeling(id); - if (position == SplinePoint::FirstPoint) - { - spl.ModifiSpl (spl.GetP1(), pos, spl.GetP3(), spl.GetP4(), spl.GetKcurve()); - } - else - { - spl.ModifiSpl (spl.GetP1(), spl.GetP2(), pos, spl.GetP4(), spl.GetKcurve()); - } - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute(AttrAngle1, QString().setNum(spl.GetAngle1())); - domElement.setAttribute(AttrAngle2, QString().setNum(spl.GetAngle2())); - domElement.setAttribute(AttrKAsm1, QString().setNum(spl.GetKasm1())); - domElement.setAttribute(AttrKAsm2, QString().setNum(spl.GetKasm2())); - domElement.setAttribute(AttrKCurve, QString().setNum(spl.GetKcurve())); - emit FullUpdateTree(); - } -} - -void VModelingSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - ContextMenu(dialogSpline, this, event); -} - -void VModelingSpline::AddToFile() -{ - VSpline spl = VAbstractTool::data.GetSplineModeling(id); - QDomElement domElement = doc->createElement(TagName); - - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrPoint1, spl.GetP1()); - AddAttribute(domElement, AttrPoint4, spl.GetP4()); - AddAttribute(domElement, AttrAngle1, spl.GetAngle1()); - AddAttribute(domElement, AttrAngle2, spl.GetAngle2()); - AddAttribute(domElement, AttrKAsm1, spl.GetKasm1()); - AddAttribute(domElement, AttrKAsm2, spl.GetKasm2()); - AddAttribute(domElement, AttrKCurve, spl.GetKcurve()); - - AddToModeling(domElement); -} - -void VModelingSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - if (event->button() == Qt::LeftButton) - { - emit ChoosedTool(id, Scene::Spline); - } - QGraphicsItem::mouseReleaseEvent(event); -} - -void VModelingSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) -{ - Q_UNUSED(event); - this->setPen(QPen(currentColor, widthMainLine)); -} - -void VModelingSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) -{ - Q_UNUSED(event); - this->setPen(QPen(currentColor, widthHairLine)); -} - -void VModelingSpline::RemoveReferens() -{ - VSpline spl = VAbstractTool::data.GetSplineModeling(id); - doc->DecrementReferens(spl.GetP1()); - doc->DecrementReferens(spl.GetP4()); -} - -void VModelingSpline::RefreshGeometry() -{ - VSpline spl = VAbstractTool::data.GetSplineModeling(id); - QPainterPath path; - path.addPath(spl.GetPath()); - path.setFillRule( Qt::WindingFill ); - this->setPath(path); - QPointF splinePoint = VAbstractTool::data.GetPointModeling(spl.GetP1()).toQPointF(); - QPointF controlPoint = spl.GetP2(); - emit RefreshLine(1, SplinePoint::FirstPoint, controlPoint, splinePoint); - splinePoint = VAbstractTool::data.GetPointModeling(spl.GetP4()).toQPointF(); - controlPoint = spl.GetP3(); - emit RefreshLine(1, SplinePoint::LastPoint, controlPoint, splinePoint); - - disconnect(controlPoints[0], &VControlPointSpline::ControlPointChangePosition, this, - &VModelingSpline::ControlPointChangePosition); - disconnect(controlPoints[1], &VControlPointSpline::ControlPointChangePosition, this, - &VModelingSpline::ControlPointChangePosition); - controlPoints[0]->setPos(spl.GetP2()); - controlPoints[1]->setPos(spl.GetP3()); - connect(controlPoints[0], &VControlPointSpline::ControlPointChangePosition, this, - &VModelingSpline::ControlPointChangePosition); - connect(controlPoints[1], &VControlPointSpline::ControlPointChangePosition, this, - &VModelingSpline::ControlPointChangePosition); -} diff --git a/src/tools/modelingTools/vmodelingspline.h b/src/tools/modelingTools/vmodelingspline.h deleted file mode 100644 index b55dbb005..000000000 --- a/src/tools/modelingTools/vmodelingspline.h +++ /dev/null @@ -1,172 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingspline.h - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef VMODELINGSPLINE_H -#define VMODELINGSPLINE_H - -#include "vmodelingtool.h" -#include -#include "../../dialogs/dialogspline.h" -#include "../../widgets/vcontrolpointspline.h" -#include "../../geometry/vsplinepath.h" - -/** - * @brief The VModelingSpline class - */ -class VModelingSpline:public VModelingTool, public QGraphicsPathItem -{ - Q_OBJECT -public: - /** - * @brief VModelingSpline - * @param doc dom document container - * @param data - * @param id - * @param typeCreation - * @param parent - */ - VModelingSpline (VDomDocument *doc, VContainer *data, qint64 id, - const Tool::Sources &typeCreation, QGraphicsItem * parent = 0 ); - /** - * @brief setDialog - */ - virtual void setDialog(); - /** - * @brief Create - * @param dialog - * @param doc dom document container - * @param data - * @return - */ - static VModelingSpline* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); - /** - * @brief Create - * @param _id - * @param p1 - * @param p4 - * @param kAsm1 - * @param kAsm2 - * @param angle1 - * @param angle2 - * @param kCurve - * @param doc dom document container - * @param data - * @param parse - * @param typeCreation - * @return - */ - 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, - const Tool::Sources &typeCreation); - /** - * @brief TagName - */ - static const QString TagName; - /** - * @brief ToolType - */ - static const QString ToolType; -signals: - /** - * @brief RefreshLine - * @param indexSpline - * @param position - * @param controlPoint - * @param splinePoint - */ - void RefreshLine (const qint32 &indexSpline, SplinePoint::Position position, - const QPointF &controlPoint, const QPointF &splinePoint ); - /** - * @brief setEnabledPoint - * @param enable - */ - void setEnabledPoint ( bool enable ); -public slots: - /** - * @brief FullUpdateFromFile - */ - virtual void FullUpdateFromFile (); - /** - * @brief FullUpdateFromGui - * @param result - */ - virtual void FullUpdateFromGui ( int result ); - /** - * @brief ControlPointChangePosition - * @param indexSpline - * @param position - * @param pos - */ - void ControlPointChangePosition (const qint32 &indexSpline, SplinePoint::Position position, - const QPointF &pos); -protected: - /** - * @brief contextMenuEvent - * @param event - */ - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - /** - * @brief AddToFile - */ - virtual void AddToFile (); - /** - * @brief mouseReleaseEvent - * @param event - */ - virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); - /** - * @brief hoverMoveEvent - * @param event - */ - virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); - /** - * @brief hoverLeaveEvent - * @param event - */ - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); - /** - * @brief RemoveReferens - */ - virtual void RemoveReferens(); -private: - /** - * @brief dialogSpline - */ - QSharedPointer dialogSpline; - /** - * @brief controlPoints - */ - QVector controlPoints; - /** - * @brief RefreshGeometry - */ - void RefreshGeometry (); -}; - -#endif // VMODELINGSPLINE_H diff --git a/src/tools/modelingTools/vmodelingsplinepath.cpp b/src/tools/modelingTools/vmodelingsplinepath.cpp deleted file mode 100644 index 012713a78..000000000 --- a/src/tools/modelingTools/vmodelingsplinepath.cpp +++ /dev/null @@ -1,310 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingsplinepath.cpp - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "vmodelingsplinepath.h" - -const QString VModelingSplinePath::TagName = QStringLiteral("spline"); -const QString VModelingSplinePath::ToolType = QStringLiteral("path"); - -VModelingSplinePath::VModelingSplinePath(VDomDocument *doc, VContainer *data, qint64 id, - const Tool::Sources &typeCreation, QGraphicsItem *parent) - :VModelingTool(doc, data, id), QGraphicsPathItem(parent), dialogSplinePath(QSharedPointer()), - controlPoints(QVector()) -{ - ignoreFullUpdate = true; - VSplinePath splPath = data->GetSplinePathModeling(id); - QPainterPath path; - path.addPath(splPath.GetPath()); - path.setFillRule( Qt::WindingFill ); - this->setPath(path); - this->setPen(QPen(Qt::black, widthHairLine)); - this->setFlag(QGraphicsItem::ItemIsSelectable, true); - this->setAcceptHoverEvents(true); - - for (qint32 i = 1; i<=splPath.Count(); ++i) - { - VSpline spl = splPath.GetSpline(i); - VControlPointSpline *controlPoint = new VControlPointSpline(i, SplinePoint::FirstPoint, spl.GetP2(), - spl.GetPointP1().toQPointF(), this); - connect(controlPoint, &VControlPointSpline::ControlPointChangePosition, this, - &VModelingSplinePath::ControlPointChangePosition); - connect(this, &VModelingSplinePath::RefreshLine, controlPoint, &VControlPointSpline::RefreshLine); - connect(this, &VModelingSplinePath::setEnabledPoint, controlPoint, &VControlPointSpline::setEnabledPoint); - controlPoints.append(controlPoint); - - controlPoint = new VControlPointSpline(i, SplinePoint::LastPoint, spl.GetP3(), - spl.GetPointP4().toQPointF(), this); - connect(controlPoint, &VControlPointSpline::ControlPointChangePosition, this, - &VModelingSplinePath::ControlPointChangePosition); - connect(this, &VModelingSplinePath::RefreshLine, controlPoint, &VControlPointSpline::RefreshLine); - connect(this, &VModelingSplinePath::setEnabledPoint, controlPoint, &VControlPointSpline::setEnabledPoint); - controlPoints.append(controlPoint); - } - if (typeCreation == Tool::FromGui) - { - AddToFile(); - } -} - -void VModelingSplinePath::setDialog() -{ - Q_ASSERT(dialogSplinePath.isNull() == false); - VSplinePath splPath = VAbstractTool::data.GetSplinePathModeling(id); - dialogSplinePath->SetPath(splPath); -} - -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); -} - -VModelingSplinePath * VModelingSplinePath::Create(const qint64 _id, const VSplinePath &path, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation) -{ - VModelingSplinePath *spl = 0; - qint64 id = _id; - if (typeCreation == Tool::FromGui) - { - id = data->AddSplinePathModeling(path); - } - else - { - data->UpdateSplinePathModeling(id, path); - if (parse != Document::FullParse) - { - doc->UpdateToolData(id, data); - } - } - data->AddLengthSpline(path.name(), toMM(path.GetLength())); - if (parse == Document::FullParse) - { - spl = new VModelingSplinePath(doc, data, id, typeCreation); - doc->AddTool(id, spl); - } - return spl; -} - -void VModelingSplinePath::FullUpdateFromFile() -{ - RefreshGeometry(); -} - -void VModelingSplinePath::FullUpdateFromGui(int result) -{ - if (result == QDialog::Accepted) - { - VSplinePath splPath = dialogSplinePath->GetPath(); - for (qint32 i = 1; i<=splPath.Count(); ++i) - { - VSpline spl = splPath.GetSpline(i); - qint32 j = i*2; - disconnect(controlPoints[j-2], &VControlPointSpline::ControlPointChangePosition, this, - &VModelingSplinePath::ControlPointChangePosition); - disconnect(controlPoints[j-1], &VControlPointSpline::ControlPointChangePosition, this, - &VModelingSplinePath::ControlPointChangePosition); - controlPoints[j-2]->setPos(spl.GetP2()); - controlPoints[j-1]->setPos(spl.GetP3()); - connect(controlPoints[j-2], &VControlPointSpline::ControlPointChangePosition, this, - &VModelingSplinePath::ControlPointChangePosition); - connect(controlPoints[j-1], &VControlPointSpline::ControlPointChangePosition, this, - &VModelingSplinePath::ControlPointChangePosition); - - spl = VSpline (VAbstractTool::data.DataPointsModeling(), spl.GetP1(), controlPoints[j-2]->pos(), - controlPoints[j-1]->pos(), spl.GetP4(), splPath.getKCurve()); - CorectControlPoints(spl, splPath, i); - CorectControlPoints(spl, splPath, i); - - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve())); - UpdatePathPoint(domElement, splPath); - emit FullUpdateTree(); - } - - } - } - dialogSplinePath.clear(); -} - -void VModelingSplinePath::ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position, - const QPointF &pos) -{ - VSplinePath splPath = VAbstractTool::data.GetSplinePathModeling(id); - VSpline spl = splPath.GetSpline(indexSpline); - if (position == SplinePoint::FirstPoint) - { - spl.ModifiSpl (spl.GetP1(), pos, spl.GetP3(), spl.GetP4(), spl.GetKcurve()); - } - else - { - spl.ModifiSpl (spl.GetP1(), spl.GetP2(), pos, spl.GetP4(), spl.GetKcurve()); - } - - CorectControlPoints(spl, splPath, indexSpline); - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve())); - UpdatePathPoint(domElement, splPath); - emit FullUpdateTree(); - } -} - -void VModelingSplinePath::CorectControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline) -{ - VSplinePoint p = splPath.GetSplinePoint(indexSpline, SplinePoint::FirstPoint); - p.SetAngle(spl.GetAngle1()); - p.SetKAsm2(spl.GetKasm1()); - splPath.UpdatePoint(indexSpline, SplinePoint::FirstPoint, p); - - p = splPath.GetSplinePoint(indexSpline, SplinePoint::LastPoint); - p.SetAngle(spl.GetAngle2()-180); - p.SetKAsm1(spl.GetKasm2()); - splPath.UpdatePoint(indexSpline, SplinePoint::LastPoint, p); -} - -void VModelingSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path) -{ - QDomNodeList nodeList = node.childNodes(); - qint32 num = nodeList.size(); - for (qint32 i = 0; i < num; ++i) - { - QDomElement domElement = nodeList.at(i).toElement(); - if (domElement.isNull() == false) - { - VSplinePoint p = path[i]; - domElement.setAttribute(AttrPSpline, QString().setNum(p.P())); - domElement.setAttribute(AttrKAsm1, QString().setNum(p.KAsm1())); - domElement.setAttribute(AttrKAsm2, QString().setNum(p.KAsm2())); - domElement.setAttribute(AttrAngle, QString().setNum(p.Angle2())); - } - } -} - -void VModelingSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - ContextMenu(dialogSplinePath, this, event); -} - -void VModelingSplinePath::AddToFile() -{ - VSplinePath splPath = VAbstractTool::data.GetSplinePathModeling(id); - QDomElement domElement = doc->createElement(TagName); - - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrKCurve, splPath.getKCurve()); - - for (qint32 i = 0; i < splPath.CountPoint(); ++i) - { - AddPathPoint(domElement, splPath[i]); - } - - AddToModeling(domElement); -} - -void VModelingSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint) -{ - QDomElement pathPoint = doc->createElement(AttrPathPoint); - - AddAttribute(pathPoint, AttrPSpline, splPoint.P()); - AddAttribute(pathPoint, AttrKAsm1, splPoint.KAsm1()); - AddAttribute(pathPoint, AttrKAsm2, splPoint.KAsm2()); - AddAttribute(pathPoint, AttrAngle, splPoint.Angle2()); - - domElement.appendChild(pathPoint); -} - -void VModelingSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - if (event->button() == Qt::LeftButton) - { - emit ChoosedTool(id, Scene::SplinePath); - } - QGraphicsItem::mouseReleaseEvent(event); -} - -void VModelingSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event) -{ - Q_UNUSED(event); - this->setPen(QPen(currentColor, widthMainLine)); -} - -void VModelingSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) -{ - Q_UNUSED(event); - this->setPen(QPen(currentColor, widthHairLine)); -} - -void VModelingSplinePath::RemoveReferens() -{ - VSplinePath splPath = VAbstractTool::data.GetSplinePathModeling(id); - for (qint32 i = 0; i < splPath.Count(); ++i) - { - doc->DecrementReferens(splPath[i].P()); - } -} - -void VModelingSplinePath::RefreshGeometry() -{ - VSplinePath splPath = VAbstractTool::data.GetSplinePathModeling(id); - QPainterPath path; - path.addPath(splPath.GetPath()); - path.setFillRule( Qt::WindingFill ); - this->setPath(path); - for (qint32 i = 1; i<=splPath.Count(); ++i) - { - VSpline spl = splPath.GetSpline(i); - QPointF splinePoint = spl.GetPointP1().toQPointF(); - QPointF controlPoint = spl.GetP2(); - emit RefreshLine(i, SplinePoint::FirstPoint, controlPoint, splinePoint); - splinePoint = spl.GetPointP4().toQPointF(); - controlPoint = spl.GetP3(); - emit RefreshLine(i, SplinePoint::LastPoint, controlPoint, splinePoint); - - qint32 j = i*2; - disconnect(controlPoints[j-2], &VControlPointSpline::ControlPointChangePosition, this, - &VModelingSplinePath::ControlPointChangePosition); - disconnect(controlPoints[j-1], &VControlPointSpline::ControlPointChangePosition, this, - &VModelingSplinePath::ControlPointChangePosition); - controlPoints[j-2]->setPos(spl.GetP2()); - controlPoints[j-1]->setPos(spl.GetP3()); - connect(controlPoints[j-2], &VControlPointSpline::ControlPointChangePosition, this, - &VModelingSplinePath::ControlPointChangePosition); - connect(controlPoints[j-1], &VControlPointSpline::ControlPointChangePosition, this, - &VModelingSplinePath::ControlPointChangePosition); - } -} diff --git a/src/tools/modelingTools/vmodelingsplinepath.h b/src/tools/modelingTools/vmodelingsplinepath.h deleted file mode 100644 index 3a7ebc519..000000000 --- a/src/tools/modelingTools/vmodelingsplinepath.h +++ /dev/null @@ -1,183 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingsplinepath.h - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef VMODELINGSPLINEPATH_H -#define VMODELINGSPLINEPATH_H - -#include "vmodelingtool.h" -#include -#include "../../dialogs/dialogsplinepath.h" -#include "../../widgets/vcontrolpointspline.h" - -/** - * @brief The VModelingSplinePath class - */ -class VModelingSplinePath:public VModelingTool, public QGraphicsPathItem -{ - Q_OBJECT -public: - /** - * @brief VModelingSplinePath - * @param doc dom document container - * @param data - * @param id - * @param typeCreation - * @param parent - */ - VModelingSplinePath(VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, - QGraphicsItem * parent = 0); - /** - * @brief setDialog - */ - virtual void setDialog(); - /** - * @brief Create - * @param dialog - * @param doc dom document container - * @param data - * @return - */ - static VModelingSplinePath* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); - /** - * @brief Create - * @param _id - * @param path - * @param doc dom document container - * @param data - * @param parse - * @param typeCreation - * @return - */ - static VModelingSplinePath* Create(const qint64 _id, const VSplinePath &path, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation); - /** - * @brief TagName - */ - static const QString TagName; - /** - * @brief ToolType - */ - static const QString ToolType; -signals: - /** - * @brief RefreshLine - * @param indexSpline - * @param pos - * @param controlPoint - * @param splinePoint - */ - void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, const QPointF &controlPoint, - const QPointF &splinePoint); - /** - * @brief setEnabledPoint - * @param enable - */ - void setEnabledPoint(bool enable); -public slots: - /** - * @brief FullUpdateFromFile - */ - virtual void FullUpdateFromFile(); - /** - * @brief FullUpdateFromGui - * @param result - */ - virtual void FullUpdateFromGui(int result); - /** - * @brief ControlPointChangePosition - * @param indexSpline - * @param position - * @param pos - */ - void ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position, - const QPointF &pos); -protected: - /** - * @brief contextMenuEvent - * @param event - */ - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - /** - * @brief AddToFile - */ - virtual void AddToFile(); - /** - * @brief mouseReleaseEvent - * @param event - */ - virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); - /** - * @brief hoverMoveEvent - * @param event - */ - virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); - /** - * @brief hoverLeaveEvent - * @param event - */ - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); - /** - * @brief RemoveReferens - */ - virtual void RemoveReferens(); -private: - /** - * @brief dialogSplinePath - */ - QSharedPointer dialogSplinePath; - /** - * @brief controlPoints - */ - QVector controlPoints; - /** - * @brief RefreshGeometry - */ - void RefreshGeometry(); - /** - * @brief AddPathPoint - * @param domElement - * @param splPoint - */ - void AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint); - /** - * @brief UpdatePathPoint - * @param node - * @param path - */ - void UpdatePathPoint(QDomNode& node, VSplinePath &path); - /** - * @brief CorectControlPoints - * @param spl - * @param splPath - * @param indexSpline - */ - void CorectControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline); -}; - -#endif // VMODELINGSPLINEPATH_H diff --git a/src/tools/modelingTools/vmodelingtool.cpp b/src/tools/modelingTools/vmodelingtool.cpp deleted file mode 100644 index d3b8f05fd..000000000 --- a/src/tools/modelingTools/vmodelingtool.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingtool.cpp - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "vmodelingtool.h" -#include - -VModelingTool::VModelingTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent) - :VAbstractTool(doc, data, id, parent), ignoreContextMenuEvent(false), ignoreFullUpdate(false) -{ - _referens = 0; -} - -void VModelingTool::AddToModeling(const QDomElement &domElement) -{ - QDomElement modelingElement; - bool ok = doc->GetActivModelingElement(modelingElement); - if (ok) - { - modelingElement.appendChild(domElement); - } - else - { - qCritical()<<"Can't find tag Modeling"<< Q_FUNC_INFO; - } - 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() == false) - { - element.removeChild(domElement); - } - } - } -} diff --git a/src/tools/modelingTools/vmodelingtool.h b/src/tools/modelingTools/vmodelingtool.h deleted file mode 100644 index 09c9b17b1..000000000 --- a/src/tools/modelingTools/vmodelingtool.h +++ /dev/null @@ -1,157 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingtool.h - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef VMODELINGTOOL_H -#define VMODELINGTOOL_H - -#include "../vabstracttool.h" -#include -#include - -/** - * @brief The VModelingTool class - */ -class VModelingTool: public VAbstractTool -{ - Q_OBJECT -public: - /** - * @brief VModelingTool - * @param doc dom document container - * @param data - * @param id - * @param parent - */ - VModelingTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0); - virtual ~VModelingTool(){} - /** - * @brief setDialog - */ - virtual void setDialog(){} - /** - * @brief ignoreContextMenu - * @param enable - */ - inline void ignoreContextMenu(bool enable) {ignoreContextMenuEvent = enable;} -public slots: - /** - * @brief FullUpdateFromGui - * @param result - */ - virtual void FullUpdateFromGui(int result)=0; -protected: - /** - * @brief ignoreContextMenuEvent - */ - bool ignoreContextMenuEvent; - /** - * @brief ignoreFullUpdate - */ - bool ignoreFullUpdate; - /** - * @brief AddToModeling - * @param domElement - */ - void AddToModeling(const QDomElement &domElement); - /** - * @brief decrementReferens - */ - virtual void decrementReferens(); - template - /** - * @brief ContextMenu - * @param dialog - * @param tool - * @param event - * @param showRemove - */ - void ContextMenu(QSharedPointer &dialog, Tool *tool, QGraphicsSceneContextMenuEvent *event, - bool showRemove = true) - { - if (ignoreContextMenuEvent == false) - { - QMenu menu; - QAction *actionOption = menu.addAction(tr("Option")); - QAction *actionRemove = 0; - if (showRemove) - { - 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); - if (ignoreFullUpdate == false) - { - connect(doc, &VDomDocument::FullUpdateFromFile, dialog.data(), &Dialog::UpdateList); - } - - tool->setDialog(); - - dialog->show(); - } - if (showRemove) - { - if (selectedAction == actionRemove) - { - //deincrement referens - RemoveReferens(); - //remove form xml file - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - QDomElement element; - bool ok = doc->GetActivCalculationElement(element); - if (ok) - { - element.removeChild(domElement); - //update xml file - emit FullUpdateTree(); - //remove form scene - emit RemoveTool(tool); - } - } - } - } - } - } -}; - -#endif // VMODELINGTOOL_H diff --git a/src/tools/modelingTools/vmodelingtriangle.cpp b/src/tools/modelingTools/vmodelingtriangle.cpp deleted file mode 100644 index 57db01474..000000000 --- a/src/tools/modelingTools/vmodelingtriangle.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingtriangle.cpp - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "vmodelingtriangle.h" -#include "../drawTools/vtooltriangle.h" - -const QString VModelingTriangle::ToolType = QStringLiteral("triangle"); - -VModelingTriangle::VModelingTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id, - const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId, - const Tool::Sources &typeCreation, QGraphicsItem *parent) - :VModelingPoint(doc, data, id, parent), axisP1Id(axisP1Id), axisP2Id(axisP2Id), firstPointId(firstPointId), - secondPointId(secondPointId), dialogTriangle(QSharedPointer()) -{ - if (typeCreation == Tool::FromGui) - { - AddToFile(); - } -} - -void VModelingTriangle::setDialog() -{ - Q_ASSERT(dialogTriangle.isNull() == false); - VPointF p = VAbstractTool::data.GetPoint(id); - dialogTriangle->setAxisP1Id(axisP1Id, id); - dialogTriangle->setAxisP2Id(axisP2Id, id); - dialogTriangle->setFirstPointId(firstPointId, id); - dialogTriangle->setSecondPointId(secondPointId, id); - dialogTriangle->setPointName(p.name()); -} - -VModelingTriangle *VModelingTriangle::Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data) -{ - qint64 axisP1Id = dialog->getAxisP1Id(); - qint64 axisP2Id = dialog->getAxisP2Id(); - qint64 firstPointId = dialog->getFirstPointId(); - qint64 secondPointId = dialog->getSecondPointId(); - QString pointName = dialog->getPointName(); - return Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10, doc, data, Document::FullParse, - Tool::FromGui); -} - -VModelingTriangle *VModelingTriangle::Create(const qint64 _id, const QString &pointName, const qint64 &axisP1Id, - const qint64 &axisP2Id, const qint64 &firstPointId, - const qint64 &secondPointId, const qreal &mx, const qreal &my, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation) -{ - VModelingTriangle *tool = 0; - VPointF axisP1 = data->GetPoint(axisP1Id); - VPointF axisP2 = data->GetPoint(axisP2Id); - VPointF firstPoint = data->GetPoint(firstPointId); - VPointF secondPoint = data->GetPoint(secondPointId); - - QPointF point = VToolTriangle::FindPoint(axisP1.toQPointF(), axisP2.toQPointF(), firstPoint.toQPointF(), - secondPoint.toQPointF()); - qint64 id = _id; - if (typeCreation == Tool::FromGui) - { - id = data->AddPoint(VPointF(point.x(), point.y(), pointName, mx, my)); - } - else - { - data->UpdatePoint(id, VPointF(point.x(), point.y(), pointName, mx, my)); - if (parse != Document::FullParse) - { - doc->UpdateToolData(id, data); - } - } - if (parse == Document::FullParse) - { - tool = new VModelingTriangle(doc, data, id, axisP1Id, axisP2Id, firstPointId, secondPointId, typeCreation); - doc->AddTool(id, tool); - doc->IncrementReferens(axisP1Id); - doc->IncrementReferens(axisP2Id); - doc->IncrementReferens(firstPointId); - doc->IncrementReferens(secondPointId); - } - return tool; -} - -void VModelingTriangle::FullUpdateFromFile() -{ - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - axisP1Id = domElement.attribute(AttrAxisP1, "").toLongLong(); - axisP2Id = domElement.attribute(AttrAxisP2, "").toLongLong(); - firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); - secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); - } - VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetPoint(id)); -} - -void VModelingTriangle::FullUpdateFromGui(int result) -{ - if (result == QDialog::Accepted) - { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute(AttrName, dialogTriangle->getPointName()); - domElement.setAttribute(AttrAxisP1, QString().setNum(dialogTriangle->getAxisP1Id())); - domElement.setAttribute(AttrAxisP2, QString().setNum(dialogTriangle->getAxisP2Id())); - domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogTriangle->getFirstPointId())); - domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogTriangle->getSecondPointId())); - emit FullUpdateTree(); - } - - } - dialogTriangle.clear(); -} - -void VModelingTriangle::RemoveReferens() -{ - doc->DecrementReferens(axisP1Id); - doc->DecrementReferens(axisP2Id); - doc->DecrementReferens(firstPointId); - doc->DecrementReferens(secondPointId); -} - -void VModelingTriangle::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - ContextMenu(dialogTriangle, this, event); -} - -void VModelingTriangle::AddToFile() -{ - VPointF point = VAbstractTool::data.GetPoint(id); - QDomElement domElement = doc->createElement(TagName); - - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point.name()); - AddAttribute(domElement, AttrMx, toMM(point.mx())); - AddAttribute(domElement, AttrMy, toMM(point.my())); - - AddAttribute(domElement, AttrAxisP1, axisP1Id); - AddAttribute(domElement, AttrAxisP2, axisP2Id); - AddAttribute(domElement, AttrFirstPoint, firstPointId); - AddAttribute(domElement, AttrSecondPoint, secondPointId); - - AddToModeling(domElement); -} diff --git a/src/tools/modelingTools/vmodelingtriangle.h b/src/tools/modelingTools/vmodelingtriangle.h deleted file mode 100644 index 62ad4e844..000000000 --- a/src/tools/modelingTools/vmodelingtriangle.h +++ /dev/null @@ -1,142 +0,0 @@ -/************************************************************************ - ** - ** @file vmodelingtriangle.h - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef VMODELINGTRIANGLE_H -#define VMODELINGTRIANGLE_H - -#include "vmodelingpoint.h" -#include "../drawTools/vtooltriangle.h" -#include "../../dialogs/dialogtriangle.h" - -/** - * @brief The VModelingTriangle class - */ -class VModelingTriangle : public VModelingPoint -{ - Q_OBJECT -public: - /** - * @brief VModelingTriangle - * @param doc dom document container - * @param data - * @param id - * @param axisP1Id - * @param axisP2Id - * @param firstPointId - * @param secondPointId - * @param typeCreation - * @param parent - */ - VModelingTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id, - const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId, - const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); - /** - * @brief setDialog - */ - virtual void setDialog(); - /** - * @brief Create - * @param dialog - * @param doc dom document container - * @param data - * @return - */ - static VModelingTriangle* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); - /** - * @brief Create - * @param _id - * @param pointName - * @param axisP1Id - * @param axisP2Id - * @param firstPointId - * @param secondPointId - * @param mx - * @param my - * @param doc dom document container - * @param data - * @param parse - * @param typeCreation - * @return - */ - static VModelingTriangle* Create(const qint64 _id, const QString &pointName, const qint64 &axisP1Id, - const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId, - const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation); - /** - * @brief ToolType - */ - static const QString ToolType; -public slots: - /** - * @brief FullUpdateFromFile - */ - virtual void FullUpdateFromFile(); - /** - * @brief FullUpdateFromGui - * @param result - */ - virtual void FullUpdateFromGui(int result); -protected: - /** - * @brief RemoveReferens - */ - virtual void RemoveReferens(); - /** - * @brief contextMenuEvent - * @param event - */ - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - /** - * @brief AddToFile - */ - virtual void AddToFile(); -private: - Q_DISABLE_COPY(VModelingTriangle) - /** - * @brief axisP1Id - */ - qint64 axisP1Id; - /** - * @brief axisP2Id - */ - qint64 axisP2Id; - /** - * @brief firstPointId - */ - qint64 firstPointId; - /** - * @brief secondPointId - */ - qint64 secondPointId; - /** - * @brief dialogTriangle - */ - QSharedPointer dialogTriangle; -}; - -#endif // VMODELINGTRIANGLE_H diff --git a/src/tools/nodeDetails/vabstractnode.cpp b/src/tools/nodeDetails/vabstractnode.cpp index 48374a891..f86408eaf 100644 --- a/src/tools/nodeDetails/vabstractnode.cpp +++ b/src/tools/nodeDetails/vabstractnode.cpp @@ -30,13 +30,9 @@ #include const QString VAbstractNode::AttrIdObject = QStringLiteral("idObject"); -const QString VAbstractNode::AttrTypeObject = QStringLiteral("typeObject"); -const QString VAbstractNode::TypeObjectCalculation = QStringLiteral("Calculation"); -const QString VAbstractNode::TypeObjectModeling = QStringLiteral("Modeling"); -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(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode, QObject *parent) + : VAbstractTool(doc, data, id, parent), idNode(idNode) { _referens = 0; } diff --git a/src/tools/nodeDetails/vabstractnode.h b/src/tools/nodeDetails/vabstractnode.h index b2190c760..cb52c85f1 100644 --- a/src/tools/nodeDetails/vabstractnode.h +++ b/src/tools/nodeDetails/vabstractnode.h @@ -44,37 +44,19 @@ public: * @param data * @param id * @param idNode - * @param typeobject * @param parent */ - VAbstractNode(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode, - Draw::Draws typeobject, QObject *parent = 0 ); + VAbstractNode(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode, QObject *parent = 0 ); virtual ~VAbstractNode() {} /** * @brief AttrIdObject */ static const QString AttrIdObject; - /** - * @brief AttrTypeObject - */ - static const QString AttrTypeObject; - /** - * @brief TypeObjectCalculation - */ - static const QString TypeObjectCalculation; - /** - * @brief TypeObjectModeling - */ - static const QString TypeObjectModeling; protected: /** * @brief idNode */ qint64 idNode; - /** - * @brief typeobject - */ - Draw::Draws typeobject; /** * @brief AddToModeling * @param domElement diff --git a/src/tools/nodeDetails/vnodearc.cpp b/src/tools/nodeDetails/vnodearc.cpp index 27ebfdea5..03c843ac3 100644 --- a/src/tools/nodeDetails/vnodearc.cpp +++ b/src/tools/nodeDetails/vnodearc.cpp @@ -33,9 +33,9 @@ const QString VNodeArc::TagName = QStringLiteral("arc"); const QString VNodeArc::ToolType = QStringLiteral("modeling"); -VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, Draw::Draws typeobject, - const Tool::Sources &typeCreation, QGraphicsItem * parent) - :VAbstractNode(doc, data, id, idArc, typeobject), QGraphicsPathItem(parent) +VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Tool::Sources &typeCreation, + QGraphicsItem * parent) + :VAbstractNode(doc, data, id, idArc), QGraphicsPathItem(parent) { RefreshGeometry(); this->setPen(QPen(baseColor, widthHairLine)); @@ -48,12 +48,12 @@ VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, } } -void VNodeArc::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Draw::Draws &typeobject, - const Document::Documents &parse, const Tool::Sources &typeCreation) +void VNodeArc::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Document::Documents &parse, + const Tool::Sources &typeCreation) { if (parse == Document::FullParse) { - VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeobject, typeCreation); + VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeCreation); Q_ASSERT(arc != 0); doc->AddTool(id, arc); doc->IncrementReferens(idArc); @@ -76,14 +76,6 @@ void VNodeArc::AddToFile() AddAttribute(domElement, AttrId, id); AddAttribute(domElement, AttrType, ToolType); AddAttribute(domElement, AttrIdObject, idNode); - if (typeobject == Draw::Calculation) - { - AddAttribute(domElement, AttrTypeObject, TypeObjectCalculation); - } - else - { - AddAttribute(domElement, AttrTypeObject, ToolType ); - } AddToModeling(domElement); } @@ -111,7 +103,7 @@ void VNodeArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VNodeArc::RefreshGeometry() { - VArc arc = VAbstractTool::data.GetArcModeling(id); + VArc arc = VAbstractTool::data.GetArc(id); QPainterPath path; path.addPath(arc.GetPath()); path.setFillRule( Qt::WindingFill ); diff --git a/src/tools/nodeDetails/vnodearc.h b/src/tools/nodeDetails/vnodearc.h index b99abd458..571687551 100644 --- a/src/tools/nodeDetails/vnodearc.h +++ b/src/tools/nodeDetails/vnodearc.h @@ -45,11 +45,10 @@ public: * @param data * @param id * @param idArc - * @param typeobject * @param typeCreation * @param parent */ - VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, Draw::Draws typeobject, + VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief Create @@ -57,12 +56,11 @@ public: * @param data * @param id * @param idArc - * @param typeobject * @param parse * @param typeCreation */ - static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Draw::Draws &typeobject, - const Document::Documents &parse, const Tool::Sources &typeCreation); + static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Document::Documents &parse, + const Tool::Sources &typeCreation); /** * @brief TagName */ diff --git a/src/tools/nodeDetails/vnodepoint.cpp b/src/tools/nodeDetails/vnodepoint.cpp index f1ed87dc3..dc7e8f293 100644 --- a/src/tools/nodeDetails/vnodepoint.cpp +++ b/src/tools/nodeDetails/vnodepoint.cpp @@ -33,10 +33,10 @@ const QString VNodePoint::TagName = QStringLiteral("point"); const QString VNodePoint::ToolType = QStringLiteral("modeling"); -VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Draws typeobject, +VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, const Tool::Sources &typeCreation, QGraphicsItem *parent) - :VAbstractNode(doc, data, id, idPoint, typeobject), QGraphicsEllipseItem(parent), radius(toPixel(1.5)), - namePoint(0), lineName(0) + :VAbstractNode(doc, data, id, idPoint), QGraphicsEllipseItem(parent), radius(toPixel(1.5)), namePoint(0), + lineName(0) { namePoint = new VGraphicsSimpleTextItem(this); lineName = new QGraphicsLineItem(this); @@ -46,19 +46,19 @@ VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 id this->setBrush(QBrush(Qt::NoBrush)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setAcceptHoverEvents(true); - RefreshPointGeometry(VAbstractTool::data.GetPointModeling(id)); + RefreshPointGeometry(VAbstractTool::data.GetPoint(id)); if (typeCreation == Tool::FromGui) { AddToFile(); } } -void VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, const Draw::Draws &typeobject, +void VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, const Document::Documents &parse, const Tool::Sources &typeCreation) { if (parse == Document::FullParse) { - VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeobject, typeCreation); + VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeCreation); Q_ASSERT(point != 0); doc->AddTool(id, point); doc->IncrementReferens(idPoint); @@ -71,25 +71,17 @@ void VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 i void VNodePoint::FullUpdateFromFile() { - RefreshPointGeometry(VAbstractTool::data.GetPointModeling(id)); + RefreshPointGeometry(VAbstractTool::data.GetPoint(id)); } void VNodePoint::AddToFile() { - VPointF point = VAbstractTool::data.GetPointModeling(id); + VPointF point = VAbstractTool::data.GetPoint(id); QDomElement domElement = doc->createElement(TagName); AddAttribute(domElement, AttrId, id); AddAttribute(domElement, AttrType, ToolType); AddAttribute(domElement, AttrIdObject, idNode); - if (typeobject == Draw::Calculation) - { - AddAttribute(domElement, AttrTypeObject, TypeObjectCalculation); - } - else - { - AddAttribute(domElement, AttrTypeObject, TypeObjectModeling); - } AddAttribute(domElement, AttrMx, toMM(point.mx())); AddAttribute(domElement, AttrMy, toMM(point.my())); @@ -120,7 +112,7 @@ void VNodePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VNodePoint::NameChangePosition(const QPointF &pos) { - VPointF point = VAbstractTool::data.GetPointModeling(id); + VPointF point = VAbstractTool::data.GetPoint(id); QPointF p = pos - this->pos(); point.setMx(p.x()); point.setMy(p.y()); diff --git a/src/tools/nodeDetails/vnodepoint.h b/src/tools/nodeDetails/vnodepoint.h index fcc63b362..e724430a0 100644 --- a/src/tools/nodeDetails/vnodepoint.h +++ b/src/tools/nodeDetails/vnodepoint.h @@ -45,11 +45,10 @@ public: * @param data * @param id * @param idPoint - * @param typeobject * @param typeCreation * @param parent */ - VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Draws typeobject, + VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0 ); /** * @brief Create @@ -57,11 +56,10 @@ public: * @param data * @param id * @param idPoint - * @param typeobject * @param parse * @param typeCreation */ - static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, const Draw::Draws &typeobject, + static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, const Document::Documents &parse, const Tool::Sources &typeCreation); /** * @brief TagName diff --git a/src/tools/nodeDetails/vnodespline.cpp b/src/tools/nodeDetails/vnodespline.cpp index ac89eaac7..1dab7b856 100644 --- a/src/tools/nodeDetails/vnodespline.cpp +++ b/src/tools/nodeDetails/vnodespline.cpp @@ -33,9 +33,9 @@ const QString VNodeSpline::TagName = QStringLiteral("spline"); const QString VNodeSpline::ToolType = QStringLiteral("modelingSpline"); -VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject, +VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, const Tool::Sources &typeCreation, QGraphicsItem * parent) - :VAbstractNode(doc, data, id, idSpline, typeobject), QGraphicsPathItem(parent) + :VAbstractNode(doc, data, id, idSpline), QGraphicsPathItem(parent) { RefreshGeometry(); this->setPen(QPen(baseColor, widthHairLine)); @@ -49,13 +49,12 @@ VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 } VNodeSpline *VNodeSpline::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - const Draw::Draws &typeobject, const Document::Documents &parse, - const Tool::Sources &typeCreation) + const Document::Documents &parse, const Tool::Sources &typeCreation) { VNodeSpline *spl = 0; if (parse == Document::FullParse) { - spl = new VNodeSpline(doc, data, id, idSpline, typeobject, typeCreation); + spl = new VNodeSpline(doc, data, id, idSpline, typeCreation); doc->AddTool(id, spl); doc->IncrementReferens(idSpline); } @@ -78,14 +77,6 @@ void VNodeSpline::AddToFile() AddAttribute(domElement, AttrId, id); AddAttribute(domElement, AttrType, ToolType); AddAttribute(domElement, AttrIdObject, idNode); - if (typeobject == Draw::Calculation) - { - AddAttribute(domElement, AttrTypeObject, TypeObjectCalculation); - } - else - { - AddAttribute(domElement, AttrTypeObject, TypeObjectModeling); - } AddToModeling(domElement); } @@ -113,7 +104,7 @@ void VNodeSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VNodeSpline::RefreshGeometry() { - VSpline spl = VAbstractTool::data.GetSplineModeling(id); + VSpline spl = VAbstractTool::data.GetSpline(id); QPainterPath path; path.addPath(spl.GetPath()); path.setFillRule( Qt::WindingFill ); diff --git a/src/tools/nodeDetails/vnodespline.h b/src/tools/nodeDetails/vnodespline.h index 016992a35..0e4b64837 100644 --- a/src/tools/nodeDetails/vnodespline.h +++ b/src/tools/nodeDetails/vnodespline.h @@ -45,11 +45,10 @@ public: * @param data * @param id * @param idSpline - * @param typeobject * @param typeCreation * @param parent */ - VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject, + VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief Create @@ -57,14 +56,12 @@ public: * @param data * @param id * @param idSpline - * @param typeobject * @param parse * @param typeCreation * @return */ static VNodeSpline *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - const Draw::Draws &typeobject, const Document::Documents &parse, - const Tool::Sources &typeCreation); + const Document::Documents &parse, const Tool::Sources &typeCreation); /** * @brief TagName */ diff --git a/src/tools/nodeDetails/vnodesplinepath.cpp b/src/tools/nodeDetails/vnodesplinepath.cpp index 250581c2d..4781ceaa8 100644 --- a/src/tools/nodeDetails/vnodesplinepath.cpp +++ b/src/tools/nodeDetails/vnodesplinepath.cpp @@ -34,8 +34,8 @@ const QString VNodeSplinePath::TagName = QStringLiteral("spline"); const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath"); VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Draws typeobject, const Tool::Sources &typeCreation, QGraphicsItem * parent) - :VAbstractNode(doc, data, id, idSpline, typeobject), QGraphicsPathItem(parent) + const Tool::Sources &typeCreation, QGraphicsItem * parent) + :VAbstractNode(doc, data, id, idSpline), QGraphicsPathItem(parent) { RefreshGeometry(); this->setPen(QPen(baseColor, widthHairLine)); @@ -49,15 +49,14 @@ VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, } void VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - const Draw::Draws &typeobject, const Document::Documents &parse, - const Tool::Sources &typeCreation) + const Document::Documents &parse, const Tool::Sources &typeCreation) { if (parse == Document::FullParse) { - VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeobject, typeCreation); + VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeCreation); Q_ASSERT(splPath != 0); doc->AddTool(id, splPath); - VSplinePath path = data->GetSplinePathModeling(id); + VSplinePath path = data->GetSplinePath(id); const QVector *points = path.GetPoint(); for (qint32 i = 0; isize(); ++i) { @@ -82,14 +81,6 @@ void VNodeSplinePath::AddToFile() AddAttribute(domElement, AttrId, id); AddAttribute(domElement, AttrType, ToolType); AddAttribute(domElement, AttrIdObject, idNode); - if (typeobject == Draw::Calculation) - { - AddAttribute(domElement, AttrTypeObject, TypeObjectCalculation); - } - else - { - AddAttribute(domElement, AttrTypeObject, TypeObjectModeling); - } AddToModeling(domElement); } @@ -117,7 +108,7 @@ void VNodeSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VNodeSplinePath::RefreshGeometry() { - VSplinePath splPath = VAbstractTool::data.GetSplinePathModeling(id); + VSplinePath splPath = VAbstractTool::data.GetSplinePath(id); QPainterPath path; path.addPath(splPath.GetPath()); path.setFillRule( Qt::WindingFill ); diff --git a/src/tools/nodeDetails/vnodesplinepath.h b/src/tools/nodeDetails/vnodesplinepath.h index 831e9860d..b82e365e8 100644 --- a/src/tools/nodeDetails/vnodesplinepath.h +++ b/src/tools/nodeDetails/vnodesplinepath.h @@ -45,23 +45,21 @@ public: * @param data * @param id * @param idSpline - * @param typeobject * @param typeCreation * @param parent */ VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Draws typeobject, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); + const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief Create * @param doc dom document container * @param data * @param id * @param idSpline - * @param typeobject * @param parse * @param typeCreation */ - static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, const Draw::Draws &typeobject, + static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, const Document::Documents &parse, const Tool::Sources &typeCreation); /** * @brief TagName diff --git a/src/tools/tools.pri b/src/tools/tools.pri index e90288cde..d9074461e 100644 --- a/src/tools/tools.pri +++ b/src/tools/tools.pri @@ -22,24 +22,6 @@ HEADERS += \ src/tools/drawTools/vtoolalongline.h \ src/tools/drawTools/vdrawtool.h \ src/tools/drawTools/drawtools.h \ - src/tools/modelingTools/vmodelingtriangle.h \ - src/tools/modelingTools/vmodelingtool.h \ - src/tools/modelingTools/vmodelingsplinepath.h \ - src/tools/modelingTools/vmodelingspline.h \ - src/tools/modelingTools/vmodelingshoulderpoint.h \ - src/tools/modelingTools/vmodelingpointofintersection.h \ - src/tools/modelingTools/vmodelingpointofcontact.h \ - src/tools/modelingTools/vmodelingpoint.h \ - src/tools/modelingTools/vmodelingnormal.h \ - src/tools/modelingTools/vmodelinglinepoint.h \ - src/tools/modelingTools/vmodelinglineintersect.h \ - src/tools/modelingTools/vmodelingline.h \ - src/tools/modelingTools/vmodelingheight.h \ - src/tools/modelingTools/vmodelingendline.h \ - src/tools/modelingTools/vmodelingbisector.h \ - src/tools/modelingTools/vmodelingarc.h \ - src/tools/modelingTools/vmodelingalongline.h \ - src/tools/modelingTools/modelingtools.h \ src/tools/nodeDetails/vnodesplinepath.h \ src/tools/nodeDetails/vnodespline.h \ src/tools/nodeDetails/vnodepoint.h \ @@ -47,9 +29,7 @@ HEADERS += \ src/tools/nodeDetails/vabstractnode.h \ src/tools/nodeDetails/nodedetails.h \ src/tools/drawTools/vtoolcutspline.h \ - src/tools/modelingTools/vmodelingcutspline.h \ - src/tools/drawTools/vtoolcutsplinepath.h \ - src/tools/modelingTools/vmodelingcutsplinepath.h + src/tools/drawTools/vtoolcutsplinepath.h SOURCES += \ src/tools/vtooldetail.cpp \ @@ -73,29 +53,10 @@ SOURCES += \ src/tools/drawTools/vtoolarc.cpp \ src/tools/drawTools/vtoolalongline.cpp \ src/tools/drawTools/vdrawtool.cpp \ - src/tools/modelingTools/vmodelingtriangle.cpp \ - src/tools/modelingTools/vmodelingtool.cpp \ - src/tools/modelingTools/vmodelingsplinepath.cpp \ - src/tools/modelingTools/vmodelingspline.cpp \ - src/tools/modelingTools/vmodelingshoulderpoint.cpp \ - src/tools/modelingTools/vmodelingpointofintersection.cpp \ - src/tools/modelingTools/vmodelingpointofcontact.cpp \ - src/tools/modelingTools/vmodelingpoint.cpp \ - src/tools/modelingTools/vmodelingnormal.cpp \ - src/tools/modelingTools/vmodelinglinepoint.cpp \ - src/tools/modelingTools/vmodelinglineintersect.cpp \ - src/tools/modelingTools/vmodelingline.cpp \ - src/tools/modelingTools/vmodelingheight.cpp \ - src/tools/modelingTools/vmodelingendline.cpp \ - src/tools/modelingTools/vmodelingbisector.cpp \ - src/tools/modelingTools/vmodelingarc.cpp \ - src/tools/modelingTools/vmodelingalongline.cpp \ src/tools/nodeDetails/vnodesplinepath.cpp \ src/tools/nodeDetails/vnodespline.cpp \ src/tools/nodeDetails/vnodepoint.cpp \ src/tools/nodeDetails/vnodearc.cpp \ src/tools/nodeDetails/vabstractnode.cpp \ src/tools/drawTools/vtoolcutspline.cpp \ - src/tools/modelingTools/vmodelingcutspline.cpp \ - src/tools/drawTools/vtoolcutsplinepath.cpp \ - src/tools/modelingTools/vmodelingcutsplinepath.cpp + src/tools/drawTools/vtoolcutsplinepath.cpp diff --git a/src/tools/vtooldetail.cpp b/src/tools/vtooldetail.cpp index c1a7fee4d..f1cb24042 100644 --- a/src/tools/vtooldetail.cpp +++ b/src/tools/vtooldetail.cpp @@ -28,8 +28,6 @@ #include "vtooldetail.h" #include "nodeDetails/nodedetails.h" -#include "modelingTools/vmodelingtool.h" -#include "modelingTools/modelingtools.h" const QString VToolDetail::TagName = QStringLiteral("detail"); const QString VToolDetail::TagNode = QStringLiteral("node"); @@ -63,60 +61,6 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, case (Tool::NodeSplinePath): InitTool(scene, detail[i]); break; - case (Tool::AlongLineTool): - InitTool(scene, detail[i]); - break; - case (Tool::ArcTool): - InitTool(scene, detail[i]); - break; - case (Tool::BisectorTool): - InitTool(scene, detail[i]); - break; - case (Tool::EndLineTool): - InitTool(scene, detail[i]); - break; - case (Tool::LineIntersectTool): - InitTool(scene, detail[i]); - break; - case (Tool::LineTool): - InitTool(scene, detail[i]); - break; - case (Tool::NormalTool): - InitTool(scene, detail[i]); - break; - case (Tool::PointOfContact): - InitTool(scene, detail[i]); - break; - case (Tool::ShoulderPointTool): - InitTool(scene, detail[i]); - break; - case (Tool::SplinePathTool): - InitTool(scene, detail[i]); - break; - case (Tool::SplineTool): - InitTool(scene, detail[i]); - break; - case (Tool::Height): - InitTool(scene, detail[i]); - break; - case (Tool::Triangle): - InitTool(scene, detail[i]); - break; - case (Tool::PointOfIntersection): - InitTool(scene, detail[i]); - break; - case (Tool::CutSplineTool): - InitTool(scene, detail[i]); - break; - case (Tool::CutSplinePathTool): - InitTool(scene, detail[i]); - break; - case (Tool::SimpleSpline): - //No need init this tool. See CutSplineTool. - break; - case (Tool::SimpleSplinePath): - //No need init this tool. See CutSplinePathTool. - break; default: qWarning()<<"Get wrong tool type. Ignore."; break; @@ -153,73 +97,37 @@ void VToolDetail::Create(QSharedPointer &dialog, VMainGraphicsScen { case (Tool::NodePoint): { - VPointF point; - if (detail[i].getMode() == Draw::Calculation) - { - point = data->GetPoint(detail[i].getId()); - } - else - { - point = data->GetPointModeling(detail[i].getId()); - } - id = data->AddPointModeling(point); - VNodePoint::Create(doc, data, id, detail[i].getId(), detail[i].getMode(), - Document::FullParse, Tool::FromGui); + VPointF point = data->GetPoint(detail[i].getId()); + id = data->AddPoint(point); + VNodePoint::Create(doc, data, id, detail[i].getId(), Document::FullParse, Tool::FromGui); } break; case (Tool::NodeArc): { - VArc arc; - if (detail[i].getMode() == Draw::Calculation) - { - arc = data->GetArc(detail[i].getId()); - } - else - { - arc = data->GetArcModeling(detail[i].getId()); - } - id = data->AddArcModeling(arc); - VNodeArc::Create(doc, data, id, detail[i].getId(), detail[i].getMode(), - Document::FullParse, Tool::FromGui); + VArc arc = data->GetArc(detail[i].getId()); + id = data->AddArc(arc); + VNodeArc::Create(doc, data, id, detail[i].getId(), Document::FullParse, Tool::FromGui); } break; case (Tool::NodeSpline): { - VSpline spline; - if (detail[i].getMode() == Draw::Calculation) - { - spline = data->GetSpline(detail[i].getId()); - } - else - { - spline = data->GetSplineModeling(detail[i].getId()); - } - id = data->AddSplineModeling(spline); - VNodeSpline::Create(doc, data, id, detail[i].getId(), detail[i].getMode(), - Document::FullParse, Tool::FromGui); + VSpline spline = data->GetSpline(detail[i].getId()); + id = data->AddSpline(spline); + VNodeSpline::Create(doc, data, id, detail[i].getId(), Document::FullParse, Tool::FromGui); } break; case (Tool::NodeSplinePath): { - VSplinePath splinePath; - if (detail[i].getMode() == Draw::Calculation) - { - splinePath = data->GetSplinePath(detail[i].getId()); - } - else - { - splinePath = data->GetSplinePathModeling(detail[i].getId()); - } - id = data->AddSplinePathModeling(splinePath); - VNodeSplinePath::Create(doc, data, id, detail[i].getId(), detail[i].getMode(), - Document::FullParse, Tool::FromGui); + VSplinePath splinePath = data->GetSplinePath(detail[i].getId()); + id = data->AddSplinePath(splinePath); + VNodeSplinePath::Create(doc, data, id, detail[i].getId(), Document::FullParse, Tool::FromGui); } break; default: qWarning()<<"May be wrong tool type!!! Ignoring."<screenPos()); if (selectedAction == actionOption) { - dialogDetail = QSharedPointer(new DialogDetail(getData(), Draw::Modeling)); + dialogDetail = QSharedPointer(new DialogDetail(getData())); connect(qobject_cast< VMainGraphicsScene * >(this->scene()), &VMainGraphicsScene::ChoosedObject, dialogDetail.data(), &DialogDetail::ChoosedObject); connect(dialogDetail.data(), &DialogDetail::DialogClosed, this, &VToolDetail::FullUpdateFromGui); @@ -413,24 +321,6 @@ void VToolDetail::AddNode(QDomElement &domElement, VNodeDetail &node) } switch (node.getTypeTool()) { - case (Tool::AlongLineTool): - AddAttribute(nod, AttrType, QStringLiteral("AlongLineTool")); - break; - case (Tool::ArcTool): - AddAttribute(nod, AttrType, QStringLiteral("ArcTool")); - break; - case (Tool::BisectorTool): - AddAttribute(nod, AttrType, QStringLiteral("BisectorTool")); - break; - case (Tool::EndLineTool): - AddAttribute(nod, AttrType, QStringLiteral("EndLineTool")); - break; - case (Tool::LineIntersectTool): - AddAttribute(nod, AttrType, QStringLiteral("LineIntersectTool")); - break; - case (Tool::LineTool): - AddAttribute(nod, AttrType, QStringLiteral("LineTool")); - break; case (Tool::NodeArc): AddAttribute(nod, AttrType, QStringLiteral("NodeArc")); break; @@ -443,36 +333,6 @@ void VToolDetail::AddNode(QDomElement &domElement, VNodeDetail &node) case (Tool::NodeSplinePath): AddAttribute(nod, AttrType, QStringLiteral("NodeSplinePath")); break; - case (Tool::NormalTool): - AddAttribute(nod, AttrType, QStringLiteral("NormalTool")); - break; - case (Tool::PointOfContact): - AddAttribute(nod, AttrType, QStringLiteral("PointOfContact")); - break; - case (Tool::ShoulderPointTool): - AddAttribute(nod, AttrType, QStringLiteral("ShoulderPointTool")); - break; - case (Tool::SplinePathTool): - AddAttribute(nod, AttrType, QStringLiteral("SplinePathTool")); - break; - case (Tool::SplineTool): - AddAttribute(nod, AttrType, QStringLiteral("SplineTool")); - break; - case (Tool::Height): - AddAttribute(nod, AttrType, QStringLiteral("Height")); - break; - case (Tool::Triangle): - AddAttribute(nod, AttrType, QStringLiteral("Triangle")); - break; - case (Tool::PointOfIntersection): - AddAttribute(nod, AttrType, QStringLiteral("PointOfIntersection")); - break; - case (Tool::CutSplineTool): - AddAttribute(nod, AttrType, QStringLiteral("CutSplineTool")); - break; - case (Tool::CutSplinePathTool): - AddAttribute(nod, AttrType, QStringLiteral("CutSplinePathTool")); - break; default: qWarning()<<"May be wrong tool type!!! Ignoring."< @@ -532,22 +531,22 @@ void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsSce { if (domElement.tagName() == "point") { - ParsePointElement(scene, domElement, parse, domElement.attribute("type", ""), mode); + ParsePointElement(scene, domElement, parse, domElement.attribute("type", "")); continue; } if (domElement.tagName() == "line") { - ParseLineElement(scene, domElement, parse, mode); + ParseLineElement(scene, domElement, parse); continue; } if (domElement.tagName() == "spline") { - ParseSplineElement(scene, domElement, parse, domElement.attribute("type", ""), mode); + ParseSplineElement(scene, domElement, parse, domElement.attribute("type", "")); continue; } if (domElement.tagName() == "arc") { - ParseArcElement(scene, domElement, parse, domElement.attribute("type", ""), mode); + ParseArcElement(scene, domElement, parse, domElement.attribute("type", "")); continue; } } @@ -584,101 +583,33 @@ void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDo qreal mx = toPixel(GetParametrDouble(element, "mx")); qreal my = toPixel(GetParametrDouble(element, "my")); Tool::Tools tool; - Draw::Draws mode; NodeDetail::NodeDetails nodeType = NodeDetail::Contour; QString t = GetParametrString(element, "type"); if (t == "NodePoint") { tool = Tool::NodePoint; - VPointF point = data->GetPointModeling(id); - mode = point.getMode(); - oldDetail.append(VNodeDetail(point.getIdObject(), tool, mode, NodeDetail::Contour)); + VPointF point = data->GetPoint(id); + oldDetail.append(VNodeDetail(point.getIdObject(), tool, NodeDetail::Contour)); } else if (t == "NodeArc") { tool = Tool::NodeArc; - VArc arc = data->GetArcModeling(id); - mode = arc.getMode(); - oldDetail.append(VNodeDetail(arc.getIdObject(), tool, mode, NodeDetail::Contour)); + VArc arc = data->GetArc(id); + oldDetail.append(VNodeDetail(arc.getIdObject(), tool, NodeDetail::Contour)); } else if (t == "NodeSpline") { tool = Tool::NodeSpline; - VSpline spl = data->GetSplineModeling(id); - mode = spl.getMode(); - oldDetail.append(VNodeDetail(spl.getIdObject(), tool, mode, NodeDetail::Contour)); + VSpline spl = data->GetSpline(id); + oldDetail.append(VNodeDetail(spl.getIdObject(), tool, NodeDetail::Contour)); } else if (t == "NodeSplinePath") { tool = Tool::NodeSplinePath; - VSplinePath splPath = data->GetSplinePathModeling(id); - mode = splPath.getMode(); - oldDetail.append(VNodeDetail(splPath.getIdObject(), tool, mode, NodeDetail::Contour)); + VSplinePath splPath = data->GetSplinePath(id); + oldDetail.append(VNodeDetail(splPath.getIdObject(), tool, NodeDetail::Contour)); } - else if (t == "AlongLineTool") - { - tool = Tool::AlongLineTool; - } - else if (t == "ArcTool") - { - tool = Tool::ArcTool; - } - else if (t == "BisectorTool") - { - tool = Tool::BisectorTool; - } - else if (t == "EndLineTool") - { - tool = Tool::EndLineTool; - } - else if (t == "LineIntersectTool") - { - tool = Tool::LineIntersectTool; - } - else if (t == "LineTool") - { - tool = Tool::LineTool; - } - else if (t == "NormalTool") - { - tool = Tool::NormalTool; - } - else if (t == "PointOfContact") - { - tool = Tool::PointOfContact; - } - else if (t == "ShoulderPointTool") - { - tool = Tool::ShoulderPointTool; - } - else if (t == "SplinePathTool") - { - tool = Tool::SplinePathTool; - } - else if (t == "SplineTool") - { - tool = Tool::SplineTool; - } - else if (t == "Height") - { - tool = Tool::Height; - } - else if (t == "Triangle") - { - tool = Tool::Triangle; - } - else if (t == "PointOfIntersection") - { - tool = Tool::PointOfIntersection; - } - else if (t == "CutSplineTool") - { - tool = Tool::CutSplineTool; - nodeType = NodeDetail::Modeling; - detail.append(VNodeDetail(id + 1, Tool::SimpleSpline, Draw::Modeling, nodeType, mx, my)); - detail.append(VNodeDetail(id + 2, Tool::SimpleSplinePath, Draw::Modeling, nodeType, mx, my)); - } - detail.append(VNodeDetail(id, tool, Draw::Modeling, nodeType, mx, my)); + detail.append(VNodeDetail(id, tool, nodeType, mx, my)); } } } @@ -716,7 +647,7 @@ void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomEleme } void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement, - const Document::Documents &parse, const QString& type, const Draw::Draws &mode) + const Document::Documents &parse, const QString& type) { Q_ASSERT(scene != 0); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); @@ -768,16 +699,9 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen QString formula = GetParametrString(domElement, "length"); qint64 basePointId = GetParametrLongLong(domElement, "basePoint"); qreal angle = GetParametrDouble(domElement, "angle"); - if (mode == Draw::Calculation) - { - VToolEndLine::Create(id, name, typeLine, formula, angle, basePointId, mx, my, scene, this, - data, parse, Tool::FromFile); - } - else - { - VModelingEndLine::Create(id, name, typeLine, formula, angle, basePointId, mx, my, this, - data, parse, Tool::FromFile); - } + + VToolEndLine::Create(id, name, typeLine, formula, angle, basePointId, mx, my, scene, this, data, parse, + Tool::FromFile); return; } catch (const VExceptionBadId &e) @@ -800,16 +724,8 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint"); qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint"); - if (mode == Draw::Calculation) - { - VToolAlongLine::Create(id, name, typeLine, formula, firstPointId, secondPointId, mx, my, - scene, this, data, parse, Tool::FromFile); - } - else - { - VModelingAlongLine::Create(id, name, typeLine, formula, firstPointId, secondPointId, mx, my, - this, data, parse, Tool::FromFile); - } + VToolAlongLine::Create(id, name, typeLine, formula, firstPointId, secondPointId, mx, my, scene, this, data, + parse, Tool::FromFile); return; } catch (const VExceptionBadId &e) @@ -833,16 +749,8 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen qint64 p2Line = GetParametrLongLong(domElement, "p2Line"); qint64 pShoulder = GetParametrLongLong(domElement, "pShoulder"); - if (mode == Draw::Calculation) - { - VToolShoulderPoint::Create(id, formula, p1Line, p2Line, pShoulder, typeLine, name, mx, my, - scene, this, data, parse, Tool::FromFile); - } - else - { - VModelingShoulderPoint::Create(id, formula, p1Line, p2Line, pShoulder, typeLine, name, mx, - my, this, data, parse, Tool::FromFile); - } + VToolShoulderPoint::Create(id, formula, p1Line, p2Line, pShoulder, typeLine, name, mx, my, scene, this, + data, parse, Tool::FromFile); return; } catch (const VExceptionBadId &e) @@ -866,16 +774,8 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint"); qreal angle = GetParametrDouble(domElement, "angle"); - if (mode == Draw::Calculation) - { - VToolNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, angle, - mx, my, scene, this, data, parse, Tool::FromFile); - } - else - { - VModelingNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, angle, - mx, my, this, data, parse, Tool::FromFile); - } + VToolNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, angle, mx, my, scene, this, + data, parse, Tool::FromFile); return; } catch (const VExceptionBadId &e) @@ -899,16 +799,8 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint"); qint64 thirdPointId = GetParametrLongLong(domElement, "thirdPoint"); - if (mode == Draw::Calculation) - { - VToolBisector::Create(id, formula, firstPointId, secondPointId, thirdPointId, typeLine, - name, mx, my, scene, this, data, parse, Tool::FromFile); - } - else - { - VModelingBisector::Create(id, formula, firstPointId, secondPointId, thirdPointId, typeLine, - name, mx, my, this, data, parse, Tool::FromFile); - } + VToolBisector::Create(id, formula, firstPointId, secondPointId, thirdPointId, typeLine, name, mx, my, scene, + this, data, parse, Tool::FromFile); return; } catch (const VExceptionBadId &e) @@ -931,16 +823,8 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen qint64 p1Line2Id = GetParametrLongLong(domElement, "p1Line2"); qint64 p2Line2Id = GetParametrLongLong(domElement, "p2Line2"); - if (mode == Draw::Calculation) - { - VToolLineIntersect::Create(id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, name, mx, my, - scene, this, data, parse, Tool::FromFile); - } - else - { - VModelingLineIntersect::Create(id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, name, mx, my, - this, data, parse, Tool::FromFile); - } + VToolLineIntersect::Create(id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, name, mx, my, scene, this, data, + parse, Tool::FromFile); return; } catch (const VExceptionBadId &e) @@ -963,16 +847,8 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint"); qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint"); - if (mode == Draw::Calculation) - { - VToolPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, mx, my, - scene, this, data, parse, Tool::FromFile); - } - else - { - VModelingPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, mx, - my, this, data, parse, Tool::FromFile); - } + VToolPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, mx, my, scene, this, + data, parse, Tool::FromFile); return; } catch (const VExceptionBadId &e) @@ -988,24 +864,11 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen { qint64 id = GetParametrId(domElement); qint64 idObject = GetParametrLongLong(domElement, "idObject"); - QString tObject = GetParametrString(domElement, "typeObject"); - VPointF point; - Draw::Draws typeObject; - if (tObject == "Calculation") - { - typeObject = Draw::Calculation; - point = data->GetPoint(idObject ); - } - else - { - typeObject = Draw::Modeling; - point = data->GetPointModeling(idObject); - } + VPointF point = data->GetPoint(idObject ); qreal mx = toPixel(GetParametrDouble(domElement, "mx")); qreal my = toPixel(GetParametrDouble(domElement, "my")); - data->UpdatePointModeling(id, VPointF(point.x(), point.y(), point.name(), mx, my, typeObject, - idObject )); - VNodePoint::Create(this, data, id, idObject, mode, parse, Tool::FromFile); + data->UpdatePoint(id, VPointF(point.x(), point.y(), point.name(), mx, my, idObject )); + VNodePoint::Create(this, data, id, idObject, parse, Tool::FromFile); return; } catch (const VExceptionBadId &e) @@ -1027,16 +890,9 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen qint64 basePointId = GetParametrLongLong(domElement, "basePoint"); qint64 p1LineId = GetParametrLongLong(domElement, "p1Line"); qint64 p2LineId = GetParametrLongLong(domElement, "p2Line"); - if (mode == Draw::Calculation) - { - VToolHeight::Create(id, name, typeLine, basePointId, p1LineId, p2LineId, mx, my, scene, - this, data, parse, Tool::FromFile); - } - else - { - VModelingHeight::Create(id, name, typeLine, basePointId, p1LineId, p2LineId, mx, my, this, - data, parse, Tool::FromFile); - } + + VToolHeight::Create(id, name, typeLine, basePointId, p1LineId, p2LineId, mx, my, scene, this, data, parse, + Tool::FromFile); return; } catch (const VExceptionBadId &e) @@ -1059,16 +915,8 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint"); qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint"); - if (mode == Draw::Calculation) - { - VToolTriangle::Create(id, name, axisP1Id, axisP2Id, firstPointId, secondPointId, mx, my, - scene, this, data, parse, Tool::FromFile); - } - else - { - VModelingTriangle::Create(id, name, axisP1Id, axisP2Id, firstPointId, secondPointId, mx, my, - this, data, parse, Tool::FromFile); - } + VToolTriangle::Create(id, name, axisP1Id, axisP2Id, firstPointId, secondPointId, mx, my, scene, this, data, + parse, Tool::FromFile); return; } catch (const VExceptionBadId &e) @@ -1089,16 +937,8 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint"); qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint"); - if (mode == Draw::Calculation) - { - VToolPointOfIntersection::Create(id, name, firstPointId, secondPointId, mx, my, scene, this, data, - parse, Tool::FromFile); - } - else - { - VModelingPointOfIntersection::Create(id, name, firstPointId, secondPointId, mx, my, this, data, - parse, Tool::FromFile); - } + VToolPointOfIntersection::Create(id, name, firstPointId, secondPointId, mx, my, scene, this, data, parse, + Tool::FromFile); return; } catch (const VExceptionBadId &e) @@ -1118,16 +958,8 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen qreal my = toPixel(GetParametrDouble(domElement, "my")); QString formula = GetParametrString(domElement, "length"); qint64 splineId = GetParametrLongLong(domElement, "spline"); - if (mode == Draw::Calculation) - { - VToolCutSpline::Create(id, name, formula, splineId, mx, my, scene, this, data, parse, - Tool::FromFile); - } - else - { - VModelingCutSpline::Create(id, name, formula, splineId, mx, my, this, data, parse, - Tool::FromFile); - } + + VToolCutSpline::Create(id, name, formula, splineId, mx, my, scene, this, data, parse, Tool::FromFile); return; } catch (const VExceptionBadId &e) @@ -1147,16 +979,9 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen qreal my = toPixel(GetParametrDouble(domElement, "my")); QString formula = GetParametrString(domElement, "length"); qint64 splinePathId = GetParametrLongLong(domElement, "splinePath"); - if (mode == Draw::Calculation) - { - VToolCutSplinePath::Create(id, name, formula, splinePathId, mx, my, scene, this, data, parse, - Tool::FromFile); - } - else - { - VModelingCutSplinePath::Create(id, name, formula, splinePathId, mx, my, this, data, parse, - Tool::FromFile); - } + + VToolCutSplinePath::Create(id, name, formula, splinePathId, mx, my, scene, this, data, parse, + Tool::FromFile); return; } catch (const VExceptionBadId &e) @@ -1169,7 +994,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen } void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement, - const Document::Documents &parse, const Draw::Draws &mode) + const Document::Documents &parse) { Q_ASSERT(scene != 0); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); @@ -1179,15 +1004,7 @@ void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement qint64 firstPoint = GetParametrLongLong(domElement, "firstPoint"); qint64 secondPoint = GetParametrLongLong(domElement, "secondPoint"); - if (mode == Draw::Calculation) - { - VToolLine::Create(id, firstPoint, secondPoint, scene, this, data, parse, Tool::FromFile); - } - else - { - VModelingLine::Create(id, firstPoint, secondPoint, this, data, parse, Tool::FromFile); - } - + VToolLine::Create(id, firstPoint, secondPoint, scene, this, data, parse, Tool::FromFile); } catch (const VExceptionBadId &e) { @@ -1198,7 +1015,7 @@ void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement } void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &domElement, - const Document::Documents &parse, const QString &type, const Draw::Draws &mode) + const Document::Documents &parse, const QString &type) { Q_ASSERT(scene != 0); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); @@ -1216,17 +1033,8 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme qreal kAsm2 = GetParametrDouble(domElement, "kAsm2"); qreal kCurve = GetParametrDouble(domElement, "kCurve"); - if (mode == Draw::Calculation) - { - VToolSpline::Create(id, point1, point4, kAsm1, kAsm2, angle1, angle2, kCurve, scene, this, - data, parse, Tool::FromFile); - } - else - { - VModelingSpline::Create(id, point1, point4, kAsm1, kAsm2, angle1, angle2, kCurve, this, - data, parse, Tool::FromFile); - } - + VToolSpline::Create(id, point1, point4, kAsm1, kAsm2, angle1, angle2, kCurve, scene, this, data, parse, + Tool::FromFile); return; } catch (const VExceptionBadId &e) @@ -1266,14 +1074,8 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme } } } - if (mode == Draw::Calculation) - { - VToolSplinePath::Create(id, path, scene, this, data, parse, Tool::FromFile); - } - else - { - VModelingSplinePath::Create(id, path, this, data, parse, Tool::FromFile); - } + + VToolSplinePath::Create(id, path, scene, this, data, parse, Tool::FromFile); return; } catch (const VExceptionBadId &e) @@ -1289,23 +1091,10 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme { qint64 id = GetParametrId(domElement); qint64 idObject = GetParametrLongLong(domElement, "idObject"); - QString tObject = GetParametrString(domElement, "typeObject"); - VSpline spl; - Draw::Draws typeObject; - if (tObject == "Calculation") - { - typeObject = Draw::Calculation; - spl = data->GetSpline(idObject); - } - else - { - typeObject = Draw::Modeling; - spl = data->GetSplineModeling(idObject); - } - spl.setMode(typeObject); + VSpline spl = data->GetSpline(idObject); spl.setIdObject(idObject); - data->UpdateSplineModeling(id, spl); - VNodeSpline::Create(this, data, id, idObject, mode, parse, Tool::FromFile); + data->UpdateSpline(id, spl); + VNodeSpline::Create(this, data, id, idObject, parse, Tool::FromFile); return; } catch (const VExceptionBadId &e) @@ -1321,23 +1110,10 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme { qint64 id = GetParametrId(domElement); qint64 idObject = GetParametrLongLong(domElement, "idObject"); - QString tObject = GetParametrString(domElement, "typeObject"); - VSplinePath path; - Draw::Draws typeObject; - if (tObject == "Calculation") - { - typeObject = Draw::Calculation; - path = data->GetSplinePath(idObject); - } - else - { - typeObject = Draw::Modeling; - path = data->GetSplinePathModeling(idObject); - } - path.setMode(typeObject); + VSplinePath path = data->GetSplinePath(idObject); path.setIdObject(idObject); - data->UpdateSplinePathModeling(id, path); - VNodeSplinePath::Create(this, data, id, idObject, mode, parse, Tool::FromFile); + data->UpdateSplinePath(id, path); + VNodeSplinePath::Create(this, data, id, idObject, parse, Tool::FromFile); return; } catch (const VExceptionBadId &e) @@ -1350,7 +1126,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme } void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &domElement, - const Document::Documents &parse, const QString &type, const Draw::Draws &mode) + const Document::Documents &parse, const QString &type) { Q_ASSERT(scene != 0); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); @@ -1365,14 +1141,7 @@ void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement QString f1 = GetParametrString(domElement, "angle1"); QString f2 = GetParametrString(domElement, "angle2"); - if (mode == Draw::Calculation) - { - VToolArc::Create(id, center, radius, f1, f2, scene, this, data, parse, Tool::FromFile); - } - else - { - VModelingArc::Create(id, center, radius, f1, f2, this, data, parse, Tool::FromFile); - } + VToolArc::Create(id, center, radius, f1, f2, scene, this, data, parse, Tool::FromFile); return; } @@ -1389,23 +1158,10 @@ void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement { qint64 id = GetParametrId(domElement); qint64 idObject = GetParametrLongLong(domElement, "idObject"); - QString tObject = GetParametrString(domElement, "typeObject"); - VArc arc; - Draw::Draws typeObject; - if (tObject == "Calculation") - { - typeObject = Draw::Calculation; - arc = data->GetArc(idObject); - } - else - { - typeObject = Draw::Modeling; - arc = data->GetArcModeling(idObject); - } - arc.setMode(typeObject); + VArc arc = data->GetArc(idObject); arc.setIdObject(idObject); - data->UpdateArcModeling(id, arc); - VNodeArc::Create(this, data, id, idObject, mode, parse, Tool::FromFile); + data->UpdateArc(id, arc); + VNodeArc::Create(this, data, id, idObject, parse, Tool::FromFile); return; } catch (const VExceptionBadId &e) diff --git a/src/xml/vdomdocument.h b/src/xml/vdomdocument.h index 866421445..897cae319 100644 --- a/src/xml/vdomdocument.h +++ b/src/xml/vdomdocument.h @@ -351,7 +351,7 @@ private: * @param mode */ void ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement, - const Document::Documents &parse, const QString &type, const Draw::Draws &mode); + const Document::Documents &parse, const QString &type); /** * @brief ParseLineElement * @param scene @@ -360,7 +360,7 @@ private: * @param mode */ void ParseLineElement(VMainGraphicsScene *scene, const QDomElement& domElement, - const Document::Documents &parse, const Draw::Draws &mode); + const Document::Documents &parse); /** * @brief ParseSplineElement * @param scene @@ -370,7 +370,7 @@ private: * @param mode */ void ParseSplineElement(VMainGraphicsScene *scene, const QDomElement& domElement, - const Document::Documents &parse, const QString& type, const Draw::Draws &mode); + const Document::Documents &parse, const QString& type); /** * @brief ParseArcElement * @param scene @@ -380,7 +380,7 @@ private: * @param mode */ void ParseArcElement(VMainGraphicsScene *scene, const QDomElement& domElement, - const Document::Documents &parse, const QString& type, const Draw::Draws &mode); + const Document::Documents &parse, const QString& type); /** * @brief ParseIncrementsElement * @param node