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)
|
||||
{
|
||||
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.
|
||||
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());
|
||||
AddVariable(length->GetName(), length);
|
||||
|
||||
|
@ -674,3 +672,23 @@ const QHash<QString, QSharedPointer<VInternalVariable> > *VContainer::DataVariab
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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 AddDetail(const VDetail &detail);
|
||||
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>
|
||||
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>
|
||||
void VContainer::AddVariable(const QString& name, T *var)
|
||||
|
|
|
@ -43,8 +43,7 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogCutArc::DialogCutArc(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
: DialogTool(data, toolId, parent), ui(new Ui::DialogCutArc), formula(QString()), formulaBaseHeight(0),
|
||||
ch1(NULL_ID), ch2(NULL_ID)
|
||||
: DialogTool(data, toolId, parent), ui(new Ui::DialogCutArc), formula(QString()), formulaBaseHeight(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -62,7 +61,7 @@ DialogCutArc::DialogCutArc(const VContainer *data, const quint32 &toolId, QWidge
|
|||
flagFormula = false;
|
||||
CheckState();
|
||||
|
||||
FillComboBoxArcs(ui->comboBoxArc, FillComboBox::NoChildren, ch1, ch2);
|
||||
FillComboBoxArcs(ui->comboBoxArc);
|
||||
FillComboBoxLineColors(ui->comboBoxColor);
|
||||
|
||||
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutArc::FXLength);
|
||||
|
@ -164,7 +163,7 @@ void DialogCutArc::closeEvent(QCloseEvent *event)
|
|||
*/
|
||||
void DialogCutArc::setArcId(const quint32 &value)
|
||||
{
|
||||
setCurrentArcId(ui->comboBoxArc, value, FillComboBox::NoChildren, ch1, ch2);
|
||||
setCurrentArcId(ui->comboBoxArc, value);
|
||||
|
||||
VisToolCutArc *path = qobject_cast<VisToolCutArc *>(vis);
|
||||
SCASSERT(path != nullptr);
|
||||
|
@ -183,14 +182,6 @@ void DialogCutArc::SetColor(const QString &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
|
||||
|
|
|
@ -57,8 +57,6 @@ public:
|
|||
|
||||
QString GetColor() const;
|
||||
void SetColor(const QString &value);
|
||||
|
||||
void SetChildrenId(const quint32 &ch1, const quint32 &ch2);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
||||
/**
|
||||
|
@ -87,9 +85,6 @@ private:
|
|||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
|
||||
quint32 ch1;
|
||||
quint32 ch2;
|
||||
};
|
||||
|
||||
#endif // DIALOGCUTARC_H
|
||||
|
|
|
@ -42,8 +42,7 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogCutSpline), formula(QString()), formulaBaseHeight(0),
|
||||
ch1(NULL_ID), ch2(NULL_ID)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogCutSpline), formula(QString()), formulaBaseHeight(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -61,7 +60,7 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId,
|
|||
flagFormula = false;
|
||||
CheckState();
|
||||
|
||||
FillComboBoxSplines(ui->comboBoxSpline, FillComboBox::NoChildren, ch1, ch2);
|
||||
FillComboBoxSplines(ui->comboBoxSpline);
|
||||
FillComboBoxLineColors(ui->comboBoxColor);
|
||||
|
||||
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutSpline::FXLength);
|
||||
|
@ -120,7 +119,7 @@ void DialogCutSpline::SetFormula(const QString &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);
|
||||
SCASSERT(path != nullptr);
|
||||
|
@ -139,14 +138,6 @@ void DialogCutSpline::SetColor(const QString &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.
|
||||
|
|
|
@ -56,8 +56,6 @@ public:
|
|||
|
||||
QString GetColor() const;
|
||||
void SetColor(const QString &value);
|
||||
|
||||
void SetChildrenId(const quint32 &ch1, const quint32 &ch2);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
||||
/**
|
||||
|
@ -83,9 +81,6 @@ private:
|
|||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
|
||||
quint32 ch1;
|
||||
quint32 ch2;
|
||||
};
|
||||
|
||||
#endif // DIALOGCUTSPLINE_H
|
||||
|
|
|
@ -42,8 +42,7 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogCutSplinePath), formula(QString()), formulaBaseHeight(0),
|
||||
ch1(NULL_ID), ch2(NULL_ID)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogCutSplinePath), formula(QString()), formulaBaseHeight(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -61,7 +60,7 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &
|
|||
flagFormula = false;
|
||||
CheckState();
|
||||
|
||||
FillComboBoxSplinesPath(ui->comboBoxSplinePath, FillComboBox::NoChildren, ch1, ch2);
|
||||
FillComboBoxSplinesPath(ui->comboBoxSplinePath);
|
||||
FillComboBoxLineColors(ui->comboBoxColor);
|
||||
|
||||
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutSplinePath::FXLength);
|
||||
|
@ -120,7 +119,7 @@ void DialogCutSplinePath::SetFormula(const QString &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);
|
||||
SCASSERT(path != nullptr);
|
||||
|
@ -139,14 +138,6 @@ void DialogCutSplinePath::SetColor(const QString &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.
|
||||
|
|
|
@ -56,8 +56,6 @@ public:
|
|||
|
||||
QString GetColor() const;
|
||||
void SetColor(const QString &value);
|
||||
|
||||
void SetChildrenId(const quint32 &ch1, const quint32 &ch2);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
||||
/**
|
||||
|
@ -83,9 +81,6 @@ private:
|
|||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
|
||||
quint32 ch1;
|
||||
quint32 ch2;
|
||||
};
|
||||
|
||||
#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);
|
||||
box->blockSignals(true);
|
||||
|
@ -142,24 +142,11 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, FillComboBox rule, const qu
|
|||
QMap<QString, quint32> list;
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i.key() != toolId)
|
||||
{
|
||||
if (IsSpline(i.value()))
|
||||
{
|
||||
PrepareList<VAbstractCurve>(list, i.key());
|
||||
}
|
||||
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,
|
||||
const quint32 &ch2) const
|
||||
void DialogTool::FillComboBoxSplinesPath(QComboBox *box) const
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
box->blockSignals(true);
|
||||
|
@ -180,24 +166,11 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, FillComboBox rule, cons
|
|||
QMap<QString, quint32> list;
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i.key() != toolId)
|
||||
{
|
||||
if (IsSplinePath(i.value()))
|
||||
{
|
||||
PrepareList<VAbstractCurve>(list, i.key());
|
||||
}
|
||||
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
|
||||
*/
|
||||
void DialogTool::setCurrentSplineId(QComboBox *box, const quint32 &value, FillComboBox rule,
|
||||
const quint32 &ch1, const quint32 &ch2) const
|
||||
void DialogTool::setCurrentSplineId(QComboBox *box, const quint32 &value) const
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
FillComboBoxSplines(box, rule, ch1, ch2);
|
||||
FillComboBoxSplines(box);
|
||||
ChangeCurrentData(box, value);
|
||||
}
|
||||
|
||||
|
@ -558,11 +530,10 @@ void DialogTool::setCurrentArcId(QComboBox *box, const quint32 &value, FillCombo
|
|||
* @param box combobox
|
||||
* @param value splinePath id
|
||||
*/
|
||||
void DialogTool::setCurrentSplinePathId(QComboBox *box, const quint32 &value, FillComboBox rule,
|
||||
const quint32 &ch1, const quint32 &ch2) const
|
||||
void DialogTool::setCurrentSplinePathId(QComboBox *box, const quint32 &value) const
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
FillComboBoxSplinesPath(box, rule, ch1, ch2);
|
||||
FillComboBoxSplinesPath(box);
|
||||
ChangeCurrentData(box, value);
|
||||
}
|
||||
|
||||
|
|
|
@ -188,10 +188,8 @@ protected:
|
|||
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID)const;
|
||||
void FillComboBoxArcs(QComboBox *box, FillComboBox rule = FillComboBox::Whole,
|
||||
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID)const;
|
||||
void FillComboBoxSplines(QComboBox *box, FillComboBox rule = FillComboBox::Whole,
|
||||
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID)const;
|
||||
void FillComboBoxSplinesPath(QComboBox *box, FillComboBox rule = FillComboBox::Whole,
|
||||
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID)const;
|
||||
void FillComboBoxSplines(QComboBox *box)const;
|
||||
void FillComboBoxSplinesPath(QComboBox *box)const;
|
||||
void FillComboBoxCurves(QComboBox *box)const;
|
||||
void FillComboBoxTypeLine(QComboBox *box, const QMap<QString, QIcon> &stylesPics) const;
|
||||
void FillComboBoxLineColors(QComboBox *box)const;
|
||||
|
@ -211,15 +209,11 @@ protected:
|
|||
void setCurrentPointId(QComboBox *box, const quint32 &value,
|
||||
FillComboBox rule = FillComboBox::NoChildren,
|
||||
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID) const;
|
||||
void setCurrentSplineId(QComboBox *box, const quint32 &value,
|
||||
FillComboBox rule = FillComboBox::NoChildren,
|
||||
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID) const;
|
||||
void setCurrentSplineId(QComboBox *box, const quint32 &value) const;
|
||||
void setCurrentArcId(QComboBox *box, const quint32 &value,
|
||||
FillComboBox rule = FillComboBox::NoChildren,
|
||||
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID) const;
|
||||
void setCurrentSplinePathId(QComboBox *box, const quint32 &value,
|
||||
FillComboBox rule = FillComboBox::NoChildren,
|
||||
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID) const;
|
||||
void setCurrentSplinePathId(QComboBox *box, const quint32 &value) const;
|
||||
void setCurrentCurveId(QComboBox *box, const quint32 &value) 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);
|
||||
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 );
|
||||
quint32 id = _id;
|
||||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
id = data->AddGObject(arc);
|
||||
data->AddArc(id);
|
||||
data->AddArc(data->GeometricObject<VArc>(id), id);
|
||||
}
|
||||
else
|
||||
{
|
||||
data->UpdateGObject(id, arc);
|
||||
data->AddArc(id);
|
||||
data->AddArc(data->GeometricObject<VArc>(id), id);
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
doc->UpdateToolData(id, data);
|
||||
|
|
|
@ -100,18 +100,18 @@ VToolArcWithLength *VToolArcWithLength::Create(const quint32 _id, const quint32
|
|||
calcLength = qApp->toPixel(CheckFormula(_id, length, 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);
|
||||
quint32 id = _id;
|
||||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
id = data->AddGObject(arc);
|
||||
data->AddArc(id);
|
||||
data->AddArc(data->GeometricObject<VArc>(id), id);
|
||||
}
|
||||
else
|
||||
{
|
||||
data->UpdateGObject(id, arc);
|
||||
data->AddArc(id);
|
||||
data->AddArc(data->GeometricObject<VArc>(id), id);
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
doc->UpdateToolData(id, data);
|
||||
|
|
|
@ -91,12 +91,12 @@ VToolCubicBezier *VToolCubicBezier::Create(const quint32 _id, VCubicBezier *spli
|
|||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
id = data->AddGObject(spline);
|
||||
data->AddCurve<VCubicBezier>(id);
|
||||
data->AddCurve(data->GeometricObject<VAbstractCurve>(id), id);
|
||||
}
|
||||
else
|
||||
{
|
||||
data->UpdateGObject(id, spline);
|
||||
data->AddCurve<VCubicBezier>(id);
|
||||
data->AddCurve(data->GeometricObject<VAbstractCurve>(id), id);
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
doc->UpdateToolData(id, data);
|
||||
|
|
|
@ -92,12 +92,12 @@ VToolCubicBezierPath *VToolCubicBezierPath::Create(const quint32 _id, VCubicBezi
|
|||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
id = data->AddGObject(path);
|
||||
data->AddCurve<VCubicBezierPath>(id);
|
||||
data->AddCurve(data->GeometricObject<VAbstractCurve>(id), id);
|
||||
}
|
||||
else
|
||||
{
|
||||
data->UpdateGObject(id, path);
|
||||
data->AddCurve<VCubicBezierPath>(id);
|
||||
data->AddCurve(data->GeometricObject<VAbstractCurve>(id), id);
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
doc->UpdateToolData(id, data);
|
||||
|
|
|
@ -162,12 +162,12 @@ VToolSpline* VToolSpline::Create(const quint32 _id, VSpline *spline, const QStri
|
|||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
id = data->AddGObject(spline);
|
||||
data->AddCurve<VSpline>(id);
|
||||
data->AddCurve(data->GeometricObject<VAbstractCurve>(id), id);
|
||||
}
|
||||
else
|
||||
{
|
||||
data->UpdateGObject(id, spline);
|
||||
data->AddCurve<VSpline>(id);
|
||||
data->AddCurve(data->GeometricObject<VAbstractCurve>(id), id);
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
doc->UpdateToolData(id, data);
|
||||
|
|
|
@ -166,12 +166,12 @@ VToolSplinePath* VToolSplinePath::Create(const quint32 _id, VSplinePath *path, c
|
|||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
id = data->AddGObject(path);
|
||||
data->AddCurve<VSplinePath>(id);
|
||||
data->AddCurve(data->GeometricObject<VAbstractCurve>(id), id);
|
||||
}
|
||||
else
|
||||
{
|
||||
data->UpdateGObject(id, path);
|
||||
data->AddCurve<VSplinePath>(id);
|
||||
data->AddCurve(data->GeometricObject<VAbstractCurve>(id), id);
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
doc->UpdateToolData(id, data);
|
||||
|
|
|
@ -32,14 +32,10 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolCut::VToolCut(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||
const quint32 &curveCutId, const quint32 &curve1id, const quint32 &curve2id, const QString &color,
|
||||
QGraphicsItem *parent)
|
||||
:VToolSinglePoint(doc, data, id, parent), formula(formula),
|
||||
curveCutId(curveCutId), curve1id(curve1id), curve2id(curve2id), detailsMode(false)
|
||||
const quint32 &curveCutId, const QString &color, QGraphicsItem *parent)
|
||||
:VToolSinglePoint(doc, data, id, parent), formula(formula), curveCutId(curveCutId), detailsMode(false)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -39,8 +39,7 @@ class VToolCut : public VToolSinglePoint
|
|||
Q_OBJECT
|
||||
public:
|
||||
VToolCut(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||
const quint32 &curveCutId,
|
||||
const quint32 &curve1id, const quint32 &curve2id, const QString &color, QGraphicsItem * parent = nullptr);
|
||||
const quint32 &curveCutId, const QString &color, QGraphicsItem * parent = nullptr);
|
||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Tool::Cut)};
|
||||
|
||||
|
@ -59,9 +58,6 @@ protected:
|
|||
QString formula;
|
||||
|
||||
quint32 curveCutId;
|
||||
quint32 curve1id;
|
||||
quint32 curve2id;
|
||||
|
||||
bool detailsMode;
|
||||
|
||||
void RefreshGeometry();
|
||||
|
|
|
@ -44,15 +44,14 @@ const QString VToolCutArc::ToolType = QStringLiteral("cutArc");
|
|||
* @param id object id in container.
|
||||
* @param formula string with formula length first arc.
|
||||
* @param arcId id arc in data container.
|
||||
* @param arc1id id first cutting arc.
|
||||
* @param arc2id id second cutting arc.
|
||||
* @param color arc color.
|
||||
* @param typeCreation way we create this tool.
|
||||
* @param parent parent object.
|
||||
*/
|
||||
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 Source &typeCreation, QGraphicsItem * parent)
|
||||
:VToolCut(doc, data, id, formula, arcId, arc1id, arc2id, color, parent)
|
||||
const quint32 &arcId, const QString &color, const Source &typeCreation,
|
||||
QGraphicsItem * parent)
|
||||
:VToolCut(doc, data, id, formula, arcId, color, parent)
|
||||
{
|
||||
ToolCreation(typeCreation);
|
||||
}
|
||||
|
@ -67,7 +66,6 @@ void VToolCutArc::setDialog()
|
|||
DialogCutArc *dialogTool = qobject_cast<DialogCutArc*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->SetChildrenId(curve1id, curve2id);
|
||||
dialogTool->SetFormula(formula);
|
||||
dialogTool->setArcId(curveCutId);
|
||||
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);
|
||||
|
||||
quint32 id = _id;
|
||||
quint32 arc1id = 0;
|
||||
quint32 arc2id = 0;
|
||||
VPointF *p = new VPointF(point, pointName, mx, my);
|
||||
auto a1 = QSharedPointer<VArc>(new VArc(arc1));
|
||||
auto a2 = QSharedPointer<VArc>(new VArc(arc2));
|
||||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
id = data->AddGObject(new VPointF(point, pointName, mx, my));
|
||||
arc1id = data->AddGObject(new VArc(arc1));
|
||||
arc2id = data->AddGObject(new VArc(arc2));
|
||||
|
||||
data->AddArc(arc1id, id);
|
||||
data->AddArc(arc2id, id);
|
||||
id = data->AddGObject(p);
|
||||
data->AddArc(a1, NULL_ID, id);
|
||||
data->AddArc(a2, NULL_ID, id);
|
||||
}
|
||||
else
|
||||
{
|
||||
data->UpdateGObject(id, new VPointF(point, pointName, mx, my));
|
||||
arc1id = id + 1;
|
||||
arc2id = id + 2;
|
||||
|
||||
data->UpdateGObject(arc1id, new VArc(arc1));
|
||||
data->UpdateGObject(arc2id, new VArc(arc2));
|
||||
|
||||
data->AddArc(arc1id, id);
|
||||
data->AddArc(arc2id, id);
|
||||
data->UpdateGObject(id, p);
|
||||
data->AddArc(a1, NULL_ID, id);
|
||||
data->AddArc(a2, NULL_ID, id);
|
||||
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
|
@ -161,12 +151,10 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS
|
|||
VDrawTool::AddRecord(id, Tool::CutArc, doc);
|
||||
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);
|
||||
InitToolConnections(scene, point);
|
||||
doc->AddTool(id, point);
|
||||
doc->AddTool(arc1id, point);
|
||||
doc->AddTool(arc2id, point);
|
||||
doc->IncrementReferens(arc->getIdTool());
|
||||
return point;
|
||||
}
|
||||
|
|
|
@ -39,8 +39,7 @@ class VToolCutArc : public VToolCut
|
|||
Q_OBJECT
|
||||
public:
|
||||
VToolCutArc(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||
const quint32 &arcId,
|
||||
const quint32 &arc1id, const quint32 &arc2id, const QString &color, const Source &typeCreation,
|
||||
const quint32 &arcId, const QString &color, const Source &typeCreation,
|
||||
QGraphicsItem * parent = nullptr);
|
||||
virtual void setDialog() Q_DECL_OVERRIDE;
|
||||
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 formula string with formula length first spline.
|
||||
* @param splineId id spline in data container.
|
||||
* @param color spline color.
|
||||
* @param typeCreation way we create this tool.
|
||||
* @param parent parent object.
|
||||
*/
|
||||
VToolCutSpline::VToolCutSpline(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||
const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id,
|
||||
const QString &color, const Source &typeCreation, QGraphicsItem *parent)
|
||||
:VToolCut(doc, data, id, formula, splineId, spl1id, spl2id, color, parent)
|
||||
const quint32 &splineId, const QString &color, const Source &typeCreation,
|
||||
QGraphicsItem *parent)
|
||||
:VToolCut(doc, data, id, formula, splineId, color, parent)
|
||||
{
|
||||
ToolCreation(typeCreation);
|
||||
}
|
||||
|
@ -66,7 +67,6 @@ void VToolCutSpline::setDialog()
|
|||
DialogCutSpline *dialogTool = qobject_cast<DialogCutSpline*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->SetChildrenId(curve1id, curve2id);
|
||||
dialogTool->SetFormula(formula);
|
||||
dialogTool->setSplineId(curveCutId);
|
||||
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);
|
||||
|
||||
quint32 id = _id;
|
||||
quint32 spl1id = 0;
|
||||
quint32 spl2id = 0;
|
||||
VPointF *p = new VPointF(point, pointName, mx, my);
|
||||
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)
|
||||
{
|
||||
VPointF *p = new VPointF(point, pointName, mx, my);
|
||||
id = data->AddGObject(p);
|
||||
|
||||
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p);
|
||||
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);
|
||||
data->AddCurve(spline1, NULL_ID, id);
|
||||
data->AddCurve(spline2, NULL_ID, id);
|
||||
}
|
||||
else
|
||||
{
|
||||
VPointF *p = new VPointF(point, pointName, mx, my);
|
||||
data->UpdateGObject(id, p);
|
||||
|
||||
spl1id = id + 1;
|
||||
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);
|
||||
data->AddCurve(spline1, NULL_ID, id);
|
||||
data->AddCurve(spline2, NULL_ID, id);
|
||||
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
|
@ -167,13 +152,10 @@ VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointNa
|
|||
VDrawTool::AddRecord(id, Tool::CutSpline, doc);
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, spl1id, spl2id, color,
|
||||
typeCreation);
|
||||
VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, color, typeCreation);
|
||||
scene->addItem(point);
|
||||
InitToolConnections(scene, point);
|
||||
doc->AddTool(id, point);
|
||||
doc->AddTool(spl1id, point);
|
||||
doc->AddTool(spl2id, point);
|
||||
doc->IncrementReferens(spl->getIdTool());
|
||||
return point;
|
||||
}
|
||||
|
|
|
@ -40,8 +40,8 @@ class VToolCutSpline : public VToolCut
|
|||
public:
|
||||
|
||||
VToolCutSpline(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||
const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id, const QString &color,
|
||||
const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||
const quint32 &splineId, const QString &color, const Source &typeCreation,
|
||||
QGraphicsItem * parent = nullptr);
|
||||
virtual void setDialog() Q_DECL_OVERRIDE;
|
||||
static VToolCutSpline *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||
VContainer *data);
|
||||
|
|
|
@ -45,16 +45,14 @@ const QString VToolCutSplinePath::AttrSplinePath = QStringLiteral("splinePath");
|
|||
* @param id object id in container.
|
||||
* @param formula string with formula length first splinePath.
|
||||
* @param splinePathId id splinePath (we cut this splinePath) in data container.
|
||||
* @param splPath1id id first splinePath after cutting.
|
||||
* @param splPath2id id second splinePath after cutting.
|
||||
* @param color spline path color.
|
||||
* @param typeCreation way we create this tool.
|
||||
* @param parent parent object.
|
||||
*/
|
||||
VToolCutSplinePath::VToolCutSplinePath(VAbstractPattern *doc, VContainer *data, const quint32 &id,
|
||||
const QString &formula, const quint32 &splinePathId,
|
||||
const quint32 &splPath1id, const quint32 &splPath2id, const QString &color,
|
||||
const Source &typeCreation, QGraphicsItem *parent)
|
||||
:VToolCut(doc, data, id, formula, splinePathId, splPath1id, splPath2id, color, parent)
|
||||
const QString &color, const Source &typeCreation, QGraphicsItem *parent)
|
||||
:VToolCut(doc, data, id, formula, splinePathId, color, parent)
|
||||
{
|
||||
ToolCreation(typeCreation);
|
||||
}
|
||||
|
@ -69,7 +67,6 @@ void VToolCutSplinePath::setDialog()
|
|||
DialogCutSplinePath *dialogTool = qobject_cast<DialogCutSplinePath*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->SetChildrenId(curve1id, curve2id);
|
||||
dialogTool->SetFormula(formula);
|
||||
dialogTool->setSplinePathId(curveCutId);
|
||||
dialogTool->SetPointName(point->name());
|
||||
|
@ -143,30 +140,16 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString
|
|||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
id = data->AddGObject(p);
|
||||
|
||||
data->AddCurve(QSharedPointer<VAbstractCurve>(splPath1), NULL_ID, id);
|
||||
data->AddCurve(QSharedPointer<VAbstractCurve>(splPath2), NULL_ID, id);
|
||||
}
|
||||
else
|
||||
{
|
||||
data->UpdateGObject(id, p);
|
||||
}
|
||||
|
||||
quint32 splPath1id = id + 1;
|
||||
quint32 splPath2id = id + 2;
|
||||
|
||||
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);
|
||||
data->AddCurve(QSharedPointer<VAbstractCurve>(splPath1), NULL_ID, id);
|
||||
data->AddCurve(QSharedPointer<VAbstractCurve>(splPath2), NULL_ID, id);
|
||||
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
|
@ -177,13 +160,10 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString
|
|||
VDrawTool::AddRecord(id, Tool::CutSplinePath, doc);
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, splPath1id,
|
||||
splPath2id, color, typeCreation);
|
||||
VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, color, typeCreation);
|
||||
scene->addItem(point);
|
||||
InitToolConnections(scene, point);
|
||||
doc->AddTool(id, point);
|
||||
doc->AddTool(splPath1id, point);
|
||||
doc->AddTool(splPath2id, point);
|
||||
doc->IncrementReferens(splPath->getIdTool());
|
||||
return point;
|
||||
}
|
||||
|
|
|
@ -44,8 +44,8 @@ class VToolCutSplinePath : public VToolCut
|
|||
public:
|
||||
|
||||
VToolCutSplinePath(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||
const quint32 &splinePathId, const quint32 &splPath1id, const quint32 &splPath2id,
|
||||
const QString &color, const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||
const quint32 &splinePathId, const QString &color, const Source &typeCreation,
|
||||
QGraphicsItem * parent = nullptr);
|
||||
virtual void setDialog() Q_DECL_OVERRIDE;
|
||||
static VToolCutSplinePath *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||
VContainer *data);
|
||||
|
|
Loading…
Reference in New Issue
Block a user