Curve factor was removed.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-02-27 16:49:10 +02:00
parent a2561bc7da
commit 8d628404df
18 changed files with 55 additions and 129 deletions

View File

@ -1337,13 +1337,6 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSpline(VProperty *property)
i->setSpline(spl); i->setSpline(spl);
} }
break; break;
case 25: // AttrKCurve
if (value.toDouble() > 0)
{
spl.SetKcurve(value.toDouble());
i->setSpline(spl);
}
break;
case 27: // AttrTypeColor case 27: // AttrTypeColor
i->SetLineColor(value.toString()); i->SetLineColor(value.toString());
break; break;
@ -1773,13 +1766,6 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item)
length2.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); length2.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit()));
AddPropertyFormula(tr("C2: length"), length2, AttrLength2); AddPropertyFormula(tr("C2: length"), length2, AttrLength2);
auto itemFactor = new VDoubleProperty(tr("Curve factor"));
itemFactor->setSetting("Min", 0.1);
itemFactor->setSetting("Max", 1000);
itemFactor->setSetting("Step", 0.01);
itemFactor->setSetting("Precision", 3);
itemFactor->setValue(spl.GetKcurve());
AddProperty(itemFactor, AttrKCurve);
AddPropertyLineColor(i, tr("Color"), VAbstractTool::ColorsList(), AttrColor); AddPropertyLineColor(i, tr("Color"), VAbstractTool::ColorsList(), AttrColor);
} }
@ -2217,7 +2203,6 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
length2.setValue(length2F); length2.setValue(length2F);
idToProperty[AttrLength2]->setValue(length2); idToProperty[AttrLength2]->setValue(length2);
idToProperty[AttrKCurve]->setValue(spl.GetKcurve());
idToProperty[AttrColor]->setValue(VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor())); idToProperty[AttrColor]->setValue(VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor()));
} }
@ -2309,7 +2294,7 @@ QStringList VToolOptionsPropertyBrowser::PropertiesList() const
<< AttrPShoulder /* 22 */ << AttrPShoulder /* 22 */
<< AttrAxisP1 /* 23 */ << AttrAxisP1 /* 23 */
<< AttrAxisP2 /* 24 */ << AttrAxisP2 /* 24 */
<< AttrKCurve /* 25 */ << AttrKCurve /*Not used*/ /* 25 */
<< AttrLineColor /* 26 */ << AttrLineColor /* 26 */
<< AttrColor /* 27 */ << AttrColor /* 27 */
<< AttrCrossPoint /* 28 */ << AttrCrossPoint /* 28 */

View File

@ -1908,11 +1908,10 @@ void VPattern::ParseToolSpline(VMainGraphicsScene *scene, QDomElement &domElemen
const QString length2 = GetParametrString(domElement, AttrLength2, "0"); const QString length2 = GetParametrString(domElement, AttrLength2, "0");
QString l2 = length2;//need for saving fixed formula; QString l2 = length2;//need for saving fixed formula;
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 quint32 duplicate = GetParametrUInt(domElement, AttrDuplicate, "0");
VToolSpline::Create(id, point1, point4, a1, a2, l1, l2, kCurve, duplicate, color, scene, this, data, parse, VToolSpline::Create(id, point1, point4, a1, a2, l1, l2, duplicate, color, scene, this, data, parse,
Source::FromFile); Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula. //Rewrite attribute formula. Need for situation when we have wrong formula.
if (a1 != angle1 || a2 != angle2 || l1 != length1 || l2 != length2) if (a1 != angle1 || a2 != angle2 || l1 != length1 || l2 != length2)

View File

@ -105,7 +105,7 @@ extern const QString AttrPoint2;
extern const QString AttrPoint4; extern const QString AttrPoint4;
extern const QString AttrKAsm1;// TODO. Delete if minimal supported version is 0.2.7 extern const QString AttrKAsm1;// TODO. Delete if minimal supported version is 0.2.7
extern const QString AttrKAsm2;// TODO. Delete if minimal supported version is 0.2.7 extern const QString AttrKAsm2;// TODO. Delete if minimal supported version is 0.2.7
extern const QString AttrKCurve; extern const QString AttrKCurve;// TODO. Delete if minimal supported version is 0.2.7
extern const QString AttrDuplicate; extern const QString AttrDuplicate;
extern const QString AttrPathPoint; extern const QString AttrPathPoint;
extern const QString AttrPSpline; extern const QString AttrPSpline;

View File

@ -75,8 +75,8 @@ VSpline::VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm
* @param p3 second control point. * @param p3 second control point.
* @param p4 second point spline. * @param p4 second point spline.
*/ */
VSpline::VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, quint32 idObject, Draw mode) VSpline::VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, quint32 idObject, Draw mode)
:VAbstractCurve(GOType::Spline, idObject, mode), d(new VSplineData(p1, p2, p3, p4, kCurve)) :VAbstractCurve(GOType::Spline, idObject, mode), d(new VSplineData(p1, p2, p3, p4))
{ {
CreateName(); CreateName();
} }
@ -95,16 +95,15 @@ VSpline::VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve,
* @param c1LengthFormula formula length from first point to first control point. * @param c1LengthFormula formula length from first point to first control point.
* @param c2Length length from second point to first control point. * @param c2Length length from second point to first control point.
* @param c2LengthFormula formula length from second point to first control point. * @param c2LengthFormula formula length from second point to first control point.
* @param kCurve coefficient of curvature spline.
* @param idObject * @param idObject
* @param mode * @param mode
*/ */
VSpline::VSpline(VPointF p1, VPointF p4, qreal angle1, const QString &angle1Formula, qreal angle2, VSpline::VSpline(VPointF p1, VPointF p4, qreal angle1, const QString &angle1Formula, qreal angle2,
const QString &angle2Formula, qreal c1Length, const QString &c1LengthFormula, qreal c2Length, const QString &angle2Formula, qreal c1Length, const QString &c1LengthFormula, qreal c2Length,
const QString &c2LengthFormula, qreal kCurve, quint32 idObject, Draw mode) const QString &c2LengthFormula, quint32 idObject, Draw mode)
: VAbstractCurve(GOType::Spline, idObject, mode), : VAbstractCurve(GOType::Spline, idObject, mode),
d(new VSplineData(p1, p4, angle1, angle1Formula, angle2,angle2Formula, c1Length, c1LengthFormula, c2Length, d(new VSplineData(p1, p4, angle1, angle1Formula, angle2,angle2Formula, c1Length, c1LengthFormula, c2Length,
c2LengthFormula, kCurve)) c2LengthFormula))
{ {
CreateName(); CreateName();
} }
@ -238,8 +237,8 @@ QPointF VSpline::CutSpline(qreal length, VSpline &spl1, VSpline &spl2) const
QPointF spl2p3; QPointF spl2p3;
QPointF cutPoint = CutSpline (length, spl1p2, spl1p3, spl2p2, spl2p3 ); QPointF cutPoint = CutSpline (length, spl1p2, spl1p3, spl2p2, spl2p3 );
spl1 = VSpline(GetP1(), spl1p2, spl1p3, cutPoint, GetKcurve()); spl1 = VSpline(GetP1(), spl1p2, spl1p3, cutPoint);
spl2 = VSpline(cutPoint, spl2p2, spl2p3, GetP4(), GetKcurve()); spl2 = VSpline(cutPoint, spl2p2, spl2p3, GetP4());
return cutPoint; return cutPoint;
} }
@ -851,15 +850,6 @@ qreal VSpline::GetKcurve() const
return d->kCurve; return d->kCurve;
} }
//---------------------------------------------------------------------------------------------------------------------
void VSpline::SetKcurve(qreal factor)
{
if (factor > 0)
{
d->kCurve = factor;
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VSpline::Sign(long double ld) int VSpline::Sign(long double ld)
{ {

View File

@ -49,11 +49,11 @@ public:
VSpline (const VSpline &spline ); VSpline (const VSpline &spline );
VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve, VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve,
quint32 idObject = 0, Draw mode = Draw::Calculation); quint32 idObject = 0, Draw mode = Draw::Calculation);
VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, quint32 idObject = 0, VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, quint32 idObject = 0,
Draw mode = Draw::Calculation); Draw mode = Draw::Calculation);
VSpline (VPointF p1, VPointF p4, qreal angle1, const QString &angle1Formula, qreal angle2, VSpline (VPointF p1, VPointF p4, qreal angle1, const QString &angle1Formula, qreal angle2,
const QString &angle2Formula, qreal c1Length, const QString &c1LengthFormula, qreal c2Length, const QString &angle2Formula, qreal c1Length, const QString &c1LengthFormula, qreal c2Length,
const QString &c2LengthFormula, qreal kCurve, quint32 idObject = 0, Draw mode = Draw::Calculation); const QString &c2LengthFormula, quint32 idObject = 0, Draw mode = Draw::Calculation);
virtual ~VSpline() Q_DECL_OVERRIDE; virtual ~VSpline() Q_DECL_OVERRIDE;
VSpline &operator=(const VSpline &spl); VSpline &operator=(const VSpline &spl);
@ -88,7 +88,6 @@ public:
qreal GetKasm1() const; qreal GetKasm1() const;
qreal GetKasm2() const; qreal GetKasm2() const;
qreal GetKcurve() const; qreal GetKcurve() const;
void SetKcurve(qreal factor);
qreal LengthT(qreal t) const; qreal LengthT(qreal t) const;
QPointF CutSpline ( qreal length, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3) const; QPointF CutSpline ( qreal length, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3) const;
QPointF CutSpline ( qreal length, VSpline &spl1, VSpline &spl2) const; QPointF CutSpline ( qreal length, VSpline &spl1, VSpline &spl2) const;

View File

@ -47,9 +47,9 @@ public:
VSplineData(); VSplineData();
VSplineData(const VSplineData &spline); VSplineData(const VSplineData &spline);
VSplineData(VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve); VSplineData(VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve);
VSplineData(VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve); VSplineData(VPointF p1, QPointF p2, QPointF p3, VPointF p4);
VSplineData(VPointF p1, VPointF p4, qreal angle1, const QString &angle1F, qreal angle2, const QString &angle2F, VSplineData(VPointF p1, VPointF p4, qreal angle1, const QString &angle1F, qreal angle2, const QString &angle2F,
qreal c1Length, const QString &c1LengthF, qreal c2Length, const QString &c2LengthF, qreal kCurve); qreal c1Length, const QString &c1LengthF, qreal c2Length, const QString &c2LengthF);
virtual ~VSplineData(); virtual ~VSplineData();
static qreal GetL(const QPointF &p1, const QPointF &p4, qreal kCurve); static qreal GetL(const QPointF &p1, const QPointF &p4, qreal kCurve);
@ -150,7 +150,7 @@ VSplineData::VSplineData(VPointF p1, VPointF p4, qreal angle1, qreal angle2, qre
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSplineData::VSplineData(VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve) VSplineData::VSplineData(VPointF p1, QPointF p2, QPointF p3, VPointF p4)
: p1(p1), : p1(p1),
p4(p4), p4(p4),
angle1(0), angle1(0),
@ -161,7 +161,7 @@ VSplineData::VSplineData(VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal k
c1LengthF("0"), c1LengthF("0"),
c2Length(0), c2Length(0),
c2LengthF("0"), c2LengthF("0"),
kCurve(kCurve) kCurve(1)
{ {
QLineF p1p2(p1.toQPointF(), p2); QLineF p1p2(p1.toQPointF(), p2);
@ -183,7 +183,7 @@ VSplineData::VSplineData(VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal k
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSplineData::VSplineData(VPointF p1, VPointF p4, qreal angle1, const QString &angle1F, qreal angle2, VSplineData::VSplineData(VPointF p1, VPointF p4, qreal angle1, const QString &angle1F, qreal angle2,
const QString &angle2F, qreal c1Length, const QString &c1LengthF, const QString &angle2F, qreal c1Length, const QString &c1LengthF,
qreal c2Length, const QString &c2LengthF, qreal kCurve) qreal c2Length, const QString &c2LengthF)
: p1(p1), : p1(p1),
p4(p4), p4(p4),
angle1(angle1), angle1(angle1),
@ -194,7 +194,7 @@ VSplineData::VSplineData(VPointF p1, VPointF p4, qreal angle1, const QString &an
c1LengthF(c1LengthF), c1LengthF(c1LengthF),
c2Length(c2Length), c2Length(c2Length),
c2LengthF(c2LengthF), c2LengthF(c2LengthF),
kCurve(kCurve) kCurve(1)
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -443,8 +443,7 @@ VSpline DialogSpline::CurrentSpline() const
length1F = qApp->TrVars()->FormulaFromUser(length1F, separator); length1F = qApp->TrVars()->FormulaFromUser(length1F, separator);
length2F = qApp->TrVars()->FormulaFromUser(length2F, separator); length2F = qApp->TrVars()->FormulaFromUser(length2F, separator);
VSpline spline(*GetP1(), *GetP4(), angle1, angle1F, angle2, angle2F, length1, length1F, length2, length2F, VSpline spline(*GetP1(), *GetP4(), angle1, angle1F, angle2, angle2F, length1, length1F, length2, length2F);
ui->doubleSpinBoxKcurve->value());
return spline; return spline;
} }
@ -502,7 +501,7 @@ void DialogSpline::ShowDialog(bool click)
auto *path = qobject_cast<VisToolSpline *>(vis); auto *path = qobject_cast<VisToolSpline *>(vis);
SCASSERT(path != nullptr); SCASSERT(path != nullptr);
spl = VSpline(*GetP1(), path->GetP2(), path->GetP3(), *GetP4(), ui->doubleSpinBoxKcurve->value()); spl = VSpline(*GetP1(), path->GetP2(), path->GetP3(), *GetP4());
const QString angle1F = qApp->TrVars()->FormulaToUser(spl.GetStartAngleFormula()); const QString angle1F = qApp->TrVars()->FormulaToUser(spl.GetStartAngleFormula());
const QString angle2F = qApp->TrVars()->FormulaToUser(spl.GetEndAngleFormula()); const QString angle2F = qApp->TrVars()->FormulaToUser(spl.GetEndAngleFormula());
@ -566,8 +565,6 @@ void DialogSpline::SetSpline(const VSpline &spline)
ui->plainTextEditLength1F->setPlainText(length1F); ui->plainTextEditLength1F->setPlainText(length1F);
ui->plainTextEditLength2F->setPlainText(length2F); ui->plainTextEditLength2F->setPlainText(length2F);
ui->doubleSpinBoxKcurve->setValue(spl.GetKcurve());
ui->lineEditSplineName->setText(spl.name()); ui->lineEditSplineName->setText(spl.name());
auto path = qobject_cast<VisToolSpline *>(vis); auto path = qobject_cast<VisToolSpline *>(vis);

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>524</width> <width>524</width>
<height>375</height> <height>342</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -837,54 +837,13 @@
<enum>QFormLayout::ExpandingFieldsGrow</enum> <enum>QFormLayout::ExpandingFieldsGrow</enum>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Coefficient of curvature of the curve:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxKcurve">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>72</width>
<height>0</height>
</size>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Color:</string> <string>Color:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="0" column="1">
<widget class="QComboBox" name="comboBoxColor"> <widget class="QComboBox" name="comboBoxColor">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@ -894,14 +853,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="1" column="0">
<widget class="QLabel" name="labelName"> <widget class="QLabel" name="labelName">
<property name="text"> <property name="text">
<string>Name:</string> <string>Name:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="1" column="1">
<widget class="QLineEdit" name="lineEditSplineName"> <widget class="QLineEdit" name="lineEditSplineName">
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
@ -925,7 +884,6 @@
<tabstops> <tabstops>
<tabstop>comboBoxP1</tabstop> <tabstop>comboBoxP1</tabstop>
<tabstop>comboBoxP4</tabstop> <tabstop>comboBoxP4</tabstop>
<tabstop>doubleSpinBoxKcurve</tabstop>
<tabstop>comboBoxColor</tabstop> <tabstop>comboBoxColor</tabstop>
<tabstop>buttonBox</tabstop> <tabstop>buttonBox</tabstop>
</tabstops> </tabstops>

View File

@ -196,7 +196,7 @@ VToolSpline* VToolSpline::Create(const quint32 _id, VSpline *spline, const QStri
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VToolSpline *VToolSpline::Create(const quint32 _id, quint32 point1, quint32 point4, QString &a1, QString &a2, VToolSpline *VToolSpline::Create(const quint32 _id, quint32 point1, quint32 point4, QString &a1, QString &a2,
QString &l1, QString &l2, qreal kCurve, quint32 duplicate, const QString &color, QString &l1, QString &l2, quint32 duplicate, const QString &color,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation) const Document &parse, const Source &typeCreation)
{ {
@ -209,7 +209,7 @@ VToolSpline *VToolSpline::Create(const quint32 _id, quint32 point1, quint32 poin
auto p1 = data->GeometricObject<VPointF>(point1); auto p1 = data->GeometricObject<VPointF>(point1);
auto p4 = data->GeometricObject<VPointF>(point4); auto p4 = data->GeometricObject<VPointF>(point4);
auto spline = new VSpline(*p1, *p4, calcAngle1, a1, calcAngle2, a2, calcLength1, l1, calcLength2, l2, kCurve); auto spline = new VSpline(*p1, *p4, calcAngle1, a1, calcAngle2, a2, calcLength1, l1, calcLength2, l2);
if (duplicate > 0) if (duplicate > 0)
{ {
spline->SetDuplicate(duplicate); spline->SetDuplicate(duplicate);
@ -277,7 +277,7 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const Sp
spl = VSpline(spline->GetP1(), spline->GetP4(), newAngle1, newAngle1F, spline->GetEndAngle(), spl = VSpline(spline->GetP1(), spline->GetP4(), newAngle1, newAngle1F, spline->GetEndAngle(),
spline->GetEndAngleFormula(), newLength1, newLength1F, spline->GetC2Length(), spline->GetEndAngleFormula(), newLength1, newLength1F, spline->GetC2Length(),
spline->GetC2LengthFormula(), spline->GetKcurve()); spline->GetC2LengthFormula());
} }
else else
{ {
@ -302,7 +302,7 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const Sp
} }
spl = VSpline(spline->GetP1(), spline->GetP4(), spline->GetStartAngle(), spline->GetStartAngleFormula(), spl = VSpline(spline->GetP1(), spline->GetP4(), spline->GetStartAngle(), spline->GetStartAngleFormula(),
newAngle2, newAngle2F, spline->GetC1Length(), spline->GetC1LengthFormula(), newAngle2, newAngle2F, spline->GetC1Length(), spline->GetC1LengthFormula(),
newLength2, newLength2F, spline->GetKcurve()); newLength2, newLength2F);
} }
MoveSpline *moveSpl = new MoveSpline(doc, spline.data(), spl, id, this->scene()); MoveSpline *moveSpl = new MoveSpline(doc, spline.data(), spl, id, this->scene());
@ -477,7 +477,7 @@ void VToolSpline::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
oldPosition = event->scenePos(); // Now mouse here oldPosition = event->scenePos(); // Now mouse here
VSpline spl = VSpline(spline->GetP1(), p2, p3, spline->GetP4(), spline->GetKcurve()); VSpline spl = VSpline(spline->GetP1(), p2, p3, spline->GetP4());
MoveSpline *moveSpl = new MoveSpline(doc, spline.data(), spl, id, this->scene()); MoveSpline *moveSpl = new MoveSpline(doc, spline.data(), spl, id, this->scene());
connect(moveSpl, &MoveSpline::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); connect(moveSpl, &MoveSpline::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
@ -635,7 +635,6 @@ void VToolSpline::SetSplineAttributes(QDomElement &domElement, const VSpline &sp
doc->SetAttribute(domElement, AttrAngle2, spl.GetEndAngleFormula()); doc->SetAttribute(domElement, AttrAngle2, spl.GetEndAngleFormula());
doc->SetAttribute(domElement, AttrLength1, spl.GetC1LengthFormula()); doc->SetAttribute(domElement, AttrLength1, spl.GetC1LengthFormula());
doc->SetAttribute(domElement, AttrLength2, spl.GetC2LengthFormula()); doc->SetAttribute(domElement, AttrLength2, spl.GetC2LengthFormula());
doc->SetAttribute(domElement, AttrKCurve, spl.GetKcurve());
if (spl.GetDuplicate() > 0) if (spl.GetDuplicate() > 0)
{ {
@ -649,6 +648,11 @@ void VToolSpline::SetSplineAttributes(QDomElement &domElement, const VSpline &sp
} }
} }
if (domElement.hasAttribute(AttrKCurve))
{
domElement.removeAttribute(AttrKCurve);
}
if (domElement.hasAttribute(AttrKAsm1)) if (domElement.hasAttribute(AttrKAsm1))
{ {
domElement.removeAttribute(AttrKAsm1); domElement.removeAttribute(AttrKAsm1);

View File

@ -49,7 +49,7 @@ public:
VAbstractPattern *doc, VContainer *data, const Document &parse, VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation); const Source &typeCreation);
static VToolSpline *Create(const quint32 _id, quint32 point1, quint32 point4, QString &a1, QString &a2, QString &l1, static VToolSpline *Create(const quint32 _id, quint32 point1, quint32 point4, QString &a1, QString &a2, QString &l1,
QString &l2, qreal kCurve, quint32 duplicate, const QString &color, QString &l2, quint32 duplicate, const QString &color,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation); const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;

View File

@ -199,11 +199,11 @@ void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, cons
VSpline spl = newSplPath.GetSpline(indexSpline); VSpline spl = newSplPath.GetSpline(indexSpline);
if (position == SplinePointPosition::FirstPoint) if (position == SplinePointPosition::FirstPoint)
{ {
spl = VSpline(spl.GetP1(), pos, spl.GetP3(), spl.GetP4(), spl.GetKcurve()); spl = VSpline(spl.GetP1(), pos, spl.GetP3(), spl.GetP4());
} }
else else
{ {
spl = VSpline(spl.GetP1(), spl.GetP2(), pos, spl.GetP4(), spl.GetKcurve()); spl = VSpline(spl.GetP1(), spl.GetP2(), pos, spl.GetP4());
} }
UpdateControlPoints(spl, newSplPath, indexSpline); UpdateControlPoints(spl, newSplPath, indexSpline);
@ -256,8 +256,7 @@ void VToolSplinePath::RefreshSplinePath(VSplinePath &splPath)
controlPoints[j-2]->blockSignals(false); controlPoints[j-2]->blockSignals(false);
controlPoints[j-1]->blockSignals(false); controlPoints[j-1]->blockSignals(false);
spl = VSpline (spl.GetP1(), controlPoints[j-2]->pos(), controlPoints[j-1]->pos(), spl.GetP4(), spl = VSpline (spl.GetP1(), controlPoints[j-2]->pos(), controlPoints[j-1]->pos(), spl.GetP4());
splPath.GetKCurve());
UpdateControlPoints(spl, splPath, i); UpdateControlPoints(spl, splPath, i);
} }
} }
@ -506,7 +505,7 @@ void VToolSplinePath::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
oldPosition = event->scenePos(); // Now mouse here oldPosition = event->scenePos(); // Now mouse here
const VSpline spl = VSpline(spline.GetP1(), p2, p3, spline.GetP4(), spline.GetKcurve()); const VSpline spl = VSpline(spline.GetP1(), p2, p3, spline.GetP4());
UpdateControlPoints(spl, newSplPath, indexSpline); UpdateControlPoints(spl, newSplPath, indexSpline);

View File

@ -135,11 +135,11 @@ VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointNa
VPointF *p = new VPointF(point, pointName, mx, my); VPointF *p = new VPointF(point, pointName, mx, my);
id = data->AddGObject(p); id = data->AddGObject(p);
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve()); VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p);
spl1id = data->AddGObject(spline1); spl1id = data->AddGObject(spline1);
data->AddCurve<VSpline>(spl1id, id); data->AddCurve<VSpline>(spl1id, id);
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve()); VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4());
spl2id = data->AddGObject(spline2); spl2id = data->AddGObject(spline2);
data->AddCurve<VSpline>(spl2id, id); data->AddCurve<VSpline>(spl2id, id);
} }
@ -151,11 +151,11 @@ VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointNa
spl1id = id + 1; spl1id = id + 1;
spl2id = id + 2; spl2id = id + 2;
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve()); VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p);
data->UpdateGObject(spl1id, spline1); data->UpdateGObject(spl1id, spline1);
data->AddCurve<VSpline>(spl1id, id); data->AddCurve<VSpline>(spl1id, id);
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve()); VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4());
data->UpdateGObject(spl2id, spline2); data->UpdateGObject(spl2id, spline2);
data->AddCurve<VSpline>(spl2id, id); data->AddCurve<VSpline>(spl2id, id);

View File

@ -148,8 +148,8 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString
VSplinePoint splP1 = splPath->at(p1); VSplinePoint splP1 = splPath->at(p1);
VSplinePoint splP2 = splPath->at(p2); VSplinePoint splP2 = splPath->at(p2);
const VSpline spl1 = VSpline(splP1.P(), spl1p2, spl1p3, *p, splPath->GetKCurve()); const VSpline spl1 = VSpline(splP1.P(), spl1p2, spl1p3, *p);
const VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P(), splPath->GetKCurve()); const VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P());
VSplinePath *splPath1 = new VSplinePath(); VSplinePath *splPath1 = new VSplinePath();
VSplinePath *splPath2 = new VSplinePath(); VSplinePath *splPath2 = new VSplinePath();

View File

@ -191,8 +191,7 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
VPointF *p4 = new VPointF(spline->GetP4()); VPointF *p4 = new VPointF(spline->GetP4());
BiasRotatePoint(p4, dx, dy, p, angle); BiasRotatePoint(p4, dx, dy, p, angle);
VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0, VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, 0, Draw::Modeling);
Draw::Modeling);
idObject = data->AddGObject(spl); idObject = data->AddGObject(spl);
children.append(idObject); children.append(idObject);
@ -238,7 +237,7 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
VPointF *p4 = new VPointF(spline.GetP4()); VPointF *p4 = new VPointF(spline.GetP4());
BiasRotatePoint(p4, dx, dy, p, angle); BiasRotatePoint(p4, dx, dy, p, angle);
VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve()); VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4);
if (i==1) if (i==1)
{ {
path->append(VSplinePoint(*p1, point1.KAsm1(), spl.GetStartAngle()+180, path->append(VSplinePoint(*p1, point1.KAsm1(), spl.GetStartAngle()+180,
@ -342,8 +341,7 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
VPointF *p4 = new VPointF(spline->GetP4()); VPointF *p4 = new VPointF(spline->GetP4());
BiasRotatePoint(p4, dx, dy, p, angle); BiasRotatePoint(p4, dx, dy, p, angle);
VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0, VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, 0, Draw::Modeling);
Draw::Modeling);
data->UpdateGObject(TakeNextId(children), spl); data->UpdateGObject(TakeNextId(children), spl);
delete p1; delete p1;
delete p4; delete p4;
@ -379,7 +377,7 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
VPointF *p4 = new VPointF(spline.GetP4()); VPointF *p4 = new VPointF(spline.GetP4());
BiasRotatePoint(p4, dx, dy, p, angle); BiasRotatePoint(p4, dx, dy, p, angle);
VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve()); VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4);
if (i==1) if (i==1)
{ {
path->append(VSplinePoint(*p1, point1.KAsm1(), spl.GetStartAngle()+180, path->append(VSplinePoint(*p1, point1.KAsm1(), spl.GetStartAngle()+180,

View File

@ -98,7 +98,6 @@ void MoveSpline::Do(const VSpline &spl)
doc->SetAttribute(domElement, AttrAngle2, spl.GetEndAngleFormula()); doc->SetAttribute(domElement, AttrAngle2, spl.GetEndAngleFormula());
doc->SetAttribute(domElement, AttrLength1, spl.GetC1LengthFormula()); doc->SetAttribute(domElement, AttrLength1, spl.GetC1LengthFormula());
doc->SetAttribute(domElement, AttrLength2, spl.GetC2LengthFormula()); doc->SetAttribute(domElement, AttrLength2, spl.GetC2LengthFormula());
doc->SetAttribute(domElement, AttrKCurve, spl.GetKcurve());
emit NeedLiteParsing(Document::LiteParse); emit NeedLiteParsing(Document::LiteParse);
} }

View File

@ -67,8 +67,8 @@ void VisToolCutSplinePath::RefreshGeometry()
VSplinePoint splP1 = splPath->at(p1); VSplinePoint splP1 = splPath->at(p1);
VSplinePoint splP2 = splPath->at(p2); VSplinePoint splP2 = splPath->at(p2);
const VSpline spl1 = VSpline(splP1.P(), spl1p2, spl1p3, p, splPath->GetKCurve()); const VSpline spl1 = VSpline(splP1.P(), spl1p2, spl1p3, p);
const VSpline spl2 = VSpline(p, spl2p2, spl2p3, splP2.P(), splPath->GetKCurve()); const VSpline spl2 = VSpline(p, spl2p2, spl2p3, splP2.P());
VSplinePath spPath1 = VSplinePath(); VSplinePath spPath1 = VSplinePath();
VSplinePath spPath2 = VSplinePath(); VSplinePath spPath2 = VSplinePath();

View File

@ -106,7 +106,7 @@ void VisToolSpline::RefreshGeometry()
if (object4Id <= NULL_ID) if (object4Id <= NULL_ID)
{ {
VSpline spline(*first, p2, Visualization::scenePos, VPointF(Visualization::scenePos), kCurve); VSpline spline(*first, p2, Visualization::scenePos, VPointF(Visualization::scenePos));
DrawPath(this, spline.GetPath(PathDirection::Hide), mainColor, Qt::SolidLine, Qt::RoundCap); DrawPath(this, spline.GetPath(PathDirection::Hide), mainColor, Qt::SolidLine, Qt::RoundCap);
} }
else else
@ -143,7 +143,7 @@ void VisToolSpline::RefreshGeometry()
if (qFuzzyCompare(angle1, EMPTY_ANGLE) || qFuzzyCompare(angle2, EMPTY_ANGLE)) if (qFuzzyCompare(angle1, EMPTY_ANGLE) || qFuzzyCompare(angle2, EMPTY_ANGLE))
{ {
VSpline spline(*first, p2, p3, *second, kCurve); VSpline spline(*first, p2, p3, *second);
DrawPath(this, spline.GetPath(PathDirection::Hide), mainColor, Qt::SolidLine, Qt::RoundCap); DrawPath(this, spline.GetPath(PathDirection::Hide), mainColor, Qt::SolidLine, Qt::RoundCap);
} }
else else

View File

@ -230,8 +230,7 @@ void VisToolSplinePath::Creating(const QPointF &pSpl, int size)
ctrlPoints[lastPoint]->RefreshCtrlPoint(size, SplinePointPosition::FirstPoint, ctrlPoint, pSpl); ctrlPoints[lastPoint]->RefreshCtrlPoint(size, SplinePointPosition::FirstPoint, ctrlPoint, pSpl);
} }
VSpline spline(VPointF(pSpl), ctrlPoint, Visualization::scenePos, VSpline spline(VPointF(pSpl), ctrlPoint, Visualization::scenePos, VPointF(Visualization::scenePos));
VPointF(Visualization::scenePos), path.GetKCurve());
if (size == 1) if (size == 1)
{ {
@ -249,7 +248,7 @@ void VisToolSplinePath::Creating(const QPointF &pSpl, int size)
else else
{ {
const VSpline spl = path.GetSpline(size - 1); const VSpline spl = path.GetSpline(size - 1);
VSpline preSpl(spl.GetP1(), spl.GetP2(), ctrlLine.p2(), VPointF(pSpl), path.GetKCurve()); VSpline preSpl(spl.GetP1(), spl.GetP2(), ctrlLine.p2(), VPointF(pSpl));
path[size-1].SetAngle2(spline.GetStartAngle()); path[size-1].SetAngle2(spline.GetStartAngle());
if (ctrlPoint != pSpl) if (ctrlPoint != pSpl)
@ -269,8 +268,7 @@ void VisToolSplinePath::Creating(const QPointF &pSpl, int size)
{ {
pointSelected = true; pointSelected = true;
VSpline spline(VPointF(pSpl), ctrlPoint, Visualization::scenePos, VSpline spline(VPointF(pSpl), ctrlPoint, Visualization::scenePos, VPointF(Visualization::scenePos));
VPointF(Visualization::scenePos), path.GetKCurve());
path[size-1].SetAngle2(spline.GetStartAngle()); path[size-1].SetAngle2(spline.GetStartAngle());