Alias field for tool Cut Arc.
This commit is contained in:
parent
b1f9327393
commit
2574ecda0e
|
@ -544,6 +544,26 @@ void VToolOptionsPropertyBrowser::AddPropertyAlias(Tool *i, const QString &prope
|
||||||
AddProperty(itemName, AttrAlias);
|
AddProperty(itemName, AttrAlias);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template<class Tool>
|
||||||
|
void VToolOptionsPropertyBrowser::AddPropertyAlias1(Tool *i, const QString &propertyName)
|
||||||
|
{
|
||||||
|
auto *itemName = new VPE::VStringProperty(propertyName);
|
||||||
|
itemName->setClearButtonEnable(true);
|
||||||
|
itemName->setValue(qApp->TrVars()->VarToUser(i->GetAliasSuffix1()));
|
||||||
|
AddProperty(itemName, AttrAlias1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template<class Tool>
|
||||||
|
void VToolOptionsPropertyBrowser::AddPropertyAlias2(Tool *i, const QString &propertyName)
|
||||||
|
{
|
||||||
|
auto *itemName = new VPE::VStringProperty(propertyName);
|
||||||
|
itemName->setClearButtonEnable(true);
|
||||||
|
itemName->setValue(qApp->TrVars()->VarToUser(i->GetAliasSuffix2()));
|
||||||
|
AddProperty(itemName, AttrAlias2);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template<class Tool>
|
template<class Tool>
|
||||||
void VToolOptionsPropertyBrowser::AddPropertyPointName1(Tool *i, const QString &propertyName)
|
void VToolOptionsPropertyBrowser::AddPropertyPointName1(Tool *i, const QString &propertyName)
|
||||||
|
@ -967,6 +987,46 @@ void VToolOptionsPropertyBrowser::SetAlias(VPE::VProperty *property)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template<class Tool>
|
||||||
|
void VToolOptionsPropertyBrowser::SetAlias1(VPE::VProperty *property)
|
||||||
|
{
|
||||||
|
if (auto *i = qgraphicsitem_cast<Tool *>(currentItem))
|
||||||
|
{
|
||||||
|
QString notes = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
|
||||||
|
if (notes == i->GetAliasSuffix1())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
i->SetAliasSuffix1(notes);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning()<<"Can't cast item";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template<class Tool>
|
||||||
|
void VToolOptionsPropertyBrowser::SetAlias2(VPE::VProperty *property)
|
||||||
|
{
|
||||||
|
if (auto *i = qgraphicsitem_cast<Tool *>(currentItem))
|
||||||
|
{
|
||||||
|
QString notes = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
|
||||||
|
if (notes == i->GetAliasSuffix2())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
i->SetAliasSuffix2(notes);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning()<<"Can't cast item";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template<class Tool>
|
template<class Tool>
|
||||||
void VToolOptionsPropertyBrowser::SetLineType(VPE::VProperty *property)
|
void VToolOptionsPropertyBrowser::SetLineType(VPE::VProperty *property)
|
||||||
|
@ -1452,6 +1512,12 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCutArc(VPE::VProperty *property)
|
||||||
case 61: // AttrNotes
|
case 61: // AttrNotes
|
||||||
SetNotes<VToolCutArc>(property);
|
SetNotes<VToolCutArc>(property);
|
||||||
break;
|
break;
|
||||||
|
case 63: // AttrAlias1
|
||||||
|
SetAlias1<VToolCutArc>(property);
|
||||||
|
break;
|
||||||
|
case 64: // AttrAlias2
|
||||||
|
SetAlias2<VToolCutArc>(property);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"Unknown property type. id = "<<id;
|
qWarning()<<"Unknown property type. id = "<<id;
|
||||||
break;
|
break;
|
||||||
|
@ -2559,6 +2625,8 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCutArc(QGraphicsItem *item)
|
||||||
|
|
||||||
AddPropertyObjectName(i, tr("Point label:"));
|
AddPropertyObjectName(i, tr("Point label:"));
|
||||||
AddPropertyParentPointName(i->CurveName(), tr("Arc:"), AttrArc);
|
AddPropertyParentPointName(i->CurveName(), tr("Arc:"), AttrArc);
|
||||||
|
AddPropertyAlias1(i, tr("Alias1:"));
|
||||||
|
AddPropertyAlias2(i, tr("Alias2:"));
|
||||||
AddPropertyFormula(tr("Length:"), i->GetFormulaLength(), AttrLength);
|
AddPropertyFormula(tr("Length:"), i->GetFormulaLength(), AttrLength);
|
||||||
AddPropertyText(tr("Notes:"), i->GetNotes(), AttrNotes);
|
AddPropertyText(tr("Notes:"), i->GetNotes(), AttrNotes);
|
||||||
}
|
}
|
||||||
|
@ -3232,6 +3300,9 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCutArc()
|
||||||
idToProperty[AttrArc]->setValue(valueArc);
|
idToProperty[AttrArc]->setValue(valueArc);
|
||||||
|
|
||||||
idToProperty[AttrNotes]->setValue(i->GetNotes());
|
idToProperty[AttrNotes]->setValue(i->GetNotes());
|
||||||
|
|
||||||
|
idToProperty[AttrAlias1]->setValue(i->GetAliasSuffix1());
|
||||||
|
idToProperty[AttrAlias2]->setValue(i->GetAliasSuffix2());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -3995,7 +4066,9 @@ QStringList VToolOptionsPropertyBrowser::PropertiesList() const
|
||||||
AttrPenStyle, /* 59 */
|
AttrPenStyle, /* 59 */
|
||||||
AttrAScale, /* 60 */
|
AttrAScale, /* 60 */
|
||||||
AttrNotes, /* 61 */
|
AttrNotes, /* 61 */
|
||||||
AttrAlias /* 62 */
|
AttrAlias, /* 62 */
|
||||||
|
AttrAlias1, /* 63 */
|
||||||
|
AttrAlias2 /* 64 */
|
||||||
};
|
};
|
||||||
return attr;
|
return attr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,12 @@ private:
|
||||||
template<class Tool>
|
template<class Tool>
|
||||||
void SetAlias(VPE::VProperty *property);
|
void SetAlias(VPE::VProperty *property);
|
||||||
|
|
||||||
|
template<class Tool>
|
||||||
|
void SetAlias1(VPE::VProperty *property);
|
||||||
|
|
||||||
|
template<class Tool>
|
||||||
|
void SetAlias2(VPE::VProperty *property);
|
||||||
|
|
||||||
template<class Tool>
|
template<class Tool>
|
||||||
void SetLineType(VPE::VProperty *property);
|
void SetLineType(VPE::VProperty *property);
|
||||||
|
|
||||||
|
@ -135,6 +141,12 @@ private:
|
||||||
template<class Tool>
|
template<class Tool>
|
||||||
void AddPropertyAlias(Tool *i, const QString &propertyName);
|
void AddPropertyAlias(Tool *i, const QString &propertyName);
|
||||||
|
|
||||||
|
template<class Tool>
|
||||||
|
void AddPropertyAlias1(Tool *i, const QString &propertyName);
|
||||||
|
|
||||||
|
template<class Tool>
|
||||||
|
void AddPropertyAlias2(Tool *i, const QString &propertyName);
|
||||||
|
|
||||||
template<class Tool>
|
template<class Tool>
|
||||||
void AddPropertyPointName1(Tool *i, const QString &propertyName);
|
void AddPropertyPointName1(Tool *i, const QString &propertyName);
|
||||||
|
|
||||||
|
|
|
@ -2030,7 +2030,7 @@ void VPattern::ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domEle
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
VToolCutSplineInitData initData;
|
VToolCutInitData initData;
|
||||||
initData.scene = scene;
|
initData.scene = scene;
|
||||||
initData.doc = this;
|
initData.doc = this;
|
||||||
initData.data = data;
|
initData.data = data;
|
||||||
|
@ -2040,7 +2040,7 @@ void VPattern::ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domEle
|
||||||
PointsCommonAttributes(domElement, initData);
|
PointsCommonAttributes(domElement, initData);
|
||||||
initData.formula = GetParametrString(domElement, AttrLength, QChar('0'));
|
initData.formula = GetParametrString(domElement, AttrLength, QChar('0'));
|
||||||
const QString f = initData.formula;//need for saving fixed formula;
|
const QString f = initData.formula;//need for saving fixed formula;
|
||||||
initData.splineId = GetParametrUInt(domElement, VToolCutSpline::AttrSpline, NULL_ID_STR);
|
initData.baseCurveId = GetParametrUInt(domElement, VToolCutSpline::AttrSpline, NULL_ID_STR);
|
||||||
|
|
||||||
VToolCutSpline::Create(initData);
|
VToolCutSpline::Create(initData);
|
||||||
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
||||||
|
@ -2073,7 +2073,7 @@ void VPattern::ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &do
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
VToolCutSplinePathInitData initData;
|
VToolCutInitData initData;
|
||||||
initData.scene = scene;
|
initData.scene = scene;
|
||||||
initData.doc = this;
|
initData.doc = this;
|
||||||
initData.data = data;
|
initData.data = data;
|
||||||
|
@ -2083,7 +2083,7 @@ void VPattern::ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &do
|
||||||
PointsCommonAttributes(domElement, initData);
|
PointsCommonAttributes(domElement, initData);
|
||||||
initData.formula = GetParametrString(domElement, AttrLength, QChar('0'));
|
initData.formula = GetParametrString(domElement, AttrLength, QChar('0'));
|
||||||
const QString f = initData.formula;//need for saving fixed formula;
|
const QString f = initData.formula;//need for saving fixed formula;
|
||||||
initData.splinePathId = GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath, NULL_ID_STR);
|
initData.baseCurveId = GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath, NULL_ID_STR);
|
||||||
|
|
||||||
VToolCutSplinePath::Create(initData);
|
VToolCutSplinePath::Create(initData);
|
||||||
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
||||||
|
@ -2116,7 +2116,7 @@ void VPattern::ParseToolCutArc(VMainGraphicsScene *scene, QDomElement &domElemen
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
VToolCutArcInitData initData;
|
VToolCutInitData initData;
|
||||||
initData.scene = scene;
|
initData.scene = scene;
|
||||||
initData.doc = this;
|
initData.doc = this;
|
||||||
initData.data = data;
|
initData.data = data;
|
||||||
|
@ -2126,7 +2126,9 @@ void VPattern::ParseToolCutArc(VMainGraphicsScene *scene, QDomElement &domElemen
|
||||||
PointsCommonAttributes(domElement, initData);
|
PointsCommonAttributes(domElement, initData);
|
||||||
initData.formula = GetParametrString(domElement, AttrLength, QChar('0'));
|
initData.formula = GetParametrString(domElement, AttrLength, QChar('0'));
|
||||||
const QString f = initData.formula;//need for saving fixed formula;
|
const QString f = initData.formula;//need for saving fixed formula;
|
||||||
initData.arcId = GetParametrUInt(domElement, AttrArc, NULL_ID_STR);
|
initData.baseCurveId = GetParametrUInt(domElement, AttrArc, NULL_ID_STR);
|
||||||
|
initData.aliasSuffix1 = GetParametrEmptyString(domElement, AttrAlias1);
|
||||||
|
initData.aliasSuffix2 = GetParametrEmptyString(domElement, AttrAlias2);
|
||||||
|
|
||||||
VToolCutArc::Create(initData);
|
VToolCutArc::Create(initData);
|
||||||
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
||||||
|
|
|
@ -135,6 +135,8 @@ const QString AttrFirstToCountour = QStringLiteral("firstToCountour");
|
||||||
const QString AttrLastToCountour = QStringLiteral("lastToCountour");
|
const QString AttrLastToCountour = QStringLiteral("lastToCountour");
|
||||||
const QString AttrNotes = QStringLiteral("notes");
|
const QString AttrNotes = QStringLiteral("notes");
|
||||||
const QString AttrAlias = QStringLiteral("alias");
|
const QString AttrAlias = QStringLiteral("alias");
|
||||||
|
const QString AttrAlias1 = QStringLiteral("alias1");
|
||||||
|
const QString AttrAlias2 = QStringLiteral("alias2");
|
||||||
|
|
||||||
const QString TypeLineNone = QStringLiteral("none");
|
const QString TypeLineNone = QStringLiteral("none");
|
||||||
const QString TypeLineLine = QStringLiteral("hair");
|
const QString TypeLineLine = QStringLiteral("hair");
|
||||||
|
|
|
@ -153,6 +153,8 @@ extern const QString AttrFirstToCountour;
|
||||||
extern const QString AttrLastToCountour;
|
extern const QString AttrLastToCountour;
|
||||||
extern const QString AttrNotes;
|
extern const QString AttrNotes;
|
||||||
extern const QString AttrAlias;
|
extern const QString AttrAlias;
|
||||||
|
extern const QString AttrAlias1;
|
||||||
|
extern const QString AttrAlias2;
|
||||||
|
|
||||||
extern const QString TypeLineNone;
|
extern const QString TypeLineNone;
|
||||||
extern const QString TypeLineLine;
|
extern const QString TypeLineLine;
|
||||||
|
|
|
@ -241,6 +241,19 @@ quint32 VContainer::GetPieceForPiecePath(quint32 id) const
|
||||||
return NULL_ID;
|
return NULL_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VContainer::RegisterUniqueName(const QSharedPointer<VGObject> &obj)
|
||||||
|
{
|
||||||
|
SCASSERT(not obj.isNull())
|
||||||
|
|
||||||
|
uniqueNames[d->nspace].insert(obj->name());
|
||||||
|
|
||||||
|
if (not obj->GetAlias().isEmpty())
|
||||||
|
{
|
||||||
|
uniqueNames[d->nspace].insert(obj->GetAlias());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief AddGObject add new GObject to container
|
* @brief AddGObject add new GObject to container
|
||||||
|
@ -265,12 +278,7 @@ quint32 VContainer::AddGObject(const QSharedPointer<VGObject> &obj)
|
||||||
return NULL_ID;
|
return NULL_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
uniqueNames[d->nspace].insert(obj->name());
|
RegisterUniqueName(obj);
|
||||||
|
|
||||||
if (not obj->GetAlias().isEmpty())
|
|
||||||
{
|
|
||||||
uniqueNames[d->nspace].insert(obj->GetAlias());
|
|
||||||
}
|
|
||||||
|
|
||||||
const quint32 id = getNextId();
|
const quint32 id = getNextId();
|
||||||
obj->setId(id);
|
obj->setId(id);
|
||||||
|
|
|
@ -151,6 +151,8 @@ public:
|
||||||
void UpdateId(quint32 newId) const;
|
void UpdateId(quint32 newId) const;
|
||||||
static void UpdateId(quint32 newId, const QString &nspace);
|
static void UpdateId(quint32 newId, const QString &nspace);
|
||||||
|
|
||||||
|
void RegisterUniqueName(const QSharedPointer<VGObject> &obj);
|
||||||
|
|
||||||
quint32 AddGObject(VGObject *obj);
|
quint32 AddGObject(VGObject *obj);
|
||||||
quint32 AddGObject(const QSharedPointer<VGObject> &obj);
|
quint32 AddGObject(const QSharedPointer<VGObject> &obj);
|
||||||
quint32 AddPiece(const VPiece &detail);
|
quint32 AddPiece(const VPiece &detail);
|
||||||
|
@ -402,12 +404,7 @@ void VContainer::UpdateGObject(quint32 id, const QSharedPointer<T> &obj)
|
||||||
{
|
{
|
||||||
SCASSERT(not obj.isNull())
|
SCASSERT(not obj.isNull())
|
||||||
UpdateObject(id, obj);
|
UpdateObject(id, obj);
|
||||||
uniqueNames[d->nspace].insert(obj->name());
|
RegisterUniqueName(obj);
|
||||||
|
|
||||||
if (not obj->GetAlias().isEmpty())
|
|
||||||
{
|
|
||||||
uniqueNames[d->nspace].insert(obj->GetAlias());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -93,6 +93,9 @@ DialogCutArc::DialogCutArc(const VContainer *data, quint32 toolId, QWidget *pare
|
||||||
|
|
||||||
connect(ui->comboBoxArc, &QComboBox::currentTextChanged, this, &DialogCutArc::ArcChanged);
|
connect(ui->comboBoxArc, &QComboBox::currentTextChanged, this, &DialogCutArc::ArcChanged);
|
||||||
|
|
||||||
|
connect(ui->lineEditAlias1, &QLineEdit::textEdited, this, &DialogCutArc::ValidateAlias);
|
||||||
|
connect(ui->lineEditAlias2, &QLineEdit::textEdited, this, &DialogCutArc::ValidateAlias);
|
||||||
|
|
||||||
vis = new VisToolCutArc(data);
|
vis = new VisToolCutArc(data);
|
||||||
|
|
||||||
ui->tabWidget->setCurrentIndex(0);
|
ui->tabWidget->setCurrentIndex(0);
|
||||||
|
@ -201,6 +204,55 @@ void DialogCutArc::ArcChanged()
|
||||||
CurrentCurveLength(getArcId(), const_cast<VContainer *> (data));
|
CurrentCurveLength(getArcId(), const_cast<VContainer *> (data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogCutArc::ValidateAlias()
|
||||||
|
{
|
||||||
|
VArc arc1;
|
||||||
|
arc1.SetAliasSuffix(GetAliasSuffix1());
|
||||||
|
if (not GetAliasSuffix1().isEmpty() && not data->IsUnique(arc1.GetAlias()))
|
||||||
|
{
|
||||||
|
flagAlias1 = false;
|
||||||
|
ChangeColor(ui->labelAlias1, errorColor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flagAlias1 = true;
|
||||||
|
ChangeColor(ui->labelAlias1, OkColor(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
VArc arc2;
|
||||||
|
arc2.SetAliasSuffix(GetAliasSuffix2());
|
||||||
|
if (not GetAliasSuffix2().isEmpty() && not data->IsUnique(arc2.GetAlias()))
|
||||||
|
{
|
||||||
|
flagAlias2 = false;
|
||||||
|
ChangeColor(ui->labelAlias2, errorColor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flagAlias2 = true;
|
||||||
|
ChangeColor(ui->labelAlias2, OkColor(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arc1.GetAlias() == arc2.GetAlias())
|
||||||
|
{
|
||||||
|
flagAlias1 = false;
|
||||||
|
ChangeColor(ui->labelAlias1, errorColor);
|
||||||
|
|
||||||
|
flagAlias2 = false;
|
||||||
|
ChangeColor(ui->labelAlias2, errorColor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flagAlias1 = true;
|
||||||
|
ChangeColor(ui->labelAlias1, OkColor(this));
|
||||||
|
|
||||||
|
flagAlias2 = true;
|
||||||
|
ChangeColor(ui->labelAlias2, OkColor(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckState();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief setArcId set id of arc
|
* @brief setArcId set id of arc
|
||||||
|
@ -279,3 +331,29 @@ QString DialogCutArc::GetNotes() const
|
||||||
{
|
{
|
||||||
return ui->plainTextEditToolNotes->toPlainText();
|
return ui->plainTextEditToolNotes->toPlainText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogCutArc::SetAliasSuffix1(const QString &alias)
|
||||||
|
{
|
||||||
|
ui->lineEditAlias1->setText(alias);
|
||||||
|
ValidateAlias();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString DialogCutArc::GetAliasSuffix1() const
|
||||||
|
{
|
||||||
|
return ui->lineEditAlias1->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogCutArc::SetAliasSuffix2(const QString &alias)
|
||||||
|
{
|
||||||
|
ui->lineEditAlias2->setText(alias);
|
||||||
|
ValidateAlias();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString DialogCutArc::GetAliasSuffix2() const
|
||||||
|
{
|
||||||
|
return ui->lineEditAlias2->text();
|
||||||
|
}
|
||||||
|
|
|
@ -65,6 +65,13 @@ public:
|
||||||
|
|
||||||
void SetNotes(const QString ¬es);
|
void SetNotes(const QString ¬es);
|
||||||
QString GetNotes() const;
|
QString GetNotes() const;
|
||||||
|
|
||||||
|
void SetAliasSuffix1(const QString &alias);
|
||||||
|
QString GetAliasSuffix1() const;
|
||||||
|
|
||||||
|
void SetAliasSuffix2(const QString &alias);
|
||||||
|
QString GetAliasSuffix2() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ChosenObject(quint32 id, const SceneObject &type) override;
|
virtual void ChosenObject(quint32 id, const SceneObject &type) override;
|
||||||
/**
|
/**
|
||||||
|
@ -84,6 +91,7 @@ protected:
|
||||||
virtual bool IsValid() const final;
|
virtual bool IsValid() const final;
|
||||||
private slots:
|
private slots:
|
||||||
void ArcChanged();
|
void ArcChanged();
|
||||||
|
void ValidateAlias();
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(DialogCutArc)
|
Q_DISABLE_COPY(DialogCutArc)
|
||||||
/** @brief ui keeps information about user interface */
|
/** @brief ui keeps information about user interface */
|
||||||
|
@ -100,12 +108,14 @@ private:
|
||||||
|
|
||||||
bool flagFormula;
|
bool flagFormula;
|
||||||
bool flagName;
|
bool flagName;
|
||||||
|
bool flagAlias1{true};
|
||||||
|
bool flagAlias2{true};
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline bool DialogCutArc::IsValid() const
|
inline bool DialogCutArc::IsValid() const
|
||||||
{
|
{
|
||||||
return flagFormula && flagName;
|
return flagFormula && flagName && flagAlias1 && flagAlias2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DIALOGCUTARC_H
|
#endif // DIALOGCUTARC_H
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>334</width>
|
<width>573</width>
|
||||||
<height>247</height>
|
<height>295</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -255,6 +255,34 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="labelAlias1">
|
||||||
|
<property name="text">
|
||||||
|
<string>Alias1:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEditAlias1">
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="labelAlias2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Alias2:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEditAlias2">
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -44,14 +44,15 @@
|
||||||
#include "../vtoolsinglepoint.h"
|
#include "../vtoolsinglepoint.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VToolCut::VToolCut(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
VToolCut::VToolCut(const VToolCutInitData &initData, QGraphicsItem *parent)
|
||||||
const quint32 &curveCutId, const QString ¬es, QGraphicsItem *parent)
|
: VToolSinglePoint(initData.doc, initData.data, initData.id, initData.notes, parent),
|
||||||
: VToolSinglePoint(doc, data, id, notes, parent),
|
formula(initData.formula),
|
||||||
formula(formula),
|
baseCurveId(initData.baseCurveId),
|
||||||
curveCutId(curveCutId),
|
detailsMode(qApp->Settings()->IsShowCurveDetails()),
|
||||||
detailsMode(qApp->Settings()->IsShowCurveDetails())
|
m_aliasSuffix1(initData.aliasSuffix1),
|
||||||
|
m_aliasSuffix2(initData.aliasSuffix2)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(curveCutId != 0, Q_FUNC_INFO, "curveCutId == 0"); //-V654 //-V712
|
Q_ASSERT_X(initData.baseCurveId != 0, Q_FUNC_INFO, "curveCutId == 0"); //-V654 //-V712
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -100,10 +101,62 @@ void VToolCut::SetFormulaLength(const VFormula &value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VToolCut::GetAliasSuffix1() const
|
||||||
|
{
|
||||||
|
return m_aliasSuffix1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolCut::SetAliasSuffix1(const QString &alias)
|
||||||
|
{
|
||||||
|
QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(baseCurveId);
|
||||||
|
|
||||||
|
const QString oldAliasSuffix = curve->GetAliasSuffix();
|
||||||
|
curve->SetAliasSuffix(alias);
|
||||||
|
|
||||||
|
if (alias.isEmpty() || VAbstractTool::data.IsUnique(curve->GetAlias()))
|
||||||
|
{
|
||||||
|
m_aliasSuffix1 = alias;
|
||||||
|
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
||||||
|
SaveOption(obj);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curve->SetAliasSuffix(oldAliasSuffix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VToolCut::GetAliasSuffix2() const
|
||||||
|
{
|
||||||
|
return m_aliasSuffix2;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolCut::SetAliasSuffix2(const QString &alias)
|
||||||
|
{
|
||||||
|
QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(baseCurveId);
|
||||||
|
|
||||||
|
const QString oldAliasSuffix = curve->GetAliasSuffix();
|
||||||
|
curve->SetAliasSuffix(alias);
|
||||||
|
|
||||||
|
if (alias.isEmpty() || VAbstractTool::data.IsUnique(curve->GetAlias()))
|
||||||
|
{
|
||||||
|
m_aliasSuffix2 = alias;
|
||||||
|
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
||||||
|
SaveOption(obj);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curve->SetAliasSuffix(oldAliasSuffix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VToolCut::CurveName() const
|
QString VToolCut::CurveName() const
|
||||||
{
|
{
|
||||||
return VAbstractTool::data.GetGObject(curveCutId)->name();
|
return VAbstractTool::data.GetGObject(baseCurveId)->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -121,7 +174,25 @@ void VToolCut::RefreshGeometry()
|
||||||
*/
|
*/
|
||||||
void VToolCut::RemoveReferens()
|
void VToolCut::RemoveReferens()
|
||||||
{
|
{
|
||||||
const auto curve = VAbstractTool::data.GetGObject(curveCutId);
|
const auto curve = VAbstractTool::data.GetGObject(baseCurveId);
|
||||||
|
|
||||||
doc->DecrementReferens(curve->getIdTool());
|
doc->DecrementReferens(curve->getIdTool());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolCut::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
||||||
|
{
|
||||||
|
VToolSinglePoint::SaveOptions(tag, obj);
|
||||||
|
|
||||||
|
doc->SetAttributeOrRemoveIf(tag, AttrAlias1, m_aliasSuffix1, m_aliasSuffix1.isEmpty());
|
||||||
|
doc->SetAttributeOrRemoveIf(tag, AttrAlias2, m_aliasSuffix2, m_aliasSuffix2.isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolCut::ReadToolAttributes(const QDomElement &domElement)
|
||||||
|
{
|
||||||
|
VToolSinglePoint::ReadToolAttributes(domElement);
|
||||||
|
|
||||||
|
m_aliasSuffix1 = doc->GetParametrEmptyString(domElement, AttrAlias1);
|
||||||
|
m_aliasSuffix2 = doc->GetParametrEmptyString(domElement, AttrAlias2);
|
||||||
|
}
|
||||||
|
|
|
@ -45,18 +45,35 @@
|
||||||
|
|
||||||
class VFormula;
|
class VFormula;
|
||||||
|
|
||||||
|
struct VToolCutInitData : VToolSinglePointInitData
|
||||||
|
{
|
||||||
|
VToolCutInitData()
|
||||||
|
: VToolSinglePointInitData()
|
||||||
|
{}
|
||||||
|
|
||||||
|
quint32 baseCurveId{NULL_ID};
|
||||||
|
QString formula{};
|
||||||
|
QString aliasSuffix1{};
|
||||||
|
QString aliasSuffix2{};
|
||||||
|
};
|
||||||
|
|
||||||
class VToolCut : public VToolSinglePoint
|
class VToolCut : public VToolSinglePoint
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VToolCut(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
explicit VToolCut(const VToolCutInitData &initData, QGraphicsItem * parent = nullptr);
|
||||||
const quint32 &curveCutId, const QString ¬es, QGraphicsItem * parent = nullptr);
|
|
||||||
virtual int type() const override {return Type;}
|
virtual int type() const override {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Tool::Cut)};
|
enum { Type = UserType + static_cast<int>(Tool::Cut)};
|
||||||
|
|
||||||
VFormula GetFormulaLength() const;
|
VFormula GetFormulaLength() const;
|
||||||
void SetFormulaLength(const VFormula &value);
|
void SetFormulaLength(const VFormula &value);
|
||||||
|
|
||||||
|
QString GetAliasSuffix1() const;
|
||||||
|
void SetAliasSuffix1(const QString &alias);
|
||||||
|
|
||||||
|
QString GetAliasSuffix2() const;
|
||||||
|
void SetAliasSuffix2(const QString &alias);
|
||||||
|
|
||||||
QString CurveName() const;
|
QString CurveName() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -67,11 +84,16 @@ protected:
|
||||||
/** @brief formula keep formula of length */
|
/** @brief formula keep formula of length */
|
||||||
QString formula;
|
QString formula;
|
||||||
|
|
||||||
quint32 curveCutId;
|
quint32 baseCurveId;
|
||||||
bool detailsMode;
|
bool detailsMode;
|
||||||
|
|
||||||
|
QString m_aliasSuffix1{};
|
||||||
|
QString m_aliasSuffix2{};
|
||||||
|
|
||||||
void RefreshGeometry();
|
void RefreshGeometry();
|
||||||
virtual void RemoveReferens() override;
|
virtual void RemoveReferens() override;
|
||||||
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) override;
|
||||||
|
virtual void ReadToolAttributes(const QDomElement &domElement) override;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void ShowToolVisualization(bool show);
|
void ShowToolVisualization(bool show);
|
||||||
|
@ -104,7 +126,7 @@ inline void VToolCut::ShowToolVisualization(bool show)
|
||||||
delete vis;
|
delete vis;
|
||||||
}
|
}
|
||||||
|
|
||||||
VDataTool *parent = VAbstractPattern::getTool(VAbstractTool::data.GetGObject(curveCutId)->getIdTool());
|
VDataTool *parent = VAbstractPattern::getTool(VAbstractTool::data.GetGObject(baseCurveId)->getIdTool());
|
||||||
if (VAbstractSpline *parentCurve = qobject_cast<VAbstractSpline *>(parent))
|
if (VAbstractSpline *parentCurve = qobject_cast<VAbstractSpline *>(parent))
|
||||||
{
|
{
|
||||||
detailsMode ? parentCurve->ShowHandles(detailsMode) : parentCurve->ShowHandles(show);
|
detailsMode ? parentCurve->ShowHandles(detailsMode) : parentCurve->ShowHandles(show);
|
||||||
|
|
|
@ -62,8 +62,8 @@ const QString VToolCutArc::ToolType = QStringLiteral("cutArc");
|
||||||
* @param initData init data.
|
* @param initData init data.
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VToolCutArc::VToolCutArc(const VToolCutArcInitData &initData, QGraphicsItem * parent)
|
VToolCutArc::VToolCutArc(const VToolCutInitData &initData, QGraphicsItem * parent)
|
||||||
:VToolCut(initData.doc, initData.data, initData.id, initData.formula, initData.arcId, initData.notes, parent)
|
:VToolCut(initData, parent)
|
||||||
{
|
{
|
||||||
ToolCreation(initData.typeCreation);
|
ToolCreation(initData.typeCreation);
|
||||||
}
|
}
|
||||||
|
@ -79,9 +79,11 @@ void VToolCutArc::setDialog()
|
||||||
SCASSERT(not dialogTool.isNull())
|
SCASSERT(not dialogTool.isNull())
|
||||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(m_id);
|
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(m_id);
|
||||||
dialogTool->SetFormula(formula);
|
dialogTool->SetFormula(formula);
|
||||||
dialogTool->setArcId(curveCutId);
|
dialogTool->setArcId(baseCurveId);
|
||||||
dialogTool->SetPointName(point->name());
|
dialogTool->SetPointName(point->name());
|
||||||
dialogTool->SetNotes(m_notes);
|
dialogTool->SetNotes(m_notes);
|
||||||
|
dialogTool->SetAliasSuffix1(m_aliasSuffix1);
|
||||||
|
dialogTool->SetAliasSuffix2(m_aliasSuffix2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -99,9 +101,9 @@ VToolCutArc* VToolCutArc::Create(const QPointer<DialogTool> &dialog, VMainGraphi
|
||||||
const QPointer<DialogCutArc> dialogTool = qobject_cast<DialogCutArc *>(dialog);
|
const QPointer<DialogCutArc> dialogTool = qobject_cast<DialogCutArc *>(dialog);
|
||||||
SCASSERT(not dialogTool.isNull())
|
SCASSERT(not dialogTool.isNull())
|
||||||
|
|
||||||
VToolCutArcInitData initData;
|
VToolCutInitData initData;
|
||||||
initData.formula = dialogTool->GetFormula();
|
initData.formula = dialogTool->GetFormula();
|
||||||
initData.arcId = dialogTool->getArcId();
|
initData.baseCurveId = dialogTool->getArcId();
|
||||||
initData.name = dialogTool->GetPointName();
|
initData.name = dialogTool->GetPointName();
|
||||||
initData.scene = scene;
|
initData.scene = scene;
|
||||||
initData.doc = doc;
|
initData.doc = doc;
|
||||||
|
@ -109,6 +111,8 @@ VToolCutArc* VToolCutArc::Create(const QPointer<DialogTool> &dialog, VMainGraphi
|
||||||
initData.parse = Document::FullParse;
|
initData.parse = Document::FullParse;
|
||||||
initData.typeCreation = Source::FromGui;
|
initData.typeCreation = Source::FromGui;
|
||||||
initData.notes = dialogTool->GetNotes();
|
initData.notes = dialogTool->GetNotes();
|
||||||
|
initData.aliasSuffix1 = dialogTool->GetAliasSuffix1();
|
||||||
|
initData.aliasSuffix2 = dialogTool->GetAliasSuffix2();
|
||||||
|
|
||||||
VToolCutArc* point = Create(initData);
|
VToolCutArc* point = Create(initData);
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
|
@ -123,12 +127,12 @@ VToolCutArc* VToolCutArc::Create(const QPointer<DialogTool> &dialog, VMainGraphi
|
||||||
* @brief Create help create tool.
|
* @brief Create help create tool.
|
||||||
* @param initData init data.
|
* @param initData init data.
|
||||||
*/
|
*/
|
||||||
VToolCutArc* VToolCutArc::Create(VToolCutArcInitData &initData)
|
VToolCutArc* VToolCutArc::Create(VToolCutInitData &initData)
|
||||||
{
|
{
|
||||||
const QSharedPointer<VArc> arc = initData.data->GeometricObject<VArc>(initData.arcId);
|
const QSharedPointer<VArc> arc = initData.data->GeometricObject<VArc>(initData.baseCurveId);
|
||||||
|
|
||||||
//Declare special variable "CurrentLength"
|
//Declare special variable "CurrentLength"
|
||||||
VCurveLength *length = new VCurveLength(initData.arcId, initData.arcId, arc.data(),
|
VCurveLength *length = new VCurveLength(initData.baseCurveId, initData.baseCurveId, arc.data(),
|
||||||
*initData.data->GetPatternUnit());
|
*initData.data->GetPatternUnit());
|
||||||
length->SetName(currentLength);
|
length->SetName(currentLength);
|
||||||
initData.data->AddVariable(length);
|
initData.data->AddVariable(length);
|
||||||
|
@ -139,6 +143,9 @@ VToolCutArc* VToolCutArc::Create(VToolCutArcInitData &initData)
|
||||||
VArc arc2;
|
VArc arc2;
|
||||||
QPointF point = arc->CutArc(qApp->toPixel(result), arc1, arc2);
|
QPointF point = arc->CutArc(qApp->toPixel(result), arc1, arc2);
|
||||||
|
|
||||||
|
arc1.SetAliasSuffix(initData.aliasSuffix1);
|
||||||
|
arc1.SetAliasSuffix(initData.aliasSuffix2);
|
||||||
|
|
||||||
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);
|
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);
|
||||||
p->SetShowLabel(initData.showLabel);
|
p->SetShowLabel(initData.showLabel);
|
||||||
|
|
||||||
|
@ -147,17 +154,25 @@ VToolCutArc* VToolCutArc::Create(VToolCutArcInitData &initData)
|
||||||
if (initData.typeCreation == Source::FromGui)
|
if (initData.typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
initData.id = initData.data->AddGObject(p);
|
initData.id = initData.data->AddGObject(p);
|
||||||
|
|
||||||
a1->setId(initData.data->getNextId());
|
a1->setId(initData.data->getNextId());
|
||||||
a2->setId(initData.data->getNextId());
|
initData.data->RegisterUniqueName(a1);
|
||||||
initData.data->AddArc(a1, a1->id(), initData.id);
|
initData.data->AddArc(a1, a1->id(), initData.id);
|
||||||
|
|
||||||
|
a2->setId(initData.data->getNextId());
|
||||||
|
initData.data->RegisterUniqueName(a2);
|
||||||
initData.data->AddArc(a2, a2->id(), initData.id);
|
initData.data->AddArc(a2, a2->id(), initData.id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
initData.data->UpdateGObject(initData.id, p);
|
initData.data->UpdateGObject(initData.id, p);
|
||||||
|
|
||||||
a1->setId(initData.id + 1);
|
a1->setId(initData.id + 1);
|
||||||
a2->setId(initData.id + 2);
|
initData.data->RegisterUniqueName(a1);
|
||||||
initData.data->AddArc(a1, a1->id(), initData.id);
|
initData.data->AddArc(a1, a1->id(), initData.id);
|
||||||
|
|
||||||
|
a2->setId(initData.id + 2);
|
||||||
|
initData.data->RegisterUniqueName(a2);
|
||||||
initData.data->AddArc(a2, a2->id(), initData.id);
|
initData.data->AddArc(a2, a2->id(), initData.id);
|
||||||
|
|
||||||
if (initData.parse != Document::FullParse)
|
if (initData.parse != Document::FullParse)
|
||||||
|
@ -212,12 +227,16 @@ void VToolCutArc::SaveDialog(QDomElement &domElement, QList<quint32> &oldDepende
|
||||||
const QPointer<DialogCutArc> dialogTool = qobject_cast<DialogCutArc *>(m_dialog);
|
const QPointer<DialogCutArc> dialogTool = qobject_cast<DialogCutArc *>(m_dialog);
|
||||||
SCASSERT(not dialogTool.isNull())
|
SCASSERT(not dialogTool.isNull())
|
||||||
|
|
||||||
AddDependence(oldDependencies, curveCutId);
|
AddDependence(oldDependencies, baseCurveId);
|
||||||
AddDependence(newDependencies, dialogTool->getArcId());
|
AddDependence(newDependencies, dialogTool->getArcId());
|
||||||
|
|
||||||
doc->SetAttribute(domElement, AttrName, dialogTool->GetPointName());
|
doc->SetAttribute(domElement, AttrName, dialogTool->GetPointName());
|
||||||
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
|
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
|
||||||
doc->SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->getArcId()));
|
doc->SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->getArcId()));
|
||||||
|
doc->SetAttributeOrRemoveIf(domElement, AttrAlias1, dialogTool->GetAliasSuffix1(),
|
||||||
|
dialogTool->GetAliasSuffix1().isEmpty());
|
||||||
|
doc->SetAttributeOrRemoveIf(domElement, AttrAlias2, dialogTool->GetAliasSuffix2(),
|
||||||
|
dialogTool->GetAliasSuffix2().isEmpty());
|
||||||
|
|
||||||
const QString notes = dialogTool->GetNotes();
|
const QString notes = dialogTool->GetNotes();
|
||||||
doc->SetAttributeOrRemoveIf(domElement, AttrNotes, notes, notes.isEmpty());
|
doc->SetAttributeOrRemoveIf(domElement, AttrNotes, notes, notes.isEmpty());
|
||||||
|
@ -230,7 +249,7 @@ void VToolCutArc::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
||||||
|
|
||||||
doc->SetAttribute(tag, AttrType, ToolType);
|
doc->SetAttribute(tag, AttrType, ToolType);
|
||||||
doc->SetAttribute(tag, AttrLength, formula);
|
doc->SetAttribute(tag, AttrLength, formula);
|
||||||
doc->SetAttribute(tag, AttrArc, curveCutId);
|
doc->SetAttribute(tag, AttrArc, baseCurveId);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -239,7 +258,7 @@ void VToolCutArc::ReadToolAttributes(const QDomElement &domElement)
|
||||||
VToolCut::ReadToolAttributes(domElement);
|
VToolCut::ReadToolAttributes(domElement);
|
||||||
|
|
||||||
formula = doc->GetParametrString(domElement, AttrLength, QString());
|
formula = doc->GetParametrString(domElement, AttrLength, QString());
|
||||||
curveCutId = doc->GetParametrUInt(domElement, AttrArc, NULL_ID_STR);
|
baseCurveId = doc->GetParametrUInt(domElement, AttrArc, NULL_ID_STR);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -250,10 +269,10 @@ void VToolCutArc::SetVisualization()
|
||||||
VisToolCutArc *visual = qobject_cast<VisToolCutArc *>(vis);
|
VisToolCutArc *visual = qobject_cast<VisToolCutArc *>(vis);
|
||||||
SCASSERT(visual != nullptr)
|
SCASSERT(visual != nullptr)
|
||||||
|
|
||||||
visual->setObject1Id(curveCutId);
|
visual->setObject1Id(baseCurveId);
|
||||||
visual->setLength(qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator()));
|
visual->setLength(qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator()));
|
||||||
|
|
||||||
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(curveCutId);
|
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(baseCurveId);
|
||||||
visual->setLineStyle(LineStyleToPenStyle(curve->GetPenStyle()));
|
visual->setLineStyle(LineStyleToPenStyle(curve->GetPenStyle()));
|
||||||
|
|
||||||
visual->RefreshGeometry();
|
visual->RefreshGeometry();
|
||||||
|
@ -263,7 +282,7 @@ void VToolCutArc::SetVisualization()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VToolCutArc::MakeToolTip() const
|
QString VToolCutArc::MakeToolTip() const
|
||||||
{
|
{
|
||||||
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(curveCutId);
|
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(baseCurveId);
|
||||||
|
|
||||||
const QString expression = qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator());
|
const QString expression = qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator());
|
||||||
const qreal length = Visualization::FindValFromUser(expression, VAbstractTool::data.DataVariables());
|
const qreal length = Visualization::FindValFromUser(expression, VAbstractTool::data.DataVariables());
|
||||||
|
@ -296,7 +315,7 @@ QString VToolCutArc::MakeToolTip() const
|
||||||
.arg(arc.GetStartAngle())
|
.arg(arc.GetStartAngle())
|
||||||
.arg(arcStr + arcNumber + QChar(QChar::Space) + endAngleStr)
|
.arg(arcStr + arcNumber + QChar(QChar::Space) + endAngleStr)
|
||||||
.arg(arc.GetEndAngle())
|
.arg(arc.GetEndAngle())
|
||||||
.arg(arcStr + arcNumber + QChar(QChar::Space) + tr("label"), arc.name());
|
.arg(arcStr + arcNumber + QChar(QChar::Space) + tr("label"), arc.ObjectName());
|
||||||
return toolTip;
|
return toolTip;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -43,18 +43,6 @@
|
||||||
|
|
||||||
template <class T> class QSharedPointer;
|
template <class T> class QSharedPointer;
|
||||||
|
|
||||||
struct VToolCutArcInitData : VToolSinglePointInitData
|
|
||||||
{
|
|
||||||
VToolCutArcInitData()
|
|
||||||
: VToolSinglePointInitData(),
|
|
||||||
formula(),
|
|
||||||
arcId(NULL_ID)
|
|
||||||
{}
|
|
||||||
|
|
||||||
QString formula;
|
|
||||||
quint32 arcId;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The VToolCutArc class tool for cutting arc.
|
* @brief The VToolCutArc class tool for cutting arc.
|
||||||
*/
|
*/
|
||||||
|
@ -65,7 +53,7 @@ public:
|
||||||
virtual void setDialog() override;
|
virtual void setDialog() override;
|
||||||
static VToolCutArc* Create(const QPointer<DialogTool> &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
static VToolCutArc* Create(const QPointer<DialogTool> &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||||
VContainer *data);
|
VContainer *data);
|
||||||
static VToolCutArc* Create(VToolCutArcInitData &initData);
|
static VToolCutArc* Create(VToolCutInitData &initData);
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
virtual int type() const override {return Type;}
|
virtual int type() const override {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Tool::CutArc)};
|
enum { Type = UserType + static_cast<int>(Tool::CutArc)};
|
||||||
|
@ -82,7 +70,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolCutArc)
|
Q_DISABLE_COPY(VToolCutArc)
|
||||||
|
|
||||||
VToolCutArc(const VToolCutArcInitData &initData, QGraphicsItem *parent = nullptr);
|
explicit VToolCutArc(const VToolCutInitData &initData, QGraphicsItem *parent = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VTOOLCUTARC_H
|
#endif // VTOOLCUTARC_H
|
||||||
|
|
|
@ -65,8 +65,8 @@ const QString VToolCutSpline::AttrSpline = QStringLiteral("spline");
|
||||||
* @param initData init data.
|
* @param initData init data.
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VToolCutSpline::VToolCutSpline(const VToolCutSplineInitData &initData, QGraphicsItem *parent)
|
VToolCutSpline::VToolCutSpline(const VToolCutInitData &initData, QGraphicsItem *parent)
|
||||||
:VToolCut(initData.doc, initData.data, initData.id, initData.formula, initData.splineId, initData.notes, parent)
|
:VToolCut(initData, parent)
|
||||||
{
|
{
|
||||||
ToolCreation(initData.typeCreation);
|
ToolCreation(initData.typeCreation);
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ void VToolCutSpline::setDialog()
|
||||||
SCASSERT(not dialogTool.isNull())
|
SCASSERT(not dialogTool.isNull())
|
||||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(m_id);
|
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(m_id);
|
||||||
dialogTool->SetFormula(formula);
|
dialogTool->SetFormula(formula);
|
||||||
dialogTool->setSplineId(curveCutId);
|
dialogTool->setSplineId(baseCurveId);
|
||||||
dialogTool->SetPointName(point->name());
|
dialogTool->SetPointName(point->name());
|
||||||
dialogTool->SetNotes(m_notes);
|
dialogTool->SetNotes(m_notes);
|
||||||
}
|
}
|
||||||
|
@ -102,9 +102,9 @@ VToolCutSpline* VToolCutSpline::Create(const QPointer<DialogTool> &dialog, VMain
|
||||||
const QPointer<DialogCutSpline> dialogTool = qobject_cast<DialogCutSpline *>(dialog);
|
const QPointer<DialogCutSpline> dialogTool = qobject_cast<DialogCutSpline *>(dialog);
|
||||||
SCASSERT(not dialogTool.isNull())
|
SCASSERT(not dialogTool.isNull())
|
||||||
|
|
||||||
VToolCutSplineInitData initData;
|
VToolCutInitData initData;
|
||||||
initData.formula = dialogTool->GetFormula();
|
initData.formula = dialogTool->GetFormula();
|
||||||
initData.splineId = dialogTool->getSplineId();
|
initData.baseCurveId = dialogTool->getSplineId();
|
||||||
initData.name = dialogTool->GetPointName();
|
initData.name = dialogTool->GetPointName();
|
||||||
initData.scene = scene;
|
initData.scene = scene;
|
||||||
initData.doc = doc;
|
initData.doc = doc;
|
||||||
|
@ -126,12 +126,12 @@ VToolCutSpline* VToolCutSpline::Create(const QPointer<DialogTool> &dialog, VMain
|
||||||
* @brief Create help create tool.
|
* @brief Create help create tool.
|
||||||
* @param initData init data.
|
* @param initData init data.
|
||||||
*/
|
*/
|
||||||
VToolCutSpline* VToolCutSpline::Create(VToolCutSplineInitData &initData)
|
VToolCutSpline* VToolCutSpline::Create(VToolCutInitData &initData)
|
||||||
{
|
{
|
||||||
const auto spl = initData.data->GeometricObject<VAbstractCubicBezier>(initData.splineId);
|
const auto spl = initData.data->GeometricObject<VAbstractCubicBezier>(initData.baseCurveId);
|
||||||
|
|
||||||
//Declare special variable "CurrentLength"
|
//Declare special variable "CurrentLength"
|
||||||
VCurveLength *length = new VCurveLength(initData.splineId, initData.splineId, spl.data(),
|
VCurveLength *length = new VCurveLength(initData.baseCurveId, initData.baseCurveId, spl.data(),
|
||||||
*initData.data->GetPatternUnit());
|
*initData.data->GetPatternUnit());
|
||||||
length->SetName(currentLength);
|
length->SetName(currentLength);
|
||||||
initData.data->AddVariable(length);
|
initData.data->AddVariable(length);
|
||||||
|
@ -211,7 +211,7 @@ void VToolCutSpline::SaveDialog(QDomElement &domElement, QList<quint32> &oldDepe
|
||||||
const QPointer<DialogCutSpline> dialogTool = qobject_cast<DialogCutSpline *>(m_dialog);
|
const QPointer<DialogCutSpline> dialogTool = qobject_cast<DialogCutSpline *>(m_dialog);
|
||||||
SCASSERT(not dialogTool.isNull())
|
SCASSERT(not dialogTool.isNull())
|
||||||
|
|
||||||
AddDependence(oldDependencies, curveCutId);
|
AddDependence(oldDependencies, baseCurveId);
|
||||||
AddDependence(newDependencies, dialogTool->getSplineId());
|
AddDependence(newDependencies, dialogTool->getSplineId());
|
||||||
|
|
||||||
doc->SetAttribute(domElement, AttrName, dialogTool->GetPointName());
|
doc->SetAttribute(domElement, AttrName, dialogTool->GetPointName());
|
||||||
|
@ -229,7 +229,7 @@ void VToolCutSpline::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj
|
||||||
|
|
||||||
doc->SetAttribute(tag, AttrType, ToolType);
|
doc->SetAttribute(tag, AttrType, ToolType);
|
||||||
doc->SetAttribute(tag, AttrLength, formula);
|
doc->SetAttribute(tag, AttrLength, formula);
|
||||||
doc->SetAttribute(tag, AttrSpline, curveCutId);
|
doc->SetAttribute(tag, AttrSpline, baseCurveId);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -238,7 +238,7 @@ void VToolCutSpline::ReadToolAttributes(const QDomElement &domElement)
|
||||||
VToolCut::ReadToolAttributes(domElement);
|
VToolCut::ReadToolAttributes(domElement);
|
||||||
|
|
||||||
formula = doc->GetParametrString(domElement, AttrLength, QString());
|
formula = doc->GetParametrString(domElement, AttrLength, QString());
|
||||||
curveCutId = doc->GetParametrUInt(domElement, AttrSpline, NULL_ID_STR);
|
baseCurveId = doc->GetParametrUInt(domElement, AttrSpline, NULL_ID_STR);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -249,10 +249,10 @@ void VToolCutSpline::SetVisualization()
|
||||||
VisToolCutSpline *visual = qobject_cast<VisToolCutSpline *>(vis);
|
VisToolCutSpline *visual = qobject_cast<VisToolCutSpline *>(vis);
|
||||||
SCASSERT(visual != nullptr)
|
SCASSERT(visual != nullptr)
|
||||||
|
|
||||||
visual->setObject1Id(curveCutId);
|
visual->setObject1Id(baseCurveId);
|
||||||
visual->setLength(qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator()));
|
visual->setLength(qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator()));
|
||||||
|
|
||||||
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(curveCutId);
|
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(baseCurveId);
|
||||||
visual->setLineStyle(LineStyleToPenStyle(curve->GetPenStyle()));
|
visual->setLineStyle(LineStyleToPenStyle(curve->GetPenStyle()));
|
||||||
|
|
||||||
visual->RefreshGeometry();
|
visual->RefreshGeometry();
|
||||||
|
@ -262,7 +262,7 @@ void VToolCutSpline::SetVisualization()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VToolCutSpline::MakeToolTip() const
|
QString VToolCutSpline::MakeToolTip() const
|
||||||
{
|
{
|
||||||
const auto spl = VAbstractTool::data.GeometricObject<VAbstractCubicBezier>(curveCutId);
|
const auto spl = VAbstractTool::data.GeometricObject<VAbstractCubicBezier>(baseCurveId);
|
||||||
|
|
||||||
const QString expression = qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator());
|
const QString expression = qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator());
|
||||||
const qreal length = Visualization::FindValFromUser(expression, VAbstractTool::data.DataVariables());
|
const qreal length = Visualization::FindValFromUser(expression, VAbstractTool::data.DataVariables());
|
||||||
|
|
|
@ -43,18 +43,6 @@
|
||||||
|
|
||||||
template <class T> class QSharedPointer;
|
template <class T> class QSharedPointer;
|
||||||
|
|
||||||
struct VToolCutSplineInitData : VToolSinglePointInitData
|
|
||||||
{
|
|
||||||
VToolCutSplineInitData()
|
|
||||||
: VToolSinglePointInitData(),
|
|
||||||
formula(),
|
|
||||||
splineId(NULL_ID)
|
|
||||||
{}
|
|
||||||
|
|
||||||
QString formula;
|
|
||||||
quint32 splineId;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The VToolCutSpline class for tool CutSpline. This tool find point on spline and cut spline on two.
|
* @brief The VToolCutSpline class for tool CutSpline. This tool find point on spline and cut spline on two.
|
||||||
*/
|
*/
|
||||||
|
@ -65,7 +53,7 @@ public:
|
||||||
virtual void setDialog() override;
|
virtual void setDialog() override;
|
||||||
static VToolCutSpline *Create(const QPointer<DialogTool> &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
static VToolCutSpline *Create(const QPointer<DialogTool> &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||||
VContainer *data);
|
VContainer *data);
|
||||||
static VToolCutSpline *Create(VToolCutSplineInitData &initData);
|
static VToolCutSpline *Create(VToolCutInitData &initData);
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
static const QString AttrSpline;
|
static const QString AttrSpline;
|
||||||
virtual int type() const override {return Type;}
|
virtual int type() const override {return Type;}
|
||||||
|
@ -83,7 +71,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolCutSpline)
|
Q_DISABLE_COPY(VToolCutSpline)
|
||||||
|
|
||||||
VToolCutSpline(const VToolCutSplineInitData &initData, QGraphicsItem * parent = nullptr);
|
VToolCutSpline(const VToolCutInitData &initData, QGraphicsItem * parent = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VTOOLCUTSPLINE_H
|
#endif // VTOOLCUTSPLINE_H
|
||||||
|
|
|
@ -68,8 +68,8 @@ const QString VToolCutSplinePath::AttrSplinePath = QStringLiteral("splinePath");
|
||||||
* @param initData init data.
|
* @param initData init data.
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VToolCutSplinePath::VToolCutSplinePath(const VToolCutSplinePathInitData &initData, QGraphicsItem *parent)
|
VToolCutSplinePath::VToolCutSplinePath(const VToolCutInitData &initData, QGraphicsItem *parent)
|
||||||
:VToolCut(initData.doc, initData.data, initData.id, initData.formula, initData.splinePathId, initData.notes, parent)
|
:VToolCut(initData, parent)
|
||||||
{
|
{
|
||||||
ToolCreation(initData.typeCreation);
|
ToolCreation(initData.typeCreation);
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ void VToolCutSplinePath::setDialog()
|
||||||
SCASSERT(not dialogTool.isNull())
|
SCASSERT(not dialogTool.isNull())
|
||||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(m_id);
|
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(m_id);
|
||||||
dialogTool->SetFormula(formula);
|
dialogTool->SetFormula(formula);
|
||||||
dialogTool->setSplinePathId(curveCutId);
|
dialogTool->setSplinePathId(baseCurveId);
|
||||||
dialogTool->SetPointName(point->name());
|
dialogTool->SetPointName(point->name());
|
||||||
dialogTool->SetNotes(m_notes);
|
dialogTool->SetNotes(m_notes);
|
||||||
}
|
}
|
||||||
|
@ -105,9 +105,9 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const QPointer<DialogTool> &dialo
|
||||||
const QPointer<DialogCutSplinePath> dialogTool = qobject_cast<DialogCutSplinePath *>(dialog);
|
const QPointer<DialogCutSplinePath> dialogTool = qobject_cast<DialogCutSplinePath *>(dialog);
|
||||||
SCASSERT(not dialogTool.isNull())
|
SCASSERT(not dialogTool.isNull())
|
||||||
|
|
||||||
VToolCutSplinePathInitData initData;
|
VToolCutInitData initData;
|
||||||
initData.formula = dialogTool->GetFormula();
|
initData.formula = dialogTool->GetFormula();
|
||||||
initData.splinePathId = dialogTool->getSplinePathId();
|
initData.baseCurveId = dialogTool->getSplinePathId();
|
||||||
initData.name = dialogTool->GetPointName();
|
initData.name = dialogTool->GetPointName();
|
||||||
initData.scene = scene;
|
initData.scene = scene;
|
||||||
initData.doc = doc;
|
initData.doc = doc;
|
||||||
|
@ -129,13 +129,13 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const QPointer<DialogTool> &dialo
|
||||||
* @brief Create help create tool.
|
* @brief Create help create tool.
|
||||||
* @param initData init data.
|
* @param initData init data.
|
||||||
*/
|
*/
|
||||||
VToolCutSplinePath* VToolCutSplinePath::Create(VToolCutSplinePathInitData &initData)
|
VToolCutSplinePath* VToolCutSplinePath::Create(VToolCutInitData &initData)
|
||||||
{
|
{
|
||||||
const auto splPath = initData.data->GeometricObject<VAbstractCubicBezierPath>(initData.splinePathId);
|
const auto splPath = initData.data->GeometricObject<VAbstractCubicBezierPath>(initData.baseCurveId);
|
||||||
SCASSERT(splPath != nullptr)
|
SCASSERT(splPath != nullptr)
|
||||||
|
|
||||||
//Declare special variable "CurrentLength"
|
//Declare special variable "CurrentLength"
|
||||||
VCurveLength *length = new VCurveLength(initData.splinePathId, initData.splinePathId, splPath.data(),
|
VCurveLength *length = new VCurveLength(initData.baseCurveId, initData.baseCurveId, splPath.data(),
|
||||||
*initData.data->GetPatternUnit());
|
*initData.data->GetPatternUnit());
|
||||||
length->SetName(currentLength);
|
length->SetName(currentLength);
|
||||||
initData.data->AddVariable(length);
|
initData.data->AddVariable(length);
|
||||||
|
@ -302,7 +302,7 @@ void VToolCutSplinePath::SaveDialog(QDomElement &domElement, QList<quint32> &old
|
||||||
const QPointer<DialogCutSplinePath> dialogTool = qobject_cast<DialogCutSplinePath *>(m_dialog);
|
const QPointer<DialogCutSplinePath> dialogTool = qobject_cast<DialogCutSplinePath *>(m_dialog);
|
||||||
SCASSERT(not dialogTool.isNull())
|
SCASSERT(not dialogTool.isNull())
|
||||||
|
|
||||||
AddDependence(oldDependencies, curveCutId);
|
AddDependence(oldDependencies, baseCurveId);
|
||||||
AddDependence(newDependencies, dialogTool->getSplinePathId());
|
AddDependence(newDependencies, dialogTool->getSplinePathId());
|
||||||
|
|
||||||
doc->SetAttribute(domElement, AttrName, dialogTool->GetPointName());
|
doc->SetAttribute(domElement, AttrName, dialogTool->GetPointName());
|
||||||
|
@ -320,7 +320,7 @@ void VToolCutSplinePath::SaveOptions(QDomElement &tag, QSharedPointer<VGObject>
|
||||||
|
|
||||||
doc->SetAttribute(tag, AttrType, ToolType);
|
doc->SetAttribute(tag, AttrType, ToolType);
|
||||||
doc->SetAttribute(tag, AttrLength, formula);
|
doc->SetAttribute(tag, AttrLength, formula);
|
||||||
doc->SetAttribute(tag, AttrSplinePath, curveCutId);
|
doc->SetAttribute(tag, AttrSplinePath, baseCurveId);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -329,7 +329,7 @@ void VToolCutSplinePath::ReadToolAttributes(const QDomElement &domElement)
|
||||||
VToolCut::ReadToolAttributes(domElement);
|
VToolCut::ReadToolAttributes(domElement);
|
||||||
|
|
||||||
formula = doc->GetParametrString(domElement, AttrLength, QString());
|
formula = doc->GetParametrString(domElement, AttrLength, QString());
|
||||||
curveCutId = doc->GetParametrUInt(domElement, AttrSplinePath, NULL_ID_STR);
|
baseCurveId = doc->GetParametrUInt(domElement, AttrSplinePath, NULL_ID_STR);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -340,10 +340,10 @@ void VToolCutSplinePath::SetVisualization()
|
||||||
VisToolCutSplinePath *visual = qobject_cast<VisToolCutSplinePath *>(vis);
|
VisToolCutSplinePath *visual = qobject_cast<VisToolCutSplinePath *>(vis);
|
||||||
SCASSERT(visual != nullptr)
|
SCASSERT(visual != nullptr)
|
||||||
|
|
||||||
visual->setObject1Id(curveCutId);
|
visual->setObject1Id(baseCurveId);
|
||||||
visual->setLength(qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator()));
|
visual->setLength(qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator()));
|
||||||
|
|
||||||
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(curveCutId);
|
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(baseCurveId);
|
||||||
visual->setLineStyle(LineStyleToPenStyle(curve->GetPenStyle()));
|
visual->setLineStyle(LineStyleToPenStyle(curve->GetPenStyle()));
|
||||||
|
|
||||||
visual->RefreshGeometry();
|
visual->RefreshGeometry();
|
||||||
|
@ -353,7 +353,7 @@ void VToolCutSplinePath::SetVisualization()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VToolCutSplinePath::MakeToolTip() const
|
QString VToolCutSplinePath::MakeToolTip() const
|
||||||
{
|
{
|
||||||
const auto splPath = VAbstractTool::data.GeometricObject<VAbstractCubicBezierPath>(curveCutId);
|
const auto splPath = VAbstractTool::data.GeometricObject<VAbstractCubicBezierPath>(baseCurveId);
|
||||||
|
|
||||||
const QString expression = qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator());
|
const QString expression = qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator());
|
||||||
const qreal length = Visualization::FindValFromUser(expression, VAbstractTool::data.DataVariables());
|
const qreal length = Visualization::FindValFromUser(expression, VAbstractTool::data.DataVariables());
|
||||||
|
|
|
@ -44,18 +44,6 @@
|
||||||
class VSplinePath;
|
class VSplinePath;
|
||||||
template <class T> class QSharedPointer;
|
template <class T> class QSharedPointer;
|
||||||
|
|
||||||
struct VToolCutSplinePathInitData : VToolSinglePointInitData
|
|
||||||
{
|
|
||||||
VToolCutSplinePathInitData()
|
|
||||||
: VToolSinglePointInitData(),
|
|
||||||
formula(),
|
|
||||||
splinePathId(NULL_ID)
|
|
||||||
{}
|
|
||||||
|
|
||||||
QString formula;
|
|
||||||
quint32 splinePathId;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The VToolCutSplinePath class for tool CutSplinePath. This tool find point on splinePath and cut splinePath on
|
* @brief The VToolCutSplinePath class for tool CutSplinePath. This tool find point on splinePath and cut splinePath on
|
||||||
* two.
|
* two.
|
||||||
|
@ -67,7 +55,7 @@ public:
|
||||||
virtual void setDialog() override;
|
virtual void setDialog() override;
|
||||||
static VToolCutSplinePath *Create(const QPointer<DialogTool> &dialog, VMainGraphicsScene *scene,
|
static VToolCutSplinePath *Create(const QPointer<DialogTool> &dialog, VMainGraphicsScene *scene,
|
||||||
VAbstractPattern *doc, VContainer *data);
|
VAbstractPattern *doc, VContainer *data);
|
||||||
static VToolCutSplinePath *Create(VToolCutSplinePathInitData &initData);
|
static VToolCutSplinePath *Create(VToolCutInitData &initData);
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
static const QString AttrSplinePath;
|
static const QString AttrSplinePath;
|
||||||
virtual int type() const override {return Type;}
|
virtual int type() const override {return Type;}
|
||||||
|
@ -90,7 +78,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolCutSplinePath)
|
Q_DISABLE_COPY(VToolCutSplinePath)
|
||||||
|
|
||||||
VToolCutSplinePath(const VToolCutSplinePathInitData &initData, QGraphicsItem *parent = nullptr);
|
VToolCutSplinePath(const VToolCutInitData &initData, QGraphicsItem *parent = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VTOOLCUTSPLINEPATH_H
|
#endif // VTOOLCUTSPLINEPATH_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user