commit
110ad09b21
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
# Use out-of-source builds (shadow builds)
|
# Use out-of-source builds (shadow builds)
|
||||||
|
|
||||||
QT += core gui widgets xml svg printsupport
|
QT += core gui widgets xml svg printsupport xmlpatterns
|
||||||
|
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
|
@ -44,7 +44,8 @@ include(src/xml/xml.pri)
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
share/resources/icon.qrc \
|
share/resources/icon.qrc \
|
||||||
share/resources/cursor.qrc \
|
share/resources/cursor.qrc \
|
||||||
share/resources/theme.qrc
|
share/resources/theme.qrc \
|
||||||
|
share/resources/schema.qrc
|
||||||
|
|
||||||
OTHER_FILES += share/resources/valentina.rc \
|
OTHER_FILES += share/resources/valentina.rc \
|
||||||
share/resources/icon/64x64/icon64x64.ico
|
share/resources/icon/64x64/icon64x64.ico
|
||||||
|
|
5
share/resources/schema.qrc
Normal file
5
share/resources/schema.qrc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>schema/pattern.xsd</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
203
share/resources/schema/pattern.xsd
Normal file
203
share/resources/schema/pattern.xsd
Normal file
|
@ -0,0 +1,203 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||||
|
<!-- XML Schema Generated from XML Document-->
|
||||||
|
<xs:element name="pattern">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:element name="increments" minOccurs="0" maxOccurs="1">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:element name="increment" minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:attribute name="ksize" type="xs:double" use="required"></xs:attribute>
|
||||||
|
<xs:attribute name="id" type="xs:long" use="required"></xs:attribute>
|
||||||
|
<xs:attribute name="description" type="xs:string" use="required"></xs:attribute>
|
||||||
|
<xs:attribute name="kgrowth" type="xs:double" use="required"></xs:attribute>
|
||||||
|
<xs:attribute name="name" type="xs:string" use="required"></xs:attribute>
|
||||||
|
<xs:attribute name="base" type="xs:double" use="required"></xs:attribute>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="draw" minOccurs="1" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="calculation" minOccurs="1" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:attribute name="id" type="xs:long" use="required"></xs:attribute>
|
||||||
|
<xs:attribute name="x" type="xs:double"></xs:attribute>
|
||||||
|
<xs:attribute name="y" type="xs:double"></xs:attribute>
|
||||||
|
<xs:attribute name="mx" type="xs:double"></xs:attribute>
|
||||||
|
<xs:attribute name="my" type="xs:double"></xs:attribute>
|
||||||
|
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="name" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="firstPoint" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="secondPoint" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="thirdPoint" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="basePoint" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="pShoulder" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="p1Line" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="p2Line" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="length" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="angle" type="xs:double"></xs:attribute>
|
||||||
|
<xs:attribute name="typeLine" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="splinePath" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="spline" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="p1Line1" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="p1Line2" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="p2Line1" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="p2Line2" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="center" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="radius" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="axisP1" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="axisP2" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="arc" type="xs:long"></xs:attribute>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:attribute name="id" type="xs:long" use="required"></xs:attribute>
|
||||||
|
<xs:attribute name="firstPoint" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="secondPoint" type="xs:long"></xs:attribute>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="arc" minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:attribute name="angle1" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="id" type="xs:long" use="required"></xs:attribute>
|
||||||
|
<xs:attribute name="angle2" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="radius" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="center" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="spline" minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="pathPoint" minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:attribute name="kAsm2" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="pSpline" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="angle" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="kAsm1" type="xs:string"></xs:attribute>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute name="id" type="xs:long" use="required"></xs:attribute>
|
||||||
|
<xs:attribute name="kCurve" type="xs:double"></xs:attribute>
|
||||||
|
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="kAsm1" type="xs:double"></xs:attribute>
|
||||||
|
<xs:attribute name="kAsm2" type="xs:double"></xs:attribute>
|
||||||
|
<xs:attribute name="angle1" type="xs:double"></xs:attribute>
|
||||||
|
<xs:attribute name="angle2" type="xs:double"></xs:attribute>
|
||||||
|
<xs:attribute name="point1" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="point4" type="xs:long"></xs:attribute>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="modeling" minOccurs="1" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:attribute name="id" type="xs:long" use="required"></xs:attribute>
|
||||||
|
<xs:attribute name="idObject" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="mx" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="my" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="idTool" type="xs:long"></xs:attribute>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="arc" minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:attribute name="id" type="xs:long" use="required"></xs:attribute>
|
||||||
|
<xs:attribute name="idObject" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="idTool" type="xs:long"></xs:attribute>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="spline" minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:attribute name="id" type="xs:long" use="required"></xs:attribute>
|
||||||
|
<xs:attribute name="idObject" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="idTool" type="xs:long"></xs:attribute>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="tools" minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="det" minOccurs="2" maxOccurs="2">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="node" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:attribute name="nodeType" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="idObject" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="mx" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="my" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute name="id" type="xs:long" use="required"></xs:attribute>
|
||||||
|
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="indexD1" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="indexD2" type="xs:long"></xs:attribute>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="details" minOccurs="1" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="detail" minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="node" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:attribute name="nodeType" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="idObject" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="mx" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="my" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute name="id" type="xs:long" use="required"></xs:attribute>
|
||||||
|
<xs:attribute name="supplement" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="mx" type="xs:double"></xs:attribute>
|
||||||
|
<xs:attribute name="my" type="xs:double"></xs:attribute>
|
||||||
|
<xs:attribute name="width" type="xs:long"></xs:attribute>
|
||||||
|
<xs:attribute name="name" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="closed" type="xs:long"></xs:attribute>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute name="name" type="xs:string"></xs:attribute>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
|
@ -442,7 +442,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column )
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
qreal value = item->text().toDouble(&ok);
|
qreal value = item->text().replace(",", ".").toDouble(&ok);
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
domElement.setAttribute("base", value);
|
domElement.setAttribute("base", value);
|
||||||
|
@ -462,7 +462,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column )
|
||||||
domElement = doc->elementById(QString().setNum(id));
|
domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute("ksize", item->text().toDouble());
|
domElement.setAttribute("ksize", item->text().replace(",", ".").toDouble());
|
||||||
this->column = 4;
|
this->column = 4;
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
|
@ -474,7 +474,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column )
|
||||||
domElement = doc->elementById(QString().setNum(id));
|
domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute("kgrowth", item->text().toDouble());
|
domElement.setAttribute("kgrowth", item->text().replace(",", ".").toDouble());
|
||||||
this->column = 5;
|
this->column = 5;
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "vexception.h"
|
#include "vexception.h"
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
VException::VException(const QString &what):QException(), what(what)
|
VException::VException(const QString &what):QException(), what(what)
|
||||||
{
|
{
|
||||||
|
@ -38,3 +39,19 @@ QString VException::ErrorMessage() const
|
||||||
QString error = QString("Exception: %1").arg(what);
|
QString error = QString("Exception: %1").arg(what);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VException::CriticalMessageBox(const QString &situation) const
|
||||||
|
{
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setWindowTitle("Critical error!");
|
||||||
|
msgBox.setText(situation);
|
||||||
|
msgBox.setInformativeText(ErrorMessage());
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
|
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||||
|
if (DetailedInformation().isEmpty() == false)
|
||||||
|
{
|
||||||
|
msgBox.setDetailedText(DetailedInformation());
|
||||||
|
}
|
||||||
|
msgBox.setIcon(QMessageBox::Critical);
|
||||||
|
msgBox.exec();
|
||||||
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ public:
|
||||||
* @return string with error
|
* @return string with error
|
||||||
*/
|
*/
|
||||||
inline QString What() const {return what;}
|
inline QString What() const {return what;}
|
||||||
|
virtual void CriticalMessageBox(const QString &situation) const;
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief what string with error
|
* @brief what string with error
|
||||||
|
|
|
@ -43,6 +43,35 @@
|
||||||
#include <QShowEvent>
|
#include <QShowEvent>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#include <QXmlSchema>
|
||||||
|
#include <QXmlSchemaValidator>
|
||||||
|
#include <QSourceLocation>
|
||||||
|
#include <QAbstractMessageHandler>
|
||||||
|
|
||||||
|
class MessageHandler : public QAbstractMessageHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MessageHandler() : QAbstractMessageHandler(0), m_messageType(QtMsgType()), m_description(QString()),
|
||||||
|
m_sourceLocation(QSourceLocation()){}
|
||||||
|
inline QString statusMessage() const {return m_description;}
|
||||||
|
inline qint64 line() const {return m_sourceLocation.line();}
|
||||||
|
inline qint64 column() const {return m_sourceLocation.column();}
|
||||||
|
protected:
|
||||||
|
virtual void handleMessage(QtMsgType type, const QString &description,
|
||||||
|
const QUrl &identifier, const QSourceLocation &sourceLocation)
|
||||||
|
{
|
||||||
|
Q_UNUSED(type);
|
||||||
|
Q_UNUSED(identifier);
|
||||||
|
|
||||||
|
m_messageType = type;
|
||||||
|
m_description = description;
|
||||||
|
m_sourceLocation = sourceLocation;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
QtMsgType m_messageType;
|
||||||
|
QString m_description;
|
||||||
|
QSourceLocation m_sourceLocation;
|
||||||
|
};
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
:QMainWindow(parent), ui(new Ui::MainWindow), pattern(0), doc(0), tool(Tool::ArrowTool), currentScene(0),
|
:QMainWindow(parent), ui(new Ui::MainWindow), pattern(0), doc(0), tool(Tool::ArrowTool), currentScene(0),
|
||||||
|
@ -1211,6 +1240,65 @@ void MainWindow::MinimumScrollBar()
|
||||||
verScrollBar->setValue(verScrollBar->minimum());
|
verScrollBar->setValue(verScrollBar->minimum());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MainWindow::ValidatePattern(const QString &schema, const QString &fileName, QString &errorMsg, qint64 &errorLine,
|
||||||
|
qint64 &errorColumn) const
|
||||||
|
{
|
||||||
|
QFile pattern(fileName);
|
||||||
|
if (pattern.open(QIODevice::ReadOnly) == false)
|
||||||
|
{
|
||||||
|
errorMsg = QString(tr("Can't open pattern file."));
|
||||||
|
errorLine = -1;
|
||||||
|
errorColumn = -1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(schema.isEmpty())
|
||||||
|
{
|
||||||
|
errorMsg = QString(tr("Empty schema path."));
|
||||||
|
errorLine = -1;
|
||||||
|
errorColumn = -1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
QFile fileSchema(schema);
|
||||||
|
if(fileSchema.open(QIODevice::ReadOnly) == false)
|
||||||
|
{
|
||||||
|
errorMsg = QString(tr("Can't open schema file."));
|
||||||
|
errorLine = -1;
|
||||||
|
errorColumn = -1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageHandler messageHandler;
|
||||||
|
QXmlSchema sch;
|
||||||
|
sch.setMessageHandler(&messageHandler);
|
||||||
|
sch.load(&fileSchema, QUrl::fromLocalFile(fileSchema.fileName()));
|
||||||
|
|
||||||
|
bool errorOccurred = false;
|
||||||
|
if (!sch.isValid())
|
||||||
|
{
|
||||||
|
errorOccurred = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QXmlSchemaValidator validator(sch);
|
||||||
|
if (!validator.validate(&pattern, QUrl::fromLocalFile(pattern.fileName())))
|
||||||
|
{
|
||||||
|
errorOccurred = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errorOccurred)
|
||||||
|
{
|
||||||
|
errorMsg = messageHandler.statusMessage();
|
||||||
|
errorLine = messageHandler.line();
|
||||||
|
errorColumn = messageHandler.column();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool MainWindow::SafeSaveing(const QString &fileName) const
|
bool MainWindow::SafeSaveing(const QString &fileName) const
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -1318,119 +1406,100 @@ void MainWindow::OpenPattern(const QString &fileName)
|
||||||
}
|
}
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
QString errorMsg;
|
QString errorMsg;
|
||||||
qint32 errorLine = 0;
|
qint64 errorLine = 0;
|
||||||
qint32 errorColumn = 0;
|
qint64 errorColumn = 0;
|
||||||
if (file.open(QIODevice::ReadOnly))
|
if (file.open(QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
if (doc->setContent(&file, &errorMsg, &errorLine, &errorColumn))
|
if(ValidatePattern("://schema/pattern.xsd", fileName, errorMsg, errorLine, errorColumn))
|
||||||
{
|
{
|
||||||
disconnect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
qint32 errorLine = 0;
|
||||||
this, &MainWindow::currentDrawChanged);
|
qint32 errorColumn = 0;
|
||||||
try
|
if (doc->setContent(&file, &errorMsg, &errorLine, &errorColumn))
|
||||||
{
|
{
|
||||||
doc->Parse(Document::FullParse, sceneDraw, sceneDetails);
|
disconnect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
}
|
this, &MainWindow::currentDrawChanged);
|
||||||
catch (const VExceptionObjectError &e)
|
try
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
doc->Parse(Document::FullParse, sceneDraw, sceneDetails);
|
||||||
msgBox.setWindowTitle(tr("Error!"));
|
}
|
||||||
msgBox.setText(tr("Error parsing file."));
|
catch (const VExceptionObjectError &e)
|
||||||
msgBox.setInformativeText(e.ErrorMessage());
|
{
|
||||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
e.CriticalMessageBox(tr("Error parsing file."));
|
||||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
file.close();
|
||||||
msgBox.setDetailedText(e.DetailedInformation());
|
Clear();
|
||||||
msgBox.setIcon(QMessageBox::Critical);
|
return;
|
||||||
msgBox.exec();
|
}
|
||||||
file.close();
|
catch (const VExceptionConversionError &e)
|
||||||
Clear();
|
{
|
||||||
return;
|
e.CriticalMessageBox(tr("Error can't convert value."));
|
||||||
}
|
file.close();
|
||||||
catch (const VExceptionConversionError &e)
|
Clear();
|
||||||
{
|
return;
|
||||||
QMessageBox msgBox;
|
}
|
||||||
msgBox.setWindowTitle(tr("Error!"));
|
catch (const VExceptionEmptyParameter &e)
|
||||||
msgBox.setText(tr("Error can't convert value."));
|
{
|
||||||
msgBox.setInformativeText(e.ErrorMessage());
|
e.CriticalMessageBox(tr("Error empty parameter."));
|
||||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
file.close();
|
||||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
Clear();
|
||||||
msgBox.setIcon(QMessageBox::Critical);
|
return;
|
||||||
msgBox.exec();
|
}
|
||||||
file.close();
|
catch (const VExceptionWrongParameterId &e)
|
||||||
Clear();
|
{
|
||||||
return;
|
e.CriticalMessageBox(tr("Error wrong id."));
|
||||||
}
|
file.close();
|
||||||
catch (const VExceptionEmptyParameter &e)
|
Clear();
|
||||||
{
|
return;
|
||||||
QMessageBox msgBox;
|
}
|
||||||
msgBox.setWindowTitle(tr("Error!"));
|
catch (const VExceptionUniqueId &e)
|
||||||
msgBox.setText(tr("Error empty parameter."));
|
{
|
||||||
msgBox.setInformativeText(e.ErrorMessage());
|
e.CriticalMessageBox(tr("Error no unique id."));
|
||||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
file.close();
|
||||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
Clear();
|
||||||
msgBox.setDetailedText(e.DetailedInformation());
|
return;
|
||||||
msgBox.setIcon(QMessageBox::Critical);
|
}
|
||||||
msgBox.exec();
|
connect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
file.close();
|
this, &MainWindow::currentDrawChanged);
|
||||||
Clear();
|
QString nameDraw = doc->GetNameActivDraw();
|
||||||
return;
|
qint32 index = comboBoxDraws->findText(nameDraw);
|
||||||
}
|
if ( index != -1 )
|
||||||
catch (const VExceptionWrongParameterId &e)
|
{ // -1 for not found
|
||||||
{
|
comboBoxDraws->setCurrentIndex(index);
|
||||||
QMessageBox msgBox;
|
}
|
||||||
msgBox.setWindowTitle(tr("Error!"));
|
if (comboBoxDraws->count() > 0)
|
||||||
msgBox.setText(tr("Error wrong id."));
|
{
|
||||||
msgBox.setInformativeText(e.ErrorMessage());
|
SetEnableTool(true);
|
||||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
}
|
||||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
else
|
||||||
msgBox.setDetailedText(e.DetailedInformation());
|
{
|
||||||
msgBox.setIcon(QMessageBox::Critical);
|
SetEnableTool(false);
|
||||||
msgBox.exec();
|
}
|
||||||
file.close();
|
SetEnableWidgets(true);
|
||||||
Clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
catch (const VExceptionUniqueId &e)
|
|
||||||
{
|
|
||||||
QMessageBox msgBox;
|
|
||||||
msgBox.setWindowTitle(tr("Error!"));
|
|
||||||
msgBox.setText(tr("Error no unique id."));
|
|
||||||
msgBox.setInformativeText(e.ErrorMessage());
|
|
||||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
|
||||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
|
||||||
msgBox.setDetailedText(e.DetailedInformation());
|
|
||||||
msgBox.setIcon(QMessageBox::Critical);
|
|
||||||
msgBox.exec();
|
|
||||||
file.close();
|
|
||||||
Clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
connect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
|
||||||
this, &MainWindow::currentDrawChanged);
|
|
||||||
QString nameDraw = doc->GetNameActivDraw();
|
|
||||||
qint32 index = comboBoxDraws->findText(nameDraw);
|
|
||||||
if ( index != -1 )
|
|
||||||
{ // -1 for not found
|
|
||||||
comboBoxDraws->setCurrentIndex(index);
|
|
||||||
}
|
|
||||||
if (comboBoxDraws->count() > 0)
|
|
||||||
{
|
|
||||||
SetEnableTool(true);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetEnableTool(false);
|
QMessageBox msgBox;
|
||||||
|
msgBox.setWindowTitle(tr("Error!"));
|
||||||
|
msgBox.setText(tr("Parsing pattern file error."));
|
||||||
|
msgBox.setInformativeText(errorMsg);
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
|
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||||
|
QString error = QString(tr("Error in line %1 column %2")).arg(errorLine).arg(errorColumn);
|
||||||
|
msgBox.setDetailedText(error);
|
||||||
|
msgBox.exec();
|
||||||
|
file.close();
|
||||||
|
Clear();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
SetEnableWidgets(true);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setWindowTitle(tr("Error!"));
|
msgBox.setWindowTitle(tr("Error!"));
|
||||||
msgBox.setText(tr("Error parsing pattern file."));
|
msgBox.setText(tr("Validation file error."));
|
||||||
msgBox.setInformativeText(errorMsg);
|
msgBox.setInformativeText(errorMsg);
|
||||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||||
QString error = QString(tr("Error in line %1 column %2")).arg(errorLine, errorColumn);
|
QString error = QString(tr("Error in line %1 column %2")).arg(errorLine).arg(errorColumn);
|
||||||
msgBox.setDetailedText(error);
|
msgBox.setDetailedText(error);
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
file.close();
|
file.close();
|
||||||
|
@ -1439,6 +1508,10 @@ void MainWindow::OpenPattern(const QString &fileName)
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning()<<tr("Can't open pattern file.")<<Q_FUNC_INFO;
|
||||||
|
}
|
||||||
this->fileName = fileName;
|
this->fileName = fileName;
|
||||||
QFileInfo info(fileName);
|
QFileInfo info(fileName);
|
||||||
QString title(info.fileName());
|
QString title(info.fileName());
|
||||||
|
|
|
@ -559,6 +559,8 @@ private:
|
||||||
* @brief MinimumScrollBar
|
* @brief MinimumScrollBar
|
||||||
*/
|
*/
|
||||||
void MinimumScrollBar();
|
void MinimumScrollBar();
|
||||||
|
bool ValidatePattern(const QString &schema, const QString &fileName, QString &errorMsg, qint64 &errorLine,
|
||||||
|
qint64 &errorColumn) const;
|
||||||
template <typename T>
|
template <typename T>
|
||||||
/**
|
/**
|
||||||
* @brief AddToolToDetail
|
* @brief AddToolToDetail
|
||||||
|
|
|
@ -69,11 +69,11 @@ void VToolAlongLine::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(AttrName, dialogAlongLine->getPointName());
|
SetAttribute(domElement, AttrName, dialogAlongLine->getPointName());
|
||||||
domElement.setAttribute(AttrTypeLine, dialogAlongLine->getTypeLine());
|
SetAttribute(domElement, AttrTypeLine, dialogAlongLine->getTypeLine());
|
||||||
domElement.setAttribute(AttrLength, dialogAlongLine->getFormula());
|
SetAttribute(domElement, AttrLength, dialogAlongLine->getFormula());
|
||||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogAlongLine->getFirstPointId()));
|
SetAttribute(domElement, AttrFirstPoint, dialogAlongLine->getFirstPointId());
|
||||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogAlongLine->getSecondPointId()));
|
SetAttribute(domElement, AttrSecondPoint, dialogAlongLine->getSecondPointId());
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,16 +101,16 @@ void VToolAlongLine::AddToFile()
|
||||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
AddAttribute(domElement, AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
AddAttribute(domElement, AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
|
|
||||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
AddAttribute(domElement, AttrLength, formula);
|
SetAttribute(domElement, AttrLength, formula);
|
||||||
AddAttribute(domElement, AttrFirstPoint, basePointId);
|
SetAttribute(domElement, AttrFirstPoint, basePointId);
|
||||||
AddAttribute(domElement, AttrSecondPoint, secondPointId);
|
SetAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
}
|
}
|
||||||
|
@ -121,13 +121,13 @@ void VToolAlongLine::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
domElement.setAttribute(AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
domElement.setAttribute(AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
domElement.setAttribute(AttrTypeLine, typeLine);
|
SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
domElement.setAttribute(AttrLength, formula);
|
SetAttribute(domElement, AttrLength, formula);
|
||||||
domElement.setAttribute(AttrFirstPoint, basePointId);
|
SetAttribute(domElement, AttrFirstPoint, basePointId);
|
||||||
domElement.setAttribute(AttrSecondPoint, secondPointId);
|
SetAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,10 +144,10 @@ void VToolArc::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(AttrCenter, QString().setNum(dialogArc->GetCenter()));
|
SetAttribute(domElement, AttrCenter, QString().setNum(dialogArc->GetCenter()));
|
||||||
domElement.setAttribute(AttrRadius, dialogArc->GetRadius());
|
SetAttribute(domElement, AttrRadius, dialogArc->GetRadius());
|
||||||
domElement.setAttribute(AttrAngle1, dialogArc->GetF1());
|
SetAttribute(domElement, AttrAngle1, dialogArc->GetF1());
|
||||||
domElement.setAttribute(AttrAngle2, dialogArc->GetF2());
|
SetAttribute(domElement, AttrAngle2, dialogArc->GetF2());
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,12 +194,12 @@ void VToolArc::AddToFile()
|
||||||
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);
|
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrCenter, arc->GetCenter().id());
|
SetAttribute(domElement, AttrCenter, arc->GetCenter().id());
|
||||||
AddAttribute(domElement, AttrRadius, arc->GetFormulaRadius());
|
SetAttribute(domElement, AttrRadius, arc->GetFormulaRadius());
|
||||||
AddAttribute(domElement, AttrAngle1, arc->GetFormulaF1());
|
SetAttribute(domElement, AttrAngle1, arc->GetFormulaF1());
|
||||||
AddAttribute(domElement, AttrAngle2, arc->GetFormulaF2());
|
SetAttribute(domElement, AttrAngle2, arc->GetFormulaF2());
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
}
|
}
|
||||||
|
@ -210,10 +210,10 @@ void VToolArc::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrCenter, arc->GetCenter().id());
|
SetAttribute(domElement, AttrCenter, arc->GetCenter().id());
|
||||||
domElement.setAttribute(AttrRadius, arc->GetFormulaRadius());
|
SetAttribute(domElement, AttrRadius, arc->GetFormulaRadius());
|
||||||
domElement.setAttribute(AttrAngle1, arc->GetFormulaF1());
|
SetAttribute(domElement, AttrAngle1, arc->GetFormulaF1());
|
||||||
domElement.setAttribute(AttrAngle2, arc->GetFormulaF2());
|
SetAttribute(domElement, AttrAngle2, arc->GetFormulaF2());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -164,12 +164,12 @@ void VToolBisector::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(AttrName, dialogBisector->getPointName());
|
SetAttribute(domElement, AttrName, dialogBisector->getPointName());
|
||||||
domElement.setAttribute(AttrTypeLine, dialogBisector->getTypeLine());
|
SetAttribute(domElement, AttrTypeLine, dialogBisector->getTypeLine());
|
||||||
domElement.setAttribute(AttrLength, dialogBisector->getFormula());
|
SetAttribute(domElement, AttrLength, dialogBisector->getFormula());
|
||||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogBisector->getFirstPointId()));
|
SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogBisector->getFirstPointId()));
|
||||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogBisector->getSecondPointId()));
|
SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogBisector->getSecondPointId()));
|
||||||
domElement.setAttribute(AttrThirdPoint, QString().setNum(dialogBisector->getThirdPointId()));
|
SetAttribute(domElement, AttrThirdPoint, QString().setNum(dialogBisector->getThirdPointId()));
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,17 +197,17 @@ void VToolBisector::AddToFile()
|
||||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
AddAttribute(domElement, AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
AddAttribute(domElement, AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
|
|
||||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
AddAttribute(domElement, AttrLength, formula);
|
SetAttribute(domElement, AttrLength, formula);
|
||||||
AddAttribute(domElement, AttrFirstPoint, firstPointId);
|
SetAttribute(domElement, AttrFirstPoint, firstPointId);
|
||||||
AddAttribute(domElement, AttrSecondPoint, basePointId);
|
SetAttribute(domElement, AttrSecondPoint, basePointId);
|
||||||
AddAttribute(domElement, AttrThirdPoint, thirdPointId);
|
SetAttribute(domElement, AttrThirdPoint, thirdPointId);
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
}
|
}
|
||||||
|
@ -218,14 +218,14 @@ void VToolBisector::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
domElement.setAttribute(AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
domElement.setAttribute(AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
domElement.setAttribute(AttrTypeLine, typeLine);
|
SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
domElement.setAttribute(AttrLength, formula);
|
SetAttribute(domElement, AttrLength, formula);
|
||||||
domElement.setAttribute(AttrFirstPoint, firstPointId);
|
SetAttribute(domElement, AttrFirstPoint, firstPointId);
|
||||||
domElement.setAttribute(AttrSecondPoint, basePointId);
|
SetAttribute(domElement, AttrSecondPoint, basePointId);
|
||||||
domElement.setAttribute(AttrThirdPoint, thirdPointId);
|
SetAttribute(domElement, AttrThirdPoint, thirdPointId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -171,9 +171,9 @@ void VToolCutArc::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(AttrName, dialogCutArc->getPointName());
|
SetAttribute(domElement, AttrName, dialogCutArc->getPointName());
|
||||||
domElement.setAttribute(AttrLength, dialogCutArc->getFormula());
|
SetAttribute(domElement, AttrLength, dialogCutArc->getFormula());
|
||||||
domElement.setAttribute(AttrArc, QString().setNum(dialogCutArc->getArcId()));
|
SetAttribute(domElement, AttrArc, QString().setNum(dialogCutArc->getArcId()));
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -223,14 +223,14 @@ void VToolCutArc::AddToFile()
|
||||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
AddAttribute(domElement, AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
AddAttribute(domElement, AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
|
|
||||||
AddAttribute(domElement, AttrLength, formula);
|
SetAttribute(domElement, AttrLength, formula);
|
||||||
AddAttribute(domElement, AttrArc, arcId);
|
SetAttribute(domElement, AttrArc, arcId);
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
}
|
}
|
||||||
|
@ -241,11 +241,11 @@ void VToolCutArc::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
domElement.setAttribute(AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
domElement.setAttribute(AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
domElement.setAttribute(AttrLength, formula);
|
SetAttribute(domElement, AttrLength, formula);
|
||||||
domElement.setAttribute(AttrArc, arcId);
|
SetAttribute(domElement, AttrArc, arcId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -172,9 +172,9 @@ void VToolCutSpline::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(AttrName, dialogCutSpline->getPointName());
|
SetAttribute(domElement, AttrName, dialogCutSpline->getPointName());
|
||||||
domElement.setAttribute(AttrLength, dialogCutSpline->getFormula());
|
SetAttribute(domElement, AttrLength, dialogCutSpline->getFormula());
|
||||||
domElement.setAttribute(AttrSpline, QString().setNum(dialogCutSpline->getSplineId()));
|
SetAttribute(domElement, AttrSpline, QString().setNum(dialogCutSpline->getSplineId()));
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -224,14 +224,14 @@ void VToolCutSpline::AddToFile()
|
||||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
AddAttribute(domElement, AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
AddAttribute(domElement, AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
|
|
||||||
AddAttribute(domElement, AttrLength, formula);
|
SetAttribute(domElement, AttrLength, formula);
|
||||||
AddAttribute(domElement, AttrSpline, splineId);
|
SetAttribute(domElement, AttrSpline, splineId);
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
}
|
}
|
||||||
|
@ -242,11 +242,11 @@ void VToolCutSpline::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
domElement.setAttribute(AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
domElement.setAttribute(AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
domElement.setAttribute(AttrLength, formula);
|
SetAttribute(domElement, AttrLength, formula);
|
||||||
domElement.setAttribute(AttrSpline, splineId);
|
SetAttribute(domElement, AttrSpline, splineId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -249,9 +249,9 @@ void VToolCutSplinePath::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(AttrName, dialogCutSplinePath->getPointName());
|
SetAttribute(domElement, AttrName, dialogCutSplinePath->getPointName());
|
||||||
domElement.setAttribute(AttrLength, dialogCutSplinePath->getFormula());
|
SetAttribute(domElement, AttrLength, dialogCutSplinePath->getFormula());
|
||||||
domElement.setAttribute(AttrSplinePath, QString().setNum(dialogCutSplinePath->getSplinePathId()));
|
SetAttribute(domElement, AttrSplinePath, QString().setNum(dialogCutSplinePath->getSplinePathId()));
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -301,14 +301,14 @@ void VToolCutSplinePath::AddToFile()
|
||||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
AddAttribute(domElement, AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
AddAttribute(domElement, AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
|
|
||||||
AddAttribute(domElement, AttrLength, formula);
|
SetAttribute(domElement, AttrLength, formula);
|
||||||
AddAttribute(domElement, AttrSplinePath, splinePathId);
|
SetAttribute(domElement, AttrSplinePath, splinePathId);
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
}
|
}
|
||||||
|
@ -319,11 +319,11 @@ void VToolCutSplinePath::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
domElement.setAttribute(AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
domElement.setAttribute(AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
domElement.setAttribute(AttrLength, formula);
|
SetAttribute(domElement, AttrLength, formula);
|
||||||
domElement.setAttribute(AttrSplinePath, splinePathId);
|
SetAttribute(domElement, AttrSplinePath, splinePathId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,11 +140,11 @@ void VToolEndLine::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(AttrName, dialogEndLine->getPointName());
|
SetAttribute(domElement, AttrName, dialogEndLine->getPointName());
|
||||||
domElement.setAttribute(AttrTypeLine, dialogEndLine->getTypeLine());
|
SetAttribute(domElement, AttrTypeLine, dialogEndLine->getTypeLine());
|
||||||
domElement.setAttribute(AttrLength, dialogEndLine->getFormula());
|
SetAttribute(domElement, AttrLength, dialogEndLine->getFormula());
|
||||||
domElement.setAttribute(AttrAngle, QString().setNum(dialogEndLine->getAngle()));
|
SetAttribute(domElement, AttrAngle, QString().setNum(dialogEndLine->getAngle()));
|
||||||
domElement.setAttribute(AttrBasePoint, QString().setNum(dialogEndLine->getBasePointId()));
|
SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogEndLine->getBasePointId()));
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,16 +161,16 @@ void VToolEndLine::AddToFile()
|
||||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
AddAttribute(domElement, AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
AddAttribute(domElement, AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
|
|
||||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
AddAttribute(domElement, AttrLength, formula);
|
SetAttribute(domElement, AttrLength, formula);
|
||||||
AddAttribute(domElement, AttrAngle, angle);
|
SetAttribute(domElement, AttrAngle, angle);
|
||||||
AddAttribute(domElement, AttrBasePoint, basePointId);
|
SetAttribute(domElement, AttrBasePoint, basePointId);
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
}
|
}
|
||||||
|
@ -181,12 +181,12 @@ void VToolEndLine::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
domElement.setAttribute(AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
domElement.setAttribute(AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
domElement.setAttribute(AttrTypeLine, typeLine);
|
SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
domElement.setAttribute(AttrLength, formula);
|
SetAttribute(domElement, AttrLength, formula);
|
||||||
domElement.setAttribute(AttrAngle, angle);
|
SetAttribute(domElement, AttrAngle, angle);
|
||||||
domElement.setAttribute(AttrBasePoint, basePointId);
|
SetAttribute(domElement, AttrBasePoint, basePointId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,11 +155,11 @@ void VToolHeight::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(AttrName, dialogHeight->getPointName());
|
SetAttribute(domElement, AttrName, dialogHeight->getPointName());
|
||||||
domElement.setAttribute(AttrTypeLine, dialogHeight->getTypeLine());
|
SetAttribute(domElement, AttrTypeLine, dialogHeight->getTypeLine());
|
||||||
domElement.setAttribute(AttrBasePoint, QString().setNum(dialogHeight->getBasePointId()));
|
SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogHeight->getBasePointId()));
|
||||||
domElement.setAttribute(AttrP1Line, QString().setNum(dialogHeight->getP1LineId()));
|
SetAttribute(domElement, AttrP1Line, QString().setNum(dialogHeight->getP1LineId()));
|
||||||
domElement.setAttribute(AttrP2Line, QString().setNum(dialogHeight->getP2LineId()));
|
SetAttribute(domElement, AttrP2Line, QString().setNum(dialogHeight->getP2LineId()));
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,16 +181,16 @@ void VToolHeight::AddToFile()
|
||||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
AddAttribute(domElement, AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
AddAttribute(domElement, AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
|
|
||||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
AddAttribute(domElement, AttrBasePoint, basePointId);
|
SetAttribute(domElement, AttrBasePoint, basePointId);
|
||||||
AddAttribute(domElement, AttrP1Line, p1LineId);
|
SetAttribute(domElement, AttrP1Line, p1LineId);
|
||||||
AddAttribute(domElement, AttrP2Line, p2LineId);
|
SetAttribute(domElement, AttrP2Line, p2LineId);
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
|
|
||||||
|
@ -202,12 +202,12 @@ void VToolHeight::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
domElement.setAttribute(AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
domElement.setAttribute(AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
domElement.setAttribute(AttrTypeLine, typeLine);
|
SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
domElement.setAttribute(AttrBasePoint, basePointId);
|
SetAttribute(domElement, AttrBasePoint, basePointId);
|
||||||
domElement.setAttribute(AttrP1Line, p1LineId);
|
SetAttribute(domElement, AttrP1Line, p1LineId);
|
||||||
domElement.setAttribute(AttrP2Line, p2LineId);
|
SetAttribute(domElement, AttrP2Line, p2LineId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,8 +118,8 @@ void VToolLine::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(AttrFirstPoint, QString().setNum(dialogLine->getFirstPoint()));
|
SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogLine->getFirstPoint()));
|
||||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogLine->getSecondPoint()));
|
SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogLine->getSecondPoint()));
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,9 +163,9 @@ void VToolLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
void VToolLine::AddToFile()
|
void VToolLine::AddToFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrFirstPoint, firstPoint);
|
SetAttribute(domElement, AttrFirstPoint, firstPoint);
|
||||||
AddAttribute(domElement, AttrSecondPoint, secondPoint);
|
SetAttribute(domElement, AttrSecondPoint, secondPoint);
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
}
|
}
|
||||||
|
@ -175,8 +175,8 @@ void VToolLine::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrFirstPoint, firstPoint);
|
SetAttribute(domElement, AttrFirstPoint, firstPoint);
|
||||||
domElement.setAttribute(AttrSecondPoint, secondPoint);
|
SetAttribute(domElement, AttrSecondPoint, secondPoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,11 +146,11 @@ void VToolLineIntersect::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(AttrName, dialogLineIntersect->getPointName());
|
SetAttribute(domElement, AttrName, dialogLineIntersect->getPointName());
|
||||||
domElement.setAttribute(AttrP1Line1, QString().setNum(dialogLineIntersect->getP1Line1()));
|
SetAttribute(domElement, AttrP1Line1, QString().setNum(dialogLineIntersect->getP1Line1()));
|
||||||
domElement.setAttribute(AttrP2Line1, QString().setNum(dialogLineIntersect->getP2Line1()));
|
SetAttribute(domElement, AttrP2Line1, QString().setNum(dialogLineIntersect->getP2Line1()));
|
||||||
domElement.setAttribute(AttrP1Line2, QString().setNum(dialogLineIntersect->getP1Line2()));
|
SetAttribute(domElement, AttrP1Line2, QString().setNum(dialogLineIntersect->getP1Line2()));
|
||||||
domElement.setAttribute(AttrP2Line2, QString().setNum(dialogLineIntersect->getP2Line2()));
|
SetAttribute(domElement, AttrP2Line2, QString().setNum(dialogLineIntersect->getP2Line2()));
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,16 +178,16 @@ void VToolLineIntersect::AddToFile()
|
||||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
AddAttribute(domElement, AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
AddAttribute(domElement, AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
|
|
||||||
AddAttribute(domElement, AttrP1Line1, p1Line1);
|
SetAttribute(domElement, AttrP1Line1, p1Line1);
|
||||||
AddAttribute(domElement, AttrP2Line1, p2Line1);
|
SetAttribute(domElement, AttrP2Line1, p2Line1);
|
||||||
AddAttribute(domElement, AttrP1Line2, p1Line2);
|
SetAttribute(domElement, AttrP1Line2, p1Line2);
|
||||||
AddAttribute(domElement, AttrP2Line2, p2Line2);
|
SetAttribute(domElement, AttrP2Line2, p2Line2);
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
}
|
}
|
||||||
|
@ -198,13 +198,13 @@ void VToolLineIntersect::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
domElement.setAttribute(AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
domElement.setAttribute(AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
domElement.setAttribute(AttrP1Line1, p1Line1);
|
SetAttribute(domElement, AttrP1Line1, p1Line1);
|
||||||
domElement.setAttribute(AttrP2Line1, p2Line1);
|
SetAttribute(domElement, AttrP2Line1, p2Line1);
|
||||||
domElement.setAttribute(AttrP1Line2, p1Line2);
|
SetAttribute(domElement, AttrP1Line2, p1Line2);
|
||||||
domElement.setAttribute(AttrP2Line2, p2Line2);
|
SetAttribute(domElement, AttrP2Line2, p2Line2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,12 +149,12 @@ void VToolNormal::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(AttrName, dialogNormal->getPointName());
|
SetAttribute(domElement, AttrName, dialogNormal->getPointName());
|
||||||
domElement.setAttribute(AttrTypeLine, dialogNormal->getTypeLine());
|
SetAttribute(domElement, AttrTypeLine, dialogNormal->getTypeLine());
|
||||||
domElement.setAttribute(AttrLength, dialogNormal->getFormula());
|
SetAttribute(domElement, AttrLength, dialogNormal->getFormula());
|
||||||
domElement.setAttribute(AttrAngle, QString().setNum(dialogNormal->getAngle()));
|
SetAttribute(domElement, AttrAngle, QString().setNum(dialogNormal->getAngle()));
|
||||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogNormal->getFirstPointId()));
|
SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogNormal->getFirstPointId()));
|
||||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogNormal->getSecondPointId()));
|
SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogNormal->getSecondPointId()));
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,17 +182,17 @@ void VToolNormal::AddToFile()
|
||||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
AddAttribute(domElement, AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
AddAttribute(domElement, AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
|
|
||||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
AddAttribute(domElement, AttrLength, formula);
|
SetAttribute(domElement, AttrLength, formula);
|
||||||
AddAttribute(domElement, AttrAngle, angle);
|
SetAttribute(domElement, AttrAngle, angle);
|
||||||
AddAttribute(domElement, AttrFirstPoint, basePointId);
|
SetAttribute(domElement, AttrFirstPoint, basePointId);
|
||||||
AddAttribute(domElement, AttrSecondPoint, secondPointId);
|
SetAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
}
|
}
|
||||||
|
@ -203,14 +203,14 @@ void VToolNormal::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
domElement.setAttribute(AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
domElement.setAttribute(AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
domElement.setAttribute(AttrTypeLine, typeLine);
|
SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
domElement.setAttribute(AttrLength, formula);
|
SetAttribute(domElement, AttrLength, formula);
|
||||||
domElement.setAttribute(AttrAngle, angle);
|
SetAttribute(domElement, AttrAngle, angle);
|
||||||
domElement.setAttribute(AttrFirstPoint, basePointId);
|
SetAttribute(domElement, AttrFirstPoint, basePointId);
|
||||||
domElement.setAttribute(AttrSecondPoint, secondPointId);
|
SetAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,8 +65,8 @@ 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(AttrMx, toMM(mx));
|
SetAttribute(domElement, AttrMx, toMM(mx));
|
||||||
domElement.setAttribute(AttrMy, toMM(my));
|
SetAttribute(domElement, AttrMy, toMM(my));
|
||||||
emit toolhaveChange();
|
emit toolhaveChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,11 +169,11 @@ void VToolPointOfContact::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(AttrName, dialogPointOfContact->getPointName());
|
SetAttribute(domElement, AttrName, dialogPointOfContact->getPointName());
|
||||||
domElement.setAttribute(AttrRadius, dialogPointOfContact->getRadius());
|
SetAttribute(domElement, AttrRadius, dialogPointOfContact->getRadius());
|
||||||
domElement.setAttribute(AttrCenter, QString().setNum(dialogPointOfContact->getCenter()));
|
SetAttribute(domElement, AttrCenter, QString().setNum(dialogPointOfContact->getCenter()));
|
||||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogPointOfContact->getFirstPoint()));
|
SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogPointOfContact->getFirstPoint()));
|
||||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogPointOfContact->getSecondPoint()));
|
SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogPointOfContact->getSecondPoint()));
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,16 +201,16 @@ void VToolPointOfContact::AddToFile()
|
||||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
AddAttribute(domElement, AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
AddAttribute(domElement, AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
|
|
||||||
AddAttribute(domElement, AttrRadius, radius);
|
SetAttribute(domElement, AttrRadius, radius);
|
||||||
AddAttribute(domElement, AttrCenter, center);
|
SetAttribute(domElement, AttrCenter, center);
|
||||||
AddAttribute(domElement, AttrFirstPoint, firstPointId);
|
SetAttribute(domElement, AttrFirstPoint, firstPointId);
|
||||||
AddAttribute(domElement, AttrSecondPoint, secondPointId);
|
SetAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
}
|
}
|
||||||
|
@ -221,13 +221,13 @@ void VToolPointOfContact::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
domElement.setAttribute(AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
domElement.setAttribute(AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
domElement.setAttribute(AttrRadius, radius);
|
SetAttribute(domElement, AttrRadius, radius);
|
||||||
domElement.setAttribute(AttrCenter, center);
|
SetAttribute(domElement, AttrCenter, center);
|
||||||
domElement.setAttribute(AttrFirstPoint, firstPointId);
|
SetAttribute(domElement, AttrFirstPoint, firstPointId);
|
||||||
domElement.setAttribute(AttrSecondPoint, secondPointId);
|
SetAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,9 +119,9 @@ void VToolPointOfIntersection::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(AttrName, dialogPointOfIntersection->getPointName());
|
SetAttribute(domElement, AttrName, dialogPointOfIntersection->getPointName());
|
||||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogPointOfIntersection->getFirstPointId()));
|
SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogPointOfIntersection->getFirstPointId()));
|
||||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogPointOfIntersection->getSecondPointId()));
|
SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogPointOfIntersection->getSecondPointId()));
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,14 +149,14 @@ void VToolPointOfIntersection::AddToFile()
|
||||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
AddAttribute(domElement, AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
AddAttribute(domElement, AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
|
|
||||||
AddAttribute(domElement, AttrFirstPoint, firstPointId);
|
SetAttribute(domElement, AttrFirstPoint, firstPointId);
|
||||||
AddAttribute(domElement, AttrSecondPoint, secondPointId);
|
SetAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
}
|
}
|
||||||
|
@ -167,10 +167,10 @@ void VToolPointOfIntersection::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
domElement.setAttribute(AttrName, toMM(point->mx()));
|
SetAttribute(domElement, AttrName, toMM(point->mx()));
|
||||||
domElement.setAttribute(AttrName, toMM(point->my()));
|
SetAttribute(domElement, AttrName, toMM(point->my()));
|
||||||
domElement.setAttribute(AttrFirstPoint, firstPointId);
|
SetAttribute(domElement, AttrFirstPoint, firstPointId);
|
||||||
domElement.setAttribute(AttrSecondPoint, secondPointId);
|
SetAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,12 +172,12 @@ void VToolShoulderPoint::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(AttrName, dialogShoulderPoint->getPointName());
|
SetAttribute(domElement, AttrName, dialogShoulderPoint->getPointName());
|
||||||
domElement.setAttribute(AttrTypeLine, dialogShoulderPoint->getTypeLine());
|
SetAttribute(domElement, AttrTypeLine, dialogShoulderPoint->getTypeLine());
|
||||||
domElement.setAttribute(AttrLength, dialogShoulderPoint->getFormula());
|
SetAttribute(domElement, AttrLength, dialogShoulderPoint->getFormula());
|
||||||
domElement.setAttribute(AttrP1Line, QString().setNum(dialogShoulderPoint->getP1Line()));
|
SetAttribute(domElement, AttrP1Line, QString().setNum(dialogShoulderPoint->getP1Line()));
|
||||||
domElement.setAttribute(AttrP2Line, QString().setNum(dialogShoulderPoint->getP2Line()));
|
SetAttribute(domElement, AttrP2Line, QString().setNum(dialogShoulderPoint->getP2Line()));
|
||||||
domElement.setAttribute(AttrPShoulder, QString().setNum(dialogShoulderPoint->getPShoulder()));
|
SetAttribute(domElement, AttrPShoulder, QString().setNum(dialogShoulderPoint->getPShoulder()));
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,17 +205,17 @@ void VToolShoulderPoint::AddToFile()
|
||||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
AddAttribute(domElement, AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
AddAttribute(domElement, AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
|
|
||||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
AddAttribute(domElement, AttrLength, formula);
|
SetAttribute(domElement, AttrLength, formula);
|
||||||
AddAttribute(domElement, AttrP1Line, basePointId);
|
SetAttribute(domElement, AttrP1Line, basePointId);
|
||||||
AddAttribute(domElement, AttrP2Line, p2Line);
|
SetAttribute(domElement, AttrP2Line, p2Line);
|
||||||
AddAttribute(domElement, AttrPShoulder, pShoulder);
|
SetAttribute(domElement, AttrPShoulder, pShoulder);
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
}
|
}
|
||||||
|
@ -226,14 +226,14 @@ void VToolShoulderPoint::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
domElement.setAttribute(AttrName, toMM(point->mx()));
|
SetAttribute(domElement, AttrName, toMM(point->mx()));
|
||||||
domElement.setAttribute(AttrName, toMM(point->my()));
|
SetAttribute(domElement, AttrName, toMM(point->my()));
|
||||||
domElement.setAttribute(AttrTypeLine, typeLine);
|
SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
domElement.setAttribute(AttrLength, formula);
|
SetAttribute(domElement, AttrLength, formula);
|
||||||
domElement.setAttribute(AttrP1Line, basePointId);
|
SetAttribute(domElement, AttrP1Line, basePointId);
|
||||||
domElement.setAttribute(AttrP2Line, p2Line);
|
SetAttribute(domElement, AttrP2Line, p2Line);
|
||||||
domElement.setAttribute(AttrPShoulder, pShoulder);
|
SetAttribute(domElement, AttrPShoulder, pShoulder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,13 +63,13 @@ void VToolSinglePoint::AddToFile()
|
||||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
AddAttribute(domElement, AttrX, toMM(point->x()));
|
SetAttribute(domElement, AttrX, toMM(point->x()));
|
||||||
AddAttribute(domElement, AttrY, toMM(point->y()));
|
SetAttribute(domElement, AttrY, toMM(point->y()));
|
||||||
AddAttribute(domElement, AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
AddAttribute(domElement, AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
}
|
}
|
||||||
|
@ -80,11 +80,11 @@ void VToolSinglePoint::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
domElement.setAttribute(AttrX, QString().setNum(toMM(point->x())));
|
SetAttribute(domElement, AttrX, QString().setNum(toMM(point->x())));
|
||||||
domElement.setAttribute(AttrY, QString().setNum(toMM(point->y())));
|
SetAttribute(domElement, AttrY, QString().setNum(toMM(point->y())));
|
||||||
domElement.setAttribute(AttrMx, QString().setNum(toMM(point->mx())));
|
SetAttribute(domElement, AttrMx, QString().setNum(toMM(point->mx())));
|
||||||
domElement.setAttribute(AttrMy, QString().setNum(toMM(point->my())));
|
SetAttribute(domElement, AttrMy, QString().setNum(toMM(point->my())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,8 +110,8 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change,
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrX, QString().setNum(toMM(newPos.x())));
|
SetAttribute(domElement, AttrX, QString().setNum(toMM(newPos.x())));
|
||||||
domElement.setAttribute(AttrY, QString().setNum(toMM(newPos.y())));
|
SetAttribute(domElement, AttrY, QString().setNum(toMM(newPos.y())));
|
||||||
|
|
||||||
QList<QGraphicsView*> list = this->scene()->views();
|
QList<QGraphicsView*> list = this->scene()->views();
|
||||||
VAbstractTool::NewSceneRect(this->scene(), list[0]);
|
VAbstractTool::NewSceneRect(this->scene(), list[0]);
|
||||||
|
@ -157,9 +157,9 @@ void VToolSinglePoint::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(AttrName, name);
|
SetAttribute(domElement, AttrName, name);
|
||||||
domElement.setAttribute(AttrX, QString().setNum(toMM(p.x())));
|
SetAttribute(domElement, AttrX, QString().setNum(toMM(p.x())));
|
||||||
domElement.setAttribute(AttrY, QString().setNum(toMM(p.y())));
|
SetAttribute(domElement, 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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,13 +168,13 @@ void VToolSpline::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(AttrPoint1, spl.GetP1().id());
|
SetAttribute(domElement, AttrPoint1, spl.GetP1().id());
|
||||||
domElement.setAttribute(AttrPoint4, spl.GetP4().id());
|
SetAttribute(domElement, AttrPoint4, spl.GetP4().id());
|
||||||
domElement.setAttribute(AttrAngle1, spl.GetAngle1());
|
SetAttribute(domElement, AttrAngle1, spl.GetAngle1());
|
||||||
domElement.setAttribute(AttrAngle2, spl.GetAngle2());
|
SetAttribute(domElement, AttrAngle2, spl.GetAngle2());
|
||||||
domElement.setAttribute(AttrKAsm1, spl.GetKasm1());
|
SetAttribute(domElement, AttrKAsm1, spl.GetKasm1());
|
||||||
domElement.setAttribute(AttrKAsm2, spl.GetKasm2());
|
SetAttribute(domElement, AttrKAsm2, spl.GetKasm2());
|
||||||
domElement.setAttribute(AttrKCurve, spl.GetKcurve());
|
SetAttribute(domElement, AttrKCurve, spl.GetKcurve());
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,11 +198,11 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const Sp
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrAngle1, QString().setNum(spl.GetAngle1()));
|
SetAttribute(domElement, AttrAngle1, QString().setNum(spl.GetAngle1()));
|
||||||
domElement.setAttribute(AttrAngle2, QString().setNum(spl.GetAngle2()));
|
SetAttribute(domElement, AttrAngle2, QString().setNum(spl.GetAngle2()));
|
||||||
domElement.setAttribute(AttrKAsm1, QString().setNum(spl.GetKasm1()));
|
SetAttribute(domElement, AttrKAsm1, QString().setNum(spl.GetKasm1()));
|
||||||
domElement.setAttribute(AttrKAsm2, QString().setNum(spl.GetKasm2()));
|
SetAttribute(domElement, AttrKAsm2, QString().setNum(spl.GetKasm2()));
|
||||||
domElement.setAttribute(AttrKCurve, QString().setNum(spl.GetKcurve()));
|
SetAttribute(domElement, AttrKCurve, QString().setNum(spl.GetKcurve()));
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,15 +217,15 @@ void VToolSpline::AddToFile()
|
||||||
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
|
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrPoint1, spl->GetP1().id());
|
SetAttribute(domElement, AttrPoint1, spl->GetP1().id());
|
||||||
AddAttribute(domElement, AttrPoint4, spl->GetP4().id());
|
SetAttribute(domElement, AttrPoint4, spl->GetP4().id());
|
||||||
AddAttribute(domElement, AttrAngle1, spl->GetAngle1());
|
SetAttribute(domElement, AttrAngle1, spl->GetAngle1());
|
||||||
AddAttribute(domElement, AttrAngle2, spl->GetAngle2());
|
SetAttribute(domElement, AttrAngle2, spl->GetAngle2());
|
||||||
AddAttribute(domElement, AttrKAsm1, spl->GetKasm1());
|
SetAttribute(domElement, AttrKAsm1, spl->GetKasm1());
|
||||||
AddAttribute(domElement, AttrKAsm2, spl->GetKasm2());
|
SetAttribute(domElement, AttrKAsm2, spl->GetKasm2());
|
||||||
AddAttribute(domElement, AttrKCurve, spl->GetKcurve());
|
SetAttribute(domElement, AttrKCurve, spl->GetKcurve());
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
}
|
}
|
||||||
|
@ -236,13 +236,13 @@ void VToolSpline::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrPoint1, spl->GetP1().id());
|
SetAttribute(domElement, AttrPoint1, spl->GetP1().id());
|
||||||
domElement.setAttribute(AttrPoint4, spl->GetP4().id());
|
SetAttribute(domElement, AttrPoint4, spl->GetP4().id());
|
||||||
domElement.setAttribute(AttrAngle1, spl->GetAngle1());
|
SetAttribute(domElement, AttrAngle1, spl->GetAngle1());
|
||||||
domElement.setAttribute(AttrAngle2, spl->GetAngle2());
|
SetAttribute(domElement, AttrAngle2, spl->GetAngle2());
|
||||||
domElement.setAttribute(AttrKAsm1, spl->GetKasm1());
|
SetAttribute(domElement, AttrKAsm1, spl->GetKasm1());
|
||||||
domElement.setAttribute(AttrKAsm2, spl->GetKasm2());
|
SetAttribute(domElement, AttrKAsm2, spl->GetKasm2());
|
||||||
domElement.setAttribute(AttrKCurve, spl->GetKcurve());
|
SetAttribute(domElement, AttrKCurve, spl->GetKcurve());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,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(AttrKCurve, QString().setNum(splPath.getKCurve()));
|
SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve()));
|
||||||
UpdatePathPoint(domElement, splPath);
|
UpdatePathPoint(domElement, splPath);
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, cons
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve()));
|
SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve()));
|
||||||
UpdatePathPoint(domElement, splPath);
|
UpdatePathPoint(domElement, splPath);
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
|
@ -214,10 +214,10 @@ void VToolSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path)
|
||||||
if (domElement.isNull() == false)
|
if (domElement.isNull() == false)
|
||||||
{
|
{
|
||||||
VSplinePoint p = path[i];
|
VSplinePoint p = path[i];
|
||||||
domElement.setAttribute(AttrPSpline, p.P().id());
|
SetAttribute(domElement, AttrPSpline, p.P().id());
|
||||||
domElement.setAttribute(AttrKAsm1, p.KAsm1());
|
SetAttribute(domElement, AttrKAsm1, p.KAsm1());
|
||||||
domElement.setAttribute(AttrKAsm2, p.KAsm2());
|
SetAttribute(domElement, AttrKAsm2, p.KAsm2());
|
||||||
domElement.setAttribute(AttrAngle, p.Angle2());
|
SetAttribute(domElement, AttrAngle, p.Angle2());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -263,9 +263,9 @@ void VToolSplinePath::AddToFile()
|
||||||
VSplinePath splPath = *VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
|
VSplinePath splPath = *VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrKCurve, splPath.getKCurve());
|
SetAttribute(domElement, AttrKCurve, splPath.getKCurve());
|
||||||
|
|
||||||
for (qint32 i = 0; i < splPath.CountPoint(); ++i)
|
for (qint32 i = 0; i < splPath.CountPoint(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -301,7 +301,7 @@ void VToolSplinePath::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve()));
|
SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve()));
|
||||||
UpdatePathPoint(domElement, splPath);
|
UpdatePathPoint(domElement, splPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,10 +312,10 @@ void VToolSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &
|
||||||
{
|
{
|
||||||
QDomElement pathPoint = doc->createElement(AttrPathPoint);
|
QDomElement pathPoint = doc->createElement(AttrPathPoint);
|
||||||
|
|
||||||
AddAttribute(pathPoint, AttrPSpline, splPoint.P().id());
|
SetAttribute(pathPoint, AttrPSpline, splPoint.P().id());
|
||||||
AddAttribute(pathPoint, AttrKAsm1, splPoint.KAsm1());
|
SetAttribute(pathPoint, AttrKAsm1, splPoint.KAsm1());
|
||||||
AddAttribute(pathPoint, AttrKAsm2, splPoint.KAsm2());
|
SetAttribute(pathPoint, AttrKAsm2, splPoint.KAsm2());
|
||||||
AddAttribute(pathPoint, AttrAngle, splPoint.Angle2());
|
SetAttribute(pathPoint, AttrAngle, splPoint.Angle2());
|
||||||
|
|
||||||
domElement.appendChild(pathPoint);
|
domElement.appendChild(pathPoint);
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,11 +172,11 @@ void VToolTriangle::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(AttrName, dialogTriangle->getPointName());
|
SetAttribute(domElement, AttrName, dialogTriangle->getPointName());
|
||||||
domElement.setAttribute(AttrAxisP1, QString().setNum(dialogTriangle->getAxisP1Id()));
|
SetAttribute(domElement, AttrAxisP1, QString().setNum(dialogTriangle->getAxisP1Id()));
|
||||||
domElement.setAttribute(AttrAxisP2, QString().setNum(dialogTriangle->getAxisP2Id()));
|
SetAttribute(domElement, AttrAxisP2, QString().setNum(dialogTriangle->getAxisP2Id()));
|
||||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogTriangle->getFirstPointId()));
|
SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTriangle->getFirstPointId()));
|
||||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogTriangle->getSecondPointId()));
|
SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTriangle->getSecondPointId()));
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,16 +207,16 @@ void VToolTriangle::AddToFile()
|
||||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
AddAttribute(domElement, AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
AddAttribute(domElement, AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
|
|
||||||
AddAttribute(domElement, AttrAxisP1, axisP1Id);
|
SetAttribute(domElement, AttrAxisP1, axisP1Id);
|
||||||
AddAttribute(domElement, AttrAxisP2, axisP2Id);
|
SetAttribute(domElement, AttrAxisP2, axisP2Id);
|
||||||
AddAttribute(domElement, AttrFirstPoint, firstPointId);
|
SetAttribute(domElement, AttrFirstPoint, firstPointId);
|
||||||
AddAttribute(domElement, AttrSecondPoint, secondPointId);
|
SetAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
}
|
}
|
||||||
|
@ -227,12 +227,12 @@ void VToolTriangle::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrName, point->name());
|
SetAttribute(domElement, AttrName, point->name());
|
||||||
domElement.setAttribute(AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
domElement.setAttribute(AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
domElement.setAttribute(AttrAxisP1, axisP1Id);
|
SetAttribute(domElement, AttrAxisP1, axisP1Id);
|
||||||
domElement.setAttribute(AttrAxisP2, axisP2Id);
|
SetAttribute(domElement, AttrAxisP2, axisP2Id);
|
||||||
domElement.setAttribute(AttrFirstPoint, firstPointId);
|
SetAttribute(domElement, AttrFirstPoint, firstPointId);
|
||||||
domElement.setAttribute(AttrSecondPoint, secondPointId);
|
SetAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,12 +93,12 @@ void VNodeArc::AddToFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrIdObject, idNode);
|
SetAttribute(domElement, AttrIdObject, idNode);
|
||||||
if (idTool != 0)
|
if (idTool != 0)
|
||||||
{
|
{
|
||||||
AddAttribute(domElement, AttrIdTool, idTool);
|
SetAttribute(domElement, AttrIdTool, idTool);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddToModeling(domElement);
|
AddToModeling(domElement);
|
||||||
|
@ -109,10 +109,10 @@ void VNodeArc::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrIdObject, idNode);
|
SetAttribute(domElement, AttrIdObject, idNode);
|
||||||
if (idTool != 0)
|
if (idTool != 0)
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrIdTool, idTool);
|
SetAttribute(domElement, AttrIdTool, idTool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,14 +105,14 @@ void VNodePoint::AddToFile()
|
||||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrIdObject, idNode);
|
SetAttribute(domElement, AttrIdObject, idNode);
|
||||||
AddAttribute(domElement, AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
AddAttribute(domElement, AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
if (idTool != 0)
|
if (idTool != 0)
|
||||||
{
|
{
|
||||||
AddAttribute(domElement, AttrIdTool, idTool);
|
SetAttribute(domElement, AttrIdTool, idTool);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddToModeling(domElement);
|
AddToModeling(domElement);
|
||||||
|
@ -124,12 +124,12 @@ void VNodePoint::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrIdObject, idNode);
|
SetAttribute(domElement, AttrIdObject, idNode);
|
||||||
domElement.setAttribute(AttrMx, toMM(point->mx()));
|
SetAttribute(domElement, AttrMx, toMM(point->mx()));
|
||||||
domElement.setAttribute(AttrMy, toMM(point->my()));
|
SetAttribute(domElement, AttrMy, toMM(point->my()));
|
||||||
if (idTool != 0)
|
if (idTool != 0)
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrIdTool, idTool);
|
SetAttribute(domElement, AttrIdTool, idTool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,8 +172,8 @@ 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(AttrMx, QString().setNum(toMM(mx)));
|
SetAttribute(domElement, AttrMx, QString().setNum(toMM(mx)));
|
||||||
domElement.setAttribute(AttrMy, QString().setNum(toMM(my)));
|
SetAttribute(domElement, AttrMy, QString().setNum(toMM(my)));
|
||||||
emit toolhaveChange();
|
emit toolhaveChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,12 +96,12 @@ void VNodeSpline::AddToFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrIdObject, idNode);
|
SetAttribute(domElement, AttrIdObject, idNode);
|
||||||
if (idTool != 0)
|
if (idTool != 0)
|
||||||
{
|
{
|
||||||
AddAttribute(domElement, AttrIdTool, idTool);
|
SetAttribute(domElement, AttrIdTool, idTool);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddToModeling(domElement);
|
AddToModeling(domElement);
|
||||||
|
@ -112,10 +112,10 @@ void VNodeSpline::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrIdObject, QString().setNum(idNode));
|
SetAttribute(domElement, AttrIdObject, QString().setNum(idNode));
|
||||||
if (idTool != 0)
|
if (idTool != 0)
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrIdTool, idTool);
|
SetAttribute(domElement, AttrIdTool, idTool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,12 +100,12 @@ void VNodeSplinePath::AddToFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrIdObject, idNode);
|
SetAttribute(domElement, AttrIdObject, idNode);
|
||||||
if (idTool != 0)
|
if (idTool != 0)
|
||||||
{
|
{
|
||||||
AddAttribute(domElement, AttrIdTool, idTool);
|
SetAttribute(domElement, AttrIdTool, idTool);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddToModeling(domElement);
|
AddToModeling(domElement);
|
||||||
|
@ -116,10 +116,10 @@ void VNodeSplinePath::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrIdObject, QString().setNum(idNode));
|
SetAttribute(domElement, AttrIdObject, QString().setNum(idNode));
|
||||||
if (idTool != 0)
|
if (idTool != 0)
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrIdTool, idTool);
|
SetAttribute(domElement, AttrIdTool, idTool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -314,21 +314,19 @@ protected:
|
||||||
* @param name
|
* @param name
|
||||||
* @param value
|
* @param value
|
||||||
*/
|
*/
|
||||||
void AddAttribute(QDomElement &domElement, const QString &name, const T &value)
|
void SetAttribute(QDomElement &domElement, const QString &name, const T &value)
|
||||||
{
|
{
|
||||||
QDomAttr domAttr = doc->createAttribute(name);
|
QString val = QString().setNum(value);
|
||||||
domAttr.setValue(QString().setNum(value));
|
val = val.replace(",", ".");
|
||||||
domElement.setAttributeNode(domAttr);
|
domElement.setAttribute(name, val);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VAbstractTool)
|
Q_DISABLE_COPY(VAbstractTool)
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline void VAbstractTool::AddAttribute<QString>(QDomElement &domElement, const QString &name, const QString &value)
|
inline void VAbstractTool::SetAttribute<QString>(QDomElement &domElement, const QString &name, const QString &value)
|
||||||
{
|
{
|
||||||
QDomAttr domAttr = doc->createAttribute(name);
|
domElement.setAttribute(name, value);
|
||||||
domAttr.setValue(value);
|
|
||||||
domElement.setAttributeNode(domAttr);
|
|
||||||
}
|
}
|
||||||
#endif // VABSTRACTTOOL_H
|
#endif // VABSTRACTTOOL_H
|
||||||
|
|
|
@ -176,10 +176,10 @@ void VToolDetail::FullUpdateFromGui(int result)
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
VDetail det = dialogDetail->getDetails();
|
VDetail det = dialogDetail->getDetails();
|
||||||
domElement.setAttribute(AttrName, det.getName());
|
SetAttribute(domElement, AttrName, det.getName());
|
||||||
domElement.setAttribute(AttrSupplement, QString().setNum(det.getSupplement()));
|
SetAttribute(domElement, AttrSupplement, QString().setNum(det.getSupplement()));
|
||||||
domElement.setAttribute(AttrClosed, QString().setNum(det.getClosed()));
|
SetAttribute(domElement, AttrClosed, QString().setNum(det.getClosed()));
|
||||||
domElement.setAttribute(AttrWidth, QString().setNum(det.getWidth()));
|
SetAttribute(domElement, AttrWidth, QString().setNum(det.getWidth()));
|
||||||
RemoveAllChild(domElement);
|
RemoveAllChild(domElement);
|
||||||
for (ptrdiff_t i = 0; i < det.CountNode(); ++i)
|
for (ptrdiff_t i = 0; i < det.CountNode(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -207,13 +207,13 @@ void VToolDetail::AddToFile()
|
||||||
VDetail detail = VAbstractTool::data.GetDetail(id);
|
VDetail detail = VAbstractTool::data.GetDetail(id);
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrName, detail.getName());
|
SetAttribute(domElement, AttrName, detail.getName());
|
||||||
AddAttribute(domElement, AttrMx, toMM(detail.getMx()));
|
SetAttribute(domElement, AttrMx, toMM(detail.getMx()));
|
||||||
AddAttribute(domElement, AttrMy, toMM(detail.getMy()));
|
SetAttribute(domElement, AttrMy, toMM(detail.getMy()));
|
||||||
AddAttribute(domElement, AttrSupplement, detail.getSupplement());
|
SetAttribute(domElement, AttrSupplement, detail.getSupplement());
|
||||||
AddAttribute(domElement, AttrClosed, detail.getClosed());
|
SetAttribute(domElement, AttrClosed, detail.getClosed());
|
||||||
AddAttribute(domElement, AttrWidth, detail.getWidth());
|
SetAttribute(domElement, AttrWidth, detail.getWidth());
|
||||||
|
|
||||||
for (ptrdiff_t i = 0; i < detail.CountNode(); ++i)
|
for (ptrdiff_t i = 0; i < detail.CountNode(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -234,10 +234,10 @@ void VToolDetail::RefreshDataInFile()
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
VDetail det = VAbstractTool::data.GetDetail(id);
|
VDetail det = VAbstractTool::data.GetDetail(id);
|
||||||
domElement.setAttribute(AttrName, det.getName());
|
SetAttribute(domElement, AttrName, det.getName());
|
||||||
domElement.setAttribute(AttrSupplement, QString().setNum(det.getSupplement()));
|
SetAttribute(domElement, AttrSupplement, QString().setNum(det.getSupplement()));
|
||||||
domElement.setAttribute(AttrClosed, QString().setNum(det.getClosed()));
|
SetAttribute(domElement, AttrClosed, QString().setNum(det.getClosed()));
|
||||||
domElement.setAttribute(AttrWidth, QString().setNum(det.getWidth()));
|
SetAttribute(domElement, AttrWidth, QString().setNum(det.getWidth()));
|
||||||
RemoveAllChild(domElement);
|
RemoveAllChild(domElement);
|
||||||
for (ptrdiff_t i = 0; i < det.CountNode(); ++i)
|
for (ptrdiff_t i = 0; i < det.CountNode(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -256,8 +256,8 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrMx, QString().setNum(toMM(newPos.x())));
|
SetAttribute(domElement, AttrMx, QString().setNum(toMM(newPos.x())));
|
||||||
domElement.setAttribute(AttrMy, QString().setNum(toMM(newPos.y())));
|
SetAttribute(domElement, AttrMy, QString().setNum(toMM(newPos.y())));
|
||||||
|
|
||||||
QList<QGraphicsView*> list = this->scene()->views();
|
QList<QGraphicsView*> list = this->scene()->views();
|
||||||
VAbstractTool::NewSceneRect(this->scene(), list[0]);
|
VAbstractTool::NewSceneRect(this->scene(), list[0]);
|
||||||
|
@ -346,30 +346,30 @@ void VToolDetail::AddNode(QDomElement &domElement, const VNodeDetail &node)
|
||||||
{
|
{
|
||||||
QDomElement nod = doc->createElement(TagNode);
|
QDomElement nod = doc->createElement(TagNode);
|
||||||
|
|
||||||
AddAttribute(nod, AttrIdObject, node.getId());
|
SetAttribute(nod, AttrIdObject, node.getId());
|
||||||
AddAttribute(nod, AttrMx, toMM(node.getMx()));
|
SetAttribute(nod, AttrMx, toMM(node.getMx()));
|
||||||
AddAttribute(nod, AttrMy, toMM(node.getMy()));
|
SetAttribute(nod, AttrMy, toMM(node.getMy()));
|
||||||
if (node.getTypeNode() == NodeDetail::Contour)
|
if (node.getTypeNode() == NodeDetail::Contour)
|
||||||
{
|
{
|
||||||
AddAttribute(nod, AttrNodeType, NodeTypeContour);
|
SetAttribute(nod, AttrNodeType, NodeTypeContour);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddAttribute(nod, AttrNodeType, NodeTypeModeling);
|
SetAttribute(nod, AttrNodeType, NodeTypeModeling);
|
||||||
}
|
}
|
||||||
switch (node.getTypeTool())
|
switch (node.getTypeTool())
|
||||||
{
|
{
|
||||||
case (Tool::NodeArc):
|
case (Tool::NodeArc):
|
||||||
AddAttribute(nod, AttrType, QStringLiteral("NodeArc"));
|
SetAttribute(nod, AttrType, QStringLiteral("NodeArc"));
|
||||||
break;
|
break;
|
||||||
case (Tool::NodePoint):
|
case (Tool::NodePoint):
|
||||||
AddAttribute(nod, AttrType, QStringLiteral("NodePoint"));
|
SetAttribute(nod, AttrType, QStringLiteral("NodePoint"));
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeSpline):
|
case (Tool::NodeSpline):
|
||||||
AddAttribute(nod, AttrType, QStringLiteral("NodeSpline"));
|
SetAttribute(nod, AttrType, QStringLiteral("NodeSpline"));
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeSplinePath):
|
case (Tool::NodeSplinePath):
|
||||||
AddAttribute(nod, AttrType, QStringLiteral("NodeSplinePath"));
|
SetAttribute(nod, AttrType, QStringLiteral("NodeSplinePath"));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
qWarning()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
||||||
|
|
|
@ -670,10 +670,10 @@ void VToolUnionDetails::AddToFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
SetAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
SetAttribute(domElement, AttrType, ToolType);
|
||||||
AddAttribute(domElement, AttrIndexD1, indexD1);
|
SetAttribute(domElement, AttrIndexD1, indexD1);
|
||||||
AddAttribute(domElement, AttrIndexD2, indexD2);
|
SetAttribute(domElement, AttrIndexD2, indexD2);
|
||||||
|
|
||||||
AddDetail(domElement, d1);
|
AddDetail(domElement, d1);
|
||||||
AddDetail(domElement, d2);
|
AddDetail(domElement, d2);
|
||||||
|
@ -686,8 +686,8 @@ void VToolUnionDetails::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute(AttrIndexD1, indexD1);
|
SetAttribute(domElement, AttrIndexD1, indexD1);
|
||||||
domElement.setAttribute(AttrIndexD2, indexD2);
|
SetAttribute(domElement, AttrIndexD2, indexD2);
|
||||||
|
|
||||||
QDomNode domNode = domElement.firstChild();
|
QDomNode domNode = domElement.firstChild();
|
||||||
domNode = UpdateDetail(domNode, d1);
|
domNode = UpdateDetail(domNode, d1);
|
||||||
|
@ -711,30 +711,30 @@ void VToolUnionDetails::AddNode(QDomElement &domElement, const VNodeDetail &node
|
||||||
{
|
{
|
||||||
QDomElement nod = doc->createElement(TagNode);
|
QDomElement nod = doc->createElement(TagNode);
|
||||||
|
|
||||||
AddAttribute(nod, AttrIdObject, node.getId());
|
SetAttribute(nod, AttrIdObject, node.getId());
|
||||||
AddAttribute(nod, AttrMx, toMM(node.getMx()));
|
SetAttribute(nod, AttrMx, toMM(node.getMx()));
|
||||||
AddAttribute(nod, AttrMy, toMM(node.getMy()));
|
SetAttribute(nod, AttrMy, toMM(node.getMy()));
|
||||||
if (node.getTypeNode() == NodeDetail::Contour)
|
if (node.getTypeNode() == NodeDetail::Contour)
|
||||||
{
|
{
|
||||||
AddAttribute(nod, AttrNodeType, NodeTypeContour);
|
SetAttribute(nod, AttrNodeType, NodeTypeContour);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddAttribute(nod, AttrNodeType, NodeTypeModeling);
|
SetAttribute(nod, AttrNodeType, NodeTypeModeling);
|
||||||
}
|
}
|
||||||
switch (node.getTypeTool())
|
switch (node.getTypeTool())
|
||||||
{
|
{
|
||||||
case (Tool::NodeArc):
|
case (Tool::NodeArc):
|
||||||
AddAttribute(nod, AttrType, QStringLiteral("NodeArc"));
|
SetAttribute(nod, AttrType, QStringLiteral("NodeArc"));
|
||||||
break;
|
break;
|
||||||
case (Tool::NodePoint):
|
case (Tool::NodePoint):
|
||||||
AddAttribute(nod, AttrType, QStringLiteral("NodePoint"));
|
SetAttribute(nod, AttrType, QStringLiteral("NodePoint"));
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeSpline):
|
case (Tool::NodeSpline):
|
||||||
AddAttribute(nod, AttrType, QStringLiteral("NodeSpline"));
|
SetAttribute(nod, AttrType, QStringLiteral("NodeSpline"));
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeSplinePath):
|
case (Tool::NodeSplinePath):
|
||||||
AddAttribute(nod, AttrType, QStringLiteral("NodeSplinePath"));
|
SetAttribute(nod, AttrType, QStringLiteral("NodeSplinePath"));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
qWarning()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
||||||
|
|
|
@ -125,8 +125,11 @@ bool VDomDocument::find(const QDomElement &node, const QString& id)
|
||||||
|
|
||||||
void VDomDocument::CreateEmptyFile()
|
void VDomDocument::CreateEmptyFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = this->createElement("lekalo");
|
QDomElement domElement = this->createElement("pattern");
|
||||||
|
|
||||||
this->appendChild(domElement);
|
this->appendChild(domElement);
|
||||||
|
QDomComment info = this->createComment("Valentina pattern format.");
|
||||||
|
domElement.appendChild(info);
|
||||||
QDomNode xmlNode = this->createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\"");
|
QDomNode xmlNode = this->createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\"");
|
||||||
this->insertBefore(xmlNode, this->firstChild());
|
this->insertBefore(xmlNode, this->firstChild());
|
||||||
QDomElement incrElement = this->createElement("increments");
|
QDomElement incrElement = this->createElement("increments");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user