diff --git a/src/app/container/container.pri b/src/app/container/container.pri index c4850fc17..095565326 100644 --- a/src/app/container/container.pri +++ b/src/app/container/container.pri @@ -15,7 +15,10 @@ SOURCES += \ $$PWD/variables/vsplinelength.cpp \ $$PWD/vformula.cpp \ $$PWD/variables/varcradius.cpp \ - $$PWD/variables/vcurvevariable.cpp + $$PWD/variables/vcurvevariable.cpp \ + container/variables/vcurveangle.cpp \ + container/variables/varcangle.cpp \ + container/variables/vsplineangle.cpp HEADERS += \ $$PWD/vcontainer.h \ @@ -39,4 +42,7 @@ HEADERS += \ $$PWD/vformula.h \ $$PWD/variables/varcradius.h \ $$PWD/variables/vcurvevariable.h \ - $$PWD/variables/vcurvevariable_p.h + $$PWD/variables/vcurvevariable_p.h \ + container/variables/vcurveangle.h \ + container/variables/varcangle.h \ + container/variables/vsplineangle.h diff --git a/src/app/container/variables.h b/src/app/container/variables.h index 49fba0320..f187403e0 100644 --- a/src/app/container/variables.h +++ b/src/app/container/variables.h @@ -37,5 +37,7 @@ #include "variables/vlinelength.h" #include "variables/vlineangle.h" #include "variables/varcradius.h" +#include "variables/varcangle.h" +#include "variables/vsplineangle.h" #endif // VARIABLES_H diff --git a/src/app/container/variables/varcangle.cpp b/src/app/container/variables/varcangle.cpp new file mode 100644 index 000000000..0e3d5603e --- /dev/null +++ b/src/app/container/variables/varcangle.cpp @@ -0,0 +1,73 @@ +/************************************************************************ + ** + ** @file varcangle.cpp + ** @author Roman Telezhynskyi + ** @date 1 6, 2015 + ** + ** @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) 2015 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 "varcangle.h" +#include "../libs/vgeometry/vabstractcurve.h" + +//--------------------------------------------------------------------------------------------------------------------- +VArcAngle::VArcAngle() + :VCurveAngle() +{ + SetType(VarType::ArcAngle); +} + +//--------------------------------------------------------------------------------------------------------------------- +VArcAngle::VArcAngle(const quint32 &id, const quint32 &parentId, const VAbstractCurve *curve, CurveAngle angle) + :VCurveAngle(id, parentId, curve, angle) +{ + SetType(VarType::ArcAngle); + SCASSERT(curve != nullptr); + if (angle == CurveAngle::StartAngle) + { + SetName(QString(angle1_V+"%1").arg(curve->name())); + } + else + { + SetName(QString(angle2_V+"%1").arg(curve->name())); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +VArcAngle::VArcAngle(const VArcAngle &var) + :VCurveAngle(var) +{} + +//--------------------------------------------------------------------------------------------------------------------- +VArcAngle &VArcAngle::operator=(const VArcAngle &var) +{ + if ( &var == this ) + { + return *this; + } + VCurveAngle::operator=(var); + return *this; +} + +//--------------------------------------------------------------------------------------------------------------------- +VArcAngle::~VArcAngle() +{} diff --git a/src/app/container/variables/varcangle.h b/src/app/container/variables/varcangle.h new file mode 100644 index 000000000..835837be3 --- /dev/null +++ b/src/app/container/variables/varcangle.h @@ -0,0 +1,46 @@ +/************************************************************************ + ** + ** @file varcangle.h + ** @author Roman Telezhynskyi + ** @date 1 6, 2015 + ** + ** @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) 2015 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 VARCANGLE_H +#define VARCANGLE_H + +#include "vcurveangle.h" + +class VAbstractCurve; + +class VArcAngle :public VCurveAngle +{ +public: + VArcAngle(); + VArcAngle(const quint32 &id, const quint32 &parentId, const VAbstractCurve *curve, CurveAngle angle); + VArcAngle(const VArcAngle &var); + VArcAngle &operator=(const VArcAngle &var); + virtual ~VArcAngle(); +}; + +#endif // VARCANGLE_H diff --git a/src/app/container/variables/varcradius.cpp b/src/app/container/variables/varcradius.cpp index 3f808669d..83b99e7b6 100644 --- a/src/app/container/variables/varcradius.cpp +++ b/src/app/container/variables/varcradius.cpp @@ -44,7 +44,7 @@ VArcRadius::VArcRadius(const quint32 &id, const quint32 &parentId, const VArc *a SCASSERT(arc != nullptr); SetType(VarType::ArcRadius); - SetName(QString(radiusArc_+"%1").arg(arc->name())); + SetName(QString(radius_V+"%1").arg(arc->name())); SetValue(qApp->fromPixel(arc->GetRadius())); } diff --git a/src/app/container/variables/vcurveangle.cpp b/src/app/container/variables/vcurveangle.cpp new file mode 100644 index 000000000..aa34b9efb --- /dev/null +++ b/src/app/container/variables/vcurveangle.cpp @@ -0,0 +1,73 @@ +/************************************************************************ + ** + ** @file vcurveangle.cpp + ** @author Roman Telezhynskyi + ** @date 1 6, 2015 + ** + ** @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) 2015 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 "vcurveangle.h" +#include "../libs/vgeometry/vabstractcurve.h" + +//--------------------------------------------------------------------------------------------------------------------- +VCurveAngle::VCurveAngle() + :VCurveVariable() +{ + SetType(VarType::Unknown); +} + +//--------------------------------------------------------------------------------------------------------------------- +VCurveAngle::VCurveAngle(const quint32 &id, const quint32 &parentId, const VAbstractCurve *curve, CurveAngle angle) + :VCurveVariable(id, parentId) +{ + SetType(VarType::Unknown); + SCASSERT(curve != nullptr); + if (angle == CurveAngle::StartAngle) + { + SetValue(curve->GetStartAngle()); + } + else + { + SetValue(curve->GetEndAngle()); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +VCurveAngle::VCurveAngle(const VCurveAngle &var) + :VCurveVariable(var) +{} + +//--------------------------------------------------------------------------------------------------------------------- +VCurveAngle &VCurveAngle::operator=(const VCurveAngle &var) +{ + if ( &var == this ) + { + return *this; + } + VCurveVariable::operator=(var); + return *this; +} + +//--------------------------------------------------------------------------------------------------------------------- +VCurveAngle::~VCurveAngle() +{} diff --git a/src/app/container/variables/vcurveangle.h b/src/app/container/variables/vcurveangle.h new file mode 100644 index 000000000..bef32cbe5 --- /dev/null +++ b/src/app/container/variables/vcurveangle.h @@ -0,0 +1,48 @@ +/************************************************************************ + ** + ** @file vcurveangle.h + ** @author Roman Telezhynskyi + ** @date 1 6, 2015 + ** + ** @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) 2015 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 VCURVEANGLE_H +#define VCURVEANGLE_H + +#include "vcurvevariable.h" + +class VAbstractCurve; + +enum class CurveAngle : char { StartAngle, EndAngle }; + +class VCurveAngle : public VCurveVariable +{ +public: + VCurveAngle(); + VCurveAngle(const quint32 &id, const quint32 &parentId, const VAbstractCurve *curve, CurveAngle angle); + VCurveAngle(const VCurveAngle &var); + VCurveAngle &operator=(const VCurveAngle &var); + virtual ~VCurveAngle(); +}; + +#endif // VCURVEANGLE_H diff --git a/src/app/container/variables/vsplineangle.cpp b/src/app/container/variables/vsplineangle.cpp new file mode 100644 index 000000000..e237d53f4 --- /dev/null +++ b/src/app/container/variables/vsplineangle.cpp @@ -0,0 +1,73 @@ +/************************************************************************ + ** + ** @file vsplineangle.cpp + ** @author Roman Telezhynskyi + ** @date 1 6, 2015 + ** + ** @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) 2015 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 "vsplineangle.h" +#include "../libs/vgeometry/vabstractcurve.h" + +//--------------------------------------------------------------------------------------------------------------------- +VSplineAngle::VSplineAngle() + :VCurveAngle() +{ + SetType(VarType::SplineAngle); +} + +//--------------------------------------------------------------------------------------------------------------------- +VSplineAngle::VSplineAngle(const quint32 &id, const quint32 &parentId, const VAbstractCurve *curve, CurveAngle angle) + :VCurveAngle(id, parentId, curve, angle) +{ + SetType(VarType::SplineAngle); + SCASSERT(curve != nullptr); + if (angle == CurveAngle::StartAngle) + { + SetName(QString(angle1_V+"%1").arg(curve->name())); + } + else + { + SetName(QString(angle2_V+"%1").arg(curve->name())); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +VSplineAngle::VSplineAngle(const VSplineAngle &var) + :VCurveAngle(var) +{} + +//--------------------------------------------------------------------------------------------------------------------- +VSplineAngle &VSplineAngle::operator=(const VSplineAngle &var) +{ + if ( &var == this ) + { + return *this; + } + VCurveAngle::operator=(var); + return *this; +} + +//--------------------------------------------------------------------------------------------------------------------- +VSplineAngle::~VSplineAngle() +{} diff --git a/src/app/container/variables/vsplineangle.h b/src/app/container/variables/vsplineangle.h new file mode 100644 index 000000000..e76a941f1 --- /dev/null +++ b/src/app/container/variables/vsplineangle.h @@ -0,0 +1,46 @@ +/************************************************************************ + ** + ** @file vsplineangle.h + ** @author Roman Telezhynskyi + ** @date 1 6, 2015 + ** + ** @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) 2015 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 VSPLINEANGLE_H +#define VSPLINEANGLE_H + +#include "vcurveangle.h" + +class VAbstractCurve; + +class VSplineAngle :public VCurveAngle +{ +public: + VSplineAngle(); + VSplineAngle(const quint32 &id, const quint32 &parentId, const VAbstractCurve *curve, CurveAngle angle); + VSplineAngle(const VSplineAngle &var); + VSplineAngle &operator=(const VSplineAngle &var); + virtual ~VSplineAngle(); +}; + +#endif // VSPLINEANGLE_H diff --git a/src/app/container/vcontainer.cpp b/src/app/container/vcontainer.cpp index 589eb5673..020da9bb9 100644 --- a/src/app/container/vcontainer.cpp +++ b/src/app/container/vcontainer.cpp @@ -316,13 +316,21 @@ void VContainer::AddLine(const quint32 &firstPointId, const quint32 &secondPoint } //--------------------------------------------------------------------------------------------------------------------- -void VContainer::AddArc(const quint32 &arcId, const quint32 &parentId) +void VContainer::AddArc(const quint32 &id, const quint32 &parentId) { - AddCurveLength(arcId, parentId); + const QSharedPointer arc = GeometricObject(id); - const QSharedPointer arc = GeometricObject(arcId); - VArcRadius *radius = new VArcRadius(arcId, parentId, arc.data()); + VArcLength *length = new VArcLength(id, parentId, arc.data()); + AddVariable(length->GetName(), length); + + VArcRadius *radius = new VArcRadius(id, parentId, arc.data()); AddVariable(radius->GetName(), radius); + + VArcAngle *startAngle = new VArcAngle(id, parentId, arc.data(), CurveAngle::StartAngle); + AddVariable(startAngle->GetName(), startAngle); + + VArcAngle *endAngle = new VArcAngle(id, parentId, arc.data(), CurveAngle::EndAngle); + AddVariable(endAngle->GetName(), endAngle); } //--------------------------------------------------------------------------------------------------------------------- @@ -433,6 +441,18 @@ const QMap > VContainer::DataRadiusesArcs() return DataVar(VarType::ArcRadius); } +//--------------------------------------------------------------------------------------------------------------------- +const QMap > VContainer::DataAnglesArcs() const +{ + return DataVar(VarType::ArcAngle); +} + +//--------------------------------------------------------------------------------------------------------------------- +const QMap > VContainer::DataAnglesCurves() const +{ + return DataVar(VarType::SplineAngle); +} + //--------------------------------------------------------------------------------------------------------------------- bool VContainer::IsUnique(const QString &name) { diff --git a/src/app/container/vcontainer.h b/src/app/container/vcontainer.h index 54cec0731..3d7600d38 100644 --- a/src/app/container/vcontainer.h +++ b/src/app/container/vcontainer.h @@ -159,18 +159,19 @@ public: void AddLine(const quint32 &firstPointId, const quint32 &secondPointId); void AddArc(const quint32 &arcId, const quint32 &parentId = 0); - template - /** - * @brief AddCurveLength add length of curve type to the container - * @param id id of variables - * @param parentId if of parent object. - * - * Parent id - id of cutting point - */ - void AddCurveLength(const quint32 &id, const quint32 &parentId = 0) + template + void AddCurve(const quint32 &id, const quint32 &parentId = 0) { - const QSharedPointer var = GeometricObject(id); - AddVariable(var->name(), new TLength(id, parentId, var.data())); + const QSharedPointer curve = GeometricObject(id); + + VSplineLength *length = new VSplineLength(id, parentId, curve.data()); + AddVariable(length->GetName(), length); + + VSplineAngle *startAngle = new VSplineAngle(id, parentId, curve.data(), CurveAngle::StartAngle); + AddVariable(startAngle->GetName(), startAngle); + + VSplineAngle *endAngle = new VSplineAngle(id, parentId, curve.data(), CurveAngle::EndAngle); + AddVariable(endAngle->GetName(), endAngle); } template @@ -225,6 +226,8 @@ public: const QMap > DataLengthArcs() const; const QMap > DataAngleLines() const; const QMap > DataRadiusesArcs() const; + const QMap > DataAnglesArcs() const; + const QMap > DataAnglesCurves() const; static bool IsUnique(const QString &name); diff --git a/src/app/core/vapplication.cpp b/src/app/core/vapplication.cpp index 1800df246..97dc99e64 100644 --- a/src/app/core/vapplication.cpp +++ b/src/app/core/vapplication.cpp @@ -1486,8 +1486,15 @@ void VApplication::InitVariables() variables.insert(spl_, QmuTranslation::translate("Variables", "Spl_", "Left symbol _ in name")); variables.insert(splPath, QmuTranslation::translate("Variables", "SplPath", "Do not add symbol _ to the end of name")); - variables.insert(radiusArc_, QmuTranslation::translate("Variables", "Radius", - "Do not add symbol _ to the end of name")); + variables.insert(radiusArc_, QmuTranslation::translate("Variables", "RadiusArc_", "Left symbol _ in name")); + variables.insert(angle1Arc_, QmuTranslation::translate("Variables", "Angle1Arc_", "Left symbol _ in name")); + variables.insert(angle2Arc_, QmuTranslation::translate("Variables", "Angle2Arc_", "Left symbol _ in name")); + variables.insert(angle1Spl_, QmuTranslation::translate("Variables", "Angle1Spl_", "Left symbol _ in name")); + variables.insert(angle2Spl_, QmuTranslation::translate("Variables", "Angle2Spl_", "Left symbol _ in name")); + variables.insert(angle1SplPath, QmuTranslation::translate("Variables", "Angle1SplPath", + "Do not add symbol _ to the end of name")); + variables.insert(angle2SplPath, QmuTranslation::translate("Variables", "Angle2SplPath", + "Do not add symbol _ to the end of name")); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/dialogs/app/dialogincrements.cpp b/src/app/dialogs/app/dialogincrements.cpp index a1346a6ce..9be173577 100644 --- a/src/app/dialogs/app/dialogincrements.cpp +++ b/src/app/dialogs/app/dialogincrements.cpp @@ -93,11 +93,13 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par FillMeasurements(); FillIncrements(); - FillLengthLines(); - FillLengthLinesAngle(); - FillLengthSplines(); + FillLengthsLines(); + FillLengthLinesAngles(); + FillLengthsCurves(); FillLengthArcs(); FillRadiusesArcs(); + FillAnglesArcs(); + FillAnglesCurves(); if (qApp->patternType() == MeasurementsType::Standard) { @@ -352,22 +354,22 @@ void DialogIncrements::FillTable(const QMap varTable, QTableWidget * /** * @brief FillLengthLines fill data for table of lines lengths */ -void DialogIncrements::FillLengthLines() +void DialogIncrements::FillLengthsLines() { FillTable(data->DataLengthLines(), ui->tableWidgetLines); } //--------------------------------------------------------------------------------------------------------------------- -void DialogIncrements::FillLengthLinesAngle() +void DialogIncrements::FillLengthLinesAngles() { - FillTable(data->DataAngleLines(), ui->tableWidgetLinesAngle); + FillTable(data->DataAngleLines(), ui->tableWidgetLinesAngles); } //--------------------------------------------------------------------------------------------------------------------- /** * @brief FillLengthSplines fill data for table of splines lengths */ -void DialogIncrements::FillLengthSplines() +void DialogIncrements::FillLengthsCurves() { FillTable(data->DataLengthSplines(), ui->tableWidgetSplines); } @@ -387,6 +389,18 @@ void DialogIncrements::FillRadiusesArcs() FillTable(data->DataRadiusesArcs(), ui->tableWidgetRadiusesArcs); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogIncrements::FillAnglesArcs() +{ + FillTable(data->DataAnglesArcs(), ui->tableWidgetAnglesArcs); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogIncrements::FillAnglesCurves() +{ + FillTable(data->DataAnglesCurves(), ui->tableWidgetAnglesCurves); +} + //--------------------------------------------------------------------------------------------------------------------- void DialogIncrements::SetItemViewOnly(QTableWidgetItem *item) { @@ -412,8 +426,10 @@ void DialogIncrements::ShowUnits() ShowHeaderUnits(ui->tableWidgetLines, 1, unit);// lengths ShowHeaderUnits(ui->tableWidgetSplines, 1, unit);// lengths ShowHeaderUnits(ui->tableWidgetArcs, 1, unit);// lengths - ShowHeaderUnits(ui->tableWidgetLinesAngle, 1, "°");// lengths + ShowHeaderUnits(ui->tableWidgetLinesAngles, 1, "°");// angle ShowHeaderUnits(ui->tableWidgetRadiusesArcs, 1, unit);// radius + ShowHeaderUnits(ui->tableWidgetAnglesArcs, 1, "°");// angle + ShowHeaderUnits(ui->tableWidgetAnglesCurves, 1, "°");// angle } //--------------------------------------------------------------------------------------------------------------------- @@ -471,10 +487,10 @@ void DialogIncrements::FullUpdateFromFile() ui->tableWidgetIncrement->blockSignals(false); ui->tableWidgetLines->clearContents(); - FillLengthLines(); + FillLengthsLines(); ui->tableWidgetSplines->clearContents(); - FillLengthSplines(); + FillLengthsCurves(); ui->tableWidgetArcs->clearContents(); FillLengthArcs(); diff --git a/src/app/dialogs/app/dialogincrements.h b/src/app/dialogs/app/dialogincrements.h index 3aac33054..7d8d61c2a 100644 --- a/src/app/dialogs/app/dialogincrements.h +++ b/src/app/dialogs/app/dialogincrements.h @@ -94,15 +94,19 @@ private: VIndividualMeasurements *m; - void FillMeasurements(); - void FillIncrements(); template void FillTable(const QMap varTable, QTableWidget *table); - void FillLengthLines(); - void FillLengthLinesAngle(); - void FillLengthSplines(); + + void FillMeasurements(); + void FillIncrements(); + void FillLengthsLines(); + void FillLengthLinesAngles(); + void FillLengthsCurves(); void FillLengthArcs(); void FillRadiusesArcs(); + void FillAnglesArcs(); + void FillAnglesCurves(); + void AddIncrementToFile(const quint32 &id, const QString &name, const qreal &base, const qreal &ksize, const qreal &kheight, const QString &description); void HideColumns(QTableWidget *table); diff --git a/src/app/dialogs/app/dialogincrements.ui b/src/app/dialogs/app/dialogincrements.ui index e1dedad6b..6079d708f 100644 --- a/src/app/dialogs/app/dialogincrements.ui +++ b/src/app/dialogs/app/dialogincrements.ui @@ -550,11 +550,11 @@ - Lines angle + Lines angles - + QAbstractItemView::NoEditTriggers @@ -589,7 +589,7 @@ - Curves + Lengths curves @@ -626,9 +626,48 @@ + + + Angles curves + + + + + + QAbstractItemView::NoEditTriggers + + + true + + + false + + + 137 + + + false + + + false + + + + Curve + + + + + Angle + + + + + + - Arcs + Lengths arcs @@ -704,6 +743,45 @@ + + + Angles arcs + + + + + + QAbstractItemView::NoEditTriggers + + + true + + + false + + + 137 + + + false + + + false + + + + Arc + + + + + Angle + + + + + + diff --git a/src/app/dialogs/tools/dialogeditwrongformula.cpp b/src/app/dialogs/tools/dialogeditwrongformula.cpp index 23f614630..29cf47caa 100644 --- a/src/app/dialogs/tools/dialogeditwrongformula.cpp +++ b/src/app/dialogs/tools/dialogeditwrongformula.cpp @@ -190,6 +190,22 @@ void DialogEditWrongFormula::ValChenged(int row) ui->labelDescription->setText(desc); return; } + if (ui->radioButtonAnglesArcs->isChecked()) + { + QString desc = QString("%1(%2) - %3").arg(item->text()) + .arg(*data->GetVariable(qApp->VarFromUser(item->text()))->GetValue()) + .arg(tr("Arc angle")); + ui->labelDescription->setText(desc); + return; + } + if (ui->radioButtonAnglesCurves->isChecked()) + { + QString desc = QString("%1(%2) - %3").arg(item->text()) + .arg(*data->GetVariable(qApp->VarFromUser(item->text()))->GetValue()) + .arg(tr("Curve angle")); + ui->labelDescription->setText(desc); + return; + } } //--------------------------------------------------------------------------------------------------------------------- @@ -273,6 +289,20 @@ void DialogEditWrongFormula::RadiusArcs() ShowVariable(data->DataRadiusesArcs()); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogEditWrongFormula::AnglesArcs() +{ + ui->checkBoxHideEmpty->setEnabled(false); + ShowVariable(data->DataAnglesArcs()); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogEditWrongFormula::AnglesCurves() +{ + ui->checkBoxHideEmpty->setEnabled(false); + ShowVariable(data->DataAnglesCurves()); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief LengthArcs show in list lengths of arcs variables @@ -380,6 +410,8 @@ void DialogEditWrongFormula::InitVariables() connect(ui->radioButtonAngleLine, &QRadioButton::clicked, this, &DialogEditWrongFormula::AngleLines); connect(ui->checkBoxHideEmpty, &QCheckBox::stateChanged, this, &DialogEditWrongFormula::Measurements); connect(ui->radioButtonRadiusesArcs, &QRadioButton::clicked, this, &DialogEditWrongFormula::RadiusArcs); + connect(ui->radioButtonAnglesArcs, &QRadioButton::clicked, this, &DialogEditWrongFormula::AnglesArcs); + connect(ui->radioButtonAnglesCurves, &QRadioButton::clicked, this, &DialogEditWrongFormula::AnglesCurves); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/dialogs/tools/dialogeditwrongformula.h b/src/app/dialogs/tools/dialogeditwrongformula.h index 6a559115c..18a3b5dfc 100644 --- a/src/app/dialogs/tools/dialogeditwrongformula.h +++ b/src/app/dialogs/tools/dialogeditwrongformula.h @@ -71,6 +71,8 @@ public slots: void Measurements(); void LengthLines(); void RadiusArcs(); + void AnglesArcs(); + void AnglesCurves(); void LengthArcs(); void LengthCurves(); void AngleLines(); diff --git a/src/app/dialogs/tools/dialogeditwrongformula.ui b/src/app/dialogs/tools/dialogeditwrongformula.ui index 33acda72b..4e52e7b49 100644 --- a/src/app/dialogs/tools/dialogeditwrongformula.ui +++ b/src/app/dialogs/tools/dialogeditwrongformula.ui @@ -10,19 +10,19 @@ 0 0 390 - 365 + 449 390 - 365 + 449 390 - 365 + 449 @@ -349,6 +349,20 @@ + + + + Angles of arcs + + + + + + + Angles of curves + + + diff --git a/src/app/options.cpp b/src/app/options.cpp index dfb49b74c..fe9746ed9 100644 --- a/src/app/options.cpp +++ b/src/app/options.cpp @@ -184,9 +184,8 @@ const QString depthWaistFirst_M = QStringLiteral("depth_waist_ const QString depthWaistSecond_M = QStringLiteral("depth_waist_second"); //variables -const QString line_ = QStringLiteral("Line_"); -const QString angleLine_ = QStringLiteral("AngleLine_"); -const QString radiusArc_ = QStringLiteral("Radius"); +const QString line_ = QStringLiteral("Line_"); +const QString angleLine_ = QStringLiteral("AngleLine_"); //functions const QString sin_F = QStringLiteral("sin"); diff --git a/src/app/options.h b/src/app/options.h index 14d9a9940..2ff8731c7 100644 --- a/src/app/options.h +++ b/src/app/options.h @@ -126,8 +126,8 @@ enum class Vis : unsigned char enum class Source : char { FromGui, FromFile, FromTool }; enum class NodeDetail : char { Contour, Modeling }; enum class Contour : char { OpenContour, CloseContour }; -enum class VarType : char { Measurement, Increment, LineLength, SplineLength, ArcLength, ArcRadius, LineAngle, - Unknown }; +enum class VarType : char { Measurement, Increment, LineLength, SplineLength, ArcLength, ArcRadius, LineAngle, ArcAngle, + SplineAngle, Unknown }; enum class GHeights : unsigned char { ALL, H92=92, H98=98, H104=104, H110=110, H116=116, H122=122, H128=128, H134=134, @@ -284,7 +284,6 @@ extern const QString depthWaistSecond_M; // variables name extern const QString line_; extern const QString angleLine_; -extern const QString radiusArc_; // functions extern const QString sin_F; diff --git a/src/app/tools/drawTools/vtoolarc.cpp b/src/app/tools/drawTools/vtoolarc.cpp index 62429b9ac..30776e08f 100644 --- a/src/app/tools/drawTools/vtoolarc.cpp +++ b/src/app/tools/drawTools/vtoolarc.cpp @@ -242,7 +242,7 @@ void VToolArc::SetFormulaF1(const VFormula &value) QSharedPointer obj = VAbstractTool::data.GetGObject(id); QSharedPointer arc = qSharedPointerDynamicCast(obj); - if (qFuzzyCompare(value.getDoubleValue() + 1, arc->GetF2() + 1)==false)// Angles can't be equal + if (qFuzzyCompare(value.getDoubleValue() + 1, arc->GetEndAngle() + 1)==false)// Angles can't be equal { arc->SetFormulaF1(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); SaveOption(obj); @@ -270,7 +270,7 @@ void VToolArc::SetFormulaF2(const VFormula &value) { QSharedPointer obj = VAbstractTool::data.GetGObject(id); QSharedPointer arc = qSharedPointerDynamicCast(obj); - if (qFuzzyCompare(value.getDoubleValue() + 1, arc->GetF1() + 1)==false)// Angles can't be equal + if (qFuzzyCompare(value.getDoubleValue() + 1, arc->GetStartAngle() + 1)==false)// Angles can't be equal { arc->SetFormulaF2(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); SaveOption(obj); diff --git a/src/app/tools/drawTools/vtoolcutspline.cpp b/src/app/tools/drawTools/vtoolcutspline.cpp index 052e1a19d..baa132c12 100644 --- a/src/app/tools/drawTools/vtoolcutspline.cpp +++ b/src/app/tools/drawTools/vtoolcutspline.cpp @@ -139,11 +139,11 @@ VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointNa VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve()); spl1id = data->AddGObject(spline1); - data->AddCurveLength(spl1id, id); + data->AddCurve(spl1id, id); VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve()); spl2id = data->AddGObject(spline2); - data->AddCurveLength(spl2id, id); + data->AddCurve(spl2id, id); } else { @@ -155,11 +155,11 @@ VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointNa VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve()); data->UpdateGObject(spl1id, spline1); - data->AddCurveLength(spl1id, id); + data->AddCurve(spl1id, id); VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve()); data->UpdateGObject(spl2id, spline2); - data->AddCurveLength(spl2id, id); + data->AddCurve(spl2id, id); if (parse != Document::FullParse) { diff --git a/src/app/tools/drawTools/vtoolcutsplinepath.cpp b/src/app/tools/drawTools/vtoolcutsplinepath.cpp index 8fac982a5..71bd85353 100644 --- a/src/app/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/app/tools/drawTools/vtoolcutsplinepath.cpp @@ -162,10 +162,10 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString { if (i == p1) { - splPath1->append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1()+180, spl1.GetKasm1(), - spl1.GetAngle1())); + splPath1->append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetStartAngle()+180, spl1.GetKasm1(), + spl1.GetStartAngle())); VSplinePoint cutPoint; - cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2(), spl2.GetKasm1(), spl1.GetAngle2()+180); + cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetEndAngle(), spl2.GetKasm1(), spl1.GetEndAngle()+180); splPath1->append(cutPoint); continue; } @@ -175,11 +175,11 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString { if (i == p2) { - const VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1()+180, - spl2.GetKasm1(), spl2.GetAngle1()); + const VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetStartAngle()+180, + spl2.GetKasm1(), spl2.GetStartAngle()); splPath2->append(cutPoint); - splPath2->append(VSplinePoint(splP2.P(), spl2.GetKasm2(), spl2.GetAngle2(), splP2.KAsm2(), - spl2.GetAngle2()+180)); + splPath2->append(VSplinePoint(splP2.P(), spl2.GetKasm2(), spl2.GetEndAngle(), splP2.KAsm2(), + spl2.GetEndAngle()+180)); continue; } splPath2->append(splPath->at(i)); @@ -191,18 +191,18 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString if (typeCreation == Source::FromGui) { splPath1id = data->AddGObject(splPath1); - data->AddCurveLength(splPath1id, id); + data->AddCurve(splPath1id, id); splPath2id = data->AddGObject(splPath2); - data->AddCurveLength(splPath2id, id); + data->AddCurve(splPath2id, id); } else { data->UpdateGObject(splPath1id, splPath1); - data->AddCurveLength(splPath1id, id); + data->AddCurve(splPath1id, id); data->UpdateGObject(splPath2id, splPath2); - data->AddCurveLength(splPath2id, id); + data->AddCurve(splPath2id, id); if (parse != Document::FullParse) { diff --git a/src/app/tools/drawTools/vtoolspline.cpp b/src/app/tools/drawTools/vtoolspline.cpp index decd1d0c2..d87d5d2bb 100644 --- a/src/app/tools/drawTools/vtoolspline.cpp +++ b/src/app/tools/drawTools/vtoolspline.cpp @@ -107,8 +107,8 @@ void VToolSpline::setDialog() const QSharedPointer spl = VAbstractTool::data.GeometricObject(id); dialogTool->SetP1(spl->GetP1().id()); dialogTool->SetP4(spl->GetP4().id()); - dialogTool->SetAngle1(spl->GetAngle1()); - dialogTool->SetAngle2(spl->GetAngle2()); + dialogTool->SetAngle1(spl->GetStartAngle()); + dialogTool->SetAngle2(spl->GetEndAngle()); dialogTool->SetKAsm1(spl->GetKasm1()); dialogTool->SetKAsm2(spl->GetKasm2()); dialogTool->SetKCurve(spl->GetKcurve()); @@ -177,12 +177,12 @@ VToolSpline* VToolSpline::Create(const quint32 _id, const quint32 &p1, const qui if (typeCreation == Source::FromGui) { id = data->AddGObject(spline); - data->AddCurveLength(id); + data->AddCurve(id); } else { data->UpdateGObject(id, spline); - data->AddCurveLength(id); + data->AddCurve(id); if (parse != Document::FullParse) { doc->UpdateToolData(id, data); @@ -310,8 +310,8 @@ void VToolSpline::SaveDialog(QDomElement &domElement) doc->SetAttribute(domElement, AttrPoint1, spl.GetP1().id()); doc->SetAttribute(domElement, AttrPoint4, spl.GetP4().id()); - doc->SetAttribute(domElement, AttrAngle1, spl.GetAngle1()); - doc->SetAttribute(domElement, AttrAngle2, spl.GetAngle2()); + doc->SetAttribute(domElement, AttrAngle1, spl.GetStartAngle()); + doc->SetAttribute(domElement, AttrAngle2, spl.GetEndAngle()); doc->SetAttribute(domElement, AttrKAsm1, spl.GetKasm1()); doc->SetAttribute(domElement, AttrKAsm2, spl.GetKasm2()); doc->SetAttribute(domElement, AttrKCurve, spl.GetKcurve()); @@ -329,8 +329,8 @@ void VToolSpline::SaveOptions(QDomElement &tag, QSharedPointer &obj) doc->SetAttribute(tag, AttrType, ToolType); doc->SetAttribute(tag, AttrPoint1, spl->GetP1().id()); doc->SetAttribute(tag, AttrPoint4, spl->GetP4().id()); - doc->SetAttribute(tag, AttrAngle1, spl->GetAngle1()); - doc->SetAttribute(tag, AttrAngle2, spl->GetAngle2()); + doc->SetAttribute(tag, AttrAngle1, spl->GetStartAngle()); + doc->SetAttribute(tag, AttrAngle2, spl->GetEndAngle()); doc->SetAttribute(tag, AttrKAsm1, spl->GetKasm1()); doc->SetAttribute(tag, AttrKAsm2, spl->GetKasm2()); doc->SetAttribute(tag, AttrKCurve, spl->GetKcurve()); @@ -452,8 +452,8 @@ void VToolSpline::SetVisualization() const QSharedPointer spl = VAbstractTool::data.GeometricObject(id); visual->setPoint1Id(spl->GetP1().id()); visual->setPoint4Id(spl->GetP4().id()); - visual->SetAngle1(spl->GetAngle1()); - visual->SetAngle2(spl->GetAngle2()); + visual->SetAngle1(spl->GetStartAngle()); + visual->SetAngle2(spl->GetEndAngle()); visual->SetKAsm1(spl->GetKasm1()); visual->SetKAsm2(spl->GetKasm2()); visual->SetKCurve(spl->GetKcurve()); diff --git a/src/app/tools/drawTools/vtoolsplinepath.cpp b/src/app/tools/drawTools/vtoolsplinepath.cpp index bf29bd489..6e6915041 100644 --- a/src/app/tools/drawTools/vtoolsplinepath.cpp +++ b/src/app/tools/drawTools/vtoolsplinepath.cpp @@ -158,12 +158,12 @@ VToolSplinePath* VToolSplinePath::Create(const quint32 _id, VSplinePath *path, c if (typeCreation == Source::FromGui) { id = data->AddGObject(path); - data->AddCurveLength(id); + data->AddCurve(id); } else { data->UpdateGObject(id, path); - data->AddCurveLength(id); + data->AddCurve(id); if (parse != Document::FullParse) { doc->UpdateToolData(id, data); @@ -230,12 +230,12 @@ void VToolSplinePath::EnableToolMove(bool move) void VToolSplinePath::UpdateControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline) const { VSplinePoint p = splPath.GetSplinePoint(indexSpline, SplinePointPosition::FirstPoint); - p.SetAngle2(spl.GetAngle1()); + p.SetAngle2(spl.GetStartAngle()); p.SetKAsm2(spl.GetKasm1()); splPath.UpdatePoint(indexSpline, SplinePointPosition::FirstPoint, p); p = splPath.GetSplinePoint(indexSpline, SplinePointPosition::LastPoint); - p.SetAngle2(spl.GetAngle2()-180); + p.SetAngle2(spl.GetEndAngle()-180); p.SetKAsm1(spl.GetKasm2()); splPath.UpdatePoint(indexSpline, SplinePointPosition::LastPoint, p); } diff --git a/src/app/tools/vtooluniondetails.cpp b/src/app/tools/vtooluniondetails.cpp index 9099bbe03..24b2e7d22 100644 --- a/src/app/tools/vtooluniondetails.cpp +++ b/src/app/tools/vtooluniondetails.cpp @@ -213,11 +213,11 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve()); if (i==1) { - path->append(VSplinePoint(*p1, splinePath->at(i-1).KAsm1(), spl.GetAngle1()+180, - splinePath->at(i-1).KAsm2(), spl.GetAngle1())); + path->append(VSplinePoint(*p1, splinePath->at(i-1).KAsm1(), spl.GetStartAngle()+180, + splinePath->at(i-1).KAsm2(), spl.GetStartAngle())); } - path->append(VSplinePoint(*p4, splinePath->at(i).KAsm1(), spl.GetAngle2(), - splinePath->at(i).KAsm2(), spl.GetAngle2()+180)); + path->append(VSplinePoint(*p4, splinePath->at(i).KAsm1(), spl.GetEndAngle(), + splinePath->at(i).KAsm2(), spl.GetEndAngle()+180)); delete p4; delete p1; } @@ -362,11 +362,11 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve()); if (i==1) { - path->append(VSplinePoint(*p1, splinePath->at(i-1).KAsm1(), spl.GetAngle1()+180, - splinePath->at(i-1).KAsm2(), spl.GetAngle1())); + path->append(VSplinePoint(*p1, splinePath->at(i-1).KAsm1(), spl.GetStartAngle()+180, + splinePath->at(i-1).KAsm2(), spl.GetStartAngle())); } - path->append(VSplinePoint(*p4, splinePath->at(i).KAsm1(), spl.GetAngle2(), - splinePath->at(i).KAsm2(), spl.GetAngle2()+180)); + path->append(VSplinePoint(*p4, splinePath->at(i).KAsm1(), spl.GetEndAngle(), + splinePath->at(i).KAsm2(), spl.GetEndAngle()+180)); delete p1; delete p4; } diff --git a/src/app/undocommands/movespline.cpp b/src/app/undocommands/movespline.cpp index ea16904c5..68731ff11 100644 --- a/src/app/undocommands/movespline.cpp +++ b/src/app/undocommands/movespline.cpp @@ -91,8 +91,8 @@ void MoveSpline::Do(const VSpline &spl) QDomElement domElement = doc->elementById(nodeId); if (domElement.isElement()) { - doc->SetAttribute(domElement, VAbstractTool::AttrAngle1, QString().setNum(spl.GetAngle1())); - doc->SetAttribute(domElement, VAbstractTool::AttrAngle2, QString().setNum(spl.GetAngle2())); + doc->SetAttribute(domElement, VAbstractTool::AttrAngle1, QString().setNum(spl.GetStartAngle())); + doc->SetAttribute(domElement, VAbstractTool::AttrAngle2, QString().setNum(spl.GetEndAngle())); doc->SetAttribute(domElement, VAbstractTool::AttrKAsm1, QString().setNum(spl.GetKasm1())); doc->SetAttribute(domElement, VAbstractTool::AttrKAsm2, QString().setNum(spl.GetKasm2())); doc->SetAttribute(domElement, VAbstractTool::AttrKCurve, QString().setNum(spl.GetKcurve())); diff --git a/src/app/visualization/vistoolcutsplinepath.cpp b/src/app/visualization/vistoolcutsplinepath.cpp index 414722232..80bfebd4e 100644 --- a/src/app/visualization/vistoolcutsplinepath.cpp +++ b/src/app/visualization/vistoolcutsplinepath.cpp @@ -79,11 +79,11 @@ void VisToolCutSplinePath::RefreshGeometry() { if (i == p1) { - spPath1.append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1()+180, spl1.GetKasm1(), - spl1.GetAngle1())); + spPath1.append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetStartAngle()+180, spl1.GetKasm1(), + spl1.GetStartAngle())); VSplinePoint cutPoint; - cutPoint = VSplinePoint(p, spl1.GetKasm2(), spl1.GetAngle2(), spl2.GetKasm1(), - spl1.GetAngle2()+180); + cutPoint = VSplinePoint(p, spl1.GetKasm2(), spl1.GetEndAngle(), spl2.GetKasm1(), + spl1.GetEndAngle()+180); spPath1.append(cutPoint); continue; } @@ -93,11 +93,11 @@ void VisToolCutSplinePath::RefreshGeometry() { if (i == p2) { - const VSplinePoint cutPoint = VSplinePoint(p, spl1.GetKasm2(), spl2.GetAngle1()+180, - spl2.GetKasm1(), spl2.GetAngle1()); + const VSplinePoint cutPoint = VSplinePoint(p, spl1.GetKasm2(), spl2.GetStartAngle()+180, + spl2.GetKasm1(), spl2.GetStartAngle()); spPath2.append(cutPoint); - spPath2.append(VSplinePoint(splP2.P(), spl2.GetKasm2(), spl2.GetAngle2(), splP2.KAsm2(), - spl2.GetAngle2()+180)); + spPath2.append(VSplinePoint(splP2.P(), spl2.GetKasm2(), spl2.GetEndAngle(), splP2.KAsm2(), + spl2.GetEndAngle()+180)); continue; } spPath2.append(splPath->at(i)); diff --git a/src/app/xml/vpattern.cpp b/src/app/xml/vpattern.cpp index b6b77aac3..f124a8fab 100644 --- a/src/app/xml/vpattern.cpp +++ b/src/app/xml/vpattern.cpp @@ -2612,6 +2612,8 @@ void VPattern::PrepareForParse(const Document &parse) data->ClearVariables(VarType::LineLength); data->ClearVariables(VarType::SplineLength); data->ClearVariables(VarType::ArcRadius); + data->ClearVariables(VarType::ArcAngle); + data->ClearVariables(VarType::SplineAngle); } } diff --git a/src/libs/vgeometry/vabstractcurve.h b/src/libs/vgeometry/vabstractcurve.h index 54a949f5c..3276561f1 100644 --- a/src/libs/vgeometry/vabstractcurve.h +++ b/src/libs/vgeometry/vabstractcurve.h @@ -52,6 +52,9 @@ public: virtual qreal GetLength() const =0; virtual QVector IntersectLine(const QLineF &line) const; virtual bool IsIntersectLine(const QLineF &line) const; + + virtual qreal GetStartAngle () const=0; + virtual qreal GetEndAngle () const=0; protected: QPainterPath ShowDirection(const QVector &points) const; private: diff --git a/src/libs/vgeometry/varc.cpp b/src/libs/vgeometry/varc.cpp index 29db2e96f..9a4aa2487 100644 --- a/src/libs/vgeometry/varc.cpp +++ b/src/libs/vgeometry/varc.cpp @@ -261,7 +261,7 @@ void VArc::SetFormulaF1(const QString &formula, qreal value) * @brief GetF1 return formula for start angle. * @return string with formula. */ -qreal VArc::GetF1() const +qreal VArc::GetStartAngle() const { return d->f1; } @@ -288,7 +288,7 @@ void VArc::SetFormulaF2(const QString &formula, qreal value) * @brief GetF2 return formula for end angle. * @return string with formula. */ -qreal VArc::GetF2() const +qreal VArc::GetEndAngle() const { return d->f2; } diff --git a/src/libs/vgeometry/varc.h b/src/libs/vgeometry/varc.h index af367910a..63850a5ba 100644 --- a/src/libs/vgeometry/varc.h +++ b/src/libs/vgeometry/varc.h @@ -53,11 +53,11 @@ public: QString GetFormulaF1 () const; void SetFormulaF1 (const QString &formula, qreal value); - qreal GetF1 () const; + virtual qreal GetStartAngle () const; QString GetFormulaF2 () const; void SetFormulaF2 (const QString &formula, qreal value); - qreal GetF2 () const; + virtual qreal GetEndAngle () const; QString GetFormulaRadius () const; void SetFormulaRadius (const QString &formula, qreal value); diff --git a/src/libs/vgeometry/vgeometrydef.cpp b/src/libs/vgeometry/vgeometrydef.cpp index 760ef60f5..6a4c52593 100644 --- a/src/libs/vgeometry/vgeometrydef.cpp +++ b/src/libs/vgeometry/vgeometrydef.cpp @@ -29,6 +29,16 @@ #include "vgeometrydef.h" //variables -const QString spl_ = QStringLiteral("Spl_"); -const QString arc_ = QStringLiteral("Arc_"); -const QString splPath = QStringLiteral("SplPath"); +const QString spl_ = QStringLiteral("Spl_"); +const QString arc_ = QStringLiteral("Arc_"); +const QString splPath = QStringLiteral("SplPath"); +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 angle1Arc_ = angle1_V + arc_; +const QString angle2Arc_ = angle2_V + arc_; +const QString angle1Spl_ = angle1_V + spl_; +const QString angle2Spl_ = angle2_V + spl_; +const QString angle1SplPath = angle1_V + splPath; +const QString angle2SplPath = angle2_V + splPath; diff --git a/src/libs/vgeometry/vgeometrydef.h b/src/libs/vgeometry/vgeometrydef.h index 3ff9b30d0..709987748 100644 --- a/src/libs/vgeometry/vgeometrydef.h +++ b/src/libs/vgeometry/vgeometrydef.h @@ -39,5 +39,16 @@ enum class SplinePointPosition : char { FirstPoint, LastPoint }; extern const QString arc_; extern const QString spl_; extern const QString splPath; +extern const QString radius_V; +extern const QString radiusArc_; +extern const QString angle1_V; +extern const QString angle2_V; +extern const QString angle1Arc_; +extern const QString angle2Arc_; +extern const QString angle1Spl_; +extern const QString angle2Spl_; +extern const QString angle1SplPath; +extern const QString angle2SplPath; + #endif // VGEOMETRYDEF_H diff --git a/src/libs/vgeometry/vspline.cpp b/src/libs/vgeometry/vspline.cpp index 8e5f4c5a5..18f2a2dca 100644 --- a/src/libs/vgeometry/vspline.cpp +++ b/src/libs/vgeometry/vspline.cpp @@ -691,7 +691,7 @@ VPointF VSpline::GetP4() const * @brief GetAngle1 return first angle control line. * @return angle. */ -qreal VSpline::GetAngle1() const +qreal VSpline::GetStartAngle() const { return d->angle1; } @@ -701,7 +701,7 @@ qreal VSpline::GetAngle1() const * @brief GetAngle2 return second angle control line. * @return angle. */ -qreal VSpline::GetAngle2() const +qreal VSpline::GetEndAngle() const { return d->angle2; } diff --git a/src/libs/vgeometry/vspline.h b/src/libs/vgeometry/vspline.h index 1e4ee833d..e332581b2 100644 --- a/src/libs/vgeometry/vspline.h +++ b/src/libs/vgeometry/vspline.h @@ -57,8 +57,10 @@ public: QPointF GetP2 () const; QPointF GetP3 () const; VPointF GetP4 () const; - qreal GetAngle1 () const; - qreal GetAngle2() const; + + virtual qreal GetStartAngle () const; + virtual qreal GetEndAngle() const; + qreal GetLength () const; qreal GetKasm1() const; qreal GetKasm2() const; diff --git a/src/libs/vgeometry/vsplinepath.cpp b/src/libs/vgeometry/vsplinepath.cpp index ebc8c1050..4c16e0d46 100644 --- a/src/libs/vgeometry/vsplinepath.cpp +++ b/src/libs/vgeometry/vsplinepath.cpp @@ -254,6 +254,32 @@ int VSplinePath::Segment(const QPointF &p) const return index; } +//--------------------------------------------------------------------------------------------------------------------- +qreal VSplinePath::GetStartAngle() const +{ + if (CountPoint() > 0) + { + return GetSplinePath().first().Angle1(); + } + else + { + return 0; + } +} + +//--------------------------------------------------------------------------------------------------------------------- +qreal VSplinePath::GetEndAngle() const +{ + if (CountPoint() > 0) + { + return GetSplinePath().last().Angle2(); + } + else + { + return 0; + } +} + //--------------------------------------------------------------------------------------------------------------------- qint32 VSplinePath::CountPoint() const { diff --git a/src/libs/vgeometry/vsplinepath.h b/src/libs/vgeometry/vsplinepath.h index 7681c97fa..f0d6deef2 100644 --- a/src/libs/vgeometry/vsplinepath.h +++ b/src/libs/vgeometry/vsplinepath.h @@ -175,6 +175,9 @@ public: QPointF &spl2p3) const; int Segment(const QPointF &p) const; + + virtual qreal GetStartAngle () const; + virtual qreal GetEndAngle () const; private: QSharedDataPointer d; };