]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Constructor/pump.cpp
Se agrega generacion de XML para dar el estado actual de la planta simulada.
[z.facultad/75.42/plaqui.git] / Constructor / pump.cpp
index c2f2edb22f8b187769f0d02ad2a709db515823fb..515dc908d848c2df294bd75eab9fc10c99693bc5 100644 (file)
@@ -14,6 +14,11 @@ Pump::Pump()
        ref->get_widget_derived("pump_pty_wnd",pump_pty_wnd);
        pump_pty_wnd->pump = this;
        name = "bomba";
        ref->get_widget_derived("pump_pty_wnd",pump_pty_wnd);
        pump_pty_wnd->pump = this;
        name = "bomba";
+       
+       Connector temp;
+       temp.id_dest = -1;
+       temp.type = OUT;
+       connect_vec.push_back(temp);
 }
 
 Pump::~Pump()
 }
 
 Pump::~Pump()
@@ -120,25 +125,32 @@ void Pump::save(FILE *archivo)
 
 bool Pump::check_connection()
 {
 
 bool Pump::check_connection()
 {
+       ConnectorType temp;
        switch (get_img_actual()) {
                case 0:
        switch (get_img_actual()) {
                case 0:
-                       if ( is_other_connection_area( get_position_x()+get_image()->get_width()+5 , get_position_y() +16) )
-                               return true;                            
+                       temp = is_other_connection_area( get_position_x()+get_image()->get_width()+5 , get_position_y() +16);
                        break;
                case 1:
                        break;
                case 1:
-                       if ( is_other_connection_area( get_position_x() -5, get_position_y() +16) )
-                               return true;
+                       temp =  is_other_connection_area( get_position_x() -5, get_position_y() +16);
        }
        }
-       return false;
+       return (is_connected = ( temp == IN) );
 }
 
 }
 
-bool Pump::is_connection_area(int _a, int _b)
+ConnectorType Pump::get_connector_type(int _a, int _b)
 {
        switch (imgActual) {
 {
        switch (imgActual) {
-               case 0: if ( (_a <= x+image->get_width()-1)&&(_a>=x+image->get_width()-10)&&(_b<=y+22)&&(_b > y) ) 
-                                               return true;
-               case 1: if ( (_a <= x+10)&&(_a > x)&&(_b<=y+22)&&(_b > y) ) 
-                                               return true;
+               case 0: 
+                       if ( (_a <= x+image->get_width()-1)&&(_a>=x+image->get_width()-10)&&(_b<=y+22)&&(_b > y) )  //derecha.
+                               return connect_vec[0].type;
+                       break;
+               case 1: 
+                       if ( (_a <= x+10)&&(_a > x)&&(_b<=y+22)&&(_b > y) ) //izquierda
+                               return connect_vec[0].type;
        }
        }
-       return false;
+       return UNDEF;
+}
+
+void Pump::set_default_connector()
+{
+       connect_vec[0].type = OUT;
 }
 }