Resolved issue #259. Draw free curve path point at distance.
--HG-- branch : develop
This commit is contained in:
parent
001c676ab5
commit
ab01a5b064
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
73
src/app/container/variables/varcangle.cpp
Normal file
73
src/app/container/variables/varcangle.cpp
Normal file
|
@ -0,0 +1,73 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file varcangle.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @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
|
||||
** <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/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#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()
|
||||
{}
|
46
src/app/container/variables/varcangle.h
Normal file
46
src/app/container/variables/varcangle.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file varcangle.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @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
|
||||
** <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 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
|
|
@ -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()));
|
||||
}
|
||||
|
||||
|
|
73
src/app/container/variables/vcurveangle.cpp
Normal file
73
src/app/container/variables/vcurveangle.cpp
Normal file
|
@ -0,0 +1,73 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vcurveangle.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @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
|
||||
** <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/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#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()
|
||||
{}
|
48
src/app/container/variables/vcurveangle.h
Normal file
48
src/app/container/variables/vcurveangle.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vcurveangle.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @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
|
||||
** <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 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
|
73
src/app/container/variables/vsplineangle.cpp
Normal file
73
src/app/container/variables/vsplineangle.cpp
Normal file
|
@ -0,0 +1,73 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vsplineangle.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @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
|
||||
** <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/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#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()
|
||||
{}
|
46
src/app/container/variables/vsplineangle.h
Normal file
46
src/app/container/variables/vsplineangle.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vsplineangle.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @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
|
||||
** <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 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
|
|
@ -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<VArcLength>(arcId, parentId);
|
||||
const QSharedPointer<VArc> arc = GeometricObject<VArc>(id);
|
||||
|
||||
const QSharedPointer<VArc> arc = GeometricObject<VArc>(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<QString, QSharedPointer<VArcRadius> > VContainer::DataRadiusesArcs()
|
|||
return DataVar<VArcRadius>(VarType::ArcRadius);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
const QMap<QString, QSharedPointer<VArcAngle> > VContainer::DataAnglesArcs() const
|
||||
{
|
||||
return DataVar<VArcAngle>(VarType::ArcAngle);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
const QMap<QString, QSharedPointer<VCurveAngle> > VContainer::DataAnglesCurves() const
|
||||
{
|
||||
return DataVar<VCurveAngle>(VarType::SplineAngle);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VContainer::IsUnique(const QString &name)
|
||||
{
|
||||
|
|
|
@ -159,18 +159,19 @@ public:
|
|||
void AddLine(const quint32 &firstPointId, const quint32 &secondPointId);
|
||||
void AddArc(const quint32 &arcId, const quint32 &parentId = 0);
|
||||
|
||||
template <typename TLength>
|
||||
/**
|
||||
* @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 <typename T>
|
||||
void AddCurve(const quint32 &id, const quint32 &parentId = 0)
|
||||
{
|
||||
const QSharedPointer<VAbstractCurve> var = GeometricObject<VAbstractCurve>(id);
|
||||
AddVariable(var->name(), new TLength(id, parentId, var.data()));
|
||||
const QSharedPointer<T> curve = GeometricObject<T>(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 <typename T>
|
||||
|
@ -225,6 +226,8 @@ public:
|
|||
const QMap<QString, QSharedPointer<VArcLength> > DataLengthArcs() const;
|
||||
const QMap<QString, QSharedPointer<VLineAngle> > DataAngleLines() const;
|
||||
const QMap<QString, QSharedPointer<VArcRadius> > DataRadiusesArcs() const;
|
||||
const QMap<QString, QSharedPointer<VArcAngle> > DataAnglesArcs() const;
|
||||
const QMap<QString, QSharedPointer<VCurveAngle> > DataAnglesCurves() const;
|
||||
|
||||
static bool IsUnique(const QString &name);
|
||||
|
||||
|
|
|
@ -1486,7 +1486,14 @@ 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",
|
||||
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"));
|
||||
}
|
||||
|
||||
|
|
|
@ -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<QString, T> 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();
|
||||
|
|
|
@ -94,15 +94,19 @@ private:
|
|||
|
||||
VIndividualMeasurements *m;
|
||||
|
||||
void FillMeasurements();
|
||||
void FillIncrements();
|
||||
template <typename T>
|
||||
void FillTable(const QMap<QString, T> 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);
|
||||
|
|
|
@ -550,11 +550,11 @@
|
|||
</widget>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
<string>Lines angle</string>
|
||||
<string>Lines angles</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTableWidget" name="tableWidgetLinesAngle">
|
||||
<widget class="QTableWidget" name="tableWidgetLinesAngles">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
|
@ -589,7 +589,7 @@
|
|||
</widget>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
<attribute name="title">
|
||||
<string>Curves</string>
|
||||
<string>Lengths curves</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
|
@ -626,9 +626,48 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_6">
|
||||
<attribute name="title">
|
||||
<string>Angles curves</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTableWidget" name="tableWidgetAnglesCurves">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderCascadingSectionResizes">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||
<number>137</number>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Curve</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Angle</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_5">
|
||||
<attribute name="title">
|
||||
<string>Arcs</string>
|
||||
<string>Lengths arcs</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
|
@ -704,6 +743,45 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_7">
|
||||
<attribute name="title">
|
||||
<string>Angles arcs</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_9">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTableWidget" name="tableWidgetAnglesArcs">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderCascadingSectionResizes">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||
<number>137</number>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Arc</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Angle</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -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<VArcAngle>(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<VCurveAngle>(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);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -71,6 +71,8 @@ public slots:
|
|||
void Measurements();
|
||||
void LengthLines();
|
||||
void RadiusArcs();
|
||||
void AnglesArcs();
|
||||
void AnglesCurves();
|
||||
void LengthArcs();
|
||||
void LengthCurves();
|
||||
void AngleLines();
|
||||
|
|
|
@ -10,19 +10,19 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>390</width>
|
||||
<height>365</height>
|
||||
<height>449</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>390</width>
|
||||
<height>365</height>
|
||||
<height>449</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>390</width>
|
||||
<height>365</height>
|
||||
<height>449</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -349,6 +349,20 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonAnglesArcs">
|
||||
<property name="text">
|
||||
<string>Angles of arcs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonAnglesCurves">
|
||||
<property name="text">
|
||||
<string>Angles of curves</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -186,7 +186,6 @@ const QString depthWaistSecond_M = QStringLiteral("depth_waist_
|
|||
//variables
|
||||
const QString line_ = QStringLiteral("Line_");
|
||||
const QString angleLine_ = QStringLiteral("AngleLine_");
|
||||
const QString radiusArc_ = QStringLiteral("Radius");
|
||||
|
||||
//functions
|
||||
const QString sin_F = QStringLiteral("sin");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -242,7 +242,7 @@ void VToolArc::SetFormulaF1(const VFormula &value)
|
|||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(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<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(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);
|
||||
|
|
|
@ -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<VSplineLength>(spl1id, id);
|
||||
data->AddCurve<VSpline>(spl1id, id);
|
||||
|
||||
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve());
|
||||
spl2id = data->AddGObject(spline2);
|
||||
data->AddCurveLength<VSplineLength>(spl2id, id);
|
||||
data->AddCurve<VSpline>(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<VSplineLength>(spl1id, id);
|
||||
data->AddCurve<VSpline>(spl1id, id);
|
||||
|
||||
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve());
|
||||
data->UpdateGObject(spl2id, spline2);
|
||||
data->AddCurveLength<VSplineLength>(spl2id, id);
|
||||
data->AddCurve<VSpline>(spl2id, id);
|
||||
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
|
|
|
@ -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<VSplineLength>(splPath1id, id);
|
||||
data->AddCurve<VSplinePath>(splPath1id, id);
|
||||
|
||||
splPath2id = data->AddGObject(splPath2);
|
||||
data->AddCurveLength<VSplineLength>(splPath2id, id);
|
||||
data->AddCurve<VSplinePath>(splPath2id, id);
|
||||
}
|
||||
else
|
||||
{
|
||||
data->UpdateGObject(splPath1id, splPath1);
|
||||
data->AddCurveLength<VSplineLength>(splPath1id, id);
|
||||
data->AddCurve<VSplinePath>(splPath1id, id);
|
||||
|
||||
data->UpdateGObject(splPath2id, splPath2);
|
||||
data->AddCurveLength<VSplineLength>(splPath2id, id);
|
||||
data->AddCurve<VSplinePath>(splPath2id, id);
|
||||
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
|
|
|
@ -107,8 +107,8 @@ void VToolSpline::setDialog()
|
|||
const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(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<VSplineLength>(id);
|
||||
data->AddCurve<VSpline>(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
data->UpdateGObject(id, spline);
|
||||
data->AddCurveLength<VSplineLength>(id);
|
||||
data->AddCurve<VSpline>(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<VGObject> &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<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(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());
|
||||
|
|
|
@ -158,12 +158,12 @@ VToolSplinePath* VToolSplinePath::Create(const quint32 _id, VSplinePath *path, c
|
|||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
id = data->AddGObject(path);
|
||||
data->AddCurveLength<VSplineLength>(id);
|
||||
data->AddCurve<VSplinePath>(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
data->UpdateGObject(id, path);
|
||||
data->AddCurveLength<VSplineLength>(id);
|
||||
data->AddCurve<VSplinePath>(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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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()));
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,9 @@ public:
|
|||
virtual qreal GetLength() const =0;
|
||||
virtual QVector<QPointF> 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<QPointF> &points) const;
|
||||
private:
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -32,3 +32,13 @@
|
|||
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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -175,6 +175,9 @@ public:
|
|||
QPointF &spl2p3) const;
|
||||
|
||||
int Segment(const QPointF &p) const;
|
||||
|
||||
virtual qreal GetStartAngle () const;
|
||||
virtual qreal GetEndAngle () const;
|
||||
private:
|
||||
QSharedDataPointer<VSplinePathData> d;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user