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