Save information about curve color inside geometric objects. Help to copy this

data to copy objects after rotation.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-05-19 13:11:50 +03:00
parent efb852a63e
commit 0266b27b36
42 changed files with 184 additions and 274 deletions

View File

@ -990,9 +990,6 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCutArc(VProperty *property)
case 4: // AttrLength
i->SetFormula(value.value<VFormula>());
break;
case 27: // AttrTypeColor
i->SetLineColor(value.toString());
break;
default:
qWarning()<<"Unknown property type. id = "<<id;
break;
@ -1017,9 +1014,6 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCutSpline(VProperty *property)
case 4: // AttrLength
i->SetFormula(value.value<VFormula>());
break;
case 27: // AttrTypeColor
i->SetLineColor(value.toString());
break;
default:
qWarning()<<"Unknown property type. id = "<<id;
break;
@ -1044,9 +1038,6 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCutSplinePath(VProperty *propert
case 4: // AttrLength
i->SetFormula(value.value<VFormula>());
break;
case 27: // AttrTypeColor
i->SetLineColor(value.toString());
break;
default:
qWarning()<<"Unknown property type. id = "<<id;
break;
@ -1705,7 +1696,6 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCutArc(QGraphicsItem *item)
AddPropertyObjectName(i, tr("Point label"));
AddPropertyFormula(tr("Length"), i->GetFormula(), AttrLength);
AddPropertyLineColor(i, tr("Color"), VAbstractTool::ColorsList(), AttrColor);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1717,7 +1707,6 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCutSpline(QGraphicsItem *item)
AddPropertyObjectName(i, tr("Point label"));
AddPropertyFormula(tr("Length"), i->GetFormula(), AttrLength);
AddPropertyLineColor(i, tr("Color"), VAbstractTool::ColorsList(), AttrColor);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1729,7 +1718,6 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCutSplinePath(QGraphicsItem *it
AddPropertyObjectName(i, tr("Point label"));
AddPropertyFormula(tr("Length"), i->GetFormula(), AttrLength);
AddPropertyLineColor(i, tr("Color"), VAbstractTool::ColorsList(), AttrColor);
}
//---------------------------------------------------------------------------------------------------------------------
@ -2135,9 +2123,6 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCutArc()
QVariant valueFormula;
valueFormula.setValue(i->GetFormula());
idToProperty[AttrLength]->setValue(valueFormula);
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[AttrColor]->setValue(index);
}
//---------------------------------------------------------------------------------------------------------------------
@ -2150,9 +2135,6 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCutSpline()
QVariant valueFormula;
valueFormula.setValue(i->GetFormula());
idToProperty[AttrLength]->setValue(valueFormula);
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[AttrColor]->setValue(index);
}
//---------------------------------------------------------------------------------------------------------------------
@ -2165,9 +2147,6 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCutSplinePath()
QVariant valueFormula;
valueFormula.setValue(i->GetFormula());
idToProperty[AttrLength]->setValue(valueFormula);
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[AttrColor]->setValue(index);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -1412,11 +1412,8 @@ void VPattern::ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domEle
const QString formula = GetParametrString(domElement, 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, AttrColor,
ColorBlack);
VToolCutSpline::Create(id, name, f, splineId, mx, my, color, scene, this, data, parse,
Source::FromFile);
VToolCutSpline::Create(id, name, f, splineId, mx, my, scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula)
{
@ -1457,11 +1454,8 @@ void VPattern::ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &do
QString f = formula;//need for saving fixed formula;
const quint32 splinePathId = GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath,
NULL_ID_STR);
const QString color = GetParametrString(domElement, AttrColor,
ColorBlack);
VToolCutSplinePath::Create(id, name, f, splinePathId, mx, my, color, scene, this, data, parse,
Source::FromFile);
VToolCutSplinePath::Create(id, name, f, splinePathId, mx, my, scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula)
{
@ -1501,9 +1495,8 @@ void VPattern::ParseToolCutArc(VMainGraphicsScene *scene, QDomElement &domElemen
const QString formula = GetParametrString(domElement, AttrLength, "0");
QString f = formula;//need for saving fixed formula;
const quint32 arcId = GetParametrUInt(domElement, AttrArc, NULL_ID_STR);
const QString color = GetParametrString(domElement, AttrColor, ColorBlack);
VToolCutArc::Create(id, name, f, arcId, mx, my, color, scene, this, data, parse, Source::FromFile);
VToolCutArc::Create(id, name, f, arcId, mx, my, scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula)
{

View File

@ -244,6 +244,18 @@ void VAbstractCurve::SetDuplicate(quint32 number)
CreateName();
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractCurve::GetColor() const
{
return d->color;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractCurve::SetColor(const QString &color)
{
d->color = color;
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VAbstractCurve::CurveIntersectLine(const QVector<QPointF> &points, const QLineF &line)
{

View File

@ -69,6 +69,9 @@ public:
quint32 GetDuplicate() const;
void SetDuplicate(quint32 number);
QString GetColor() const;
void SetColor(const QString &color);
static QVector<QPointF> CurveIntersectLine(const QVector<QPointF> &points, const QLineF &line);
virtual QString NameForHistory(const QString &toolName) const=0;

View File

@ -31,6 +31,8 @@
#include <QSharedData>
#include "../ifc/ifcdef.h"
#ifdef Q_CC_GNU
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
@ -41,11 +43,11 @@ class VAbstractCurveData : public QSharedData
public:
VAbstractCurveData ()
: duplicate(0)
: duplicate(0), color(ColorBlack)
{}
VAbstractCurveData(const VAbstractCurveData &curve)
: QSharedData(curve), duplicate(curve.duplicate)
: QSharedData(curve), duplicate(curve.duplicate), color(curve.color)
{}
virtual ~VAbstractCurveData();
@ -53,6 +55,8 @@ public:
/** @brief duplicate helps create unique name for curves that connects the same start and finish points. */
quint32 duplicate;
QString color;
private:
VAbstractCurveData &operator=(const VAbstractCurveData &) Q_DECL_EQ_DELETE;
};

View File

@ -62,7 +62,6 @@ DialogCutArc::DialogCutArc(const VContainer *data, const quint32 &toolId, QWidge
CheckState();
FillComboBoxArcs(ui->comboBoxArc);
FillComboBoxLineColors(ui->comboBoxColor);
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutArc::FXLength);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutArc::NamePointChanged);
@ -170,18 +169,6 @@ void DialogCutArc::setArcId(const quint32 &value)
path->setObject1Id(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

@ -54,9 +54,6 @@ 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) Q_DECL_OVERRIDE;
/**

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>412</width>
<height>222</height>
<height>189</height>
</rect>
</property>
<property name="windowTitle">
@ -246,16 +246,6 @@
</property>
</widget>
</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

@ -61,7 +61,6 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId,
CheckState();
FillComboBoxSplines(ui->comboBoxSpline);
FillComboBoxLineColors(ui->comboBoxColor);
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutSpline::FXLength);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSpline::NamePointChanged);
@ -126,18 +125,6 @@ void DialogCutSpline::setSplineId(const quint32 &value)
path->setObject1Id(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

@ -53,9 +53,6 @@ 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) Q_DECL_OVERRIDE;
/**

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>412</width>
<height>222</height>
<height>189</height>
</rect>
</property>
<property name="windowTitle">
@ -246,16 +246,6 @@
</property>
</widget>
</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

@ -61,7 +61,6 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &
CheckState();
FillComboBoxSplinesPath(ui->comboBoxSplinePath);
FillComboBoxLineColors(ui->comboBoxColor);
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutSplinePath::FXLength);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSplinePath::NamePointChanged);
@ -126,18 +125,6 @@ void DialogCutSplinePath::setSplinePathId(const quint32 &value)
path->setObject1Id(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

@ -53,9 +53,6 @@ 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) Q_DECL_OVERRIDE;
/**

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>412</width>
<height>222</height>
<height>189</height>
</rect>
</property>
<property name="windowTitle">
@ -246,22 +246,6 @@
</property>
</widget>
</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

@ -65,7 +65,8 @@ void VAbstractSpline::Disable(bool disable, const QString &namePP)
{
enabled = !CorrectDisable(disable, namePP);
this->setEnabled(enabled);
this->setPen(QPen(CorrectColor(lineColor),
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
this->setPen(QPen(CorrectColor(curve->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor, Qt::SolidLine,
Qt::RoundCap));
emit setEnabledPoint(enabled);
@ -122,7 +123,8 @@ void VAbstractSpline::SetFactor(qreal factor)
void VAbstractSpline::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
this->setPen(QPen(CorrectColor(lineColor),
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
this->setPen(QPen(CorrectColor(curve->GetColor()),
qApp->toPixel(WidthMainLine(*VAbstractTool::data.GetPatternUnit()))/factor, Qt::SolidLine,
Qt::RoundCap));
this->setPath(ToolPath(PathDirection::Show));
@ -139,7 +141,8 @@ void VAbstractSpline::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
this->setPen(QPen(CorrectColor(lineColor),
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
this->setPen(QPen(CorrectColor(curve->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
if (detailsMode)
{
@ -231,7 +234,7 @@ QPainterPath VAbstractSpline::ToolPath(PathDirection direction) const
//---------------------------------------------------------------------------------------------------------------------
void VAbstractSpline::ReadToolAttributes(const QDomElement &domElement)
{
lineColor = doc->GetParametrString(domElement, AttrColor, ColorBlack);
Q_UNUSED(domElement)
}
//---------------------------------------------------------------------------------------------------------------------
@ -239,7 +242,8 @@ void VAbstractSpline::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &ob
{
VDrawTool::SaveOptions(tag, obj);
doc->SetAttribute(tag, AttrColor, lineColor);
const QSharedPointer<VAbstractCurve> curve = qSharedPointerCast<VAbstractCurve>(obj);
doc->SetAttribute(tag, AttrColor, curve->GetColor());
}
//---------------------------------------------------------------------------------------------------------------------
@ -317,7 +321,8 @@ void VAbstractSpline::setEnabled(bool enabled)
QGraphicsPathItem::setEnabled(enabled);
if (enabled)
{
setPen(QPen(QColor(lineColor),
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
setPen(QPen(QColor(curve->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
}
else
@ -327,6 +332,22 @@ void VAbstractSpline::setEnabled(bool enabled)
}
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractSpline::GetLineColor() const
{
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
return curve->GetColor();
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractSpline::SetLineColor(const QString &value)
{
QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
curve->SetColor(value);
QSharedPointer<VGObject> obj = qSharedPointerCast<VGObject>(curve);
SaveOption(obj);
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractSpline::name() const
{

View File

@ -50,6 +50,9 @@ public:
void setEnabled(bool enabled);
QString GetLineColor() const;
void SetLineColor(const QString &value);
QString name() const;
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;

View File

@ -47,13 +47,11 @@ const QString VToolArc::ToolType = QStringLiteral("simple");
* @param typeCreation way we create this tool.
* @param parent parent object
*/
VToolArc::VToolArc(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color,
const Source &typeCreation,
VToolArc::VToolArc(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem *parent)
:VAbstractSpline(doc, data, id, parent)
{
sceneType = SceneObject::Arc;
lineColor = color;
this->setPath(ToolPath());
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
@ -76,7 +74,7 @@ void VToolArc::setDialog()
dialogTool->SetF1(arc->GetFormulaF1());
dialogTool->SetF2(arc->GetFormulaF2());
dialogTool->SetRadius(arc->GetFormulaRadius());
dialogTool->SetColor(lineColor);
dialogTool->SetColor(arc->GetColor());
}
//---------------------------------------------------------------------------------------------------------------------
@ -133,6 +131,7 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 &center, QString &ra
const VPointF c = *data->GeometricObject<VPointF>(center);
VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 );
arc->SetColor(color);
quint32 id = _id;
if (typeCreation == Source::FromGui)
{
@ -151,7 +150,7 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 &center, QString &ra
VDrawTool::AddRecord(id, Tool::Arc, doc);
if (parse == Document::FullParse)
{
VToolArc *toolArc = new VToolArc(doc, data, id, color, typeCreation);
VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation);
scene->addItem(toolArc);
InitArcToolConnections(scene, toolArc);
doc->AddTool(id, toolArc);
@ -364,7 +363,8 @@ void VToolArc::SetVisualization()
*/
void VToolArc::RefreshGeometry()
{
this->setPen(QPen(CorrectColor(lineColor),
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
this->setPen(QPen(CorrectColor(arc->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
this->setPath(ToolPath());

View File

@ -73,7 +73,7 @@ protected:
private:
Q_DISABLE_COPY(VToolArc)
VToolArc(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color, const Source &typeCreation,
VToolArc(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
virtual void RefreshGeometry() Q_DECL_OVERRIDE;

View File

@ -39,12 +39,11 @@
const QString VToolArcWithLength::ToolType = QStringLiteral("arcWithLength");
//---------------------------------------------------------------------------------------------------------------------
VToolArcWithLength::VToolArcWithLength(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color,
const Source &typeCreation, QGraphicsItem *parent)
VToolArcWithLength::VToolArcWithLength(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem *parent)
:VAbstractSpline(doc, data, id, parent)
{
sceneType = SceneObject::Arc;
lineColor = color;
this->setPath(ToolPath());
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
@ -64,7 +63,7 @@ void VToolArcWithLength::setDialog()
dialogTool->SetF1(arc->GetFormulaF1());
dialogTool->SetLength(arc->GetFormulaLength());
dialogTool->SetRadius(arc->GetFormulaRadius());
dialogTool->SetColor(lineColor);
dialogTool->SetColor(arc->GetColor());
}
//---------------------------------------------------------------------------------------------------------------------
@ -102,6 +101,7 @@ VToolArcWithLength *VToolArcWithLength::Create(const quint32 _id, const quint32
const VPointF c = *data->GeometricObject<VPointF>(center);
VArc *arc = new VArc(calcLength, length, c, calcRadius, radius, calcF1, f1);
arc->SetColor(color);
quint32 id = _id;
if (typeCreation == Source::FromGui)
{
@ -120,7 +120,7 @@ VToolArcWithLength *VToolArcWithLength::Create(const quint32 _id, const quint32
VDrawTool::AddRecord(id, Tool::ArcWithLength, doc);
if (parse == Document::FullParse)
{
VToolArcWithLength *toolArc = new VToolArcWithLength(doc, data, id, color, typeCreation);
VToolArcWithLength *toolArc = new VToolArcWithLength(doc, data, id, typeCreation);
scene->addItem(toolArc);
InitArcToolConnections(scene, toolArc);
doc->AddTool(id, toolArc);
@ -317,7 +317,8 @@ void VToolArcWithLength::SetVisualization()
//---------------------------------------------------------------------------------------------------------------------
void VToolArcWithLength::RefreshGeometry()
{
this->setPen(QPen(CorrectColor(lineColor),
QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
this->setPen(QPen(CorrectColor(arc->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
this->setPath(ToolPath());

View File

@ -42,8 +42,8 @@ public:
VContainer *data);
static VToolArcWithLength* Create(const quint32 _id, const quint32 &center, QString &radius, QString &f1,
QString &length, const QString &color, VMainGraphicsScene *scene,
VAbstractPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation);
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
static const QString ToolType;
virtual int type() const Q_DECL_OVERRIDE {return Type;}
@ -72,8 +72,8 @@ protected:
private:
Q_DISABLE_COPY(VToolArcWithLength)
VToolArcWithLength(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
VToolArcWithLength(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
virtual void RefreshGeometry() Q_DECL_OVERRIDE;

View File

@ -35,12 +35,11 @@
const QString VToolCubicBezier::ToolType = QStringLiteral("cubicBezier");
//---------------------------------------------------------------------------------------------------------------------
VToolCubicBezier::VToolCubicBezier(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color,
VToolCubicBezier::VToolCubicBezier(VAbstractPattern *doc, VContainer *data, quint32 id,
const Source &typeCreation, QGraphicsItem *parent)
:VAbstractSpline(doc, data, id, parent)
{
sceneType = SceneObject::Spline;
lineColor = color;
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
this->setPath(ToolPath());
@ -62,7 +61,7 @@ void VToolCubicBezier::setDialog()
SCASSERT(dialogTool != nullptr);
const auto spl = VAbstractTool::data.GeometricObject<VCubicBezier>(id);
dialogTool->SetSpline(*spl);
dialogTool->SetColor(lineColor);
dialogTool->SetColor(spl->GetColor());
}
//---------------------------------------------------------------------------------------------------------------------
@ -89,6 +88,7 @@ VToolCubicBezier *VToolCubicBezier::Create(const quint32 _id, VCubicBezier *spli
const Document &parse, const Source &typeCreation)
{
quint32 id = _id;
spline->SetColor(color);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(spline);
@ -106,7 +106,7 @@ VToolCubicBezier *VToolCubicBezier::Create(const quint32 _id, VCubicBezier *spli
VDrawTool::AddRecord(id, Tool::CubicBezier, doc);
if (parse == Document::FullParse)
{
auto _spl = new VToolCubicBezier(doc, data, id, color, typeCreation);
auto _spl = new VToolCubicBezier(doc, data, id, typeCreation);
scene->addItem(_spl);
InitSplineToolConnections(scene, _spl);
doc->AddTool(id, _spl);
@ -209,7 +209,8 @@ void VToolCubicBezier::SetVisualization()
//---------------------------------------------------------------------------------------------------------------------
void VToolCubicBezier::RefreshGeometry()
{
this->setPen(QPen(CorrectColor(lineColor),
const QSharedPointer<VCubicBezier> spl = VAbstractTool::data.GeometricObject<VCubicBezier>(id);
this->setPen(QPen(CorrectColor(spl->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
if (isHovered || detailsMode)
{

View File

@ -61,8 +61,8 @@ protected:
private:
Q_DISABLE_COPY(VToolCubicBezier)
VToolCubicBezier(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
VToolCubicBezier(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
void SetSplineAttributes(QDomElement &domElement, const VCubicBezier &spl);

View File

@ -33,12 +33,11 @@
const QString VToolCubicBezierPath::ToolType = QStringLiteral("cubicBezierPath");
//---------------------------------------------------------------------------------------------------------------------
VToolCubicBezierPath::VToolCubicBezierPath(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color,
VToolCubicBezierPath::VToolCubicBezierPath(VAbstractPattern *doc, VContainer *data, quint32 id,
const Source &typeCreation, QGraphicsItem *parent)
: VAbstractSpline(doc, data, id, parent)
{
sceneType = SceneObject::SplinePath;
lineColor = color;
this->setPath(ToolPath());
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
@ -60,7 +59,7 @@ void VToolCubicBezierPath::setDialog()
SCASSERT(dialogTool != nullptr);
const QSharedPointer<VCubicBezierPath> splPath = VAbstractTool::data.GeometricObject<VCubicBezierPath>(id);
dialogTool->SetPath(*splPath);
dialogTool->SetColor(lineColor);
dialogTool->SetColor(splPath->GetColor());
}
//---------------------------------------------------------------------------------------------------------------------
@ -90,6 +89,7 @@ VToolCubicBezierPath *VToolCubicBezierPath::Create(const quint32 _id, VCubicBezi
const Document &parse, const Source &typeCreation)
{
quint32 id = _id;
path->SetColor(color);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(path);
@ -107,7 +107,7 @@ VToolCubicBezierPath *VToolCubicBezierPath::Create(const quint32 _id, VCubicBezi
VDrawTool::AddRecord(id, Tool::CubicBezierPath, doc);
if (parse == Document::FullParse)
{
VToolCubicBezierPath *spl = new VToolCubicBezierPath(doc, data, id, color, typeCreation);
VToolCubicBezierPath *spl = new VToolCubicBezierPath(doc, data, id, typeCreation);
scene->addItem(spl);
InitSplinePathToolConnections(scene, spl);
doc->AddTool(id, spl);
@ -214,7 +214,8 @@ void VToolCubicBezierPath::RefreshGeometry()
{
isHovered || detailsMode ? setPath(ToolPath(PathDirection::Show)) : setPath(ToolPath());
this->setPen(QPen(CorrectColor(lineColor),
QSharedPointer<VCubicBezierPath> splPath = VAbstractTool::data.GeometricObject<VCubicBezierPath>(id);
this->setPen(QPen(CorrectColor(splPath->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
SetVisualization();

View File

@ -63,7 +63,7 @@ protected:
private:
Q_DISABLE_COPY(VToolCubicBezierPath)
VToolCubicBezierPath(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color,
VToolCubicBezierPath(VAbstractPattern *doc, VContainer *data, quint32 id,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
virtual void RefreshGeometry() Q_DECL_OVERRIDE;

View File

@ -52,13 +52,11 @@ const QString VToolSpline::OldToolType = QStringLiteral("simple");
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolSpline::VToolSpline(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color,
const Source &typeCreation,
VToolSpline::VToolSpline(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem *parent)
:VAbstractSpline(doc, data, id, parent), oldPosition()
{
sceneType = SceneObject::Spline;
lineColor = color;
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
this->setFlag(QGraphicsItem::ItemIsMovable, true);
@ -114,7 +112,7 @@ void VToolSpline::setDialog()
SCASSERT(dialogTool != nullptr);
const auto spl = VAbstractTool::data.GeometricObject<VSpline>(id);
dialogTool->SetSpline(*spl);
dialogTool->SetColor(lineColor);
dialogTool->SetColor(spl->GetColor());
}
//---------------------------------------------------------------------------------------------------------------------
@ -132,8 +130,9 @@ VToolSpline* VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene,
auto dialogTool = qobject_cast<DialogSpline*>(dialog);
SCASSERT(dialogTool != nullptr);
auto spl = Create(0, new VSpline(dialogTool->GetSpline()), dialogTool->GetColor(), scene, doc, data,
Document::FullParse, Source::FromGui);
VSpline *spline = new VSpline(dialogTool->GetSpline());
auto spl = Create(0, spline, dialogTool->GetColor(), scene, doc, data, Document::FullParse, Source::FromGui);
if (spl != nullptr)
{
@ -147,7 +146,6 @@ VToolSpline* VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene,
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param spline spline.
* @param color spline color.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
@ -160,6 +158,7 @@ VToolSpline* VToolSpline::Create(const quint32 _id, VSpline *spline, const QStri
const Source &typeCreation)
{
quint32 id = _id;
spline->SetColor(color);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(spline);
@ -177,7 +176,7 @@ VToolSpline* VToolSpline::Create(const quint32 _id, VSpline *spline, const QStri
VDrawTool::AddRecord(id, Tool::Spline, doc);
if (parse == Document::FullParse)
{
auto _spl = new VToolSpline(doc, data, id, color, typeCreation);
auto _spl = new VToolSpline(doc, data, id, typeCreation);
scene->addItem(_spl);
InitSplineToolConnections(scene, _spl);
doc->AddTool(id, _spl);
@ -508,7 +507,9 @@ void VToolSpline::RefreshGeometry()
point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
}
this->setPen(QPen(CorrectColor(lineColor),
const auto spl = VAbstractTool::data.GeometricObject<VSpline>(id);
this->setPen(QPen(CorrectColor(spl->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
if (isHovered || detailsMode)
{
@ -522,8 +523,6 @@ void VToolSpline::RefreshGeometry()
controlPoints[0]->blockSignals(true);
controlPoints[1]->blockSignals(true);
const auto spl = VAbstractTool::data.GeometricObject<VSpline>(id);
{
const bool freeAngle1 = qmu::QmuTokenParser::IsSingle(spl->GetStartAngleFormula());
const bool freeLength1 = qmu::QmuTokenParser::IsSingle(spl->GetC1LengthFormula());

View File

@ -78,7 +78,7 @@ private:
Q_DISABLE_COPY(VToolSpline)
QPointF oldPosition;
VToolSpline (VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color, const Source &typeCreation,
VToolSpline (VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem * parent = nullptr );
bool IsMovable() const;

View File

@ -51,14 +51,13 @@ const QString VToolSplinePath::OldToolType = QStringLiteral("path");
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolSplinePath::VToolSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color,
const Source &typeCreation, QGraphicsItem *parent)
VToolSplinePath::VToolSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem *parent)
: VAbstractSpline(doc, data, id, parent),
oldPosition(),
splIndex(-1)
{
sceneType = SceneObject::SplinePath;
lineColor = color;
this->setPath(ToolPath());
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
@ -117,7 +116,7 @@ void VToolSplinePath::setDialog()
SCASSERT(dialogTool != nullptr);
const QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
dialogTool->SetPath(*splPath);
dialogTool->SetColor(lineColor);
dialogTool->SetColor(splPath->GetColor());
}
//---------------------------------------------------------------------------------------------------------------------
@ -135,12 +134,12 @@ VToolSplinePath* VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene
DialogSplinePath *dialogTool = qobject_cast<DialogSplinePath*>(dialog);
SCASSERT(dialogTool != nullptr);
VSplinePath *path = new VSplinePath(dialogTool->GetPath());
const QString color = dialogTool->GetColor();
for (qint32 i = 0; i < path->CountPoints(); ++i)
{
doc->IncrementReferens((*path)[i].P().getIdTool());
}
VToolSplinePath* spl = Create(0, path, color, scene, doc, data, Document::FullParse, Source::FromGui);
VToolSplinePath* spl = Create(0, path, dialogTool->GetColor(), scene, doc, data, Document::FullParse,
Source::FromGui);
if (spl != nullptr)
{
spl->dialog=dialogTool;
@ -164,6 +163,7 @@ VToolSplinePath* VToolSplinePath::Create(const quint32 _id, VSplinePath *path, c
const Document &parse, const Source &typeCreation)
{
quint32 id = _id;
path->SetColor(color);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(path);
@ -181,7 +181,7 @@ VToolSplinePath* VToolSplinePath::Create(const quint32 _id, VSplinePath *path, c
VDrawTool::AddRecord(id, Tool::SplinePath, doc);
if (parse == Document::FullParse)
{
VToolSplinePath *spl = new VToolSplinePath(doc, data, id, color, typeCreation);
VToolSplinePath *spl = new VToolSplinePath(doc, data, id, typeCreation);
scene->addItem(spl);
InitSplinePathToolConnections(scene, spl);
doc->AddTool(id, spl);
@ -631,10 +631,10 @@ void VToolSplinePath::RefreshGeometry()
this->setPath(ToolPath());
}
this->setPen(QPen(CorrectColor(lineColor),
const auto splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
this->setPen(QPen(CorrectColor(splPath->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
const auto splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
for (qint32 i = 1; i<=splPath->CountSubSpl(); ++i)
{
const qint32 j = i*2;

View File

@ -48,9 +48,7 @@ public:
VContainer *data);
static VToolSplinePath *Create(const quint32 _id, VSplinePath *path, const QString &color,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse,
const Source &typeCreation);
const Document &parse, const Source &typeCreation);
static VToolSplinePath *Create(const quint32 _id, const QVector<quint32> &points, QVector<QString> &a1,
QVector<QString> &a2, QVector<QString> &l1, QVector<QString> &l2,
const QString &color, VMainGraphicsScene *scene, VAbstractPattern *doc,
@ -101,8 +99,8 @@ private:
QPointF oldPosition;
int splIndex;
VToolSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
VToolSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem *parent = nullptr);
bool IsMovable(int index) const;
virtual void RefreshGeometry() Q_DECL_OVERRIDE;

View File

@ -32,12 +32,10 @@
//---------------------------------------------------------------------------------------------------------------------
VToolCut::VToolCut(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &curveCutId, const QString &color, QGraphicsItem *parent)
const quint32 &curveCutId, QGraphicsItem *parent)
:VToolSinglePoint(doc, data, id, parent), formula(formula), curveCutId(curveCutId), detailsMode(false)
{
Q_ASSERT_X(curveCutId != 0, Q_FUNC_INFO, "curveCutId == 0"); //-V654 //-V712
lineColor = color;
}
//---------------------------------------------------------------------------------------------------------------------
@ -137,11 +135,3 @@ void VToolCut::FullUpdateCurveFromFile(const QString &attrCurve)
curveCutId = domElement.attribute(attrCurve, "").toUInt();
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolCut::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
VToolSinglePoint::SaveOptions(tag, obj);
doc->SetAttribute(tag, AttrColor, lineColor);
}

View File

@ -39,7 +39,7 @@ class VToolCut : public VToolSinglePoint
Q_OBJECT
public:
VToolCut(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &curveCutId, const QString &color, QGraphicsItem * parent = nullptr);
const quint32 &curveCutId, QGraphicsItem * parent = nullptr);
virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(Tool::Cut)};
@ -63,7 +63,6 @@ protected:
void RefreshGeometry();
virtual void RemoveReferens() Q_DECL_OVERRIDE;
void FullUpdateCurveFromFile(const QString &attrCurve);
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
template <typename T>
void ShowToolVisualization(bool show);

View File

@ -44,14 +44,12 @@ const QString VToolCutArc::ToolType = QStringLiteral("cutArc");
* @param id object id in container.
* @param formula string with formula length first arc.
* @param arcId id arc in data container.
* @param color arc color.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolCutArc::VToolCutArc(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &arcId, const QString &color, const Source &typeCreation,
QGraphicsItem * parent)
:VToolCut(doc, data, id, formula, arcId, color, parent)
const quint32 &arcId, const Source &typeCreation, QGraphicsItem * parent)
:VToolCut(doc, data, id, formula, arcId, parent)
{
ToolCreation(typeCreation);
}
@ -69,7 +67,6 @@ void VToolCutArc::setDialog()
dialogTool->SetFormula(formula);
dialogTool->setArcId(curveCutId);
dialogTool->SetPointName(point->name());
dialogTool->SetColor(lineColor);
}
//---------------------------------------------------------------------------------------------------------------------
@ -88,8 +85,7 @@ 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 = Create(0, pointName, formula, arcId, 5, 10, color, scene, doc, data, Document::FullParse,
VToolCutArc* point = Create(0, pointName, formula, arcId, 5, 10, scene, doc, data, Document::FullParse,
Source::FromGui);
if (point != nullptr)
{
@ -114,9 +110,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, const QString &color, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation)
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
{
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(arcId);
@ -155,7 +150,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, color, typeCreation);
VToolCutArc *point = new VToolCutArc(doc, data, id, formula, arcId, typeCreation);
scene->addItem(point);
InitToolConnections(scene, point);
doc->AddTool(id, point);
@ -201,7 +196,6 @@ 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());
}
//---------------------------------------------------------------------------------------------------------------------
@ -219,7 +213,6 @@ 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

@ -41,7 +41,7 @@ public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolCutArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data);
static VToolCutArc* Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
const qreal &mx, const qreal &my, const QString &color, VMainGraphicsScene *scene,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
static const QString ToolType;
@ -58,8 +58,7 @@ private:
Q_DISABLE_COPY(VToolCutArc)
VToolCutArc(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &arcId, const QString &color, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
const quint32 &arcId, const Source &typeCreation, QGraphicsItem * parent = nullptr);
};
#endif // VTOOLCUTARC_H

View File

@ -45,14 +45,12 @@ const QString VToolCutSpline::AttrSpline = QStringLiteral("spline");
* @param id object id in container.
* @param formula string with formula length first spline.
* @param splineId id spline in data container.
* @param color spline color.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolCutSpline::VToolCutSpline(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &splineId, const QString &color, const Source &typeCreation,
QGraphicsItem *parent)
:VToolCut(doc, data, id, formula, splineId, color, parent)
const quint32 &splineId, const Source &typeCreation, QGraphicsItem *parent)
:VToolCut(doc, data, id, formula, splineId, parent)
{
ToolCreation(typeCreation);
}
@ -70,7 +68,6 @@ void VToolCutSpline::setDialog()
dialogTool->SetFormula(formula);
dialogTool->setSplineId(curveCutId);
dialogTool->SetPointName(point->name());
dialogTool->SetColor(lineColor);
}
//---------------------------------------------------------------------------------------------------------------------
@ -90,8 +87,7 @@ 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 = Create(0, pointName, formula, splineId, 5, 10, color, scene, doc, data, Document::FullParse,
VToolCutSpline* point = Create(0, pointName, formula, splineId, 5, 10, scene, doc, data, Document::FullParse,
Source::FromGui);
if (point != nullptr)
{
@ -116,7 +112,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 QString &color,
const quint32 &splineId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
{
@ -152,7 +148,7 @@ 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, color, typeCreation);
VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, typeCreation);
scene->addItem(point);
InitToolConnections(scene, point);
doc->AddTool(id, point);
@ -198,7 +194,6 @@ 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());
}
//---------------------------------------------------------------------------------------------------------------------
@ -216,7 +211,6 @@ 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

@ -42,7 +42,7 @@ public:
static VToolCutSpline *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolCutSpline *Create(const quint32 _id, const QString &pointName, QString &formula,
const quint32 &splineId, const qreal &mx, const qreal &my, const QString &color,
const quint32 &splineId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse,
const Source &typeCreation);
@ -61,8 +61,7 @@ private:
Q_DISABLE_COPY(VToolCutSpline)
VToolCutSpline(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &splineId, const QString &color, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
const quint32 &splineId, const Source &typeCreation, QGraphicsItem * parent = nullptr);
};
#endif // VTOOLCUTSPLINE_H

View File

@ -45,14 +45,13 @@ const QString VToolCutSplinePath::AttrSplinePath = QStringLiteral("splinePath");
* @param id object id in container.
* @param formula string with formula length first splinePath.
* @param splinePathId id splinePath (we cut this splinePath) in data container.
* @param color spline path color.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolCutSplinePath::VToolCutSplinePath(VAbstractPattern *doc, VContainer *data, const quint32 &id,
const QString &formula, const quint32 &splinePathId,
const QString &color, const Source &typeCreation, QGraphicsItem *parent)
:VToolCut(doc, data, id, formula, splinePathId, color, parent)
const Source &typeCreation, QGraphicsItem *parent)
:VToolCut(doc, data, id, formula, splinePathId, parent)
{
ToolCreation(typeCreation);
}
@ -70,7 +69,6 @@ void VToolCutSplinePath::setDialog()
dialogTool->SetFormula(formula);
dialogTool->setSplinePathId(curveCutId);
dialogTool->SetPointName(point->name());
dialogTool->SetColor(lineColor);
}
//---------------------------------------------------------------------------------------------------------------------
@ -90,8 +88,7 @@ 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 = Create(0, pointName, formula, splinePathId, 5, 10, color, scene, doc, data,
VToolCutSplinePath* point = Create(0, pointName, formula, splinePathId, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
if (point != nullptr)
{
@ -117,7 +114,7 @@ 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,
const QString &color, VMainGraphicsScene *scene, VAbstractPattern *doc,
VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
{
const auto splPath = data->GeometricObject<VAbstractCubicBezierPath>(splinePathId);
@ -160,7 +157,7 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString
VDrawTool::AddRecord(id, Tool::CutSplinePath, doc);
if (parse == Document::FullParse)
{
VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, color, typeCreation);
VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, typeCreation);
scene->addItem(point);
InitToolConnections(scene, point);
doc->AddTool(id, point);
@ -282,7 +279,6 @@ 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());
}
//---------------------------------------------------------------------------------------------------------------------
@ -300,7 +296,6 @@ 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

@ -47,8 +47,7 @@ public:
VContainer *data);
static VToolCutSplinePath *Create(const quint32 _id, const QString &pointName, QString &formula,
const quint32 &splinePathId, const qreal &mx, const qreal &my,
const QString &color, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
static const QString ToolType;
static const QString AttrSplinePath;
@ -69,8 +68,7 @@ private:
Q_DISABLE_COPY(VToolCutSplinePath)
VToolCutSplinePath(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &splinePathId, const QString &color, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
const quint32 &splinePathId, const Source &typeCreation, QGraphicsItem * parent = nullptr);
};
#endif // VTOOLCUTSPLINEPATH_H

View File

@ -46,7 +46,7 @@ VToolLinePoint::VToolLinePoint(VAbstractPattern *doc, VContainer *data, const qu
const QString &lineColor, const QString &formula, const quint32 &basePointId,
const qreal &angle, QGraphicsItem *parent)
:VToolSinglePoint(doc, data, id, parent), formulaLength(formula), angle(angle), basePointId(basePointId),
mainLine(nullptr)
mainLine(nullptr), lineColor(ColorBlack)
{
this->typeLine = typeLine;
this->lineColor = lineColor;
@ -145,6 +145,21 @@ void VToolLinePoint::SetAngle(const qreal &value)
SaveOption(obj);
}
//---------------------------------------------------------------------------------------------------------------------
QString VToolLinePoint::GetLineColor() const
{
return lineColor;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolLinePoint::SetLineColor(const QString &value)
{
lineColor = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
SaveOption(obj);
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolLinePoint::GetBasePointId() const
{

View File

@ -45,6 +45,7 @@ public:
virtual ~VToolLinePoint() Q_DECL_OVERRIDE;
virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(Tool::LinePoint)};
VFormula GetFormulaLength() const;
void SetFormulaLength(const VFormula &value);
@ -54,6 +55,9 @@ public:
qreal GetAngle() const;
void SetAngle(const qreal &value);
QString GetLineColor() const;
void SetLineColor(const QString &value);
public slots:
virtual void SetFactor(qreal factor) Q_DECL_OVERRIDE;
virtual void Disable(bool disable, const QString &namePP) Q_DECL_OVERRIDE;
@ -71,6 +75,9 @@ protected:
/** @brief mainLine line item. */
QGraphicsLineItem *mainLine;
/** @brief lineColor color of a line. */
QString lineColor;
virtual void RefreshGeometry();
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;

View File

@ -47,7 +47,7 @@ qreal VDrawTool::factor = 1;
*/
VDrawTool::VDrawTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent)
:VAbstractTool(doc, data, id, parent), nameActivDraw(doc->GetNameActivPP()),
dialog(nullptr), typeLine(TypeLineLine), lineColor(ColorBlack), enabled(true)
dialog(nullptr), typeLine(TypeLineLine), enabled(true)
{
connect(this->doc, &VAbstractPattern::ChangedActivPP, this, &VDrawTool::ChangedActivDraw);
connect(this->doc, &VAbstractPattern::ChangedNameDraw, this, &VDrawTool::ChangedNameDraw);
@ -384,19 +384,3 @@ void VDrawTool::SetTypeLine(const QString &value)
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
SaveOption(obj);
}
//---------------------------------------------------------------------------------------------------------------------
QString VDrawTool::GetLineColor() const
{
return lineColor;
}
//---------------------------------------------------------------------------------------------------------------------
void VDrawTool::SetLineColor(const QString &value)
{
lineColor = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
SaveOption(obj);
}

View File

@ -58,9 +58,6 @@ public:
QString getLineType() const;
virtual void SetTypeLine(const QString &value);
QString GetLineColor() const;
virtual void SetLineColor(const QString &value);
signals:
void ChangedToolSelection(bool selected, quint32 object, quint32 tool);
@ -88,9 +85,6 @@ protected:
/** @brief typeLine line type. */
QString typeLine;
/** @brief lineColor color line or curve, but not a point. */
QString lineColor;
bool enabled;
void AddToCalculation(const QDomElement &domElement);

View File

@ -48,7 +48,8 @@
VToolLine::VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint,
const QString &typeLine, const QString &lineColor, const Source &typeCreation,
QGraphicsItem *parent)
:VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint)
:VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint),
lineColor(ColorBlack)
{
this->typeLine = typeLine;
this->lineColor = lineColor;
@ -459,6 +460,12 @@ void VToolLine::SetTypeLine(const QString &value)
SaveOption(obj);
}
//---------------------------------------------------------------------------------------------------------------------
QString VToolLine::GetLineColor() const
{
return lineColor;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::SetLineColor(const QString &value)
{

View File

@ -55,10 +55,12 @@ public:
quint32 GetSecondPoint() const;
void SetSecondPoint(const quint32 &value);
QString GetLineColor() const;
void SetLineColor(const QString &value);
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
virtual void SetTypeLine(const QString &value) Q_DECL_OVERRIDE;
virtual void SetLineColor(const QString &value) Q_DECL_OVERRIDE;
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
public slots:
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
@ -89,6 +91,9 @@ private:
/** @brief secondPoint id second line point. */
quint32 secondPoint;
/** @brief lineColor color of a line. */
QString lineColor;
VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint,
const QString &typeLine, const QString &lineColor, const Source &typeCreation,
QGraphicsItem * parent = nullptr);