mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-04-21 10:09:58 +02:00
add comments
This commit is contained in:
@@ -1009,10 +1009,10 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Load all elements from the XML
|
//Load all elements from the collection in the XML
|
||||||
QList<Element *> added_elements;
|
QList<Element *> added_elements;
|
||||||
QHash<int, Terminal *> table_adr_id;
|
QHash<int, Terminal *> table_adr_id;
|
||||||
foreach (QDomElement element_xml, QET::findInDomElement(root, "elements", "element"))
|
foreach (QDomElement element_xml, QET::findInDomElement(root, "elements", "element")) // read all elements from the diagram
|
||||||
{
|
{
|
||||||
if (!Element::valideXml(element_xml)) continue;
|
if (!Element::valideXml(element_xml)) continue;
|
||||||
|
|
||||||
@@ -1027,7 +1027,8 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
}
|
}
|
||||||
|
|
||||||
int state = 0;
|
int state = 0;
|
||||||
Element *nvel_elmt = ElementFactory::Instance() -> createElement(element_location, nullptr, &state); // read element definition!
|
// Create element from the collection
|
||||||
|
Element *nvel_elmt = ElementFactory::Instance() -> createElement(element_location, nullptr, &state); // read element definition from the collection!
|
||||||
if (state)
|
if (state)
|
||||||
{
|
{
|
||||||
QString debug_message = QString("Diagram::fromXml() : Le chargement de la description de l'element %1 a echoue avec le code d'erreur %2").arg(element_location.path()).arg(state);
|
QString debug_message = QString("Diagram::fromXml() : Le chargement de la description de l'element %1 a echoue avec le code d'erreur %2").arg(element_location.path()).arg(state);
|
||||||
@@ -1038,7 +1039,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
|
|
||||||
addItem(nvel_elmt);
|
addItem(nvel_elmt);
|
||||||
//Loading fail, remove item from the diagram
|
//Loading fail, remove item from the diagram
|
||||||
if (!nvel_elmt->fromXml(element_xml, table_adr_id, handle_inputs_rotation))
|
if (!nvel_elmt->fromXml(element_xml, table_adr_id, handle_inputs_rotation)) // load element definition from the diagram
|
||||||
{
|
{
|
||||||
removeItem(nvel_elmt);
|
removeItem(nvel_elmt);
|
||||||
delete nvel_elmt;
|
delete nvel_elmt;
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ Element::Element(const ElementsLocation &location, QGraphicsItem *parent, int *s
|
|||||||
}
|
}
|
||||||
int elmt_state;
|
int elmt_state;
|
||||||
qDebug() << "\tCollection Path: " << location.collectionPath();
|
qDebug() << "\tCollection Path: " << location.collectionPath();
|
||||||
buildFromXml(location.xml(), &elmt_state);
|
buildFromXml(location.xml(), &elmt_state); // build from the collection definition
|
||||||
if (state) {
|
if (state) {
|
||||||
*state = elmt_state;
|
*state = elmt_state;
|
||||||
}
|
}
|
||||||
@@ -338,7 +338,7 @@ void Element::drawHighlight(QPainter *painter, const QStyleOptionGraphicsItem *o
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Element::buildFromXml
|
* @brief Element::buildFromXml
|
||||||
* Build this element from an xml description
|
* Build this element from an xml description (from the collection)
|
||||||
* @param xml_def_elmt
|
* @param xml_def_elmt
|
||||||
* @param state
|
* @param state
|
||||||
* Optional pointer which define the status of build
|
* Optional pointer which define the status of build
|
||||||
@@ -638,7 +638,7 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
|
|||||||
les bornes vont maintenant etre recensees pour associer leurs id a leur adresse reelle
|
les bornes vont maintenant etre recensees pour associer leurs id a leur adresse reelle
|
||||||
ce recensement servira lors de la mise en place des fils
|
ce recensement servira lors de la mise en place des fils
|
||||||
*/
|
*/
|
||||||
QList<QDomElement> liste_terminals;
|
QList<QDomElement> liste_terminals; // terminals in the element in the diagram
|
||||||
foreach(QDomElement qde, QET::findInDomElement(e, "terminals", "terminal")) {
|
foreach(QDomElement qde, QET::findInDomElement(e, "terminals", "terminal")) {
|
||||||
if (Terminal::valideXml(qde)) liste_terminals << qde;
|
if (Terminal::valideXml(qde)) liste_terminals << qde;
|
||||||
}
|
}
|
||||||
@@ -647,7 +647,7 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
|
|||||||
int terminals_non_trouvees = 0;
|
int terminals_non_trouvees = 0;
|
||||||
// The added childs from the collection now must match with the terminals from the diagram. Iterate through
|
// The added childs from the collection now must match with the terminals from the diagram. Iterate through
|
||||||
// all Terminals in the collection and in the diagram to link them together
|
// all Terminals in the collection and in the diagram to link them together
|
||||||
foreach(QGraphicsItem *qgi, childItems()) { // Where the Terminals are added as childs?
|
for(QGraphicsItem *qgi: childItems()) { // TODO: Where the Terminals are added as childs?
|
||||||
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) {
|
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) {
|
||||||
bool terminal_trouvee = false;
|
bool terminal_trouvee = false;
|
||||||
foreach(QDomElement qde, liste_terminals) {
|
foreach(QDomElement qde, liste_terminals) {
|
||||||
|
|||||||
Reference in New Issue
Block a user