Refactoring. Move line type to VDrawTool class.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-02-03 16:46:14 +02:00
parent 76074f2820
commit 9d9bc2404b
4 changed files with 25 additions and 25 deletions

View File

@ -46,8 +46,8 @@ qreal VDrawTool::factor = 1;
* @param id object id in container. * @param id object id in container.
*/ */
VDrawTool::VDrawTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent) VDrawTool::VDrawTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent)
:VAbstractTool(doc, data, id, parent), ignoreFullUpdate(false), :VAbstractTool(doc, data, id, parent), ignoreFullUpdate(false), nameActivDraw(doc->GetNameActivPP()),
nameActivDraw(doc->GetNameActivPP()), dialog(nullptr) dialog(nullptr), typeLine(TypeLineLine)
{ {
connect(this->doc, &VPattern::ChangedActivPP, this, &VDrawTool::ChangedActivDraw); connect(this->doc, &VPattern::ChangedActivPP, this, &VDrawTool::ChangedActivDraw);
connect(this->doc, &VPattern::ChangedNameDraw, this, &VDrawTool::ChangedNameDraw); connect(this->doc, &VPattern::ChangedNameDraw, this, &VDrawTool::ChangedNameDraw);
@ -285,3 +285,18 @@ void VDrawTool::AddToCalculation(const QDomElement &domElement)
connect(addToCal, &AddToCalc::NeedFullParsing, doc, &VPattern::NeedFullParsing); connect(addToCal, &AddToCalc::NeedFullParsing, doc, &VPattern::NeedFullParsing);
qApp->getUndoStack()->push(addToCal); qApp->getUndoStack()->push(addToCal);
} }
//---------------------------------------------------------------------------------------------------------------------
QString VDrawTool::getLineType() const
{
return typeLine;
}
//---------------------------------------------------------------------------------------------------------------------
void VDrawTool::SetTypeLine(const QString &value)
{
typeLine = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
SaveOption(obj);
}

View File

@ -55,6 +55,9 @@ public:
virtual void setDialog() {} virtual void setDialog() {}
virtual void DialogLinkDestroy(); virtual void DialogLinkDestroy();
static qreal CheckFormula(const quint32 &toolId, QString &formula, VContainer *data); static qreal CheckFormula(const quint32 &toolId, QString &formula, VContainer *data);
QString getLineType() const;
virtual void SetTypeLine(const QString &value);
public slots: public slots:
virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable); virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
virtual void ChangedActivDraw(const QString &newName); virtual void ChangedActivDraw(const QString &newName);
@ -73,6 +76,9 @@ protected:
/** @brief dialog dialog options.*/ /** @brief dialog dialog options.*/
DialogTool *dialog; DialogTool *dialog;
/** @brief typeLine line type. */
QString typeLine;
void AddToCalculation(const QDomElement &domElement); void AddToCalculation(const QDomElement &domElement);
/** @brief SaveDialog save options into file after change in dialog. */ /** @brief SaveDialog save options into file after change in dialog. */

View File

@ -97,8 +97,7 @@ const QString VAbstractTool::ColorYellow = QStringLiteral("yellow");
* @param parent parent object. * @param parent parent object.
*/ */
VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent) VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent)
:VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black), typeLine(TypeLineLine), :VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black), vis(nullptr)
vis(nullptr)
{ {
SCASSERT(doc != nullptr); SCASSERT(doc != nullptr);
connect(this, &VAbstractTool::toolhaveChange, this->doc, &VPattern::haveLiteChange); connect(this, &VAbstractTool::toolhaveChange, this->doc, &VPattern::haveLiteChange);
@ -232,21 +231,6 @@ const QStringList VAbstractTool::Colors()
return colors; return colors;
} }
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractTool::getLineType() const
{
return typeLine;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractTool::SetTypeLine(const QString &value)
{
typeLine = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
SaveOption(obj);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QMap<QString, quint32> VAbstractTool::PointsList() const QMap<QString, quint32> VAbstractTool::PointsList() const
{ {

View File

@ -114,8 +114,6 @@ public:
const VContainer *getData() const; const VContainer *getData() const;
QString getLineType() const;
virtual void SetTypeLine(const QString &value);
QMap<QString, quint32> PointsList() const; QMap<QString, quint32> PointsList() const;
virtual QString getTagName() const =0; virtual QString getTagName() const =0;
virtual void ShowVisualization(bool show) =0; virtual void ShowVisualization(bool show) =0;
@ -152,9 +150,6 @@ protected:
/** @brief currentColor current tool color. */ /** @brief currentColor current tool color. */
Qt::GlobalColor currentColor; Qt::GlobalColor currentColor;
/** @brief typeLine line type. */
QString typeLine;
Visualization *vis; Visualization *vis;
/** /**