entre todos podemos descubrir cual es el item que me trae problemas.
me imagino que para poder descubrir esto tendrian que ver la implementacion, pero cualquier cosa se las cuento hoy a la noche, igual es facil pero medio ilegible.
Otra cosa, mas que nada para Richard, los items te los mando conectados o los conectas vos???
a mi me parcee que si los conecto yo tendrias una tarea engorrosa menos en el cliente, decime vos..
nada mas
{
switch (get_img_actual()) {
case 0:
- if ( is_other_occupied_area( get_position_x()+get_image()->get_width()+10 , get_position_y()+get_image()->get_height() -10) &&
- is_other_occupied_area( get_position_x() + 10, get_position_y() - 10) )
+ if ( is_other_connection_area( get_position_x()+get_image()->get_width() + 5 , get_position_y()+get_image()->get_height() -16) &&
+ is_other_connection_area( get_position_x() + 16, get_position_y() - 5) )
return true;
- break;
case 1:
- if ( is_other_occupied_area( get_position_x() -10, get_position_y()+get_image()->get_height()-10) &&
- is_other_occupied_area( get_position_x()+get_image()->get_width() - 10, get_position_y() - 10) )
+ if ( is_other_connection_area( get_position_x() -5, get_position_y()+get_image()->get_height()-16) &&
+ is_other_connection_area( get_position_x()+get_image()->get_width() - 16, get_position_y() - 5) )
return true;
}
return false;
}
+
+bool Cistern::is_connection_area(int _a, int _b)
+{
+ switch (imgActual) {
+ case 0: if ( ( (_a <= x+22)&&(_a>=x+10)&&(_b<=y+10)&&(_b > y) ) ||
+ ( (_a <= x+image->get_width()-1)&&(_a >=x+image->get_width()-10)&&(_b<=y+image->get_height()-10)&&(_b >=y+image->get_height()-22) ) )
+ return true;
+ case 1: if ( ( (_a <= x+image->get_width()-10)&&(_a>=x+image->get_width()-22)&&(_b<=y+10)&&(_b > y) ) ||
+ ( (_a <= x +10)&&(_a > x)&&(_b<=y+image->get_height()-10)&&(_b >=y+image->get_height()-22) ) )
+ return true;
+ }
+ return false;
+}
virtual void on_menu_popup_rotar();
virtual void on_menu_popup_propiedades();
void set_capacidad(double _cap);
- double get_capacidad();
void set_contenido_inicial(double _ini);
double get_contenido_inicial();
+ double get_capacidad();
virtual void save(FILE *archivo);
virtual bool check_connection();
+ virtual bool is_connection_area(int _a, int _b);
protected:
double capacidad, contenido_inicial;
Glib::RefPtr<Gdk::Pixbuf> imageE; // 0
{
switch (get_img_actual()) {
case 0:
- if ( is_other_occupied_area( get_position_x()+10, get_position_y()-10) &&
- is_other_occupied_area( get_position_x()+get_image()->get_width()-10, get_position_y()+get_image()->get_height() +10) )
+ if ( is_other_connection_area( get_position_x()+16, get_position_y()-5) &&
+ is_other_connection_area( get_position_x()+16, get_position_y()+get_image()->get_height() +5) )
return true;
break;
case 1:
- if ( is_other_occupied_area( get_position_x()-10, get_position_y()+10) &&
- is_other_occupied_area( get_position_x()+get_image()->get_width()+10, get_position_y()+get_image()->get_height()-10) )
+ if ( is_other_connection_area( get_position_x()-5, get_position_y()+16) &&
+ is_other_connection_area( get_position_x()+get_image()->get_width()+5, get_position_y()+16) )
+ return true;
+ }
+ return false;
+}
+
+bool Conduct::is_connection_area(int _a, int _b)
+{
+ switch (imgActual){
+ case 0:
+ if ( ((_a <= x+image->get_width()-10 )&&(_a >= x + 10) && (_b <= y+10) &&(_b > 0 )) ||
+ ((_a <= x+22 )&&(_a >= x + 10) && (_b <= y+image->get_height()-1) &&(_b >= y+image->get_height()-10 )) )
+ return true;
+ case 1:
+ if ( ((_a <= x+10 )&&(_a > 0) && (_b <= y+image->get_height()-10) &&(_b >= y+10 )) ||
+ ((_a <= x+image->get_width()-1)&&(_a >= x+image->get_width()-10) && (_b <= y+image->get_height()-10) &&(_b >= y +10 )) )
return true;
}
return false;
virtual void on_menu_popup_propiedades();
virtual void save(FILE *archivo);
virtual bool check_connection();
+ virtual bool is_connection_area(int _a, int _b);
private:
Glib::RefPtr<Gdk::Pixbuf> imageN; // 0
Glib::RefPtr<Gdk::Pixbuf> imageS; // 1
return true;
}
+void Exclusa::set_estado(bool _state)
+{
+ estado = _state;
+}
+
+bool Exclusa::get_estado()
+{
+ return estado;
+}
+
void Exclusa::on_menu_popup_rotar()
{
GdkEventButton event;
{
switch (get_img_actual()) {
case 0:
- if ( is_other_occupied_area( get_position_x()+get_image()->get_width()+10, get_position_y()+10) &&
- is_other_occupied_area( get_position_x()-10, get_position_y() + 10) )
+ if ( is_other_connection_area( get_position_x()+get_image()->get_width()+5, get_position_y()+16) &&
+ is_other_connection_area( get_position_x()-5, get_position_y() + 16) )
return true;
break;
case 1:
- if ( is_other_occupied_area( get_position_x()+10, get_position_y()-10 ) &&
- is_other_occupied_area( get_position_x()+get_image()->get_width()-10, get_position_y()+get_image()->get_height()+10) )
+ if ( is_other_connection_area( get_position_x()+16, get_position_y()-5 ) &&
+ is_other_connection_area( get_position_x()+16, get_position_y()+get_image()->get_height()+5) )
return true;
}
return false;
}
-void Exclusa::set_estado(bool _state)
+bool Exclusa::is_connection_area(int _a, int _b)
{
- estado = _state;
-}
-
-bool Exclusa::get_estado()
-{
- return estado;
+ switch (imgActual){
+ case 0:
+ if ( ((_a <= x+10 )&&(_a > 0) && (_b <= y+image->get_height()-10) &&(_b >= y+10 )) ||
+ ((_a <= x+image->get_width()-1)&&(_a >= x+image->get_width()-10) && (_b <= y+image->get_height()-10) &&(_b >= y +10 )) )
+ return true;
+ case 1:
+ if ( ((_a <= x+image->get_width()-10 )&&(_a >= x + 10) && (_b <= y+10) &&(_b > 0 )) ||
+ ((_a <= x+22 )&&(_a >= x + 10) && (_b <= y+image->get_height()-1) &&(_b >= y+image->get_height()-10 )) )
+ return true;
+ }
+ return false;
}
virtual void on_menu_popup_propiedades();
virtual void save(FILE *archivo);
virtual bool check_connection();
+ virtual bool is_connection_area(int _a, int _b);
void set_estado(bool _state);
bool get_estado();
private:
else return false;
}
-bool CItem::is_other_occupied_area(int _a, int _b)
+bool CItem::is_other_connection_area(int _a, int _b)
{
std::list<CItem *>::iterator i = listaItems->begin();
while ( i != listaItems->end() ){
CItem *temp = *i;
- if ( temp->is_occupied_area(_a,_b) )
+ if ( temp->is_connection_area(_a,_b) )
return true;
i++;
}
void set_conector_in(int _in);
void set_conector_out(int _out);
bool is_occupied_area(int _a, int _b);
- bool is_other_occupied_area(int _a, int _b);
+ bool is_other_connection_area(int _a, int _b);
virtual void save(FILE *archivo) = 0;
virtual bool check_connection()=0;
+ virtual bool is_connection_area(int _a, int _b)=0;
Glib::ustring get_name();
WorkPlace *workplace;
Gtk::Entry *combo_entry;
{
switch (get_img_actual()) {
case 0:
- if ( is_other_occupied_area( get_position_x()+get_image()->get_width()+10 , get_position_y() +10) )
+ if ( is_other_connection_area( get_position_x()+get_image()->get_width()+5 , get_position_y() +16) )
return true;
break;
case 1:
- if ( is_other_occupied_area( get_position_x() -10, get_position_y() -10) )
+ if ( is_other_connection_area( get_position_x() -5, get_position_y() +16) )
return true;
}
return false;
}
+
+bool Pump::is_connection_area(int _a, int _b)
+{
+ 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;
+ }
+ return false;
+}
double get_entrega();
virtual void save(FILE *archivo);
virtual bool check_connection();
+ virtual bool is_connection_area(int _a, int _b);
protected:
double entrega;
Glib::RefPtr<Gdk::Pixbuf> imageE; // 0
{
switch (get_img_actual()) {
case 0:
- if ( is_other_occupied_area( get_position_x()-10, get_position_y()+10) &&
- is_other_occupied_area( get_position_x()+get_image()->get_width()-10, +get_position_y()+get_image()->get_height() + 10) )
+ if ( is_other_connection_area( get_position_x()-5, get_position_y()+16) &&
+ is_other_connection_area( get_position_x()+get_image()->get_width()-16, +get_position_y()+get_image()->get_height() + 5) )
return true;
break;
case 1:
- if ( is_other_occupied_area( get_position_x()+get_image()->get_width() - 10, get_position_y() -10) &&
- is_other_occupied_area( get_position_x()-10, get_position_y()+get_image()->get_height()-10) )
+ if ( is_other_connection_area( get_position_x()+get_image()->get_width() - 16, get_position_y() -5) &&
+ is_other_connection_area( get_position_x()-5, get_position_y()+get_image()->get_height()-16) )
return true;
break;
case 2:
- if ( is_other_occupied_area( get_position_x() + 10, get_position_y() -10) &&
- is_other_occupied_area( get_position_x()+get_image()->get_width()+10, get_position_y()+get_image()->get_height()-10) )
+ if ( is_other_connection_area( get_position_x() + 16, get_position_y() -5) &&
+ is_other_connection_area( get_position_x()+get_image()->get_width()+5, get_position_y()+get_image()->get_height()-16) )
return true;
break;
case 3:
- if ( is_other_occupied_area( get_position_x()+get_image()->get_width()+10, get_position_y() +10) &&
- is_other_occupied_area( get_position_x() + 10, get_position_y()+get_image()->get_height() + 10) )
+ if ( is_other_connection_area( get_position_x()+get_image()->get_width()+5, get_position_y() +16) &&
+ is_other_connection_area( get_position_x() + 16, get_position_y()+get_image()->get_height() + 5) )
return true;
}
return false;
}
+
+bool Splitter::is_connection_area(int _a, int _b)
+{
+ switch (imgActual) {
+ case 0: if ( ( (_a <= x+10)&&(_a > x) && (_b <=y+22)&&(_b>=y+10) ) ||
+ ( (_a <= x+image->get_width()-10)&&(_a>=x+image->get_width()-22)&&(_b<=y+image->get_height()-1)&&(_b>=y+image->get_height()-10) ) )
+ return true;
+ case 1: if ( ( (_a <= x+image->get_width()-10)&&(_a >= x+image->get_width()-22) && (_b <=y+10)&&(_b > y) ) ||
+ ( (_a <= x+10)&&(_a > x)&&(_b<=y+image->get_height()-10)&&(_b>=y+image->get_height()-22) ) )
+ return true;
+ case 2: if ( ( (_a <= x+22)&&(_a >= x+10) && (_b <=y+10)&&(_b > y) ) ||
+ ( (_a <= x+image->get_width()-1)&&(_a>=x+image->get_width()-10)&&(_b<=y+image->get_height()-10)&&(_b>=y+image->get_height()-22) ) )
+ return true;
+ case 3: if ( ( (_a <= x+image->get_width()-1)&&(_a >= x+image->get_width()-10) && (_b <=y+22)&&(_b>=y+10) ) ||
+ ( (_a <= x+22)&&(_a>=x+10)&&(_b<=y+image->get_height()-1)&&(_b>=y+image->get_height()-10) ) )
+ return true;
+ }
+ return false;
+}
virtual void on_menu_popup_propiedades();
virtual void save(FILE *archivo);
virtual bool check_connection();
+ virtual bool is_connection_area(int _a, int _b);
private:
Glib::RefPtr<Gdk::Pixbuf> imageN; // 0
Glib::RefPtr<Gdk::Pixbuf> imageS; // 1
{
switch (get_img_actual()) {
case 0:
- if ( is_other_occupied_area( get_position_x() - 10, get_position_y() +10) &&
- is_other_occupied_area( get_position_x()+get_image()->get_width()+10, get_position_y()+10) &&
- is_other_occupied_area( get_position_x()+get_image()->get_width()/2, get_position_y()+get_image()->get_height()+10) )
+ if ( is_other_connection_area( get_position_x() - 5, get_position_y() +16) &&
+ is_other_connection_area( get_position_x()+get_image()->get_width()+5, get_position_y()+16) &&
+ is_other_connection_area( get_position_x()+get_image()->get_width()/2, get_position_y()+get_image()->get_height()+5) )
return true;
break;
case 1:
- if ( is_other_occupied_area( get_position_x()-10, get_position_y()+get_image()->get_height()/2) &&
- is_other_occupied_area( get_position_x()+get_image()->get_width()-10, get_position_y()-10) &&
- is_other_occupied_area( get_position_x()+get_image()->get_width()-10, get_position_y()+get_image()->get_height()+10) )
+ if ( is_other_connection_area( get_position_x()-5, get_position_y()+get_image()->get_height()/2) &&
+ is_other_connection_area( get_position_x()+get_image()->get_width()-16, get_position_y()-5) &&
+ is_other_connection_area( get_position_x()+get_image()->get_width()-16, get_position_y()+get_image()->get_height()+5) )
return true;
break;
case 2:
- if ( is_other_occupied_area( get_position_x()-10, get_position_y()+get_image()->get_height()-10) &&
- is_other_occupied_area( get_position_x()+get_image()->get_width()/2, get_position_y()-10) &&
- is_other_occupied_area( get_position_x()+get_image()->get_width()+10, get_position_y()+get_image()->get_height()-10) )
+ if ( is_other_connection_area( get_position_x()-5, get_position_y()+get_image()->get_height()-16) &&
+ is_other_connection_area( get_position_x()+get_image()->get_width()/2, get_position_y()-5) &&
+ is_other_connection_area( get_position_x()+get_image()->get_width()+5, get_position_y()+get_image()->get_height()-16) )
return true;
break;
case 3:
- if ( is_other_occupied_area( get_position_x()+10, get_position_y()-10) &&
- is_other_occupied_area( get_position_x()+get_image()->get_width()+10, get_position_y()+get_image()->get_height()/2) &&
- is_other_occupied_area( get_position_x()+10, get_position_y()+get_image()->get_height()+10) )
+ if ( is_other_connection_area( get_position_x()+16, get_position_y()-5) &&
+ is_other_connection_area( get_position_x()+get_image()->get_width()+5, get_position_y()+get_image()->get_height()/2) &&
+ is_other_connection_area( get_position_x()+16, get_position_y()+get_image()->get_height()+5) )
return true;
}
return false;
}
+
+bool Union::is_connection_area(int _a, int _b)
+{
+ switch ( imgActual) {
+ case 0: if ( ((_a <= x+10) && (_a > x+1) && (_b<= y + 22) && (_b >= y+10)) ||
+ ((_a <= x+image->get_width()-1) && (_a >= x+image->get_width()-10)&&(_b <= y+22) && (_b >= y+10)) ||
+ ((_a <= x+image->get_width()/2 + 5)&&( _a>= x+image->get_width()/2 - 5) && (_b<=y+image->get_height()-1)&&(_b >= y+image->get_height()-10)) )
+ return true;
+ case 1: if ( ((_a <= x+image->get_width()-10) && (_a >= x+image->get_width() -22) && (_b<= y + 10) && (_b > y )) ||
+ ((_a <= x +10) && (_a > x )&&(_b <= y+image->get_height()/2+5 ) && (_b >= y+image->get_height()/2-5)) ||
+ ((_a <= x+image->get_width() - 10)&&( _a>= x+image->get_width()-22) && (_b<=y+image->get_height()-1)&&(_b >= y+image->get_height()-10)) )
+ return true;
+ case 2: if ( ((_a <= x+10) && (_a > x+1) && (_b<= y+image->get_height()-1) && (_b >= y+image->get_height()-10)) ||
+ ((_a <= x+image->get_width()-1) && (_a >= x+image->get_width()-10)&&(_b <= y+image->get_height()-10) && (_b >= y+image->get_height()-22)) ||
+ ((_a <= x+image->get_width()/2 + 5)&&( _a>= x+image->get_width()/2 - 5) && (_b<=y+10)&&(_b > y)) )
+ return true;
+ case 3: if ( ((_a <= x+22) && (_a >= x+10) && (_b<= y + 10) && (_b > y )) ||
+ ((_a <= x+22) && (_a >= x+10 )&&(_b <= y+image->get_height()-1 ) && (_b >= y+image->get_height()+10)) ||
+ ((_a <= x+image->get_width() -1)&&( _a>= x+image->get_width()-10) && (_b<=y+image->get_height()/2+5)&&(_b >= y+image->get_height()/2-5)) )
+ return true;
+ }
+ return false;
+}
virtual void on_menu_popup_propiedades();
virtual void save(FILE *archivo);
virtual bool check_connection();
+ virtual bool is_connection_area(int _a, int _b);
private:
Glib::RefPtr<Gdk::Pixbuf> imageN; // 0
Glib::RefPtr<Gdk::Pixbuf> imageS; // 1