+ std::cout<<"check_connection logic"<<std::endl;
+ std::list<CItem *>::iterator j = lista_logic_Items.begin();
+ while ( j != lista_logic_Items.end() ) {
+ if ( !(*j)->check_connection() ) {
+ name = (*j)->get_name();
+ return false;
+ }
+ j++;
+ }
+ return true;
+}
+
+Pump *Constructor::loadBomba(xmlNodePtr nodo)
+{
+ std::string name = (char *)xmlGetProp(nodo, BAD_CAST"nombre");
+ std::string id = (char *)xmlGetProp(nodo, BAD_CAST"id");
+ int orientacion=0, x, y;
+ float flujo;
+
+ nodo = nodo->children;
+ while (nodo != NULL) {
+ if (nodo->type == XML_ELEMENT_NODE) {
+ if (xmlStrcmp(nodo->name, BAD_CAST"orientacion") == 0) {
+ orientacion = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"x") == 0) {
+ x = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"y") == 0) {
+ y = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"entrega") == 0) {
+ flujo = atof( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"color") == 0) {
+ // FIXME !
+ }
+ }
+ nodo = nodo->next;
+ }
+
+ Pump *p = new Pump(orientacion);
+ p->set_position(x,y);
+ p->set_entrega(flujo);
+ p->set_id( atoi(id.c_str()) );
+ p->set_name(name);
+
+ return p;
+}
+
+Conduct *Constructor::loadConduct(xmlNodePtr nodo)
+{
+ std::string name = (char *)xmlGetProp(nodo, BAD_CAST"nombre");
+ std::string id = (char *)xmlGetProp(nodo, BAD_CAST"id");
+ int orientacion=0, x, y;
+ float flujo;
+
+ nodo = nodo->children;
+ while (nodo != NULL) {
+ if (nodo->type == XML_ELEMENT_NODE) {
+ if (xmlStrcmp(nodo->name, BAD_CAST"orientacion") == 0) {
+ orientacion = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"x") == 0) {
+ x = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"y") == 0) {
+ y = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"caudal") == 0) {
+ flujo = atof( (char *)XML_GET_CONTENT(nodo->children) );
+ }
+ }
+ nodo = nodo->next;
+ }
+
+ Conduct *p = new Conduct(orientacion);
+ p->set_position(x,y);
+ p->set_caudal(flujo);
+ p->set_id( atoi(id.c_str()) );
+ p->set_name(name);
+
+ return p;
+}
+
+Exclusa *Constructor::loadExclusa(xmlNodePtr nodo)
+{
+ std::string name = (char *)xmlGetProp(nodo, BAD_CAST"nombre");
+ std::string id = (char *)xmlGetProp(nodo, BAD_CAST"id");
+ std::string estado;
+ int orientacion=0, x, y;
+ float flujo;
+
+ nodo = nodo->children;
+ while (nodo != NULL) {
+ if (nodo->type == XML_ELEMENT_NODE) {
+ if (xmlStrcmp(nodo->name, BAD_CAST"orientacion") == 0) {
+ orientacion = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"x") == 0) {
+ x = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"y") == 0) {
+ y = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"estado") == 0) {
+ estado = (char *)XML_GET_CONTENT(nodo->children);
+ }
+ }
+ nodo = nodo->next;
+ }
+
+ Exclusa *p = new Exclusa(orientacion);
+ p->set_position(x,y);
+ p->set_id( atoi(id.c_str()) );
+ p->set_name(name);
+ p->set_estado( estado == "1" );
+
+ return p;
+}
+
+Cistern *Constructor::loadTank(xmlNodePtr nodo)
+{
+ std::string name = (char *)xmlGetProp(nodo, BAD_CAST"nombre");
+ std::string id = (char *)xmlGetProp(nodo, BAD_CAST"id");
+ int orientacion=0, x, y;
+ float liquido,capacidad;
+
+ nodo = nodo->children;
+ while (nodo != NULL) {
+ if (nodo->type == XML_ELEMENT_NODE) {
+ if (xmlStrcmp(nodo->name, BAD_CAST"orientacion") == 0) {
+ orientacion = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"x") == 0) {
+ x = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"y") == 0) {
+ y = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"capacidad") == 0) {
+ capacidad = atof ((char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"inicial") == 0) {
+ liquido = atof ((char *)XML_GET_CONTENT(nodo->children) );
+ }
+ }
+ nodo = nodo->next;
+ }
+
+ Cistern *p = new Cistern(orientacion);
+ p->set_position(x,y);
+ p->set_id( atoi(id.c_str()) );
+ p->set_name(name);
+ p->set_capacidad(capacidad);
+ p->set_contenido_inicial(liquido);
+
+ return p;
+}
+
+Union *Constructor::loadUnion(xmlNodePtr nodo)
+{
+ std::string name = (char *)xmlGetProp(nodo, BAD_CAST"nombre");
+ std::string id = (char *)xmlGetProp(nodo, BAD_CAST"id");
+ std::string tipo;
+ int orientacion=0, x, y;
+ float caudal;
+
+ nodo = nodo->children;
+ while (nodo != NULL) {
+ if (nodo->type == XML_ELEMENT_NODE) {
+ if (xmlStrcmp(nodo->name, BAD_CAST"orientacion") == 0) {
+ orientacion = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"x") == 0) {
+ x = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"y") == 0) {
+ y = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"caudal") == 0) {
+ caudal = atof ((char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"tipo") == 0) {
+ tipo = (char *)XML_GET_CONTENT(nodo->children);
+ }
+ }
+ nodo = nodo->next;
+ }
+
+ Union *p = new Union(orientacion);
+ p->set_position(x,y);
+ p->set_id( atoi(id.c_str()) );
+ p->set_name(name);
+ p->set_caudal(caudal);
+ p->is_union = (tipo == "union");
+
+ return p;
+}
+
+Drain *Constructor::loadDrain(xmlNodePtr nodo)
+{
+ std::string name = (char *)xmlGetProp(nodo, BAD_CAST"nombre");
+ std::string id = (char *)xmlGetProp(nodo, BAD_CAST"id");
+ int orientacion=0, x, y;
+
+ nodo = nodo->children;
+ while (nodo != NULL) {
+ if (nodo->type == XML_ELEMENT_NODE) {
+ if (xmlStrcmp(nodo->name, BAD_CAST"orientacion") == 0) {
+ orientacion = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"x") == 0) {
+ x = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"y") == 0) {
+ y = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ }
+ }
+ nodo = nodo->next;
+ }
+
+ Drain *p = new Drain(orientacion);
+ p->set_position(x,y);
+ p->set_id( atoi(id.c_str()) );
+ p->set_name(name);
+
+ return p;
+}
+
+Splitter *Constructor::loadCodo(xmlNodePtr nodo)
+{
+ std::string name = (char *)xmlGetProp(nodo, BAD_CAST"nombre");
+ std::string id = (char *)xmlGetProp(nodo, BAD_CAST"id");
+ int orientacion=0, x, y;
+ float caudal;
+
+ nodo = nodo->children;
+ while (nodo != NULL) {
+ if (nodo->type == XML_ELEMENT_NODE) {
+ if (xmlStrcmp(nodo->name, BAD_CAST"orientacion") == 0) {
+ orientacion = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"x") == 0) {
+ x = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"y") == 0) {
+ y = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"caudal") == 0) {
+ caudal = atof( (char *)XML_GET_CONTENT(nodo->children) );
+ }
+ }
+ nodo = nodo->next;
+ }
+
+ Splitter *p = new Splitter(orientacion);
+ p->set_position(x,y);
+ p->set_id( atoi(id.c_str()) );
+ p->set_name(name);
+ p->set_caudal(caudal);
+
+ return p;