Cut tools do not create subcurves anymore.
--HG-- branch : develop
This commit is contained in:
parent
5c487b7b78
commit
bb29984b4a
|
@ -68,7 +68,7 @@ VCurveVariable::~VCurveVariable()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VCurveVariable::Filter(quint32 id)
|
bool VCurveVariable::Filter(quint32 id)
|
||||||
{
|
{
|
||||||
if (d->parentId != 0)//Do not check if value zero
|
if (d->parentId != NULL_ID)//Do not check if value zero
|
||||||
{// Not all curves have parents. Only those who was created after cutting the parent curve.
|
{// Not all curves have parents. Only those who was created after cutting the parent curve.
|
||||||
return d->id == id || d->parentId == id;
|
return d->id == id || d->parentId == id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -372,10 +372,8 @@ void VContainer::AddLine(const quint32 &firstPointId, const quint32 &secondPoint
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VContainer::AddArc(const quint32 &id, const quint32 &parentId)
|
void VContainer::AddArc(const QSharedPointer<VArc> &arc, const quint32 &id, const quint32 &parentId)
|
||||||
{
|
{
|
||||||
const QSharedPointer<VArc> arc = GeometricObject<VArc>(id);
|
|
||||||
|
|
||||||
VArcLength *length = new VArcLength(id, parentId, arc.data(), *GetPatternUnit());
|
VArcLength *length = new VArcLength(id, parentId, arc.data(), *GetPatternUnit());
|
||||||
AddVariable(length->GetName(), length);
|
AddVariable(length->GetName(), length);
|
||||||
|
|
||||||
|
@ -674,3 +672,23 @@ const QHash<QString, QSharedPointer<VInternalVariable> > *VContainer::DataVariab
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VContainerData::~VContainerData()
|
VContainerData::~VContainerData()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VContainer::AddCurve(const QSharedPointer<VAbstractCurve> &curve, const quint32 &id, const quint32 &parentId)
|
||||||
|
{
|
||||||
|
const GOType curveType = curve->getType();
|
||||||
|
if (curveType != GOType::Spline && curveType != GOType::SplinePath &&
|
||||||
|
curveType != GOType::CubicBezier && curveType != GOType::CubicBezierPath)
|
||||||
|
{
|
||||||
|
throw VException(tr("Can't create a curve with type %1").arg(static_cast<int>(curveType)));
|
||||||
|
}
|
||||||
|
|
||||||
|
VSplineLength *length = new VSplineLength(id, parentId, curve.data(), *GetPatternUnit());
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -120,10 +120,10 @@ public:
|
||||||
quint32 AddGObject(VGObject *obj);
|
quint32 AddGObject(VGObject *obj);
|
||||||
quint32 AddDetail(const VDetail &detail);
|
quint32 AddDetail(const VDetail &detail);
|
||||||
void AddLine(const quint32 &firstPointId, const quint32 &secondPointId);
|
void AddLine(const quint32 &firstPointId, const quint32 &secondPointId);
|
||||||
void AddArc(const quint32 &arcId, const quint32 &parentId = 0);
|
void AddArc(const QSharedPointer<VArc> &arc, const quint32 &arcId, const quint32 &parentId = 0);
|
||||||
|
void AddCurve(const QSharedPointer<VAbstractCurve> &curve, const quint32 &id,
|
||||||
|
const quint32 &parentId = NULL_ID);
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
void AddCurve(const quint32 &id, const quint32 &parentId = 0);
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void AddVariable(const QString& name, T *var);
|
void AddVariable(const QString& name, T *var);
|
||||||
|
|
||||||
|
@ -259,21 +259,6 @@ QSharedPointer<T> VContainer::GetVariable(QString name) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
template <typename T>
|
|
||||||
void VContainer::AddCurve(const quint32 &id, const quint32 &parentId)
|
|
||||||
{
|
|
||||||
const QSharedPointer<T> curve = GeometricObject<T>(id);
|
|
||||||
VSplineLength *length = new VSplineLength(id, parentId, curve.data(), *GetPatternUnit());
|
|
||||||
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>
|
template <typename T>
|
||||||
void VContainer::AddVariable(const QString& name, T *var)
|
void VContainer::AddVariable(const QString& name, T *var)
|
||||||
|
|
|
@ -43,8 +43,7 @@
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogCutArc::DialogCutArc(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
DialogCutArc::DialogCutArc(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||||
: DialogTool(data, toolId, parent), ui(new Ui::DialogCutArc), formula(QString()), formulaBaseHeight(0),
|
: DialogTool(data, toolId, parent), ui(new Ui::DialogCutArc), formula(QString()), formulaBaseHeight(0)
|
||||||
ch1(NULL_ID), ch2(NULL_ID)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -62,7 +61,7 @@ DialogCutArc::DialogCutArc(const VContainer *data, const quint32 &toolId, QWidge
|
||||||
flagFormula = false;
|
flagFormula = false;
|
||||||
CheckState();
|
CheckState();
|
||||||
|
|
||||||
FillComboBoxArcs(ui->comboBoxArc, FillComboBox::NoChildren, ch1, ch2);
|
FillComboBoxArcs(ui->comboBoxArc);
|
||||||
FillComboBoxLineColors(ui->comboBoxColor);
|
FillComboBoxLineColors(ui->comboBoxColor);
|
||||||
|
|
||||||
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutArc::FXLength);
|
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutArc::FXLength);
|
||||||
|
@ -164,7 +163,7 @@ void DialogCutArc::closeEvent(QCloseEvent *event)
|
||||||
*/
|
*/
|
||||||
void DialogCutArc::setArcId(const quint32 &value)
|
void DialogCutArc::setArcId(const quint32 &value)
|
||||||
{
|
{
|
||||||
setCurrentArcId(ui->comboBoxArc, value, FillComboBox::NoChildren, ch1, ch2);
|
setCurrentArcId(ui->comboBoxArc, value);
|
||||||
|
|
||||||
VisToolCutArc *path = qobject_cast<VisToolCutArc *>(vis);
|
VisToolCutArc *path = qobject_cast<VisToolCutArc *>(vis);
|
||||||
SCASSERT(path != nullptr);
|
SCASSERT(path != nullptr);
|
||||||
|
@ -183,14 +182,6 @@ void DialogCutArc::SetColor(const QString &value)
|
||||||
ChangeCurrentData(ui->comboBoxColor, value);
|
ChangeCurrentData(ui->comboBoxColor, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void DialogCutArc::SetChildrenId(const quint32 &ch1, const quint32 &ch2)
|
|
||||||
{
|
|
||||||
this->ch1 = ch1;
|
|
||||||
this->ch2 = ch2;
|
|
||||||
FillComboBoxArcs(ui->comboBoxArc, FillComboBox::NoChildren, ch1, ch2);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief SetFormula set string with formula length
|
* @brief SetFormula set string with formula length
|
||||||
|
|
|
@ -57,8 +57,6 @@ public:
|
||||||
|
|
||||||
QString GetColor() const;
|
QString GetColor() const;
|
||||||
void SetColor(const QString &value);
|
void SetColor(const QString &value);
|
||||||
|
|
||||||
void SetChildrenId(const quint32 &ch1, const quint32 &ch2);
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
||||||
/**
|
/**
|
||||||
|
@ -87,9 +85,6 @@ private:
|
||||||
|
|
||||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||||
int formulaBaseHeight;
|
int formulaBaseHeight;
|
||||||
|
|
||||||
quint32 ch1;
|
|
||||||
quint32 ch2;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGCUTARC_H
|
#endif // DIALOGCUTARC_H
|
||||||
|
|
|
@ -42,8 +42,7 @@
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogCutSpline), formula(QString()), formulaBaseHeight(0),
|
:DialogTool(data, toolId, parent), ui(new Ui::DialogCutSpline), formula(QString()), formulaBaseHeight(0)
|
||||||
ch1(NULL_ID), ch2(NULL_ID)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -61,7 +60,7 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId,
|
||||||
flagFormula = false;
|
flagFormula = false;
|
||||||
CheckState();
|
CheckState();
|
||||||
|
|
||||||
FillComboBoxSplines(ui->comboBoxSpline, FillComboBox::NoChildren, ch1, ch2);
|
FillComboBoxSplines(ui->comboBoxSpline);
|
||||||
FillComboBoxLineColors(ui->comboBoxColor);
|
FillComboBoxLineColors(ui->comboBoxColor);
|
||||||
|
|
||||||
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutSpline::FXLength);
|
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutSpline::FXLength);
|
||||||
|
@ -120,7 +119,7 @@ void DialogCutSpline::SetFormula(const QString &value)
|
||||||
*/
|
*/
|
||||||
void DialogCutSpline::setSplineId(const quint32 &value)
|
void DialogCutSpline::setSplineId(const quint32 &value)
|
||||||
{
|
{
|
||||||
setCurrentSplineId(ui->comboBoxSpline, value, FillComboBox::NoChildren, ch1, ch2);
|
setCurrentSplineId(ui->comboBoxSpline, value);
|
||||||
|
|
||||||
VisToolCutSpline *path = qobject_cast<VisToolCutSpline *>(vis);
|
VisToolCutSpline *path = qobject_cast<VisToolCutSpline *>(vis);
|
||||||
SCASSERT(path != nullptr);
|
SCASSERT(path != nullptr);
|
||||||
|
@ -139,14 +138,6 @@ void DialogCutSpline::SetColor(const QString &value)
|
||||||
ChangeCurrentData(ui->comboBoxColor, value);
|
ChangeCurrentData(ui->comboBoxColor, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void DialogCutSpline::SetChildrenId(const quint32 &ch1, const quint32 &ch2)
|
|
||||||
{
|
|
||||||
this->ch1 = ch1;
|
|
||||||
this->ch2 = ch2;
|
|
||||||
FillComboBoxSplines(ui->comboBoxSpline, FillComboBox::NoChildren, ch1, ch2);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
|
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
|
||||||
|
|
|
@ -56,8 +56,6 @@ public:
|
||||||
|
|
||||||
QString GetColor() const;
|
QString GetColor() const;
|
||||||
void SetColor(const QString &value);
|
void SetColor(const QString &value);
|
||||||
|
|
||||||
void SetChildrenId(const quint32 &ch1, const quint32 &ch2);
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
||||||
/**
|
/**
|
||||||
|
@ -83,9 +81,6 @@ private:
|
||||||
|
|
||||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||||
int formulaBaseHeight;
|
int formulaBaseHeight;
|
||||||
|
|
||||||
quint32 ch1;
|
|
||||||
quint32 ch2;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGCUTSPLINE_H
|
#endif // DIALOGCUTSPLINE_H
|
||||||
|
|
|
@ -42,8 +42,7 @@
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogCutSplinePath), formula(QString()), formulaBaseHeight(0),
|
:DialogTool(data, toolId, parent), ui(new Ui::DialogCutSplinePath), formula(QString()), formulaBaseHeight(0)
|
||||||
ch1(NULL_ID), ch2(NULL_ID)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -61,7 +60,7 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &
|
||||||
flagFormula = false;
|
flagFormula = false;
|
||||||
CheckState();
|
CheckState();
|
||||||
|
|
||||||
FillComboBoxSplinesPath(ui->comboBoxSplinePath, FillComboBox::NoChildren, ch1, ch2);
|
FillComboBoxSplinesPath(ui->comboBoxSplinePath);
|
||||||
FillComboBoxLineColors(ui->comboBoxColor);
|
FillComboBoxLineColors(ui->comboBoxColor);
|
||||||
|
|
||||||
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutSplinePath::FXLength);
|
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutSplinePath::FXLength);
|
||||||
|
@ -120,7 +119,7 @@ void DialogCutSplinePath::SetFormula(const QString &value)
|
||||||
*/
|
*/
|
||||||
void DialogCutSplinePath::setSplinePathId(const quint32 &value)
|
void DialogCutSplinePath::setSplinePathId(const quint32 &value)
|
||||||
{
|
{
|
||||||
setCurrentSplinePathId(ui->comboBoxSplinePath, value, FillComboBox::NoChildren, ch1, ch2);
|
setCurrentSplinePathId(ui->comboBoxSplinePath, value);
|
||||||
|
|
||||||
VisToolCutSplinePath *path = qobject_cast<VisToolCutSplinePath *>(vis);
|
VisToolCutSplinePath *path = qobject_cast<VisToolCutSplinePath *>(vis);
|
||||||
SCASSERT(path != nullptr);
|
SCASSERT(path != nullptr);
|
||||||
|
@ -139,14 +138,6 @@ void DialogCutSplinePath::SetColor(const QString &value)
|
||||||
ChangeCurrentData(ui->comboBoxColor, value);
|
ChangeCurrentData(ui->comboBoxColor, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void DialogCutSplinePath::SetChildrenId(const quint32 &ch1, const quint32 &ch2)
|
|
||||||
{
|
|
||||||
this->ch1 = ch1;
|
|
||||||
this->ch2 = ch2;
|
|
||||||
FillComboBoxSplinesPath(ui->comboBoxSplinePath, FillComboBox::NoChildren, ch1, ch2);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
|
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
|
||||||
|
|
|
@ -56,8 +56,6 @@ public:
|
||||||
|
|
||||||
QString GetColor() const;
|
QString GetColor() const;
|
||||||
void SetColor(const QString &value);
|
void SetColor(const QString &value);
|
||||||
|
|
||||||
void SetChildrenId(const quint32 &ch1, const quint32 &ch2);
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
||||||
/**
|
/**
|
||||||
|
@ -83,9 +81,6 @@ private:
|
||||||
|
|
||||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||||
int formulaBaseHeight;
|
int formulaBaseHeight;
|
||||||
|
|
||||||
quint32 ch1;
|
|
||||||
quint32 ch2;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGCUTSPLINEPATH_H
|
#endif // DIALOGCUTSPLINEPATH_H
|
||||||
|
|
|
@ -132,7 +132,7 @@ void DialogTool::FillComboBoxArcs(QComboBox *box, FillComboBox rule, const quint
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogTool::FillComboBoxSplines(QComboBox *box, FillComboBox rule, const quint32 &ch1, const quint32 &ch2) const
|
void DialogTool::FillComboBoxSplines(QComboBox *box) const
|
||||||
{
|
{
|
||||||
SCASSERT(box != nullptr);
|
SCASSERT(box != nullptr);
|
||||||
box->blockSignals(true);
|
box->blockSignals(true);
|
||||||
|
@ -142,24 +142,11 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, FillComboBox rule, const qu
|
||||||
QMap<QString, quint32> list;
|
QMap<QString, quint32> list;
|
||||||
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||||
{
|
{
|
||||||
if (rule == FillComboBox::NoChildren)
|
if (i.key() != toolId)
|
||||||
{
|
{
|
||||||
if (i.key() != toolId && i.key() != ch1 && i.key() != ch2)
|
if (IsSpline(i.value()))
|
||||||
{
|
{
|
||||||
if (IsSpline(i.value()))
|
PrepareList<VAbstractCurve>(list, i.key());
|
||||||
{
|
|
||||||
PrepareList<VAbstractCurve>(list, i.key());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (i.key() != toolId)
|
|
||||||
{
|
|
||||||
if (IsSpline(i.value()))
|
|
||||||
{
|
|
||||||
PrepareList<VAbstractCurve>(list, i.key());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,8 +156,7 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, FillComboBox rule, const qu
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogTool::FillComboBoxSplinesPath(QComboBox *box, FillComboBox rule, const quint32 &ch1,
|
void DialogTool::FillComboBoxSplinesPath(QComboBox *box) const
|
||||||
const quint32 &ch2) const
|
|
||||||
{
|
{
|
||||||
SCASSERT(box != nullptr);
|
SCASSERT(box != nullptr);
|
||||||
box->blockSignals(true);
|
box->blockSignals(true);
|
||||||
|
@ -180,24 +166,11 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, FillComboBox rule, cons
|
||||||
QMap<QString, quint32> list;
|
QMap<QString, quint32> list;
|
||||||
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||||
{
|
{
|
||||||
if (rule == FillComboBox::NoChildren)
|
if (i.key() != toolId)
|
||||||
{
|
{
|
||||||
if (i.key() != toolId && i.key() != ch1 && i.key() != ch2)
|
if (IsSplinePath(i.value()))
|
||||||
{
|
{
|
||||||
if (IsSplinePath(i.value()))
|
PrepareList<VAbstractCurve>(list, i.key());
|
||||||
{
|
|
||||||
PrepareList<VAbstractCurve>(list, i.key());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (i.key() != toolId)
|
|
||||||
{
|
|
||||||
if (IsSplinePath(i.value()))
|
|
||||||
{
|
|
||||||
PrepareList<VAbstractCurve>(list, i.key());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -532,11 +505,10 @@ void DialogTool::setCurrentPointId(QComboBox *box, const quint32 &value, FillCom
|
||||||
/**
|
/**
|
||||||
* @brief setCurrentSplineId set current spline id in combobox
|
* @brief setCurrentSplineId set current spline id in combobox
|
||||||
*/
|
*/
|
||||||
void DialogTool::setCurrentSplineId(QComboBox *box, const quint32 &value, FillComboBox rule,
|
void DialogTool::setCurrentSplineId(QComboBox *box, const quint32 &value) const
|
||||||
const quint32 &ch1, const quint32 &ch2) const
|
|
||||||
{
|
{
|
||||||
SCASSERT(box != nullptr);
|
SCASSERT(box != nullptr);
|
||||||
FillComboBoxSplines(box, rule, ch1, ch2);
|
FillComboBoxSplines(box);
|
||||||
ChangeCurrentData(box, value);
|
ChangeCurrentData(box, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,11 +530,10 @@ void DialogTool::setCurrentArcId(QComboBox *box, const quint32 &value, FillCombo
|
||||||
* @param box combobox
|
* @param box combobox
|
||||||
* @param value splinePath id
|
* @param value splinePath id
|
||||||
*/
|
*/
|
||||||
void DialogTool::setCurrentSplinePathId(QComboBox *box, const quint32 &value, FillComboBox rule,
|
void DialogTool::setCurrentSplinePathId(QComboBox *box, const quint32 &value) const
|
||||||
const quint32 &ch1, const quint32 &ch2) const
|
|
||||||
{
|
{
|
||||||
SCASSERT(box != nullptr);
|
SCASSERT(box != nullptr);
|
||||||
FillComboBoxSplinesPath(box, rule, ch1, ch2);
|
FillComboBoxSplinesPath(box);
|
||||||
ChangeCurrentData(box, value);
|
ChangeCurrentData(box, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,10 +188,8 @@ protected:
|
||||||
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID)const;
|
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID)const;
|
||||||
void FillComboBoxArcs(QComboBox *box, FillComboBox rule = FillComboBox::Whole,
|
void FillComboBoxArcs(QComboBox *box, FillComboBox rule = FillComboBox::Whole,
|
||||||
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID)const;
|
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID)const;
|
||||||
void FillComboBoxSplines(QComboBox *box, FillComboBox rule = FillComboBox::Whole,
|
void FillComboBoxSplines(QComboBox *box)const;
|
||||||
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID)const;
|
void FillComboBoxSplinesPath(QComboBox *box)const;
|
||||||
void FillComboBoxSplinesPath(QComboBox *box, FillComboBox rule = FillComboBox::Whole,
|
|
||||||
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID)const;
|
|
||||||
void FillComboBoxCurves(QComboBox *box)const;
|
void FillComboBoxCurves(QComboBox *box)const;
|
||||||
void FillComboBoxTypeLine(QComboBox *box, const QMap<QString, QIcon> &stylesPics) const;
|
void FillComboBoxTypeLine(QComboBox *box, const QMap<QString, QIcon> &stylesPics) const;
|
||||||
void FillComboBoxLineColors(QComboBox *box)const;
|
void FillComboBoxLineColors(QComboBox *box)const;
|
||||||
|
@ -211,15 +209,11 @@ protected:
|
||||||
void setCurrentPointId(QComboBox *box, const quint32 &value,
|
void setCurrentPointId(QComboBox *box, const quint32 &value,
|
||||||
FillComboBox rule = FillComboBox::NoChildren,
|
FillComboBox rule = FillComboBox::NoChildren,
|
||||||
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID) const;
|
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID) const;
|
||||||
void setCurrentSplineId(QComboBox *box, const quint32 &value,
|
void setCurrentSplineId(QComboBox *box, const quint32 &value) const;
|
||||||
FillComboBox rule = FillComboBox::NoChildren,
|
|
||||||
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID) const;
|
|
||||||
void setCurrentArcId(QComboBox *box, const quint32 &value,
|
void setCurrentArcId(QComboBox *box, const quint32 &value,
|
||||||
FillComboBox rule = FillComboBox::NoChildren,
|
FillComboBox rule = FillComboBox::NoChildren,
|
||||||
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID) const;
|
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID) const;
|
||||||
void setCurrentSplinePathId(QComboBox *box, const quint32 &value,
|
void setCurrentSplinePathId(QComboBox *box, const quint32 &value) const;
|
||||||
FillComboBox rule = FillComboBox::NoChildren,
|
|
||||||
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID) const;
|
|
||||||
void setCurrentCurveId(QComboBox *box, const quint32 &value) const;
|
void setCurrentCurveId(QComboBox *box, const quint32 &value) const;
|
||||||
|
|
||||||
quint32 getCurrentObjectId(QComboBox *box) const;
|
quint32 getCurrentObjectId(QComboBox *box) const;
|
||||||
|
|
|
@ -131,18 +131,18 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 ¢er, QString &ra
|
||||||
calcF1 = CheckFormula(_id, f1, data);
|
calcF1 = CheckFormula(_id, f1, data);
|
||||||
calcF2 = CheckFormula(_id, f2, data);
|
calcF2 = CheckFormula(_id, f2, data);
|
||||||
|
|
||||||
VPointF c = *data->GeometricObject<VPointF>(center);
|
const VPointF c = *data->GeometricObject<VPointF>(center);
|
||||||
VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 );
|
VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 );
|
||||||
quint32 id = _id;
|
quint32 id = _id;
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
id = data->AddGObject(arc);
|
id = data->AddGObject(arc);
|
||||||
data->AddArc(id);
|
data->AddArc(data->GeometricObject<VArc>(id), id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data->UpdateGObject(id, arc);
|
data->UpdateGObject(id, arc);
|
||||||
data->AddArc(id);
|
data->AddArc(data->GeometricObject<VArc>(id), id);
|
||||||
if (parse != Document::FullParse)
|
if (parse != Document::FullParse)
|
||||||
{
|
{
|
||||||
doc->UpdateToolData(id, data);
|
doc->UpdateToolData(id, data);
|
||||||
|
|
|
@ -100,18 +100,18 @@ VToolArcWithLength *VToolArcWithLength::Create(const quint32 _id, const quint32
|
||||||
calcLength = qApp->toPixel(CheckFormula(_id, length, data));
|
calcLength = qApp->toPixel(CheckFormula(_id, length, data));
|
||||||
calcF1 = CheckFormula(_id, f1, data);
|
calcF1 = CheckFormula(_id, f1, data);
|
||||||
|
|
||||||
VPointF c = *data->GeometricObject<VPointF>(center);
|
const VPointF c = *data->GeometricObject<VPointF>(center);
|
||||||
VArc *arc = new VArc(calcLength, length, c, calcRadius, radius, calcF1, f1);
|
VArc *arc = new VArc(calcLength, length, c, calcRadius, radius, calcF1, f1);
|
||||||
quint32 id = _id;
|
quint32 id = _id;
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
id = data->AddGObject(arc);
|
id = data->AddGObject(arc);
|
||||||
data->AddArc(id);
|
data->AddArc(data->GeometricObject<VArc>(id), id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data->UpdateGObject(id, arc);
|
data->UpdateGObject(id, arc);
|
||||||
data->AddArc(id);
|
data->AddArc(data->GeometricObject<VArc>(id), id);
|
||||||
if (parse != Document::FullParse)
|
if (parse != Document::FullParse)
|
||||||
{
|
{
|
||||||
doc->UpdateToolData(id, data);
|
doc->UpdateToolData(id, data);
|
||||||
|
|
|
@ -91,12 +91,12 @@ VToolCubicBezier *VToolCubicBezier::Create(const quint32 _id, VCubicBezier *spli
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
id = data->AddGObject(spline);
|
id = data->AddGObject(spline);
|
||||||
data->AddCurve<VCubicBezier>(id);
|
data->AddCurve(data->GeometricObject<VAbstractCurve>(id), id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data->UpdateGObject(id, spline);
|
data->UpdateGObject(id, spline);
|
||||||
data->AddCurve<VCubicBezier>(id);
|
data->AddCurve(data->GeometricObject<VAbstractCurve>(id), id);
|
||||||
if (parse != Document::FullParse)
|
if (parse != Document::FullParse)
|
||||||
{
|
{
|
||||||
doc->UpdateToolData(id, data);
|
doc->UpdateToolData(id, data);
|
||||||
|
|
|
@ -92,12 +92,12 @@ VToolCubicBezierPath *VToolCubicBezierPath::Create(const quint32 _id, VCubicBezi
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
id = data->AddGObject(path);
|
id = data->AddGObject(path);
|
||||||
data->AddCurve<VCubicBezierPath>(id);
|
data->AddCurve(data->GeometricObject<VAbstractCurve>(id), id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data->UpdateGObject(id, path);
|
data->UpdateGObject(id, path);
|
||||||
data->AddCurve<VCubicBezierPath>(id);
|
data->AddCurve(data->GeometricObject<VAbstractCurve>(id), id);
|
||||||
if (parse != Document::FullParse)
|
if (parse != Document::FullParse)
|
||||||
{
|
{
|
||||||
doc->UpdateToolData(id, data);
|
doc->UpdateToolData(id, data);
|
||||||
|
|
|
@ -162,12 +162,12 @@ VToolSpline* VToolSpline::Create(const quint32 _id, VSpline *spline, const QStri
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
id = data->AddGObject(spline);
|
id = data->AddGObject(spline);
|
||||||
data->AddCurve<VSpline>(id);
|
data->AddCurve(data->GeometricObject<VAbstractCurve>(id), id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data->UpdateGObject(id, spline);
|
data->UpdateGObject(id, spline);
|
||||||
data->AddCurve<VSpline>(id);
|
data->AddCurve(data->GeometricObject<VAbstractCurve>(id), id);
|
||||||
if (parse != Document::FullParse)
|
if (parse != Document::FullParse)
|
||||||
{
|
{
|
||||||
doc->UpdateToolData(id, data);
|
doc->UpdateToolData(id, data);
|
||||||
|
|
|
@ -166,12 +166,12 @@ VToolSplinePath* VToolSplinePath::Create(const quint32 _id, VSplinePath *path, c
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
id = data->AddGObject(path);
|
id = data->AddGObject(path);
|
||||||
data->AddCurve<VSplinePath>(id);
|
data->AddCurve(data->GeometricObject<VAbstractCurve>(id), id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data->UpdateGObject(id, path);
|
data->UpdateGObject(id, path);
|
||||||
data->AddCurve<VSplinePath>(id);
|
data->AddCurve(data->GeometricObject<VAbstractCurve>(id), id);
|
||||||
if (parse != Document::FullParse)
|
if (parse != Document::FullParse)
|
||||||
{
|
{
|
||||||
doc->UpdateToolData(id, data);
|
doc->UpdateToolData(id, data);
|
||||||
|
|
|
@ -32,14 +32,10 @@
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VToolCut::VToolCut(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
VToolCut::VToolCut(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||||
const quint32 &curveCutId, const quint32 &curve1id, const quint32 &curve2id, const QString &color,
|
const quint32 &curveCutId, const QString &color, QGraphicsItem *parent)
|
||||||
QGraphicsItem *parent)
|
:VToolSinglePoint(doc, data, id, parent), formula(formula), curveCutId(curveCutId), detailsMode(false)
|
||||||
:VToolSinglePoint(doc, data, id, parent), formula(formula),
|
|
||||||
curveCutId(curveCutId), curve1id(curve1id), curve2id(curve2id), detailsMode(false)
|
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(curveCutId != 0, Q_FUNC_INFO, "curveCutId == 0"); //-V654 //-V712
|
Q_ASSERT_X(curveCutId != 0, Q_FUNC_INFO, "curveCutId == 0"); //-V654 //-V712
|
||||||
Q_ASSERT_X(curve1id != 0, Q_FUNC_INFO, "curve1id == 0"); //-V654 //-V712
|
|
||||||
Q_ASSERT_X(curve2id != 0, Q_FUNC_INFO, "curve2id == 0"); //-V654 //-V712
|
|
||||||
|
|
||||||
lineColor = color;
|
lineColor = color;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,8 +39,7 @@ class VToolCut : public VToolSinglePoint
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VToolCut(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
VToolCut(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||||
const quint32 &curveCutId,
|
const quint32 &curveCutId, const QString &color, QGraphicsItem * parent = nullptr);
|
||||||
const quint32 &curve1id, const quint32 &curve2id, const QString &color, QGraphicsItem * parent = nullptr);
|
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Tool::Cut)};
|
enum { Type = UserType + static_cast<int>(Tool::Cut)};
|
||||||
|
|
||||||
|
@ -59,9 +58,6 @@ protected:
|
||||||
QString formula;
|
QString formula;
|
||||||
|
|
||||||
quint32 curveCutId;
|
quint32 curveCutId;
|
||||||
quint32 curve1id;
|
|
||||||
quint32 curve2id;
|
|
||||||
|
|
||||||
bool detailsMode;
|
bool detailsMode;
|
||||||
|
|
||||||
void RefreshGeometry();
|
void RefreshGeometry();
|
||||||
|
|
|
@ -44,15 +44,14 @@ const QString VToolCutArc::ToolType = QStringLiteral("cutArc");
|
||||||
* @param id object id in container.
|
* @param id object id in container.
|
||||||
* @param formula string with formula length first arc.
|
* @param formula string with formula length first arc.
|
||||||
* @param arcId id arc in data container.
|
* @param arcId id arc in data container.
|
||||||
* @param arc1id id first cutting arc.
|
* @param color arc color.
|
||||||
* @param arc2id id second cutting arc.
|
|
||||||
* @param typeCreation way we create this tool.
|
* @param typeCreation way we create this tool.
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VToolCutArc::VToolCutArc(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
VToolCutArc::VToolCutArc(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||||
const quint32 &arcId, const quint32 &arc1id, const quint32 &arc2id, const QString &color,
|
const quint32 &arcId, const QString &color, const Source &typeCreation,
|
||||||
const Source &typeCreation, QGraphicsItem * parent)
|
QGraphicsItem * parent)
|
||||||
:VToolCut(doc, data, id, formula, arcId, arc1id, arc2id, color, parent)
|
:VToolCut(doc, data, id, formula, arcId, color, parent)
|
||||||
{
|
{
|
||||||
ToolCreation(typeCreation);
|
ToolCreation(typeCreation);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +66,6 @@ void VToolCutArc::setDialog()
|
||||||
DialogCutArc *dialogTool = qobject_cast<DialogCutArc*>(dialog);
|
DialogCutArc *dialogTool = qobject_cast<DialogCutArc*>(dialog);
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||||
dialogTool->SetChildrenId(curve1id, curve2id);
|
|
||||||
dialogTool->SetFormula(formula);
|
dialogTool->SetFormula(formula);
|
||||||
dialogTool->setArcId(curveCutId);
|
dialogTool->setArcId(curveCutId);
|
||||||
dialogTool->SetPointName(point->name());
|
dialogTool->SetPointName(point->name());
|
||||||
|
@ -129,28 +127,20 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS
|
||||||
QPointF point = arc->CutArc(qApp->toPixel(result), arc1, arc2);
|
QPointF point = arc->CutArc(qApp->toPixel(result), arc1, arc2);
|
||||||
|
|
||||||
quint32 id = _id;
|
quint32 id = _id;
|
||||||
quint32 arc1id = 0;
|
VPointF *p = new VPointF(point, pointName, mx, my);
|
||||||
quint32 arc2id = 0;
|
auto a1 = QSharedPointer<VArc>(new VArc(arc1));
|
||||||
|
auto a2 = QSharedPointer<VArc>(new VArc(arc2));
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
id = data->AddGObject(new VPointF(point, pointName, mx, my));
|
id = data->AddGObject(p);
|
||||||
arc1id = data->AddGObject(new VArc(arc1));
|
data->AddArc(a1, NULL_ID, id);
|
||||||
arc2id = data->AddGObject(new VArc(arc2));
|
data->AddArc(a2, NULL_ID, id);
|
||||||
|
|
||||||
data->AddArc(arc1id, id);
|
|
||||||
data->AddArc(arc2id, id);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data->UpdateGObject(id, new VPointF(point, pointName, mx, my));
|
data->UpdateGObject(id, p);
|
||||||
arc1id = id + 1;
|
data->AddArc(a1, NULL_ID, id);
|
||||||
arc2id = id + 2;
|
data->AddArc(a2, NULL_ID, id);
|
||||||
|
|
||||||
data->UpdateGObject(arc1id, new VArc(arc1));
|
|
||||||
data->UpdateGObject(arc2id, new VArc(arc2));
|
|
||||||
|
|
||||||
data->AddArc(arc1id, id);
|
|
||||||
data->AddArc(arc2id, id);
|
|
||||||
|
|
||||||
if (parse != Document::FullParse)
|
if (parse != Document::FullParse)
|
||||||
{
|
{
|
||||||
|
@ -161,12 +151,10 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS
|
||||||
VDrawTool::AddRecord(id, Tool::CutArc, doc);
|
VDrawTool::AddRecord(id, Tool::CutArc, doc);
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VToolCutArc *point = new VToolCutArc(doc, data, id, formula, arcId, arc1id, arc2id, color, typeCreation);
|
VToolCutArc *point = new VToolCutArc(doc, data, id, formula, arcId, color, typeCreation);
|
||||||
scene->addItem(point);
|
scene->addItem(point);
|
||||||
InitToolConnections(scene, point);
|
InitToolConnections(scene, point);
|
||||||
doc->AddTool(id, point);
|
doc->AddTool(id, point);
|
||||||
doc->AddTool(arc1id, point);
|
|
||||||
doc->AddTool(arc2id, point);
|
|
||||||
doc->IncrementReferens(arc->getIdTool());
|
doc->IncrementReferens(arc->getIdTool());
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,8 +39,7 @@ class VToolCutArc : public VToolCut
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VToolCutArc(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
VToolCutArc(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||||
const quint32 &arcId,
|
const quint32 &arcId, const QString &color, const Source &typeCreation,
|
||||||
const quint32 &arc1id, const quint32 &arc2id, const QString &color, const Source &typeCreation,
|
|
||||||
QGraphicsItem * parent = nullptr);
|
QGraphicsItem * parent = nullptr);
|
||||||
virtual void setDialog() Q_DECL_OVERRIDE;
|
virtual void setDialog() Q_DECL_OVERRIDE;
|
||||||
static VToolCutArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data);
|
static VToolCutArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data);
|
||||||
|
|
|
@ -45,13 +45,14 @@ const QString VToolCutSpline::AttrSpline = QStringLiteral("spline");
|
||||||
* @param id object id in container.
|
* @param id object id in container.
|
||||||
* @param formula string with formula length first spline.
|
* @param formula string with formula length first spline.
|
||||||
* @param splineId id spline in data container.
|
* @param splineId id spline in data container.
|
||||||
|
* @param color spline color.
|
||||||
* @param typeCreation way we create this tool.
|
* @param typeCreation way we create this tool.
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VToolCutSpline::VToolCutSpline(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
VToolCutSpline::VToolCutSpline(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||||
const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id,
|
const quint32 &splineId, const QString &color, const Source &typeCreation,
|
||||||
const QString &color, const Source &typeCreation, QGraphicsItem *parent)
|
QGraphicsItem *parent)
|
||||||
:VToolCut(doc, data, id, formula, splineId, spl1id, spl2id, color, parent)
|
:VToolCut(doc, data, id, formula, splineId, color, parent)
|
||||||
{
|
{
|
||||||
ToolCreation(typeCreation);
|
ToolCreation(typeCreation);
|
||||||
}
|
}
|
||||||
|
@ -66,7 +67,6 @@ void VToolCutSpline::setDialog()
|
||||||
DialogCutSpline *dialogTool = qobject_cast<DialogCutSpline*>(dialog);
|
DialogCutSpline *dialogTool = qobject_cast<DialogCutSpline*>(dialog);
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||||
dialogTool->SetChildrenId(curve1id, curve2id);
|
|
||||||
dialogTool->SetFormula(formula);
|
dialogTool->SetFormula(formula);
|
||||||
dialogTool->setSplineId(curveCutId);
|
dialogTool->setSplineId(curveCutId);
|
||||||
dialogTool->SetPointName(point->name());
|
dialogTool->SetPointName(point->name());
|
||||||
|
@ -128,36 +128,21 @@ VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointNa
|
||||||
QPointF point = spl->CutSpline(qApp->toPixel(result), spl1p2, spl1p3, spl2p2, spl2p3);
|
QPointF point = spl->CutSpline(qApp->toPixel(result), spl1p2, spl1p3, spl2p2, spl2p3);
|
||||||
|
|
||||||
quint32 id = _id;
|
quint32 id = _id;
|
||||||
quint32 spl1id = 0;
|
VPointF *p = new VPointF(point, pointName, mx, my);
|
||||||
quint32 spl2id = 0;
|
auto spline1 = QSharedPointer<VAbstractCurve>(new VSpline(spl->GetP1(), spl1p2, spl1p3, *p));
|
||||||
|
auto spline2 = QSharedPointer<VAbstractCurve>(new VSpline(*p, spl2p2, spl2p3, spl->GetP4()));
|
||||||
|
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
VPointF *p = new VPointF(point, pointName, mx, my);
|
|
||||||
id = data->AddGObject(p);
|
id = data->AddGObject(p);
|
||||||
|
data->AddCurve(spline1, NULL_ID, id);
|
||||||
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p);
|
data->AddCurve(spline2, NULL_ID, id);
|
||||||
spl1id = data->AddGObject(spline1);
|
|
||||||
data->AddCurve<VSpline>(spl1id, id);
|
|
||||||
|
|
||||||
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4());
|
|
||||||
spl2id = data->AddGObject(spline2);
|
|
||||||
data->AddCurve<VSpline>(spl2id, id);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VPointF *p = new VPointF(point, pointName, mx, my);
|
|
||||||
data->UpdateGObject(id, p);
|
data->UpdateGObject(id, p);
|
||||||
|
data->AddCurve(spline1, NULL_ID, id);
|
||||||
spl1id = id + 1;
|
data->AddCurve(spline2, NULL_ID, id);
|
||||||
spl2id = id + 2;
|
|
||||||
|
|
||||||
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p);
|
|
||||||
data->UpdateGObject(spl1id, spline1);
|
|
||||||
data->AddCurve<VSpline>(spl1id, id);
|
|
||||||
|
|
||||||
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4());
|
|
||||||
data->UpdateGObject(spl2id, spline2);
|
|
||||||
data->AddCurve<VSpline>(spl2id, id);
|
|
||||||
|
|
||||||
if (parse != Document::FullParse)
|
if (parse != Document::FullParse)
|
||||||
{
|
{
|
||||||
|
@ -167,13 +152,10 @@ VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointNa
|
||||||
VDrawTool::AddRecord(id, Tool::CutSpline, doc);
|
VDrawTool::AddRecord(id, Tool::CutSpline, doc);
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, spl1id, spl2id, color,
|
VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, color, typeCreation);
|
||||||
typeCreation);
|
|
||||||
scene->addItem(point);
|
scene->addItem(point);
|
||||||
InitToolConnections(scene, point);
|
InitToolConnections(scene, point);
|
||||||
doc->AddTool(id, point);
|
doc->AddTool(id, point);
|
||||||
doc->AddTool(spl1id, point);
|
|
||||||
doc->AddTool(spl2id, point);
|
|
||||||
doc->IncrementReferens(spl->getIdTool());
|
doc->IncrementReferens(spl->getIdTool());
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,8 @@ class VToolCutSpline : public VToolCut
|
||||||
public:
|
public:
|
||||||
|
|
||||||
VToolCutSpline(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
VToolCutSpline(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||||
const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id, const QString &color,
|
const quint32 &splineId, const QString &color, const Source &typeCreation,
|
||||||
const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
QGraphicsItem * parent = nullptr);
|
||||||
virtual void setDialog() Q_DECL_OVERRIDE;
|
virtual void setDialog() Q_DECL_OVERRIDE;
|
||||||
static VToolCutSpline *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
static VToolCutSpline *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||||
VContainer *data);
|
VContainer *data);
|
||||||
|
|
|
@ -45,16 +45,14 @@ const QString VToolCutSplinePath::AttrSplinePath = QStringLiteral("splinePath");
|
||||||
* @param id object id in container.
|
* @param id object id in container.
|
||||||
* @param formula string with formula length first splinePath.
|
* @param formula string with formula length first splinePath.
|
||||||
* @param splinePathId id splinePath (we cut this splinePath) in data container.
|
* @param splinePathId id splinePath (we cut this splinePath) in data container.
|
||||||
* @param splPath1id id first splinePath after cutting.
|
* @param color spline path color.
|
||||||
* @param splPath2id id second splinePath after cutting.
|
|
||||||
* @param typeCreation way we create this tool.
|
* @param typeCreation way we create this tool.
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VToolCutSplinePath::VToolCutSplinePath(VAbstractPattern *doc, VContainer *data, const quint32 &id,
|
VToolCutSplinePath::VToolCutSplinePath(VAbstractPattern *doc, VContainer *data, const quint32 &id,
|
||||||
const QString &formula, const quint32 &splinePathId,
|
const QString &formula, const quint32 &splinePathId,
|
||||||
const quint32 &splPath1id, const quint32 &splPath2id, const QString &color,
|
const QString &color, const Source &typeCreation, QGraphicsItem *parent)
|
||||||
const Source &typeCreation, QGraphicsItem *parent)
|
:VToolCut(doc, data, id, formula, splinePathId, color, parent)
|
||||||
:VToolCut(doc, data, id, formula, splinePathId, splPath1id, splPath2id, color, parent)
|
|
||||||
{
|
{
|
||||||
ToolCreation(typeCreation);
|
ToolCreation(typeCreation);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +67,6 @@ void VToolCutSplinePath::setDialog()
|
||||||
DialogCutSplinePath *dialogTool = qobject_cast<DialogCutSplinePath*>(dialog);
|
DialogCutSplinePath *dialogTool = qobject_cast<DialogCutSplinePath*>(dialog);
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||||
dialogTool->SetChildrenId(curve1id, curve2id);
|
|
||||||
dialogTool->SetFormula(formula);
|
dialogTool->SetFormula(formula);
|
||||||
dialogTool->setSplinePathId(curveCutId);
|
dialogTool->setSplinePathId(curveCutId);
|
||||||
dialogTool->SetPointName(point->name());
|
dialogTool->SetPointName(point->name());
|
||||||
|
@ -143,30 +140,16 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
id = data->AddGObject(p);
|
id = data->AddGObject(p);
|
||||||
|
|
||||||
|
data->AddCurve(QSharedPointer<VAbstractCurve>(splPath1), NULL_ID, id);
|
||||||
|
data->AddCurve(QSharedPointer<VAbstractCurve>(splPath2), NULL_ID, id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data->UpdateGObject(id, p);
|
data->UpdateGObject(id, p);
|
||||||
}
|
|
||||||
|
|
||||||
quint32 splPath1id = id + 1;
|
data->AddCurve(QSharedPointer<VAbstractCurve>(splPath1), NULL_ID, id);
|
||||||
quint32 splPath2id = id + 2;
|
data->AddCurve(QSharedPointer<VAbstractCurve>(splPath2), NULL_ID, id);
|
||||||
|
|
||||||
if (typeCreation == Source::FromGui)
|
|
||||||
{
|
|
||||||
splPath1id = data->AddGObject(splPath1);
|
|
||||||
data->AddCurve<VSplinePath>(splPath1id, id);
|
|
||||||
|
|
||||||
splPath2id = data->AddGObject(splPath2);
|
|
||||||
data->AddCurve<VSplinePath>(splPath2id, id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data->UpdateGObject(splPath1id, splPath1);
|
|
||||||
data->AddCurve<VSplinePath>(splPath1id, id);
|
|
||||||
|
|
||||||
data->UpdateGObject(splPath2id, splPath2);
|
|
||||||
data->AddCurve<VSplinePath>(splPath2id, id);
|
|
||||||
|
|
||||||
if (parse != Document::FullParse)
|
if (parse != Document::FullParse)
|
||||||
{
|
{
|
||||||
|
@ -177,13 +160,10 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString
|
||||||
VDrawTool::AddRecord(id, Tool::CutSplinePath, doc);
|
VDrawTool::AddRecord(id, Tool::CutSplinePath, doc);
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, splPath1id,
|
VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, color, typeCreation);
|
||||||
splPath2id, color, typeCreation);
|
|
||||||
scene->addItem(point);
|
scene->addItem(point);
|
||||||
InitToolConnections(scene, point);
|
InitToolConnections(scene, point);
|
||||||
doc->AddTool(id, point);
|
doc->AddTool(id, point);
|
||||||
doc->AddTool(splPath1id, point);
|
|
||||||
doc->AddTool(splPath2id, point);
|
|
||||||
doc->IncrementReferens(splPath->getIdTool());
|
doc->IncrementReferens(splPath->getIdTool());
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,8 @@ class VToolCutSplinePath : public VToolCut
|
||||||
public:
|
public:
|
||||||
|
|
||||||
VToolCutSplinePath(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
VToolCutSplinePath(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||||
const quint32 &splinePathId, const quint32 &splPath1id, const quint32 &splPath2id,
|
const quint32 &splinePathId, const QString &color, const Source &typeCreation,
|
||||||
const QString &color, const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
QGraphicsItem * parent = nullptr);
|
||||||
virtual void setDialog() Q_DECL_OVERRIDE;
|
virtual void setDialog() Q_DECL_OVERRIDE;
|
||||||
static VToolCutSplinePath *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
static VToolCutSplinePath *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||||
VContainer *data);
|
VContainer *data);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user