Static attribute of xml.
--HG-- branch : develop
This commit is contained in:
parent
f9f724fcab
commit
1539ba0c47
|
@ -92,7 +92,7 @@ void VDrawTool::AddToCalculation(const QDomElement &domElement){
|
|||
}
|
||||
}
|
||||
} else {
|
||||
qCritical()<<"Can't find tag Calculation"<< Q_FUNC_INFO;
|
||||
qCritical()<<tr("Can't find tag Calculation")<< Q_FUNC_INFO;
|
||||
}
|
||||
emit toolhaveChange();
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "vtoolalongline.h"
|
||||
#include "container/calculator.h"
|
||||
|
||||
const QString VToolAlongLine::ToolType = QStringLiteral("alongLine");
|
||||
|
||||
VToolAlongLine::VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula,
|
||||
const qint64 &firstPointId, const qint64 &secondPointId,
|
||||
const QString &typeLine, Tool::Sources typeCreation,
|
||||
|
@ -37,10 +39,10 @@ VToolAlongLine::VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, c
|
|||
void VToolAlongLine::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
typeLine = domElement.attribute("typeLine", "");
|
||||
formula = domElement.attribute("length", "");
|
||||
basePointId = domElement.attribute("firstPoint", "").toLongLong();
|
||||
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||
formula = domElement.attribute(AttrLength, "");
|
||||
basePointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
||||
}
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
@ -49,11 +51,11 @@ void VToolAlongLine::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", dialogAlongLine->getPointName());
|
||||
domElement.setAttribute("typeLine", dialogAlongLine->getTypeLine());
|
||||
domElement.setAttribute("length", dialogAlongLine->getFormula());
|
||||
domElement.setAttribute("firstPoint", QString().setNum(dialogAlongLine->getFirstPointId()));
|
||||
domElement.setAttribute("secondPoint", QString().setNum(dialogAlongLine->getSecondPointId()));
|
||||
domElement.setAttribute(AttrName, dialogAlongLine->getPointName());
|
||||
domElement.setAttribute(AttrTypeLine, dialogAlongLine->getTypeLine());
|
||||
domElement.setAttribute(AttrLength, dialogAlongLine->getFormula());
|
||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogAlongLine->getFirstPointId()));
|
||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogAlongLine->getSecondPointId()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -71,18 +73,18 @@ void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
|||
|
||||
void VToolAlongLine::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "alongLine");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "typeLine", typeLine);
|
||||
AddAttribute(domElement, "length", formula);
|
||||
AddAttribute(domElement, "firstPoint", basePointId);
|
||||
AddAttribute(domElement, "secondPoint", secondPointId);
|
||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
||||
AddAttribute(domElement, AttrLength, formula);
|
||||
AddAttribute(domElement, AttrFirstPoint, basePointId);
|
||||
AddAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||
|
||||
AddToCalculation(domElement);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#include "vtoolarc.h"
|
||||
#include "container/calculator.h"
|
||||
|
||||
const QString VToolArc::TagName = QStringLiteral("arc");
|
||||
const QString VToolArc::ToolType = QStringLiteral("simple");
|
||||
|
||||
VToolArc::VToolArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,
|
||||
QGraphicsItem *parent):VDrawTool(doc, data, id), QGraphicsPathItem(parent),
|
||||
dialogArc(QSharedPointer<DialogArc>()){
|
||||
|
@ -114,10 +117,10 @@ void VToolArc::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("center", QString().setNum(dialogArc->GetCenter()));
|
||||
domElement.setAttribute("radius", dialogArc->GetRadius());
|
||||
domElement.setAttribute("angle1", dialogArc->GetF1());
|
||||
domElement.setAttribute("angle2", dialogArc->GetF2());
|
||||
domElement.setAttribute(AttrCenter, QString().setNum(dialogArc->GetCenter()));
|
||||
domElement.setAttribute(AttrRadius, dialogArc->GetRadius());
|
||||
domElement.setAttribute(AttrAngle1, dialogArc->GetF1());
|
||||
domElement.setAttribute(AttrAngle2, dialogArc->GetF2());
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -154,14 +157,14 @@ void VToolArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
|||
|
||||
void VToolArc::AddToFile(){
|
||||
VArc arc = VAbstractTool::data.GetArc(id);
|
||||
QDomElement domElement = doc->createElement("arc");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "simple");
|
||||
AddAttribute(domElement, "center", arc.GetCenter());
|
||||
AddAttribute(domElement, "radius", arc.GetFormulaRadius());
|
||||
AddAttribute(domElement, "angle1", arc.GetFormulaF1());
|
||||
AddAttribute(domElement, "angle2", arc.GetFormulaF2());
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrCenter, arc.GetCenter());
|
||||
AddAttribute(domElement, AttrRadius, arc.GetFormulaRadius());
|
||||
AddAttribute(domElement, AttrAngle1, arc.GetFormulaF1());
|
||||
AddAttribute(domElement, AttrAngle2, arc.GetFormulaF2());
|
||||
|
||||
AddToCalculation(domElement);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@ public:
|
|||
static void Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1,
|
||||
const QString &f2, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString TagName;
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "vtoolbisector.h"
|
||||
#include <container/calculator.h>
|
||||
|
||||
const QString VToolBisector::ToolType = QStringLiteral("bisector");
|
||||
|
||||
VToolBisector::VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const QString &typeLine, const QString &formula, const qint64 &firstPointId,
|
||||
const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Sources typeCreation,
|
||||
|
@ -121,11 +123,11 @@ void VToolBisector::Create(const qint64 _id, const QString &formula, const qint6
|
|||
void VToolBisector::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
typeLine = domElement.attribute("typeLine", "");
|
||||
formula = domElement.attribute("length", "");
|
||||
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
|
||||
basePointId = domElement.attribute("secondPoint", "").toLongLong();
|
||||
thirdPointId = domElement.attribute("thirdPoint", "").toLongLong();
|
||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||
formula = domElement.attribute(AttrLength, "");
|
||||
firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
||||
basePointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
||||
thirdPointId = domElement.attribute(AttrThirdPoint, "").toLongLong();
|
||||
}
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
@ -134,12 +136,12 @@ void VToolBisector::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", dialogBisector->getPointName());
|
||||
domElement.setAttribute("typeLine", dialogBisector->getTypeLine());
|
||||
domElement.setAttribute("length", dialogBisector->getFormula());
|
||||
domElement.setAttribute("firstPoint", QString().setNum(dialogBisector->getFirstPointId()));
|
||||
domElement.setAttribute("secondPoint", QString().setNum(dialogBisector->getSecondPointId()));
|
||||
domElement.setAttribute("thirdPoint", QString().setNum(dialogBisector->getThirdPointId()));
|
||||
domElement.setAttribute(AttrName, dialogBisector->getPointName());
|
||||
domElement.setAttribute(AttrTypeLine, dialogBisector->getTypeLine());
|
||||
domElement.setAttribute(AttrLength, dialogBisector->getFormula());
|
||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogBisector->getFirstPointId()));
|
||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogBisector->getSecondPointId()));
|
||||
domElement.setAttribute(AttrThirdPoint, QString().setNum(dialogBisector->getThirdPointId()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -157,19 +159,19 @@ void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
|||
|
||||
void VToolBisector::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "bisector");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "typeLine", typeLine);
|
||||
AddAttribute(domElement, "length", formula);
|
||||
AddAttribute(domElement, "firstPoint", firstPointId);
|
||||
AddAttribute(domElement, "secondPoint", basePointId);
|
||||
AddAttribute(domElement, "thirdPoint", thirdPointId);
|
||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
||||
AddAttribute(domElement, AttrLength, formula);
|
||||
AddAttribute(domElement, AttrFirstPoint, firstPointId);
|
||||
AddAttribute(domElement, AttrSecondPoint, basePointId);
|
||||
AddAttribute(domElement, AttrThirdPoint, thirdPointId);
|
||||
|
||||
AddToCalculation(domElement);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
|
||||
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
||||
Tool::Sources typeCreation);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include "widgets/vmaingraphicsscene.h"
|
||||
#include <container/calculator.h>
|
||||
|
||||
const QString VToolEndLine::ToolType = QStringLiteral("endLine");
|
||||
|
||||
VToolEndLine::VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
|
||||
const QString &formula, const qreal &angle, const qint64 &basePointId,
|
||||
Tool::Sources typeCreation, QGraphicsItem *parent):
|
||||
|
@ -96,10 +98,10 @@ void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QStr
|
|||
void VToolEndLine::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
typeLine = domElement.attribute("typeLine", "");
|
||||
formula = domElement.attribute("length", "");
|
||||
basePointId = domElement.attribute("basePoint", "").toLongLong();
|
||||
angle = domElement.attribute("angle", "").toInt();
|
||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||
formula = domElement.attribute(AttrLength, "");
|
||||
basePointId = domElement.attribute(AttrBasePoint, "").toLongLong();
|
||||
angle = domElement.attribute(AttrAngle, "").toInt();
|
||||
}
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
@ -112,11 +114,11 @@ void VToolEndLine::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", dialogEndLine->getPointName());
|
||||
domElement.setAttribute("typeLine", dialogEndLine->getTypeLine());
|
||||
domElement.setAttribute("length", dialogEndLine->getFormula());
|
||||
domElement.setAttribute("angle", QString().setNum(dialogEndLine->getAngle()));
|
||||
domElement.setAttribute("basePoint", QString().setNum(dialogEndLine->getBasePointId()));
|
||||
domElement.setAttribute(AttrName, dialogEndLine->getPointName());
|
||||
domElement.setAttribute(AttrTypeLine, dialogEndLine->getTypeLine());
|
||||
domElement.setAttribute(AttrLength, dialogEndLine->getFormula());
|
||||
domElement.setAttribute(AttrAngle, QString().setNum(dialogEndLine->getAngle()));
|
||||
domElement.setAttribute(AttrBasePoint, QString().setNum(dialogEndLine->getBasePointId()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -125,18 +127,18 @@ void VToolEndLine::FullUpdateFromGui(int result){
|
|||
|
||||
void VToolEndLine::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "endLine");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "typeLine", typeLine);
|
||||
AddAttribute(domElement, "length", formula);
|
||||
AddAttribute(domElement, "angle", angle);
|
||||
AddAttribute(domElement, "basePoint", basePointId);
|
||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
||||
AddAttribute(domElement, AttrLength, formula);
|
||||
AddAttribute(domElement, AttrAngle, angle);
|
||||
AddAttribute(domElement, AttrBasePoint, basePointId);
|
||||
|
||||
AddToCalculation(domElement);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
const QString &formula, const qreal &angle, const qint64 &basePointId, const qreal &mx,
|
||||
const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "vtoolheight.h"
|
||||
|
||||
const QString VToolHeight::ToolType = QStringLiteral("height");
|
||||
|
||||
VToolHeight::VToolHeight(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
|
||||
const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId,
|
||||
Tool::Sources typeCreation, QGraphicsItem * parent)
|
||||
|
@ -90,10 +92,10 @@ QPointF VToolHeight::FindPoint(const QLineF &line, const QPointF &point){
|
|||
void VToolHeight::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
typeLine = domElement.attribute("typeLine", "");
|
||||
basePointId = domElement.attribute("basePoint", "").toLongLong();
|
||||
p1LineId = domElement.attribute("p1Line", "").toLongLong();
|
||||
p2LineId = domElement.attribute("p2Line", "").toLongLong();
|
||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||
basePointId = domElement.attribute(AttrBasePoint, "").toLongLong();
|
||||
p1LineId = domElement.attribute(AttrP1Line, "").toLongLong();
|
||||
p2LineId = domElement.attribute(AttrP2Line, "").toLongLong();
|
||||
}
|
||||
RefreshGeometry();
|
||||
|
||||
|
@ -103,11 +105,11 @@ void VToolHeight::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", dialogHeight->getPointName());
|
||||
domElement.setAttribute("typeLine", dialogHeight->getTypeLine());
|
||||
domElement.setAttribute("basePoint", QString().setNum(dialogHeight->getBasePointId()));
|
||||
domElement.setAttribute("p1Line", QString().setNum(dialogHeight->getP1LineId()));
|
||||
domElement.setAttribute("p2Line", QString().setNum(dialogHeight->getP2LineId()));
|
||||
domElement.setAttribute(AttrName, dialogHeight->getPointName());
|
||||
domElement.setAttribute(AttrTypeLine, dialogHeight->getTypeLine());
|
||||
domElement.setAttribute(AttrBasePoint, QString().setNum(dialogHeight->getBasePointId()));
|
||||
domElement.setAttribute(AttrP1Line, QString().setNum(dialogHeight->getP1LineId()));
|
||||
domElement.setAttribute(AttrP2Line, QString().setNum(dialogHeight->getP2LineId()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -120,18 +122,18 @@ void VToolHeight::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
|||
|
||||
void VToolHeight::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "height");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "typeLine", typeLine);
|
||||
AddAttribute(domElement, "basePoint", basePointId);
|
||||
AddAttribute(domElement, "p1Line", p1LineId);
|
||||
AddAttribute(domElement, "p2Line", p2LineId);
|
||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
||||
AddAttribute(domElement, AttrBasePoint, basePointId);
|
||||
AddAttribute(domElement, AttrP1Line, p1LineId);
|
||||
AddAttribute(domElement, AttrP2Line, p2LineId);
|
||||
|
||||
AddToCalculation(domElement);
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ public:
|
|||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
|
||||
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static QPointF FindPoint(const QLineF &line, const QPointF &point);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "vtoolline.h"
|
||||
|
||||
const QString VToolLine::TagName = QStringLiteral("line");
|
||||
|
||||
VToolLine::VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, qint64 secondPoint,
|
||||
Tool::Sources typeCreation, QGraphicsItem *parent):VDrawTool(doc, data, id),
|
||||
QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint),
|
||||
|
@ -91,8 +93,8 @@ void VToolLine::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("firstPoint", QString().setNum(dialogLine->getFirstPoint()));
|
||||
domElement.setAttribute("secondPoint", QString().setNum(dialogLine->getSecondPoint()));
|
||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogLine->getFirstPoint()));
|
||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogLine->getSecondPoint()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -127,10 +129,10 @@ void VToolLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
|||
}
|
||||
|
||||
void VToolLine::AddToFile(){
|
||||
QDomElement domElement = doc->createElement("line");
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "firstPoint", firstPoint);
|
||||
AddAttribute(domElement, "secondPoint", secondPoint);
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrFirstPoint, firstPoint);
|
||||
AddAttribute(domElement, AttrSecondPoint, secondPoint);
|
||||
|
||||
AddToCalculation(domElement);
|
||||
}
|
||||
|
@ -153,8 +155,8 @@ void VToolLine::RemoveReferens(){
|
|||
void VToolLine::RefreshGeometry(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
firstPoint = domElement.attribute("firstPoint", "").toLongLong();
|
||||
secondPoint = domElement.attribute("secondPoint", "").toLongLong();
|
||||
firstPoint = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
||||
secondPoint = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
||||
}
|
||||
VPointF first = VAbstractTool::data.GetPoint(firstPoint);
|
||||
VPointF second = VAbstractTool::data.GetPoint(secondPoint);
|
||||
|
|
|
@ -37,6 +37,7 @@ public:
|
|||
static void Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint,
|
||||
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString TagName;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void ChangedActivDraw(const QString newName);
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "vtoollineintersect.h"
|
||||
|
||||
const QString VToolLineIntersect::ToolType = QStringLiteral("lineIntersect");
|
||||
|
||||
VToolLineIntersect::VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2,
|
||||
const qint64 &p2Line2, Tool::Sources typeCreation,
|
||||
|
@ -109,10 +111,10 @@ void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const
|
|||
void VToolLineIntersect::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
p1Line1 = domElement.attribute("p1Line1", "").toLongLong();
|
||||
p2Line1 = domElement.attribute("p2Line1", "").toLongLong();
|
||||
p1Line2 = domElement.attribute("p1Line2", "").toLongLong();
|
||||
p2Line2 = domElement.attribute("p2Line2", "").toLongLong();
|
||||
p1Line1 = domElement.attribute(AttrP1Line1, "").toLongLong();
|
||||
p2Line1 = domElement.attribute(AttrP2Line1, "").toLongLong();
|
||||
p1Line2 = domElement.attribute(AttrP1Line2, "").toLongLong();
|
||||
p2Line2 = domElement.attribute(AttrP2Line2, "").toLongLong();
|
||||
}
|
||||
RefreshPointGeometry(VAbstractTool::data.GetPoint(id));
|
||||
}
|
||||
|
@ -121,11 +123,11 @@ void VToolLineIntersect::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", dialogLineIntersect->getPointName());
|
||||
domElement.setAttribute("p1Line1", QString().setNum(dialogLineIntersect->getP1Line1()));
|
||||
domElement.setAttribute("p2Line1", QString().setNum(dialogLineIntersect->getP2Line1()));
|
||||
domElement.setAttribute("p1Line2", QString().setNum(dialogLineIntersect->getP1Line2()));
|
||||
domElement.setAttribute("p2Line2", QString().setNum(dialogLineIntersect->getP2Line2()));
|
||||
domElement.setAttribute(AttrName, dialogLineIntersect->getPointName());
|
||||
domElement.setAttribute(AttrP1Line1, QString().setNum(dialogLineIntersect->getP1Line1()));
|
||||
domElement.setAttribute(AttrP2Line1, QString().setNum(dialogLineIntersect->getP2Line1()));
|
||||
domElement.setAttribute(AttrP1Line2, QString().setNum(dialogLineIntersect->getP1Line2()));
|
||||
domElement.setAttribute(AttrP2Line2, QString().setNum(dialogLineIntersect->getP2Line2()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -143,18 +145,18 @@ void VToolLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||
|
||||
void VToolLineIntersect::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "lineIntersect");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "p1Line1", p1Line1);
|
||||
AddAttribute(domElement, "p2Line1", p2Line1);
|
||||
AddAttribute(domElement, "p1Line2", p1Line2);
|
||||
AddAttribute(domElement, "p2Line2", p2Line2);
|
||||
AddAttribute(domElement, AttrP1Line1, p1Line1);
|
||||
AddAttribute(domElement, AttrP2Line1, p2Line1);
|
||||
AddAttribute(domElement, AttrP1Line2, p1Line2);
|
||||
AddAttribute(domElement, AttrP2Line2, p2Line2);
|
||||
|
||||
AddToCalculation(domElement);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
const qint64 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -32,7 +32,7 @@ VToolLinePoint::VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64
|
|||
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);
|
||||
mainLine->setPen(QPen(Qt::black, widthHairLine/factor));
|
||||
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
||||
if(typeLine == "none"){
|
||||
if(typeLine == TypeLineNone){
|
||||
mainLine->setVisible(false);
|
||||
} else {
|
||||
mainLine->setVisible(true);
|
||||
|
@ -55,7 +55,7 @@ void VToolLinePoint::RefreshGeometry(){
|
|||
QPointF point = VDrawTool::data.GetPoint(id).toQPointF();
|
||||
QPointF basePoint = VDrawTool::data.GetPoint(basePointId).toQPointF();
|
||||
mainLine->setLine(QLineF(basePoint - point, QPointF()));
|
||||
if(typeLine == "none"){
|
||||
if(typeLine == TypeLineNone){
|
||||
mainLine->setVisible(false);
|
||||
} else {
|
||||
mainLine->setVisible(true);
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "vtoolnormal.h"
|
||||
#include <container/calculator.h>
|
||||
|
||||
const QString VToolNormal::ToolType = QStringLiteral("normal");
|
||||
|
||||
VToolNormal::VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
|
||||
const QString &formula, const qreal &angle, const qint64 &firstPointId,
|
||||
const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem *parent):
|
||||
|
@ -110,11 +112,11 @@ QPointF VToolNormal::FindPoint(const QPointF &firstPoint, const QPointF &secondP
|
|||
void VToolNormal::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
typeLine = domElement.attribute("typeLine", "");
|
||||
formula = domElement.attribute("length", "");
|
||||
basePointId = domElement.attribute("firstPoint", "").toLongLong();
|
||||
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
||||
angle = domElement.attribute("angle", "").toDouble();
|
||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||
formula = domElement.attribute(AttrLength, "");
|
||||
basePointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
||||
angle = domElement.attribute(AttrAngle, "").toDouble();
|
||||
}
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
@ -123,12 +125,12 @@ void VToolNormal::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", dialogNormal->getPointName());
|
||||
domElement.setAttribute("typeLine", dialogNormal->getTypeLine());
|
||||
domElement.setAttribute("length", dialogNormal->getFormula());
|
||||
domElement.setAttribute("angle", QString().setNum(dialogNormal->getAngle()));
|
||||
domElement.setAttribute("firstPoint", QString().setNum(dialogNormal->getFirstPointId()));
|
||||
domElement.setAttribute("secondPoint", QString().setNum(dialogNormal->getSecondPointId()));
|
||||
domElement.setAttribute(AttrName, dialogNormal->getPointName());
|
||||
domElement.setAttribute(AttrTypeLine, dialogNormal->getTypeLine());
|
||||
domElement.setAttribute(AttrLength, dialogNormal->getFormula());
|
||||
domElement.setAttribute(AttrAngle, QString().setNum(dialogNormal->getAngle()));
|
||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogNormal->getFirstPointId()));
|
||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogNormal->getSecondPointId()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -146,19 +148,19 @@ void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
|||
|
||||
void VToolNormal::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "normal");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "typeLine", typeLine);
|
||||
AddAttribute(domElement, "length", formula);
|
||||
AddAttribute(domElement, "angle", angle);
|
||||
AddAttribute(domElement, "firstPoint", basePointId);
|
||||
AddAttribute(domElement, "secondPoint", secondPointId);
|
||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
||||
AddAttribute(domElement, AttrLength, formula);
|
||||
AddAttribute(domElement, AttrAngle, angle);
|
||||
AddAttribute(domElement, AttrFirstPoint, basePointId);
|
||||
AddAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||
|
||||
AddToCalculation(domElement);
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
Tool::Sources typeCreation);
|
||||
static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length,
|
||||
const qreal &angle = 0);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "vtoolpoint.h"
|
||||
|
||||
const QString VToolPoint::TagName = QStringLiteral("point");
|
||||
|
||||
VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id,
|
||||
QGraphicsItem *parent):VDrawTool(doc, data, id),
|
||||
QGraphicsEllipseItem(parent), radius(toPixel(2)), namePoint(0), lineName(0){
|
||||
|
@ -47,8 +49,8 @@ void VToolPoint::NameChangePosition(const QPointF pos){
|
|||
void VToolPoint::UpdateNamePosition(qreal mx, qreal my){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("mx", QString().setNum(toMM(mx)));
|
||||
domElement.setAttribute("my", QString().setNum(toMM(my)));
|
||||
domElement.setAttribute(AttrMx, QString().setNum(toMM(mx)));
|
||||
domElement.setAttribute(AttrMy, QString().setNum(toMM(my)));
|
||||
emit toolhaveChange();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ class VToolPoint: public VDrawTool, public QGraphicsEllipseItem{
|
|||
public:
|
||||
VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0);
|
||||
virtual ~VToolPoint(){}
|
||||
static const QString TagName;
|
||||
public slots:
|
||||
void NameChangePosition(const QPointF pos);
|
||||
virtual void ChangedActivDraw(const QString newName);
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "vtoolpointofcontact.h"
|
||||
#include <container/calculator.h>
|
||||
|
||||
const QString VToolPointOfContact::ToolType = QStringLiteral("pointOfContact");
|
||||
|
||||
VToolPointOfContact::VToolPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const QString &radius, const qint64 ¢er,
|
||||
const qint64 &firstPointId, const qint64 &secondPointId,
|
||||
|
@ -128,10 +130,10 @@ void VToolPointOfContact::Create(const qint64 _id, const QString &radius, const
|
|||
void VToolPointOfContact::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
radius = domElement.attribute("radius", "");
|
||||
center = domElement.attribute("center", "").toLongLong();
|
||||
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
|
||||
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
||||
radius = domElement.attribute(AttrRadius, "");
|
||||
center = domElement.attribute(AttrCenter, "").toLongLong();
|
||||
firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
||||
}
|
||||
RefreshPointGeometry(VAbstractTool::data.GetPoint(id));
|
||||
}
|
||||
|
@ -140,11 +142,11 @@ void VToolPointOfContact::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", dialogPointOfContact->getPointName());
|
||||
domElement.setAttribute("radius", dialogPointOfContact->getRadius());
|
||||
domElement.setAttribute("center", QString().setNum(dialogPointOfContact->getCenter()));
|
||||
domElement.setAttribute("firstPoint", QString().setNum(dialogPointOfContact->getFirstPoint()));
|
||||
domElement.setAttribute("secondPoint", QString().setNum(dialogPointOfContact->getSecondPoint()));
|
||||
domElement.setAttribute(AttrName, dialogPointOfContact->getPointName());
|
||||
domElement.setAttribute(AttrRadius, dialogPointOfContact->getRadius());
|
||||
domElement.setAttribute(AttrCenter, QString().setNum(dialogPointOfContact->getCenter()));
|
||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogPointOfContact->getFirstPoint()));
|
||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogPointOfContact->getSecondPoint()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -162,18 +164,18 @@ void VToolPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event
|
|||
|
||||
void VToolPointOfContact::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "pointOfContact");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "radius", radius);
|
||||
AddAttribute(domElement, "center", center);
|
||||
AddAttribute(domElement, "firstPoint", firstPointId);
|
||||
AddAttribute(domElement, "secondPoint", secondPointId);
|
||||
AddAttribute(domElement, AttrRadius, radius);
|
||||
AddAttribute(domElement, AttrCenter, center);
|
||||
AddAttribute(domElement, AttrFirstPoint, firstPointId);
|
||||
AddAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||
|
||||
AddToCalculation(domElement);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
const qint64 &firstPointId, const qint64 &secondPointId, const QString &pointName,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
|
||||
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "vtoolpointofintersection.h"
|
||||
|
||||
const QString VToolPointOfIntersection::ToolType = QStringLiteral("pointOfIntersection");
|
||||
|
||||
VToolPointOfIntersection::VToolPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const qint64 &firstPointId, const qint64 &secondPointId,
|
||||
Tool::Sources typeCreation, QGraphicsItem *parent)
|
||||
|
@ -61,8 +63,8 @@ void VToolPointOfIntersection::Create(const qint64 _id, const QString &pointName
|
|||
void VToolPointOfIntersection::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
|
||||
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
||||
firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
||||
}
|
||||
VToolPoint::RefreshPointGeometry(VDrawTool::data.GetPoint(id));
|
||||
}
|
||||
|
@ -71,9 +73,9 @@ void VToolPointOfIntersection::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", dialogPointOfIntersection->getPointName());
|
||||
domElement.setAttribute("firstPoint", QString().setNum(dialogPointOfIntersection->getFirstPointId()));
|
||||
domElement.setAttribute("secondPoint", QString().setNum(dialogPointOfIntersection->getSecondPointId()));
|
||||
domElement.setAttribute(AttrName, dialogPointOfIntersection->getPointName());
|
||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogPointOfIntersection->getFirstPointId()));
|
||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogPointOfIntersection->getSecondPointId()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -91,16 +93,16 @@ void VToolPointOfIntersection::contextMenuEvent(QGraphicsSceneContextMenuEvent *
|
|||
|
||||
void VToolPointOfIntersection::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "pointOfIntersection");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "firstPoint", firstPointId);
|
||||
AddAttribute(domElement, "secondPoint", secondPointId);
|
||||
AddAttribute(domElement, AttrFirstPoint, firstPointId);
|
||||
AddAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||
|
||||
AddToCalculation(domElement);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ public:
|
|||
const qint64 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
|
||||
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
||||
Tool::Sources typeCreation);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include "vtoolshoulderpoint.h"
|
||||
#include <QDebug>
|
||||
#include <container/calculator.h>
|
||||
|
||||
const QString VToolShoulderPoint::ToolType = QStringLiteral("shoulder");
|
||||
|
||||
VToolShoulderPoint::VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const QString &typeLine, const QString &formula, const qint64 &p1Line,
|
||||
const qint64 &p2Line, const qint64 &pShoulder, Tool::Sources typeCreation,
|
||||
|
@ -129,11 +130,11 @@ void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const
|
|||
void VToolShoulderPoint::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
typeLine = domElement.attribute("typeLine", "");
|
||||
formula = domElement.attribute("length", "");
|
||||
basePointId = domElement.attribute("p1Line", "").toLongLong();
|
||||
p2Line = domElement.attribute("p2Line", "").toLongLong();
|
||||
pShoulder = domElement.attribute("pShoulder", "").toLongLong();
|
||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||
formula = domElement.attribute(AttrLength, "");
|
||||
basePointId = domElement.attribute(AttrP1Line, "").toLongLong();
|
||||
p2Line = domElement.attribute(AttrP2Line, "").toLongLong();
|
||||
pShoulder = domElement.attribute(AttrPShoulder, "").toLongLong();
|
||||
}
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
@ -142,12 +143,12 @@ void VToolShoulderPoint::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", dialogShoulderPoint->getPointName());
|
||||
domElement.setAttribute("typeLine", dialogShoulderPoint->getTypeLine());
|
||||
domElement.setAttribute("length", dialogShoulderPoint->getFormula());
|
||||
domElement.setAttribute("p1Line", QString().setNum(dialogShoulderPoint->getP1Line()));
|
||||
domElement.setAttribute("p2Line", QString().setNum(dialogShoulderPoint->getP2Line()));
|
||||
domElement.setAttribute("pShoulder", QString().setNum(dialogShoulderPoint->getPShoulder()));
|
||||
domElement.setAttribute(AttrName, dialogShoulderPoint->getPointName());
|
||||
domElement.setAttribute(AttrTypeLine, dialogShoulderPoint->getTypeLine());
|
||||
domElement.setAttribute(AttrLength, dialogShoulderPoint->getFormula());
|
||||
domElement.setAttribute(AttrP1Line, QString().setNum(dialogShoulderPoint->getP1Line()));
|
||||
domElement.setAttribute(AttrP2Line, QString().setNum(dialogShoulderPoint->getP2Line()));
|
||||
domElement.setAttribute(AttrPShoulder, QString().setNum(dialogShoulderPoint->getPShoulder()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -165,19 +166,19 @@ void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||
|
||||
void VToolShoulderPoint::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "shoulder");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "typeLine", typeLine);
|
||||
AddAttribute(domElement, "length", formula);
|
||||
AddAttribute(domElement, "p1Line", basePointId);
|
||||
AddAttribute(domElement, "p2Line", p2Line);
|
||||
AddAttribute(domElement, "pShoulder", pShoulder);
|
||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
||||
AddAttribute(domElement, AttrLength, formula);
|
||||
AddAttribute(domElement, AttrP1Line, basePointId);
|
||||
AddAttribute(domElement, AttrP2Line, p2Line);
|
||||
AddAttribute(domElement, AttrPShoulder, pShoulder);
|
||||
|
||||
AddToCalculation(domElement);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ public:
|
|||
const qint64 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx,
|
||||
const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "vtoolsinglepoint.h"
|
||||
|
||||
const QString VToolSinglePoint::ToolType = QStringLiteral("single");
|
||||
|
||||
VToolSinglePoint::VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,
|
||||
QGraphicsItem * parent ):VToolPoint(doc, data, id, parent),
|
||||
dialogSinglePoint(QSharedPointer<DialogSinglePoint>()){
|
||||
|
@ -42,15 +44,15 @@ void VToolSinglePoint::setDialog(){
|
|||
|
||||
void VToolSinglePoint::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "single");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "x", toMM(point.x()));
|
||||
AddAttribute(domElement, "y", toMM(point.y()));
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrX, toMM(point.x()));
|
||||
AddAttribute(domElement, AttrY, toMM(point.y()));
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddToCalculation(domElement);
|
||||
}
|
||||
|
@ -72,8 +74,8 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change,
|
|||
QPointF newPos = value.toPointF();
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("x", QString().setNum(toMM(newPos.x())));
|
||||
domElement.setAttribute("y", QString().setNum(toMM(newPos.y())));
|
||||
domElement.setAttribute(AttrX, QString().setNum(toMM(newPos.x())));
|
||||
domElement.setAttribute(AttrY, QString().setNum(toMM(newPos.y())));
|
||||
//I don't now why but signal does not work.
|
||||
doc->FullUpdateTree();
|
||||
}
|
||||
|
@ -101,9 +103,9 @@ void VToolSinglePoint::FullUpdateFromGui(int result){
|
|||
QString name = dialogSinglePoint->getName();
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", name);
|
||||
domElement.setAttribute("x", QString().setNum(toMM(p.x())));
|
||||
domElement.setAttribute("y", QString().setNum(toMM(p.y())));
|
||||
domElement.setAttribute(AttrName, name);
|
||||
domElement.setAttribute(AttrX, QString().setNum(toMM(p.x())));
|
||||
domElement.setAttribute(AttrY, QString().setNum(toMM(p.y())));
|
||||
//I don't now why but signal does not work.
|
||||
doc->FullUpdateTree();
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ public:
|
|||
VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,
|
||||
QGraphicsItem * parent = 0 );
|
||||
virtual void setDialog();
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include "vtoolspline.h"
|
||||
#include <QDebug>
|
||||
#include "geometry/vspline.h"
|
||||
|
||||
const QString VToolSpline::TagName = QStringLiteral("spline");
|
||||
const QString VToolSpline::ToolType = QStringLiteral("simple");
|
||||
|
||||
VToolSpline::VToolSpline(VDomDocument *doc, VContainer *data, qint64 id,
|
||||
Tool::Sources typeCreation,
|
||||
|
@ -141,13 +142,13 @@ void VToolSpline::FullUpdateFromGui(int result){
|
|||
controlPoints[1]->pos(), dialogSpline->getP4(), dialogSpline->getKCurve());
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("point1", QString().setNum(spl.GetP1()));
|
||||
domElement.setAttribute("point4", QString().setNum(spl.GetP4()));
|
||||
domElement.setAttribute("angle1", QString().setNum(spl.GetAngle1()));
|
||||
domElement.setAttribute("angle2", QString().setNum(spl.GetAngle2()));
|
||||
domElement.setAttribute("kAsm1", QString().setNum(spl.GetKasm1()));
|
||||
domElement.setAttribute("kAsm2", QString().setNum(spl.GetKasm2()));
|
||||
domElement.setAttribute("kCurve", QString().setNum(spl.GetKcurve()));
|
||||
domElement.setAttribute(AttrPoint1, QString().setNum(spl.GetP1()));
|
||||
domElement.setAttribute(AttrPoint4, QString().setNum(spl.GetP4()));
|
||||
domElement.setAttribute(AttrAngle1, QString().setNum(spl.GetAngle1()));
|
||||
domElement.setAttribute(AttrAngle2, QString().setNum(spl.GetAngle2()));
|
||||
domElement.setAttribute(AttrKAsm1, QString().setNum(spl.GetKasm1()));
|
||||
domElement.setAttribute(AttrKAsm2, QString().setNum(spl.GetKasm2()));
|
||||
domElement.setAttribute(AttrKCurve, QString().setNum(spl.GetKcurve()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -165,11 +166,11 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, SplinePo
|
|||
}
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("angle1", QString().setNum(spl.GetAngle1()));
|
||||
domElement.setAttribute("angle2", QString().setNum(spl.GetAngle2()));
|
||||
domElement.setAttribute("kAsm1", QString().setNum(spl.GetKasm1()));
|
||||
domElement.setAttribute("kAsm2", QString().setNum(spl.GetKasm2()));
|
||||
domElement.setAttribute("kCurve", QString().setNum(spl.GetKcurve()));
|
||||
domElement.setAttribute(AttrAngle1, QString().setNum(spl.GetAngle1()));
|
||||
domElement.setAttribute(AttrAngle2, QString().setNum(spl.GetAngle2()));
|
||||
domElement.setAttribute(AttrKAsm1, QString().setNum(spl.GetKasm1()));
|
||||
domElement.setAttribute(AttrKAsm2, QString().setNum(spl.GetKasm2()));
|
||||
domElement.setAttribute(AttrKCurve, QString().setNum(spl.GetKcurve()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -180,17 +181,17 @@ void VToolSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
|||
|
||||
void VToolSpline::AddToFile(){
|
||||
VSpline spl = VAbstractTool::data.GetSpline(id);
|
||||
QDomElement domElement = doc->createElement("spline");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "simple");
|
||||
AddAttribute(domElement, "point1", spl.GetP1());
|
||||
AddAttribute(domElement, "point4", spl.GetP4());
|
||||
AddAttribute(domElement, "angle1", spl.GetAngle1());
|
||||
AddAttribute(domElement, "angle2", spl.GetAngle2());
|
||||
AddAttribute(domElement, "kAsm1", spl.GetKasm1());
|
||||
AddAttribute(domElement, "kAsm2", spl.GetKasm2());
|
||||
AddAttribute(domElement, "kCurve", spl.GetKcurve());
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrPoint1, spl.GetP1());
|
||||
AddAttribute(domElement, AttrPoint4, spl.GetP4());
|
||||
AddAttribute(domElement, AttrAngle1, spl.GetAngle1());
|
||||
AddAttribute(domElement, AttrAngle2, spl.GetAngle2());
|
||||
AddAttribute(domElement, AttrKAsm1, spl.GetKasm1());
|
||||
AddAttribute(domElement, AttrKAsm2, spl.GetKasm2());
|
||||
AddAttribute(domElement, AttrKCurve, spl.GetKcurve());
|
||||
|
||||
AddToCalculation(domElement);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,8 @@ public:
|
|||
const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
|
||||
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString TagName;
|
||||
static const QString ToolType;
|
||||
signals:
|
||||
void RefreshLine ( const qint32 &indexSpline, SplinePoint::Position position, const QPointF &controlPoint,
|
||||
const QPointF &splinePoint );
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
|
||||
#include "vtoolsplinepath.h"
|
||||
|
||||
const QString VToolSplinePath::TagName = QStringLiteral("spline");
|
||||
const QString VToolSplinePath::ToolType = QStringLiteral("path");
|
||||
|
||||
VToolSplinePath::VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id,
|
||||
Tool::Sources typeCreation,
|
||||
QGraphicsItem *parent):VDrawTool(doc, data, id),
|
||||
|
@ -129,7 +132,7 @@ void VToolSplinePath::FullUpdateFromGui(int result){
|
|||
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("kCurve", QString().setNum(splPath.getKCurve()));
|
||||
domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve()));
|
||||
UpdatePathPoint(domElement, splPath);
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
|
@ -152,7 +155,7 @@ void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, Spli
|
|||
CorectControlPoints(spl, splPath, indexSpline);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("kCurve", QString().setNum(splPath.getKCurve()));
|
||||
domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve()));
|
||||
UpdatePathPoint(domElement, splPath);
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
|
@ -178,10 +181,10 @@ void VToolSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path){
|
|||
QDomElement domElement = nodeList.at(i).toElement();
|
||||
if(!domElement.isNull()){
|
||||
VSplinePoint p = path[i];
|
||||
domElement.setAttribute("pSpline", QString().setNum(p.P()));
|
||||
domElement.setAttribute("kAsm1", QString().setNum(p.KAsm1()));
|
||||
domElement.setAttribute("kAsm2", QString().setNum(p.KAsm2()));
|
||||
domElement.setAttribute("angle", QString().setNum(p.Angle2()));
|
||||
domElement.setAttribute(AttrPSpline, QString().setNum(p.P()));
|
||||
domElement.setAttribute(AttrKAsm1, QString().setNum(p.KAsm1()));
|
||||
domElement.setAttribute(AttrKAsm2, QString().setNum(p.KAsm2()));
|
||||
domElement.setAttribute(AttrAngle, QString().setNum(p.Angle2()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -217,11 +220,11 @@ void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
|||
|
||||
void VToolSplinePath::AddToFile(){
|
||||
VSplinePath splPath = VAbstractTool::data.GetSplinePath(id);
|
||||
QDomElement domElement = doc->createElement("spline");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "path");
|
||||
AddAttribute(domElement, "kCurve", splPath.getKCurve());
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrKCurve, splPath.getKCurve());
|
||||
|
||||
for(qint32 i = 0; i < splPath.CountPoint(); ++i){
|
||||
AddPathPoint(domElement, splPath[i]);
|
||||
|
@ -231,12 +234,12 @@ void VToolSplinePath::AddToFile(){
|
|||
}
|
||||
|
||||
void VToolSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint){
|
||||
QDomElement pathPoint = doc->createElement("pathPoint");
|
||||
QDomElement pathPoint = doc->createElement(AttrPathPoint);
|
||||
|
||||
AddAttribute(pathPoint, "pSpline", splPoint.P());
|
||||
AddAttribute(pathPoint, "kAsm1", splPoint.KAsm1());
|
||||
AddAttribute(pathPoint, "kAsm2", splPoint.KAsm2());
|
||||
AddAttribute(pathPoint, "angle", splPoint.Angle2());
|
||||
AddAttribute(pathPoint, AttrPSpline, splPoint.P());
|
||||
AddAttribute(pathPoint, AttrKAsm1, splPoint.KAsm1());
|
||||
AddAttribute(pathPoint, AttrKAsm2, splPoint.KAsm2());
|
||||
AddAttribute(pathPoint, AttrAngle, splPoint.Angle2());
|
||||
|
||||
domElement.appendChild(pathPoint);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@ public:
|
|||
static void Create(const qint64 _id, const VSplinePath &path, VMainGraphicsScene *scene,
|
||||
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
||||
Tool::Sources typeCreation);
|
||||
static const QString TagName;
|
||||
static const QString ToolType;
|
||||
signals:
|
||||
void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos,
|
||||
const QPointF &controlPoint, const QPointF &splinePoint);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "vtooltriangle.h"
|
||||
|
||||
const QString VToolTriangle::ToolType = QStringLiteral("triangle");
|
||||
|
||||
VToolTriangle::VToolTriangle(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const qint64 &axisP1Id, const qint64 &axisP2Id, const qint64 &firstPointId,
|
||||
const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem *parent)
|
||||
|
@ -104,10 +106,10 @@ QPointF VToolTriangle::FindPoint(const QPointF axisP1, const QPointF axisP2, con
|
|||
void VToolTriangle::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
axisP1Id = domElement.attribute("axisP1", "").toLongLong();
|
||||
axisP2Id = domElement.attribute("axisP2", "").toLongLong();
|
||||
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
|
||||
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
||||
axisP1Id = domElement.attribute(AttrAxisP1, "").toLongLong();
|
||||
axisP2Id = domElement.attribute(AttrAxisP2, "").toLongLong();
|
||||
firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
||||
}
|
||||
VToolPoint::RefreshPointGeometry(VDrawTool::data.GetPoint(id));
|
||||
}
|
||||
|
@ -116,11 +118,11 @@ void VToolTriangle::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", dialogTriangle->getPointName());
|
||||
domElement.setAttribute("axisP1", QString().setNum(dialogTriangle->getAxisP1Id()));
|
||||
domElement.setAttribute("axisP2", QString().setNum(dialogTriangle->getAxisP2Id()));
|
||||
domElement.setAttribute("firstPoint", QString().setNum(dialogTriangle->getFirstPointId()));
|
||||
domElement.setAttribute("secondPoint", QString().setNum(dialogTriangle->getSecondPointId()));
|
||||
domElement.setAttribute(AttrName, dialogTriangle->getPointName());
|
||||
domElement.setAttribute(AttrAxisP1, QString().setNum(dialogTriangle->getAxisP1Id()));
|
||||
domElement.setAttribute(AttrAxisP2, QString().setNum(dialogTriangle->getAxisP2Id()));
|
||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogTriangle->getFirstPointId()));
|
||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogTriangle->getSecondPointId()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
|
||||
|
@ -141,18 +143,18 @@ void VToolTriangle::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
|||
|
||||
void VToolTriangle::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "triangle");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "axisP1", axisP1Id);
|
||||
AddAttribute(domElement, "axisP2", axisP2Id);
|
||||
AddAttribute(domElement, "firstPoint", firstPointId);
|
||||
AddAttribute(domElement, "secondPoint", secondPointId);
|
||||
AddAttribute(domElement, AttrAxisP1, axisP1Id);
|
||||
AddAttribute(domElement, AttrAxisP2, axisP2Id);
|
||||
AddAttribute(domElement, AttrFirstPoint, firstPointId);
|
||||
AddAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||
|
||||
AddToCalculation(domElement);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static QPointF FindPoint(const QPointF axisP1, const QPointF axisP2, const QPointF firstPoint,
|
||||
const QPointF secondPoint);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "vmodelingalongline.h"
|
||||
#include "container/calculator.h"
|
||||
|
||||
const QString VModelingAlongLine::ToolType = QStringLiteral("alongLine");
|
||||
|
||||
VModelingAlongLine::VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id,
|
||||
const QString &formula, const qint64 &firstPointId,
|
||||
const qint64 &secondPointId, const QString &typeLine,
|
||||
|
@ -37,10 +39,10 @@ VModelingAlongLine::VModelingAlongLine(VDomDocument *doc, VContainer *data, qint
|
|||
void VModelingAlongLine::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
typeLine = domElement.attribute("typeLine", "");
|
||||
formula = domElement.attribute("length", "");
|
||||
basePointId = domElement.attribute("firstPoint", "").toLongLong();
|
||||
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||
formula = domElement.attribute(AttrLength, "");
|
||||
basePointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
||||
}
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
@ -49,11 +51,11 @@ void VModelingAlongLine::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", dialogAlongLine->getPointName());
|
||||
domElement.setAttribute("typeLine", dialogAlongLine->getTypeLine());
|
||||
domElement.setAttribute("length", dialogAlongLine->getFormula());
|
||||
domElement.setAttribute("firstPoint", QString().setNum(dialogAlongLine->getFirstPointId()));
|
||||
domElement.setAttribute("secondPoint", QString().setNum(dialogAlongLine->getSecondPointId()));
|
||||
domElement.setAttribute(AttrName, dialogAlongLine->getPointName());
|
||||
domElement.setAttribute(AttrTypeLine, dialogAlongLine->getTypeLine());
|
||||
domElement.setAttribute(AttrLength, dialogAlongLine->getFormula());
|
||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogAlongLine->getFirstPointId()));
|
||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogAlongLine->getSecondPointId()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
|
||||
|
@ -67,18 +69,18 @@ void VModelingAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||
|
||||
void VModelingAlongLine::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetModelingPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "alongLine");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "typeLine", typeLine);
|
||||
AddAttribute(domElement, "length", formula);
|
||||
AddAttribute(domElement, "firstPoint", basePointId);
|
||||
AddAttribute(domElement, "secondPoint", secondPointId);
|
||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
||||
AddAttribute(domElement, AttrLength, formula);
|
||||
AddAttribute(domElement, AttrFirstPoint, basePointId);
|
||||
AddAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||
|
||||
AddToModeling(domElement);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId,
|
||||
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#include "vmodelingarc.h"
|
||||
#include "container/calculator.h"
|
||||
|
||||
const QString VModelingArc::TagName = QStringLiteral("arc");
|
||||
const QString VModelingArc::ToolType = QStringLiteral("simple");
|
||||
|
||||
VModelingArc::VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,
|
||||
QGraphicsItem *parent):VModelingTool(doc, data, id), QGraphicsPathItem(parent),
|
||||
dialogArc(QSharedPointer<DialogArc>()){
|
||||
|
@ -106,10 +109,10 @@ void VModelingArc::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("center", QString().setNum(dialogArc->GetCenter()));
|
||||
domElement.setAttribute("radius", dialogArc->GetRadius());
|
||||
domElement.setAttribute("angle1", dialogArc->GetF1());
|
||||
domElement.setAttribute("angle2", dialogArc->GetF2());
|
||||
domElement.setAttribute(AttrCenter, QString().setNum(dialogArc->GetCenter()));
|
||||
domElement.setAttribute(AttrRadius, dialogArc->GetRadius());
|
||||
domElement.setAttribute(AttrAngle1, dialogArc->GetF1());
|
||||
domElement.setAttribute(AttrAngle2, dialogArc->GetF2());
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -122,14 +125,14 @@ void VModelingArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
|||
|
||||
void VModelingArc::AddToFile(){
|
||||
VArc arc = VAbstractTool::data.GetModelingArc(id);
|
||||
QDomElement domElement = doc->createElement("arc");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "simple");
|
||||
AddAttribute(domElement, "center", arc.GetCenter());
|
||||
AddAttribute(domElement, "radius", arc.GetFormulaRadius());
|
||||
AddAttribute(domElement, "angle1", arc.GetFormulaF1());
|
||||
AddAttribute(domElement, "angle2", arc.GetFormulaF2());
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrCenter, arc.GetCenter());
|
||||
AddAttribute(domElement, AttrRadius, arc.GetFormulaRadius());
|
||||
AddAttribute(domElement, AttrAngle1, arc.GetFormulaF1());
|
||||
AddAttribute(domElement, AttrAngle2, arc.GetFormulaF2());
|
||||
|
||||
AddToModeling(domElement);
|
||||
}
|
||||
|
|
|
@ -37,6 +37,8 @@ public:
|
|||
static VModelingArc* Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1,
|
||||
const QString &f2, VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString TagName;
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include "../drawTools/vtoolbisector.h"
|
||||
#include <container/calculator.h>
|
||||
|
||||
const QString VModelingBisector::ToolType = QStringLiteral("bisector");
|
||||
|
||||
VModelingBisector::VModelingBisector(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const QString &typeLine, const QString &formula, const qint64 &firstPointId,
|
||||
const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Sources typeCreation,
|
||||
|
@ -104,11 +106,11 @@ VModelingBisector *VModelingBisector::Create(const qint64 _id, const QString &fo
|
|||
void VModelingBisector::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
typeLine = domElement.attribute("typeLine", "");
|
||||
formula = domElement.attribute("length", "");
|
||||
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
|
||||
basePointId = domElement.attribute("secondPoint", "").toLongLong();
|
||||
thirdPointId = domElement.attribute("thirdPoint", "").toLongLong();
|
||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||
formula = domElement.attribute(AttrLength, "");
|
||||
firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
||||
basePointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
||||
thirdPointId = domElement.attribute(AttrThirdPoint, "").toLongLong();
|
||||
}
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
@ -117,12 +119,12 @@ void VModelingBisector::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", dialogBisector->getPointName());
|
||||
domElement.setAttribute("typeLine", dialogBisector->getTypeLine());
|
||||
domElement.setAttribute("length", dialogBisector->getFormula());
|
||||
domElement.setAttribute("firstPoint", QString().setNum(dialogBisector->getFirstPointId()));
|
||||
domElement.setAttribute("secondPoint", QString().setNum(dialogBisector->getSecondPointId()));
|
||||
domElement.setAttribute("thirdPoint", QString().setNum(dialogBisector->getThirdPointId()));
|
||||
domElement.setAttribute(AttrName, dialogBisector->getPointName());
|
||||
domElement.setAttribute(AttrTypeLine, dialogBisector->getTypeLine());
|
||||
domElement.setAttribute(AttrLength, dialogBisector->getFormula());
|
||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogBisector->getFirstPointId()));
|
||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogBisector->getSecondPointId()));
|
||||
domElement.setAttribute(AttrThirdPoint, QString().setNum(dialogBisector->getThirdPointId()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -135,19 +137,19 @@ void VModelingBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
|||
|
||||
void VModelingBisector::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetModelingPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "bisector");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "typeLine", typeLine);
|
||||
AddAttribute(domElement, "length", formula);
|
||||
AddAttribute(domElement, "firstPoint", firstPointId);
|
||||
AddAttribute(domElement, "secondPoint", basePointId);
|
||||
AddAttribute(domElement, "thirdPoint", thirdPointId);
|
||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
||||
AddAttribute(domElement, AttrLength, formula);
|
||||
AddAttribute(domElement, AttrFirstPoint, firstPointId);
|
||||
AddAttribute(domElement, AttrSecondPoint, basePointId);
|
||||
AddAttribute(domElement, AttrThirdPoint, thirdPointId);
|
||||
|
||||
AddToModeling(domElement);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ public:
|
|||
const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine,
|
||||
const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc,
|
||||
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "vmodelingendline.h"
|
||||
#include <container/calculator.h>
|
||||
|
||||
const QString VModelingEndLine::ToolType = QStringLiteral("endLine");
|
||||
|
||||
VModelingEndLine::VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const QString &typeLine, const QString &formula, const qreal &angle,
|
||||
const qint64 &basePointId, Tool::Sources typeCreation,
|
||||
|
@ -91,10 +93,10 @@ VModelingEndLine *VModelingEndLine::Create(const qint64 _id, const QString &poin
|
|||
void VModelingEndLine::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
typeLine = domElement.attribute("typeLine", "");
|
||||
formula = domElement.attribute("length", "");
|
||||
basePointId = domElement.attribute("basePoint", "").toLongLong();
|
||||
angle = domElement.attribute("angle", "").toDouble();
|
||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||
formula = domElement.attribute(AttrLength, "");
|
||||
basePointId = domElement.attribute(AttrBasePoint, "").toLongLong();
|
||||
angle = domElement.attribute(AttrAngle, "").toDouble();
|
||||
}
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
@ -107,11 +109,11 @@ void VModelingEndLine::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", dialogEndLine->getPointName());
|
||||
domElement.setAttribute("typeLine", dialogEndLine->getTypeLine());
|
||||
domElement.setAttribute("length", dialogEndLine->getFormula());
|
||||
domElement.setAttribute("angle", QString().setNum(dialogEndLine->getAngle()));
|
||||
domElement.setAttribute("basePoint", QString().setNum(dialogEndLine->getBasePointId()));
|
||||
domElement.setAttribute(AttrName, dialogEndLine->getPointName());
|
||||
domElement.setAttribute(AttrTypeLine, dialogEndLine->getTypeLine());
|
||||
domElement.setAttribute(AttrLength, dialogEndLine->getFormula());
|
||||
domElement.setAttribute(AttrAngle, QString().setNum(dialogEndLine->getAngle()));
|
||||
domElement.setAttribute(AttrBasePoint, QString().setNum(dialogEndLine->getBasePointId()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -120,18 +122,18 @@ void VModelingEndLine::FullUpdateFromGui(int result){
|
|||
|
||||
void VModelingEndLine::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetModelingPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "endLine");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "typeLine", typeLine);
|
||||
AddAttribute(domElement, "length", formula);
|
||||
AddAttribute(domElement, "angle", angle);
|
||||
AddAttribute(domElement, "basePoint", basePointId);
|
||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
||||
AddAttribute(domElement, AttrLength, formula);
|
||||
AddAttribute(domElement, AttrAngle, angle);
|
||||
AddAttribute(domElement, AttrBasePoint, basePointId);
|
||||
|
||||
AddToModeling(domElement);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
const QString &formula, const qreal &angle, const qint64 &basePointId,
|
||||
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "vmodelingheight.h"
|
||||
#include "../drawTools/vtoolheight.h"
|
||||
|
||||
const QString VModelingHeight::ToolType = QStringLiteral("height");
|
||||
|
||||
VModelingHeight::VModelingHeight(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const QString &typeLine, const qint64 &basePointId, const qint64 &p1LineId,
|
||||
const qint64 &p2LineId, Tool::Sources typeCreation,
|
||||
|
@ -71,10 +73,10 @@ VModelingHeight *VModelingHeight::Create(const qint64 _id, const QString &pointN
|
|||
void VModelingHeight::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
typeLine = domElement.attribute("typeLine", "");
|
||||
basePointId = domElement.attribute("basePoint", "").toLongLong();
|
||||
p1LineId = domElement.attribute("p1Line", "").toLongLong();
|
||||
p2LineId = domElement.attribute("p2Line", "").toLongLong();
|
||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||
basePointId = domElement.attribute(AttrBasePoint, "").toLongLong();
|
||||
p1LineId = domElement.attribute(AttrP1Line, "").toLongLong();
|
||||
p2LineId = domElement.attribute(AttrP2Line, "").toLongLong();
|
||||
}
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
@ -83,11 +85,11 @@ void VModelingHeight::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", dialogHeight->getPointName());
|
||||
domElement.setAttribute("typeLine", dialogHeight->getTypeLine());
|
||||
domElement.setAttribute("basePoint", QString().setNum(dialogHeight->getBasePointId()));
|
||||
domElement.setAttribute("p1Line", QString().setNum(dialogHeight->getP1LineId()));
|
||||
domElement.setAttribute("p2Line", QString().setNum(dialogHeight->getP2LineId()));
|
||||
domElement.setAttribute(AttrName, dialogHeight->getPointName());
|
||||
domElement.setAttribute(AttrTypeLine, dialogHeight->getTypeLine());
|
||||
domElement.setAttribute(AttrBasePoint, QString().setNum(dialogHeight->getBasePointId()));
|
||||
domElement.setAttribute(AttrP1Line, QString().setNum(dialogHeight->getP1LineId()));
|
||||
domElement.setAttribute(AttrP2Line, QString().setNum(dialogHeight->getP2LineId()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -100,18 +102,18 @@ void VModelingHeight::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
|||
|
||||
void VModelingHeight::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetModelingPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "endLine");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "typeLine", typeLine);
|
||||
AddAttribute(domElement, "basePoint", basePointId);
|
||||
AddAttribute(domElement, "p1Line", p1LineId);
|
||||
AddAttribute(domElement, "p2Line", p2LineId);
|
||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
||||
AddAttribute(domElement, AttrBasePoint, basePointId);
|
||||
AddAttribute(domElement, AttrP1Line, p1LineId);
|
||||
AddAttribute(domElement, AttrP2Line, p2LineId);
|
||||
|
||||
AddToModeling(domElement);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId,
|
||||
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "vmodelingline.h"
|
||||
|
||||
const QString VModelingLine::TagName = QStringLiteral("line");
|
||||
|
||||
VModelingLine::VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint,
|
||||
qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem *parent):
|
||||
VModelingTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint),
|
||||
|
@ -79,8 +81,8 @@ VModelingLine *VModelingLine::Create(const qint64 &_id, const qint64 &firstPoint
|
|||
void VModelingLine::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
firstPoint = domElement.attribute("firstPoint", "").toLongLong();
|
||||
secondPoint = domElement.attribute("secondPoint", "").toLongLong();
|
||||
firstPoint = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
||||
secondPoint = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
||||
}
|
||||
VPointF first = VAbstractTool::data.GetModelingPoint(firstPoint);
|
||||
VPointF second = VAbstractTool::data.GetModelingPoint(secondPoint);
|
||||
|
@ -91,8 +93,8 @@ void VModelingLine::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("firstPoint", QString().setNum(dialogLine->getFirstPoint()));
|
||||
domElement.setAttribute("secondPoint", QString().setNum(dialogLine->getSecondPoint()));
|
||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogLine->getFirstPoint()));
|
||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogLine->getSecondPoint()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -104,10 +106,10 @@ void VModelingLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
|||
}
|
||||
|
||||
void VModelingLine::AddToFile(){
|
||||
QDomElement domElement = doc->createElement("line");
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "firstPoint", firstPoint);
|
||||
AddAttribute(domElement, "secondPoint", secondPoint);
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrFirstPoint, firstPoint);
|
||||
AddAttribute(domElement, AttrSecondPoint, secondPoint);
|
||||
|
||||
AddToModeling(domElement);
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ public:
|
|||
static VModelingLine* Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint,
|
||||
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
||||
Tool::Sources typeCreation);
|
||||
static const QString TagName;
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "vmodelinglineintersect.h"
|
||||
|
||||
const QString VModelingLineIntersect::ToolType = QStringLiteral("lineIntersect");
|
||||
|
||||
VModelingLineIntersect::VModelingLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2,
|
||||
const qint64 &p2Line2, Tool::Sources typeCreation, QGraphicsItem *parent):
|
||||
|
@ -101,10 +103,10 @@ VModelingLineIntersect *VModelingLineIntersect::Create(const qint64 _id, const q
|
|||
void VModelingLineIntersect::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
p1Line1 = domElement.attribute("p1Line1", "").toLongLong();
|
||||
p2Line1 = domElement.attribute("p2Line1", "").toLongLong();
|
||||
p1Line2 = domElement.attribute("p1Line2", "").toLongLong();
|
||||
p2Line2 = domElement.attribute("p2Line2", "").toLongLong();
|
||||
p1Line1 = domElement.attribute(AttrP1Line1, "").toLongLong();
|
||||
p2Line1 = domElement.attribute(AttrP2Line1, "").toLongLong();
|
||||
p1Line2 = domElement.attribute(AttrP1Line2, "").toLongLong();
|
||||
p2Line2 = domElement.attribute(AttrP2Line2, "").toLongLong();
|
||||
}
|
||||
RefreshPointGeometry(VAbstractTool::data.GetModelingPoint(id));
|
||||
}
|
||||
|
@ -113,11 +115,11 @@ void VModelingLineIntersect::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", dialogLineIntersect->getPointName());
|
||||
domElement.setAttribute("p1Line1", QString().setNum(dialogLineIntersect->getP1Line1()));
|
||||
domElement.setAttribute("p2Line1", QString().setNum(dialogLineIntersect->getP2Line1()));
|
||||
domElement.setAttribute("p1Line2", QString().setNum(dialogLineIntersect->getP1Line2()));
|
||||
domElement.setAttribute("p2Line2", QString().setNum(dialogLineIntersect->getP2Line2()));
|
||||
domElement.setAttribute(AttrName, dialogLineIntersect->getPointName());
|
||||
domElement.setAttribute(AttrP1Line1, QString().setNum(dialogLineIntersect->getP1Line1()));
|
||||
domElement.setAttribute(AttrP2Line1, QString().setNum(dialogLineIntersect->getP2Line1()));
|
||||
domElement.setAttribute(AttrP1Line2, QString().setNum(dialogLineIntersect->getP1Line2()));
|
||||
domElement.setAttribute(AttrP2Line2, QString().setNum(dialogLineIntersect->getP2Line2()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -130,18 +132,18 @@ void VModelingLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *ev
|
|||
|
||||
void VModelingLineIntersect::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetModelingPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "lineIntersect");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "p1Line1", p1Line1);
|
||||
AddAttribute(domElement, "p2Line1", p2Line1);
|
||||
AddAttribute(domElement, "p1Line2", p1Line2);
|
||||
AddAttribute(domElement, "p2Line2", p2Line2);
|
||||
AddAttribute(domElement, AttrP1Line1, p1Line1);
|
||||
AddAttribute(domElement, AttrP2Line1, p2Line1);
|
||||
AddAttribute(domElement, AttrP1Line2, p1Line2);
|
||||
AddAttribute(domElement, AttrP2Line2, p2Line2);
|
||||
|
||||
AddToModeling(domElement);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ public:
|
|||
const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName,
|
||||
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -32,7 +32,7 @@ VModelingLinePoint::VModelingLinePoint(VDomDocument *doc, VContainer *data, cons
|
|||
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);
|
||||
mainLine->setPen(QPen(Qt::black, widthHairLine));
|
||||
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
||||
if(typeLine == "none"){
|
||||
if(typeLine == TypeLineNone){
|
||||
mainLine->setVisible(false);
|
||||
} else {
|
||||
mainLine->setVisible(true);
|
||||
|
@ -44,7 +44,7 @@ void VModelingLinePoint::RefreshGeometry(){
|
|||
QPointF point = VModelingTool::data.GetModelingPoint(id).toQPointF();
|
||||
QPointF basePoint = VModelingTool::data.GetModelingPoint(basePointId).toQPointF();
|
||||
mainLine->setLine(QLineF(basePoint - point, QPointF()));
|
||||
if(typeLine == "none"){
|
||||
if(typeLine == TypeLineNone){
|
||||
mainLine->setVisible(false);
|
||||
} else {
|
||||
mainLine->setVisible(true);
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include "../drawTools/vtoolnormal.h"
|
||||
#include <container/calculator.h>
|
||||
|
||||
const QString VModelingNormal::ToolType = QStringLiteral("normal");
|
||||
|
||||
VModelingNormal::VModelingNormal(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const QString &typeLine,
|
||||
const QString &formula, const qreal &angle, const qint64 &firstPointId,
|
||||
|
@ -99,11 +101,11 @@ VModelingNormal *VModelingNormal::Create(const qint64 _id, const QString &formul
|
|||
void VModelingNormal::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
typeLine = domElement.attribute("typeLine", "");
|
||||
formula = domElement.attribute("length", "");
|
||||
basePointId = domElement.attribute("firstPoint", "").toLongLong();
|
||||
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
||||
angle = domElement.attribute("angle", "").toInt();
|
||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||
formula = domElement.attribute(AttrLength, "");
|
||||
basePointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
||||
angle = domElement.attribute(AttrAngle, "").toInt();
|
||||
}
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
@ -112,12 +114,12 @@ void VModelingNormal::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", dialogNormal->getPointName());
|
||||
domElement.setAttribute("typeLine", dialogNormal->getTypeLine());
|
||||
domElement.setAttribute("length", dialogNormal->getFormula());
|
||||
domElement.setAttribute("angle", QString().setNum(dialogNormal->getAngle()));
|
||||
domElement.setAttribute("firstPoint", QString().setNum(dialogNormal->getFirstPointId()));
|
||||
domElement.setAttribute("secondPoint", QString().setNum(dialogNormal->getSecondPointId()));
|
||||
domElement.setAttribute(AttrName, dialogNormal->getPointName());
|
||||
domElement.setAttribute(AttrTypeLine, dialogNormal->getTypeLine());
|
||||
domElement.setAttribute(AttrLength, dialogNormal->getFormula());
|
||||
domElement.setAttribute(AttrAngle, QString().setNum(dialogNormal->getAngle()));
|
||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogNormal->getFirstPointId()));
|
||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogNormal->getSecondPointId()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -130,19 +132,19 @@ void VModelingNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
|||
|
||||
void VModelingNormal::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetModelingPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "normal");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "typeLine", typeLine);
|
||||
AddAttribute(domElement, "length", formula);
|
||||
AddAttribute(domElement, "angle", angle);
|
||||
AddAttribute(domElement, "firstPoint", basePointId);
|
||||
AddAttribute(domElement, "secondPoint", secondPointId);
|
||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
||||
AddAttribute(domElement, AttrLength, formula);
|
||||
AddAttribute(domElement, AttrAngle, angle);
|
||||
AddAttribute(domElement, AttrFirstPoint, basePointId);
|
||||
AddAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||
|
||||
AddToModeling(domElement);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
const qint64 &secondPointId, const QString typeLine, const QString pointName,
|
||||
const qreal angle, const qreal &mx, const qreal &my, VDomDocument *doc,
|
||||
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "vmodelingpoint.h"
|
||||
#include "container/vpointf.h"
|
||||
|
||||
const QString VModelingPoint::TagName = QStringLiteral("point");
|
||||
|
||||
VModelingPoint::VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id,
|
||||
QGraphicsItem *parent):VModelingTool(doc, data, id),
|
||||
QGraphicsEllipseItem(parent), radius(toPixel(1.5)), namePoint(0), lineName(0){
|
||||
|
@ -49,8 +51,8 @@ void VModelingPoint::NameChangePosition(const QPointF pos){
|
|||
void VModelingPoint::UpdateNamePosition(qreal mx, qreal my){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("mx", QString().setNum(toMM(mx)));
|
||||
domElement.setAttribute("my", QString().setNum(toMM(my)));
|
||||
domElement.setAttribute(AttrMx, QString().setNum(toMM(mx)));
|
||||
domElement.setAttribute(AttrMy, QString().setNum(toMM(my)));
|
||||
emit toolhaveChange();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ class VModelingPoint: public VModelingTool, public QGraphicsEllipseItem{
|
|||
public:
|
||||
VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0);
|
||||
virtual ~VModelingPoint() {}
|
||||
static const QString TagName;
|
||||
public slots:
|
||||
void NameChangePosition(const QPointF pos);
|
||||
virtual void FullUpdateFromGui(int result) = 0;
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include "../drawTools/vtoolpointofcontact.h"
|
||||
#include <container/calculator.h>
|
||||
|
||||
const QString VModelingPointOfContact::ToolType = QStringLiteral("pointOfContact");
|
||||
|
||||
VModelingPointOfContact::VModelingPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const QString &radius, const qint64 ¢er,
|
||||
const qint64 &firstPointId, const qint64 &secondPointId,
|
||||
|
@ -100,10 +102,10 @@ VModelingPointOfContact *VModelingPointOfContact::Create(const qint64 _id, const
|
|||
void VModelingPointOfContact::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
radius = domElement.attribute("radius", "");
|
||||
center = domElement.attribute("center", "").toLongLong();
|
||||
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
|
||||
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
||||
radius = domElement.attribute(AttrRadius, "");
|
||||
center = domElement.attribute(AttrCenter, "").toLongLong();
|
||||
firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
||||
}
|
||||
RefreshPointGeometry(VAbstractTool::data.GetModelingPoint(id));
|
||||
}
|
||||
|
@ -112,11 +114,11 @@ void VModelingPointOfContact::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", dialogPointOfContact->getPointName());
|
||||
domElement.setAttribute("radius", dialogPointOfContact->getRadius());
|
||||
domElement.setAttribute("center", QString().setNum(dialogPointOfContact->getCenter()));
|
||||
domElement.setAttribute("firstPoint", QString().setNum(dialogPointOfContact->getFirstPoint()));
|
||||
domElement.setAttribute("secondPoint", QString().setNum(dialogPointOfContact->getSecondPoint()));
|
||||
domElement.setAttribute(AttrName, dialogPointOfContact->getPointName());
|
||||
domElement.setAttribute(AttrRadius, dialogPointOfContact->getRadius());
|
||||
domElement.setAttribute(AttrCenter, QString().setNum(dialogPointOfContact->getCenter()));
|
||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogPointOfContact->getFirstPoint()));
|
||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogPointOfContact->getSecondPoint()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -129,18 +131,18 @@ void VModelingPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *e
|
|||
|
||||
void VModelingPointOfContact::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetModelingPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "pointOfContact");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "radius", radius);
|
||||
AddAttribute(domElement, "center", center);
|
||||
AddAttribute(domElement, "firstPoint", firstPointId);
|
||||
AddAttribute(domElement, "secondPoint", secondPointId);
|
||||
AddAttribute(domElement, AttrRadius, radius);
|
||||
AddAttribute(domElement, AttrCenter, center);
|
||||
AddAttribute(domElement, AttrFirstPoint, firstPointId);
|
||||
AddAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||
|
||||
AddToModeling(domElement);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
const QString &pointName, const qreal &mx, const qreal &my,
|
||||
VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "vmodelingpointofintersection.h"
|
||||
|
||||
const QString VModelingPointOfIntersection::ToolType = QStringLiteral("pointOfIntersection");
|
||||
|
||||
VModelingPointOfIntersection::VModelingPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const qint64 &firstPointId, const qint64 &secondPointId,
|
||||
Tool::Sources typeCreation, QGraphicsItem *parent)
|
||||
|
@ -60,8 +62,8 @@ VModelingPointOfIntersection *VModelingPointOfIntersection::Create(const qint64
|
|||
void VModelingPointOfIntersection::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
|
||||
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
||||
firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
||||
}
|
||||
VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetPoint(id));
|
||||
}
|
||||
|
@ -70,9 +72,9 @@ void VModelingPointOfIntersection::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", dialogPointOfIntersection->getPointName());
|
||||
domElement.setAttribute("firstPoint", QString().setNum(dialogPointOfIntersection->getFirstPointId()));
|
||||
domElement.setAttribute("secondPoint", QString().setNum(dialogPointOfIntersection->getSecondPointId()));
|
||||
domElement.setAttribute(AttrName, dialogPointOfIntersection->getPointName());
|
||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogPointOfIntersection->getFirstPointId()));
|
||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogPointOfIntersection->getSecondPointId()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -90,16 +92,16 @@ void VModelingPointOfIntersection::contextMenuEvent(QGraphicsSceneContextMenuEve
|
|||
|
||||
void VModelingPointOfIntersection::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "pointOfIntersection");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "firstPoint", firstPointId);
|
||||
AddAttribute(domElement, "secondPoint", secondPointId);
|
||||
AddAttribute(domElement, AttrFirstPoint, firstPointId);
|
||||
AddAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||
|
||||
AddToModeling(domElement);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ public:
|
|||
const qreal &mx, const qreal &my, VDomDocument *doc,
|
||||
VContainer *data, const Document::Documents &parse,
|
||||
Tool::Sources typeCreation);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include "../drawTools/vtoolshoulderpoint.h"
|
||||
#include <container/calculator.h>
|
||||
|
||||
const QString VModelingShoulderPoint::ToolType = QStringLiteral("shoulder");
|
||||
|
||||
VModelingShoulderPoint::VModelingShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const QString &typeLine, const QString &formula, const qint64 &p1Line,
|
||||
const qint64 &p2Line, const qint64 &pShoulder, Tool::Sources typeCreation,
|
||||
|
@ -104,11 +106,11 @@ VModelingShoulderPoint *VModelingShoulderPoint::Create(const qint64 _id, const Q
|
|||
void VModelingShoulderPoint::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
typeLine = domElement.attribute("typeLine", "");
|
||||
formula = domElement.attribute("length", "");
|
||||
basePointId = domElement.attribute("p1Line", "").toLongLong();
|
||||
p2Line = domElement.attribute("p2Line", "").toLongLong();
|
||||
pShoulder = domElement.attribute("pShoulder", "").toLongLong();
|
||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||
formula = domElement.attribute(AttrLength, "");
|
||||
basePointId = domElement.attribute(AttrP1Line, "").toLongLong();
|
||||
p2Line = domElement.attribute(AttrP2Line, "").toLongLong();
|
||||
pShoulder = domElement.attribute(AttrPShoulder, "").toLongLong();
|
||||
}
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
@ -117,12 +119,12 @@ void VModelingShoulderPoint::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", dialogShoulderPoint->getPointName());
|
||||
domElement.setAttribute("typeLine", dialogShoulderPoint->getTypeLine());
|
||||
domElement.setAttribute("length", dialogShoulderPoint->getFormula());
|
||||
domElement.setAttribute("p1Line", QString().setNum(dialogShoulderPoint->getP1Line()));
|
||||
domElement.setAttribute("p2Line", QString().setNum(dialogShoulderPoint->getP2Line()));
|
||||
domElement.setAttribute("pShoulder", QString().setNum(dialogShoulderPoint->getPShoulder()));
|
||||
domElement.setAttribute(AttrName, dialogShoulderPoint->getPointName());
|
||||
domElement.setAttribute(AttrTypeLine, dialogShoulderPoint->getTypeLine());
|
||||
domElement.setAttribute(AttrLength, dialogShoulderPoint->getFormula());
|
||||
domElement.setAttribute(AttrP1Line, QString().setNum(dialogShoulderPoint->getP1Line()));
|
||||
domElement.setAttribute(AttrP2Line, QString().setNum(dialogShoulderPoint->getP2Line()));
|
||||
domElement.setAttribute(AttrPShoulder, QString().setNum(dialogShoulderPoint->getPShoulder()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -135,19 +137,19 @@ void VModelingShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *ev
|
|||
|
||||
void VModelingShoulderPoint::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetModelingPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "shoulder");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "typeLine", typeLine);
|
||||
AddAttribute(domElement, "length", formula);
|
||||
AddAttribute(domElement, "p1Line", basePointId);
|
||||
AddAttribute(domElement, "p2Line", p2Line);
|
||||
AddAttribute(domElement, "pShoulder", pShoulder);
|
||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
||||
AddAttribute(domElement, AttrLength, formula);
|
||||
AddAttribute(domElement, AttrP1Line, basePointId);
|
||||
AddAttribute(domElement, AttrP2Line, p2Line);
|
||||
AddAttribute(domElement, AttrPShoulder, pShoulder);
|
||||
|
||||
AddToModeling(domElement);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc,
|
||||
VContainer *data, const Document::Documents &parse,
|
||||
const Tool::Sources &typeCreation);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -22,8 +22,10 @@
|
|||
#include "vmodelingspline.h"
|
||||
#include "geometry/vspline.h"
|
||||
|
||||
VModelingSpline::VModelingSpline(VDomDocument *doc, VContainer *data, qint64 id,
|
||||
Tool::Sources typeCreation,
|
||||
const QString VModelingSpline::TagName = QStringLiteral("spline");
|
||||
const QString VModelingSpline::ToolType = QStringLiteral("simple");
|
||||
|
||||
VModelingSpline::VModelingSpline(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,
|
||||
QGraphicsItem *parent):VModelingTool(doc, data, id), QGraphicsPathItem(parent),
|
||||
dialogSpline(QSharedPointer<DialogSpline>()), controlPoints(QVector<VControlPointSpline *>()){
|
||||
ignoreFullUpdate = true;
|
||||
|
@ -135,13 +137,13 @@ void VModelingSpline::FullUpdateFromGui(int result){
|
|||
dialogSpline->getKCurve());
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("point1", QString().setNum(spl.GetP1()));
|
||||
domElement.setAttribute("point4", QString().setNum(spl.GetP4()));
|
||||
domElement.setAttribute("angle1", QString().setNum(spl.GetAngle1()));
|
||||
domElement.setAttribute("angle2", QString().setNum(spl.GetAngle2()));
|
||||
domElement.setAttribute("kAsm1", QString().setNum(spl.GetKasm1()));
|
||||
domElement.setAttribute("kAsm2", QString().setNum(spl.GetKasm2()));
|
||||
domElement.setAttribute("kCurve", QString().setNum(spl.GetKcurve()));
|
||||
domElement.setAttribute(AttrPoint1, QString().setNum(spl.GetP1()));
|
||||
domElement.setAttribute(AttrPoint4, QString().setNum(spl.GetP4()));
|
||||
domElement.setAttribute(AttrAngle1, QString().setNum(spl.GetAngle1()));
|
||||
domElement.setAttribute(AttrAngle2, QString().setNum(spl.GetAngle2()));
|
||||
domElement.setAttribute(AttrKAsm1, QString().setNum(spl.GetKasm1()));
|
||||
domElement.setAttribute(AttrKAsm2, QString().setNum(spl.GetKasm2()));
|
||||
domElement.setAttribute(AttrKCurve, QString().setNum(spl.GetKcurve()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -159,11 +161,11 @@ void VModelingSpline::ControlPointChangePosition(const qint32 &indexSpline, Spli
|
|||
}
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("angle1", QString().setNum(spl.GetAngle1()));
|
||||
domElement.setAttribute("angle2", QString().setNum(spl.GetAngle2()));
|
||||
domElement.setAttribute("kAsm1", QString().setNum(spl.GetKasm1()));
|
||||
domElement.setAttribute("kAsm2", QString().setNum(spl.GetKasm2()));
|
||||
domElement.setAttribute("kCurve", QString().setNum(spl.GetKcurve()));
|
||||
domElement.setAttribute(AttrAngle1, QString().setNum(spl.GetAngle1()));
|
||||
domElement.setAttribute(AttrAngle2, QString().setNum(spl.GetAngle2()));
|
||||
domElement.setAttribute(AttrKAsm1, QString().setNum(spl.GetKasm1()));
|
||||
domElement.setAttribute(AttrKAsm2, QString().setNum(spl.GetKasm2()));
|
||||
domElement.setAttribute(AttrKCurve, QString().setNum(spl.GetKcurve()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
}
|
||||
|
@ -174,17 +176,17 @@ void VModelingSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
|||
|
||||
void VModelingSpline::AddToFile(){
|
||||
VSpline spl = VAbstractTool::data.GetModelingSpline(id);
|
||||
QDomElement domElement = doc->createElement("spline");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "simple");
|
||||
AddAttribute(domElement, "point1", spl.GetP1());
|
||||
AddAttribute(domElement, "point4", spl.GetP4());
|
||||
AddAttribute(domElement, "angle1", spl.GetAngle1());
|
||||
AddAttribute(domElement, "angle2", spl.GetAngle2());
|
||||
AddAttribute(domElement, "kAsm1", spl.GetKasm1());
|
||||
AddAttribute(domElement, "kAsm2", spl.GetKasm2());
|
||||
AddAttribute(domElement, "kCurve", spl.GetKcurve());
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrPoint1, spl.GetP1());
|
||||
AddAttribute(domElement, AttrPoint4, spl.GetP4());
|
||||
AddAttribute(domElement, AttrAngle1, spl.GetAngle1());
|
||||
AddAttribute(domElement, AttrAngle2, spl.GetAngle2());
|
||||
AddAttribute(domElement, AttrKAsm1, spl.GetKasm1());
|
||||
AddAttribute(domElement, AttrKAsm2, spl.GetKasm2());
|
||||
AddAttribute(domElement, AttrKCurve, spl.GetKcurve());
|
||||
|
||||
AddToModeling(domElement);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@ public:
|
|||
const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
|
||||
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
||||
Tool::Sources typeCreation);
|
||||
static const QString TagName;
|
||||
static const QString ToolType;
|
||||
signals:
|
||||
void RefreshLine (const qint32 &indexSpline, SplinePoint::Position position,
|
||||
const QPointF &controlPoint, const QPointF &splinePoint );
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
|
||||
#include "vmodelingsplinepath.h"
|
||||
|
||||
const QString VModelingSplinePath::TagName = QStringLiteral("spline");
|
||||
const QString VModelingSplinePath::ToolType = QStringLiteral("path");
|
||||
|
||||
VModelingSplinePath::VModelingSplinePath(VDomDocument *doc, VContainer *data, qint64 id,
|
||||
Tool::Sources typeCreation,
|
||||
QGraphicsItem *parent):VModelingTool(doc, data, id),
|
||||
|
@ -125,7 +128,7 @@ void VModelingSplinePath::FullUpdateFromGui(int result){
|
|||
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("kCurve", QString().setNum(splPath.getKCurve()));
|
||||
domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve()));
|
||||
UpdatePathPoint(domElement, splPath);
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
|
@ -148,7 +151,7 @@ void VModelingSplinePath::ControlPointChangePosition(const qint32 &indexSpline,
|
|||
CorectControlPoints(spl, splPath, indexSpline);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("kCurve", QString().setNum(splPath.getKCurve()));
|
||||
domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve()));
|
||||
UpdatePathPoint(domElement, splPath);
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
|
@ -174,10 +177,10 @@ void VModelingSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path){
|
|||
QDomElement domElement = nodeList.at(i).toElement();
|
||||
if(!domElement.isNull()){
|
||||
VSplinePoint p = path[i];
|
||||
domElement.setAttribute("pSpline", QString().setNum(p.P()));
|
||||
domElement.setAttribute("kAsm1", QString().setNum(p.KAsm1()));
|
||||
domElement.setAttribute("kAsm2", QString().setNum(p.KAsm2()));
|
||||
domElement.setAttribute("angle", QString().setNum(p.Angle2()));
|
||||
domElement.setAttribute(AttrPSpline, QString().setNum(p.P()));
|
||||
domElement.setAttribute(AttrKAsm1, QString().setNum(p.KAsm1()));
|
||||
domElement.setAttribute(AttrKAsm2, QString().setNum(p.KAsm2()));
|
||||
domElement.setAttribute(AttrAngle, QString().setNum(p.Angle2()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -188,11 +191,11 @@ void VModelingSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event
|
|||
|
||||
void VModelingSplinePath::AddToFile(){
|
||||
VSplinePath splPath = VAbstractTool::data.GetModelingSplinePath(id);
|
||||
QDomElement domElement = doc->createElement("spline");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "path");
|
||||
AddAttribute(domElement, "kCurve", splPath.getKCurve());
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrKCurve, splPath.getKCurve());
|
||||
|
||||
for(qint32 i = 0; i < splPath.CountPoint(); ++i){
|
||||
AddPathPoint(domElement, splPath[i]);
|
||||
|
@ -202,12 +205,12 @@ void VModelingSplinePath::AddToFile(){
|
|||
}
|
||||
|
||||
void VModelingSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint){
|
||||
QDomElement pathPoint = doc->createElement("pathPoint");
|
||||
QDomElement pathPoint = doc->createElement(AttrPathPoint);
|
||||
|
||||
AddAttribute(pathPoint, "pSpline", splPoint.P());
|
||||
AddAttribute(pathPoint, "kAsm1", splPoint.KAsm1());
|
||||
AddAttribute(pathPoint, "kAsm2", splPoint.KAsm2());
|
||||
AddAttribute(pathPoint, "angle", splPoint.Angle2());
|
||||
AddAttribute(pathPoint, AttrPSpline, splPoint.P());
|
||||
AddAttribute(pathPoint, AttrKAsm1, splPoint.KAsm1());
|
||||
AddAttribute(pathPoint, AttrKAsm2, splPoint.KAsm2());
|
||||
AddAttribute(pathPoint, AttrAngle, splPoint.Angle2());
|
||||
|
||||
domElement.appendChild(pathPoint);
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ public:
|
|||
static VModelingSplinePath* Create(QSharedPointer<DialogSplinePath> &dialog, VDomDocument *doc, VContainer *data);
|
||||
static VModelingSplinePath* Create(const qint64 _id, const VSplinePath &path, VDomDocument *doc,
|
||||
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString TagName;
|
||||
static const QString ToolType;
|
||||
signals:
|
||||
void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, const QPointF &controlPoint,
|
||||
const QPointF &splinePoint);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#include "vmodelingtriangle.h"
|
||||
#include "../drawTools/vtooltriangle.h"
|
||||
|
||||
VModelingTriangle::VModelingTriangle(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const qint64 &axisP1Id, const qint64 &axisP2Id,
|
||||
const qint64 &firstPointId, const qint64 &secondPointId,
|
||||
const QString VModelingTriangle::ToolType = QStringLiteral("triangle");
|
||||
|
||||
VModelingTriangle::VModelingTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id,
|
||||
const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId,
|
||||
Tool::Sources typeCreation, QGraphicsItem *parent)
|
||||
:VModelingPoint(doc, data, id, parent), axisP1Id(axisP1Id), axisP2Id(axisP2Id),
|
||||
firstPointId(firstPointId), secondPointId(secondPointId),
|
||||
dialogTriangle(QSharedPointer<DialogTriangle>()) {
|
||||
:VModelingPoint(doc, data, id, parent), axisP1Id(axisP1Id), axisP2Id(axisP2Id), firstPointId(firstPointId),
|
||||
secondPointId(secondPointId), dialogTriangle(QSharedPointer<DialogTriangle>()) {
|
||||
if(typeCreation == Tool::FromGui){
|
||||
AddToFile();
|
||||
}
|
||||
|
@ -30,15 +30,14 @@ VModelingTriangle *VModelingTriangle::Create(QSharedPointer<DialogTriangle> &dia
|
|||
qint64 firstPointId = dialog->getFirstPointId();
|
||||
qint64 secondPointId = dialog->getSecondPointId();
|
||||
QString pointName = dialog->getPointName();
|
||||
return Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10, doc, data,
|
||||
Document::FullParse, Tool::FromGui);
|
||||
return Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10, doc, data, Document::FullParse,
|
||||
Tool::FromGui);
|
||||
}
|
||||
|
||||
VModelingTriangle *VModelingTriangle::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, VDomDocument *doc,
|
||||
VContainer *data, const Document::Documents &parse,
|
||||
VModelingTriangle *VModelingTriangle::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,
|
||||
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
||||
Tool::Sources typeCreation){
|
||||
VModelingTriangle *tool = 0;
|
||||
VPointF axisP1 = data->GetPoint(axisP1Id);
|
||||
|
@ -58,8 +57,7 @@ VModelingTriangle *VModelingTriangle::Create(const qint64 _id, const QString &po
|
|||
}
|
||||
}
|
||||
if(parse == Document::FullParse){
|
||||
tool = new VModelingTriangle(doc, data, id, axisP1Id, axisP2Id, firstPointId,
|
||||
secondPointId, typeCreation);
|
||||
tool = new VModelingTriangle(doc, data, id, axisP1Id, axisP2Id, firstPointId, secondPointId, typeCreation);
|
||||
doc->AddTool(id, tool);
|
||||
doc->IncrementReferens(axisP1Id);
|
||||
doc->IncrementReferens(axisP2Id);
|
||||
|
@ -72,10 +70,10 @@ VModelingTriangle *VModelingTriangle::Create(const qint64 _id, const QString &po
|
|||
void VModelingTriangle::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
axisP1Id = domElement.attribute("axisP1", "").toLongLong();
|
||||
axisP2Id = domElement.attribute("axisP2", "").toLongLong();
|
||||
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
|
||||
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
||||
axisP1Id = domElement.attribute(AttrAxisP1, "").toLongLong();
|
||||
axisP2Id = domElement.attribute(AttrAxisP2, "").toLongLong();
|
||||
firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
||||
}
|
||||
VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetPoint(id));
|
||||
}
|
||||
|
@ -84,11 +82,11 @@ void VModelingTriangle::FullUpdateFromGui(int result){
|
|||
if(result == QDialog::Accepted){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("name", dialogTriangle->getPointName());
|
||||
domElement.setAttribute("axisP1", QString().setNum(dialogTriangle->getAxisP1Id()));
|
||||
domElement.setAttribute("axisP2", QString().setNum(dialogTriangle->getAxisP2Id()));
|
||||
domElement.setAttribute("firstPoint", QString().setNum(dialogTriangle->getFirstPointId()));
|
||||
domElement.setAttribute("secondPoint", QString().setNum(dialogTriangle->getSecondPointId()));
|
||||
domElement.setAttribute(AttrName, dialogTriangle->getPointName());
|
||||
domElement.setAttribute(AttrAxisP1, QString().setNum(dialogTriangle->getAxisP1Id()));
|
||||
domElement.setAttribute(AttrAxisP2, QString().setNum(dialogTriangle->getAxisP2Id()));
|
||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogTriangle->getFirstPointId()));
|
||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogTriangle->getSecondPointId()));
|
||||
emit FullUpdateTree();
|
||||
}
|
||||
|
||||
|
@ -109,18 +107,18 @@ void VModelingTriangle::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
|||
|
||||
void VModelingTriangle::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "triangle");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "axisP1", axisP1Id);
|
||||
AddAttribute(domElement, "axisP2", axisP2Id);
|
||||
AddAttribute(domElement, "firstPoint", firstPointId);
|
||||
AddAttribute(domElement, "secondPoint", secondPointId);
|
||||
AddAttribute(domElement, AttrAxisP1, axisP1Id);
|
||||
AddAttribute(domElement, AttrAxisP2, axisP2Id);
|
||||
AddAttribute(domElement, AttrFirstPoint, firstPointId);
|
||||
AddAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||
|
||||
AddToModeling(domElement);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId,
|
||||
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
|
@ -22,9 +22,14 @@
|
|||
#include "vabstractnode.h"
|
||||
#include <QDebug>
|
||||
|
||||
VAbstractNode::VAbstractNode(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode,
|
||||
Draw::Draws typeobject, QObject *parent) :
|
||||
VAbstractTool(doc, data, id, parent), idNode(idNode), typeobject(typeobject){
|
||||
const QString VAbstractNode::AttrIdObject = QStringLiteral("idObject");
|
||||
const QString VAbstractNode::AttrTypeObject = QStringLiteral("typeObject");
|
||||
const QString VAbstractNode::TypeObjectCalculation = QStringLiteral("Calculation");
|
||||
const QString VAbstractNode::TypeObjectModeling = QStringLiteral("Modeling");
|
||||
|
||||
VAbstractNode::VAbstractNode(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode, Draw::Draws typeobject,
|
||||
QObject *parent) : VAbstractTool(doc, data, id, parent), idNode(idNode),
|
||||
typeobject(typeobject){
|
||||
_referens = 0;
|
||||
}
|
||||
|
||||
|
@ -34,7 +39,7 @@ void VAbstractNode::AddToModeling(const QDomElement &domElement){
|
|||
if(ok){
|
||||
modelingElement.appendChild(domElement);
|
||||
} else {
|
||||
qCritical()<<"Can't find tag Modeling"<< Q_FUNC_INFO;
|
||||
qCritical()<<tr("Can't find tag Modeling")<< Q_FUNC_INFO;
|
||||
}
|
||||
emit toolhaveChange();
|
||||
}
|
||||
|
|
|
@ -30,6 +30,10 @@ public:
|
|||
VAbstractNode(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode,
|
||||
Draw::Draws typeobject, QObject *parent = 0 );
|
||||
virtual ~VAbstractNode() {}
|
||||
static const QString AttrIdObject;
|
||||
static const QString AttrTypeObject;
|
||||
static const QString TypeObjectCalculation;
|
||||
static const QString TypeObjectModeling;
|
||||
protected:
|
||||
qint64 idNode;
|
||||
Draw::Draws typeobject;
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
|
||||
#include "vnodearc.h"
|
||||
|
||||
const QString VNodeArc::TagName = QStringLiteral("arc");
|
||||
const QString VNodeArc::ToolType = QStringLiteral("modeling");
|
||||
|
||||
VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, Draw::Draws typeobject,
|
||||
Tool::Sources typeCreation, QGraphicsItem * parent) :
|
||||
VAbstractNode(doc, data, id, idArc, typeobject), QGraphicsPathItem(parent){
|
||||
|
@ -51,15 +54,15 @@ void VNodeArc::FullUpdateFromFile(){
|
|||
}
|
||||
|
||||
void VNodeArc::AddToFile(){
|
||||
QDomElement domElement = doc->createElement("arc");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "modeling");
|
||||
AddAttribute(domElement, "idObject", idNode);
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrIdObject, idNode);
|
||||
if(typeobject == Draw::Calculation){
|
||||
AddAttribute(domElement, "typeObject", "Calculation");
|
||||
AddAttribute(domElement, AttrTypeObject, TypeObjectCalculation);
|
||||
} else {
|
||||
AddAttribute(domElement, "typeObject", "Modeling");
|
||||
AddAttribute(domElement, AttrTypeObject, ToolType );
|
||||
}
|
||||
|
||||
AddToModeling(domElement);
|
||||
|
|
|
@ -32,6 +32,8 @@ public:
|
|||
Tool::Sources typeCreation, QGraphicsItem * parent = 0);
|
||||
static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc,
|
||||
Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString TagName;
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
protected:
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
|
||||
#include "vnodepoint.h"
|
||||
|
||||
const QString VNodePoint::TagName = QStringLiteral("point");
|
||||
const QString VNodePoint::ToolType = QStringLiteral("modeling");
|
||||
|
||||
VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint,
|
||||
Draw::Draws typeobject, Tool::Sources typeCreation, QGraphicsItem *parent)
|
||||
:VAbstractNode(doc, data, id, idPoint, typeobject), QGraphicsEllipseItem(parent),
|
||||
|
@ -57,18 +60,18 @@ void VNodePoint::FullUpdateFromFile(){
|
|||
|
||||
void VNodePoint::AddToFile(){
|
||||
VPointF point = VAbstractTool::data.GetModelingPoint(id);
|
||||
QDomElement domElement = doc->createElement("point");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "modeling");
|
||||
AddAttribute(domElement, "idObject", idNode);
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrIdObject, idNode);
|
||||
if(typeobject == Draw::Calculation){
|
||||
AddAttribute(domElement, "typeObject", "Calculation");
|
||||
AddAttribute(domElement, AttrTypeObject, TypeObjectCalculation);
|
||||
} else {
|
||||
AddAttribute(domElement, "typeObject", "Modeling");
|
||||
AddAttribute(domElement, AttrTypeObject, TypeObjectModeling);
|
||||
}
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
||||
AddToModeling(domElement);
|
||||
}
|
||||
|
@ -104,8 +107,8 @@ void VNodePoint::NameChangePosition(const QPointF pos){
|
|||
void VNodePoint::UpdateNamePosition(qreal mx, qreal my){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("mx", QString().setNum(toMM(mx)));
|
||||
domElement.setAttribute("my", QString().setNum(toMM(my)));
|
||||
domElement.setAttribute(AttrMx, QString().setNum(toMM(mx)));
|
||||
domElement.setAttribute(AttrMy, QString().setNum(toMM(my)));
|
||||
emit toolhaveChange();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,8 @@ public:
|
|||
Tool::Sources typeCreation, QGraphicsItem * parent = 0 );
|
||||
static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Draws typeobject,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString TagName;
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
void NameChangePosition(const QPointF pos);
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
|
||||
#include "vnodespline.h"
|
||||
|
||||
const QString VNodeSpline::TagName = QStringLiteral("spline");
|
||||
const QString VNodeSpline::ToolType = QStringLiteral("modelingSpline");
|
||||
|
||||
VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
|
||||
Draw::Draws typeobject, Tool::Sources typeCreation, QGraphicsItem * parent) :
|
||||
VAbstractNode(doc, data, id, idSpline, typeobject), QGraphicsPathItem(parent){
|
||||
|
@ -53,15 +56,15 @@ void VNodeSpline::FullUpdateFromFile(){
|
|||
}
|
||||
|
||||
void VNodeSpline::AddToFile(){
|
||||
QDomElement domElement = doc->createElement("spline");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "modelingSpline");
|
||||
AddAttribute(domElement, "idObject", idNode);
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrIdObject, idNode);
|
||||
if(typeobject == Draw::Calculation){
|
||||
AddAttribute(domElement, "typeObject", "Calculation");
|
||||
AddAttribute(domElement, AttrTypeObject, TypeObjectCalculation);
|
||||
} else {
|
||||
AddAttribute(domElement, "typeObject", "Modeling");
|
||||
AddAttribute(domElement, AttrTypeObject, TypeObjectModeling);
|
||||
}
|
||||
|
||||
AddToModeling(domElement);
|
||||
|
|
|
@ -32,6 +32,8 @@ public:
|
|||
Tool::Sources typeCreation, QGraphicsItem * parent = 0);
|
||||
static VNodeSpline *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString TagName;
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile ();
|
||||
protected:
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
|
||||
#include "vnodesplinepath.h"
|
||||
|
||||
const QString VNodeSplinePath::TagName = QStringLiteral("spline");
|
||||
const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath");
|
||||
|
||||
VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
|
||||
Draw::Draws typeobject, Tool::Sources typeCreation,
|
||||
QGraphicsItem * parent) :
|
||||
|
@ -57,15 +60,15 @@ void VNodeSplinePath::FullUpdateFromFile(){
|
|||
}
|
||||
|
||||
void VNodeSplinePath::AddToFile(){
|
||||
QDomElement domElement = doc->createElement("spline");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "modelingPath");
|
||||
AddAttribute(domElement, "idObject", idNode);
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrIdObject, idNode);
|
||||
if(typeobject == Draw::Calculation){
|
||||
AddAttribute(domElement, "typeObject", "Calculation");
|
||||
AddAttribute(domElement, AttrTypeObject, TypeObjectCalculation);
|
||||
} else {
|
||||
AddAttribute(domElement, "typeObject", "Modeling");
|
||||
AddAttribute(domElement, AttrTypeObject, TypeObjectModeling);
|
||||
}
|
||||
|
||||
AddToModeling(domElement);
|
||||
|
|
|
@ -32,6 +32,8 @@ public:
|
|||
Draw::Draws typeobject, Tool::Sources typeCreation, QGraphicsItem * parent = 0);
|
||||
static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static const QString TagName;
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
protected:
|
||||
|
|
|
@ -21,6 +21,43 @@
|
|||
|
||||
#include "vabstracttool.h"
|
||||
|
||||
const QString VAbstractTool::AttrId = QStringLiteral("id");
|
||||
const QString VAbstractTool::AttrType = QStringLiteral("type");
|
||||
const QString VAbstractTool::AttrMx = QStringLiteral("mx");
|
||||
const QString VAbstractTool::AttrMy = QStringLiteral("my");
|
||||
const QString VAbstractTool::AttrName = QStringLiteral("name");
|
||||
const QString VAbstractTool::AttrX = QStringLiteral("x");
|
||||
const QString VAbstractTool::AttrY = QStringLiteral("y");
|
||||
const QString VAbstractTool::AttrTypeLine = QStringLiteral("typeLine");
|
||||
const QString VAbstractTool::AttrLength = QStringLiteral("length");
|
||||
const QString VAbstractTool::AttrBasePoint = QStringLiteral("basePoint");
|
||||
const QString VAbstractTool::AttrFirstPoint = QStringLiteral("firstPoint");
|
||||
const QString VAbstractTool::AttrSecondPoint = QStringLiteral("secondPoint");
|
||||
const QString VAbstractTool::AttrThirdPoint = QStringLiteral("thirdPoint");
|
||||
const QString VAbstractTool::AttrCenter = QStringLiteral("center");
|
||||
const QString VAbstractTool::AttrRadius = QStringLiteral("radius");
|
||||
const QString VAbstractTool::AttrAngle = QStringLiteral("angle");
|
||||
const QString VAbstractTool::AttrAngle1 = QStringLiteral("angle1");
|
||||
const QString VAbstractTool::AttrAngle2 = QStringLiteral("angle2");
|
||||
const QString VAbstractTool::AttrP1Line = QStringLiteral("p1Line");
|
||||
const QString VAbstractTool::AttrP2Line = QStringLiteral("p2Line");
|
||||
const QString VAbstractTool::AttrP1Line1 = QStringLiteral("p1Line1");
|
||||
const QString VAbstractTool::AttrP2Line1 = QStringLiteral("p2Line1");
|
||||
const QString VAbstractTool::AttrP1Line2 = QStringLiteral("p1Line2");
|
||||
const QString VAbstractTool::AttrP2Line2 = QStringLiteral("p2Line2");
|
||||
const QString VAbstractTool::AttrPShoulder = QStringLiteral("pShoulder");
|
||||
const QString VAbstractTool::AttrPoint1 = QStringLiteral("point1");
|
||||
const QString VAbstractTool::AttrPoint4 = QStringLiteral("point4");
|
||||
const QString VAbstractTool::AttrKAsm1 = QStringLiteral("kAsm1");
|
||||
const QString VAbstractTool::AttrKAsm2 = QStringLiteral("kAsm2");
|
||||
const QString VAbstractTool::AttrKCurve = QStringLiteral("kCurve");
|
||||
const QString VAbstractTool::AttrPathPoint = QStringLiteral("pathPoint");
|
||||
const QString VAbstractTool::AttrPSpline = QStringLiteral("pSpline");
|
||||
const QString VAbstractTool::AttrAxisP1 = QStringLiteral("axisP1");
|
||||
const QString VAbstractTool::AttrAxisP2 = QStringLiteral("axisP2");
|
||||
const QString VAbstractTool::TypeLineNone = QStringLiteral("none");
|
||||
const QString VAbstractTool::TypeLineLine = QStringLiteral("hair");
|
||||
|
||||
VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent):
|
||||
VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black){
|
||||
|
||||
|
@ -29,33 +66,6 @@ VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QOb
|
|||
connect(this, &VAbstractTool::FullUpdateTree, this->doc, &VDomDocument::FullUpdateTree);
|
||||
}
|
||||
|
||||
void VAbstractTool::AddAttribute(QDomElement &domElement, const QString &name, const qint64 &value){
|
||||
QDomAttr domAttr = doc->createAttribute(name);
|
||||
domAttr.setValue(QString().setNum(value));
|
||||
domElement.setAttributeNode(domAttr);
|
||||
}
|
||||
|
||||
void VAbstractTool::AddAttribute(QDomElement &domElement, const QString &name, const qint32 &value){
|
||||
QDomAttr domAttr = doc->createAttribute(name);
|
||||
domAttr.setValue(QString().setNum(value));
|
||||
domElement.setAttributeNode(domAttr);
|
||||
}
|
||||
|
||||
void VAbstractTool::AddAttribute(QDomElement &domElement, const QString &name, const qreal &value){
|
||||
QDomAttr domAttr = doc->createAttribute(name);
|
||||
domAttr.setValue(QString().setNum(value));
|
||||
domElement.setAttributeNode(domAttr);
|
||||
}
|
||||
|
||||
void VAbstractTool::AddAttribute(QDomElement &domElement, const QString &name, const QString &value){
|
||||
QDomAttr domAttr = doc->createAttribute(name);
|
||||
domAttr.setValue(value);
|
||||
domElement.setAttributeNode(domAttr);
|
||||
}
|
||||
|
||||
VAbstractTool::~VAbstractTool(){
|
||||
}
|
||||
|
||||
QPointF VAbstractTool::LineIntersectRect(QRectF rec, QLineF line){
|
||||
qreal x1, y1, x2, y2;
|
||||
rec.getCoords(&x1, &y1, &x2, &y2);
|
||||
|
@ -76,7 +86,7 @@ QPointF VAbstractTool::LineIntersectRect(QRectF rec, QLineF line){
|
|||
if ( type == QLineF::BoundedIntersection ){
|
||||
return point;
|
||||
}
|
||||
Q_ASSERT_X(type != QLineF::BoundedIntersection, Q_FUNC_INFO, "Немає точки перетину.");
|
||||
Q_ASSERT_X(type != QLineF::BoundedIntersection, Q_FUNC_INFO, "There is no point of intersection.");
|
||||
return point;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,13 +29,49 @@ class VAbstractTool: public VDataTool{
|
|||
Q_OBJECT
|
||||
public:
|
||||
VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0);
|
||||
virtual ~VAbstractTool();
|
||||
virtual ~VAbstractTool() {}
|
||||
static QPointF LineIntersectRect(QRectF rec, QLineF line);
|
||||
static qint32 LineIntersectCircle(QPointF center, qreal radius, QLineF line, QPointF &p1, QPointF &p2);
|
||||
static QPointF ClosestPoint(QLineF line, QPointF p);
|
||||
static QPointF addVector (QPointF p, QPointF p1, QPointF p2, qreal k);
|
||||
inline qint64 getId() const {return id;}
|
||||
static void LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c);
|
||||
static const QString AttrId;
|
||||
static const QString AttrType;
|
||||
static const QString AttrMx;
|
||||
static const QString AttrMy;
|
||||
static const QString AttrName;
|
||||
static const QString AttrX;
|
||||
static const QString AttrY;
|
||||
static const QString AttrTypeLine;
|
||||
static const QString AttrLength;
|
||||
static const QString AttrBasePoint;
|
||||
static const QString AttrFirstPoint;
|
||||
static const QString AttrSecondPoint;
|
||||
static const QString AttrThirdPoint;
|
||||
static const QString AttrCenter;
|
||||
static const QString AttrRadius;
|
||||
static const QString AttrAngle;
|
||||
static const QString AttrAngle1;
|
||||
static const QString AttrAngle2;
|
||||
static const QString AttrP1Line;
|
||||
static const QString AttrP2Line;
|
||||
static const QString AttrP1Line1;
|
||||
static const QString AttrP2Line1;
|
||||
static const QString AttrP1Line2;
|
||||
static const QString AttrP2Line2;
|
||||
static const QString AttrPShoulder;
|
||||
static const QString AttrPoint1;
|
||||
static const QString AttrPoint4;
|
||||
static const QString AttrKAsm1;
|
||||
static const QString AttrKAsm2;
|
||||
static const QString AttrKCurve;
|
||||
static const QString AttrPathPoint;
|
||||
static const QString AttrPSpline;
|
||||
static const QString AttrAxisP1;
|
||||
static const QString AttrAxisP2;
|
||||
static const QString TypeLineNone;
|
||||
static const QString TypeLineLine;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile()=0;
|
||||
signals:
|
||||
|
@ -48,14 +84,23 @@ protected:
|
|||
const Qt::GlobalColor baseColor;
|
||||
Qt::GlobalColor currentColor;
|
||||
virtual void AddToFile()=0;
|
||||
void AddAttribute(QDomElement &domElement, const QString &name, const qint64 &value);
|
||||
void AddAttribute(QDomElement &domElement, const QString &name, const qint32 &value);
|
||||
void AddAttribute(QDomElement &domElement, const QString &name, const qreal &value);
|
||||
void AddAttribute(QDomElement &domElement, const QString &name, const QString &value);
|
||||
inline const VContainer *getData() const {return &data;}
|
||||
virtual void RemoveReferens(){}
|
||||
void RemoveAllChild(QDomElement &domElement);
|
||||
template <typename T>
|
||||
void AddAttribute(QDomElement &domElement, const QString &name, const T &value){
|
||||
QDomAttr domAttr = doc->createAttribute(name);
|
||||
domAttr.setValue(QString().setNum(value));
|
||||
domElement.setAttributeNode(domAttr);
|
||||
}
|
||||
private:
|
||||
Q_DISABLE_COPY(VAbstractTool)
|
||||
};
|
||||
|
||||
template <>
|
||||
inline void VAbstractTool::AddAttribute<QString>(QDomElement &domElement, const QString &name, const QString &value){
|
||||
QDomAttr domAttr = doc->createAttribute(name);
|
||||
domAttr.setValue(value);
|
||||
domElement.setAttributeNode(domAttr);
|
||||
}
|
||||
#endif // VABSTRACTTOOL_H
|
||||
|
|
|
@ -24,6 +24,16 @@
|
|||
#include "modelingTools/vmodelingtool.h"
|
||||
#include "modelingTools/modelingtools.h"
|
||||
|
||||
const QString VToolDetail::TagName = QStringLiteral("detail");
|
||||
const QString VToolDetail::TagNode = QStringLiteral("node");
|
||||
const QString VToolDetail::AttrSupplement = QStringLiteral("supplement");
|
||||
const QString VToolDetail::AttrClosed = QStringLiteral("closed");
|
||||
const QString VToolDetail::AttrWidth = QStringLiteral("width");
|
||||
const QString VToolDetail::AttrIdObject = QStringLiteral("idObject");
|
||||
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, Tool::Sources typeCreation,
|
||||
VMainGraphicsScene *scene, QGraphicsItem *parent) :VAbstractTool(doc, data, id),
|
||||
QGraphicsPathItem(parent), dialogDetail(QSharedPointer<DialogDetail>()), sceneDetails(scene){
|
||||
|
@ -290,10 +300,10 @@ void VToolDetail::FullUpdateFromGui(int result){
|
|||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
VDetail det = dialogDetail->getDetails();
|
||||
domElement.setAttribute("name", det.getName());
|
||||
domElement.setAttribute("supplement", QString().setNum(det.getSupplement()));
|
||||
domElement.setAttribute("closed", QString().setNum(det.getClosed()));
|
||||
domElement.setAttribute("width", QString().setNum(det.getWidth()));
|
||||
domElement.setAttribute(AttrName, det.getName());
|
||||
domElement.setAttribute(AttrSupplement, QString().setNum(det.getSupplement()));
|
||||
domElement.setAttribute(AttrClosed, QString().setNum(det.getClosed()));
|
||||
domElement.setAttribute(AttrWidth, QString().setNum(det.getWidth()));
|
||||
RemoveAllChild(domElement);
|
||||
for(qint32 i = 0; i < det.CountNode(); ++i){
|
||||
AddNode(domElement, det[i]);
|
||||
|
@ -306,15 +316,15 @@ void VToolDetail::FullUpdateFromGui(int result){
|
|||
|
||||
void VToolDetail::AddToFile(){
|
||||
VDetail detail = VAbstractTool::data.GetDetail(id);
|
||||
QDomElement domElement = doc->createElement("detail");
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "name", detail.getName());
|
||||
AddAttribute(domElement, "mx", toMM(detail.getMx()));
|
||||
AddAttribute(domElement, "my", toMM(detail.getMy()));
|
||||
AddAttribute(domElement, "supplement", detail.getSupplement());
|
||||
AddAttribute(domElement, "closed", detail.getClosed());
|
||||
AddAttribute(domElement, "width", detail.getWidth());
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrName, detail.getName());
|
||||
AddAttribute(domElement, AttrMx, toMM(detail.getMx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(detail.getMy()));
|
||||
AddAttribute(domElement, AttrSupplement, detail.getSupplement());
|
||||
AddAttribute(domElement, AttrClosed, detail.getClosed());
|
||||
AddAttribute(domElement, AttrWidth, detail.getWidth());
|
||||
|
||||
for(qint32 i = 0; i < detail.CountNode(); ++i){
|
||||
AddNode(domElement, detail[i]);
|
||||
|
@ -334,8 +344,8 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const
|
|||
//qDebug()<<newPos;
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
domElement.setAttribute("mx", QString().setNum(toMM(newPos.x())));
|
||||
domElement.setAttribute("my", QString().setNum(toMM(newPos.y())));
|
||||
domElement.setAttribute(AttrMx, QString().setNum(toMM(newPos.x())));
|
||||
domElement.setAttribute(AttrMy, QString().setNum(toMM(newPos.y())));
|
||||
//I don't now why but signal does not work.
|
||||
doc->FullUpdateTree();
|
||||
}
|
||||
|
@ -398,70 +408,70 @@ void VToolDetail::RemoveReferens(){
|
|||
}
|
||||
|
||||
void VToolDetail::AddNode(QDomElement &domElement, VNodeDetail &node){
|
||||
QDomElement nod = doc->createElement("node");
|
||||
QDomElement nod = doc->createElement(TagNode);
|
||||
|
||||
AddAttribute(nod, "idObject", node.getId());
|
||||
AddAttribute(nod, "mx", toMM(node.getMx()));
|
||||
AddAttribute(nod, "my", toMM(node.getMy()));
|
||||
AddAttribute(nod, AttrIdObject, node.getId());
|
||||
AddAttribute(nod, AttrMx, toMM(node.getMx()));
|
||||
AddAttribute(nod, AttrMy, toMM(node.getMy()));
|
||||
if(node.getTypeNode() == NodeDetail::Contour){
|
||||
AddAttribute(nod, "nodeType", "Contour");
|
||||
AddAttribute(nod, AttrNodeType, NodeTypeContour);
|
||||
} else {
|
||||
AddAttribute(nod, "nodeType", "Modeling");
|
||||
AddAttribute(nod, AttrNodeType, NodeTypeModeling);
|
||||
}
|
||||
switch(node.getTypeTool()){
|
||||
case(Tool::AlongLineTool):
|
||||
AddAttribute(nod, "type", "AlongLineTool");
|
||||
AddAttribute(nod, AttrType, QStringLiteral("AlongLineTool"));
|
||||
break;
|
||||
case(Tool::ArcTool):
|
||||
AddAttribute(nod, "type", "ArcTool");
|
||||
AddAttribute(nod, AttrType, QStringLiteral("ArcTool"));
|
||||
break;
|
||||
case(Tool::BisectorTool):
|
||||
AddAttribute(nod, "type", "BisectorTool");
|
||||
AddAttribute(nod, AttrType, QStringLiteral("BisectorTool"));
|
||||
break;
|
||||
case(Tool::EndLineTool):
|
||||
AddAttribute(nod, "type", "EndLineTool");
|
||||
AddAttribute(nod, AttrType, QStringLiteral("EndLineTool"));
|
||||
break;
|
||||
case(Tool::LineIntersectTool):
|
||||
AddAttribute(nod, "type", "LineIntersectTool");
|
||||
AddAttribute(nod, AttrType, QStringLiteral("LineIntersectTool"));
|
||||
break;
|
||||
case(Tool::LineTool):
|
||||
AddAttribute(nod, "type", "LineTool");
|
||||
AddAttribute(nod, AttrType, QStringLiteral("LineTool"));
|
||||
break;
|
||||
case(Tool::NodeArc):
|
||||
AddAttribute(nod, "type", "NodeArc");
|
||||
AddAttribute(nod, AttrType, QStringLiteral("NodeArc"));
|
||||
break;
|
||||
case(Tool::NodePoint):
|
||||
AddAttribute(nod, "type", "NodePoint");
|
||||
AddAttribute(nod, AttrType, QStringLiteral("NodePoint"));
|
||||
break;
|
||||
case(Tool::NodeSpline):
|
||||
AddAttribute(nod, "type", "NodeSpline");
|
||||
AddAttribute(nod, AttrType, QStringLiteral("NodeSpline"));
|
||||
break;
|
||||
case(Tool::NodeSplinePath):
|
||||
AddAttribute(nod, "type", "NodeSplinePath");
|
||||
AddAttribute(nod, AttrType, QStringLiteral("NodeSplinePath"));
|
||||
break;
|
||||
case(Tool::NormalTool):
|
||||
AddAttribute(nod, "type", "NormalTool");
|
||||
AddAttribute(nod, AttrType, QStringLiteral("NormalTool"));
|
||||
break;
|
||||
case(Tool::PointOfContact):
|
||||
AddAttribute(nod, "type", "PointOfContact");
|
||||
AddAttribute(nod, AttrType, QStringLiteral("PointOfContact"));
|
||||
break;
|
||||
case(Tool::ShoulderPointTool):
|
||||
AddAttribute(nod, "type", "ShoulderPointTool");
|
||||
AddAttribute(nod, AttrType, QStringLiteral("ShoulderPointTool"));
|
||||
break;
|
||||
case(Tool::SplinePathTool):
|
||||
AddAttribute(nod, "type", "SplinePathTool");
|
||||
AddAttribute(nod, AttrType, QStringLiteral("SplinePathTool"));
|
||||
break;
|
||||
case(Tool::SplineTool):
|
||||
AddAttribute(nod, "type", "SplineTool");
|
||||
AddAttribute(nod, AttrType, QStringLiteral("SplineTool"));
|
||||
break;
|
||||
case(Tool::Height):
|
||||
AddAttribute(nod, "type", "Height");
|
||||
AddAttribute(nod, AttrType, QStringLiteral("Height"));
|
||||
break;
|
||||
case(Tool::Triangle):
|
||||
AddAttribute(nod, "type", "Triangle");
|
||||
AddAttribute(nod, AttrType, QStringLiteral("Triangle"));
|
||||
break;
|
||||
case(Tool::PointOfIntersection):
|
||||
AddAttribute(nod, "type", "PointOfIntersection");
|
||||
AddAttribute(nod, AttrType, QStringLiteral("PointOfIntersection"));
|
||||
break;
|
||||
default:
|
||||
qWarning()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
||||
|
|
|
@ -51,6 +51,15 @@ public:
|
|||
AddNode(domElement, node);
|
||||
}
|
||||
}
|
||||
static const QString TagName;
|
||||
static const QString TagNode;
|
||||
static const QString AttrSupplement;
|
||||
static const QString AttrClosed;
|
||||
static const QString AttrWidth;
|
||||
static const QString AttrIdObject;
|
||||
static const QString AttrNodeType;
|
||||
static const QString NodeTypeContour;
|
||||
static const QString NodeTypeModeling;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile ();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
|
|
Loading…
Reference in New Issue
Block a user