From 3bb657ea1a4572cedbad1f17bc61c2d487d09b18 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 24 Sep 2016 20:44:06 +0300 Subject: [PATCH] New internal variable "Length to spline control point". --HG-- branch : develop --- .../valentina/dialogs/dialogincrements.cpp | 9 ++ src/app/valentina/dialogs/dialogincrements.h | 1 + src/app/valentina/dialogs/dialogincrements.ui | 45 +++++++- src/app/valentina/xml/vpattern.cpp | 1 + src/libs/ifc/ifcdef.cpp | 2 + src/libs/ifc/ifcdef.h | 2 + src/libs/vgeometry/vabstractbezier.cpp | 57 ++++++++++ src/libs/vgeometry/vabstractbezier.h | 48 ++++++++ src/libs/vgeometry/vabstractcubicbezier.cpp | 6 +- src/libs/vgeometry/vabstractcubicbezier.h | 4 +- .../vgeometry/vabstractcubicbezierpath.cpp | 6 +- src/libs/vgeometry/vabstractcubicbezierpath.h | 4 +- src/libs/vgeometry/vcubicbezier.cpp | 12 ++ src/libs/vgeometry/vcubicbezier.h | 3 + src/libs/vgeometry/vcubicbezierpath.cpp | 27 +++++ src/libs/vgeometry/vcubicbezierpath.h | 3 + src/libs/vgeometry/vgeometry.pri | 6 +- src/libs/vgeometry/vspline.h | 4 +- src/libs/vgeometry/vsplinepath.cpp | 26 +++++ src/libs/vgeometry/vsplinepath.h | 3 + src/libs/vmisc/def.h | 4 +- src/libs/vpatterndb/variables.h | 1 + .../vpatterndb/variables/vcurveclength.cpp | 105 ++++++++++++++++++ src/libs/vpatterndb/variables/vcurveclength.h | 56 ++++++++++ src/libs/vpatterndb/vcontainer.cpp | 30 ++++- src/libs/vpatterndb/vcontainer.h | 22 ++-- src/libs/vpatterndb/vpatterndb.pri | 6 +- .../support/dialogeditwrongformula.cpp | 8 ++ .../dialogs/support/dialogeditwrongformula.h | 1 + .../dialogs/support/dialogeditwrongformula.ui | 11 +- .../operation/flipping/vabstractflipping.h | 4 +- .../drawTools/operation/vtoolrotation.cpp | 10 +- .../drawTools/toolcurve/vtoolcubicbezier.cpp | 4 +- .../tools/drawTools/toolcurve/vtoolspline.cpp | 4 +- .../toolcut/vtoolcutspline.cpp | 12 +- .../toolcut/vtoolcutsplinepath.cpp | 8 +- .../toollinepoint/vtoolcurveintersectaxis.cpp | 32 +++--- 37 files changed, 515 insertions(+), 72 deletions(-) create mode 100644 src/libs/vgeometry/vabstractbezier.cpp create mode 100644 src/libs/vgeometry/vabstractbezier.h create mode 100644 src/libs/vpatterndb/variables/vcurveclength.cpp create mode 100644 src/libs/vpatterndb/variables/vcurveclength.h diff --git a/src/app/valentina/dialogs/dialogincrements.cpp b/src/app/valentina/dialogs/dialogincrements.cpp index 45f750104..93ba69a91 100644 --- a/src/app/valentina/dialogs/dialogincrements.cpp +++ b/src/app/valentina/dialogs/dialogincrements.cpp @@ -84,6 +84,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par FillLengthsLines(); FillLengthLinesAngles(); FillLengthsCurves(); + FillCurvesCLengths(); FillRadiusesArcs(); FillAnglesCurves(); @@ -232,6 +233,12 @@ void DialogIncrements::FillLengthsCurves() FillTable(data->DataLengthCurves(), ui->tableWidgetSplines); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogIncrements::FillCurvesCLengths() +{ + FillTable(data->DataCurvesCLength(), ui->tableWidgetCLength); +} + //--------------------------------------------------------------------------------------------------------------------- void DialogIncrements::FillRadiusesArcs() { @@ -254,6 +261,7 @@ void DialogIncrements::ShowUnits() ShowHeaderUnits(ui->tableWidgetLines, 1, unit);// lengths ShowHeaderUnits(ui->tableWidgetSplines, 1, unit);// lengths + ShowHeaderUnits(ui->tableWidgetCLength, 1, unit);// lengths ShowHeaderUnits(ui->tableWidgetLinesAngles, 1, degreeSymbol);// angle ShowHeaderUnits(ui->tableWidgetRadiusesArcs, 1, unit);// radius ShowHeaderUnits(ui->tableWidgetAnglesCurves, 1, degreeSymbol);// angle @@ -445,6 +453,7 @@ void DialogIncrements::FullUpdateFromFile() FillLengthsLines(); FillLengthLinesAngles(); FillLengthsCurves(); + FillCurvesCLengths(); FillRadiusesArcs(); FillAnglesCurves(); diff --git a/src/app/valentina/dialogs/dialogincrements.h b/src/app/valentina/dialogs/dialogincrements.h index af30e4b45..8de446295 100644 --- a/src/app/valentina/dialogs/dialogincrements.h +++ b/src/app/valentina/dialogs/dialogincrements.h @@ -98,6 +98,7 @@ private: void FillLengthsLines(); void FillLengthLinesAngles(); void FillLengthsCurves(); + void FillCurvesCLengths(); void FillRadiusesArcs(); void FillAnglesCurves(); diff --git a/src/app/valentina/dialogs/dialogincrements.ui b/src/app/valentina/dialogs/dialogincrements.ui index 0f9e62962..287243e7e 100644 --- a/src/app/valentina/dialogs/dialogincrements.ui +++ b/src/app/valentina/dialogs/dialogincrements.ui @@ -273,8 +273,7 @@ - - + .. @@ -288,8 +287,7 @@ - - + .. @@ -572,6 +570,45 @@ + + + Curves control point lengths + + + + + + QAbstractItemView::NoEditTriggers + + + true + + + false + + + 137 + + + false + + + false + + + + Curve + + + + + Length + + + + + + Angles curves diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index c779f1896..5a93aa209 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -3356,6 +3356,7 @@ void VPattern::PrepareForParse(const Document &parse) data->ClearVariables(VarType::LineAngle); data->ClearVariables(VarType::LineLength); data->ClearVariables(VarType::CurveLength); + data->ClearVariables(VarType::CurveCLength); data->ClearVariables(VarType::ArcRadius); data->ClearVariables(VarType::CurveAngle); } diff --git a/src/libs/ifc/ifcdef.cpp b/src/libs/ifc/ifcdef.cpp index 5a47465c1..0e21829b1 100644 --- a/src/libs/ifc/ifcdef.cpp +++ b/src/libs/ifc/ifcdef.cpp @@ -162,6 +162,8 @@ const QString radius_V = QStringLiteral("Radius"); const QString radiusArc_ = radius_V + arc_; const QString angle1_V = QStringLiteral("Angle1"); const QString angle2_V = QStringLiteral("Angle2"); +const QString c1Length_V = QStringLiteral("C1Length"); +const QString c2Length_V = QStringLiteral("C2Length"); const QString angle1Arc_ = angle1_V + arc_; const QString angle2Arc_ = angle2_V + arc_; const QString angle1Spl_ = angle1_V + spl_; diff --git a/src/libs/ifc/ifcdef.h b/src/libs/ifc/ifcdef.h index 900c31aa6..359edcce2 100644 --- a/src/libs/ifc/ifcdef.h +++ b/src/libs/ifc/ifcdef.h @@ -168,6 +168,8 @@ extern const QString radius_V; extern const QString radiusArc_; extern const QString angle1_V; extern const QString angle2_V; +extern const QString c1Length_V; +extern const QString c2Length_V; extern const QString angle1Arc_; extern const QString angle2Arc_; extern const QString angle1Spl_; diff --git a/src/libs/vgeometry/vabstractbezier.cpp b/src/libs/vgeometry/vabstractbezier.cpp new file mode 100644 index 000000000..9d2eea0c1 --- /dev/null +++ b/src/libs/vgeometry/vabstractbezier.cpp @@ -0,0 +1,57 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 24 9, 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 "vabstractbezier.h" + +//--------------------------------------------------------------------------------------------------------------------- +VAbstractBezier::VAbstractBezier(const GOType &type, const quint32 &idObject, const Draw &mode) + : VAbstractCurve(type, idObject, mode) +{ +} + +//--------------------------------------------------------------------------------------------------------------------- +VAbstractBezier::VAbstractBezier(const VAbstractBezier &curve) + : VAbstractCurve(curve) +{ +} + +//--------------------------------------------------------------------------------------------------------------------- +VAbstractBezier &VAbstractBezier::operator=(const VAbstractBezier &curve) +{ + if ( &curve == this ) + { + return *this; + } + VAbstractCurve::operator=(curve); + return *this; +} + +//--------------------------------------------------------------------------------------------------------------------- +VAbstractBezier::~VAbstractBezier() +{ +} diff --git a/src/libs/vgeometry/vabstractbezier.h b/src/libs/vgeometry/vabstractbezier.h new file mode 100644 index 000000000..d59959bba --- /dev/null +++ b/src/libs/vgeometry/vabstractbezier.h @@ -0,0 +1,48 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 24 9, 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 VABSTRACTBEZIER_H +#define VABSTRACTBEZIER_H + +#include + +#include "vabstractcurve.h" + +class VAbstractBezier : public VAbstractCurve +{ +public: + VAbstractBezier(const GOType &type, const quint32 &idObject = NULL_ID, const Draw &mode = Draw::Calculation); + VAbstractBezier(const VAbstractBezier &curve); + VAbstractBezier& operator= (const VAbstractBezier &curve); + virtual ~VAbstractBezier(); + + virtual qreal GetC1Length() const =0; + virtual qreal GetC2Length() const =0; +}; + +#endif // VABSTRACTBEZIER_H diff --git a/src/libs/vgeometry/vabstractcubicbezier.cpp b/src/libs/vgeometry/vabstractcubicbezier.cpp index 35179a844..7694e9cc1 100644 --- a/src/libs/vgeometry/vabstractcubicbezier.cpp +++ b/src/libs/vgeometry/vabstractcubicbezier.cpp @@ -39,13 +39,13 @@ //--------------------------------------------------------------------------------------------------------------------- VAbstractCubicBezier::VAbstractCubicBezier(const GOType &type, const quint32 &idObject, const Draw &mode) - : VAbstractCurve(type, idObject, mode) + : VAbstractBezier(type, idObject, mode) { } //--------------------------------------------------------------------------------------------------------------------- VAbstractCubicBezier::VAbstractCubicBezier(const VAbstractCubicBezier &curve) - : VAbstractCurve(curve) + : VAbstractBezier(curve) { } @@ -56,7 +56,7 @@ VAbstractCubicBezier &VAbstractCubicBezier::operator=(const VAbstractCubicBezier { return *this; } - VAbstractCurve::operator=(curve); + VAbstractBezier::operator=(curve); return *this; } diff --git a/src/libs/vgeometry/vabstractcubicbezier.h b/src/libs/vgeometry/vabstractcubicbezier.h index 3cf0d2769..1e30d698e 100644 --- a/src/libs/vgeometry/vabstractcubicbezier.h +++ b/src/libs/vgeometry/vabstractcubicbezier.h @@ -36,13 +36,13 @@ #include #include "../ifc/ifcdef.h" -#include "vabstractcurve.h" +#include "vabstractbezier.h" #include "vgeometrydef.h" class QPointF; class VPointF; -class VAbstractCubicBezier : public VAbstractCurve +class VAbstractCubicBezier : public VAbstractBezier { public: VAbstractCubicBezier(const GOType &type, const quint32 &idObject = NULL_ID, const Draw &mode = Draw::Calculation); diff --git a/src/libs/vgeometry/vabstractcubicbezierpath.cpp b/src/libs/vgeometry/vabstractcubicbezierpath.cpp index 6a9ffadc0..5c56a8d56 100644 --- a/src/libs/vgeometry/vabstractcubicbezierpath.cpp +++ b/src/libs/vgeometry/vabstractcubicbezierpath.cpp @@ -40,13 +40,13 @@ class QPointF; //--------------------------------------------------------------------------------------------------------------------- VAbstractCubicBezierPath::VAbstractCubicBezierPath(const GOType &type, const quint32 &idObject, const Draw &mode) - : VAbstractCurve(type, idObject, mode) + : VAbstractBezier(type, idObject, mode) { } //--------------------------------------------------------------------------------------------------------------------- VAbstractCubicBezierPath::VAbstractCubicBezierPath(const VAbstractCubicBezierPath &curve) - : VAbstractCurve(curve) + : VAbstractBezier(curve) { } @@ -57,7 +57,7 @@ VAbstractCubicBezierPath &VAbstractCubicBezierPath::operator=(const VAbstractCub { return *this; } - VAbstractCurve::operator=(curve); + VAbstractBezier::operator=(curve); return *this; } diff --git a/src/libs/vgeometry/vabstractcubicbezierpath.h b/src/libs/vgeometry/vabstractcubicbezierpath.h index 79ff14f92..f1caa1648 100644 --- a/src/libs/vgeometry/vabstractcubicbezierpath.h +++ b/src/libs/vgeometry/vabstractcubicbezierpath.h @@ -36,7 +36,7 @@ #include #include -#include "vabstractcurve.h" +#include "vabstractbezier.h" #include "vgeometrydef.h" class QPainterPath; @@ -45,7 +45,7 @@ class VPointF; class VSpline; class VSplinePoint; -class VAbstractCubicBezierPath : public VAbstractCurve +class VAbstractCubicBezierPath : public VAbstractBezier { Q_DECLARE_TR_FUNCTIONS(VAbstractCubicBezierPath) public: diff --git a/src/libs/vgeometry/vcubicbezier.cpp b/src/libs/vgeometry/vcubicbezier.cpp index 3b3d88786..3f710e339 100644 --- a/src/libs/vgeometry/vcubicbezier.cpp +++ b/src/libs/vgeometry/vcubicbezier.cpp @@ -175,6 +175,18 @@ QVector VCubicBezier::GetPoints() const return GetCubicBezierPoints(GetP1(), GetP2(), GetP3(), GetP4()); } +//--------------------------------------------------------------------------------------------------------------------- +qreal VCubicBezier::GetC1Length() const +{ + return QLineF(GetP1(), GetP2()).length(); +} + +//--------------------------------------------------------------------------------------------------------------------- +qreal VCubicBezier::GetC2Length() const +{ + return QLineF(GetP4(), GetP3()).length(); +} + //--------------------------------------------------------------------------------------------------------------------- QPointF VCubicBezier::GetControlPoint1() const { diff --git a/src/libs/vgeometry/vcubicbezier.h b/src/libs/vgeometry/vcubicbezier.h index 283141884..3e5b138ab 100644 --- a/src/libs/vgeometry/vcubicbezier.h +++ b/src/libs/vgeometry/vcubicbezier.h @@ -73,6 +73,9 @@ public: virtual qreal GetLength() const Q_DECL_OVERRIDE; virtual QVector GetPoints() const Q_DECL_OVERRIDE; + virtual qreal GetC1Length() const Q_DECL_OVERRIDE; + virtual qreal GetC2Length() const Q_DECL_OVERRIDE; + protected: virtual QPointF GetControlPoint1() const Q_DECL_OVERRIDE; virtual QPointF GetControlPoint2() const Q_DECL_OVERRIDE; diff --git a/src/libs/vgeometry/vcubicbezierpath.cpp b/src/libs/vgeometry/vcubicbezierpath.cpp index 1cc4c9c1b..208c38206 100644 --- a/src/libs/vgeometry/vcubicbezierpath.cpp +++ b/src/libs/vgeometry/vcubicbezierpath.cpp @@ -210,6 +210,33 @@ qreal VCubicBezierPath::GetEndAngle() const } } +//--------------------------------------------------------------------------------------------------------------------- +qreal VCubicBezierPath::GetC1Length() const +{ + if (CountSubSpl() > 0) + { + return GetSpline(1).GetC1Length(); + } + else + { + return 0; + } +} + +//--------------------------------------------------------------------------------------------------------------------- +qreal VCubicBezierPath::GetC2Length() const +{ + const qint32 count = CountSubSpl(); + if (count > 0) + { + return GetSpline(count).GetC2Length(); + } + else + { + return 0; + } +} + //--------------------------------------------------------------------------------------------------------------------- QVector VCubicBezierPath::GetSplinePath() const { diff --git a/src/libs/vgeometry/vcubicbezierpath.h b/src/libs/vgeometry/vcubicbezierpath.h index c0c38cd8e..d483264f1 100644 --- a/src/libs/vgeometry/vcubicbezierpath.h +++ b/src/libs/vgeometry/vcubicbezierpath.h @@ -72,6 +72,9 @@ public: virtual qreal GetStartAngle () const Q_DECL_OVERRIDE; virtual qreal GetEndAngle () const Q_DECL_OVERRIDE; + virtual qreal GetC1Length() const Q_DECL_OVERRIDE; + virtual qreal GetC2Length() const Q_DECL_OVERRIDE; + virtual QVector GetSplinePath() const Q_DECL_OVERRIDE; QVector GetCubicPath() const; diff --git a/src/libs/vgeometry/vgeometry.pri b/src/libs/vgeometry/vgeometry.pri index 2b05f9b20..9caf4e3a3 100644 --- a/src/libs/vgeometry/vgeometry.pri +++ b/src/libs/vgeometry/vgeometry.pri @@ -14,7 +14,8 @@ SOURCES += \ $$PWD/vabstractcubicbezier.cpp \ $$PWD/vabstractcubicbezierpath.cpp \ $$PWD/vcubicbezierpath.cpp \ - $$PWD/vabstractarc.cpp + $$PWD/vabstractarc.cpp \ + $$PWD/vabstractbezier.cpp win32-msvc*:SOURCES += $$PWD/stable.cpp @@ -44,4 +45,5 @@ HEADERS += \ $$PWD/vcubicbezierpath.h \ $$PWD/vcubicbezierpath_p.h \ $$PWD/vabstractarc.h \ - $$PWD/vabstractarc_p.h + $$PWD/vabstractarc_p.h \ + $$PWD/vabstractbezier.h diff --git a/src/libs/vgeometry/vspline.h b/src/libs/vgeometry/vspline.h index 78705e496..325aea0ff 100644 --- a/src/libs/vgeometry/vspline.h +++ b/src/libs/vgeometry/vspline.h @@ -85,8 +85,8 @@ public: void SetStartAngle(qreal angle, const QString &formula); void SetEndAngle(qreal angle, const QString &formula); - qreal GetC1Length() const; - qreal GetC2Length() const; + virtual qreal GetC1Length() const Q_DECL_OVERRIDE; + virtual qreal GetC2Length() const Q_DECL_OVERRIDE; QString GetC1LengthFormula() const; QString GetC2LengthFormula() const; diff --git a/src/libs/vgeometry/vsplinepath.cpp b/src/libs/vgeometry/vsplinepath.cpp index bbf0be400..e21938d11 100644 --- a/src/libs/vgeometry/vsplinepath.cpp +++ b/src/libs/vgeometry/vsplinepath.cpp @@ -317,6 +317,32 @@ qreal VSplinePath::GetEndAngle() const } } +//--------------------------------------------------------------------------------------------------------------------- +qreal VSplinePath::GetC1Length() const +{ + if (CountPoints() > 0) + { + return GetSplinePath().first().Length2(); + } + else + { + return 0; + } +} + +//--------------------------------------------------------------------------------------------------------------------- +qreal VSplinePath::GetC2Length() const +{ + if (CountPoints() > 0) + { + return GetSplinePath().last().Length1(); + } + else + { + return 0; + } +} + //--------------------------------------------------------------------------------------------------------------------- VPointF VSplinePath::FirstPoint() const { diff --git a/src/libs/vgeometry/vsplinepath.h b/src/libs/vgeometry/vsplinepath.h index 424e1de44..da3b73c49 100644 --- a/src/libs/vgeometry/vsplinepath.h +++ b/src/libs/vgeometry/vsplinepath.h @@ -80,6 +80,9 @@ public: virtual qreal GetStartAngle () const Q_DECL_OVERRIDE; virtual qreal GetEndAngle () const Q_DECL_OVERRIDE; + virtual qreal GetC1Length() const Q_DECL_OVERRIDE; + virtual qreal GetC2Length() const Q_DECL_OVERRIDE; + void UpdatePoint(qint32 indexSpline, const SplinePointPosition &pos, const VSplinePoint &point); VSplinePoint GetSplinePoint(qint32 indexSpline, SplinePointPosition pos) const; diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index 31b04099f..80a92c9d1 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -157,8 +157,8 @@ enum class Vis : ToolVisHolderType ToolFlippingByAxis }; -enum class VarType : char { Measurement, Increment, LineLength, CurveLength, LineAngle, CurveAngle, ArcRadius, - Unknown }; +enum class VarType : char { Measurement, Increment, LineLength, CurveLength, CurveCLength, LineAngle, CurveAngle, + ArcRadius, Unknown }; enum class GHeights : unsigned char { ALL, H92=92, H98=98, H104=104, H110=110, H116=116, H122=122, H128=128, H134=134, diff --git a/src/libs/vpatterndb/variables.h b/src/libs/vpatterndb/variables.h index f07b5a709..5504c1904 100644 --- a/src/libs/vpatterndb/variables.h +++ b/src/libs/vpatterndb/variables.h @@ -37,5 +37,6 @@ #include "variables/vlineangle.h" #include "variables/varcradius.h" #include "variables/vcurveangle.h" +#include "variables/vcurveclength.h" #endif // VARIABLES_H diff --git a/src/libs/vpatterndb/variables/vcurveclength.cpp b/src/libs/vpatterndb/variables/vcurveclength.cpp new file mode 100644 index 000000000..1262cd832 --- /dev/null +++ b/src/libs/vpatterndb/variables/vcurveclength.cpp @@ -0,0 +1,105 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 24 9, 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 "vcurveclength.h" + +#include +#include + +#include "../vmisc/def.h" +#include "../ifc/ifcdef.h" +#include "../vgeometry/vabstractcurve.h" +#include "../vgeometry/vspline.h" +#include "vcurvevariable.h" + +//--------------------------------------------------------------------------------------------------------------------- +VCurveCLength::VCurveCLength() + : VCurveVariable() +{ + SetType(VarType::CurveCLength); +} + +//--------------------------------------------------------------------------------------------------------------------- +VCurveCLength::VCurveCLength(const quint32 &id, const quint32 &parentId, const VAbstractBezier *curve, + CurveCLength cType, Unit patternUnit) + : VCurveVariable(id, parentId) +{ + SetType(VarType::CurveCLength); + SCASSERT(curve != nullptr); + if (cType == CurveCLength::C1) + { + SetValue(FromPixel(curve->GetC1Length(), patternUnit)); + SetName(c1Length_V + curve->name()); + } + else + { + SetValue(FromPixel(curve->GetC2Length(), patternUnit)); + SetName(c2Length_V + curve->name()); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +VCurveCLength::VCurveCLength(const quint32 &id, const quint32 &parentId, const QString &baseCurveName, + const VSpline &spl, CurveCLength cType, Unit patternUnit, qint32 segment) + : VCurveVariable(id, parentId) +{ + SetType(VarType::CurveCLength); + if (cType == CurveCLength::C1) + { + SetValue(FromPixel(spl.GetC1Length(), patternUnit)); + SetName(c1Length_V + baseCurveName + QLatin1String("_") + seg_ + QString().setNum(segment)); + } + else + { + SetValue(FromPixel(spl.GetC2Length(), patternUnit)); + SetName(c2Length_V + baseCurveName + QLatin1String("_") + seg_ + QString().setNum(segment)); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +VCurveCLength::VCurveCLength(const VCurveCLength &var) + : VCurveVariable(var) +{ +} + +//--------------------------------------------------------------------------------------------------------------------- +VCurveCLength &VCurveCLength::operator=(const VCurveCLength &var) +{ + if ( &var == this ) + { + return *this; + } + VCurveVariable::operator=(var); + return *this; +} + +//--------------------------------------------------------------------------------------------------------------------- +VCurveCLength::~VCurveCLength() +{ +} + diff --git a/src/libs/vpatterndb/variables/vcurveclength.h b/src/libs/vpatterndb/variables/vcurveclength.h new file mode 100644 index 000000000..b20dabc89 --- /dev/null +++ b/src/libs/vpatterndb/variables/vcurveclength.h @@ -0,0 +1,56 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 24 9, 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 VCURVECLENGTH_H +#define VCURVECLENGTH_H + +#include +#include +#include + +#include "vcurvevariable.h" + +enum class CurveCLength : char { C1, C2 }; + +class VAbstractBezier; +class VSpline; + +class VCurveCLength : public VCurveVariable +{ +public: + VCurveCLength(); + VCurveCLength(const quint32 &id, const quint32 &parentId, const VAbstractBezier *curve, CurveCLength cType, + Unit patternUnit); + VCurveCLength(const quint32 &id, const quint32 &parentId, const QString &baseCurveName, const VSpline &spl, + CurveCLength cType, Unit patternUnit, qint32 segment); + VCurveCLength(const VCurveCLength &var); + VCurveCLength &operator=(const VCurveCLength &var); + virtual ~VCurveCLength() Q_DECL_OVERRIDE; +}; + +#endif // VCURVECLENGTH_H diff --git a/src/libs/vpatterndb/vcontainer.cpp b/src/libs/vpatterndb/vcontainer.cpp index 9843c0659..ea350a8a9 100644 --- a/src/libs/vpatterndb/vcontainer.cpp +++ b/src/libs/vpatterndb/vcontainer.cpp @@ -46,6 +46,7 @@ #include "variables/varcradius.h" #include "variables/vcurveangle.h" #include "variables/vcurvelength.h" +#include "variables/vcurveclength.h" #include "variables/vincrement.h" #include "variables/vlineangle.h" #include "variables/vlinelength.h" @@ -276,6 +277,7 @@ void VContainer::ClearForFullParse() ClearVariables(VarType::LineAngle); ClearVariables(VarType::LineLength); ClearVariables(VarType::CurveLength); + ClearVariables(VarType::CurveCLength); ClearVariables(VarType::ArcRadius); ClearVariables(VarType::CurveAngle); ClearGObjects(); @@ -407,11 +409,23 @@ void VContainer::AddCurve(const QSharedPointer &curve, const qui AddVariable(endAngle->GetName(), endAngle); } +//--------------------------------------------------------------------------------------------------------------------- +void VContainer::AddSpline(const QSharedPointer &curve, quint32 id, quint32 parentId) +{ + AddCurve(curve, id, parentId); + + VCurveCLength *c1Length = new VCurveCLength(id, parentId, curve.data(), CurveCLength::C1, *GetPatternUnit()); + AddVariable(c1Length->GetName(), c1Length); + + VCurveCLength *c2Length = new VCurveCLength(id, parentId, curve.data(), CurveCLength::C2, *GetPatternUnit()); + AddVariable(c2Length->GetName(), c2Length); +} + //--------------------------------------------------------------------------------------------------------------------- void VContainer::AddCurveWithSegments(const QSharedPointer &curve, const quint32 &id, quint32 parentId) { - AddCurve(curve, id, parentId); + AddSpline(curve, id, parentId); for (qint32 i = 1; i <= curve->CountSubSpl(); ++i) { @@ -425,6 +439,14 @@ void VContainer::AddCurveWithSegments(const QSharedPointername(), spl, CurveAngle::EndAngle, i); AddVariable(endAngle->GetName(), endAngle); + + VCurveCLength *c1Length = new VCurveCLength(id, parentId, curve->name(), spl, CurveCLength::C1, + *GetPatternUnit(), i); + AddVariable(c1Length->GetName(), c1Length); + + VCurveCLength *c2Length = new VCurveCLength(id, parentId, curve->name(), spl, CurveCLength::C2, + *GetPatternUnit(), i); + AddVariable(c2Length->GetName(), c2Length); } } @@ -524,6 +546,12 @@ const QMap > VContainer::DataLengthCurves( return DataVar(VarType::CurveLength); } +//--------------------------------------------------------------------------------------------------------------------- +const QMap > VContainer::DataCurvesCLength() const +{ + return DataVar(VarType::CurveCLength); +} + //--------------------------------------------------------------------------------------------------------------------- const QMap > VContainer::DataAngleLines() const { diff --git a/src/libs/vpatterndb/vcontainer.h b/src/libs/vpatterndb/vcontainer.h index 849c30ca7..6a581f94c 100644 --- a/src/libs/vpatterndb/vcontainer.h +++ b/src/libs/vpatterndb/vcontainer.h @@ -140,9 +140,8 @@ public: quint32 AddGObject(VGObject *obj); quint32 AddDetail(const VDetail &detail); void AddLine(const quint32 &firstPointId, const quint32 &secondPointId); - void AddArc(const QSharedPointer &arc, const quint32 &arcId, const quint32 &parentId = 0); - void AddCurve(const QSharedPointer &curve, const quint32 &id, - quint32 parentId = NULL_ID); + void AddArc(const QSharedPointer &arc, const quint32 &arcId, const quint32 &parentId = NULL_ID); + void AddSpline(const QSharedPointer &curve, quint32 id, quint32 parentId = NULL_ID); void AddCurveWithSegments(const QSharedPointer &curve, const quint32 &id, quint32 parentId = NULL_ID); @@ -176,13 +175,14 @@ public: const QHash *DataDetails() const; const QHash> *DataVariables() const; - const QMap > DataMeasurements() const; - const QMap > DataIncrements() const; - const QMap > DataLengthLines() const; - const QMap > DataLengthCurves() const; - const QMap > DataAngleLines() const; - const QMap > DataRadiusesArcs() const; - const QMap > DataAnglesCurves() const; + const QMap > DataMeasurements() const; + const QMap > DataIncrements() const; + const QMap > DataLengthLines() const; + const QMap > DataLengthCurves() const; + const QMap > DataCurvesCLength() const; + const QMap > DataAngleLines() const; + const QMap > DataRadiusesArcs() const; + const QMap > DataAnglesCurves() const; const QHash PlainVariables() const; @@ -203,6 +203,8 @@ private: QSharedDataPointer d; + void AddCurve(const QSharedPointer &curve, const quint32 &id, quint32 parentId = NULL_ID); + template uint qHash( const QSharedPointer &p ); diff --git a/src/libs/vpatterndb/vpatterndb.pri b/src/libs/vpatterndb/vpatterndb.pri index b2e055a6e..93f7d3490 100644 --- a/src/libs/vpatterndb/vpatterndb.pri +++ b/src/libs/vpatterndb/vpatterndb.pri @@ -19,7 +19,8 @@ SOURCES += \ $$PWD/variables/vvariable.cpp \ $$PWD/vformula.cpp \ $$PWD/vpatternpiecedata.cpp \ - $$PWD/vpatterninfogeometry.cpp + $$PWD/vpatterninfogeometry.cpp \ + $$PWD/variables/vcurveclength.cpp win32-msvc*:SOURCES += $$PWD/stable.cpp @@ -53,4 +54,5 @@ HEADERS += \ $$PWD/variables/vvariable_p.h \ $$PWD/vformula.h \ $$PWD/vpatternpiecedata.h \ - $$PWD/vpatterninfogeometry.h + $$PWD/vpatterninfogeometry.h \ + $$PWD/variables/vcurveclength.h diff --git a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp index 7bc6e8ab2..b9603cfaa 100644 --- a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp +++ b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp @@ -297,6 +297,13 @@ void DialogEditWrongFormula::LengthCurves() ShowVariable(data->DataLengthCurves()); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogEditWrongFormula::CurvesCLength() +{ + ui->checkBoxHideEmpty->setEnabled(false); + ShowVariable(data->DataCurvesCLength()); +} + //--------------------------------------------------------------------------------------------------------------------- void DialogEditWrongFormula::AngleLines() { @@ -399,6 +406,7 @@ void DialogEditWrongFormula::InitVariables() connect(ui->checkBoxHideEmpty, &QCheckBox::stateChanged, this, &DialogEditWrongFormula::Measurements); connect(ui->radioButtonRadiusesArcs, &QRadioButton::clicked, this, &DialogEditWrongFormula::RadiusArcs); connect(ui->radioButtonAnglesCurves, &QRadioButton::clicked, this, &DialogEditWrongFormula::AnglesCurves); + connect(ui->radioButtonCLength, &QRadioButton::clicked, this, &DialogEditWrongFormula::CurvesCLength); connect(ui->radioButtonFunctions, &QRadioButton::clicked, this, &DialogEditWrongFormula::Functions); } diff --git a/src/libs/vtools/dialogs/support/dialogeditwrongformula.h b/src/libs/vtools/dialogs/support/dialogeditwrongformula.h index 3eed52e9c..2e1255e85 100644 --- a/src/libs/vtools/dialogs/support/dialogeditwrongformula.h +++ b/src/libs/vtools/dialogs/support/dialogeditwrongformula.h @@ -88,6 +88,7 @@ public slots: void RadiusArcs(); void AnglesCurves(); void LengthCurves(); + void CurvesCLength(); void AngleLines(); void Increments(); void Functions(); diff --git a/src/libs/vtools/dialogs/support/dialogeditwrongformula.ui b/src/libs/vtools/dialogs/support/dialogeditwrongformula.ui index 9a6c353ae..8f952605e 100644 --- a/src/libs/vtools/dialogs/support/dialogeditwrongformula.ui +++ b/src/libs/vtools/dialogs/support/dialogeditwrongformula.ui @@ -9,8 +9,8 @@ 0 0 - 390 - 453 + 448 + 425 @@ -329,6 +329,13 @@ + + + + Lengths to control points + + + diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vabstractflipping.h b/src/libs/vtools/tools/drawTools/operation/flipping/vabstractflipping.h index 0bc98b1be..72bd275d9 100644 --- a/src/libs/vtools/tools/drawTools/operation/flipping/vabstractflipping.h +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vabstractflipping.h @@ -103,7 +103,7 @@ DestinationItem VAbstractFlipping::CreateCurve(quint32 idTool, quint32 idItem, c const QPointF &secondPoint, const QString &suffix, VContainer *data) { const DestinationItem item = CreateItem(idTool, idItem, firstPoint, secondPoint, suffix, data); - data->AddCurve(data->GeometricObject(item.id), item.id); + data->AddSpline(data->GeometricObject(item.id), item.id); return item; } @@ -135,7 +135,7 @@ void VAbstractFlipping::UpdateCurve(quint32 idTool, quint32 idItem, const QPoint const QPointF &secondPoint, const QString &suffix, VContainer *data, quint32 id) { UpdateItem(idTool, idItem, firstPoint, secondPoint, suffix, data, id); - data->AddCurve(data->GeometricObject(id), id); + data->AddSpline(data->GeometricObject(id), id); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp b/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp index 8959868bc..4dd3e640c 100644 --- a/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp +++ b/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp @@ -390,7 +390,7 @@ DestinationItem VToolRotation::CreateCurve(quint32 idTool, quint32 idItem, const const QString &suffix, VContainer *data) { const DestinationItem item = CreateItem(idTool, idItem, origin, angle, suffix, data); - data->AddCurve(data->GeometricObject(item.id), item.id); + data->AddSpline(data->GeometricObject(item.id), item.id); return item; } @@ -429,7 +429,7 @@ void VToolRotation::UpdateItem(quint32 idTool, quint32 idItem, const QPointF &or //--------------------------------------------------------------------------------------------------------------------- void VToolRotation::UpdateArc(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle, - const QString &suffix, VContainer *data, quint32 id) + const QString &suffix, VContainer *data, quint32 id) { UpdateItem(idTool, idItem, origin, angle, suffix, data, id); data->AddArc(data->GeometricObject(id), id); @@ -438,16 +438,16 @@ void VToolRotation::UpdateArc(quint32 idTool, quint32 idItem, const QPointF &ori //--------------------------------------------------------------------------------------------------------------------- template void VToolRotation::UpdateCurve(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle, - const QString &suffix, VContainer *data, quint32 id) + const QString &suffix, VContainer *data, quint32 id) { UpdateItem(idTool, idItem, origin, angle, suffix, data, id); - data->AddCurve(data->GeometricObject(id), id); + data->AddSpline(data->GeometricObject(id), id); } //--------------------------------------------------------------------------------------------------------------------- template void VToolRotation::UpdateCurveWithSegments(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle, - const QString &suffix, VContainer *data, quint32 id) + const QString &suffix, VContainer *data, quint32 id) { UpdateItem(idTool, idItem, origin, angle, suffix, data, id); data->AddCurveWithSegments(data->GeometricObject(id), id); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp index e074b103d..6da275d30 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp @@ -117,12 +117,12 @@ VToolCubicBezier *VToolCubicBezier::Create(const quint32 _id, VCubicBezier *spli if (typeCreation == Source::FromGui) { id = data->AddGObject(spline); - data->AddCurve(data->GeometricObject(id), id); + data->AddSpline(data->GeometricObject(id), id); } else { data->UpdateGObject(id, spline); - data->AddCurve(data->GeometricObject(id), id); + data->AddSpline(data->GeometricObject(id), id); if (parse != Document::FullParse) { doc->UpdateToolData(id, data); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp index b48024c1f..1ae884da6 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp @@ -196,12 +196,12 @@ VToolSpline* VToolSpline::Create(const quint32 _id, VSpline *spline, const QStri if (typeCreation == Source::FromGui) { id = data->AddGObject(spline); - data->AddCurve(data->GeometricObject(id), id); + data->AddSpline(data->GeometricObject(id), id); } else { data->UpdateGObject(id, spline); - data->AddCurve(data->GeometricObject(id), id); + data->AddSpline(data->GeometricObject(id), id); if (parse != Document::FullParse) { doc->UpdateToolData(id, data); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp index f58a42d8d..2e29d3e90 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp @@ -150,20 +150,20 @@ VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointNa quint32 id = _id; VPointF *p = new VPointF(point, pointName, mx, my); - auto spline1 = QSharedPointer(new VSpline(spl->GetP1(), spl1p2, spl1p3, *p)); - auto spline2 = QSharedPointer(new VSpline(*p, spl2p2, spl2p3, spl->GetP4())); + auto spline1 = QSharedPointer(new VSpline(spl->GetP1(), spl1p2, spl1p3, *p)); + auto spline2 = QSharedPointer(new VSpline(*p, spl2p2, spl2p3, spl->GetP4())); if (typeCreation == Source::FromGui) { id = data->AddGObject(p); - data->AddCurve(spline1, NULL_ID, id); - data->AddCurve(spline2, NULL_ID, id); + data->AddSpline(spline1, NULL_ID, id); + data->AddSpline(spline2, NULL_ID, id); } else { data->UpdateGObject(id, p); - data->AddCurve(spline1, NULL_ID, id); - data->AddCurve(spline2, NULL_ID, id); + data->AddSpline(spline1, NULL_ID, id); + data->AddSpline(spline2, NULL_ID, id); if (parse != Document::FullParse) { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp index cdb998195..d300c3d02 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp @@ -166,15 +166,15 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString { id = data->AddGObject(p); - data->AddCurve(QSharedPointer(splPath1), NULL_ID, id); - data->AddCurve(QSharedPointer(splPath2), NULL_ID, id); + data->AddSpline(QSharedPointer(splPath1), NULL_ID, id); + data->AddSpline(QSharedPointer(splPath2), NULL_ID, id); } else { data->UpdateGObject(id, p); - data->AddCurve(QSharedPointer(splPath1), NULL_ID, id); - data->AddCurve(QSharedPointer(splPath2), NULL_ID, id); + data->AddSpline(QSharedPointer(splPath1), NULL_ID, id); + data->AddSpline(QSharedPointer(splPath2), NULL_ID, id); if (parse != Document::FullParse) { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp index e25800a43..54c5d2b7a 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp @@ -378,8 +378,8 @@ void VToolCurveIntersectAxis::InitSegments(const GOType &curveType, qreal segLen case GOType::CubicBezier: case GOType::Spline: { - QSharedPointer spline1; - QSharedPointer spline2; + QSharedPointer spline1; + QSharedPointer spline2; const auto spl = data->GeometricObject(curveId); QPointF spl1p2, spl1p3, spl2p2, spl2p3; @@ -397,13 +397,13 @@ void VToolCurveIntersectAxis::InitSegments(const GOType &curveType, qreal segLen if (not VFuzzyComparePossibleNulls(segLength, -1)) { - spline1 = QSharedPointer(spl1); - spline2 = QSharedPointer(spl2); + spline1 = QSharedPointer(spl1); + spline2 = QSharedPointer(spl2); } else { - spline1 = QSharedPointer(new VSpline()); - spline2 = QSharedPointer(new VSpline()); + spline1 = QSharedPointer(new VSpline()); + spline2 = QSharedPointer(new VSpline()); // Take names for empty splines from donors. spline1->setName(spl1->name()); @@ -413,15 +413,15 @@ void VToolCurveIntersectAxis::InitSegments(const GOType &curveType, qreal segLen delete spl2; } - data->AddCurve(spline1, NULL_ID, p->id()); - data->AddCurve(spline2, NULL_ID, p->id()); + data->AddSpline(spline1, NULL_ID, p->id()); + data->AddSpline(spline2, NULL_ID, p->id()); break; } case GOType::CubicBezierPath: case GOType::SplinePath: { - QSharedPointer splP1; - QSharedPointer splP2; + QSharedPointer splP1; + QSharedPointer splP2; const auto splPath = data->GeometricObject(curveId); VSplinePath *splPath1 = nullptr; @@ -442,13 +442,13 @@ void VToolCurveIntersectAxis::InitSegments(const GOType &curveType, qreal segLen if (not VFuzzyComparePossibleNulls(segLength, -1)) { - splP1 = QSharedPointer(splPath1); - splP2 = QSharedPointer(splPath2); + splP1 = QSharedPointer(splPath1); + splP2 = QSharedPointer(splPath2); } else { - splP1 = QSharedPointer(new VSplinePath()); - splP2 = QSharedPointer(new VSplinePath()); + splP1 = QSharedPointer(new VSplinePath()); + splP2 = QSharedPointer(new VSplinePath()); // Take names for empty spline paths from donors. splP1->setName(splPath1->name()); @@ -458,8 +458,8 @@ void VToolCurveIntersectAxis::InitSegments(const GOType &curveType, qreal segLen delete splPath2; } - data->AddCurve(splP1, NULL_ID, p->id()); - data->AddCurve(splP2, NULL_ID, p->id()); + data->AddSpline(splP1, NULL_ID, p->id()); + data->AddSpline(splP2, NULL_ID, p->id()); break; } case GOType::EllipticalArc: