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:
parent
efb852a63e
commit
0266b27b36
|
@ -990,9 +990,6 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCutArc(VProperty *property)
|
||||||
case 4: // AttrLength
|
case 4: // AttrLength
|
||||||
i->SetFormula(value.value<VFormula>());
|
i->SetFormula(value.value<VFormula>());
|
||||||
break;
|
break;
|
||||||
case 27: // AttrTypeColor
|
|
||||||
i->SetLineColor(value.toString());
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
qWarning()<<"Unknown property type. id = "<<id;
|
qWarning()<<"Unknown property type. id = "<<id;
|
||||||
break;
|
break;
|
||||||
|
@ -1017,9 +1014,6 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCutSpline(VProperty *property)
|
||||||
case 4: // AttrLength
|
case 4: // AttrLength
|
||||||
i->SetFormula(value.value<VFormula>());
|
i->SetFormula(value.value<VFormula>());
|
||||||
break;
|
break;
|
||||||
case 27: // AttrTypeColor
|
|
||||||
i->SetLineColor(value.toString());
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
qWarning()<<"Unknown property type. id = "<<id;
|
qWarning()<<"Unknown property type. id = "<<id;
|
||||||
break;
|
break;
|
||||||
|
@ -1044,9 +1038,6 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCutSplinePath(VProperty *propert
|
||||||
case 4: // AttrLength
|
case 4: // AttrLength
|
||||||
i->SetFormula(value.value<VFormula>());
|
i->SetFormula(value.value<VFormula>());
|
||||||
break;
|
break;
|
||||||
case 27: // AttrTypeColor
|
|
||||||
i->SetLineColor(value.toString());
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
qWarning()<<"Unknown property type. id = "<<id;
|
qWarning()<<"Unknown property type. id = "<<id;
|
||||||
break;
|
break;
|
||||||
|
@ -1705,7 +1696,6 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCutArc(QGraphicsItem *item)
|
||||||
|
|
||||||
AddPropertyObjectName(i, tr("Point label"));
|
AddPropertyObjectName(i, tr("Point label"));
|
||||||
AddPropertyFormula(tr("Length"), i->GetFormula(), AttrLength);
|
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"));
|
AddPropertyObjectName(i, tr("Point label"));
|
||||||
AddPropertyFormula(tr("Length"), i->GetFormula(), AttrLength);
|
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"));
|
AddPropertyObjectName(i, tr("Point label"));
|
||||||
AddPropertyFormula(tr("Length"), i->GetFormula(), AttrLength);
|
AddPropertyFormula(tr("Length"), i->GetFormula(), AttrLength);
|
||||||
AddPropertyLineColor(i, tr("Color"), VAbstractTool::ColorsList(), AttrColor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -2135,9 +2123,6 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCutArc()
|
||||||
QVariant valueFormula;
|
QVariant valueFormula;
|
||||||
valueFormula.setValue(i->GetFormula());
|
valueFormula.setValue(i->GetFormula());
|
||||||
idToProperty[AttrLength]->setValue(valueFormula);
|
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;
|
QVariant valueFormula;
|
||||||
valueFormula.setValue(i->GetFormula());
|
valueFormula.setValue(i->GetFormula());
|
||||||
idToProperty[AttrLength]->setValue(valueFormula);
|
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;
|
QVariant valueFormula;
|
||||||
valueFormula.setValue(i->GetFormula());
|
valueFormula.setValue(i->GetFormula());
|
||||||
idToProperty[AttrLength]->setValue(valueFormula);
|
idToProperty[AttrLength]->setValue(valueFormula);
|
||||||
|
|
||||||
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
|
|
||||||
idToProperty[AttrColor]->setValue(index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -1412,11 +1412,8 @@ void VPattern::ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domEle
|
||||||
const QString formula = GetParametrString(domElement, AttrLength, "0");
|
const QString formula = GetParametrString(domElement, AttrLength, "0");
|
||||||
QString f = formula;//need for saving fixed formula;
|
QString f = formula;//need for saving fixed formula;
|
||||||
const quint32 splineId = GetParametrUInt(domElement, VToolCutSpline::AttrSpline, NULL_ID_STR);
|
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,
|
VToolCutSpline::Create(id, name, f, splineId, mx, my, scene, this, data, parse, Source::FromFile);
|
||||||
Source::FromFile);
|
|
||||||
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
||||||
if (f != formula)
|
if (f != formula)
|
||||||
{
|
{
|
||||||
|
@ -1457,11 +1454,8 @@ void VPattern::ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &do
|
||||||
QString f = formula;//need for saving fixed formula;
|
QString f = formula;//need for saving fixed formula;
|
||||||
const quint32 splinePathId = GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath,
|
const quint32 splinePathId = GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath,
|
||||||
NULL_ID_STR);
|
NULL_ID_STR);
|
||||||
const QString color = GetParametrString(domElement, AttrColor,
|
|
||||||
ColorBlack);
|
|
||||||
|
|
||||||
VToolCutSplinePath::Create(id, name, f, splinePathId, mx, my, color, scene, this, data, parse,
|
VToolCutSplinePath::Create(id, name, f, splinePathId, mx, my, scene, this, data, parse, Source::FromFile);
|
||||||
Source::FromFile);
|
|
||||||
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
||||||
if (f != formula)
|
if (f != formula)
|
||||||
{
|
{
|
||||||
|
@ -1501,9 +1495,8 @@ void VPattern::ParseToolCutArc(VMainGraphicsScene *scene, QDomElement &domElemen
|
||||||
const QString formula = GetParametrString(domElement, AttrLength, "0");
|
const QString formula = GetParametrString(domElement, AttrLength, "0");
|
||||||
QString f = formula;//need for saving fixed formula;
|
QString f = formula;//need for saving fixed formula;
|
||||||
const quint32 arcId = GetParametrUInt(domElement, AttrArc, NULL_ID_STR);
|
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.
|
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
||||||
if (f != formula)
|
if (f != formula)
|
||||||
{
|
{
|
||||||
|
|
|
@ -244,6 +244,18 @@ void VAbstractCurve::SetDuplicate(quint32 number)
|
||||||
CreateName();
|
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)
|
QVector<QPointF> VAbstractCurve::CurveIntersectLine(const QVector<QPointF> &points, const QLineF &line)
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,6 +69,9 @@ public:
|
||||||
quint32 GetDuplicate() const;
|
quint32 GetDuplicate() const;
|
||||||
void SetDuplicate(quint32 number);
|
void SetDuplicate(quint32 number);
|
||||||
|
|
||||||
|
QString GetColor() const;
|
||||||
|
void SetColor(const QString &color);
|
||||||
|
|
||||||
static QVector<QPointF> CurveIntersectLine(const QVector<QPointF> &points, const QLineF &line);
|
static QVector<QPointF> CurveIntersectLine(const QVector<QPointF> &points, const QLineF &line);
|
||||||
|
|
||||||
virtual QString NameForHistory(const QString &toolName) const=0;
|
virtual QString NameForHistory(const QString &toolName) const=0;
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
|
|
||||||
#include <QSharedData>
|
#include <QSharedData>
|
||||||
|
|
||||||
|
#include "../ifc/ifcdef.h"
|
||||||
|
|
||||||
#ifdef Q_CC_GNU
|
#ifdef Q_CC_GNU
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Weffc++"
|
#pragma GCC diagnostic ignored "-Weffc++"
|
||||||
|
@ -41,11 +43,11 @@ class VAbstractCurveData : public QSharedData
|
||||||
public:
|
public:
|
||||||
|
|
||||||
VAbstractCurveData ()
|
VAbstractCurveData ()
|
||||||
: duplicate(0)
|
: duplicate(0), color(ColorBlack)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
VAbstractCurveData(const VAbstractCurveData &curve)
|
VAbstractCurveData(const VAbstractCurveData &curve)
|
||||||
: QSharedData(curve), duplicate(curve.duplicate)
|
: QSharedData(curve), duplicate(curve.duplicate), color(curve.color)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual ~VAbstractCurveData();
|
virtual ~VAbstractCurveData();
|
||||||
|
@ -53,6 +55,8 @@ public:
|
||||||
/** @brief duplicate helps create unique name for curves that connects the same start and finish points. */
|
/** @brief duplicate helps create unique name for curves that connects the same start and finish points. */
|
||||||
quint32 duplicate;
|
quint32 duplicate;
|
||||||
|
|
||||||
|
QString color;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VAbstractCurveData &operator=(const VAbstractCurveData &) Q_DECL_EQ_DELETE;
|
VAbstractCurveData &operator=(const VAbstractCurveData &) Q_DECL_EQ_DELETE;
|
||||||
};
|
};
|
||||||
|
|
|
@ -62,7 +62,6 @@ DialogCutArc::DialogCutArc(const VContainer *data, const quint32 &toolId, QWidge
|
||||||
CheckState();
|
CheckState();
|
||||||
|
|
||||||
FillComboBoxArcs(ui->comboBoxArc);
|
FillComboBoxArcs(ui->comboBoxArc);
|
||||||
FillComboBoxLineColors(ui->comboBoxColor);
|
|
||||||
|
|
||||||
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutArc::FXLength);
|
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutArc::FXLength);
|
||||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutArc::NamePointChanged);
|
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutArc::NamePointChanged);
|
||||||
|
@ -170,18 +169,6 @@ void DialogCutArc::setArcId(const quint32 &value)
|
||||||
path->setObject1Id(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
|
* @brief SetFormula set string with formula length
|
||||||
|
|
|
@ -54,9 +54,6 @@ public:
|
||||||
|
|
||||||
quint32 getArcId() const;
|
quint32 getArcId() const;
|
||||||
void setArcId(const quint32 &value);
|
void setArcId(const quint32 &value);
|
||||||
|
|
||||||
QString GetColor() const;
|
|
||||||
void SetColor(const QString &value);
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>412</width>
|
<width>412</width>
|
||||||
<height>222</height>
|
<height>189</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -246,16 +246,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -61,7 +61,6 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId,
|
||||||
CheckState();
|
CheckState();
|
||||||
|
|
||||||
FillComboBoxSplines(ui->comboBoxSpline);
|
FillComboBoxSplines(ui->comboBoxSpline);
|
||||||
FillComboBoxLineColors(ui->comboBoxColor);
|
|
||||||
|
|
||||||
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutSpline::FXLength);
|
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutSpline::FXLength);
|
||||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSpline::NamePointChanged);
|
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSpline::NamePointChanged);
|
||||||
|
@ -126,18 +125,6 @@ void DialogCutSpline::setSplineId(const quint32 &value)
|
||||||
path->setObject1Id(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.
|
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
|
||||||
|
|
|
@ -53,9 +53,6 @@ public:
|
||||||
|
|
||||||
quint32 getSplineId() const;
|
quint32 getSplineId() const;
|
||||||
void setSplineId(const quint32 &value);
|
void setSplineId(const quint32 &value);
|
||||||
|
|
||||||
QString GetColor() const;
|
|
||||||
void SetColor(const QString &value);
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>412</width>
|
<width>412</width>
|
||||||
<height>222</height>
|
<height>189</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -246,16 +246,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -61,7 +61,6 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &
|
||||||
CheckState();
|
CheckState();
|
||||||
|
|
||||||
FillComboBoxSplinesPath(ui->comboBoxSplinePath);
|
FillComboBoxSplinesPath(ui->comboBoxSplinePath);
|
||||||
FillComboBoxLineColors(ui->comboBoxColor);
|
|
||||||
|
|
||||||
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutSplinePath::FXLength);
|
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutSplinePath::FXLength);
|
||||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSplinePath::NamePointChanged);
|
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSplinePath::NamePointChanged);
|
||||||
|
@ -126,18 +125,6 @@ void DialogCutSplinePath::setSplinePathId(const quint32 &value)
|
||||||
path->setObject1Id(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.
|
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
|
||||||
|
|
|
@ -53,9 +53,6 @@ public:
|
||||||
|
|
||||||
quint32 getSplinePathId() const;
|
quint32 getSplinePathId() const;
|
||||||
void setSplinePathId(const quint32 &value);
|
void setSplinePathId(const quint32 &value);
|
||||||
|
|
||||||
QString GetColor() const;
|
|
||||||
void SetColor(const QString &value);
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>412</width>
|
<width>412</width>
|
||||||
<height>222</height>
|
<height>189</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -246,22 +246,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -65,7 +65,8 @@ void VAbstractSpline::Disable(bool disable, const QString &namePP)
|
||||||
{
|
{
|
||||||
enabled = !CorrectDisable(disable, namePP);
|
enabled = !CorrectDisable(disable, namePP);
|
||||||
this->setEnabled(enabled);
|
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,
|
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor, Qt::SolidLine,
|
||||||
Qt::RoundCap));
|
Qt::RoundCap));
|
||||||
emit setEnabledPoint(enabled);
|
emit setEnabledPoint(enabled);
|
||||||
|
@ -122,7 +123,8 @@ void VAbstractSpline::SetFactor(qreal factor)
|
||||||
void VAbstractSpline::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
void VAbstractSpline::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(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,
|
qApp->toPixel(WidthMainLine(*VAbstractTool::data.GetPatternUnit()))/factor, Qt::SolidLine,
|
||||||
Qt::RoundCap));
|
Qt::RoundCap));
|
||||||
this->setPath(ToolPath(PathDirection::Show));
|
this->setPath(ToolPath(PathDirection::Show));
|
||||||
|
@ -139,7 +141,8 @@ void VAbstractSpline::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(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));
|
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
||||||
if (detailsMode)
|
if (detailsMode)
|
||||||
{
|
{
|
||||||
|
@ -231,7 +234,7 @@ QPainterPath VAbstractSpline::ToolPath(PathDirection direction) const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractSpline::ReadToolAttributes(const QDomElement &domElement)
|
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);
|
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);
|
QGraphicsPathItem::setEnabled(enabled);
|
||||||
if (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));
|
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
||||||
}
|
}
|
||||||
else
|
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
|
QString VAbstractSpline::name() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,6 +50,9 @@ public:
|
||||||
|
|
||||||
void setEnabled(bool enabled);
|
void setEnabled(bool enabled);
|
||||||
|
|
||||||
|
QString GetLineColor() const;
|
||||||
|
void SetLineColor(const QString &value);
|
||||||
|
|
||||||
QString name() const;
|
QString name() const;
|
||||||
|
|
||||||
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
|
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -47,13 +47,11 @@ const QString VToolArc::ToolType = QStringLiteral("simple");
|
||||||
* @param typeCreation way we create this tool.
|
* @param typeCreation way we create this tool.
|
||||||
* @param parent parent object
|
* @param parent parent object
|
||||||
*/
|
*/
|
||||||
VToolArc::VToolArc(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color,
|
VToolArc::VToolArc(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
|
||||||
const Source &typeCreation,
|
|
||||||
QGraphicsItem *parent)
|
QGraphicsItem *parent)
|
||||||
:VAbstractSpline(doc, data, id, parent)
|
:VAbstractSpline(doc, data, id, parent)
|
||||||
{
|
{
|
||||||
sceneType = SceneObject::Arc;
|
sceneType = SceneObject::Arc;
|
||||||
lineColor = color;
|
|
||||||
|
|
||||||
this->setPath(ToolPath());
|
this->setPath(ToolPath());
|
||||||
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
||||||
|
@ -76,7 +74,7 @@ void VToolArc::setDialog()
|
||||||
dialogTool->SetF1(arc->GetFormulaF1());
|
dialogTool->SetF1(arc->GetFormulaF1());
|
||||||
dialogTool->SetF2(arc->GetFormulaF2());
|
dialogTool->SetF2(arc->GetFormulaF2());
|
||||||
dialogTool->SetRadius(arc->GetFormulaRadius());
|
dialogTool->SetRadius(arc->GetFormulaRadius());
|
||||||
dialogTool->SetColor(lineColor);
|
dialogTool->SetColor(arc->GetColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -133,6 +131,7 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 ¢er, QString &ra
|
||||||
|
|
||||||
const VPointF c = *data->GeometricObject<VPointF>(center);
|
const VPointF c = *data->GeometricObject<VPointF>(center);
|
||||||
VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 );
|
VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 );
|
||||||
|
arc->SetColor(color);
|
||||||
quint32 id = _id;
|
quint32 id = _id;
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
|
@ -151,7 +150,7 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 ¢er, QString &ra
|
||||||
VDrawTool::AddRecord(id, Tool::Arc, doc);
|
VDrawTool::AddRecord(id, Tool::Arc, doc);
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VToolArc *toolArc = new VToolArc(doc, data, id, color, typeCreation);
|
VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation);
|
||||||
scene->addItem(toolArc);
|
scene->addItem(toolArc);
|
||||||
InitArcToolConnections(scene, toolArc);
|
InitArcToolConnections(scene, toolArc);
|
||||||
doc->AddTool(id, toolArc);
|
doc->AddTool(id, toolArc);
|
||||||
|
@ -364,7 +363,8 @@ void VToolArc::SetVisualization()
|
||||||
*/
|
*/
|
||||||
void VToolArc::RefreshGeometry()
|
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));
|
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
||||||
this->setPath(ToolPath());
|
this->setPath(ToolPath());
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolArc)
|
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);
|
QGraphicsItem * parent = nullptr);
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -39,12 +39,11 @@
|
||||||
const QString VToolArcWithLength::ToolType = QStringLiteral("arcWithLength");
|
const QString VToolArcWithLength::ToolType = QStringLiteral("arcWithLength");
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VToolArcWithLength::VToolArcWithLength(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color,
|
VToolArcWithLength::VToolArcWithLength(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
|
||||||
const Source &typeCreation, QGraphicsItem *parent)
|
QGraphicsItem *parent)
|
||||||
:VAbstractSpline(doc, data, id, parent)
|
:VAbstractSpline(doc, data, id, parent)
|
||||||
{
|
{
|
||||||
sceneType = SceneObject::Arc;
|
sceneType = SceneObject::Arc;
|
||||||
lineColor = color;
|
|
||||||
|
|
||||||
this->setPath(ToolPath());
|
this->setPath(ToolPath());
|
||||||
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
||||||
|
@ -64,7 +63,7 @@ void VToolArcWithLength::setDialog()
|
||||||
dialogTool->SetF1(arc->GetFormulaF1());
|
dialogTool->SetF1(arc->GetFormulaF1());
|
||||||
dialogTool->SetLength(arc->GetFormulaLength());
|
dialogTool->SetLength(arc->GetFormulaLength());
|
||||||
dialogTool->SetRadius(arc->GetFormulaRadius());
|
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);
|
const VPointF c = *data->GeometricObject<VPointF>(center);
|
||||||
VArc *arc = new VArc(calcLength, length, c, calcRadius, radius, calcF1, f1);
|
VArc *arc = new VArc(calcLength, length, c, calcRadius, radius, calcF1, f1);
|
||||||
|
arc->SetColor(color);
|
||||||
quint32 id = _id;
|
quint32 id = _id;
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
|
@ -120,7 +120,7 @@ VToolArcWithLength *VToolArcWithLength::Create(const quint32 _id, const quint32
|
||||||
VDrawTool::AddRecord(id, Tool::ArcWithLength, doc);
|
VDrawTool::AddRecord(id, Tool::ArcWithLength, doc);
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VToolArcWithLength *toolArc = new VToolArcWithLength(doc, data, id, color, typeCreation);
|
VToolArcWithLength *toolArc = new VToolArcWithLength(doc, data, id, typeCreation);
|
||||||
scene->addItem(toolArc);
|
scene->addItem(toolArc);
|
||||||
InitArcToolConnections(scene, toolArc);
|
InitArcToolConnections(scene, toolArc);
|
||||||
doc->AddTool(id, toolArc);
|
doc->AddTool(id, toolArc);
|
||||||
|
@ -317,7 +317,8 @@ void VToolArcWithLength::SetVisualization()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolArcWithLength::RefreshGeometry()
|
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));
|
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
||||||
this->setPath(ToolPath());
|
this->setPath(ToolPath());
|
||||||
|
|
||||||
|
|
|
@ -41,9 +41,9 @@ public:
|
||||||
static VToolArcWithLength* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
static VToolArcWithLength* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||||
VContainer *data);
|
VContainer *data);
|
||||||
static VToolArcWithLength* Create(const quint32 _id, const quint32 ¢er, QString &radius, QString &f1,
|
static VToolArcWithLength* Create(const quint32 _id, const quint32 ¢er, QString &radius, QString &f1,
|
||||||
QString &length, const QString &color, VMainGraphicsScene *scene,
|
QString &length, const QString &color, VMainGraphicsScene *scene,
|
||||||
VAbstractPattern *doc,
|
VAbstractPattern *doc, VContainer *data, const Document &parse,
|
||||||
VContainer *data, const Document &parse, const Source &typeCreation);
|
const Source &typeCreation);
|
||||||
|
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
|
@ -72,8 +72,8 @@ protected:
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolArcWithLength)
|
Q_DISABLE_COPY(VToolArcWithLength)
|
||||||
|
|
||||||
VToolArcWithLength(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color,
|
VToolArcWithLength(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
|
||||||
const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
QGraphicsItem * parent = nullptr);
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
|
|
@ -35,12 +35,11 @@
|
||||||
const QString VToolCubicBezier::ToolType = QStringLiteral("cubicBezier");
|
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)
|
const Source &typeCreation, QGraphicsItem *parent)
|
||||||
:VAbstractSpline(doc, data, id, parent)
|
:VAbstractSpline(doc, data, id, parent)
|
||||||
{
|
{
|
||||||
sceneType = SceneObject::Spline;
|
sceneType = SceneObject::Spline;
|
||||||
lineColor = color;
|
|
||||||
|
|
||||||
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
||||||
this->setPath(ToolPath());
|
this->setPath(ToolPath());
|
||||||
|
@ -62,7 +61,7 @@ void VToolCubicBezier::setDialog()
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const auto spl = VAbstractTool::data.GeometricObject<VCubicBezier>(id);
|
const auto spl = VAbstractTool::data.GeometricObject<VCubicBezier>(id);
|
||||||
dialogTool->SetSpline(*spl);
|
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)
|
const Document &parse, const Source &typeCreation)
|
||||||
{
|
{
|
||||||
quint32 id = _id;
|
quint32 id = _id;
|
||||||
|
spline->SetColor(color);
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
id = data->AddGObject(spline);
|
id = data->AddGObject(spline);
|
||||||
|
@ -106,7 +106,7 @@ VToolCubicBezier *VToolCubicBezier::Create(const quint32 _id, VCubicBezier *spli
|
||||||
VDrawTool::AddRecord(id, Tool::CubicBezier, doc);
|
VDrawTool::AddRecord(id, Tool::CubicBezier, doc);
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
auto _spl = new VToolCubicBezier(doc, data, id, color, typeCreation);
|
auto _spl = new VToolCubicBezier(doc, data, id, typeCreation);
|
||||||
scene->addItem(_spl);
|
scene->addItem(_spl);
|
||||||
InitSplineToolConnections(scene, _spl);
|
InitSplineToolConnections(scene, _spl);
|
||||||
doc->AddTool(id, _spl);
|
doc->AddTool(id, _spl);
|
||||||
|
@ -209,7 +209,8 @@ void VToolCubicBezier::SetVisualization()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolCubicBezier::RefreshGeometry()
|
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));
|
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
||||||
if (isHovered || detailsMode)
|
if (isHovered || detailsMode)
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,8 +61,8 @@ protected:
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolCubicBezier)
|
Q_DISABLE_COPY(VToolCubicBezier)
|
||||||
|
|
||||||
VToolCubicBezier(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color,
|
VToolCubicBezier(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
|
||||||
const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
QGraphicsItem * parent = nullptr);
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
void SetSplineAttributes(QDomElement &domElement, const VCubicBezier &spl);
|
void SetSplineAttributes(QDomElement &domElement, const VCubicBezier &spl);
|
||||||
|
|
|
@ -33,12 +33,11 @@
|
||||||
const QString VToolCubicBezierPath::ToolType = QStringLiteral("cubicBezierPath");
|
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)
|
const Source &typeCreation, QGraphicsItem *parent)
|
||||||
: VAbstractSpline(doc, data, id, parent)
|
: VAbstractSpline(doc, data, id, parent)
|
||||||
{
|
{
|
||||||
sceneType = SceneObject::SplinePath;
|
sceneType = SceneObject::SplinePath;
|
||||||
lineColor = color;
|
|
||||||
|
|
||||||
this->setPath(ToolPath());
|
this->setPath(ToolPath());
|
||||||
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
||||||
|
@ -60,7 +59,7 @@ void VToolCubicBezierPath::setDialog()
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const QSharedPointer<VCubicBezierPath> splPath = VAbstractTool::data.GeometricObject<VCubicBezierPath>(id);
|
const QSharedPointer<VCubicBezierPath> splPath = VAbstractTool::data.GeometricObject<VCubicBezierPath>(id);
|
||||||
dialogTool->SetPath(*splPath);
|
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)
|
const Document &parse, const Source &typeCreation)
|
||||||
{
|
{
|
||||||
quint32 id = _id;
|
quint32 id = _id;
|
||||||
|
path->SetColor(color);
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
id = data->AddGObject(path);
|
id = data->AddGObject(path);
|
||||||
|
@ -107,7 +107,7 @@ VToolCubicBezierPath *VToolCubicBezierPath::Create(const quint32 _id, VCubicBezi
|
||||||
VDrawTool::AddRecord(id, Tool::CubicBezierPath, doc);
|
VDrawTool::AddRecord(id, Tool::CubicBezierPath, doc);
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VToolCubicBezierPath *spl = new VToolCubicBezierPath(doc, data, id, color, typeCreation);
|
VToolCubicBezierPath *spl = new VToolCubicBezierPath(doc, data, id, typeCreation);
|
||||||
scene->addItem(spl);
|
scene->addItem(spl);
|
||||||
InitSplinePathToolConnections(scene, spl);
|
InitSplinePathToolConnections(scene, spl);
|
||||||
doc->AddTool(id, spl);
|
doc->AddTool(id, spl);
|
||||||
|
@ -214,7 +214,8 @@ void VToolCubicBezierPath::RefreshGeometry()
|
||||||
{
|
{
|
||||||
isHovered || detailsMode ? setPath(ToolPath(PathDirection::Show)) : setPath(ToolPath());
|
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));
|
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
||||||
|
|
||||||
SetVisualization();
|
SetVisualization();
|
||||||
|
|
|
@ -63,7 +63,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolCubicBezierPath)
|
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);
|
const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -52,13 +52,11 @@ const QString VToolSpline::OldToolType = QStringLiteral("simple");
|
||||||
* @param typeCreation way we create this tool.
|
* @param typeCreation way we create this tool.
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VToolSpline::VToolSpline(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color,
|
VToolSpline::VToolSpline(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
|
||||||
const Source &typeCreation,
|
|
||||||
QGraphicsItem *parent)
|
QGraphicsItem *parent)
|
||||||
:VAbstractSpline(doc, data, id, parent), oldPosition()
|
:VAbstractSpline(doc, data, id, parent), oldPosition()
|
||||||
{
|
{
|
||||||
sceneType = SceneObject::Spline;
|
sceneType = SceneObject::Spline;
|
||||||
lineColor = color;
|
|
||||||
|
|
||||||
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
||||||
this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||||
|
@ -114,7 +112,7 @@ void VToolSpline::setDialog()
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const auto spl = VAbstractTool::data.GeometricObject<VSpline>(id);
|
const auto spl = VAbstractTool::data.GeometricObject<VSpline>(id);
|
||||||
dialogTool->SetSpline(*spl);
|
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);
|
auto dialogTool = qobject_cast<DialogSpline*>(dialog);
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
|
|
||||||
auto spl = Create(0, new VSpline(dialogTool->GetSpline()), dialogTool->GetColor(), scene, doc, data,
|
VSpline *spline = new VSpline(dialogTool->GetSpline());
|
||||||
Document::FullParse, Source::FromGui);
|
|
||||||
|
auto spl = Create(0, spline, dialogTool->GetColor(), scene, doc, data, Document::FullParse, Source::FromGui);
|
||||||
|
|
||||||
if (spl != nullptr)
|
if (spl != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -147,7 +146,6 @@ VToolSpline* VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene,
|
||||||
* @brief Create help create tool.
|
* @brief Create help create tool.
|
||||||
* @param _id tool id, 0 if tool doesn't exist yet.
|
* @param _id tool id, 0 if tool doesn't exist yet.
|
||||||
* @param spline spline.
|
* @param spline spline.
|
||||||
* @param color spline color.
|
|
||||||
* @param scene pointer to scene.
|
* @param scene pointer to scene.
|
||||||
* @param doc dom document container.
|
* @param doc dom document container.
|
||||||
* @param data container with variables.
|
* @param data container with variables.
|
||||||
|
@ -160,6 +158,7 @@ VToolSpline* VToolSpline::Create(const quint32 _id, VSpline *spline, const QStri
|
||||||
const Source &typeCreation)
|
const Source &typeCreation)
|
||||||
{
|
{
|
||||||
quint32 id = _id;
|
quint32 id = _id;
|
||||||
|
spline->SetColor(color);
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
id = data->AddGObject(spline);
|
id = data->AddGObject(spline);
|
||||||
|
@ -177,7 +176,7 @@ VToolSpline* VToolSpline::Create(const quint32 _id, VSpline *spline, const QStri
|
||||||
VDrawTool::AddRecord(id, Tool::Spline, doc);
|
VDrawTool::AddRecord(id, Tool::Spline, doc);
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
auto _spl = new VToolSpline(doc, data, id, color, typeCreation);
|
auto _spl = new VToolSpline(doc, data, id, typeCreation);
|
||||||
scene->addItem(_spl);
|
scene->addItem(_spl);
|
||||||
InitSplineToolConnections(scene, _spl);
|
InitSplineToolConnections(scene, _spl);
|
||||||
doc->AddTool(id, _spl);
|
doc->AddTool(id, _spl);
|
||||||
|
@ -508,7 +507,9 @@ void VToolSpline::RefreshGeometry()
|
||||||
point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
|
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));
|
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
||||||
if (isHovered || detailsMode)
|
if (isHovered || detailsMode)
|
||||||
{
|
{
|
||||||
|
@ -522,8 +523,6 @@ void VToolSpline::RefreshGeometry()
|
||||||
controlPoints[0]->blockSignals(true);
|
controlPoints[0]->blockSignals(true);
|
||||||
controlPoints[1]->blockSignals(true);
|
controlPoints[1]->blockSignals(true);
|
||||||
|
|
||||||
const auto spl = VAbstractTool::data.GeometricObject<VSpline>(id);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
const bool freeAngle1 = qmu::QmuTokenParser::IsSingle(spl->GetStartAngleFormula());
|
const bool freeAngle1 = qmu::QmuTokenParser::IsSingle(spl->GetStartAngleFormula());
|
||||||
const bool freeLength1 = qmu::QmuTokenParser::IsSingle(spl->GetC1LengthFormula());
|
const bool freeLength1 = qmu::QmuTokenParser::IsSingle(spl->GetC1LengthFormula());
|
||||||
|
|
|
@ -78,7 +78,7 @@ private:
|
||||||
Q_DISABLE_COPY(VToolSpline)
|
Q_DISABLE_COPY(VToolSpline)
|
||||||
QPointF oldPosition;
|
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 );
|
QGraphicsItem * parent = nullptr );
|
||||||
|
|
||||||
bool IsMovable() const;
|
bool IsMovable() const;
|
||||||
|
|
|
@ -51,14 +51,13 @@ const QString VToolSplinePath::OldToolType = QStringLiteral("path");
|
||||||
* @param typeCreation way we create this tool.
|
* @param typeCreation way we create this tool.
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VToolSplinePath::VToolSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color,
|
VToolSplinePath::VToolSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
|
||||||
const Source &typeCreation, QGraphicsItem *parent)
|
QGraphicsItem *parent)
|
||||||
: VAbstractSpline(doc, data, id, parent),
|
: VAbstractSpline(doc, data, id, parent),
|
||||||
oldPosition(),
|
oldPosition(),
|
||||||
splIndex(-1)
|
splIndex(-1)
|
||||||
{
|
{
|
||||||
sceneType = SceneObject::SplinePath;
|
sceneType = SceneObject::SplinePath;
|
||||||
lineColor = color;
|
|
||||||
|
|
||||||
this->setPath(ToolPath());
|
this->setPath(ToolPath());
|
||||||
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
||||||
|
@ -117,7 +116,7 @@ void VToolSplinePath::setDialog()
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
const QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
||||||
dialogTool->SetPath(*splPath);
|
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);
|
DialogSplinePath *dialogTool = qobject_cast<DialogSplinePath*>(dialog);
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
VSplinePath *path = new VSplinePath(dialogTool->GetPath());
|
VSplinePath *path = new VSplinePath(dialogTool->GetPath());
|
||||||
const QString color = dialogTool->GetColor();
|
|
||||||
for (qint32 i = 0; i < path->CountPoints(); ++i)
|
for (qint32 i = 0; i < path->CountPoints(); ++i)
|
||||||
{
|
{
|
||||||
doc->IncrementReferens((*path)[i].P().getIdTool());
|
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)
|
if (spl != nullptr)
|
||||||
{
|
{
|
||||||
spl->dialog=dialogTool;
|
spl->dialog=dialogTool;
|
||||||
|
@ -164,6 +163,7 @@ VToolSplinePath* VToolSplinePath::Create(const quint32 _id, VSplinePath *path, c
|
||||||
const Document &parse, const Source &typeCreation)
|
const Document &parse, const Source &typeCreation)
|
||||||
{
|
{
|
||||||
quint32 id = _id;
|
quint32 id = _id;
|
||||||
|
path->SetColor(color);
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
id = data->AddGObject(path);
|
id = data->AddGObject(path);
|
||||||
|
@ -181,7 +181,7 @@ VToolSplinePath* VToolSplinePath::Create(const quint32 _id, VSplinePath *path, c
|
||||||
VDrawTool::AddRecord(id, Tool::SplinePath, doc);
|
VDrawTool::AddRecord(id, Tool::SplinePath, doc);
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VToolSplinePath *spl = new VToolSplinePath(doc, data, id, color, typeCreation);
|
VToolSplinePath *spl = new VToolSplinePath(doc, data, id, typeCreation);
|
||||||
scene->addItem(spl);
|
scene->addItem(spl);
|
||||||
InitSplinePathToolConnections(scene, spl);
|
InitSplinePathToolConnections(scene, spl);
|
||||||
doc->AddTool(id, spl);
|
doc->AddTool(id, spl);
|
||||||
|
@ -631,10 +631,10 @@ void VToolSplinePath::RefreshGeometry()
|
||||||
this->setPath(ToolPath());
|
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));
|
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
||||||
|
|
||||||
const auto splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
|
||||||
for (qint32 i = 1; i<=splPath->CountSubSpl(); ++i)
|
for (qint32 i = 1; i<=splPath->CountSubSpl(); ++i)
|
||||||
{
|
{
|
||||||
const qint32 j = i*2;
|
const qint32 j = i*2;
|
||||||
|
|
|
@ -47,10 +47,8 @@ public:
|
||||||
static VToolSplinePath *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
static VToolSplinePath *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||||
VContainer *data);
|
VContainer *data);
|
||||||
static VToolSplinePath *Create(const quint32 _id, VSplinePath *path, const QString &color,
|
static VToolSplinePath *Create(const quint32 _id, VSplinePath *path, const QString &color,
|
||||||
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
|
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
|
||||||
const Document &parse,
|
const Document &parse, const Source &typeCreation);
|
||||||
const Source &typeCreation);
|
|
||||||
|
|
||||||
static VToolSplinePath *Create(const quint32 _id, const QVector<quint32> &points, QVector<QString> &a1,
|
static VToolSplinePath *Create(const quint32 _id, const QVector<quint32> &points, QVector<QString> &a1,
|
||||||
QVector<QString> &a2, QVector<QString> &l1, QVector<QString> &l2,
|
QVector<QString> &a2, QVector<QString> &l1, QVector<QString> &l2,
|
||||||
const QString &color, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
const QString &color, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||||
|
@ -101,8 +99,8 @@ private:
|
||||||
QPointF oldPosition;
|
QPointF oldPosition;
|
||||||
int splIndex;
|
int splIndex;
|
||||||
|
|
||||||
VToolSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color,
|
VToolSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
|
||||||
const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
QGraphicsItem *parent = nullptr);
|
||||||
|
|
||||||
bool IsMovable(int index) const;
|
bool IsMovable(int index) const;
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -32,12 +32,10 @@
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VToolCut::VToolCut(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
VToolCut::VToolCut(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||||
const quint32 &curveCutId, const QString &color, QGraphicsItem *parent)
|
const quint32 &curveCutId, QGraphicsItem *parent)
|
||||||
:VToolSinglePoint(doc, data, id, parent), formula(formula), curveCutId(curveCutId), detailsMode(false)
|
:VToolSinglePoint(doc, data, id, parent), formula(formula), curveCutId(curveCutId), detailsMode(false)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(curveCutId != 0, Q_FUNC_INFO, "curveCutId == 0"); //-V654 //-V712
|
Q_ASSERT_X(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();
|
curveCutId = domElement.attribute(attrCurve, "").toUInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VToolCut::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
|
||||||
{
|
|
||||||
VToolSinglePoint::SaveOptions(tag, obj);
|
|
||||||
|
|
||||||
doc->SetAttribute(tag, AttrColor, lineColor);
|
|
||||||
}
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class VToolCut : public VToolSinglePoint
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VToolCut(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
VToolCut(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||||
const quint32 &curveCutId, const QString &color, QGraphicsItem * parent = nullptr);
|
const quint32 &curveCutId, QGraphicsItem * parent = nullptr);
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Tool::Cut)};
|
enum { Type = UserType + static_cast<int>(Tool::Cut)};
|
||||||
|
|
||||||
|
@ -63,7 +63,6 @@ protected:
|
||||||
void RefreshGeometry();
|
void RefreshGeometry();
|
||||||
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
||||||
void FullUpdateCurveFromFile(const QString &attrCurve);
|
void FullUpdateCurveFromFile(const QString &attrCurve);
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void ShowToolVisualization(bool show);
|
void ShowToolVisualization(bool show);
|
||||||
|
|
|
@ -44,14 +44,12 @@ const QString VToolCutArc::ToolType = QStringLiteral("cutArc");
|
||||||
* @param id object id in container.
|
* @param id object id in container.
|
||||||
* @param formula string with formula length first arc.
|
* @param formula string with formula length first arc.
|
||||||
* @param arcId id arc in data container.
|
* @param arcId id arc in data container.
|
||||||
* @param color arc color.
|
|
||||||
* @param typeCreation way we create this tool.
|
* @param typeCreation way we create this tool.
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VToolCutArc::VToolCutArc(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
VToolCutArc::VToolCutArc(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||||
const quint32 &arcId, const QString &color, const Source &typeCreation,
|
const quint32 &arcId, const Source &typeCreation, QGraphicsItem * parent)
|
||||||
QGraphicsItem * parent)
|
:VToolCut(doc, data, id, formula, arcId, parent)
|
||||||
:VToolCut(doc, data, id, formula, arcId, color, parent)
|
|
||||||
{
|
{
|
||||||
ToolCreation(typeCreation);
|
ToolCreation(typeCreation);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +67,6 @@ void VToolCutArc::setDialog()
|
||||||
dialogTool->SetFormula(formula);
|
dialogTool->SetFormula(formula);
|
||||||
dialogTool->setArcId(curveCutId);
|
dialogTool->setArcId(curveCutId);
|
||||||
dialogTool->SetPointName(point->name());
|
dialogTool->SetPointName(point->name());
|
||||||
dialogTool->SetColor(lineColor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -88,8 +85,7 @@ VToolCutArc* VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene,
|
||||||
const QString pointName = dialogTool->getPointName();
|
const QString pointName = dialogTool->getPointName();
|
||||||
QString formula = dialogTool->GetFormula();
|
QString formula = dialogTool->GetFormula();
|
||||||
const quint32 arcId = dialogTool->getArcId();
|
const quint32 arcId = dialogTool->getArcId();
|
||||||
const QString color = dialogTool->GetColor();
|
VToolCutArc* point = Create(0, pointName, formula, arcId, 5, 10, scene, doc, data, Document::FullParse,
|
||||||
VToolCutArc* point = Create(0, pointName, formula, arcId, 5, 10, color, scene, doc, data, Document::FullParse,
|
|
||||||
Source::FromGui);
|
Source::FromGui);
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -114,9 +110,8 @@ VToolCutArc* VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene,
|
||||||
* @param typeCreation way we create this tool.
|
* @param typeCreation way we create this tool.
|
||||||
*/
|
*/
|
||||||
VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
|
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,
|
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||||
VAbstractPattern *doc, VContainer *data, const Document &parse,
|
VContainer *data, const Document &parse, const Source &typeCreation)
|
||||||
const Source &typeCreation)
|
|
||||||
{
|
{
|
||||||
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(arcId);
|
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);
|
VDrawTool::AddRecord(id, Tool::CutArc, doc);
|
||||||
if (parse == Document::FullParse)
|
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);
|
scene->addItem(point);
|
||||||
InitToolConnections(scene, point);
|
InitToolConnections(scene, point);
|
||||||
doc->AddTool(id, point);
|
doc->AddTool(id, point);
|
||||||
|
@ -201,7 +196,6 @@ void VToolCutArc::SaveDialog(QDomElement &domElement)
|
||||||
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->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -219,7 +213,6 @@ void VToolCutArc::ReadToolAttributes(const QDomElement &domElement)
|
||||||
{
|
{
|
||||||
formula = doc->GetParametrString(domElement, AttrLength, "");
|
formula = doc->GetParametrString(domElement, AttrLength, "");
|
||||||
curveCutId = doc->GetParametrUInt(domElement, AttrArc, NULL_ID_STR);
|
curveCutId = doc->GetParametrUInt(domElement, AttrArc, NULL_ID_STR);
|
||||||
lineColor = doc->GetParametrString(domElement, AttrColor, ColorBlack);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
virtual void setDialog() Q_DECL_OVERRIDE;
|
virtual void setDialog() Q_DECL_OVERRIDE;
|
||||||
static VToolCutArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data);
|
static VToolCutArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data);
|
||||||
static VToolCutArc* Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
|
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,
|
VAbstractPattern *doc, VContainer *data, const Document &parse,
|
||||||
const Source &typeCreation);
|
const Source &typeCreation);
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
|
@ -58,8 +58,7 @@ private:
|
||||||
Q_DISABLE_COPY(VToolCutArc)
|
Q_DISABLE_COPY(VToolCutArc)
|
||||||
|
|
||||||
VToolCutArc(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
VToolCutArc(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||||
const quint32 &arcId, const QString &color, const Source &typeCreation,
|
const quint32 &arcId, const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||||
QGraphicsItem * parent = nullptr);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VTOOLCUTARC_H
|
#endif // VTOOLCUTARC_H
|
||||||
|
|
|
@ -45,14 +45,12 @@ const QString VToolCutSpline::AttrSpline = QStringLiteral("spline");
|
||||||
* @param id object id in container.
|
* @param id object id in container.
|
||||||
* @param formula string with formula length first spline.
|
* @param formula string with formula length first spline.
|
||||||
* @param splineId id spline in data container.
|
* @param splineId id spline in data container.
|
||||||
* @param color spline color.
|
|
||||||
* @param typeCreation way we create this tool.
|
* @param typeCreation way we create this tool.
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VToolCutSpline::VToolCutSpline(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
VToolCutSpline::VToolCutSpline(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||||
const quint32 &splineId, const QString &color, const Source &typeCreation,
|
const quint32 &splineId, const Source &typeCreation, QGraphicsItem *parent)
|
||||||
QGraphicsItem *parent)
|
:VToolCut(doc, data, id, formula, splineId, parent)
|
||||||
:VToolCut(doc, data, id, formula, splineId, color, parent)
|
|
||||||
{
|
{
|
||||||
ToolCreation(typeCreation);
|
ToolCreation(typeCreation);
|
||||||
}
|
}
|
||||||
|
@ -70,7 +68,6 @@ void VToolCutSpline::setDialog()
|
||||||
dialogTool->SetFormula(formula);
|
dialogTool->SetFormula(formula);
|
||||||
dialogTool->setSplineId(curveCutId);
|
dialogTool->setSplineId(curveCutId);
|
||||||
dialogTool->SetPointName(point->name());
|
dialogTool->SetPointName(point->name());
|
||||||
dialogTool->SetColor(lineColor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -90,8 +87,7 @@ VToolCutSpline* VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *s
|
||||||
const QString pointName = dialogTool->getPointName();
|
const QString pointName = dialogTool->getPointName();
|
||||||
QString formula = dialogTool->GetFormula();
|
QString formula = dialogTool->GetFormula();
|
||||||
const quint32 splineId = dialogTool->getSplineId();
|
const quint32 splineId = dialogTool->getSplineId();
|
||||||
const QString color = dialogTool->GetColor();
|
VToolCutSpline* point = Create(0, pointName, formula, splineId, 5, 10, scene, doc, data, Document::FullParse,
|
||||||
VToolCutSpline* point = Create(0, pointName, formula, splineId, 5, 10, color, scene, doc, data, Document::FullParse,
|
|
||||||
Source::FromGui);
|
Source::FromGui);
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -116,7 +112,7 @@ VToolCutSpline* VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *s
|
||||||
* @param typeCreation way we create this tool.
|
* @param typeCreation way we create this tool.
|
||||||
*/
|
*/
|
||||||
VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointName, QString &formula,
|
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,
|
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
|
||||||
const Document &parse, const Source &typeCreation)
|
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);
|
VDrawTool::AddRecord(id, Tool::CutSpline, doc);
|
||||||
if (parse == Document::FullParse)
|
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);
|
scene->addItem(point);
|
||||||
InitToolConnections(scene, point);
|
InitToolConnections(scene, point);
|
||||||
doc->AddTool(id, point);
|
doc->AddTool(id, point);
|
||||||
|
@ -198,7 +194,6 @@ void VToolCutSpline::SaveDialog(QDomElement &domElement)
|
||||||
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, AttrSpline, QString().setNum(dialogTool->getSplineId()));
|
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, "");
|
formula = doc->GetParametrString(domElement, AttrLength, "");
|
||||||
curveCutId = doc->GetParametrUInt(domElement, AttrSpline, NULL_ID_STR);
|
curveCutId = doc->GetParametrUInt(domElement, AttrSpline, NULL_ID_STR);
|
||||||
lineColor = doc->GetParametrString(domElement, AttrColor, ColorBlack);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
static VToolCutSpline *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
static VToolCutSpline *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||||
VContainer *data);
|
VContainer *data);
|
||||||
static VToolCutSpline *Create(const quint32 _id, const QString &pointName, QString &formula,
|
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,
|
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
|
||||||
const Document &parse,
|
const Document &parse,
|
||||||
const Source &typeCreation);
|
const Source &typeCreation);
|
||||||
|
@ -61,8 +61,7 @@ private:
|
||||||
Q_DISABLE_COPY(VToolCutSpline)
|
Q_DISABLE_COPY(VToolCutSpline)
|
||||||
|
|
||||||
VToolCutSpline(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
VToolCutSpline(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||||
const quint32 &splineId, const QString &color, const Source &typeCreation,
|
const quint32 &splineId, const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||||
QGraphicsItem * parent = nullptr);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VTOOLCUTSPLINE_H
|
#endif // VTOOLCUTSPLINE_H
|
||||||
|
|
|
@ -45,14 +45,13 @@ const QString VToolCutSplinePath::AttrSplinePath = QStringLiteral("splinePath");
|
||||||
* @param id object id in container.
|
* @param id object id in container.
|
||||||
* @param formula string with formula length first splinePath.
|
* @param formula string with formula length first splinePath.
|
||||||
* @param splinePathId id splinePath (we cut this splinePath) in data container.
|
* @param splinePathId id splinePath (we cut this splinePath) in data container.
|
||||||
* @param color spline path color.
|
|
||||||
* @param typeCreation way we create this tool.
|
* @param typeCreation way we create this tool.
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VToolCutSplinePath::VToolCutSplinePath(VAbstractPattern *doc, VContainer *data, const quint32 &id,
|
VToolCutSplinePath::VToolCutSplinePath(VAbstractPattern *doc, VContainer *data, const quint32 &id,
|
||||||
const QString &formula, const quint32 &splinePathId,
|
const QString &formula, const quint32 &splinePathId,
|
||||||
const QString &color, const Source &typeCreation, QGraphicsItem *parent)
|
const Source &typeCreation, QGraphicsItem *parent)
|
||||||
:VToolCut(doc, data, id, formula, splinePathId, color, parent)
|
:VToolCut(doc, data, id, formula, splinePathId, parent)
|
||||||
{
|
{
|
||||||
ToolCreation(typeCreation);
|
ToolCreation(typeCreation);
|
||||||
}
|
}
|
||||||
|
@ -70,7 +69,6 @@ void VToolCutSplinePath::setDialog()
|
||||||
dialogTool->SetFormula(formula);
|
dialogTool->SetFormula(formula);
|
||||||
dialogTool->setSplinePathId(curveCutId);
|
dialogTool->setSplinePathId(curveCutId);
|
||||||
dialogTool->SetPointName(point->name());
|
dialogTool->SetPointName(point->name());
|
||||||
dialogTool->SetColor(lineColor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -90,8 +88,7 @@ VToolCutSplinePath* VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphics
|
||||||
const QString pointName = dialogTool->getPointName();
|
const QString pointName = dialogTool->getPointName();
|
||||||
QString formula = dialogTool->GetFormula();
|
QString formula = dialogTool->GetFormula();
|
||||||
const quint32 splinePathId = dialogTool->getSplinePathId();
|
const quint32 splinePathId = dialogTool->getSplinePathId();
|
||||||
const QString color = dialogTool->GetColor();
|
VToolCutSplinePath* point = Create(0, pointName, formula, splinePathId, 5, 10, scene, doc, data,
|
||||||
VToolCutSplinePath* point = Create(0, pointName, formula, splinePathId, 5, 10, color, scene, doc, data,
|
|
||||||
Document::FullParse, Source::FromGui);
|
Document::FullParse, Source::FromGui);
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -117,7 +114,7 @@ VToolCutSplinePath* VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphics
|
||||||
*/
|
*/
|
||||||
VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QString &formula,
|
VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QString &formula,
|
||||||
const quint32 &splinePathId, const qreal &mx, const qreal &my,
|
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)
|
VContainer *data, const Document &parse, const Source &typeCreation)
|
||||||
{
|
{
|
||||||
const auto splPath = data->GeometricObject<VAbstractCubicBezierPath>(splinePathId);
|
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);
|
VDrawTool::AddRecord(id, Tool::CutSplinePath, doc);
|
||||||
if (parse == Document::FullParse)
|
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);
|
scene->addItem(point);
|
||||||
InitToolConnections(scene, point);
|
InitToolConnections(scene, point);
|
||||||
doc->AddTool(id, point);
|
doc->AddTool(id, point);
|
||||||
|
@ -282,7 +279,6 @@ void VToolCutSplinePath::SaveDialog(QDomElement &domElement)
|
||||||
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, AttrSplinePath, QString().setNum(dialogTool->getSplinePathId()));
|
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, "");
|
formula = doc->GetParametrString(domElement, AttrLength, "");
|
||||||
curveCutId = doc->GetParametrUInt(domElement, AttrSplinePath, NULL_ID_STR);
|
curveCutId = doc->GetParametrUInt(domElement, AttrSplinePath, NULL_ID_STR);
|
||||||
lineColor = doc->GetParametrString(domElement, AttrColor, ColorBlack);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -47,8 +47,7 @@ public:
|
||||||
VContainer *data);
|
VContainer *data);
|
||||||
static VToolCutSplinePath *Create(const quint32 _id, const QString &pointName, QString &formula,
|
static VToolCutSplinePath *Create(const quint32 _id, const QString &pointName, QString &formula,
|
||||||
const quint32 &splinePathId, const qreal &mx, const qreal &my,
|
const quint32 &splinePathId, const qreal &mx, const qreal &my,
|
||||||
const QString &color, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
|
||||||
VContainer *data,
|
|
||||||
const Document &parse, const Source &typeCreation);
|
const Document &parse, const Source &typeCreation);
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
static const QString AttrSplinePath;
|
static const QString AttrSplinePath;
|
||||||
|
@ -69,8 +68,7 @@ private:
|
||||||
Q_DISABLE_COPY(VToolCutSplinePath)
|
Q_DISABLE_COPY(VToolCutSplinePath)
|
||||||
|
|
||||||
VToolCutSplinePath(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
VToolCutSplinePath(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||||
const quint32 &splinePathId, const QString &color, const Source &typeCreation,
|
const quint32 &splinePathId, const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||||
QGraphicsItem * parent = nullptr);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VTOOLCUTSPLINEPATH_H
|
#endif // VTOOLCUTSPLINEPATH_H
|
||||||
|
|
|
@ -46,7 +46,7 @@ VToolLinePoint::VToolLinePoint(VAbstractPattern *doc, VContainer *data, const qu
|
||||||
const QString &lineColor, const QString &formula, const quint32 &basePointId,
|
const QString &lineColor, const QString &formula, const quint32 &basePointId,
|
||||||
const qreal &angle, QGraphicsItem *parent)
|
const qreal &angle, QGraphicsItem *parent)
|
||||||
:VToolSinglePoint(doc, data, id, parent), formulaLength(formula), angle(angle), basePointId(basePointId),
|
:VToolSinglePoint(doc, data, id, parent), formulaLength(formula), angle(angle), basePointId(basePointId),
|
||||||
mainLine(nullptr)
|
mainLine(nullptr), lineColor(ColorBlack)
|
||||||
{
|
{
|
||||||
this->typeLine = typeLine;
|
this->typeLine = typeLine;
|
||||||
this->lineColor = lineColor;
|
this->lineColor = lineColor;
|
||||||
|
@ -145,6 +145,21 @@ void VToolLinePoint::SetAngle(const qreal &value)
|
||||||
SaveOption(obj);
|
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
|
quint32 VToolLinePoint::GetBasePointId() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,14 +45,18 @@ public:
|
||||||
virtual ~VToolLinePoint() Q_DECL_OVERRIDE;
|
virtual ~VToolLinePoint() Q_DECL_OVERRIDE;
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Tool::LinePoint)};
|
enum { Type = UserType + static_cast<int>(Tool::LinePoint)};
|
||||||
VFormula GetFormulaLength() const;
|
|
||||||
void SetFormulaLength(const VFormula &value);
|
|
||||||
|
|
||||||
quint32 GetBasePointId() const;
|
VFormula GetFormulaLength() const;
|
||||||
void SetBasePointId(const quint32 &value);
|
void SetFormulaLength(const VFormula &value);
|
||||||
|
|
||||||
qreal GetAngle() const;
|
quint32 GetBasePointId() const;
|
||||||
void SetAngle(const qreal &value);
|
void SetBasePointId(const quint32 &value);
|
||||||
|
|
||||||
|
qreal GetAngle() const;
|
||||||
|
void SetAngle(const qreal &value);
|
||||||
|
|
||||||
|
QString GetLineColor() const;
|
||||||
|
void SetLineColor(const QString &value);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void SetFactor(qreal factor) Q_DECL_OVERRIDE;
|
virtual void SetFactor(qreal factor) Q_DECL_OVERRIDE;
|
||||||
|
@ -66,11 +70,14 @@ protected:
|
||||||
qreal angle;
|
qreal angle;
|
||||||
|
|
||||||
/** @brief basePointId id base line point. */
|
/** @brief basePointId id base line point. */
|
||||||
quint32 basePointId;
|
quint32 basePointId;
|
||||||
|
|
||||||
/** @brief mainLine line item. */
|
/** @brief mainLine line item. */
|
||||||
QGraphicsLineItem *mainLine;
|
QGraphicsLineItem *mainLine;
|
||||||
|
|
||||||
|
/** @brief lineColor color of a line. */
|
||||||
|
QString lineColor;
|
||||||
|
|
||||||
virtual void RefreshGeometry();
|
virtual void RefreshGeometry();
|
||||||
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -47,7 +47,7 @@ qreal VDrawTool::factor = 1;
|
||||||
*/
|
*/
|
||||||
VDrawTool::VDrawTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent)
|
VDrawTool::VDrawTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent)
|
||||||
:VAbstractTool(doc, data, id, parent), nameActivDraw(doc->GetNameActivPP()),
|
: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::ChangedActivPP, this, &VDrawTool::ChangedActivDraw);
|
||||||
connect(this->doc, &VAbstractPattern::ChangedNameDraw, this, &VDrawTool::ChangedNameDraw);
|
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);
|
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||||
SaveOption(obj);
|
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);
|
|
||||||
}
|
|
||||||
|
|
|
@ -58,9 +58,6 @@ public:
|
||||||
QString getLineType() const;
|
QString getLineType() const;
|
||||||
virtual void SetTypeLine(const QString &value);
|
virtual void SetTypeLine(const QString &value);
|
||||||
|
|
||||||
QString GetLineColor() const;
|
|
||||||
virtual void SetLineColor(const QString &value);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void ChangedToolSelection(bool selected, quint32 object, quint32 tool);
|
void ChangedToolSelection(bool selected, quint32 object, quint32 tool);
|
||||||
|
|
||||||
|
@ -88,9 +85,6 @@ protected:
|
||||||
/** @brief typeLine line type. */
|
/** @brief typeLine line type. */
|
||||||
QString typeLine;
|
QString typeLine;
|
||||||
|
|
||||||
/** @brief lineColor color line or curve, but not a point. */
|
|
||||||
QString lineColor;
|
|
||||||
|
|
||||||
bool enabled;
|
bool enabled;
|
||||||
|
|
||||||
void AddToCalculation(const QDomElement &domElement);
|
void AddToCalculation(const QDomElement &domElement);
|
||||||
|
|
|
@ -48,7 +48,8 @@
|
||||||
VToolLine::VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint,
|
VToolLine::VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint,
|
||||||
const QString &typeLine, const QString &lineColor, const Source &typeCreation,
|
const QString &typeLine, const QString &lineColor, const Source &typeCreation,
|
||||||
QGraphicsItem *parent)
|
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->typeLine = typeLine;
|
||||||
this->lineColor = lineColor;
|
this->lineColor = lineColor;
|
||||||
|
@ -459,6 +460,12 @@ void VToolLine::SetTypeLine(const QString &value)
|
||||||
SaveOption(obj);
|
SaveOption(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VToolLine::GetLineColor() const
|
||||||
|
{
|
||||||
|
return lineColor;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolLine::SetLineColor(const QString &value)
|
void VToolLine::SetLineColor(const QString &value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,10 +55,12 @@ public:
|
||||||
quint32 GetSecondPoint() const;
|
quint32 GetSecondPoint() const;
|
||||||
void SetSecondPoint(const quint32 &value);
|
void SetSecondPoint(const quint32 &value);
|
||||||
|
|
||||||
|
QString GetLineColor() const;
|
||||||
|
void SetLineColor(const QString &value);
|
||||||
|
|
||||||
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
virtual void SetTypeLine(const QString &value) 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;
|
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
|
||||||
public slots:
|
public slots:
|
||||||
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
|
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
|
||||||
|
@ -89,6 +91,9 @@ private:
|
||||||
/** @brief secondPoint id second line point. */
|
/** @brief secondPoint id second line point. */
|
||||||
quint32 secondPoint;
|
quint32 secondPoint;
|
||||||
|
|
||||||
|
/** @brief lineColor color of a line. */
|
||||||
|
QString lineColor;
|
||||||
|
|
||||||
VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint,
|
VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint,
|
||||||
const QString &typeLine, const QString &lineColor, const Source &typeCreation,
|
const QString &typeLine, const QString &lineColor, const Source &typeCreation,
|
||||||
QGraphicsItem * parent = nullptr);
|
QGraphicsItem * parent = nullptr);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user