Color property also for cut tools: cut arc, cut spline, cut spline path.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-02-08 12:23:26 +02:00
parent aa7b2a4112
commit eb56288d13
19 changed files with 170 additions and 37 deletions

View File

@ -58,6 +58,7 @@ DialogCutArc::DialogCutArc(const VContainer *data, const quint32 &toolId, QWidge
CheckState();
FillComboBoxArcs(ui->comboBoxArc);
FillComboBoxLineColors(ui->comboBoxColor);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutArc::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutArc::PutVal);
@ -157,6 +158,18 @@ void DialogCutArc::setArcId(const quint32 &value)
path->setPoint1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogCutArc::GetColor() const
{
return GetComboBoxCurrentData(ui->comboBoxColor);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCutArc::SetColor(const QString &value)
{
ChangeCurrentData(ui->comboBoxColor, value);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetFormula set string with formula length

View File

@ -56,6 +56,9 @@ public:
quint32 getArcId() const;
void setArcId(const quint32 &value);
QString GetColor() const;
void SetColor(const QString &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
/**

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>412</width>
<height>433</height>
<height>466</height>
</rect>
</property>
<property name="windowTitle">
@ -250,6 +250,16 @@
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditNamePoint"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Color</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxColor"/>
</item>
</layout>
</item>
<item>

View File

@ -57,6 +57,7 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId,
CheckState();
FillComboBoxSplines(ui->comboBoxSpline);
FillComboBoxLineColors(ui->comboBoxColor);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSpline::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSpline::PutVal);
@ -119,6 +120,18 @@ void DialogCutSpline::setSplineId(const quint32 &value)
path->setPoint1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogCutSpline::GetColor() const
{
return GetComboBoxCurrentData(ui->comboBoxColor);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCutSpline::SetColor(const QString &value)
{
ChangeCurrentData(ui->comboBoxColor, value);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.

View File

@ -55,6 +55,9 @@ public:
quint32 getSplineId() const;
void setSplineId(const quint32 &value);
QString GetColor() const;
void SetColor(const QString &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
/**

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>412</width>
<height>433</height>
<height>466</height>
</rect>
</property>
<property name="windowTitle">
@ -217,7 +217,7 @@
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -237,7 +237,7 @@
<item row="1" column="0">
<widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -250,6 +250,16 @@
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditNamePoint"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Color</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxColor"/>
</item>
</layout>
</item>
<item>

View File

@ -57,6 +57,7 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &
CheckState();
FillComboBoxSplinesPath(ui->comboBoxSplinePath);
FillComboBoxLineColors(ui->comboBoxColor);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSplinePath::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSplinePath::PutVal);
@ -119,6 +120,18 @@ void DialogCutSplinePath::setSplinePathId(const quint32 &value)
path->setPoint1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogCutSplinePath::GetColor() const
{
return GetComboBoxCurrentData(ui->comboBoxColor);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCutSplinePath::SetColor(const QString &value)
{
ChangeCurrentData(ui->comboBoxColor, value);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.

View File

@ -55,6 +55,9 @@ public:
quint32 getSplinePathId() const;
void setSplinePathId(const quint32 &value);
QString GetColor() const;
void SetColor(const QString &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
/**

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>412</width>
<height>433</height>
<height>466</height>
</rect>
</property>
<property name="windowTitle">
@ -217,7 +217,7 @@
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -237,7 +237,7 @@
<item row="1" column="0">
<widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -250,6 +250,22 @@
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditNamePoint"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Color</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxColor"/>
</item>
</layout>
</item>
<item>

View File

@ -32,7 +32,7 @@
//---------------------------------------------------------------------------------------------------------------------
VToolCut::VToolCut(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &curveCutId, const quint32 &curve1id, const quint32 &curve2id,
const quint32 &curveCutId, const quint32 &curve1id, const quint32 &curve2id, const QString &color,
QGraphicsItem *parent)
:VToolPoint(doc, data, id, parent), formula(formula), firstCurve(nullptr), secondCurve(nullptr),
curveCutId(curveCutId), curve1id(curve1id), curve2id(curve2id)
@ -41,6 +41,8 @@ VToolCut::VToolCut(VPattern *doc, VContainer *data, const quint32 &id, const QSt
Q_ASSERT_X(curve1id > 0, Q_FUNC_INFO, "curve1id <= 0");
Q_ASSERT_X(curve2id > 0, Q_FUNC_INFO, "curve2id <= 0");
lineColor = color;
firstCurve = new VSimpleCurve(curve1id, QColor(lineColor), SimpleCurvePoint::ForthPoint, &factor);
firstCurve->setParentItem(this);
connect(firstCurve, &VSimpleCurve::Choosed, this, &VToolCut::CurveChoosed);

View File

@ -39,7 +39,7 @@ class VToolCut : public VToolPoint
Q_OBJECT
public:
VToolCut(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, const quint32 &curveCutId,
const quint32 &curve1id, const quint32 &curve2id, QGraphicsItem * parent = nullptr);
const quint32 &curve1id, const quint32 &curve2id, const QString &color, QGraphicsItem * parent = nullptr);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::Cut)};

View File

@ -50,9 +50,9 @@ const QString VToolCutArc::AttrArc = QStringLiteral("arc");
* @param parent parent object.
*/
VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &arcId, const quint32 &arc1id, const quint32 &arc2id,
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, parent)
:VToolCut(doc, data, id, formula, arcId, arc1id, arc2id, color, parent)
{
RefreshCurve(firstCurve, curve1id, SimpleCurvePoint::ForthPoint);
RefreshCurve(secondCurve, curve2id, SimpleCurvePoint::FirstPoint);
@ -80,6 +80,7 @@ void VToolCutArc::setDialog()
dialogTool->SetFormula(formula);
dialogTool->setArcId(curveCutId);
dialogTool->SetPointName(point->name());
dialogTool->SetColor(lineColor);
}
//---------------------------------------------------------------------------------------------------------------------
@ -98,8 +99,9 @@ VToolCutArc* VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene,
const QString pointName = dialogTool->getPointName();
QString formula = dialogTool->GetFormula();
const quint32 arcId = dialogTool->getArcId();
const QString color = dialogTool->GetColor();
VToolCutArc* point = nullptr;
point=Create(0, pointName, formula, arcId, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
point=Create(0, pointName, formula, arcId, 5, 10, color, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
@ -123,8 +125,8 @@ VToolCutArc* VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene,
* @param typeCreation way we create this tool.
*/
VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
const qreal &mx, const qreal &my, const QString &color, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation)
{
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(arcId);
@ -167,7 +169,7 @@ 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, typeCreation);
VToolCutArc *point = new VToolCutArc(doc, data, id, formula, arcId, arc1id, arc2id, color, typeCreation);
scene->addItem(point);
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolCutArc::SetFactor);
@ -274,6 +276,7 @@ void VToolCutArc::SaveDialog(QDomElement &domElement)
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
doc->SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->getArcId()));
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
}
//---------------------------------------------------------------------------------------------------------------------
@ -312,6 +315,7 @@ void VToolCutArc::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(tag, AttrColor, lineColor);
doc->SetAttribute(tag, AttrLength, formula);
doc->SetAttribute(tag, AttrArc, curveCutId);
@ -322,4 +326,5 @@ void VToolCutArc::ReadToolAttributes(const QDomElement &domElement)
{
formula = doc->GetParametrString(domElement, AttrLength, "");
curveCutId = doc->GetParametrUInt(domElement, AttrArc, NULL_ID_STR);
lineColor = doc->GetParametrString(domElement, AttrColor, ColorBlack);
}

View File

@ -39,13 +39,13 @@ class VToolCutArc : public VToolCut
Q_OBJECT
public:
VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, const quint32 &arcId,
const quint32 &arc1id, const quint32 &arc2id, const Source &typeCreation,
const quint32 &arc1id, const quint32 &arc2id, const QString &color, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
virtual void setDialog();
static VToolCutArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
static VToolCutArc* Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation);
const qreal &mx, const qreal &my, const QString &color, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation);
static const QString ToolType;
static const QString AttrArc;
virtual int type() const {return Type;}

View File

@ -50,8 +50,8 @@ const QString VToolCutSpline::AttrSpline = QStringLiteral("spline");
*/
VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id,
const Source &typeCreation, QGraphicsItem *parent)
:VToolCut(doc, data, id, formula, splineId, spl1id, spl2id, parent)
const QString &color, const Source &typeCreation, QGraphicsItem *parent)
:VToolCut(doc, data, id, formula, splineId, spl1id, spl2id, color, parent)
{
RefreshCurve(firstCurve, curve1id, SimpleCurvePoint::ForthPoint);
RefreshCurve(secondCurve, curve2id, SimpleCurvePoint::FirstPoint);
@ -79,6 +79,7 @@ void VToolCutSpline::setDialog()
dialogTool->SetFormula(formula);
dialogTool->setSplineId(curveCutId);
dialogTool->SetPointName(point->name());
dialogTool->SetColor(lineColor);
}
//---------------------------------------------------------------------------------------------------------------------
@ -98,8 +99,10 @@ VToolCutSpline* VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *s
const QString pointName = dialogTool->getPointName();
QString formula = dialogTool->GetFormula();
const quint32 splineId = dialogTool->getSplineId();
const QString color = dialogTool->GetColor();
VToolCutSpline* point = nullptr;
point = Create(0, pointName, formula, splineId, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
point = Create(0, pointName, formula, splineId, 5, 10, color, scene, doc, data, Document::FullParse,
Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
@ -123,7 +126,7 @@ VToolCutSpline* VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *s
* @param typeCreation way we create this tool.
*/
VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointName, QString &formula,
const quint32 &splineId, const qreal &mx, const qreal &my,
const quint32 &splineId, const qreal &mx, const qreal &my, const QString &color,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
{
@ -174,7 +177,8 @@ 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, typeCreation);
VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, spl1id, spl2id, color,
typeCreation);
scene->addItem(point);
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolCutSpline::SetFactor);
@ -285,6 +289,7 @@ void VToolCutSpline::SaveDialog(QDomElement &domElement)
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
doc->SetAttribute(domElement, AttrSpline, QString().setNum(dialogTool->getSplineId()));
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
}
//---------------------------------------------------------------------------------------------------------------------
@ -323,6 +328,7 @@ void VToolCutSpline::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(tag, AttrColor, lineColor);
doc->SetAttribute(tag, AttrLength, formula);
doc->SetAttribute(tag, AttrSpline, curveCutId);
@ -333,4 +339,5 @@ void VToolCutSpline::ReadToolAttributes(const QDomElement &domElement)
{
formula = doc->GetParametrString(domElement, AttrLength, "");
curveCutId = doc->GetParametrUInt(domElement, AttrSpline, NULL_ID_STR);
lineColor = doc->GetParametrString(domElement, AttrColor, ColorBlack);
}

View File

@ -40,13 +40,14 @@ class VToolCutSpline : public VToolCut
public:
VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id,
const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id, const QString &color,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
virtual void setDialog();
static VToolCutSpline *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
static VToolCutSpline *Create(const quint32 _id, const QString &pointName, QString &formula,
const quint32 &splineId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation);
const quint32 &splineId, const qreal &mx, const qreal &my, const QString &color,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
static const QString ToolType;
static const QString AttrSpline;
virtual int type() const {return Type;}

View File

@ -53,9 +53,9 @@ const QString VToolCutSplinePath::AttrSplinePath = QStringLiteral("splinePath");
*/
VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const quint32 &id,
const QString &formula, const quint32 &splinePathId,
const quint32 &splPath1id, const quint32 &splPath2id,
const quint32 &splPath1id, const quint32 &splPath2id, const QString &color,
const Source &typeCreation, QGraphicsItem *parent)
:VToolCut(doc, data, id, formula, splinePathId, splPath1id, splPath2id, parent)
:VToolCut(doc, data, id, formula, splinePathId, splPath1id, splPath2id, color, parent)
{
RefreshCurve(firstCurve, curve1id, SimpleCurvePoint::ForthPoint);
RefreshCurve(secondCurve, curve2id, SimpleCurvePoint::FirstPoint);
@ -83,6 +83,7 @@ void VToolCutSplinePath::setDialog()
dialogTool->SetFormula(formula);
dialogTool->setSplinePathId(curveCutId);
dialogTool->SetPointName(point->name());
dialogTool->SetColor(lineColor);
}
//---------------------------------------------------------------------------------------------------------------------
@ -102,8 +103,10 @@ VToolCutSplinePath* VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphics
const QString pointName = dialogTool->getPointName();
QString formula = dialogTool->GetFormula();
const quint32 splinePathId = dialogTool->getSplinePathId();
const QString color = dialogTool->GetColor();
VToolCutSplinePath* point = nullptr;
point = Create(0, pointName, formula, splinePathId, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
point = Create(0, pointName, formula, splinePathId, 5, 10, color, scene, doc, data, Document::FullParse,
Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
@ -128,8 +131,8 @@ VToolCutSplinePath* VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphics
*/
VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QString &formula,
const quint32 &splinePathId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
const QString &color, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
{
const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(splinePathId);
SCASSERT(splPath != nullptr);
@ -223,7 +226,7 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString
if (parse == Document::FullParse)
{
VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, splPath1id,
splPath2id, typeCreation);
splPath2id, color, typeCreation);
scene->addItem(point);
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolCutSplinePath::SetFactor);
@ -334,6 +337,7 @@ void VToolCutSplinePath::SaveDialog(QDomElement &domElement)
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
doc->SetAttribute(domElement, AttrSplinePath, QString().setNum(dialogTool->getSplinePathId()));
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
}
//---------------------------------------------------------------------------------------------------------------------
@ -374,6 +378,7 @@ void VToolCutSplinePath::SaveOptions(QDomElement &tag, QSharedPointer<VGObject>
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(tag, AttrColor, lineColor);
doc->SetAttribute(tag, AttrLength, formula);
doc->SetAttribute(tag, AttrSplinePath, curveCutId);
@ -384,4 +389,5 @@ void VToolCutSplinePath::ReadToolAttributes(const QDomElement &domElement)
{
formula = doc->GetParametrString(domElement, AttrLength, "");
curveCutId = doc->GetParametrUInt(domElement, AttrSplinePath, NULL_ID_STR);
lineColor = doc->GetParametrString(domElement, AttrColor, ColorBlack);
}

View File

@ -42,12 +42,12 @@ public:
VToolCutSplinePath(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &splinePathId, const quint32 &splPath1id, const quint32 &splPath2id,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
const QString &color, const Source &typeCreation, QGraphicsItem * parent = nullptr);
virtual void setDialog();
static VToolCutSplinePath *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
static VToolCutSplinePath *Create(const quint32 _id, const QString &pointName, QString &formula,
const quint32 &splinePathId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const QString &color, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
static const QString ToolType;
static const QString AttrSplinePath;

View File

@ -610,6 +610,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCutArc(VProperty *property)
case 4: // VAbstractTool::AttrLength
i->SetFormula(value.value<VFormula>());
break;
case 27: // VAbstractTool::AttrTypeColor
i->SetLineColor(value.toString());
break;
default:
qWarning()<<"Unknown property type. id = "<<id;
break;
@ -634,6 +637,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCutSpline(VProperty *property)
case 4: // VAbstractTool::AttrLength
i->SetFormula(value.value<VFormula>());
break;
case 27: // VAbstractTool::AttrTypeColor
i->SetLineColor(value.toString());
break;
default:
qWarning()<<"Unknown property type. id = "<<id;
break;
@ -658,6 +664,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCutSplinePath(VProperty *propert
case 4: // VAbstractTool::AttrLength
i->SetFormula(value.value<VFormula>());
break;
case 27: // VAbstractTool::AttrTypeColor
i->SetLineColor(value.toString());
break;
default:
qWarning()<<"Unknown property type. id = "<<id;
break;
@ -1051,6 +1060,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCutArc(QGraphicsItem *item)
AddPropertyPointName(i, tr("Point label"));
AddPropertyFormula(tr("Length"), i->GetFormula(), VAbstractTool::AttrLength);
AddPropertyLineColor(i, tr("Color"), VAbstractTool::ColorsList(), VAbstractTool::AttrColor);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1062,6 +1072,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCutSpline(QGraphicsItem *item)
AddPropertyPointName(i, tr("Point label"));
AddPropertyFormula(tr("Length"), i->GetFormula(), VAbstractTool::AttrLength);
AddPropertyLineColor(i, tr("Color"), VAbstractTool::ColorsList(), VAbstractTool::AttrColor);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1073,6 +1084,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCutSplinePath(QGraphicsItem *it
AddPropertyPointName(i, tr("Point label"));
AddPropertyFormula(tr("Length"), i->GetFormula(), VAbstractTool::AttrLength);
AddPropertyLineColor(i, tr("Color"), VAbstractTool::ColorsList(), VAbstractTool::AttrColor);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1344,6 +1356,9 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCutArc()
QVariant valueFormula;
valueFormula.setValue(i->GetFormula());
idToProperty[VAbstractTool::AttrLength]->setValue(valueFormula);
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[VAbstractTool::AttrColor]->setValue(index);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1356,6 +1371,9 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCutSpline()
QVariant valueFormula;
valueFormula.setValue(i->GetFormula());
idToProperty[VAbstractTool::AttrLength]->setValue(valueFormula);
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[VAbstractTool::AttrColor]->setValue(index);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1368,6 +1386,9 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCutSplinePath()
QVariant valueFormula;
valueFormula.setValue(i->GetFormula());
idToProperty[VAbstractTool::AttrLength]->setValue(valueFormula);
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[VAbstractTool::AttrColor]->setValue(index);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -1469,8 +1469,11 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0");
QString f = formula;//need for saving fixed formula;
const quint32 splineId = GetParametrUInt(domElement, VToolCutSpline::AttrSpline, NULL_ID_STR);
const QString color = GetParametrString(domElement, VAbstractTool::AttrColor,
VAbstractTool::ColorBlack);
VToolCutSpline::Create(id, name, f, splineId, mx, my, scene, this, data, parse, Source::FromFile);
VToolCutSpline::Create(id, name, f, splineId, mx, my, color, scene, this, data, parse,
Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula)
{
@ -1499,8 +1502,10 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
QString f = formula;//need for saving fixed formula;
const quint32 splinePathId = GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath,
NULL_ID_STR);
const QString color = GetParametrString(domElement, VAbstractTool::AttrColor,
VAbstractTool::ColorBlack);
VToolCutSplinePath::Create(id, name, f, splinePathId, mx, my, scene, this, data, parse,
VToolCutSplinePath::Create(id, name, f, splinePathId, mx, my, color, scene, this, data, parse,
Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula)
@ -1529,8 +1534,10 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0");
QString f = formula;//need for saving fixed formula;
const quint32 arcId = GetParametrUInt(domElement, VToolCutArc::AttrArc, NULL_ID_STR);
const QString color = GetParametrString(domElement, VAbstractTool::AttrColor,
VAbstractTool::ColorBlack);
VToolCutArc::Create(id, name, f, arcId, mx, my, scene, this, data, parse, Source::FromFile);
VToolCutArc::Create(id, name, f, arcId, mx, my, color, scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula)
{