move all static xml functions to qetxml

This commit is contained in:
Martin Marmsoler
2021-03-06 20:01:31 +01:00
parent ea793125a5
commit 058824f29a
23 changed files with 725 additions and 675 deletions

View File

@@ -21,6 +21,8 @@
#include "../../QetGraphicsItemModeler/qetgraphicshandleritem.h"
#include "../elementscene.h"
#include "../../qetxml.h"
#include <cmath>
/**
@@ -112,15 +114,15 @@ void PartLine::toXmlPriv(QDomElement& e) const
QPointF p1(sceneP1());
QPointF p2(sceneP2());
e.appendChild(createXmlProperty("x1", p1.x()));
e.appendChild(createXmlProperty("y1", p1.y()));
e.appendChild(createXmlProperty("x2", p2.x()));
e.appendChild(createXmlProperty("y2", p2.y()));
e.appendChild(QETXML::createXmlProperty("x1", p1.x()));
e.appendChild(QETXML::createXmlProperty("y1", p1.y()));
e.appendChild(QETXML::createXmlProperty("x2", p2.x()));
e.appendChild(QETXML::createXmlProperty("y2", p2.y()));
e.appendChild(createXmlProperty("end1", Qet::endTypeToString(first_end)));
e.appendChild(createXmlProperty("length1", first_length));
e.appendChild(createXmlProperty("end2", Qet::endTypeToString(second_end)));
e.appendChild(createXmlProperty("length2", second_length));
e.appendChild(QETXML::createXmlProperty("end1", Qet::endTypeToString(first_end)));
e.appendChild(QETXML::createXmlProperty("length1", first_length));
e.appendChild(QETXML::createXmlProperty("end2", Qet::endTypeToString(second_end)));
e.appendChild(QETXML::createXmlProperty("length2", second_length));
stylesToXml(e);
}
@@ -134,41 +136,41 @@ bool PartLine::fromXmlPriv(const QDomElement &qde) {
stylesFromXml(qde);
double x1 = 0, y1 = 0, x2 = 0, y2 = 0;
if (propertyDouble(qde, "x1", &x1) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "y1", &y1) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "x2", &x2) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "y2", &y2) == PropertyFlags::NoValidConversion)
if (QETXML::propertyDouble(qde, "x1", &x1) == QETXML::PropertyFlags::NoValidConversion ||
QETXML::propertyDouble(qde, "y1", &y1) == QETXML::PropertyFlags::NoValidConversion ||
QETXML::propertyDouble(qde, "x2", &x2) == QETXML::PropertyFlags::NoValidConversion ||
QETXML::propertyDouble(qde, "y2", &y2) == QETXML::PropertyFlags::NoValidConversion)
return false;
m_line = QLineF(mapFromScene(x1, y1),
mapFromScene(x2, y2));
QString s;
if (propertyString(qde, "end1", &s) != PropertyFlags::Success)
if (QETXML::propertyString(qde, "end1", &s) != QETXML::PropertyFlags::Success)
return false;
first_end = Qet::endTypeFromString(s);
if (propertyString(qde, "end2", &s) != PropertyFlags::Success)
if (QETXML::propertyString(qde, "end2", &s) != QETXML::PropertyFlags::Success)
return false;
first_end = Qet::endTypeFromString(s);
if (propertyDouble(qde, "length1", &first_length) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "length2", &second_length) == PropertyFlags::NoValidConversion)
if (QETXML::propertyDouble(qde, "length1", &first_length) == QETXML::PropertyFlags::NoValidConversion ||
QETXML::propertyDouble(qde, "length2", &second_length) == QETXML::PropertyFlags::NoValidConversion)
return false;
return true;
}
bool PartLine::valideXml(QDomElement& element) const {
if (propertyDouble(element, "x1") ||
propertyDouble(element, "y1") ||
propertyDouble(element, "x2") ||
propertyDouble(element, "y2") ||
propertyString(element, "end1") ||
propertyString(element, "end2") ||
propertyDouble(element, "length1") ||
propertyDouble(element, "length2") )
if (QETXML::propertyDouble(element, "x1") ||
QETXML::propertyDouble(element, "y1") ||
QETXML::propertyDouble(element, "x2") ||
QETXML::propertyDouble(element, "y2") ||
QETXML::propertyString(element, "end1") ||
QETXML::propertyString(element, "end2") ||
QETXML::propertyDouble(element, "length1") ||
QETXML::propertyDouble(element, "length2") )
return false;
return true;