Refactoring VDomDocument, creation VPattern class.

--HG--
branch : feature
This commit is contained in:
dismine 2014-02-25 16:02:09 +02:00
parent bffa81d36e
commit de0200ca2a
74 changed files with 2291 additions and 2314 deletions

View File

@ -275,6 +275,7 @@ void VContainer::Clear()
lengthArcs.clear();
lineAngles.clear();
details.clear();
lengthSplines.clear();
ClearGObjects();
}

View File

@ -38,7 +38,7 @@
#include <QDebug>
#include <QPushButton>
DialogHistory::DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent)
DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogHistory), doc(doc), cursorRow(0),
cursorToolRecordRow(0)
{
@ -48,10 +48,10 @@ DialogHistory::DialogHistory(VContainer *data, VDomDocument *doc, QWidget *paren
FillTable();
InitialTable();
connect(ui->tableWidget, &QTableWidget::cellClicked, this, &DialogHistory::cellClicked);
connect(this, &DialogHistory::ShowHistoryTool, doc, &VDomDocument::ShowHistoryTool);
connect(doc, &VDomDocument::ChangedCursor, this, &DialogHistory::ChangedCursor);
connect(doc, &VDomDocument::patternChanged, this, &DialogHistory::UpdateHistory);
connect(doc, &VDomDocument::ChangedActivDraw, this, &DialogHistory::UpdateHistory);
connect(this, &DialogHistory::ShowHistoryTool, doc, &VPattern::ShowHistoryTool);
connect(doc, &VPattern::ChangedCursor, this, &DialogHistory::ChangedCursor);
connect(doc, &VPattern::patternChanged, this, &DialogHistory::UpdateHistory);
connect(doc, &VPattern::ChangedActivDraw, this, &DialogHistory::UpdateHistory);
ShowPoint();
}
@ -79,9 +79,9 @@ void DialogHistory::cellClicked(int row, int column)
cursorRow = row;
item->setIcon(QIcon("://icon/32x32/put_after.png"));
qint64 id = qvariant_cast<qint64>(item->data(Qt::UserRole));
disconnect(doc, &VDomDocument::ChangedCursor, this, &DialogHistory::ChangedCursor);
disconnect(doc, &VPattern::ChangedCursor, this, &DialogHistory::ChangedCursor);
doc->setCursor(id);
connect(doc, &VDomDocument::ChangedCursor, this, &DialogHistory::ChangedCursor);
connect(doc, &VPattern::ChangedCursor, this, &DialogHistory::ChangedCursor);
}
else
{

View File

@ -30,7 +30,7 @@
#define DIALOGHISTORY_H
#include "../tools/dialogtool.h"
#include "../../xml/vdomdocument.h"
#include "../../xml/vpattern.h"
namespace Ui
{
@ -50,7 +50,7 @@ public:
* @param doc dom document container
* @param parent parent widget
*/
DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent = 0);
DialogHistory(VContainer *data, VPattern *doc, QWidget *parent = 0);
virtual ~DialogHistory();
public slots:
/**
@ -95,7 +95,7 @@ private:
/**
* @brief doc dom document container
*/
VDomDocument *doc;
VPattern *doc;
/**
* @brief cursorRow save number of row where is cursor
*/

View File

@ -34,7 +34,7 @@
#include <QPushButton>
DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent)
DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogIncrements), data(data), doc(doc), row(0), column(0)
{
ui->setupUi(this);
@ -57,9 +57,9 @@ DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget
connect(ui->toolButtonAdd, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonAdd);
connect(ui->toolButtonRemove, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonRemove);
connect(this, &DialogIncrements::FullUpdateTree, this->doc, &VDomDocument::FullUpdateTree);
connect(this, &DialogIncrements::haveLiteChange, this->doc, &VDomDocument::haveLiteChange);
connect(this->doc, &VDomDocument::FullUpdateFromFile, this, &DialogIncrements::FullUpdateFromFile);
connect(this, &DialogIncrements::FullUpdateTree, this->doc, &VPattern::FullUpdateTree);
connect(this, &DialogIncrements::haveLiteChange, this->doc, &VPattern::haveLiteChange);
connect(this->doc, &VPattern::FullUpdateFromFile, this, &DialogIncrements::FullUpdateFromFile);
ui->tabWidget->setCurrentIndex(0);
}

View File

@ -30,7 +30,7 @@
#define DIALOGINCREMENTS_H
#include "../tools/dialogtool.h"
#include "../../xml/vdomdocument.h"
#include "../../xml/vpattern.h"
namespace Ui
{
@ -50,7 +50,7 @@ public:
* @param doc dom document container
* @param parent parent widget
*/
DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent = 0);
DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent = 0);
~DialogIncrements();
public slots:
/**
@ -95,7 +95,7 @@ private:
/**
* @brief doc dom document container
*/
VDomDocument *doc;
VPattern *doc;
/**
* @brief row save number of row current selected cell
*/

View File

@ -30,7 +30,7 @@
#include "ui_dialogpatternproperties.h"
#include <QSettings>
DialogPatternProperties::DialogPatternProperties(VDomDocument *doc, QWidget *parent) :
DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent) :
QDialog(parent), ui(new Ui::DialogPatternProperties), doc(doc)
{
ui->setupUi(this);
@ -57,7 +57,7 @@ DialogPatternProperties::DialogPatternProperties(VDomDocument *doc, QWidget *par
Q_CHECK_PTR(bCansel);
connect(bCansel, &QPushButton::clicked, this, &DialogPatternProperties::close);
connect(this, &DialogPatternProperties::haveChange, this->doc, &VDomDocument::haveLiteChange);
connect(this, &DialogPatternProperties::haveChange, this->doc, &VPattern::haveLiteChange);
}
DialogPatternProperties::~DialogPatternProperties()

View File

@ -30,7 +30,7 @@
#define DIALOGPATTERNPROPERTIES_H
#include <QDialog>
#include "../../xml/vdomdocument.h"
#include "../../xml/vpattern.h"
namespace Ui {
class DialogPatternProperties;
@ -40,7 +40,7 @@ class DialogPatternProperties : public QDialog
{
Q_OBJECT
public:
DialogPatternProperties(VDomDocument *doc, QWidget *parent = 0);
DialogPatternProperties(VPattern *doc, QWidget *parent = 0);
virtual ~DialogPatternProperties();
signals:
void haveChange();
@ -49,7 +49,7 @@ public slots:
private:
Q_DISABLE_COPY(DialogPatternProperties)
Ui::DialogPatternProperties *ui;
VDomDocument *doc;
VPattern *doc;
void Write(const QString &tagName, const QString &text) const;
};

View File

@ -128,9 +128,9 @@ MainWindow::MainWindow(QWidget *parent)
pattern = new VContainer();
doc = new VDomDocument(pattern, comboBoxDraws, &mode);
doc = new VPattern(pattern, comboBoxDraws, &mode);
doc->CreateEmptyFile();
connect(doc, &VDomDocument::patternChanged, this, &MainWindow::PatternWasModified);
connect(doc, &VPattern::patternChanged, this, &MainWindow::PatternWasModified);
InitAutoSave();
@ -268,7 +268,7 @@ void MainWindow::SetToolButton(bool checked, Tool::Tools t, const QString &curso
connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChoosedObject);
connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot);
connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
connect(doc, &VDomDocument::FullUpdateFromFile, dialogTool, &DialogTool::UpdateList);
connect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogTool::UpdateList);
}
else
{
@ -488,7 +488,7 @@ void MainWindow::ToolUnionDetails(bool checked)
SetToolButton<DialogUnionDetails>(checked, Tool::UnionDetails, ":/cursor/union_cursor.png", tr("Select detail"),
&MainWindow::ClosedDialogUnionDetails);
//Must disconnect this signal here.
disconnect(doc, &VDomDocument::FullUpdateFromFile, dialogTool, &DialogTool::UpdateList);
disconnect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogTool::UpdateList);
}
void MainWindow::ClosedDialogUnionDetails(int result)

View File

@ -403,7 +403,7 @@ private:
/**
* @brief doc dom document container
*/
VDomDocument *doc;
VPattern *doc;
/**
* @brief tool current tool
*/

View File

@ -30,13 +30,13 @@
qreal VDrawTool::factor = 1;
VDrawTool::VDrawTool(VDomDocument *doc, VContainer *data, qint64 id)
VDrawTool::VDrawTool(VPattern *doc, VContainer *data, qint64 id)
:VAbstractTool(doc, data, id), ignoreContextMenuEvent(false), ignoreFullUpdate(false),
nameActivDraw(doc->GetNameActivDraw()), dialog(0)
{
connect(this->doc, &VDomDocument::ChangedActivDraw, this, &VDrawTool::ChangedActivDraw);
connect(this->doc, &VDomDocument::ChangedNameDraw, this, &VDrawTool::ChangedNameDraw);
connect(this->doc, &VDomDocument::ShowTool, this, &VDrawTool::ShowTool);
connect(this->doc, &VPattern::ChangedActivDraw, this, &VDrawTool::ChangedActivDraw);
connect(this->doc, &VPattern::ChangedNameDraw, this, &VDrawTool::ChangedNameDraw);
connect(this->doc, &VPattern::ShowTool, this, &VDrawTool::ShowTool);
}
VDrawTool::~VDrawTool()
@ -99,7 +99,7 @@ void VDrawTool::SetFactor(qreal factor)
void VDrawTool::AddToCalculation(const QDomElement &domElement)
{
QDomElement calcElement;
bool ok = doc->GetActivCalculationElement(calcElement);
bool ok = doc->GetActivNodeElement(VPattern::TagCalculation, calcElement);
if (ok)
{
qint64 id = doc->getCursor();

View File

@ -49,7 +49,7 @@ public:
* @param id object id in container.
* @param parent parent object.
*/
VDrawTool(VDomDocument *doc, VContainer *data, qint64 id);
VDrawTool(VPattern *doc, VContainer *data, qint64 id);
virtual ~VDrawTool();
/**
* @brief setDialog set dialog when user want change tool option.
@ -159,7 +159,7 @@ protected:
connect(dialog, &DialogTool::DialogClosed, tool, &Tool::FullUpdateFromGui);
if (ignoreFullUpdate == false)
{
connect(doc, &VDomDocument::FullUpdateFromFile, dialog, &DialogTool::UpdateList);
connect(doc, &VPattern::FullUpdateFromFile, dialog, &DialogTool::UpdateList);
}
tool->setDialog();

View File

@ -32,7 +32,7 @@
const QString VToolAlongLine::ToolType = QStringLiteral("alongLine");
VToolAlongLine::VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula,
VToolAlongLine::VToolAlongLine(VPattern *doc, VContainer *data, qint64 id, const QString &formula,
const qint64 &firstPointId, const qint64 &secondPointId,
const QString &typeLine, const Tool::Sources &typeCreation,
QGraphicsItem *parent)
@ -84,16 +84,16 @@ void VToolAlongLine::AddToFile()
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrTypeLine, typeLine);
SetAttribute(domElement, AttrLength, formula);
SetAttribute(domElement, AttrFirstPoint, basePointId);
SetAttribute(domElement, AttrSecondPoint, secondPointId);
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrFirstPoint, basePointId);
doc->SetAttribute(domElement, AttrSecondPoint, secondPointId);
AddToCalculation(domElement);
}
@ -104,13 +104,13 @@ void VToolAlongLine::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrTypeLine, typeLine);
SetAttribute(domElement, AttrLength, formula);
SetAttribute(domElement, AttrFirstPoint, basePointId);
SetAttribute(domElement, AttrSecondPoint, secondPointId);
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrFirstPoint, basePointId);
doc->SetAttribute(domElement, AttrSecondPoint, secondPointId);
}
}
@ -125,11 +125,11 @@ void VToolAlongLine::SaveDialog(QDomElement &domElement)
Q_CHECK_PTR(dialog);
DialogAlongLine *dialogTool = qobject_cast<DialogAlongLine*>(dialog);
Q_CHECK_PTR(dialogTool);
SetAttribute(domElement, AttrName, dialogTool->getPointName());
SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
SetAttribute(domElement, AttrLength, dialogTool->getFormula());
SetAttribute(domElement, AttrFirstPoint, dialogTool->getFirstPointId());
SetAttribute(domElement, AttrSecondPoint, dialogTool->getSecondPointId());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
doc->SetAttribute(domElement, AttrFirstPoint, dialogTool->getFirstPointId());
doc->SetAttribute(domElement, AttrSecondPoint, dialogTool->getSecondPointId());
}
void VToolAlongLine::setDialog()
@ -145,7 +145,7 @@ void VToolAlongLine::setDialog()
dialogTool->setPointName(p->name());
}
void VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data)
void VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
DialogAlongLine *dialogTool = qobject_cast<DialogAlongLine*>(dialog);
@ -161,7 +161,7 @@ void VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomD
void VToolAlongLine::Create(const qint64 _id, const QString &pointName, const QString &typeLine,
const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation)
{
const VPointF *firstPoint = data->GeometricObject<const VPointF *>(firstPointId);

View File

@ -50,7 +50,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula,
VToolAlongLine(VPattern *doc, VContainer *data, qint64 id, const QString &formula,
const qint64 &firstPointId, const qint64 &secondPointId, const QString &typeLine,
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
/**
@ -64,7 +64,7 @@ public:
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
@ -83,7 +83,7 @@ public:
*/
static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, const QString &formula,
const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation);
static const QString ToolType;
public slots:

View File

@ -33,7 +33,7 @@
const QString VToolArc::TagName = QStringLiteral("arc");
const QString VToolArc::ToolType = QStringLiteral("simple");
VToolArc::VToolArc(VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation,
VToolArc::VToolArc(VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation,
QGraphicsItem *parent)
:VDrawTool(doc, data, id), QGraphicsPathItem(parent)
{
@ -69,7 +69,7 @@ void VToolArc::setDialog()
dialogTool->SetRadius(arc->GetFormulaRadius());
}
void VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc,
void VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data)
{
Q_CHECK_PTR(dialog);
@ -83,7 +83,7 @@ void VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocumen
}
void VToolArc::Create(const qint64 _id, const qint64 &center, const QString &radius, const QString &f1,
const QString &f2, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const QString &f2, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation)
{
qreal calcRadius = 0, calcF1 = 0, calcF2 = 0;
@ -183,12 +183,12 @@ void VToolArc::AddToFile()
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrCenter, arc->GetCenter().id());
SetAttribute(domElement, AttrRadius, arc->GetFormulaRadius());
SetAttribute(domElement, AttrAngle1, arc->GetFormulaF1());
SetAttribute(domElement, AttrAngle2, arc->GetFormulaF2());
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrCenter, arc->GetCenter().id());
doc->SetAttribute(domElement, AttrRadius, arc->GetFormulaRadius());
doc->SetAttribute(domElement, AttrAngle1, arc->GetFormulaF1());
doc->SetAttribute(domElement, AttrAngle2, arc->GetFormulaF2());
AddToCalculation(domElement);
}
@ -199,10 +199,10 @@ void VToolArc::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrCenter, arc->GetCenter().id());
SetAttribute(domElement, AttrRadius, arc->GetFormulaRadius());
SetAttribute(domElement, AttrAngle1, arc->GetFormulaF1());
SetAttribute(domElement, AttrAngle2, arc->GetFormulaF2());
doc->SetAttribute(domElement, AttrCenter, arc->GetCenter().id());
doc->SetAttribute(domElement, AttrRadius, arc->GetFormulaRadius());
doc->SetAttribute(domElement, AttrAngle1, arc->GetFormulaF1());
doc->SetAttribute(domElement, AttrAngle2, arc->GetFormulaF2());
}
}
@ -271,10 +271,10 @@ void VToolArc::SaveDialog(QDomElement &domElement)
Q_CHECK_PTR(dialog);
DialogArc *dialogTool = qobject_cast<DialogArc*>(dialog);
Q_CHECK_PTR(dialogTool);
SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter()));
SetAttribute(domElement, AttrRadius, dialogTool->GetRadius());
SetAttribute(domElement, AttrAngle1, dialogTool->GetF1());
SetAttribute(domElement, AttrAngle2, dialogTool->GetF2());
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter()));
doc->SetAttribute(domElement, AttrRadius, dialogTool->GetRadius());
doc->SetAttribute(domElement, AttrAngle1, dialogTool->GetF1());
doc->SetAttribute(domElement, AttrAngle2, dialogTool->GetF2());
}
void VToolArc::RefreshGeometry()

View File

@ -48,7 +48,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object
*/
VToolArc(VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation,
VToolArc(VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation,
QGraphicsItem * parent = 0);
/**
* @brief setDialog set dialog when user want change tool option.
@ -61,7 +61,7 @@ public:
* @param doc dom document container
* @param data container with variables
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool form GUI.
* @param _id tool id, 0 if tool doesn't exist yet.
@ -76,7 +76,7 @@ public:
* @param typeCreation way we create this tool.
*/
static void Create(const qint64 _id, const qint64 &center, const QString &radius, const QString &f1,
const QString &f2, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const QString &f2, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation);
static const QString TagName;
static const QString ToolType;

View File

@ -32,7 +32,7 @@
const QString VToolBisector::ToolType = QStringLiteral("bisector");
VToolBisector::VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id,
VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const qint64 &thirdPointId, const Tool::Sources &typeCreation,
QGraphicsItem *parent)
@ -84,7 +84,7 @@ void VToolBisector::setDialog()
dialogTool->setPointName(p->name());
}
void VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc,
void VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data)
{
Q_CHECK_PTR(dialog);
@ -103,7 +103,7 @@ void VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDo
void VToolBisector::Create(const qint64 _id, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine,
const QString &pointName, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation)
{
const VPointF *firstPoint = data->GeometricObject<const VPointF *>(firstPointId);
@ -183,17 +183,17 @@ void VToolBisector::AddToFile()
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrTypeLine, typeLine);
SetAttribute(domElement, AttrLength, formula);
SetAttribute(domElement, AttrFirstPoint, firstPointId);
SetAttribute(domElement, AttrSecondPoint, basePointId);
SetAttribute(domElement, AttrThirdPoint, thirdPointId);
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrFirstPoint, firstPointId);
doc->SetAttribute(domElement, AttrSecondPoint, basePointId);
doc->SetAttribute(domElement, AttrThirdPoint, thirdPointId);
AddToCalculation(domElement);
}
@ -204,14 +204,14 @@ void VToolBisector::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrTypeLine, typeLine);
SetAttribute(domElement, AttrLength, formula);
SetAttribute(domElement, AttrFirstPoint, firstPointId);
SetAttribute(domElement, AttrSecondPoint, basePointId);
SetAttribute(domElement, AttrThirdPoint, thirdPointId);
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrFirstPoint, firstPointId);
doc->SetAttribute(domElement, AttrSecondPoint, basePointId);
doc->SetAttribute(domElement, AttrThirdPoint, thirdPointId);
}
}
@ -227,10 +227,10 @@ void VToolBisector::SaveDialog(QDomElement &domElement)
Q_CHECK_PTR(dialog);
DialogBisector *dialogTool = qobject_cast<DialogBisector*>(dialog);
Q_CHECK_PTR(dialogTool);
SetAttribute(domElement, AttrName, dialogTool->getPointName());
SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
SetAttribute(domElement, AttrLength, dialogTool->getFormula());
SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPointId()));
SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPointId()));
SetAttribute(domElement, AttrThirdPoint, QString().setNum(dialogTool->getThirdPointId()));
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPointId()));
doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPointId()));
doc->SetAttribute(domElement, AttrThirdPoint, QString().setNum(dialogTool->getThirdPointId()));
}

View File

@ -50,7 +50,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
VToolBisector(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId,
const qint64 &thirdPointId, const Tool::Sources &typeCreation,
QGraphicsItem * parent = 0);
@ -75,7 +75,7 @@ public:
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
@ -96,7 +96,7 @@ public:
static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine,
const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
VPattern *doc, VContainer *data, const Document::Documents &parse,
const Tool::Sources &typeCreation);
static const QString ToolType;
public slots:

View File

@ -33,7 +33,7 @@
const QString VToolCutArc::ToolType = QStringLiteral("cutArc");
const QString VToolCutArc::AttrArc = QStringLiteral("arc");
VToolCutArc::VToolCutArc(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &formula,
VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const qint64 &id, const QString &formula,
const qint64 &arcId, const qint64 &arc1id, const qint64 &arc2id,
const Tool::Sources &typeCreation, QGraphicsItem * parent)
:VToolPoint(doc, data, id, parent), formula(formula), arcId(arcId), firstArc(), secondArc(), arc1id(arc1id),
@ -76,7 +76,7 @@ void VToolCutArc::setDialog()
dialogTool->setPointName(point->name());
}
void VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc,
void VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data)
{
Q_CHECK_PTR(dialog);
@ -89,7 +89,7 @@ void VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocu
}
void VToolCutArc::Create(const qint64 _id, const QString &pointName, const QString &formula, const qint64 &arcId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation)
{
const VArc *arc = data->GeometricObject<const VArc *>(arcId);
@ -213,14 +213,14 @@ void VToolCutArc::AddToFile()
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrLength, formula);
SetAttribute(domElement, AttrArc, arcId);
doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrArc, arcId);
AddToCalculation(domElement);
}
@ -231,11 +231,11 @@ void VToolCutArc::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrLength, formula);
SetAttribute(domElement, AttrArc, arcId);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrArc, arcId);
}
}
@ -251,9 +251,9 @@ void VToolCutArc::SaveDialog(QDomElement &domElement)
Q_CHECK_PTR(dialog);
DialogCutArc *dialogTool = qobject_cast<DialogCutArc*>(dialog);
Q_CHECK_PTR(dialogTool);
SetAttribute(domElement, AttrName, dialogTool->getPointName());
SetAttribute(domElement, AttrLength, dialogTool->getFormula());
SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->getArcId()));
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
doc->SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->getArcId()));
}
void VToolCutArc::RefreshArc(VSimpleArc *sArc, qint64 arcid, SimpleArc::Translation tr)

View File

@ -51,7 +51,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolCutArc(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &formula,
VToolCutArc(VPattern *doc, VContainer *data, const qint64 &id, const QString &formula,
const qint64 &arcId, const qint64 &arc1id, const qint64 &arc2id,
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
/**
@ -65,7 +65,7 @@ public:
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
@ -81,7 +81,7 @@ public:
* @param typeCreation way we create this tool.
*/
static void Create(const qint64 _id, const QString &pointName, const QString &formula, const qint64 &arcId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation);
static const QString ToolType;
static const QString AttrArc;

View File

@ -33,7 +33,7 @@
const QString VToolCutSpline::ToolType = QStringLiteral("cutSpline");
const QString VToolCutSpline::AttrSpline = QStringLiteral("spline");
VToolCutSpline::VToolCutSpline(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &formula,
VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const qint64 &id, const QString &formula,
const qint64 &splineId, const qint64 &spl1id, const qint64 &spl2id,
const Tool::Sources &typeCreation, QGraphicsItem *parent)
:VToolPoint(doc, data, id, parent), formula(formula), splineId(splineId), firstSpline(), secondSpline(),
@ -77,7 +77,7 @@ void VToolCutSpline::setDialog()
}
void VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data)
VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
DialogCutSpline *dialogTool = qobject_cast<DialogCutSpline*>(dialog);
@ -90,7 +90,7 @@ void VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene,
void VToolCutSpline::Create(const qint64 _id, const QString &pointName,
const QString &formula, const qint64 &splineId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation)
{
const VSpline *spl = data->GeometricObject<const VSpline *>(splineId);
@ -214,14 +214,14 @@ void VToolCutSpline::AddToFile()
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrLength, formula);
SetAttribute(domElement, AttrSpline, splineId);
doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrSpline, splineId);
AddToCalculation(domElement);
}
@ -232,11 +232,11 @@ void VToolCutSpline::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrLength, formula);
SetAttribute(domElement, AttrSpline, splineId);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrSpline, splineId);
}
}
@ -257,9 +257,9 @@ void VToolCutSpline::SaveDialog(QDomElement &domElement)
Q_CHECK_PTR(dialog);
DialogCutSpline *dialogTool = qobject_cast<DialogCutSpline*>(dialog);
Q_CHECK_PTR(dialogTool);
SetAttribute(domElement, AttrName, dialogTool->getPointName());
SetAttribute(domElement, AttrLength, dialogTool->getFormula());
SetAttribute(domElement, AttrSpline, QString().setNum(dialogTool->getSplineId()));
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
doc->SetAttribute(domElement, AttrSpline, QString().setNum(dialogTool->getSplineId()));
}
void VToolCutSpline::RefreshSpline(VSimpleSpline *spline, qint64 splid, SimpleSpline::Translation tr)

View File

@ -49,7 +49,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolCutSpline(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &formula,
VToolCutSpline(VPattern *doc, VContainer *data, const qint64 &id, const QString &formula,
const qint64 &splineId, const qint64 &spl1id, const qint64 &spl2id,
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
/**
@ -63,7 +63,7 @@ public:
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
@ -80,7 +80,7 @@ public:
*/
static void Create(const qint64 _id, const QString &pointName,
const QString &formula, const qint64 &splineId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation);
static const QString ToolType;
static const QString AttrSpline;

View File

@ -33,7 +33,7 @@
const QString VToolCutSplinePath::ToolType = QStringLiteral("cutSplinePath");
const QString VToolCutSplinePath::AttrSplinePath = QStringLiteral("splinePath");
VToolCutSplinePath::VToolCutSplinePath(VDomDocument *doc, VContainer *data, const qint64 &id,
VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const qint64 &id,
const QString &formula, const qint64 &splinePathId,
const qint64 &splPath1id, const qint64 &splPath2id,
const Tool::Sources &typeCreation, QGraphicsItem *parent)
@ -77,7 +77,7 @@ void VToolCutSplinePath::setDialog()
dialogTool->setPointName(point->name());
}
void VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data)
void VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
DialogCutSplinePath *dialogTool = qobject_cast<DialogCutSplinePath*>(dialog);
@ -90,7 +90,7 @@ void VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, V
void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, const QString &formula,
const qint64 &splinePathId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation)
{
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(splinePathId);
@ -295,14 +295,14 @@ void VToolCutSplinePath::AddToFile()
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrLength, formula);
SetAttribute(domElement, AttrSplinePath, splinePathId);
doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrSplinePath, splinePathId);
AddToCalculation(domElement);
}
@ -313,11 +313,11 @@ void VToolCutSplinePath::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrLength, formula);
SetAttribute(domElement, AttrSplinePath, splinePathId);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrSplinePath, splinePathId);
}
}
@ -338,9 +338,9 @@ void VToolCutSplinePath::SaveDialog(QDomElement &domElement)
Q_CHECK_PTR(dialog);
DialogCutSplinePath *dialogTool = qobject_cast<DialogCutSplinePath*>(dialog);
Q_CHECK_PTR(dialogTool);
SetAttribute(domElement, AttrName, dialogTool->getPointName());
SetAttribute(domElement, AttrLength, dialogTool->getFormula());
SetAttribute(domElement, AttrSplinePath, QString().setNum(dialogTool->getSplinePathId()));
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
doc->SetAttribute(domElement, AttrSplinePath, QString().setNum(dialogTool->getSplinePathId()));
}
void VToolCutSplinePath::RefreshSpline(VSimpleSpline *spline, qint64 splPathid, SimpleSpline::Translation tr)

View File

@ -52,7 +52,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolCutSplinePath(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &formula,
VToolCutSplinePath(VPattern *doc, VContainer *data, const qint64 &id, const QString &formula,
const qint64 &splinePathId, const qint64 &splPath1id, const qint64 &splPath2id,
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
/**
@ -66,7 +66,7 @@ public:
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
@ -83,7 +83,7 @@ public:
*/
static void Create(const qint64 _id, const QString &pointName, const QString &formula,
const qint64 &splinePathId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
VPattern *doc, VContainer *data, const Document::Documents &parse,
const Tool::Sources &typeCreation);
static const QString ToolType;
static const QString AttrSplinePath;

View File

@ -33,7 +33,7 @@
const QString VToolEndLine::ToolType = QStringLiteral("endLine");
VToolEndLine::VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
VToolEndLine::VToolEndLine(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const QString &formula, const qreal &angle, const qint64 &basePointId,
const Tool::Sources &typeCreation, QGraphicsItem *parent)
:VToolLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent)
@ -62,7 +62,7 @@ void VToolEndLine::setDialog()
dialogTool->setPointName(p->name());
}
void VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc,
void VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data)
{
Q_CHECK_PTR(dialog);
@ -79,7 +79,7 @@ void VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDoc
void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QString &typeLine,
const QString &formula, const qreal &angle, const qint64 &basePointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation)
{
const VPointF *basePoint = data->GeometricObject<const VPointF *>(basePointId);
@ -148,16 +148,16 @@ void VToolEndLine::AddToFile()
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrTypeLine, typeLine);
SetAttribute(domElement, AttrLength, formula);
SetAttribute(domElement, AttrAngle, angle);
SetAttribute(domElement, AttrBasePoint, basePointId);
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrAngle, angle);
doc->SetAttribute(domElement, AttrBasePoint, basePointId);
AddToCalculation(domElement);
}
@ -168,13 +168,13 @@ void VToolEndLine::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrTypeLine, typeLine);
SetAttribute(domElement, AttrLength, formula);
SetAttribute(domElement, AttrAngle, angle);
SetAttribute(domElement, AttrBasePoint, basePointId);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrAngle, angle);
doc->SetAttribute(domElement, AttrBasePoint, basePointId);
}
}
@ -183,9 +183,9 @@ void VToolEndLine::SaveDialog(QDomElement &domElement)
Q_CHECK_PTR(dialog);
DialogEndLine *dialogTool = qobject_cast<DialogEndLine*>(dialog);
Q_CHECK_PTR(dialogTool);
SetAttribute(domElement, AttrName, dialogTool->getPointName());
SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
SetAttribute(domElement, AttrLength, dialogTool->getFormula());
SetAttribute(domElement, AttrAngle, QString().setNum(dialogTool->getAngle()));
SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->getBasePointId()));
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
doc->SetAttribute(domElement, AttrAngle, QString().setNum(dialogTool->getAngle()));
doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->getBasePointId()));
}

View File

@ -50,7 +50,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
VToolEndLine(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const QString &formula, const qreal &angle, const qint64 &basePointId,
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
/**
@ -64,7 +64,7 @@ public:
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
@ -83,7 +83,7 @@ public:
*/
static void Create(const qint64 _id, const QString &pointName, const QString &typeLine,
const QString &formula, const qreal &angle, const qint64 &basePointId, const qreal &mx,
const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation);
static const QString ToolType;
public slots:

View File

@ -31,7 +31,7 @@
const QString VToolHeight::ToolType = QStringLiteral("height");
VToolHeight::VToolHeight(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
VToolHeight::VToolHeight(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId,
const Tool::Sources &typeCreation, QGraphicsItem * parent)
:VToolLinePoint(doc, data, id, typeLine, QString(), basePointId, 0, parent), p1LineId(p1LineId), p2LineId(p2LineId)
@ -60,13 +60,13 @@ void VToolHeight::setDialog()
dialogTool->setPointName(p->name());
}
void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc,
void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data)
{
Q_CHECK_PTR(dialog);
DialogHeight *dialogTool = qobject_cast<DialogHeight*>(dialog);
Q_CHECK_PTR(dialogTool);
disconnect(doc, &VDomDocument::FullUpdateFromFile, dialogTool, &DialogHeight::UpdateList);
disconnect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogHeight::UpdateList);
QString pointName = dialogTool->getPointName();
QString typeLine = dialogTool->getTypeLine();
qint64 basePointId = dialogTool->getBasePointId();
@ -78,7 +78,7 @@ void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocu
void VToolHeight::Create(const qint64 _id, const QString &pointName, const QString &typeLine,
const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation)
{
const VPointF *basePoint = data->GeometricObject<const VPointF *>(basePointId);
@ -154,16 +154,16 @@ void VToolHeight::AddToFile()
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrTypeLine, typeLine);
SetAttribute(domElement, AttrBasePoint, basePointId);
SetAttribute(domElement, AttrP1Line, p1LineId);
SetAttribute(domElement, AttrP2Line, p2LineId);
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrBasePoint, basePointId);
doc->SetAttribute(domElement, AttrP1Line, p1LineId);
doc->SetAttribute(domElement, AttrP2Line, p2LineId);
AddToCalculation(domElement);
@ -175,13 +175,13 @@ void VToolHeight::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrTypeLine, typeLine);
SetAttribute(domElement, AttrBasePoint, basePointId);
SetAttribute(domElement, AttrP1Line, p1LineId);
SetAttribute(domElement, AttrP2Line, p2LineId);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrBasePoint, basePointId);
doc->SetAttribute(domElement, AttrP1Line, p1LineId);
doc->SetAttribute(domElement, AttrP2Line, p2LineId);
}
}
@ -190,9 +190,9 @@ void VToolHeight::SaveDialog(QDomElement &domElement)
Q_CHECK_PTR(dialog);
DialogHeight *dialogTool = qobject_cast<DialogHeight*>(dialog);
Q_CHECK_PTR(dialogTool);
SetAttribute(domElement, AttrName, dialogTool->getPointName());
SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->getBasePointId()));
SetAttribute(domElement, AttrP1Line, QString().setNum(dialogTool->getP1LineId()));
SetAttribute(domElement, AttrP2Line, QString().setNum(dialogTool->getP2LineId()));
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->getBasePointId()));
doc->SetAttribute(domElement, AttrP1Line, QString().setNum(dialogTool->getP1LineId()));
doc->SetAttribute(domElement, AttrP2Line, QString().setNum(dialogTool->getP2LineId()));
}

View File

@ -50,7 +50,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolHeight(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
VToolHeight(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId,
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
/**
@ -64,7 +64,7 @@ public:
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool
* @param _id tool id, 0 if tool doesn't exist yet.
@ -83,7 +83,7 @@ public:
*/
static void Create(const qint64 _id, const QString &pointName, const QString &typeLine,
const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation);
/**
* @brief FindPoint find projection base point onto line.

View File

@ -31,7 +31,7 @@
const QString VToolLine::TagName = QStringLiteral("line");
VToolLine::VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, qint64 secondPoint,
VToolLine::VToolLine(VPattern *doc, VContainer *data, qint64 id, qint64 firstPoint, qint64 secondPoint,
const QString &typeLine, const Tool::Sources &typeCreation, QGraphicsItem *parent)
:VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint)
{
@ -67,7 +67,7 @@ void VToolLine::setDialog()
dialogTool->setTypeLine(typeLine);
}
void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data)
void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
DialogLine *dialogTool = qobject_cast<DialogLine*>(dialog);
@ -79,7 +79,7 @@ void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocume
}
void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, const QString &typeLine,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation)
{
Q_CHECK_PTR(scene);
@ -156,10 +156,10 @@ void VToolLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void VToolLine::AddToFile()
{
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrFirstPoint, firstPoint);
SetAttribute(domElement, AttrSecondPoint, secondPoint);
SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrFirstPoint, firstPoint);
doc->SetAttribute(domElement, AttrSecondPoint, secondPoint);
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
AddToCalculation(domElement);
}
@ -169,9 +169,9 @@ void VToolLine::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrFirstPoint, firstPoint);
SetAttribute(domElement, AttrSecondPoint, secondPoint);
SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrFirstPoint, firstPoint);
doc->SetAttribute(domElement, AttrSecondPoint, secondPoint);
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
}
}
@ -229,9 +229,9 @@ void VToolLine::SaveDialog(QDomElement &domElement)
Q_CHECK_PTR(dialog);
DialogLine *dialogTool = qobject_cast<DialogLine*>(dialog);
Q_CHECK_PTR(dialogTool);
SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPoint()));
SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPoint()));
SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPoint()));
doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPoint()));
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
}
void VToolLine::RefreshGeometry()

View File

@ -51,7 +51,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint,
VToolLine(VPattern *doc, VContainer *data, qint64 id, qint64 firstPoint,
qint64 secondPoint, const QString &typeLine, const Tool::Sources &typeCreation,
QGraphicsItem * parent = 0);
/**
@ -65,7 +65,7 @@ public:
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
@ -79,7 +79,7 @@ public:
* @param typeCreation way we create this tool.
*/
static void Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, const QString &typeLine,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation);
static const QString TagName;
public slots:

View File

@ -31,7 +31,7 @@
const QString VToolLineIntersect::ToolType = QStringLiteral("lineIntersect");
VToolLineIntersect::VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id,
VToolLineIntersect::VToolLineIntersect(VPattern *doc, VContainer *data, const qint64 &id,
const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2,
const qint64 &p2Line2, const Tool::Sources &typeCreation,
QGraphicsItem *parent)
@ -62,7 +62,7 @@ void VToolLineIntersect::setDialog()
dialogTool->setPointName(p->name());
}
void VToolLineIntersect::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data)
void VToolLineIntersect::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
DialogLineIntersect *dialogTool = qobject_cast<DialogLineIntersect*>(dialog);
@ -79,7 +79,7 @@ void VToolLineIntersect::Create(DialogTool *dialog, VMainGraphicsScene *scene, V
void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id,
const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
VPattern *doc, VContainer *data, const Document::Documents &parse,
const Tool::Sources &typeCreation)
{
const VPointF *p1Line1 = data->GeometricObject<const VPointF *>(p1Line1Id);
@ -165,16 +165,16 @@ void VToolLineIntersect::AddToFile()
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrP1Line1, p1Line1);
SetAttribute(domElement, AttrP2Line1, p2Line1);
SetAttribute(domElement, AttrP1Line2, p1Line2);
SetAttribute(domElement, AttrP2Line2, p2Line2);
doc->SetAttribute(domElement, AttrP1Line1, p1Line1);
doc->SetAttribute(domElement, AttrP2Line1, p2Line1);
doc->SetAttribute(domElement, AttrP1Line2, p1Line2);
doc->SetAttribute(domElement, AttrP2Line2, p2Line2);
AddToCalculation(domElement);
}
@ -185,13 +185,13 @@ void VToolLineIntersect::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrP1Line1, p1Line1);
SetAttribute(domElement, AttrP2Line1, p2Line1);
SetAttribute(domElement, AttrP1Line2, p1Line2);
SetAttribute(domElement, AttrP2Line2, p2Line2);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrP1Line1, p1Line1);
doc->SetAttribute(domElement, AttrP2Line1, p2Line1);
doc->SetAttribute(domElement, AttrP1Line2, p1Line2);
doc->SetAttribute(domElement, AttrP2Line2, p2Line2);
}
}
@ -208,9 +208,9 @@ void VToolLineIntersect::SaveDialog(QDomElement &domElement)
Q_CHECK_PTR(dialog);
DialogLineIntersect *dialogTool = qobject_cast<DialogLineIntersect*>(dialog);
Q_CHECK_PTR(dialogTool);
SetAttribute(domElement, AttrName, dialogTool->getPointName());
SetAttribute(domElement, AttrP1Line1, QString().setNum(dialogTool->getP1Line1()));
SetAttribute(domElement, AttrP2Line1, QString().setNum(dialogTool->getP2Line1()));
SetAttribute(domElement, AttrP1Line2, QString().setNum(dialogTool->getP1Line2()));
SetAttribute(domElement, AttrP2Line2, QString().setNum(dialogTool->getP2Line2()));
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrP1Line1, QString().setNum(dialogTool->getP1Line1()));
doc->SetAttribute(domElement, AttrP2Line1, QString().setNum(dialogTool->getP2Line1()));
doc->SetAttribute(domElement, AttrP1Line2, QString().setNum(dialogTool->getP1Line2()));
doc->SetAttribute(domElement, AttrP2Line2, QString().setNum(dialogTool->getP2Line2()));
}

View File

@ -50,7 +50,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &p1Line1,
VToolLineIntersect(VPattern *doc, VContainer *data, const qint64 &id, const qint64 &p1Line1,
const qint64 &p2Line1, const qint64 &p1Line2, const qint64 &p2Line2,
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
/**
@ -64,7 +64,7 @@ public:
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
@ -83,7 +83,7 @@ public:
*/
static void Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id, const qint64 &p1Line2Id,
const qint64 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation);
static const QString ToolType;
public slots:

View File

@ -28,7 +28,7 @@
#include "vtoollinepoint.h"
VToolLinePoint::VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id,
VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint64 &basePointId,
const qreal &angle, QGraphicsItem *parent)
:VToolPoint(doc, data, id, parent), formula(formula), angle(angle), basePointId(basePointId),

View File

@ -49,7 +49,7 @@ public:
* @param angle line angle.
* @param parent parent object.
*/
VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
VToolLinePoint(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const QString &formula, const qint64 &basePointId, const qreal &angle,
QGraphicsItem * parent = 0);
public slots:

View File

@ -32,7 +32,7 @@
const QString VToolNormal::ToolType = QStringLiteral("normal");
VToolNormal::VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
VToolNormal::VToolNormal(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const QString &formula, const qreal &angle, const qint64 &firstPointId,
const qint64 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent)
:VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, angle, parent),
@ -63,7 +63,7 @@ void VToolNormal::setDialog()
dialogTool->setPointName(p->name());
}
void VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data)
void VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
DialogNormal *dialogTool = qobject_cast<DialogNormal*>(dialog);
@ -81,7 +81,7 @@ void VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocu
void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const QString &typeLine, const QString &pointName,
const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
VPattern *doc, VContainer *data, const Document::Documents &parse,
const Tool::Sources &typeCreation)
{
const VPointF *firstPoint = data->GeometricObject<const VPointF *>(firstPointId);
@ -168,17 +168,17 @@ void VToolNormal::AddToFile()
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrTypeLine, typeLine);
SetAttribute(domElement, AttrLength, formula);
SetAttribute(domElement, AttrAngle, angle);
SetAttribute(domElement, AttrFirstPoint, basePointId);
SetAttribute(domElement, AttrSecondPoint, secondPointId);
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrAngle, angle);
doc->SetAttribute(domElement, AttrFirstPoint, basePointId);
doc->SetAttribute(domElement, AttrSecondPoint, secondPointId);
AddToCalculation(domElement);
}
@ -189,14 +189,14 @@ void VToolNormal::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrTypeLine, typeLine);
SetAttribute(domElement, AttrLength, formula);
SetAttribute(domElement, AttrAngle, angle);
SetAttribute(domElement, AttrFirstPoint, basePointId);
SetAttribute(domElement, AttrSecondPoint, secondPointId);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrAngle, angle);
doc->SetAttribute(domElement, AttrFirstPoint, basePointId);
doc->SetAttribute(domElement, AttrSecondPoint, secondPointId);
}
}
@ -211,10 +211,10 @@ void VToolNormal::SaveDialog(QDomElement &domElement)
Q_CHECK_PTR(dialog);
DialogNormal *dialogTool = qobject_cast<DialogNormal*>(dialog);
Q_CHECK_PTR(dialogTool);
SetAttribute(domElement, AttrName, dialogTool->getPointName());
SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
SetAttribute(domElement, AttrLength, dialogTool->getFormula());
SetAttribute(domElement, AttrAngle, QString().setNum(dialogTool->getAngle()));
SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPointId()));
SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPointId()));
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
doc->SetAttribute(domElement, AttrAngle, QString().setNum(dialogTool->getAngle()));
doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPointId()));
doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPointId()));
}

View File

@ -51,7 +51,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
VToolNormal(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const QString &formula, const qreal &angle, const qint64 &firstPointId,
const qint64 &secondPointId, const Tool::Sources &typeCreation,
QGraphicsItem * parent = 0);
@ -66,7 +66,7 @@ public:
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
@ -87,7 +87,7 @@ public:
static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const QString &typeLine, const QString &pointName,
const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
VPattern *doc, VContainer *data, const Document::Documents &parse,
const Tool::Sources &typeCreation);
/**
* @brief FindPoint return normal point.

View File

@ -30,7 +30,7 @@
const QString VToolPoint::TagName = QStringLiteral("point");
VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem *parent):VDrawTool(doc, data, id),
VToolPoint::VToolPoint(VPattern *doc, VContainer *data, qint64 id, QGraphicsItem *parent):VDrawTool(doc, data, id),
QGraphicsEllipseItem(parent), radius(toPixel(2)), namePoint(0), lineName(0)
{
namePoint = new VGraphicsSimpleTextItem(this);
@ -65,8 +65,8 @@ void VToolPoint::UpdateNamePosition(qreal mx, qreal my)
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrMx, toMM(mx));
SetAttribute(domElement, AttrMy, toMM(my));
doc->SetAttribute(domElement, AttrMx, toMM(mx));
doc->SetAttribute(domElement, AttrMy, toMM(my));
emit toolhaveChange();
}
}

View File

@ -46,7 +46,7 @@ public:
* @param id object id in container.
* @param parent parent object.
*/
VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0);
VToolPoint(VPattern *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0);
virtual ~VToolPoint(){}
static const QString TagName;
public slots:

View File

@ -32,7 +32,7 @@
const QString VToolPointOfContact::ToolType = QStringLiteral("pointOfContact");
VToolPointOfContact::VToolPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id,
VToolPointOfContact::VToolPointOfContact(VPattern *doc, VContainer *data, const qint64 &id,
const QString &radius, const qint64 &center,
const qint64 &firstPointId, const qint64 &secondPointId,
const Tool::Sources &typeCreation, QGraphicsItem *parent)
@ -88,7 +88,7 @@ QPointF VToolPointOfContact::FindPoint(const qreal &radius, const QPointF &cente
return pArc;
}
void VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data)
void VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
DialogPointOfContact *dialogTool = qobject_cast<DialogPointOfContact*>(dialog);
@ -105,7 +105,7 @@ void VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene,
void VToolPointOfContact::Create(const qint64 _id, const QString &radius, const qint64 &center,
const qint64 &firstPointId, const qint64 &secondPointId,
const QString &pointName, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation)
{
const VPointF *centerP = data->GeometricObject<const VPointF *>(center);
@ -188,16 +188,16 @@ void VToolPointOfContact::AddToFile()
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrRadius, arcRadius);
SetAttribute(domElement, AttrCenter, center);
SetAttribute(domElement, AttrFirstPoint, firstPointId);
SetAttribute(domElement, AttrSecondPoint, secondPointId);
doc->SetAttribute(domElement, AttrRadius, arcRadius);
doc->SetAttribute(domElement, AttrCenter, center);
doc->SetAttribute(domElement, AttrFirstPoint, firstPointId);
doc->SetAttribute(domElement, AttrSecondPoint, secondPointId);
AddToCalculation(domElement);
}
@ -208,13 +208,13 @@ void VToolPointOfContact::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrRadius, arcRadius);
SetAttribute(domElement, AttrCenter, center);
SetAttribute(domElement, AttrFirstPoint, firstPointId);
SetAttribute(domElement, AttrSecondPoint, secondPointId);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrRadius, arcRadius);
doc->SetAttribute(domElement, AttrCenter, center);
doc->SetAttribute(domElement, AttrFirstPoint, firstPointId);
doc->SetAttribute(domElement, AttrSecondPoint, secondPointId);
}
}
@ -230,9 +230,9 @@ void VToolPointOfContact::SaveDialog(QDomElement &domElement)
Q_CHECK_PTR(dialog);
DialogPointOfContact *dialogTool = qobject_cast<DialogPointOfContact*>(dialog);
Q_CHECK_PTR(dialogTool);
SetAttribute(domElement, AttrName, dialogTool->getPointName());
SetAttribute(domElement, AttrRadius, dialogTool->getRadius());
SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->getCenter()));
SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPoint()));
SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPoint()));
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrRadius, dialogTool->getRadius());
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->getCenter()));
doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPoint()));
doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPoint()));
}

View File

@ -49,7 +49,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id,
VToolPointOfContact(VPattern *doc, VContainer *data, const qint64 &id,
const QString &arcRadius, const qint64 &center,
const qint64 &firstPointId, const qint64 &secondPointId,
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
@ -74,7 +74,7 @@ public:
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
@ -93,7 +93,7 @@ public:
*/
static void Create(const qint64 _id, const QString &arcRadius, const qint64 &center,
const qint64 &firstPointId, const qint64 &secondPointId, const QString &pointName,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation);
static const QString ToolType;
public slots:

View File

@ -31,7 +31,7 @@
const QString VToolPointOfIntersection::ToolType = QStringLiteral("pointOfIntersection");
VToolPointOfIntersection::VToolPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id,
VToolPointOfIntersection::VToolPointOfIntersection(VPattern *doc, VContainer *data, const qint64 &id,
const qint64 &firstPointId, const qint64 &secondPointId,
const Tool::Sources &typeCreation, QGraphicsItem *parent)
:VToolPoint(doc, data, id, parent), firstPointId(firstPointId), secondPointId(secondPointId)
@ -58,7 +58,7 @@ void VToolPointOfIntersection::setDialog()
dialogTool->setPointName(p->name());
}
void VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc,
void VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data)
{
Q_CHECK_PTR(dialog);
@ -72,7 +72,7 @@ void VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *sc
void VToolPointOfIntersection::Create(const qint64 _id, const QString &pointName, const qint64 &firstPointId,
const qint64 &secondPointId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation)
{
const VPointF *firstPoint = data->GeometricObject<const VPointF *>(firstPointId);
@ -138,14 +138,14 @@ void VToolPointOfIntersection::AddToFile()
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrFirstPoint, firstPointId);
SetAttribute(domElement, AttrSecondPoint, secondPointId);
doc->SetAttribute(domElement, AttrFirstPoint, firstPointId);
doc->SetAttribute(domElement, AttrSecondPoint, secondPointId);
AddToCalculation(domElement);
}
@ -156,11 +156,11 @@ void VToolPointOfIntersection::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrFirstPoint, firstPointId);
SetAttribute(domElement, AttrSecondPoint, secondPointId);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrFirstPoint, firstPointId);
doc->SetAttribute(domElement, AttrSecondPoint, secondPointId);
}
}
@ -169,7 +169,7 @@ void VToolPointOfIntersection::SaveDialog(QDomElement &domElement)
Q_CHECK_PTR(dialog);
DialogPointOfIntersection *dialogTool = qobject_cast<DialogPointOfIntersection*>(dialog);
Q_CHECK_PTR(dialogTool);
SetAttribute(domElement, AttrName, dialogTool->getPointName());
SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPointId()));
SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPointId()));
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPointId()));
doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPointId()));
}

View File

@ -48,7 +48,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id,
VToolPointOfIntersection(VPattern *doc, VContainer *data, const qint64 &id,
const qint64 &firstPointId, const qint64 &secondPointId,
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
/**
@ -62,7 +62,7 @@ public:
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
@ -79,7 +79,7 @@ public:
*/
static void Create(const qint64 _id, const QString &pointName, const qint64 &firstPointId,
const qint64 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
VPattern *doc, VContainer *data, const Document::Documents &parse,
const Tool::Sources &typeCreation);
static const QString ToolType;
public slots:

View File

@ -32,7 +32,7 @@
const QString VToolShoulderPoint::ToolType = QStringLiteral("shoulder");
VToolShoulderPoint::VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id,
VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint64 &p1Line,
const qint64 &p2Line, const qint64 &pShoulder, const Tool::Sources &typeCreation,
QGraphicsItem * parent)
@ -89,7 +89,7 @@ QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Li
}
}
void VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data)
void VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
DialogShoulderPoint *dialogTool = qobject_cast<DialogShoulderPoint*>(dialog);
@ -107,7 +107,7 @@ void VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphicsScene *scene, V
void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const qint64 &p1Line,
const qint64 &p2Line, const qint64 &pShoulder, const QString &typeLine,
const QString &pointName, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation)
{
const VPointF *firstPoint = data->GeometricObject<const VPointF *>(p1Line);
@ -190,17 +190,17 @@ void VToolShoulderPoint::AddToFile()
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrTypeLine, typeLine);
SetAttribute(domElement, AttrLength, formula);
SetAttribute(domElement, AttrP1Line, basePointId);
SetAttribute(domElement, AttrP2Line, p2Line);
SetAttribute(domElement, AttrPShoulder, pShoulder);
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrP1Line, basePointId);
doc->SetAttribute(domElement, AttrP2Line, p2Line);
doc->SetAttribute(domElement, AttrPShoulder, pShoulder);
AddToCalculation(domElement);
}
@ -211,14 +211,14 @@ void VToolShoulderPoint::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrName, toMM(point->mx()));
SetAttribute(domElement, AttrName, toMM(point->my()));
SetAttribute(domElement, AttrTypeLine, typeLine);
SetAttribute(domElement, AttrLength, formula);
SetAttribute(domElement, AttrP1Line, basePointId);
SetAttribute(domElement, AttrP2Line, p2Line);
SetAttribute(domElement, AttrPShoulder, pShoulder);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrName, toMM(point->mx()));
doc->SetAttribute(domElement, AttrName, toMM(point->my()));
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrP1Line, basePointId);
doc->SetAttribute(domElement, AttrP2Line, p2Line);
doc->SetAttribute(domElement, AttrPShoulder, pShoulder);
}
}
@ -234,10 +234,10 @@ void VToolShoulderPoint::SaveDialog(QDomElement &domElement)
Q_CHECK_PTR(dialog);
DialogShoulderPoint *dialogTool = qobject_cast<DialogShoulderPoint*>(dialog);
Q_CHECK_PTR(dialogTool);
SetAttribute(domElement, AttrName, dialogTool->getPointName());
SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
SetAttribute(domElement, AttrLength, dialogTool->getFormula());
SetAttribute(domElement, AttrP1Line, QString().setNum(dialogTool->getP1Line()));
SetAttribute(domElement, AttrP2Line, QString().setNum(dialogTool->getP2Line()));
SetAttribute(domElement, AttrPShoulder, QString().setNum(dialogTool->getPShoulder()));
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
doc->SetAttribute(domElement, AttrP1Line, QString().setNum(dialogTool->getP1Line()));
doc->SetAttribute(domElement, AttrP2Line, QString().setNum(dialogTool->getP2Line()));
doc->SetAttribute(domElement, AttrPShoulder, QString().setNum(dialogTool->getPShoulder()));
}

View File

@ -51,7 +51,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
VToolShoulderPoint(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const QString &formula, const qint64 &p1Line, const qint64 &p2Line,
const qint64 &pShoulder, const Tool::Sources &typeCreation,
QGraphicsItem * parent = 0);
@ -76,7 +76,7 @@ public:
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
@ -96,7 +96,7 @@ public:
*/
static void Create(const qint64 _id, const QString &formula, const qint64 &p1Line, const qint64 &p2Line,
const qint64 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx,
const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation);
static const QString ToolType;
public slots:

View File

@ -31,7 +31,7 @@
const QString VToolSinglePoint::ToolType = QStringLiteral("single");
VToolSinglePoint::VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation,
VToolSinglePoint::VToolSinglePoint (VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation,
QGraphicsItem * parent )
:VToolPoint(doc, data, id, parent)
{
@ -66,13 +66,13 @@ void VToolSinglePoint::AddToFile()
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrX, toMM(point->x()));
SetAttribute(domElement, AttrY, toMM(point->y()));
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrX, toMM(point->x()));
doc->SetAttribute(domElement, AttrY, toMM(point->y()));
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
AddToCalculation(domElement);
}
@ -83,11 +83,11 @@ void VToolSinglePoint::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrX, QString().setNum(toMM(point->x())));
SetAttribute(domElement, AttrY, QString().setNum(toMM(point->y())));
SetAttribute(domElement, AttrMx, QString().setNum(toMM(point->mx())));
SetAttribute(domElement, AttrMy, QString().setNum(toMM(point->my())));
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrX, QString().setNum(toMM(point->x())));
doc->SetAttribute(domElement, AttrY, QString().setNum(toMM(point->y())));
doc->SetAttribute(domElement, AttrMx, QString().setNum(toMM(point->mx())));
doc->SetAttribute(domElement, AttrMy, QString().setNum(toMM(point->my())));
}
}
@ -113,8 +113,8 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change,
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrX, QString().setNum(toMM(newPos.x())));
SetAttribute(domElement, AttrY, QString().setNum(toMM(newPos.y())));
doc->SetAttribute(domElement, AttrX, QString().setNum(toMM(newPos.x())));
doc->SetAttribute(domElement, AttrY, QString().setNum(toMM(newPos.y())));
QList<QGraphicsView*> list = this->scene()->views();
VAbstractTool::NewSceneRect(this->scene(), list[0]);
@ -142,9 +142,9 @@ void VToolSinglePoint::SaveDialog(QDomElement &domElement)
Q_CHECK_PTR(dialogTool);
QPointF p = dialogTool->getPoint();
QString name = dialogTool->getName();
SetAttribute(domElement, AttrName, name);
SetAttribute(domElement, AttrX, QString().setNum(toMM(p.x())));
SetAttribute(domElement, AttrY, QString().setNum(toMM(p.y())));
doc->SetAttribute(domElement, AttrName, name);
doc->SetAttribute(domElement, AttrX, QString().setNum(toMM(p.x())));
doc->SetAttribute(domElement, AttrY, QString().setNum(toMM(p.y())));
}
void VToolSinglePoint::setColorLabel(const Qt::GlobalColor &color)

View File

@ -47,7 +47,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation,
VToolSinglePoint (VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation,
QGraphicsItem * parent = 0 );
/**
* @brief setDialog set dialog when user want change tool option.

View File

@ -33,7 +33,7 @@
const QString VToolSpline::TagName = QStringLiteral("spline");
const QString VToolSpline::ToolType = QStringLiteral("simple");
VToolSpline::VToolSpline(VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation,
VToolSpline::VToolSpline(VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation,
QGraphicsItem *parent)
:VDrawTool(doc, data, id), QGraphicsPathItem(parent), controlPoints(QVector<VControlPointSpline *>())
{
@ -90,7 +90,7 @@ void VToolSpline::setDialog()
dialogTool->setKCurve(spl->GetKcurve());
}
void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc,
void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data)
{
Q_CHECK_PTR(dialog);
@ -109,7 +109,7 @@ void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocu
void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1,
const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation)
{
VPointF point1 = *data->GeometricObject<const VPointF *>(p1);
@ -166,11 +166,11 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const Sp
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrAngle1, QString().setNum(spl.GetAngle1()));
SetAttribute(domElement, AttrAngle2, QString().setNum(spl.GetAngle2()));
SetAttribute(domElement, AttrKAsm1, QString().setNum(spl.GetKasm1()));
SetAttribute(domElement, AttrKAsm2, QString().setNum(spl.GetKasm2()));
SetAttribute(domElement, AttrKCurve, QString().setNum(spl.GetKcurve()));
doc->SetAttribute(domElement, AttrAngle1, QString().setNum(spl.GetAngle1()));
doc->SetAttribute(domElement, AttrAngle2, QString().setNum(spl.GetAngle2()));
doc->SetAttribute(domElement, AttrKAsm1, QString().setNum(spl.GetKasm1()));
doc->SetAttribute(domElement, AttrKAsm2, QString().setNum(spl.GetKasm2()));
doc->SetAttribute(domElement, AttrKCurve, QString().setNum(spl.GetKcurve()));
emit FullUpdateTree();
emit toolhaveChange();
}
@ -186,15 +186,15 @@ void VToolSpline::AddToFile()
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrPoint1, spl->GetP1().id());
SetAttribute(domElement, AttrPoint4, spl->GetP4().id());
SetAttribute(domElement, AttrAngle1, spl->GetAngle1());
SetAttribute(domElement, AttrAngle2, spl->GetAngle2());
SetAttribute(domElement, AttrKAsm1, spl->GetKasm1());
SetAttribute(domElement, AttrKAsm2, spl->GetKasm2());
SetAttribute(domElement, AttrKCurve, spl->GetKcurve());
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrPoint1, spl->GetP1().id());
doc->SetAttribute(domElement, AttrPoint4, spl->GetP4().id());
doc->SetAttribute(domElement, AttrAngle1, spl->GetAngle1());
doc->SetAttribute(domElement, AttrAngle2, spl->GetAngle2());
doc->SetAttribute(domElement, AttrKAsm1, spl->GetKasm1());
doc->SetAttribute(domElement, AttrKAsm2, spl->GetKasm2());
doc->SetAttribute(domElement, AttrKCurve, spl->GetKcurve());
AddToCalculation(domElement);
}
@ -205,13 +205,13 @@ void VToolSpline::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrPoint1, spl->GetP1().id());
SetAttribute(domElement, AttrPoint4, spl->GetP4().id());
SetAttribute(domElement, AttrAngle1, spl->GetAngle1());
SetAttribute(domElement, AttrAngle2, spl->GetAngle2());
SetAttribute(domElement, AttrKAsm1, spl->GetKasm1());
SetAttribute(domElement, AttrKAsm2, spl->GetKasm2());
SetAttribute(domElement, AttrKCurve, spl->GetKcurve());
doc->SetAttribute(domElement, AttrPoint1, spl->GetP1().id());
doc->SetAttribute(domElement, AttrPoint4, spl->GetP4().id());
doc->SetAttribute(domElement, AttrAngle1, spl->GetAngle1());
doc->SetAttribute(domElement, AttrAngle2, spl->GetAngle2());
doc->SetAttribute(domElement, AttrKAsm1, spl->GetKasm1());
doc->SetAttribute(domElement, AttrKAsm2, spl->GetKasm2());
doc->SetAttribute(domElement, AttrKCurve, spl->GetKcurve());
}
}
@ -298,13 +298,13 @@ void VToolSpline::SaveDialog(QDomElement &domElement)
spl = VSpline (point1, controlPoints[0]->pos(), controlPoints[1]->pos(), point4, dialogTool->getKCurve());
SetAttribute(domElement, AttrPoint1, spl.GetP1().id());
SetAttribute(domElement, AttrPoint4, spl.GetP4().id());
SetAttribute(domElement, AttrAngle1, spl.GetAngle1());
SetAttribute(domElement, AttrAngle2, spl.GetAngle2());
SetAttribute(domElement, AttrKAsm1, spl.GetKasm1());
SetAttribute(domElement, AttrKAsm2, spl.GetKasm2());
SetAttribute(domElement, AttrKCurve, spl.GetKcurve());
doc->SetAttribute(domElement, AttrPoint1, spl.GetP1().id());
doc->SetAttribute(domElement, AttrPoint4, spl.GetP4().id());
doc->SetAttribute(domElement, AttrAngle1, spl.GetAngle1());
doc->SetAttribute(domElement, AttrAngle2, spl.GetAngle2());
doc->SetAttribute(domElement, AttrKAsm1, spl.GetKasm1());
doc->SetAttribute(domElement, AttrKAsm2, spl.GetKasm2());
doc->SetAttribute(domElement, AttrKCurve, spl.GetKcurve());
}
void VToolSpline::RefreshGeometry()

View File

@ -49,7 +49,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolSpline (VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation,
VToolSpline (VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation,
QGraphicsItem * parent = 0 );
/**
* @brief setDialog set dialog when user want change tool option.
@ -62,7 +62,7 @@ public:
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
@ -81,7 +81,7 @@ public:
*/
static void Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1,
const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation);
static const QString TagName;
static const QString ToolType;

View File

@ -32,7 +32,7 @@
const QString VToolSplinePath::TagName = QStringLiteral("spline");
const QString VToolSplinePath::ToolType = QStringLiteral("path");
VToolSplinePath::VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation,
VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation,
QGraphicsItem *parent)
:VDrawTool(doc, data, id), QGraphicsPathItem(parent), controlPoints(QVector<VControlPointSpline *>())
{
@ -84,7 +84,7 @@ void VToolSplinePath::setDialog()
dialogTool->SetPath(*splPath);
}
void VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data)
void VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
DialogSplinePath *dialogTool = qobject_cast<DialogSplinePath*>(dialog);
@ -99,7 +99,7 @@ void VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDom
}
void VToolSplinePath::Create(const qint64 _id, VSplinePath *path, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
VPattern *doc, VContainer *data, const Document::Documents &parse,
const Tool::Sources &typeCreation)
{
qint64 id = _id;
@ -151,7 +151,7 @@ void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, cons
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve()));
doc->SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve()));
UpdatePathPoint(domElement, splPath);
emit FullUpdateTree();
emit toolhaveChange();
@ -181,10 +181,10 @@ void VToolSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path)
if (domElement.isNull() == false)
{
VSplinePoint p = path[i];
SetAttribute(domElement, AttrPSpline, p.P().id());
SetAttribute(domElement, AttrKAsm1, p.KAsm1());
SetAttribute(domElement, AttrKAsm2, p.KAsm2());
SetAttribute(domElement, AttrAngle, p.Angle2());
doc->SetAttribute(domElement, AttrPSpline, p.P().id());
doc->SetAttribute(domElement, AttrKAsm1, p.KAsm1());
doc->SetAttribute(domElement, AttrKAsm2, p.KAsm2());
doc->SetAttribute(domElement, AttrAngle, p.Angle2());
}
}
}
@ -230,9 +230,9 @@ void VToolSplinePath::AddToFile()
VSplinePath splPath = *VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrKCurve, splPath.getKCurve());
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrKCurve, splPath.getKCurve());
for (qint32 i = 0; i < splPath.CountPoint(); ++i)
{
@ -268,7 +268,7 @@ void VToolSplinePath::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve()));
doc->SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve()));
UpdatePathPoint(domElement, splPath);
}
@ -279,10 +279,10 @@ void VToolSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &
{
QDomElement pathPoint = doc->createElement(AttrPathPoint);
SetAttribute(pathPoint, AttrPSpline, splPoint.P().id());
SetAttribute(pathPoint, AttrKAsm1, splPoint.KAsm1());
SetAttribute(pathPoint, AttrKAsm2, splPoint.KAsm2());
SetAttribute(pathPoint, AttrAngle, splPoint.Angle2());
doc->SetAttribute(pathPoint, AttrPSpline, splPoint.P().id());
doc->SetAttribute(pathPoint, AttrKAsm1, splPoint.KAsm1());
doc->SetAttribute(pathPoint, AttrKAsm2, splPoint.KAsm2());
doc->SetAttribute(pathPoint, AttrAngle, splPoint.Angle2());
domElement.appendChild(pathPoint);
}
@ -376,7 +376,7 @@ void VToolSplinePath::SaveDialog(QDomElement &domElement)
CorectControlPoints(spl, splPath, i);
}
SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve()));
doc->SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve()));
UpdatePathPoint(domElement, splPath);
}

View File

@ -48,7 +48,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation,
VToolSplinePath(VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation,
QGraphicsItem * parent = 0);
/**
* @brief setDialog set dialog when user want change tool option.
@ -61,7 +61,7 @@ public:
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
@ -73,7 +73,7 @@ public:
* @param typeCreation way we create this tool.
*/
static void Create(const qint64 _id, VSplinePath *path, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
VPattern *doc, VContainer *data, const Document::Documents &parse,
const Tool::Sources &typeCreation);
static const QString TagName;
static const QString ToolType;

View File

@ -31,7 +31,7 @@
const QString VToolTriangle::ToolType = QStringLiteral("triangle");
VToolTriangle::VToolTriangle(VDomDocument *doc, VContainer *data, const qint64 &id,
VToolTriangle::VToolTriangle(VPattern *doc, VContainer *data, const qint64 &id,
const qint64 &axisP1Id, const qint64 &axisP2Id, const qint64 &firstPointId,
const qint64 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent)
:VToolPoint(doc, data, id, parent), axisP1Id(axisP1Id), axisP2Id(axisP2Id), firstPointId(firstPointId),
@ -62,7 +62,7 @@ void VToolTriangle::setDialog()
}
void VToolTriangle::Create(DialogTool *dialog, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data)
VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
DialogTriangle *dialogTool = qobject_cast<DialogTriangle*>(dialog);
@ -78,7 +78,7 @@ void VToolTriangle::Create(DialogTool *dialog, VMainGraphicsScene *scene,
void VToolTriangle::Create(const qint64 _id, const QString &pointName, const qint64 &axisP1Id,
const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation)
{
const VPointF *axisP1 = data->GeometricObject<const VPointF *>(axisP1Id);
@ -194,16 +194,16 @@ void VToolTriangle::AddToFile()
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrAxisP1, axisP1Id);
SetAttribute(domElement, AttrAxisP2, axisP2Id);
SetAttribute(domElement, AttrFirstPoint, firstPointId);
SetAttribute(domElement, AttrSecondPoint, secondPointId);
doc->SetAttribute(domElement, AttrAxisP1, axisP1Id);
doc->SetAttribute(domElement, AttrAxisP2, axisP2Id);
doc->SetAttribute(domElement, AttrFirstPoint, firstPointId);
doc->SetAttribute(domElement, AttrSecondPoint, secondPointId);
AddToCalculation(domElement);
}
@ -214,13 +214,13 @@ void VToolTriangle::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrName, point->name());
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
SetAttribute(domElement, AttrAxisP1, axisP1Id);
SetAttribute(domElement, AttrAxisP2, axisP2Id);
SetAttribute(domElement, AttrFirstPoint, firstPointId);
SetAttribute(domElement, AttrSecondPoint, secondPointId);
doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrAxisP1, axisP1Id);
doc->SetAttribute(domElement, AttrAxisP2, axisP2Id);
doc->SetAttribute(domElement, AttrFirstPoint, firstPointId);
doc->SetAttribute(domElement, AttrSecondPoint, secondPointId);
}
}
@ -229,9 +229,9 @@ void VToolTriangle::SaveDialog(QDomElement &domElement)
Q_CHECK_PTR(dialog);
DialogTriangle *dialogTool = qobject_cast<DialogTriangle*>(dialog);
Q_CHECK_PTR(dialogTool);
SetAttribute(domElement, AttrName, dialogTool->getPointName());
SetAttribute(domElement, AttrAxisP1, QString().setNum(dialogTool->getAxisP1Id()));
SetAttribute(domElement, AttrAxisP2, QString().setNum(dialogTool->getAxisP2Id()));
SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPointId()));
SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPointId()));
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrAxisP1, QString().setNum(dialogTool->getAxisP1Id()));
doc->SetAttribute(domElement, AttrAxisP2, QString().setNum(dialogTool->getAxisP2Id()));
doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPointId()));
doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPointId()));
}

View File

@ -50,7 +50,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id,
VToolTriangle(VPattern *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id,
const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId,
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
/**
@ -64,7 +64,7 @@ public:
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
@ -83,7 +83,7 @@ public:
*/
static void Create(const qint64 _id, const QString &pointName, const qint64 &axisP1Id, const qint64 &axisP2Id,
const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation);
/**
* @brief FindPoint find point intersection two foots right triangle.

View File

@ -32,7 +32,7 @@
const QString VAbstractNode::AttrIdObject = QStringLiteral("idObject");
const QString VAbstractNode::AttrIdTool = QStringLiteral("idTool");
VAbstractNode::VAbstractNode(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &idNode,
VAbstractNode::VAbstractNode(VPattern *doc, VContainer *data, const qint64 &id, const qint64 &idNode,
const qint64 &idTool, QObject *parent)
: VAbstractTool(doc, data, id, parent), idNode(idNode), idTool(idTool)
{
@ -76,7 +76,7 @@ void VAbstractNode::DeleteNode()
void VAbstractNode::AddToModeling(const QDomElement &domElement)
{
QDomElement modelingElement;
bool ok = doc->GetActivModelingElement(modelingElement);
bool ok = doc->GetActivNodeElement(VPattern::TagModeling, modelingElement);
if (ok)
{
modelingElement.appendChild(domElement);

View File

@ -46,7 +46,7 @@ public:
* @param id object id in containerNode.
* @param parent parent object.
*/
VAbstractNode(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &idNode,
VAbstractNode(VPattern *doc, VContainer *data, const qint64 &id, const qint64 &idNode,
const qint64 &idTool, QObject *parent = 0);
virtual ~VAbstractNode() {}
static const QString AttrIdObject;

View File

@ -33,7 +33,7 @@
const QString VNodeArc::TagName = QStringLiteral("arc");
const QString VNodeArc::ToolType = QStringLiteral("modeling");
VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Tool::Sources &typeCreation,
VNodeArc::VNodeArc(VPattern *doc, VContainer *data, qint64 id, qint64 idArc, const Tool::Sources &typeCreation,
const qint64 &idTool, QObject *qoParent, QGraphicsItem *parent)
:VAbstractNode(doc, data, id, idArc, idTool, qoParent), QGraphicsPathItem(parent)
{
@ -50,7 +50,7 @@ VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc,
}
}
void VNodeArc::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Document::Documents &parse,
void VNodeArc::Create(VPattern *doc, VContainer *data, qint64 id, qint64 idArc, const Document::Documents &parse,
const Tool::Sources &typeCreation, const qint64 &idTool, QObject *parent)
{
VAbstractTool::AddRecord(id, Tool::NodeArc, doc);
@ -93,12 +93,12 @@ void VNodeArc::AddToFile()
{
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrIdObject, idNode);
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrIdObject, idNode);
if (idTool != 0)
{
SetAttribute(domElement, AttrIdTool, idTool);
doc->SetAttribute(domElement, AttrIdTool, idTool);
}
AddToModeling(domElement);
@ -109,10 +109,10 @@ void VNodeArc::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrIdObject, idNode);
doc->SetAttribute(domElement, AttrIdObject, idNode);
if (idTool != 0)
{
SetAttribute(domElement, AttrIdTool, idTool);
doc->SetAttribute(domElement, AttrIdTool, idTool);
}
}
}

View File

@ -48,7 +48,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc,
VNodeArc(VPattern *doc, VContainer *data, qint64 id, qint64 idArc,
const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *qoParent = 0,
QGraphicsItem * parent = 0);
/**
@ -60,7 +60,7 @@ public:
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Document::Documents &parse,
static void Create(VPattern *doc, VContainer *data, qint64 id, qint64 idArc, const Document::Documents &parse,
const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *parent = 0);
static const QString TagName;
static const QString ToolType;

View File

@ -33,7 +33,7 @@
const QString VNodePoint::TagName = QStringLiteral("point");
const QString VNodePoint::ToolType = QStringLiteral("modeling");
VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint,
VNodePoint::VNodePoint(VPattern *doc, VContainer *data, qint64 id, qint64 idPoint,
const Tool::Sources &typeCreation, const qint64 &idTool, QObject *qoParent,
QGraphicsItem *parent)
:VAbstractNode(doc, data, id, idPoint, idTool, qoParent), QGraphicsEllipseItem(parent), radius(toPixel(1.5)),
@ -58,7 +58,7 @@ VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 id
}
}
void VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint,
void VNodePoint::Create(VPattern *doc, VContainer *data, qint64 id, qint64 idPoint,
const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool,
QObject *parent)
{
@ -105,14 +105,14 @@ void VNodePoint::AddToFile()
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrIdObject, idNode);
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrIdObject, idNode);
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
if (idTool != 0)
{
SetAttribute(domElement, AttrIdTool, idTool);
doc->SetAttribute(domElement, AttrIdTool, idTool);
}
AddToModeling(domElement);
@ -124,12 +124,12 @@ void VNodePoint::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrIdObject, idNode);
SetAttribute(domElement, AttrMx, toMM(point->mx()));
SetAttribute(domElement, AttrMy, toMM(point->my()));
doc->SetAttribute(domElement, AttrIdObject, idNode);
doc->SetAttribute(domElement, AttrMx, toMM(point->mx()));
doc->SetAttribute(domElement, AttrMy, toMM(point->my()));
if (idTool != 0)
{
SetAttribute(domElement, AttrIdTool, idTool);
doc->SetAttribute(domElement, AttrIdTool, idTool);
}
}
}
@ -172,8 +172,8 @@ void VNodePoint::UpdateNamePosition(qreal mx, qreal my)
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrMx, QString().setNum(toMM(mx)));
SetAttribute(domElement, AttrMy, QString().setNum(toMM(my)));
doc->SetAttribute(domElement, AttrMx, QString().setNum(toMM(mx)));
doc->SetAttribute(domElement, AttrMy, QString().setNum(toMM(my)));
emit toolhaveChange();
}
}

View File

@ -48,7 +48,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint,
VNodePoint(VPattern *doc, VContainer *data, qint64 id, qint64 idPoint,
const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *qoParent = 0,
QGraphicsItem * parent = 0 );
/**
@ -60,7 +60,7 @@ public:
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint,
static void Create(VPattern *doc, VContainer *data, qint64 id, qint64 idPoint,
const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool = 0,
QObject *parent = 0);
static const QString TagName;

View File

@ -33,7 +33,7 @@
const QString VNodeSpline::TagName = QStringLiteral("spline");
const QString VNodeSpline::ToolType = QStringLiteral("modelingSpline");
VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
VNodeSpline::VNodeSpline(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline,
const Tool::Sources &typeCreation, const qint64 &idTool, QObject *qoParent,
QGraphicsItem * parent)
:VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent)
@ -51,7 +51,7 @@ VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64
}
}
VNodeSpline *VNodeSpline::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
VNodeSpline *VNodeSpline::Create(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline,
const Document::Documents &parse, const Tool::Sources &typeCreation,
const qint64 &idTool, QObject *parent)
{
@ -96,12 +96,12 @@ void VNodeSpline::AddToFile()
{
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrIdObject, idNode);
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrIdObject, idNode);
if (idTool != 0)
{
SetAttribute(domElement, AttrIdTool, idTool);
doc->SetAttribute(domElement, AttrIdTool, idTool);
}
AddToModeling(domElement);
@ -112,10 +112,10 @@ void VNodeSpline::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrIdObject, QString().setNum(idNode));
doc->SetAttribute(domElement, AttrIdObject, QString().setNum(idNode));
if (idTool != 0)
{
SetAttribute(domElement, AttrIdTool, idTool);
doc->SetAttribute(domElement, AttrIdTool, idTool);
}
}
}

View File

@ -48,7 +48,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
VNodeSpline(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline,
const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *qoParent = 0,
QGraphicsItem * parent = 0);
/**
@ -61,7 +61,7 @@ public:
* @param typeCreation way we create this tool.
* @return
*/
static VNodeSpline *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
static VNodeSpline *Create(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline,
const Document::Documents &parse, const Tool::Sources &typeCreation,
const qint64 &idTool = 0, QObject *parent = 0);
static const QString TagName;

View File

@ -33,7 +33,7 @@
const QString VNodeSplinePath::TagName = QStringLiteral("spline");
const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath");
VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
VNodeSplinePath::VNodeSplinePath(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline,
const Tool::Sources &typeCreation, const qint64 &idTool, QObject *qoParent,
QGraphicsItem * parent)
:VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent)
@ -51,7 +51,7 @@ VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id,
}
}
void VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
void VNodeSplinePath::Create(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline,
const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool,
QObject *parent)
{
@ -100,12 +100,12 @@ void VNodeSplinePath::AddToFile()
{
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrIdObject, idNode);
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrIdObject, idNode);
if (idTool != 0)
{
SetAttribute(domElement, AttrIdTool, idTool);
doc->SetAttribute(domElement, AttrIdTool, idTool);
}
AddToModeling(domElement);
@ -116,10 +116,10 @@ void VNodeSplinePath::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrIdObject, QString().setNum(idNode));
doc->SetAttribute(domElement, AttrIdObject, QString().setNum(idNode));
if (idTool != 0)
{
SetAttribute(domElement, AttrIdTool, idTool);
doc->SetAttribute(domElement, AttrIdTool, idTool);
}
}
}

View File

@ -48,7 +48,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
VNodeSplinePath(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline,
const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *qoParent = 0,
QGraphicsItem * parent = 0);
/**
@ -60,7 +60,7 @@ public:
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
static void Create(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline,
const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool = 0,
QObject *parent = 0);
static const QString TagName;

View File

@ -69,13 +69,13 @@ const QString VAbstractTool::TypeLineDotLine = QStringLiteral("dotLine");
const QString VAbstractTool::TypeLineDashDotLine = QStringLiteral("dashDotLine");
const QString VAbstractTool::TypeLineDashDotDotLine = QStringLiteral("dashDotDotLine");
VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent)
VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, qint64 id, QObject *parent)
:VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black), typeLine(TypeLineLine)
{
Q_CHECK_PTR(doc);
connect(this, &VAbstractTool::toolhaveChange, this->doc, &VDomDocument::haveLiteChange);
connect(this->doc, &VDomDocument::FullUpdateFromFile, this, &VAbstractTool::FullUpdateFromFile);
connect(this, &VAbstractTool::FullUpdateTree, this->doc, &VDomDocument::FullUpdateTree);
connect(this, &VAbstractTool::toolhaveChange, this->doc, &VPattern::haveLiteChange);
connect(this->doc, &VPattern::FullUpdateFromFile, this, &VAbstractTool::FullUpdateFromFile);
connect(this, &VAbstractTool::FullUpdateTree, this->doc, &VPattern::FullUpdateTree);
emit toolhaveChange();
}
@ -303,7 +303,7 @@ const QStringList VAbstractTool::Styles()
return styles;
}
void VAbstractTool::AddRecord(const qint64 id, const Tool::Tools &toolType, VDomDocument *doc)
void VAbstractTool::AddRecord(const qint64 id, const Tool::Tools &toolType, VPattern *doc)
{
qint64 cursor = doc->getCursor();
QVector<VToolRecord> *history = doc->getHistory();

View File

@ -30,7 +30,7 @@
#define VABSTRACTTOOL_H
#include "vdatatool.h"
#include "../xml/vdomdocument.h"
#include "../xml/vpattern.h"
#include <QMessageBox>
/**
@ -47,7 +47,7 @@ public:
* @param id object id in container.
* @param parent parent object.
*/
VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0);
VAbstractTool(VPattern *doc, VContainer *data, qint64 id, QObject *parent = 0);
virtual ~VAbstractTool(){}
/**
* @brief NewSceneRect calculate scene rect what contains all items and doesn't less that size of scene view.
@ -153,7 +153,7 @@ public:
* @param toolType tool type
* @param doc dom document container
*/
static void AddRecord(const qint64 id, const Tool::Tools &toolType, VDomDocument *doc);
static void AddRecord(const qint64 id, const Tool::Tools &toolType, VPattern *doc);
public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
@ -178,7 +178,7 @@ protected:
/**
* @brief doc dom document container
*/
VDomDocument *doc;
VPattern *doc;
/**
* @brief id object id.
*/
@ -227,26 +227,7 @@ protected:
* @return pen style.
*/
Qt::PenStyle LineStyle();
template <typename T>
/**
* @brief SetAttribute set attribute in pattern file. Replace "," by ".".
* @param domElement element in xml tree.
* @param name name of attribute.
* @param value value of attribute.
*/
void SetAttribute(QDomElement &domElement, const QString &name, const T &value)
{
QString val = QString().setNum(value);
val = val.replace(",", ".");
domElement.setAttribute(name, val);
}
private:
Q_DISABLE_COPY(VAbstractTool)
};
template <>
inline void VAbstractTool::SetAttribute<QString>(QDomElement &domElement, const QString &name, const QString &value)
{
domElement.setAttribute(name, value);
}
#endif // VABSTRACTTOOL_H

View File

@ -40,7 +40,7 @@ const QString VToolDetail::AttrNodeType = QStringLiteral("nodeType");
const QString VToolDetail::NodeTypeContour = QStringLiteral("Contour");
const QString VToolDetail::NodeTypeModeling = QStringLiteral("Modeling");
VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, const Tool::Sources &typeCreation,
VToolDetail::VToolDetail(VPattern *doc, VContainer *data, const qint64 &id, const Tool::Sources &typeCreation,
VMainGraphicsScene *scene, QGraphicsItem *parent)
:VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialog(0), sceneDetails(scene)
{
@ -93,7 +93,7 @@ void VToolDetail::setDialog()
dialogTool->setDetails(detail);
}
void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data)
void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
DialogDetail *dialogTool = qobject_cast<DialogDetail*>(dialog);
@ -140,7 +140,7 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocu
Create(0, det, scene, doc, data, Document::FullParse, Tool::FromGui);
}
void VToolDetail::Create(const qint64 &_id, const VDetail &newDetail, VMainGraphicsScene *scene, VDomDocument *doc,
void VToolDetail::Create(const qint64 &_id, const VDetail &newDetail, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation)
{
qint64 id = _id;
@ -188,10 +188,10 @@ void VToolDetail::FullUpdateFromGui(int result)
DialogDetail *dialogTool = qobject_cast<DialogDetail*>(dialog);
Q_CHECK_PTR(dialogTool);
VDetail det = dialogTool->getDetails();
SetAttribute(domElement, AttrName, det.getName());
SetAttribute(domElement, AttrSupplement, QString().setNum(det.getSeamAllowance()));
SetAttribute(domElement, AttrClosed, QString().setNum(det.getClosed()));
SetAttribute(domElement, AttrWidth, QString().setNum(det.getWidth()));
doc->SetAttribute(domElement, AttrName, det.getName());
doc->SetAttribute(domElement, AttrSupplement, QString().setNum(det.getSeamAllowance()));
doc->SetAttribute(domElement, AttrClosed, QString().setNum(det.getClosed()));
doc->SetAttribute(domElement, AttrWidth, QString().setNum(det.getWidth()));
RemoveAllChild(domElement);
for (ptrdiff_t i = 0; i < det.CountNode(); ++i)
{
@ -221,13 +221,13 @@ void VToolDetail::AddToFile()
VDetail detail = VAbstractTool::data.GetDetail(id);
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrName, detail.getName());
SetAttribute(domElement, AttrMx, toMM(detail.getMx()));
SetAttribute(domElement, AttrMy, toMM(detail.getMy()));
SetAttribute(domElement, AttrSupplement, detail.getSeamAllowance());
SetAttribute(domElement, AttrClosed, detail.getClosed());
SetAttribute(domElement, AttrWidth, detail.getWidth());
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrName, detail.getName());
doc->SetAttribute(domElement, AttrMx, toMM(detail.getMx()));
doc->SetAttribute(domElement, AttrMy, toMM(detail.getMy()));
doc->SetAttribute(domElement, AttrSupplement, detail.getSeamAllowance());
doc->SetAttribute(domElement, AttrClosed, detail.getClosed());
doc->SetAttribute(domElement, AttrWidth, detail.getWidth());
for (ptrdiff_t i = 0; i < detail.CountNode(); ++i)
{
@ -235,7 +235,7 @@ void VToolDetail::AddToFile()
}
QDomElement element;
bool ok = doc->GetActivDetailsElement(element);
bool ok = doc->GetActivNodeElement(VPattern::TagDetails, element);
if (ok)
{
element.appendChild(domElement);
@ -248,10 +248,10 @@ void VToolDetail::RefreshDataInFile()
if (domElement.isElement())
{
VDetail det = VAbstractTool::data.GetDetail(id);
SetAttribute(domElement, AttrName, det.getName());
SetAttribute(domElement, AttrSupplement, QString().setNum(det.getSeamAllowance()));
SetAttribute(domElement, AttrClosed, QString().setNum(det.getClosed()));
SetAttribute(domElement, AttrWidth, QString().setNum(det.getWidth()));
doc->SetAttribute(domElement, AttrName, det.getName());
doc->SetAttribute(domElement, AttrSupplement, QString().setNum(det.getSeamAllowance()));
doc->SetAttribute(domElement, AttrClosed, QString().setNum(det.getClosed()));
doc->SetAttribute(domElement, AttrWidth, QString().setNum(det.getWidth()));
RemoveAllChild(domElement);
for (ptrdiff_t i = 0; i < det.CountNode(); ++i)
{
@ -270,8 +270,8 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrMx, QString().setNum(toMM(newPos.x())));
SetAttribute(domElement, AttrMy, QString().setNum(toMM(newPos.y())));
doc->SetAttribute(domElement, AttrMx, QString().setNum(toMM(newPos.x())));
doc->SetAttribute(domElement, AttrMy, QString().setNum(toMM(newPos.y())));
QList<QGraphicsView*> list = this->scene()->views();
VAbstractTool::NewSceneRect(this->scene(), list[0]);
@ -362,30 +362,30 @@ void VToolDetail::AddNode(QDomElement &domElement, const VNodeDetail &node)
{
QDomElement nod = doc->createElement(TagNode);
SetAttribute(nod, AttrIdObject, node.getId());
SetAttribute(nod, AttrMx, toMM(node.getMx()));
SetAttribute(nod, AttrMy, toMM(node.getMy()));
doc->SetAttribute(nod, AttrIdObject, node.getId());
doc->SetAttribute(nod, AttrMx, toMM(node.getMx()));
doc->SetAttribute(nod, AttrMy, toMM(node.getMy()));
if (node.getTypeNode() == NodeDetail::Contour)
{
SetAttribute(nod, AttrNodeType, NodeTypeContour);
doc->SetAttribute(nod, AttrNodeType, NodeTypeContour);
}
else
{
SetAttribute(nod, AttrNodeType, NodeTypeModeling);
doc->SetAttribute(nod, AttrNodeType, NodeTypeModeling);
}
switch (node.getTypeTool())
{
case (Tool::NodeArc):
SetAttribute(nod, AttrType, QStringLiteral("NodeArc"));
doc->SetAttribute(nod, AttrType, QStringLiteral("NodeArc"));
break;
case (Tool::NodePoint):
SetAttribute(nod, AttrType, QStringLiteral("NodePoint"));
doc->SetAttribute(nod, AttrType, QStringLiteral("NodePoint"));
break;
case (Tool::NodeSpline):
SetAttribute(nod, AttrType, QStringLiteral("NodeSpline"));
doc->SetAttribute(nod, AttrType, QStringLiteral("NodeSpline"));
break;
case (Tool::NodeSplinePath):
SetAttribute(nod, AttrType, QStringLiteral("NodeSplinePath"));
doc->SetAttribute(nod, AttrType, QStringLiteral("NodeSplinePath"));
break;
default:
qWarning()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;

View File

@ -49,7 +49,7 @@ public:
* @param scene pointer to scene.
* @param parent parent object
*/
VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, const Tool::Sources &typeCreation,
VToolDetail(VPattern *doc, VContainer *data, const qint64 &id, const Tool::Sources &typeCreation,
VMainGraphicsScene *scene, QGraphicsItem * parent = 0);
~VToolDetail();
/**
@ -79,7 +79,7 @@ public:
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
@ -91,7 +91,7 @@ public:
* @param typeCreation way we create this tool.
*/
static void Create(const qint64 &_id, const VDetail &newDetail, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
VPattern *doc, VContainer *data, const Document::Documents &parse,
const Tool::Sources &typeCreation);
static const QString TagName;
static const QString TagNode;

View File

@ -41,7 +41,7 @@ const QString VToolUnionDetails::AttrNodeType = QStringLiteral("nodeType");
const QString VToolUnionDetails::NodeTypeContour = QStringLiteral("Contour");
const QString VToolUnionDetails::NodeTypeModeling = QStringLiteral("Modeling");
VToolUnionDetails::VToolUnionDetails(VDomDocument *doc, VContainer *data, const qint64 &id, const VDetail &d1,
VToolUnionDetails::VToolUnionDetails(VPattern *doc, VContainer *data, const qint64 &id, const VDetail &d1,
const VDetail &d2, const ptrdiff_t &indexD1, const ptrdiff_t &indexD2,
const Tool::Sources &typeCreation, QObject *parent)
:VAbstractTool(doc, data, id, parent), d1(d1), d2(d2), indexD1(indexD1), indexD2(indexD2)
@ -56,7 +56,7 @@ VToolUnionDetails::VToolUnionDetails(VDomDocument *doc, VContainer *data, const
}
}
void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContainer *data, VDetail &newDetail,
void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer *data, VDetail &newDetail,
const VDetail &det, const ptrdiff_t &i, const qint64 &idTool, const qreal &dx,
const qreal &dy, const qint64 &pRotate, const qreal &angle)
{
@ -402,7 +402,7 @@ void VToolUnionDetails::BiasRotatePoint(VPointF *point, const qreal &dx, const q
point->setY(line.p2().y());
}
void VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data)
void VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
DialogUnionDetails *dialogTool = qobject_cast<DialogUnionDetails*>(dialog);
@ -417,7 +417,7 @@ void VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsScene *scene, VD
void VToolUnionDetails::Create(const qint64 _id, const VDetail &d1, const VDetail &d2, const qint64 &d1id,
const qint64 &d2id, const ptrdiff_t &indexD1, const ptrdiff_t &indexD2,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation)
{
VToolUnionDetails *unionDetails = 0;
@ -613,7 +613,7 @@ void VToolUnionDetails::Create(const qint64 _id, const VDetail &d1, const VDetai
}
}
QVector<VDetail> VToolUnionDetails::GetDetailFromFile(VDomDocument *doc, const QDomElement &domElement)
QVector<VDetail> VToolUnionDetails::GetDetailFromFile(VPattern *doc, const QDomElement &domElement)
{
QVector<VDetail> vector;
QDomNodeList detailList = domElement.childNodes();
@ -672,10 +672,10 @@ void VToolUnionDetails::AddToFile()
{
QDomElement domElement = doc->createElement(TagName);
SetAttribute(domElement, AttrId, id);
SetAttribute(domElement, AttrType, ToolType);
SetAttribute(domElement, AttrIndexD1, indexD1);
SetAttribute(domElement, AttrIndexD2, indexD2);
doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrIndexD1, indexD1);
doc->SetAttribute(domElement, AttrIndexD2, indexD2);
AddDetail(domElement, d1);
AddDetail(domElement, d2);
@ -688,8 +688,8 @@ void VToolUnionDetails::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SetAttribute(domElement, AttrIndexD1, indexD1);
SetAttribute(domElement, AttrIndexD2, indexD2);
doc->SetAttribute(domElement, AttrIndexD1, indexD1);
doc->SetAttribute(domElement, AttrIndexD2, indexD2);
QDomNode domNode = domElement.firstChild();
domNode = UpdateDetail(domNode, d1);
@ -713,30 +713,30 @@ void VToolUnionDetails::AddNode(QDomElement &domElement, const VNodeDetail &node
{
QDomElement nod = doc->createElement(TagNode);
SetAttribute(nod, AttrIdObject, node.getId());
SetAttribute(nod, AttrMx, toMM(node.getMx()));
SetAttribute(nod, AttrMy, toMM(node.getMy()));
doc->SetAttribute(nod, AttrIdObject, node.getId());
doc->SetAttribute(nod, AttrMx, toMM(node.getMx()));
doc->SetAttribute(nod, AttrMy, toMM(node.getMy()));
if (node.getTypeNode() == NodeDetail::Contour)
{
SetAttribute(nod, AttrNodeType, NodeTypeContour);
doc->SetAttribute(nod, AttrNodeType, NodeTypeContour);
}
else
{
SetAttribute(nod, AttrNodeType, NodeTypeModeling);
doc->SetAttribute(nod, AttrNodeType, NodeTypeModeling);
}
switch (node.getTypeTool())
{
case (Tool::NodeArc):
SetAttribute(nod, AttrType, QStringLiteral("NodeArc"));
doc->SetAttribute(nod, AttrType, QStringLiteral("NodeArc"));
break;
case (Tool::NodePoint):
SetAttribute(nod, AttrType, QStringLiteral("NodePoint"));
doc->SetAttribute(nod, AttrType, QStringLiteral("NodePoint"));
break;
case (Tool::NodeSpline):
SetAttribute(nod, AttrType, QStringLiteral("NodeSpline"));
doc->SetAttribute(nod, AttrType, QStringLiteral("NodeSpline"));
break;
case (Tool::NodeSplinePath):
SetAttribute(nod, AttrType, QStringLiteral("NodeSplinePath"));
doc->SetAttribute(nod, AttrType, QStringLiteral("NodeSplinePath"));
break;
default:
qWarning()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
@ -773,7 +773,7 @@ QDomNode VToolUnionDetails::UpdateDetail(const QDomNode &domNode, const VDetail
void VToolUnionDetails::AddToModeling(const QDomElement &domElement)
{
QDomElement modelingElement;
bool ok = doc->GetActivModelingElement(modelingElement);
bool ok = doc->GetActivNodeElement(VPattern::TagModeling, modelingElement);
if (ok)
{
modelingElement.appendChild(domElement);

View File

@ -51,7 +51,7 @@ public:
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolUnionDetails(VDomDocument *doc, VContainer *data, const qint64 &id, const VDetail &d1, const VDetail &d2,
VToolUnionDetails(VPattern *doc, VContainer *data, const qint64 &id, const VDetail &d1, const VDetail &d2,
const ptrdiff_t &indexD1, const ptrdiff_t &indexD2,
const Tool::Sources &typeCreation, QObject *parent = 0);
/**
@ -64,7 +64,7 @@ public:
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
@ -82,7 +82,7 @@ public:
*/
static void Create(const qint64 _id, const VDetail &d1, const VDetail &d2, const qint64 &d1id, const qint64 &d2id,
const ptrdiff_t &indexD1, const ptrdiff_t &indexD2, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
VPattern *doc, VContainer *data, const Document::Documents &parse,
const Tool::Sources &typeCreation);
/**
* @brief GetDetailFromFile parse detail from file.
@ -90,7 +90,7 @@ public:
* @param domElement tag in xml tree.
* @return detail stored in file.
*/
static QVector<VDetail> GetDetailFromFile(VDomDocument *doc, const QDomElement &domElement);
static QVector<VDetail> GetDetailFromFile(VPattern *doc, const QDomElement &domElement);
static const QString TagName;
static const QString ToolType;
static const QString TagDetail;
@ -115,7 +115,7 @@ public:
* @param pRotate point rotation.
* @param angle angle rotation.
*/
static void AddToNewDetail(QObject *tool, VDomDocument *doc, VContainer *data, VDetail &newDetail,
static void AddToNewDetail(QObject *tool, VPattern *doc, VContainer *data, VDetail &newDetail,
const VDetail &det, const ptrdiff_t &i, const qint64 &idTool, const qreal &dx = 0,
const qreal &dy = 0, const qint64 &pRotate = 0, const qreal &angle = 0);
/**

View File

@ -28,7 +28,7 @@
#include "vsimplesplinepath.h"
VSimpleSplinePath::VSimpleSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qreal *factor)
VSimpleSplinePath::VSimpleSplinePath(VPattern *doc, VContainer *data, qint64 id, qreal *factor)
:VAbstractTool(doc, data, id), factor(factor)
{
}

View File

@ -47,7 +47,7 @@ public:
* @param id spline path id.
* @param factor scale factor.
*/
VSimpleSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qreal *factor);
VSimpleSplinePath(VPattern *doc, VContainer *data, qint64 id, qreal *factor);
protected:
/**
* @brief mouseReleaseEvent handle mouse release events.

File diff suppressed because it is too large Load Diff

View File

@ -30,62 +30,29 @@
#define VDOMDOCUMENT_H
#include "../container/vcontainer.h"
#include "../widgets/vmaingraphicsscene.h"
#include "../tools/vdatatool.h"
#include "vtoolrecord.h"
#include <QComboBox>
#include <QDomDocument>
#include <QDebug>
namespace Document
{
/**
* @brief The Document enum types parse.
*/
enum Document { LiteParse, FullParse};
Q_DECLARE_FLAGS(Documents, Document)
}
Q_DECLARE_OPERATORS_FOR_FLAGS(Document::Documents)
#ifdef Q_CC_GNU
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#endif
/**
* @brief The VDomDocument class working with pattern file.
* @brief The VDomDocument class extend QDomDocument class.
*/
class VDomDocument : public QObject, public QDomDocument
class VDomDocument : public QDomDocument
{
Q_OBJECT
Q_DECLARE_TR_FUNCTIONS(VDomDocument)
public:
/**
* @brief VDomDocument constructor.
* @param data container with variables.
* @param comboBoxDraws combobox for pattern peaces names.
* @param mode draw mode.
*/
VDomDocument(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode, QObject *parent = 0);
/**
* @brief VDomDocument constructor.
* @param name pattern peace name.
* @param data container with variables.
* @param comboBoxDraws combobox for pattern peaces names.
* @param mode draw mode.
*/
VDomDocument(const QString& name, VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode,
QObject *parent = 0);
/**
* @brief VDomDocument constructor.
* @param doc dom document container type.
* @param data container with variables.
* @param comboBoxDraws combobox for pattern peaces names.
* @param mode draw mode.
*/
VDomDocument(const QDomDocumentType& doctype, VContainer *data, QComboBox *comboBoxDraws,
Draw::Draws *mode, QObject *parent = 0);
~VDomDocument(){}
/**
* @brief VDomDocument constructor.
* @param data container with variables.
* @param parent parent object
*/
VDomDocument(VContainer *data);
virtual ~VDomDocument(){}
/**
* @brief elementById find element by id.
* @param id value id attribute.
@ -97,121 +64,19 @@ public:
* @param element tag.
*/
void removeAllChilds(QDomElement &element);
template <typename T>
/**
* @brief CreateEmptyFile create minimal empty file.
* @brief SetAttribute set attribute in pattern file. Replace "," by ".".
* @param domElement element in xml tree.
* @param name name of attribute.
* @param value value of attribute.
*/
void CreateEmptyFile();
/**
* @brief ChangeActivDraw set new pattern peace name.
* @param name new name.
* @param parse parser file mode.
*/
void ChangeActivDraw(const QString& name, const Document::Documents &parse = Document::FullParse);
/**
* @brief GetNameActivDraw return current pattern peace name.
* @return pattern peace name.
*/
inline QString GetNameActivDraw() const {return nameActivDraw;}
/**
* @brief GetActivDrawElement return draw tag for current pattern peace.
* @param element draw tag.
* @return true if found.
*/
bool GetActivDrawElement(QDomElement &element);
/**
* @brief GetActivCalculationElement return calculation tag for current pattern peace.
* @param element calculation tag.
* @return true if found.
*/
bool GetActivCalculationElement(QDomElement &element);
/**
* @brief GetActivModelingElement return modeling tag for current pattern peace.
* @param element modeling tag
* @return true if found.
*/
bool GetActivModelingElement(QDomElement &element);
/**
* @brief GetActivDetailsElement return details tag for current pattern peace.
* @param element details tag.
* @return true if found.
*/
bool GetActivDetailsElement(QDomElement &element);
/**
* @brief appendDraw add new pattern peace structure to the file.
* @param name pattern peace name.
* @return true if success.
*/
bool appendDraw(const QString& name);
/**
* @brief SetNameDraw change current pattern peace.
* @param name pattern peace name.
* @return true if success.
*/
bool SetNameDraw(const QString& name);
/**
* @brief Parse parse file.
* @param parse parser file mode.
* @param sceneDraw pointer to draw scene.
* @param sceneDetail pointer to details scene.
*/
void Parse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw,
VMainGraphicsScene *sceneDetail);
/**
* @brief getTools return list of tools pointers.
* @return list.
*/
inline QHash<qint64, VDataTool*>* getTools() {return &tools;}
/**
* @brief getTool return tool from tool list.
* @param id tool id.
* @return tool.
*/
VDataTool* getTool(const qint64 &id);
/**
* @brief getHistory return list with list of history records.
* @return list of history records.
*/
inline QVector<VToolRecord> *getHistory() {return &history;}
/**
* @brief getCursor return cursor.
* @return cursor.
*/
inline qint64 getCursor() const {return cursor;}
/**
* @brief setCursor set cursor.
* @param value cursor.
*/
void setCursor(const qint64 &value);
/**
* @brief setCurrentData set current data set.
*/
void setCurrentData();
/**
* @brief AddTool add tool to list tools.
* @param id tool id.
* @param tool tool.
*/
void AddTool(const qint64 &id, VDataTool *tool);
/**
* @brief UpdateToolData update tool in list tools.
* @param id tool id.
* @param data container with variables.
*/
void UpdateToolData(const qint64 &id, VContainer *data);
/**
* @brief IncrementReferens increment reference parent objects.
* @param id parent object id.
*/
void IncrementReferens(qint64 id) const;
/**
* @brief DecrementReferens decrement reference parent objects.
* @param id parent object id.
*/
void DecrementReferens(qint64 id) const;
/**
* @brief TestUniqueId test exist unique id in pattern file. Each id must be unique.
*/
void TestUniqueId() const;
void SetAttribute(QDomElement &domElement, const QString &name, const T &value)
{
QString val = QString().setNum(value);
val = val.replace(",", ".");
domElement.setAttribute(name, val);
}
/**
* @brief GetParametrLongLong return long long value of attribute.
* @param domElement tag in xml tree.
@ -226,7 +91,8 @@ public:
* @param name attribute name.
* @return attribute value.
*/
QString GetParametrString(const QDomElement& domElement, const QString &name, const QString &defValue) const;
QString GetParametrString(const QDomElement& domElement, const QString &name,
const QString &defValue = QString()) const;
/**
* @brief GetParametrDouble return double value of attribute.
* @param domElement tag in xml tree.
@ -234,100 +100,19 @@ public:
* @return double value.
*/
qreal GetParametrDouble(const QDomElement& domElement, const QString &name, const QString &defValue) const;
QString UniqueTagText(const QString &tagName, const QString &defVal = QString()) const;
protected:
/**
* @brief SPointActiveDraw return id base point current pattern peace.
* @return id base point.
* @brief data container with data.
*/
qint64 SPointActiveDraw();
bool isPatternModified() const;
void setPatternModified(bool value);
QString UniqueTagText(const QString &tagName, const QString &defVal = QString());
signals:
/**
* @brief ChangedActivDraw change active pattern peace.
* @param newName new pattern peace name.
*/
void ChangedActivDraw(const QString &newName);
/**
* @brief ChangedNameDraw save new name active pattern peace.
* @param oldName old name.
* @param newName new name.
*/
void ChangedNameDraw(const QString &oldName, const QString &newName);
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void FullUpdateFromFile();
/**
* @brief patternChanged emit if we have unsaved change.
*/
void patternChanged();
/**
* @brief ShowTool highlight tool.
* @param id tool id.
* @param color highlight color.
* @param enable enable or disable highlight.
*/
void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);
/**
* @brief ChangedCursor change cursor position.
* @param id tool id.
*/
void ChangedCursor(qint64 id);
public slots:
/**
* @brief FullUpdateTree lite parse file.
*/
void FullUpdateTree();
/**
* @brief haveLiteChange we have unsaved change.
*/
void haveLiteChange();
/**
* @brief ShowHistoryTool hightlight tool.
* @param id tool id.
* @param color hightlight color.
* @param enable enable or diasable hightlight.
*/
void ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable);
VContainer *data;
private:
Q_DISABLE_COPY(VDomDocument)
/**
* @brief map use for finding element by id.
*/
QHash<QString, QDomElement> map;
/**
* @brief nameActivDraw name current pattern peace.
*/
QString nameActivDraw;
/**
* @brief data container with data.
*/
VContainer *data;
/**
* @brief tools list with pointer on tools.
*/
QHash<qint64, VDataTool*> tools;
/**
* @brief history history records.
*/
QVector<VToolRecord> history;
/**
* @brief cursor cursor keep id tool after which we will add new tool in file.
*/
qint64 cursor;
/**
* @brief comboBoxDraws combobox with pattern peace names.
*/
QComboBox *comboBoxDraws;
/**
* @brief mode current draw mode.
*/
Draw::Draws *mode;
/**
* @brief fileModified true if exist change in file.
*/
bool patternModified;
/**
* @brief find find element by id.
* @param node node.
@ -335,126 +120,14 @@ private:
* @return true if found.
*/
bool find(const QDomElement &node, const QString& id);
/**
* @brief CheckNameDraw check if exist pattern peace with this name.
* @param name pattern peace name.
* @return true if exist.
*/
bool CheckNameDraw(const QString& name) const;
/**
* @brief SetActivDraw set current pattern peace.
* @param name pattern peace name.
*/
void SetActivDraw(const QString& name);
/**
* @brief GetActivNodeElement find element in current pattern peace by name.
* @param name name tag.
* @param element element.
* @return true if found.
*/
bool GetActivNodeElement(const QString& name, QDomElement& element);
/**
* @brief ParseDrawElement parse draw tag.
* @param sceneDraw draw scene.
* @param sceneDetail details scene.
* @param node node.
* @param parse parser file mode.
*/
void ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
const QDomNode& node, const Document::Documents &parse);
/**
* @brief ParseDrawMode parse draw tag with draw mode.
* @param sceneDraw draw scene.
* @param sceneDetail details scene.
* @param node node.
* @param parse parser file mode.
* @param mode draw mode.
*/
void ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
const QDomNode& node, const Document::Documents &parse, const Draw::Draws &mode);
/**
* @brief ParseDetailElement parse detail tag.
* @param sceneDetail detail scene.
* @param domElement tag in xml tree.
* @param parse parser file mode.
*/
void ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
const Document::Documents &parse);
/**
* @brief ParseDetails parse details tag.
* @param sceneDetail detail scene.
* @param domElement tag in xml tree.
* @param parse parser file mode.
*/
void ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
const Document::Documents &parse);
/**
* @brief ParsePointElement parse point tag.
* @param scene scene.
* @param domElement tag in xml tree.
* @param parse parser file mode.
* @param type type of point.
* @param mode draw mode.
*/
void ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement,
const Document::Documents &parse, const QString &type);
/**
* @brief ParseLineElement parse line tag.
* @param scene scene.
* @param domElement tag in xml tree.
* @param parse parser file mode.
* @param mode draw mode.
*/
void ParseLineElement(VMainGraphicsScene *scene, const QDomElement& domElement,
const Document::Documents &parse);
/**
* @brief ParseSplineElement parse spline tag.
* @param scene scene.
* @param domElement tag in xml tree.
* @param parse parser file mode.
* @param type type of spline.
* @param mode draw mode.
*/
void ParseSplineElement(VMainGraphicsScene *scene, const QDomElement& domElement,
const Document::Documents &parse, const QString& type);
/**
* @brief ParseArcElement parse arc tag.
* @param scene scene.
* @param domElement tag in xml tree.
* @param parse parser file mode.
* @param type type of spline.
* @param mode draw mode.
*/
void ParseArcElement(VMainGraphicsScene *scene, const QDomElement& domElement,
const Document::Documents &parse, const QString& type);
/**
* @brief ParseToolsElement parse tools tag.
* @param scene scene.
* @param domElement tag in xml tree.
* @param parse parser file mode.
* @param type type of spline.
*/
void ParseToolsElement(VMainGraphicsScene *scene, const QDomElement& domElement,
const Document::Documents &parse, const QString& type);
/**
* @brief ParseIncrementsElement parse increments tag.
* @param node tag in xml tree.
*/
void ParseIncrementsElement(const QDomNode& node);
/**
* @brief GetParametrId return value id attribute.
* @param domElement tag in xml tree.
* @return id value.
*/
qint64 GetParametrId(const QDomElement& domElement) const;
/**
* @brief CollectId recursive function, try find id attribute in file. Throw exclusion if find not unique.
* @param node tag in xml tree.
* @param vector list with ids.
*/
void CollectId(const QDomElement &node, QVector<qint64> &vector)const;
};
template <>
inline void VDomDocument::SetAttribute<QString>(QDomElement &domElement, const QString &name, const QString &value)
{
domElement.setAttribute(name, value);
}
#ifdef Q_CC_GNU
#pragma GCC diagnostic pop
#endif

1265
src/xml/vpattern.cpp Normal file

File diff suppressed because it is too large Load Diff

367
src/xml/vpattern.h Normal file
View File

@ -0,0 +1,367 @@
/************************************************************************
**
** @file vpattern.h
** @author Roman Telezhinsky <dismine@gmail.com>
** @date 24 2, 2014
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef VPATTERN_H
#define VPATTERN_H
#include "vdomdocument.h"
#include "../widgets/vmaingraphicsscene.h"
#include "../tools/vdatatool.h"
#include "vtoolrecord.h"
#include <QComboBox>
namespace Document
{
/**
* @brief The Document enum parse types.
*/
enum Document { LiteParse, FullParse};
Q_DECLARE_FLAGS(Documents, Document)
}
Q_DECLARE_OPERATORS_FOR_FLAGS(Document::Documents)
/**
* @brief The VPattern class working with pattern file.
*/
class VPattern : public QObject, public VDomDocument
{
Q_OBJECT
public:
VPattern(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode, QObject *parent = 0);
/**
* @brief CreateEmptyFile create minimal empty file.
*/
void CreateEmptyFile();
/**
* @brief ChangeActivDraw set new pattern peace name.
* @param name new name.
* @param parse parser file mode.
*/
void ChangeActivDraw(const QString& name, const Document::Documents &parse = Document::FullParse);
/**
* @brief GetNameActivDraw return current pattern peace name.
* @return pattern peace name.
*/
inline QString GetNameActivDraw() const {return nameActivDraw;}
/**
* @brief GetActivDrawElement return draw tag for current pattern peace.
* @param element draw tag.
* @return true if found.
*/
bool GetActivDrawElement(QDomElement &element);
/**
* @brief appendDraw add new pattern peace structure to the file.
* @param name pattern peace name.
* @return true if success.
*/
bool appendDraw(const QString& name);
/**
* @brief SetNameDraw change current pattern peace.
* @param name pattern peace name.
* @return true if success.
*/
bool SetNameDraw(const QString& name);
/**
* @brief Parse parse file.
* @param parse parser file mode.
* @param sceneDraw pointer to draw scene.
* @param sceneDetail pointer to details scene.
*/
void Parse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw,
VMainGraphicsScene *sceneDetail);
/**
* @brief getTools return list of tools pointers.
* @return list.
*/
inline QHash<qint64, VDataTool*>* getTools() {return &tools;}
/**
* @brief getTool return tool from tool list.
* @param id tool id.
* @return tool.
*/
VDataTool* getTool(const qint64 &id);
/**
* @brief getHistory return list with list of history records.
* @return list of history records.
*/
inline QVector<VToolRecord> *getHistory() {return &history;}
/**
* @brief getCursor return cursor.
* @return cursor.
*/
inline qint64 getCursor() const {return cursor;}
/**
* @brief setCursor set cursor.
* @param value cursor.
*/
void setCursor(const qint64 &value);
/**
* @brief setCurrentData set current data set.
*/
void setCurrentData();
/**
* @brief AddTool add tool to list tools.
* @param id tool id.
* @param tool tool.
*/
void AddTool(const qint64 &id, VDataTool *tool);
/**
* @brief UpdateToolData update tool in list tools.
* @param id tool id.
* @param data container with variables.
*/
void UpdateToolData(const qint64 &id, VContainer *data);
/**
* @brief IncrementReferens increment reference parent objects.
* @param id parent object id.
*/
void IncrementReferens(qint64 id) const;
/**
* @brief DecrementReferens decrement reference parent objects.
* @param id parent object id.
*/
void DecrementReferens(qint64 id) const;
/**
* @brief TestUniqueId test exist unique id in pattern file. Each id must be unique.
*/
void TestUniqueId() const;
/**
* @brief SPointActiveDraw return id base point current pattern peace.
* @return id base point.
*/
qint64 SPointActiveDraw();
inline bool isPatternModified() const {return patternModified;}
inline void setPatternModified(bool value) {patternModified = value;}
/**
* @brief GetActivNodeElement find element in current pattern piece by name.
* @param name name tag.
* @param element element.
* @return true if found.
*/
bool GetActivNodeElement(const QString& name, QDomElement& element);
static const QString TagCalculation;
static const QString TagModeling;
static const QString TagDetails;
static const QString TagAuthor;
static const QString TagDescription;
static const QString TagNotes;
static const QString TagIncrements;
static const QString TagDraw;
static const QString AttrName;
signals:
/**
* @brief ChangedActivDraw change active pattern peace.
* @param newName new pattern peace name.
*/
void ChangedActivDraw(const QString &newName);
/**
* @brief ChangedNameDraw save new name active pattern peace.
* @param oldName old name.
* @param newName new name.
*/
void ChangedNameDraw(const QString &oldName, const QString &newName);
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void FullUpdateFromFile();
/**
* @brief patternChanged emit if we have unsaved change.
*/
void patternChanged();
/**
* @brief ShowTool highlight tool.
* @param id tool id.
* @param color highlight color.
* @param enable enable or disable highlight.
*/
void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);
/**
* @brief ChangedCursor change cursor position.
* @param id tool id.
*/
void ChangedCursor(qint64 id);
public slots:
/**
* @brief FullUpdateTree lite parse file.
*/
void FullUpdateTree();
/**
* @brief haveLiteChange we have unsaved change.
*/
void haveLiteChange();
/**
* @brief ShowHistoryTool hightlight tool.
* @param id tool id.
* @param color hightlight color.
* @param enable enable or diasable hightlight.
*/
void ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable);
private:
Q_DISABLE_COPY(VPattern)
/**
* @brief nameActivDraw name current pattern peace.
*/
QString nameActivDraw;
/**
* @brief tools list with pointer on tools.
*/
QHash<qint64, VDataTool*> tools;
/**
* @brief history history records.
*/
QVector<VToolRecord> history;
/**
* @brief cursor cursor keep id tool after which we will add new tool in file.
*/
qint64 cursor;
QComboBox *comboBoxDraws;
/**
* @brief mode current draw mode.
*/
Draw::Draws *mode;
/**
* @brief fileModified true if exist change in file.
*/
bool patternModified;
/**
* @brief CheckNameDraw check if exist pattern peace with this name.
* @param name pattern peace name.
* @return true if exist.
*/
bool CheckNameDraw(const QString& name) const;
/**
* @brief SetActivDraw set current pattern peace.
* @param name pattern peace name.
*/
void SetActivDraw(const QString& name);
/**
* @brief ParseDrawElement parse draw tag.
* @param sceneDraw draw scene.
* @param sceneDetail details scene.
* @param node node.
* @param parse parser file mode.
*/
void ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
const QDomNode& node, const Document::Documents &parse);
/**
* @brief ParseDrawMode parse draw tag with draw mode.
* @param sceneDraw draw scene.
* @param sceneDetail details scene.
* @param node node.
* @param parse parser file mode.
* @param mode draw mode.
*/
void ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
const QDomNode& node, const Document::Documents &parse, const Draw::Draws &mode);
/**
* @brief ParseDetailElement parse detail tag.
* @param sceneDetail detail scene.
* @param domElement tag in xml tree.
* @param parse parser file mode.
*/
void ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
const Document::Documents &parse);
/**
* @brief ParseDetails parse details tag.
* @param sceneDetail detail scene.
* @param domElement tag in xml tree.
* @param parse parser file mode.
*/
void ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
const Document::Documents &parse);
/**
* @brief ParsePointElement parse point tag.
* @param scene scene.
* @param domElement tag in xml tree.
* @param parse parser file mode.
* @param type type of point.
* @param mode draw mode.
*/
void ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement,
const Document::Documents &parse, const QString &type);
/**
* @brief ParseLineElement parse line tag.
* @param scene scene.
* @param domElement tag in xml tree.
* @param parse parser file mode.
* @param mode draw mode.
*/
void ParseLineElement(VMainGraphicsScene *scene, const QDomElement& domElement,
const Document::Documents &parse);
/**
* @brief ParseSplineElement parse spline tag.
* @param scene scene.
* @param domElement tag in xml tree.
* @param parse parser file mode.
* @param type type of spline.
* @param mode draw mode.
*/
void ParseSplineElement(VMainGraphicsScene *scene, const QDomElement& domElement,
const Document::Documents &parse, const QString& type);
/**
* @brief ParseArcElement parse arc tag.
* @param scene scene.
* @param domElement tag in xml tree.
* @param parse parser file mode.
* @param type type of spline.
* @param mode draw mode.
*/
void ParseArcElement(VMainGraphicsScene *scene, const QDomElement& domElement,
const Document::Documents &parse, const QString& type);
/**
* @brief ParseToolsElement parse tools tag.
* @param scene scene.
* @param domElement tag in xml tree.
* @param parse parser file mode.
* @param type type of spline.
*/
void ParseToolsElement(VMainGraphicsScene *scene, const QDomElement& domElement,
const Document::Documents &parse, const QString& type);
/**
* @brief ParseIncrementsElement parse increments tag.
* @param node tag in xml tree.
*/
void ParseIncrementsElement(const QDomNode& node);
/**
* @brief GetParametrId return value id attribute.
* @param domElement tag in xml tree.
* @return id value.
*/
qint64 GetParametrId(const QDomElement& domElement) const;
/**
* @brief CollectId recursive function, try find id attribute in file. Throw exclusion if find not unique.
* @param node tag in xml tree.
* @param vector list with ids.
*/
void CollectId(const QDomElement &node, QVector<qint64> &vector)const;
void PrepareForParse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw,
VMainGraphicsScene *sceneDetail);
};
#endif // VPATTERN_H

View File

@ -1,7 +1,9 @@
HEADERS += \
src/xml/vtoolrecord.h \
src/xml/vdomdocument.h
src/xml/vdomdocument.h \
src/xml/vpattern.h
SOURCES += \
src/xml/vtoolrecord.cpp \
src/xml/vdomdocument.cpp
src/xml/vdomdocument.cpp \
src/xml/vpattern.cpp