diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.cpp b/src/app/valentina/core/vtooloptionspropertybrowser.cpp index e4cc9d177..e32df2705 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.cpp +++ b/src/app/valentina/core/vtooloptionspropertybrowser.cpp @@ -77,7 +77,7 @@ void VToolOptionsPropertyBrowser::ClearPropertyBrowser() void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item) { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools were used in switch."); switch (item->type()) { @@ -213,7 +213,7 @@ void VToolOptionsPropertyBrowser::UpdateOptions() } // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools were used in switch."); switch (currentItem->type()) { @@ -360,7 +360,7 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property) } // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools were used in switch."); switch (currentItem->type()) { diff --git a/src/app/valentina/dialogs/dialoghistory.cpp b/src/app/valentina/dialogs/dialoghistory.cpp index e4f5e9616..34a779bdb 100644 --- a/src/app/valentina/dialogs/dialoghistory.cpp +++ b/src/app/valentina/dialogs/dialoghistory.cpp @@ -209,7 +209,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") QString DialogHistory::Record(const VToolRecord &tool) { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was used in history."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools were used in history."); const QDomElement domElem = doc->elementById(tool.getId()); if (domElem.isElement() == false) @@ -392,6 +392,7 @@ QString DialogHistory::Record(const VToolRecord &tool) case Tool::Detail: case Tool::UnionDetails: case Tool::NodeArc: + case Tool::NodeElArc: case Tool::NodePoint: case Tool::NodeSpline: case Tool::NodeSplinePath: diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 8ea7b8fc8..2aca6bd2c 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -1791,7 +1791,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") void MainWindow::CancelTool() { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools were handled."); qCDebug(vMainWindow, "Canceling tool."); delete dialogTool; @@ -1824,6 +1824,7 @@ void MainWindow::CancelTool() case Tool::LAST_ONE_DO_NOT_USE: case Tool::NodePoint: case Tool::NodeArc: + case Tool::NodeElArc: case Tool::NodeSpline: case Tool::NodeSplinePath: Q_UNREACHABLE(); //-V501 @@ -2995,7 +2996,7 @@ void MainWindow::SetEnableTool(bool enable) } // This check helps to find missed tools - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools were handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools were handled."); //Drawing Tools ui->toolButtonEndLine->setEnabled(drawTools); @@ -3316,7 +3317,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") void MainWindow::LastUsedTool() { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools were handled."); if (currentTool == lastUsedTool) { @@ -3341,6 +3342,7 @@ void MainWindow::LastUsedTool() case Tool::LAST_ONE_DO_NOT_USE: case Tool::NodePoint: case Tool::NodeArc: + case Tool::NodeElArc: case Tool::NodeSpline: case Tool::NodeSplinePath: Q_UNREACHABLE(); //-V501 diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index a090c3a53..c5f2fb433 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -44,6 +44,7 @@ #include "../vmisc/vmath.h" #include "../qmuparser/qmuparsererror.h" #include "../vgeometry/varc.h" +#include "../vgeometry/vellipticalarc.h" #include "../vgeometry/vsplinepath.h" #include "../vgeometry/vcubicbezier.h" #include "../vgeometry/vcubicbezierpath.h" @@ -628,8 +629,11 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document QString().setNum(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping()))); detail.SetInLayout(GetParametrBool(domElement, AttrInLayout, trueStr)); - QStringList types = QStringList() << VToolDetail::NodePoint << VToolDetail::NodeArc << VToolDetail::NodeSpline - << VToolDetail::NodeSplinePath; + QStringList types = QStringList() << VToolDetail::NodePoint + << VToolDetail::NodeArc + << VToolDetail::NodeSpline + << VToolDetail::NodeSplinePath + << VToolDetail::NodeElArc; const QDomNodeList nodeList = domElement.childNodes(); const qint32 num = nodeList.size(); for (qint32 i = 0; i < num; ++i) @@ -662,6 +666,9 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document case 3: // VToolDetail::NodeSplinePath tool = Tool::NodeSplinePath; break; + case 4: // VToolDetail::NodeElArc + tool = Tool::NodeElArc; + break; default: VException e(tr("Wrong tag name '%1'.").arg(t)); throw e; @@ -2495,6 +2502,41 @@ void VPattern::ParseToolEllipticalArc(VMainGraphicsScene *scene, QDomElement &do } } +//--------------------------------------------------------------------------------------------------------------------- +void VPattern::ParseNodeEllipticalArc(const QDomElement &domElement, const Document &parse) +{ + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); + + try + { + quint32 id = 0; + + ToolsCommonAttributes(domElement, id); + const quint32 idObject = GetParametrUInt(domElement, AttrIdObject, NULL_ID_STR); + const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, NULL_ID_STR); + VEllipticalArc *arc = nullptr; + try + { + arc = new VEllipticalArc(*data->GeometricObject(idObject)); + } + catch (const VExceptionBadId &e) + { // Possible case. Parent was deleted, but the node object is still here. + Q_UNUSED(e); + return;// Just ignore + } + arc->setIdObject(idObject); + arc->setMode(Draw::Modeling); + data->UpdateGObject(id, arc); + VNodeEllipticalArc::Create(this, data, id, idObject, parse, Source::FromFile, "", idTool); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating modeling elliptical arc"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } +} + //--------------------------------------------------------------------------------------------------------------------- void VPattern::ParseNodeArc(const QDomElement &domElement, const Document &parse) { @@ -2937,13 +2979,17 @@ void VPattern::ParseEllipticalArcElement(VMainGraphicsScene *scene, QDomElement Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of elliptical arc is empty"); - QStringList arcs = QStringList() << VToolEllipticalArc::ToolType; /*0*/ + const QStringList arcs = QStringList() << VToolEllipticalArc::ToolType /*0*/ + << VNodeEllipticalArc::ToolType; /*1*/ switch (arcs.indexOf(type)) { case 0: //VToolArc::ToolType ParseToolEllipticalArc(scene, domElement, parse); break; + case 1: //VNodeEllipticalArc::ToolType + ParseNodeEllipticalArc(domElement, parse); + break; default: VException e(tr("Unknown elliptical arc type '%1'.").arg(type)); throw e; @@ -3527,7 +3573,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") QRectF VPattern::ActiveDrawBoundingRect() const { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was used."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools were used."); QRectF rec; @@ -3655,6 +3701,7 @@ QRectF VPattern::ActiveDrawBoundingRect() const case Tool::Detail: case Tool::UnionDetails: case Tool::NodeArc: + case Tool::NodeElArc: case Tool::NodePoint: case Tool::NodeSpline: case Tool::NodeSplinePath: diff --git a/src/app/valentina/xml/vpattern.h b/src/app/valentina/xml/vpattern.h index dd8c68496..02ce823c7 100644 --- a/src/app/valentina/xml/vpattern.h +++ b/src/app/valentina/xml/vpattern.h @@ -126,7 +126,7 @@ private: void ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse, const QString& type); void ParseEllipticalArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse, - const QString &type); + const QString &type); void ParseToolsElement(VMainGraphicsScene *scene, const QDomElement& domElement, const Document &parse, const QString& type); void ParseOperationElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse, @@ -196,6 +196,7 @@ private: void ParseToolArcWithLength(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse); void ParseToolEllipticalArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse); + void ParseNodeEllipticalArc(const QDomElement &domElement, const Document &parse); void ParseToolRotation(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse); void ParseToolFlippingByLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse); diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 65882a7cd..787cfbbd8 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -638,6 +638,7 @@ quint32 VAbstractPattern::SiblingNodeId(const quint32 &nodeId) const case Tool::Detail: case Tool::UnionDetails: case Tool::NodeArc: + case Tool::NodeElArc: case Tool::NodePoint: case Tool::NodeSpline: case Tool::NodeSplinePath: @@ -1426,7 +1427,7 @@ QStringList VAbstractPattern::ListPointExpressions() const // Check if new tool doesn't bring new attribute with a formula. // If no just increment a number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50); QStringList expressions; const QDomNodeList list = elementsByTagName(TagPoint); @@ -1498,7 +1499,7 @@ QStringList VAbstractPattern::ListArcExpressions() const // Check if new tool doesn't bring new attribute with a formula. // If no just increment number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50); QStringList expressions; const QDomNodeList list = elementsByTagName(TagArc); @@ -1552,7 +1553,7 @@ QStringList VAbstractPattern::ListElArcExpressions() const // Check if new tool doesn't bring new attribute with a formula. // If no just increment number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50); QStringList expressions; const QDomNodeList list = elementsByTagName(TagElArc); @@ -1623,7 +1624,7 @@ QStringList VAbstractPattern::ListPathPointExpressions() const // Check if new tool doesn't bring new attribute with a formula. // If no just increment number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50); QStringList expressions; const QDomNodeList list = elementsByTagName(AttrPathPoint); @@ -1690,7 +1691,7 @@ QStringList VAbstractPattern::ListOperationExpressions() const // Check if new tool doesn't bring new attribute with a formula. // If no just increment number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50); QStringList expressions; const QDomNodeList list = elementsByTagName(TagOperation); diff --git a/src/libs/vgeometry/vellipticalarc.h b/src/libs/vgeometry/vellipticalarc.h index 8527f3498..3d0cc0fe4 100644 --- a/src/libs/vgeometry/vellipticalarc.h +++ b/src/libs/vgeometry/vellipticalarc.h @@ -57,7 +57,8 @@ public: VEllipticalArc (const VPointF ¢er, qreal radius1, qreal radius2, qreal f1, qreal f2, qreal rotationAngle); VEllipticalArc (qreal length, const QString &formulaLength, const VPointF ¢er, qreal radius1, qreal radius2, const QString &formulaRadius1, const QString &formulaRadius2, qreal f1, const QString &formulaF1, - qreal rotationAngle, const QString &formulaRotationAngle, quint32 idObject = 0, Draw mode = Draw::Calculation); + qreal rotationAngle, const QString &formulaRotationAngle, quint32 idObject = 0, + Draw mode = Draw::Calculation); VEllipticalArc (qreal length, const VPointF ¢er, qreal radius1, qreal radius2, qreal f1, qreal rotationAngle); VEllipticalArc(const VEllipticalArc &arc); diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index cf56c8716..9c62e8919 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -57,7 +57,7 @@ class VTranslateMeasurements; #define DefPointRadius 1.5//mm enum class NodeDetail : char { Contour, Modeling }; -enum class SceneObject : char { Point, Line, Spline, Arc, SplinePath, Detail, Unknown }; +enum class SceneObject : char { Point, Line, Spline, Arc, ElArc, SplinePath, Detail, Unknown }; enum class MeasurementsType : char { Standard, Individual , Unknown}; enum class Unit : char { Mm = 0, Cm, Inch, Px, LAST_UNIT_DO_NOT_USE}; enum class Source : char { FromGui, FromFile, FromTool }; @@ -94,6 +94,7 @@ enum class Tool : ToolVisHolderType Detail, NodePoint, NodeArc, + NodeElArc, NodeSpline, NodeSplinePath, Height, diff --git a/src/libs/vpatterndb/vdetail.cpp b/src/libs/vpatterndb/vdetail.cpp index 3da63174e..665f3fd9b 100644 --- a/src/libs/vpatterndb/vdetail.cpp +++ b/src/libs/vpatterndb/vdetail.cpp @@ -404,6 +404,7 @@ QVector VDetail::ContourPoints(const VContainer *data) const } break; case (Tool::NodeArc): + case (Tool::NodeElArc): case (Tool::NodeSpline): case (Tool::NodeSplinePath): { @@ -448,6 +449,7 @@ QVector VDetail::SeamAllowancePoints(const VContainer *data) const } break; case (Tool::NodeArc): + case (Tool::NodeElArc): case (Tool::NodeSpline): case (Tool::NodeSplinePath): { diff --git a/src/libs/vtools/dialogs/tools/dialogdetail.cpp b/src/libs/vtools/dialogs/tools/dialogdetail.cpp index 6b0a6333c..1475c6f29 100644 --- a/src/libs/vtools/dialogs/tools/dialogdetail.cpp +++ b/src/libs/vtools/dialogs/tools/dialogdetail.cpp @@ -193,6 +193,9 @@ void DialogDetail::ChosenObject(quint32 id, const SceneObject &type) case (SceneObject::Arc): NewItem(id, Tool::NodeArc, NodeDetail::Contour); break; + case (SceneObject::ElArc): + NewItem(id, Tool::NodeElArc, NodeDetail::Contour); + break; case (SceneObject::Point): NewItem(id, Tool::NodePoint, NodeDetail::Contour); break; @@ -394,6 +397,7 @@ void DialogDetail::NewItem(quint32 id, const Tool &typeTool, const NodeDetail &t { case (Tool::NodePoint): case (Tool::NodeArc): + case (Tool::NodeElArc): case (Tool::NodeSpline): case (Tool::NodeSplinePath): { diff --git a/src/libs/vtools/tools/nodeDetails/nodedetails.h b/src/libs/vtools/tools/nodeDetails/nodedetails.h index 497136c6e..8f9321212 100644 --- a/src/libs/vtools/tools/nodeDetails/nodedetails.h +++ b/src/libs/vtools/tools/nodeDetails/nodedetails.h @@ -30,6 +30,7 @@ #define NODEDETAILS_H #include "vnodearc.h" +#include "vnodeellipticalarc.h" #include "vnodepoint.h" #include "vnodespline.h" #include "vnodesplinepath.h" diff --git a/src/libs/vtools/tools/nodeDetails/vnodearc.cpp b/src/libs/vtools/tools/nodeDetails/vnodearc.cpp index 9642baa80..dba366d37 100644 --- a/src/libs/vtools/tools/nodeDetails/vnodearc.cpp +++ b/src/libs/vtools/tools/nodeDetails/vnodearc.cpp @@ -39,8 +39,6 @@ #include "../vdatatool.h" #include "vabstractnode.h" -class VContainer; - const QString VNodeArc::ToolType = QStringLiteral("modeling"); //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/tools/nodeDetails/vnodeellipticalarc.cpp b/src/libs/vtools/tools/nodeDetails/vnodeellipticalarc.cpp new file mode 100644 index 000000000..482a6ce11 --- /dev/null +++ b/src/libs/vtools/tools/nodeDetails/vnodeellipticalarc.cpp @@ -0,0 +1,131 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 20 12, 2016 + ** + ** @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) 2016 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 "vnodeellipticalarc.h" + +#include +#include +#include +#include + +#include "../ifc/xml/vdomdocument.h" +#include "../ifc/ifcdef.h" +#include "../vabstracttool.h" +#include "../vdatatool.h" +#include "vabstractnode.h" + +const QString VNodeEllipticalArc::ToolType = QStringLiteral("modeling"); + +//--------------------------------------------------------------------------------------------------------------------- +void VNodeEllipticalArc::Create(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc, + const Document &parse, const Source &typeCreation, const QString &drawName, + const quint32 &idTool) +{ + VAbstractTool::AddRecord(id, Tool::NodeElArc, doc); + if (parse == Document::FullParse) + { + VNodeEllipticalArc *arc = new VNodeEllipticalArc(doc, data, id, idArc, typeCreation, drawName, idTool, doc); + + doc->AddTool(id, arc); + if (idTool != NULL_ID) + { + //Some nodes we don't show on scene. Tool that create this nodes must free memory. + VDataTool *tool = doc->getTool(idTool); + SCASSERT(tool != nullptr); + arc->setParent(tool);// Adopted by a tool + } + else + { + // Help to delete the node before each FullParse + doc->AddToolOnRemove(arc); + } + } + else + { + doc->UpdateToolData(id, data); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +QString VNodeEllipticalArc::getTagName() const +{ + return VAbstractPattern::TagElArc; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VNodeEllipticalArc::AllowHover(bool enabled) +{ + Q_UNUSED(enabled) + // do nothing +} + +//--------------------------------------------------------------------------------------------------------------------- +void VNodeEllipticalArc::AllowSelecting(bool enabled) +{ + Q_UNUSED(enabled) + // do nothing +} + +//--------------------------------------------------------------------------------------------------------------------- +void VNodeEllipticalArc::AddToFile() +{ + QDomElement domElement = doc->createElement(getTagName()); + + doc->SetAttribute(domElement, VDomDocument::AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrIdObject, idNode); + if (idTool != NULL_ID) + { + doc->SetAttribute(domElement, AttrIdTool, idTool); + } + + AddToModeling(domElement); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VNodeEllipticalArc::RefreshDataInFile() +{ + QDomElement domElement = doc->elementById(id); + if (domElement.isElement()) + { + doc->SetAttribute(domElement, AttrIdObject, idNode); + if (idTool != NULL_ID) + { + doc->SetAttribute(domElement, AttrIdTool, idTool); + } + } +} + +//--------------------------------------------------------------------------------------------------------------------- +VNodeEllipticalArc::VNodeEllipticalArc(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc, + const Source &typeCreation, const QString &drawName, const quint32 &idTool, + QObject *qoParent) + :VAbstractNode(doc, data, id, idArc, drawName, idTool, qoParent) +{ + ToolCreation(typeCreation); +} diff --git a/src/libs/vtools/tools/nodeDetails/vnodeellipticalarc.h b/src/libs/vtools/tools/nodeDetails/vnodeellipticalarc.h new file mode 100644 index 000000000..55fe206b5 --- /dev/null +++ b/src/libs/vtools/tools/nodeDetails/vnodeellipticalarc.h @@ -0,0 +1,71 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 20 12, 2016 + ** + ** @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) 2016 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 VNODEELLIPTICALARC_H +#define VNODEELLIPTICALARC_H + +#include +#include +#include +#include +#include +#include + +#include "../ifc/xml/vabstractpattern.h" +#include "../vmisc/def.h" +#include "vabstractnode.h" + +class VContainer; + +class VNodeEllipticalArc :public VAbstractNode +{ + Q_OBJECT +public: + static void Create(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Document &parse, + const Source &typeCreation, const QString &drawName = QString(), + const quint32 &idTool = NULL_ID); + + static const QString ToolType; + virtual QString getTagName() const Q_DECL_OVERRIDE; +public slots: + virtual void FullUpdateFromFile() Q_DECL_OVERRIDE {} + virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE; + virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE; +protected: + virtual void AddToFile() Q_DECL_OVERRIDE; + virtual void RefreshDataInFile() Q_DECL_OVERRIDE; + virtual void ShowNode() Q_DECL_OVERRIDE {} + virtual void HideNode() Q_DECL_OVERRIDE {} +private: + Q_DISABLE_COPY(VNodeEllipticalArc) + + VNodeEllipticalArc(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Source &typeCreation, + const QString &drawName = QString(), const quint32 &idTool = 0, QObject *qoParent = nullptr); +}; + +#endif // VNODEELLIPTICALARC_H diff --git a/src/libs/vtools/tools/tools.pri b/src/libs/vtools/tools/tools.pri index 819713744..b1a63e83b 100644 --- a/src/libs/vtools/tools/tools.pri +++ b/src/libs/vtools/tools/tools.pri @@ -1,117 +1,119 @@ -# ADD TO EACH PATH $$PWD VARIABLE!!!!!! -# This need for corect working file translations.pro - -HEADERS += \ - $$PWD/vtooldetail.h \ - $$PWD/vdatatool.h \ - $$PWD/vabstracttool.h \ - $$PWD/tools.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h \ - $$PWD/drawTools/toolcurve/vtoolsplinepath.h \ - $$PWD/drawTools/toolcurve/vtoolspline.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.h \ - $$PWD/drawTools/vtoolline.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.h \ - $$PWD/drawTools/toolcurve/vtoolarc.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.h \ - $$PWD/drawTools/vdrawtool.h \ - $$PWD/drawTools/drawtools.h \ - $$PWD/nodeDetails/vnodesplinepath.h \ - $$PWD/nodeDetails/vnodespline.h \ - $$PWD/nodeDetails/vnodepoint.h \ - $$PWD/nodeDetails/vnodearc.h \ - $$PWD/nodeDetails/vabstractnode.h \ - $$PWD/nodeDetails/nodedetails.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h \ - $$PWD/vtooluniondetails.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h \ - $$PWD/drawTools/toolcurve/vabstractspline.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h \ - $$PWD/drawTools/toolcurve/vtoolarcwithlength.h \ - $$PWD/drawTools/toolpoint/vabstractpoint.h \ - $$PWD/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.h \ - $$PWD/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h \ - $$PWD/drawTools/toolcurve/vtoolcubicbezier.h \ - $$PWD/drawTools/toolcurve/vtoolcubicbezierpath.h \ - $$PWD/drawTools/operation/vtoolrotation.h \ - $$PWD/vtextgraphicsitem.h \ - $$PWD/vgrainlineitem.h \ - $$PWD/drawTools/operation/flipping/vtoolflippingbyline.h \ - $$PWD/drawTools/operation/vabstractoperation.h \ - $$PWD/drawTools/operation/flipping/vtoolflippingbyaxis.h \ - $$PWD/drawTools/operation/flipping/vabstractflipping.h \ - $$PWD/drawTools/operation/vtoolmove.h \ - $$PWD/drawTools/toolcurve/vtoolellipticalarc.h - -SOURCES += \ - $$PWD/vtooldetail.cpp \ - $$PWD/vdatatool.cpp \ - $$PWD/vabstracttool.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp \ - $$PWD/drawTools/toolcurve/vtoolsplinepath.cpp \ - $$PWD/drawTools/toolcurve/vtoolspline.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp \ - $$PWD/drawTools/vtoolline.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp \ - $$PWD/drawTools/toolcurve/vtoolarc.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp \ - $$PWD/drawTools/vdrawtool.cpp \ - $$PWD/nodeDetails/vnodesplinepath.cpp \ - $$PWD/nodeDetails/vnodespline.cpp \ - $$PWD/nodeDetails/vnodepoint.cpp \ - $$PWD/nodeDetails/vnodearc.cpp \ - $$PWD/nodeDetails/vabstractnode.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp \ - $$PWD/vtooluniondetails.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp \ - $$PWD/drawTools/toolcurve/vabstractspline.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp \ - $$PWD/drawTools/toolcurve/vtoolarcwithlength.cpp \ - $$PWD/drawTools/toolpoint/vabstractpoint.cpp \ - $$PWD/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp \ - $$PWD/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp \ - $$PWD/drawTools/toolcurve/vtoolcubicbezier.cpp \ - $$PWD/drawTools/toolcurve/vtoolcubicbezierpath.cpp \ - $$PWD/drawTools/operation/vtoolrotation.cpp \ - $$PWD/vtextgraphicsitem.cpp \ - $$PWD/vgrainlineitem.cpp \ - $$PWD/drawTools/operation/flipping/vtoolflippingbyline.cpp \ - $$PWD/drawTools/operation/vabstractoperation.cpp \ - $$PWD/drawTools/operation/flipping/vtoolflippingbyaxis.cpp \ - $$PWD/drawTools/operation/flipping/vabstractflipping.cpp \ - $$PWD/drawTools/operation/vtoolmove.cpp \ - $$PWD/drawTools/toolcurve/vtoolellipticalarc.cpp +# ADD TO EACH PATH $$PWD VARIABLE!!!!!! +# This need for corect working file translations.pro + +HEADERS += \ + $$PWD/vtooldetail.h \ + $$PWD/vdatatool.h \ + $$PWD/vabstracttool.h \ + $$PWD/tools.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h \ + $$PWD/drawTools/toolcurve/vtoolsplinepath.h \ + $$PWD/drawTools/toolcurve/vtoolspline.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.h \ + $$PWD/drawTools/vtoolline.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.h \ + $$PWD/drawTools/toolcurve/vtoolarc.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.h \ + $$PWD/drawTools/vdrawtool.h \ + $$PWD/drawTools/drawtools.h \ + $$PWD/nodeDetails/vnodesplinepath.h \ + $$PWD/nodeDetails/vnodespline.h \ + $$PWD/nodeDetails/vnodepoint.h \ + $$PWD/nodeDetails/vnodearc.h \ + $$PWD/nodeDetails/vabstractnode.h \ + $$PWD/nodeDetails/nodedetails.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h \ + $$PWD/vtooluniondetails.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h \ + $$PWD/drawTools/toolcurve/vabstractspline.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h \ + $$PWD/drawTools/toolcurve/vtoolarcwithlength.h \ + $$PWD/drawTools/toolpoint/vabstractpoint.h \ + $$PWD/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.h \ + $$PWD/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h \ + $$PWD/drawTools/toolcurve/vtoolcubicbezier.h \ + $$PWD/drawTools/toolcurve/vtoolcubicbezierpath.h \ + $$PWD/drawTools/operation/vtoolrotation.h \ + $$PWD/vtextgraphicsitem.h \ + $$PWD/vgrainlineitem.h \ + $$PWD/drawTools/operation/flipping/vtoolflippingbyline.h \ + $$PWD/drawTools/operation/vabstractoperation.h \ + $$PWD/drawTools/operation/flipping/vtoolflippingbyaxis.h \ + $$PWD/drawTools/operation/flipping/vabstractflipping.h \ + $$PWD/drawTools/operation/vtoolmove.h \ + $$PWD/drawTools/toolcurve/vtoolellipticalarc.h \ + $$PWD/nodeDetails/vnodeellipticalarc.h + +SOURCES += \ + $$PWD/vtooldetail.cpp \ + $$PWD/vdatatool.cpp \ + $$PWD/vabstracttool.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp \ + $$PWD/drawTools/toolcurve/vtoolsplinepath.cpp \ + $$PWD/drawTools/toolcurve/vtoolspline.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp \ + $$PWD/drawTools/vtoolline.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp \ + $$PWD/drawTools/toolcurve/vtoolarc.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp \ + $$PWD/drawTools/vdrawtool.cpp \ + $$PWD/nodeDetails/vnodesplinepath.cpp \ + $$PWD/nodeDetails/vnodespline.cpp \ + $$PWD/nodeDetails/vnodepoint.cpp \ + $$PWD/nodeDetails/vnodearc.cpp \ + $$PWD/nodeDetails/vabstractnode.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp \ + $$PWD/vtooluniondetails.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp \ + $$PWD/drawTools/toolcurve/vabstractspline.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp \ + $$PWD/drawTools/toolcurve/vtoolarcwithlength.cpp \ + $$PWD/drawTools/toolpoint/vabstractpoint.cpp \ + $$PWD/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp \ + $$PWD/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp \ + $$PWD/drawTools/toolcurve/vtoolcubicbezier.cpp \ + $$PWD/drawTools/toolcurve/vtoolcubicbezierpath.cpp \ + $$PWD/drawTools/operation/vtoolrotation.cpp \ + $$PWD/vtextgraphicsitem.cpp \ + $$PWD/vgrainlineitem.cpp \ + $$PWD/drawTools/operation/flipping/vtoolflippingbyline.cpp \ + $$PWD/drawTools/operation/vabstractoperation.cpp \ + $$PWD/drawTools/operation/flipping/vtoolflippingbyaxis.cpp \ + $$PWD/drawTools/operation/flipping/vabstractflipping.cpp \ + $$PWD/drawTools/operation/vtoolmove.cpp \ + $$PWD/drawTools/toolcurve/vtoolellipticalarc.cpp \ + $$PWD/nodeDetails/vnodeellipticalarc.cpp diff --git a/src/libs/vtools/tools/vtooldetail.cpp b/src/libs/vtools/tools/vtooldetail.cpp index 3ebd5d434..ed3ef504e 100644 --- a/src/libs/vtools/tools/vtooldetail.cpp +++ b/src/libs/vtools/tools/vtooldetail.cpp @@ -78,6 +78,7 @@ #include "../undocommands/savedetailoptions.h" #include "../undocommands/toggledetailinlayout.h" #include "../vgeometry/varc.h" +#include "../vgeometry/vellipticalarc.h" #include "../vgeometry/vcubicbezier.h" #include "../vgeometry/vcubicbezierpath.h" #include "../vgeometry/vgeometrydef.h" @@ -99,6 +100,7 @@ #include "vabstracttool.h" #include "nodeDetails/vabstractnode.h" #include "nodeDetails/vnodearc.h" +#include "nodeDetails/vnodeellipticalarc.h" #include "nodeDetails/vnodepoint.h" #include "nodeDetails/vnodespline.h" #include "nodeDetails/vnodesplinepath.h" @@ -130,6 +132,7 @@ const QString VToolDetail::NodeTypeContour = QStringLiteral("Contour"); const QString VToolDetail::NodeTypeModeling = QStringLiteral("Modeling"); const QString VToolDetail::NodeArc = QStringLiteral("NodeArc"); +const QString VToolDetail::NodeElArc = QStringLiteral("NodeElArc"); const QString VToolDetail::NodePoint = QStringLiteral("NodePoint"); const QString VToolDetail::NodeSpline = QStringLiteral("NodeSpline"); const QString VToolDetail::NodeSplinePath = QStringLiteral("NodeSplinePath"); @@ -162,11 +165,8 @@ VToolDetail::VToolDetail(VAbstractPattern *doc, VContainer *data, const quint32 break; } case (Tool::NodeArc): - doc->IncrementReferens(detail.at(i).getId()); - break; + case (Tool::NodeElArc): case (Tool::NodeSpline): - doc->IncrementReferens(detail.at(i).getId()); - break; case (Tool::NodeSplinePath): doc->IncrementReferens(detail.at(i).getId()); break; @@ -275,6 +275,12 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstrac VNodeArc::Create(doc, data, id, nodeD.getId(), Document::FullParse, Source::FromGui); } break; + case (Tool::NodeElArc): + { + id = CreateNode(data, nodeD.getId()); + VNodeEllipticalArc::Create(doc, data, id, nodeD.getId(), Document::FullParse, Source::FromGui); + } + break; case (Tool::NodeSpline): { const auto obj = data->GetGObject(nodeD.getId()); @@ -1155,6 +1161,9 @@ void VToolDetail::AddNode(VAbstractPattern *doc, QDomElement &domElement, const case (Tool::NodeArc): doc->SetAttribute(nod, AttrType, NodeArc); break; + case (Tool::NodeElArc): + doc->SetAttribute(nod, AttrType, NodeElArc); + break; case (Tool::NodePoint): doc->SetAttribute(nod, AttrType, NodePoint); break; diff --git a/src/libs/vtools/tools/vtooldetail.h b/src/libs/vtools/tools/vtooldetail.h index afefd8694..d46b144e6 100644 --- a/src/libs/vtools/tools/vtooldetail.h +++ b/src/libs/vtools/tools/vtooldetail.h @@ -83,6 +83,7 @@ public: static const QString NodeTypeContour; static const QString NodeTypeModeling; static const QString NodeArc; + static const QString NodeElArc; static const QString NodePoint; static const QString NodeSpline; static const QString NodeSplinePath; diff --git a/src/libs/vtools/tools/vtooluniondetails.cpp b/src/libs/vtools/tools/vtooluniondetails.cpp index 6002152eb..410520a80 100644 --- a/src/libs/vtools/tools/vtooluniondetails.cpp +++ b/src/libs/vtools/tools/vtooluniondetails.cpp @@ -46,6 +46,7 @@ #include "../ifc/xml/vdomdocument.h" #include "../ifc/xml/vpatternconverter.h" #include "../vgeometry/varc.h" +#include "../vgeometry/vellipticalarc.h" #include "../vgeometry/vsplinepath.h" #include "../vgeometry/vabstractcubicbezier.h" #include "../vgeometry/vabstractcubicbezierpath.h" @@ -59,6 +60,7 @@ #include "../vpatterndb/vcontainer.h" #include "../dialogs/tools/dialogtool.h" #include "nodeDetails/vnodearc.h" +#include "nodeDetails/vnodeellipticalarc.h" #include "nodeDetails/vnodepoint.h" #include "nodeDetails/vnodespline.h" #include "nodeDetails/vnodesplinepath.h" @@ -188,6 +190,42 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte VNodeArc::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, drawName, idTool); } break; + case (Tool::NodeElArc): + { + const QSharedPointer arc = data->GeometricObject(det.at(i).getId()); + VPointF p1 = VPointF(arc->GetP1(), "A", 0, 0); + VPointF p2 = VPointF(arc->GetP2(), "A", 0, 0); + VPointF *center = new VPointF(arc->GetCenter()); + + if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) + { + const QPointF p = *data->GeometricObject(pRotate); + + BiasRotatePoint(&p1, dx, dy, p, angle); + BiasRotatePoint(&p2, dx, dy, p, angle); + BiasRotatePoint(center, dx, dy, p, angle); + } + + QLineF l1(*center, p1); + QLineF l2(*center, p2); + center->setMode(Draw::Modeling); + quint32 idCenter = data->AddGObject(center); + Q_UNUSED(idCenter); + VEllipticalArc *arc1 = new VEllipticalArc (*center, arc->GetRadius1(), arc->GetRadius2(), + arc->GetFormulaRadius1(), arc->GetFormulaRadius2(), + l1.angle(), QString().setNum(l1.angle()), l2.angle(), + QString().setNum(l2.angle()), 0, "0"); + arc1->setMode(Draw::Modeling); + idObject = data->AddGObject(arc1); + children.append(idObject); + + VEllipticalArc *arc2 = new VEllipticalArc(*arc1); + arc2->setMode(Draw::Modeling); + id = data->AddGObject(arc2); + + VNodeEllipticalArc::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, drawName, idTool); + } + break; case (Tool::NodeSpline): { const QSharedPointer spline = @@ -344,6 +382,34 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const delete center; } break; + case (Tool::NodeElArc): + { + const QSharedPointer arc = data->GeometricObject(det.at(i).getId()); + VPointF p1 = VPointF(arc->GetP1()); + VPointF p2 = VPointF(arc->GetP2()); + VPointF *center = new VPointF(arc->GetCenter()); + + if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) + { + const QPointF p = *data->GeometricObject(pRotate); + + BiasRotatePoint(&p1, dx, dy, p, angle); + BiasRotatePoint(&p2, dx, dy, p, angle); + BiasRotatePoint(center, dx, dy, p, angle); + } + + QLineF l1(*center, p1); + QLineF l2(*center, p2); + + VEllipticalArc *arc1 = new VEllipticalArc (*center, arc->GetRadius1(), arc->GetRadius2(), + arc->GetFormulaRadius1(), arc->GetFormulaRadius2(), + l1.angle(), QString().setNum(l1.angle()), l2.angle(), + QString().setNum(l2.angle()), 0, "0"); + arc1->setMode(Draw::Modeling); + data->UpdateGObject(TakeNextId(children), arc1); + delete center; + } + break; case (Tool::NodeSpline): { const QSharedPointer spline = @@ -803,19 +869,23 @@ QVector VToolUnionDetails::GetDetailFromFile(VAbstractPattern *doc, con Tool tool = Tool::NodePoint; NodeDetail nodeType = NodeDetail::Contour; QString t = doc->GetParametrString(element, "type", "NodePoint"); - if (t == "NodePoint") + if (t == QLatin1String("NodePoint")) { tool = Tool::NodePoint; } - else if (t == "NodeArc") + else if (t == QLatin1String("NodeArc")) { tool = Tool::NodeArc; } - else if (t == "NodeSpline") + else if (t == QLatin1String("NodeElArc")) + { + tool = Tool::NodeElArc; + } + else if (t == QLatin1String("NodeSpline")) { tool = Tool::NodeSpline; } - else if (t == "NodeSplinePath") + else if (t == QLatin1String("NodeSplinePath")) { tool = Tool::NodeSplinePath; } @@ -962,6 +1032,7 @@ void VToolUnionDetails::IncrementReferences(const VDetail &d) const break; } case (Tool::NodeArc): + case (Tool::NodeElArc): case (Tool::NodeSpline): case (Tool::NodeSplinePath): doc->IncrementReferens(d.at(i).getId()); @@ -987,6 +1058,7 @@ void VToolUnionDetails::DecrementReferences(const VDetail &d) const break; } case (Tool::NodeArc): + case (Tool::NodeElArc): case (Tool::NodeSpline): case (Tool::NodeSplinePath): doc->DecrementReferens(d.at(i).getId());