Untested changes for the tool Spline.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-02-15 16:30:48 +02:00
parent f264206aab
commit be3fc296f4
17 changed files with 263 additions and 38 deletions

View File

@ -1860,11 +1860,16 @@ void VPattern::ParseToolSpline(VMainGraphicsScene *scene, const QDomElement &dom
const qreal kAsm2 = GetParametrDouble(domElement, AttrKAsm2, "1.0"); const qreal kAsm2 = GetParametrDouble(domElement, AttrKAsm2, "1.0");
const qreal kCurve = GetParametrDouble(domElement, AttrKCurve, "1.0"); const qreal kCurve = GetParametrDouble(domElement, AttrKCurve, "1.0");
const QString color = GetParametrString(domElement, AttrColor, ColorBlack); const QString color = GetParametrString(domElement, AttrColor, ColorBlack);
const quint32 duplicate = GetParametrUInt(domElement, AttrDuplicate, "0");
const auto p1 = data->GeometricObject<VPointF>(point1); const auto p1 = data->GeometricObject<VPointF>(point1);
const auto p4 = data->GeometricObject<VPointF>(point4); const auto p4 = data->GeometricObject<VPointF>(point4);
VSpline spline(*p1, *p4, angle1, angle2, kAsm1, kAsm2, kCurve); VSpline spline(*p1, *p4, angle1, angle2, kAsm1, kAsm2, kCurve);
if (duplicate > 0)
{
spline.SetDuplicate(duplicate);
}
VToolSpline::Create(id, spline, color, scene, this, data, parse, Source::FromFile); VToolSpline::Create(id, spline, color, scene, this, data, parse, Source::FromFile);
} }

View File

@ -102,6 +102,7 @@ const QString AttrPoint4 = QStringLiteral("point4");
const QString AttrKAsm1 = QStringLiteral("kAsm1"); const QString AttrKAsm1 = QStringLiteral("kAsm1");
const QString AttrKAsm2 = QStringLiteral("kAsm2"); const QString AttrKAsm2 = QStringLiteral("kAsm2");
const QString AttrKCurve = QStringLiteral("kCurve"); const QString AttrKCurve = QStringLiteral("kCurve");
const QString AttrDuplicate = QStringLiteral("duplicate");
const QString AttrPathPoint = QStringLiteral("pathPoint"); const QString AttrPathPoint = QStringLiteral("pathPoint");
const QString AttrPSpline = QStringLiteral("pSpline"); const QString AttrPSpline = QStringLiteral("pSpline");
const QString AttrAxisP1 = QStringLiteral("axisP1"); const QString AttrAxisP1 = QStringLiteral("axisP1");

View File

@ -104,6 +104,7 @@ extern const QString AttrPoint4;
extern const QString AttrKAsm1; extern const QString AttrKAsm1;
extern const QString AttrKAsm2; extern const QString AttrKAsm2;
extern const QString AttrKCurve; extern const QString AttrKCurve;
extern const QString AttrDuplicate;
extern const QString AttrPathPoint; extern const QString AttrPathPoint;
extern const QString AttrPSpline; extern const QString AttrPSpline;
extern const QString AttrAxisP1; extern const QString AttrAxisP1;

View File

@ -27,17 +27,18 @@
*************************************************************************/ *************************************************************************/
#include "vabstractcurve.h" #include "vabstractcurve.h"
#include "vabstractcurve_p.h"
#include <QPainterPath> #include <QPainterPath>
#include <QDebug> #include <QDebug>
VAbstractCurve::VAbstractCurve(const GOType &type, const quint32 &idObject, const Draw &mode) VAbstractCurve::VAbstractCurve(const GOType &type, const quint32 &idObject, const Draw &mode)
:VGObject(type, idObject, mode) :VGObject(type, idObject, mode), d (new VAbstractCurveData())
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractCurve::VAbstractCurve(const VAbstractCurve &curve) VAbstractCurve::VAbstractCurve(const VAbstractCurve &curve)
:VGObject(curve) :VGObject(curve), d (curve.d)
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -48,9 +49,14 @@ VAbstractCurve &VAbstractCurve::operator=(const VAbstractCurve &curve)
return *this; return *this;
} }
VGObject::operator=(curve); VGObject::operator=(curve);
d = curve.d;
return *this; return *this;
} }
//---------------------------------------------------------------------------------------------------------------------
VAbstractCurve::~VAbstractCurve()
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VAbstractCurve::GetSegmentPoints(const QPointF &begin, const QPointF &end, bool reverse) const QVector<QPointF> VAbstractCurve::GetSegmentPoints(const QPointF &begin, const QPointF &end, bool reverse) const
{ {
@ -165,6 +171,19 @@ bool VAbstractCurve::IsIntersectLine(const QLineF &line) const
return not points.isEmpty(); return not points.isEmpty();
} }
//---------------------------------------------------------------------------------------------------------------------
quint32 VAbstractCurve::GetDuplicate() const
{
return d->duplicate;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractCurve::SetDuplicate(quint32 number)
{
d->duplicate = number;
CreateName();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VAbstractCurve::CurveIntersectLine(const QVector<QPointF> &points, const QLineF &line) QVector<QPointF> VAbstractCurve::CurveIntersectLine(const QVector<QPointF> &points, const QLineF &line)
{ {

View File

@ -37,6 +37,7 @@ enum class PathDirection : char { Hide, Show };
class QPainterPath; class QPainterPath;
class QLineF; class QLineF;
class VAbstractCurveData;
class VAbstractCurve :public VGObject class VAbstractCurve :public VGObject
{ {
@ -45,6 +46,7 @@ public:
const Draw &mode = Draw::Calculation); const Draw &mode = Draw::Calculation);
explicit VAbstractCurve(const VAbstractCurve &curve); explicit VAbstractCurve(const VAbstractCurve &curve);
VAbstractCurve& operator= (const VAbstractCurve &curve); VAbstractCurve& operator= (const VAbstractCurve &curve);
virtual ~VAbstractCurve() Q_DECL_OVERRIDE;
virtual QVector<QPointF> GetPoints() const =0; virtual QVector<QPointF> GetPoints() const =0;
QVector<QPointF> GetSegmentPoints(const QPointF &begin, const QPointF &end, bool reverse = false) const; QVector<QPointF> GetSegmentPoints(const QPointF &begin, const QPointF &end, bool reverse = false) const;
@ -57,12 +59,20 @@ public:
virtual qreal GetStartAngle () const=0; virtual qreal GetStartAngle () const=0;
virtual qreal GetEndAngle () const=0; virtual qreal GetEndAngle () const=0;
quint32 GetDuplicate() const;
void SetDuplicate(quint32 number);
static QVector<QPointF> CurveIntersectLine(const QVector<QPointF> &points, const QLineF &line); static QVector<QPointF> CurveIntersectLine(const QVector<QPointF> &points, const QLineF &line);
protected: protected:
QPainterPath ShowDirection(const QVector<QPointF> &points) const; QPainterPath ShowDirection(const QVector<QPointF> &points) const;
virtual void CreateName() =0;
private: private:
QSharedDataPointer<VAbstractCurveData> d;
static QVector<QPointF> FromBegin(const QVector<QPointF> &points, const QPointF &begin); static QVector<QPointF> FromBegin(const QVector<QPointF> &points, const QPointF &begin);
static QVector<QPointF> ToEnd(const QVector<QPointF> &points, const QPointF &end); static QVector<QPointF> ToEnd(const QVector<QPointF> &points, const QPointF &end);
}; };
Q_DECLARE_TYPEINFO(VAbstractCurve, Q_MOVABLE_TYPE);
#endif // VABSTRACTCURVE_H #endif // VABSTRACTCURVE_H

View File

@ -0,0 +1,67 @@
/************************************************************************
**
** @file vabstractcurve_p.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 15 2, 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
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef VABSTRACTCURVE_P_H
#define VABSTRACTCURVE_P_H
#include <QSharedData>
#ifdef Q_CC_GNU
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#endif
class VAbstractCurveData : public QSharedData
{
public:
VAbstractCurveData ()
: duplicate(0)
{}
VAbstractCurveData(const VAbstractCurveData &curve)
: QSharedData(curve), duplicate(curve.duplicate)
{}
virtual ~VAbstractCurveData();
/** @brief duplicate helps create unique name for curves that connects the same start and finish points. */
quint32 duplicate;
private:
VAbstractCurveData &operator=(const VAbstractCurveData &) Q_DECL_EQ_DELETE;
};
VAbstractCurveData::~VAbstractCurveData()
{}
#ifdef Q_CC_GNU
#pragma GCC diagnostic pop
#endif
#endif // VABSTRACTCURVE_P_H

View File

@ -58,14 +58,14 @@ VArc::VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QStri
: VAbstractCurve(GOType::Arc, idObject, mode), : VAbstractCurve(GOType::Arc, idObject, mode),
d (new VArcData(center, radius, formulaRadius, f1, formulaF1, f2, formulaF2)) d (new VArcData(center, radius, formulaRadius, f1, formulaF1, f2, formulaF2))
{ {
ArcName(); CreateName();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VArc::VArc(VPointF center, qreal radius, qreal f1, qreal f2) VArc::VArc(VPointF center, qreal radius, qreal f1, qreal f2)
: VAbstractCurve(GOType::Arc, NULL_ID, Draw::Calculation), d (new VArcData(center, radius, f1, f2)) : VAbstractCurve(GOType::Arc, NULL_ID, Draw::Calculation), d (new VArcData(center, radius, f1, f2))
{ {
ArcName(); CreateName();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -74,7 +74,7 @@ VArc::VArc(qreal length, QString formulaLength, VPointF center, qreal radius, QS
: VAbstractCurve(GOType::Arc, idObject, mode), : VAbstractCurve(GOType::Arc, idObject, mode),
d (new VArcData(formulaLength, center, radius, formulaRadius, f1, formulaF1)) d (new VArcData(formulaLength, center, radius, formulaRadius, f1, formulaF1))
{ {
ArcName(); CreateName();
FindF2(length); FindF2(length);
} }
@ -82,7 +82,7 @@ VArc::VArc(qreal length, QString formulaLength, VPointF center, qreal radius, QS
VArc::VArc(qreal length, VPointF center, qreal radius, qreal f1) VArc::VArc(qreal length, VPointF center, qreal radius, qreal f1)
: VAbstractCurve(GOType::Arc, NULL_ID, Draw::Calculation), d (new VArcData(center, radius, f1)) : VAbstractCurve(GOType::Arc, NULL_ID, Draw::Calculation), d (new VArcData(center, radius, f1))
{ {
ArcName(); CreateName();
FindF2(length); FindF2(length);
} }
@ -126,7 +126,7 @@ qreal VArc::GetLength() const
qreal length = (M_PI * d->radius)/180 * AngleArc(); qreal length = (M_PI * d->radius)/180 * AngleArc();
if (d->isFlipped) if (d->isFlipped)
{ {
length = length * -1; length *= -1;
} }
return length; return length;
@ -312,13 +312,25 @@ QPointF VArc::CutArc(const qreal &length) const
void VArc::setId(const quint32 &id) void VArc::setId(const quint32 &id)
{ {
VAbstractCurve::setId(id); VAbstractCurve::setId(id);
setName(ARC_ + QString("%1_%2").arg(d->center.name()).arg(id)); CreateName();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VArc::ArcName() void VArc::CreateName()
{ {
setName(ARC_ + QString("%1").arg(this->GetCenter().name())); QString name = ARC_ + QString("%1").arg(this->GetCenter().name());
if (VAbstractCurve::id() != NULL_ID)
{
name += QString("_%1").arg(VAbstractCurve::id());
}
if (GetDuplicate() > 0)
{
name += QString("_%1").arg(GetDuplicate());
}
setName(name);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -80,10 +80,11 @@ public:
QPointF CutArc (const qreal &length, VArc &arc1, VArc &arc2) const; QPointF CutArc (const qreal &length, VArc &arc1, VArc &arc2) const;
QPointF CutArc (const qreal &length) const; QPointF CutArc (const qreal &length) const;
virtual void setId(const quint32 &id) Q_DECL_OVERRIDE; virtual void setId(const quint32 &id) Q_DECL_OVERRIDE;
protected:
virtual void CreateName() Q_DECL_OVERRIDE;
private: private:
QSharedDataPointer<VArcData> d; QSharedDataPointer<VArcData> d;
void ArcName();
void FindF2(qreal length); void FindF2(qreal length);
qreal MaxLength() const; qreal MaxLength() const;

View File

@ -27,4 +27,5 @@ HEADERS += \
$$PWD/vsplinepath_p.h \ $$PWD/vsplinepath_p.h \
$$PWD/vsplinepoint.h \ $$PWD/vsplinepoint.h \
$$PWD/vsplinepoint_p.h \ $$PWD/vsplinepoint_p.h \
$$PWD/vgeometrydef.h $$PWD/vgeometrydef.h \
$$PWD/vabstractcurve_p.h

View File

@ -600,7 +600,13 @@ qreal VSpline::CalcSqDistance (qreal x1, qreal y1, qreal x2, qreal y2)
*/ */
void VSpline::CreateName() void VSpline::CreateName()
{ {
setName(SPL_ + QString("%1_%2").arg(this->GetP1().name(), this->GetP4().name())); QString name = SPL_ + QString("%1_%2").arg(this->GetP1().name()).arg(this->GetP4().name());
if (GetDuplicate() > 0)
{
name += QString("_%1").arg(GetDuplicate());
}
setName(name);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -76,13 +76,13 @@ public:
qreal ParamT(const QPointF &pBt) const; qreal ParamT(const QPointF &pBt) const;
protected: protected:
static QVector<QPointF> GetPoints (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 ); static QVector<QPointF> GetPoints (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 );
virtual void CreateName() Q_DECL_OVERRIDE;
private: private:
QSharedDataPointer<VSplineData> d; QSharedDataPointer<VSplineData> d;
static qreal LengthBezier (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 ); static qreal LengthBezier (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 );
static void PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4, static void PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4,
qint16 level, QVector<qreal> &px, QVector<qreal> &py); qint16 level, QVector<qreal> &px, QVector<qreal> &py);
static qreal CalcSqDistance ( qreal x1, qreal y1, qreal x2, qreal y2); static qreal CalcSqDistance ( qreal x1, qreal y1, qreal x2, qreal y2);
void CreateName();
QVector<qreal> CalcT(qreal curveCoord1, qreal curveCoord2, qreal curveCoord3, qreal curveCoord4, QVector<qreal> CalcT(qreal curveCoord1, qreal curveCoord2, qreal curveCoord3, qreal curveCoord4,
qreal pointCoord) const; qreal pointCoord) const;
static qint32 Cubic(QVector<qreal> &x, qreal a, qreal b, qreal c); static qint32 Cubic(QVector<qreal> &x, qreal a, qreal b, qreal c);

View File

@ -59,13 +59,7 @@ void VSplinePath::append(const VSplinePoint &point)
} }
d->path.append(point); d->path.append(point);
QString name = splPath; CreateName();
name.append(QString("_%1").arg(d->path.first().P().name()));
if (d->path.size() > 1)
{
name.append(QString("_%1").arg(d->path.last().P().name()));
}
setName(name);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -288,6 +282,27 @@ qreal VSplinePath::GetEndAngle() const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VSplinePath::CreateName()
{
QString name;
if (not d->path.isEmpty())
{
name = splPath;
name.append(QString("_%1").arg(d->path.first().P().name()));
if (d->path.size() > 1)
{
name.append(QString("_%1").arg(d->path.last().P().name()));
}
if (GetDuplicate() > 0)
{
name += QString("_%1").arg(GetDuplicate());
}
}
setName(name);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
qint32 VSplinePath::CountPoint() const qint32 VSplinePath::CountPoint() const
{ {

View File

@ -178,6 +178,8 @@ public:
virtual qreal GetStartAngle () const Q_DECL_OVERRIDE; virtual qreal GetStartAngle () const Q_DECL_OVERRIDE;
virtual qreal GetEndAngle () const Q_DECL_OVERRIDE; virtual qreal GetEndAngle () const Q_DECL_OVERRIDE;
protected:
virtual void CreateName() Q_DECL_OVERRIDE;
private: private:
QSharedDataPointer<VSplinePathData> d; QSharedDataPointer<VSplinePathData> d;
}; };

View File

@ -43,7 +43,7 @@
* @param parent parent widget * @param parent parent widget
*/ */
DialogSpline::DialogSpline(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogSpline::DialogSpline(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogSpline), spl() :DialogTool(data, toolId, parent), ui(new Ui::DialogSpline), spl(), newDuplicate(-1)
{ {
ui->setupUi(this); ui->setupUi(this);
InitOkCancelApply(ui); InitOkCancelApply(ui);
@ -129,8 +129,18 @@ void DialogSpline::SaveData()
const qreal kAsm2 = ui->doubleSpinBoxKasm2->value(); const qreal kAsm2 = ui->doubleSpinBoxKasm2->value();
const qreal kCurve = ui->doubleSpinBoxKcurve->value(); const qreal kCurve = ui->doubleSpinBoxKcurve->value();
const quint32 d = spl.GetDuplicate();//Save previous value
spl = VSpline(*GetP1(), *GetP4(), angle1, angle2, kAsm1, kAsm2, kCurve); spl = VSpline(*GetP1(), *GetP4(), angle1, angle2, kAsm1, kAsm2, kCurve);
if (newDuplicate <= -1)
{
spl.SetDuplicate(d);
}
else
{
spl.SetDuplicate(static_cast<quint32>(newDuplicate));
}
auto path = qobject_cast<VisToolSpline *>(vis); auto path = qobject_cast<VisToolSpline *>(vis);
SCASSERT(path != nullptr); SCASSERT(path != nullptr);
@ -157,6 +167,20 @@ const QSharedPointer<VPointF> DialogSpline::GetP4() const
return data->GeometricObject<VPointF>(getCurrentObjectId(ui->comboBoxP4)); return data->GeometricObject<VPointF>(getCurrentObjectId(ui->comboBoxP4));
} }
//---------------------------------------------------------------------------------------------------------------------
quint32 DialogSpline::DNumber(const QString &baseName) const
{
quint32 num = 1;
QString name;
do
{
name = baseName + QString("_%1").arg(num);
++num;
} while (not data->IsUnique(name));
return num;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogSpline::PointNameChanged() void DialogSpline::PointNameChanged()
{ {
@ -169,11 +193,33 @@ void DialogSpline::PointNameChanged()
{ {
flagError = false; flagError = false;
color = errorColor; color = errorColor;
ui->lineEditSplineName->setText(QString());
} }
else else
{ {
flagError = true; flagError = true;
color = okColor; color = okColor;
if (getCurrentObjectId(ui->comboBoxP1) == spl.GetP1().id() &&
getCurrentObjectId(ui->comboBoxP4) == spl.GetP4().id())
{
newDuplicate = -1;
ui->lineEditSplineName->setText(spl.name());
}
else
{
VSpline spline(*GetP1(), *GetP4(), spl.GetStartAngle(), spl.GetEndAngle(), spl.GetKasm1(), spl.GetKasm2(),
spl.GetKcurve());
if (not data->IsUnique(spline.name()))
{
newDuplicate = DNumber(spline.name());
spline.SetDuplicate(newDuplicate);
ui->lineEditSplineName->setText(spline.name());
}
}
} }
ChangeColor(ui->labelFirstPoint, color); ChangeColor(ui->labelFirstPoint, color);
ChangeColor(ui->labelSecondPoint, color); ChangeColor(ui->labelSecondPoint, color);
@ -188,7 +234,7 @@ void DialogSpline::ShowDialog(bool click)
auto *path = qobject_cast<VisToolSpline *>(vis); auto *path = qobject_cast<VisToolSpline *>(vis);
SCASSERT(path != nullptr); SCASSERT(path != nullptr);
VSpline spl(*GetP1(), path->GetP2(), path->GetP3(), *GetP4(), 1); spl = VSpline(*GetP1(), path->GetP2(), path->GetP3(), *GetP4(), ui->doubleSpinBoxKcurve->value());
ui->spinBoxAngle1->setValue(static_cast<qint32>(spl.GetStartAngle())); ui->spinBoxAngle1->setValue(static_cast<qint32>(spl.GetStartAngle()));
ui->spinBoxAngle2->setValue(static_cast<qint32>(spl.GetEndAngle())); ui->spinBoxAngle2->setValue(static_cast<qint32>(spl.GetEndAngle()));
@ -196,6 +242,13 @@ void DialogSpline::ShowDialog(bool click)
ui->doubleSpinBoxKasm1->setValue(spl.GetKasm1()); ui->doubleSpinBoxKasm1->setValue(spl.GetKasm1());
ui->doubleSpinBoxKasm2->setValue(spl.GetKasm2()); ui->doubleSpinBoxKasm2->setValue(spl.GetKasm2());
if (not data->IsUnique(spl.name()))
{
spl.SetDuplicate(DNumber(spl.name()));
}
ui->lineEditSplineName->setText(spl.name());
DialogAccepted(); DialogAccepted();
} }
} }
@ -225,6 +278,8 @@ void DialogSpline::SetSpline(const VSpline &spline)
ui->doubleSpinBoxKasm2->setValue(spl.GetKasm2()); ui->doubleSpinBoxKasm2->setValue(spl.GetKasm2());
ui->doubleSpinBoxKcurve->setValue(spl.GetKcurve()); ui->doubleSpinBoxKcurve->setValue(spl.GetKcurve());
ui->lineEditSplineName->setText(spl.name());
auto path = qobject_cast<VisToolSpline *>(vis); auto path = qobject_cast<VisToolSpline *>(vis);
SCASSERT(path != nullptr); SCASSERT(path != nullptr);

View File

@ -71,8 +71,12 @@ private:
/** @brief spl spline */ /** @brief spl spline */
VSpline spl; VSpline spl;
qint32 newDuplicate;
const QSharedPointer<VPointF> GetP1() const; const QSharedPointer<VPointF> GetP1() const;
const QSharedPointer<VPointF> GetP4() const; const QSharedPointer<VPointF> GetP4() const;
quint32 DNumber(const QString &baseName) const;
}; };
#endif // DIALOGSPLINE_H #endif // DIALOGSPLINE_H

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>540</width> <width>540</width>
<height>233</height> <height>273</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -207,6 +207,20 @@
<item row="1" column="1"> <item row="1" column="1">
<widget class="QComboBox" name="comboBoxColor"/> <widget class="QComboBox" name="comboBoxColor"/>
</item> </item>
<item row="2" column="0">
<widget class="QLabel" name="labelName">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditSplineName">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>

View File

@ -316,6 +316,18 @@ void VToolSpline::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
doc->SetAttribute(tag, AttrKAsm1, spl->GetKasm1()); doc->SetAttribute(tag, AttrKAsm1, spl->GetKasm1());
doc->SetAttribute(tag, AttrKAsm2, spl->GetKasm2()); doc->SetAttribute(tag, AttrKAsm2, spl->GetKasm2());
doc->SetAttribute(tag, AttrKCurve, spl->GetKcurve()); doc->SetAttribute(tag, AttrKCurve, spl->GetKcurve());
if (spl->GetDuplicate() > 0)
{
doc->SetAttribute(tag, AttrDuplicate, spl->GetDuplicate());
}
else
{
if (tag.hasAttribute(AttrDuplicate))
{
tag.removeAttribute(AttrDuplicate);
}
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------