Revert pull request #48

This commit is contained in:
Laurent Trinques
2020-06-14 07:35:52 +02:00
parent c9a7c836c5
commit 22e619d6b9
13 changed files with 171 additions and 428 deletions

View File

@@ -581,27 +581,13 @@ bool Conductor::valideXml(QDomElement &e){
if (!e.hasAttribute("terminal2")) return(false);
bool conv_ok;
// parse l'abscisse
if (e.hasAttribute("element1")) {
if (QUuid(e.attribute("element1")).isNull())
return false;
if (QUuid(e.attribute("terminal1")).isNull())
return false;
} else {
e.attribute("terminal1").toInt(&conv_ok);
if (!conv_ok) return(false);
}
// parse l'abscisse
e.attribute("terminal1").toInt(&conv_ok);
if (!conv_ok) return(false);
// parse l'ordonnee
if (e.hasAttribute("element2")) {
if (QUuid(e.attribute("element2")).isNull())
return false;
if (QUuid(e.attribute("terminal2")).isNull())
return false;
} else {
e.attribute("terminal2").toInt(&conv_ok);
if (!conv_ok) return(false);
}
e.attribute("terminal2").toInt(&conv_ok);
if (!conv_ok) return(false);
return(true);
}
@@ -1010,23 +996,8 @@ QDomElement Conductor::toXml(QDomDocument &dom_document, QHash<Terminal *, int>
dom_element.setAttribute("x", QString::number(pos().x()));
dom_element.setAttribute("y", QString::number(pos().y()));
// Terminal is uniquely identified by the uuid of the terminal and the element
if (terminal1->uuid().isNull()) {
// legacy method to identify the terminal
dom_element.setAttribute("terminal1", table_adr_id.value(terminal1)); // for backward compability
} else {
dom_element.setAttribute("element1", terminal1->parentElement()->uuid().toString());
dom_element.setAttribute("terminal1", terminal1->uuid().toString());
}
if (terminal2->uuid().isNull()) {
// legacy method to identify the terminal
dom_element.setAttribute("terminal2", table_adr_id.value(terminal2)); // for backward compability
} else {
dom_element.setAttribute("element2", terminal2->parentElement()->uuid().toString());
dom_element.setAttribute("terminal2", terminal2->uuid().toString());
}
dom_element.setAttribute("terminal1", table_adr_id.value(terminal1));
dom_element.setAttribute("terminal2", table_adr_id.value(terminal2));
dom_element.setAttribute("freezeLabel", m_freeze_label? "true" : "false");
// on n'exporte les segments du conducteur que si ceux-ci ont
@@ -1062,8 +1033,7 @@ QDomElement Conductor::toXml(QDomDocument &dom_document, QHash<Terminal *, int>
/**
* @brief Conductor::pathFromXml
* Generate the path (of the line) from xml file by checking the segments in the xml
* file
* Generate the path from xml file
* @param e
* @return true if generate path success else return false
*/