return false;*/
return true;
}
-
-/*
-bool And::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_rotar();
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 UNDEF;
}
-
-/*
-ConnectorType Cistern::is_connection_area(int _a, int _b)
+
+void Cistern::set_default_connector()
{
- switch (imgActual) {
- case 0:
- if ( (_a <= x+22)&&(_a>=x+10)&&(_b<=y+10)&&(_b > y) )
- return connect_vec[0].type;
- if ( (_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 connect_vec[1].type;
- break;
- case 1:
- if ( (_a <= x+image->get_width()-10)&&(_a>=x+image->get_width()-22)&&(_b<=y+10)&&(_b > y) )
- return connect_vec[0].type;
- if ( (_a <= x +10)&&(_a > x)&&(_b<=y+image->get_height()-10)&&(_b >=y+image->get_height()-22) )
- return connect_vec[1].type;
- break;
- }
- return UNDEF;
+ connect_vec[0].type = IN;
+ connect_vec[1].type = OUT;
}
-*/
Gdk::Color get_liquid_color();
virtual void save(FILE *archivo);
virtual bool check_connection();
-// virtual ConnectorType is_connection_area(int _a, int _b);
+ virtual void set_default_connector();
virtual ConnectorType get_connector_type(int _a, int _b);
protected:
double capacidad, contenido_inicial;
/*si no estoy conectado pregunto por el del otro lado, y ahi puedo setear los dos
*si ya estoy devuelvo.
*/
-/*
-bool Conduct::is_connection_area(int _a, int _b)
+
+void Conduct::set_default_connector()
{
- 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;
+ connect_vec[0].type = UNDEF;
+ connect_vec[1].type = UNDEF;
}
-*/
virtual void on_menu_popup_propiedades();
virtual void save(FILE *archivo);
virtual bool check_connection();
-// virtual bool is_connection_area(int _a, int _b);
+ virtual void set_default_connector();
virtual ConnectorType get_connector_type(int _a, int _b);
private:
Glib::RefPtr<Gdk::Pixbuf> imageN; // 0
void Constructor::on_btn_canio_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time)
{
- gtk_selection_data_set (selection_data, selection_data->target, 8, (const guchar*)"canio_n.png", 14);
+ gtk_selection_data_set (selection_data, selection_data->target, 8, (const guchar*)"canio_n.png", 12);
}
void Constructor::on_btn_y_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time)
{
- gtk_selection_data_set(selection_data, selection_data->target, 8,(const guchar*)"y_n.png",10);
+ gtk_selection_data_set(selection_data, selection_data->target, 8,(const guchar*)"y_n.png",8);
}
void Constructor::on_btn_codo_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time)
{
- gtk_selection_data_set(selection_data, selection_data->target, 8 ,(const guchar*)"codo_o.png",13);
+ gtk_selection_data_set(selection_data, selection_data->target, 8 ,(const guchar*)"codo_o.png",10);
}
void Constructor::on_btn_tanque_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time)
{
- gtk_selection_data_set(selection_data, selection_data->target, 8,(const guchar*)"tanque_e.png",15);
+ gtk_selection_data_set(selection_data, selection_data->target, 8,(const guchar*)"tanque_e.png",12);
}
void Constructor::on_btn_bomba_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time)
{
- gtk_selection_data_set(selection_data, selection_data->target, 8,(const guchar*)"bomba_e.png",15);
+ gtk_selection_data_set(selection_data, selection_data->target, 8,(const guchar*)"bomba_e.png",11);
}
void Constructor::on_btn_exclusa_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time)
{
- gtk_selection_data_set(selection_data, selection_data->target, 8,(const guchar*)"exclusa_h.png",15);
+ gtk_selection_data_set(selection_data, selection_data->target, 8,(const guchar*)"exclusa_h.png",13);
}
void Constructor::on_btn_drain_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time)
void Constructor::on_item_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context, CItem *item)
{
context->set_icon(item->get_image(), 5, 5);
+ std::list<CItem *>::iterator i = listaItems.begin();
+ while ( i != listaItems.end() ){
+ (*i)->set_default_connector();
+ i++;
+ }
}
void Constructor::on_item_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time)
}
return UNDEF;
}
+
+void Drain::set_default_connector()
+{
+ connect_vec[0].type = IN;
+}
double get_capacidad();
virtual void save(FILE *archivo);
virtual bool check_connection();
- //virtual ConnectorType is_connection_area(int _a, int _b);
+ virtual void set_default_connector();
virtual ConnectorType get_connector_type(int _a, int _b);
protected:
Glib::RefPtr<Gdk::Pixbuf> imageE; // 0
ref->get_widget_derived("exclusa_pty_wnd",exclusa_pty_wnd);
exclusa_pty_wnd->exclusa = this;
name = "exclusa";
+
+ Connector temp;
+ temp.id_dest = -1;
+ temp.type = UNDEF;
+ connect_vec.push_back(temp);
+ connect_vec.push_back(temp);
}
Exclusa::~Exclusa()
}
return UNDEF;
}
-/*si no estoy conectado pregunto por el del otro lado, y ahi puedo setear los dos
- *si ya estoy devuelvo.
-*/
-/*bool Exclusa::is_connection_area(int _a, int _b)
+
+void Exclusa::set_default_connector()
{
- 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;
+ connect_vec[0].type = UNDEF;
+ connect_vec[1].type = UNDEF;
}
-*/
virtual void on_menu_popup_propiedades();
virtual void save(FILE *archivo);
virtual bool check_connection();
-// virtual ConnectorType is_connection_area(int _a, int _b);
+ virtual void set_default_connector();
virtual ConnectorType get_connector_type(int _a, int _b);
void set_estado(bool _state);
bool get_estado();
std::list<CItem *>::iterator i = listaItems->begin();
while ( i != listaItems->end() ) {
CItem *temp = *i;
- if (temp != this) {
+ if (temp != this)
if ( (temp2 = temp->get_connector_type(_a,_b)) != UNDEF )
return temp2;
- i++;
- }
+ i++;
}
return UNDEF;
}
{
return UNDEF;
}
+void CItem::set_default_connector()
+{
+}
ConnectorType is_other_connection_area(int _a, int _b);
virtual void save(FILE *archivo) = 0;
virtual bool check_connection()=0;
-// virtual ConnectorType is_connection_area(int _a, int _b)=0;
+ virtual void set_default_connector();
virtual ConnectorType get_connector_type( int _a, int _b );
WorkPlace *workplace;
Gtk::Entry *combo_entry;
return false;*/
return true;
}
-
-/*
-bool Not::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;
- return true;
-}
-*/
virtual void on_menu_popup_rotar();
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
// CAMBIAR TODO ESTO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
bool Or::check_connection()
{
- /*switch (get_img_actual()) {
- case 0:
- 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_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_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_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;*/
return true;
}
-
-/*
-bool Or::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_rotar();
virtual void save(FILE *archivo);
virtual bool check_connection();
- //virtual ConnectorType is_connection_area(int _a, int _b);
private:
Glib::RefPtr<Gdk::Pixbuf> imageN; // 0
Glib::RefPtr<Gdk::Pixbuf> imageS; // 1
}
return UNDEF;
}
-/*
-bool Pump::is_connection_area(int _a, int _b)
+
+void Pump::set_default_connector()
{
- 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;
+ connect_vec[0].type = OUT;
}
-*/
Gdk::Color get_liquid_color();
virtual void save(FILE *archivo);
virtual bool check_connection();
+ virtual void set_default_connector();
virtual ConnectorType get_connector_type(int _a, int _b);
protected:
double entrega;
return UNDEF;
}
-/*
-bool Splitter::is_connection_area(int _a, int _b)
+void Splitter::set_default_connector()
{
- 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;
+ connect_vec[0].type = UNDEF;
+ connect_vec[1].type = UNDEF;
}
-*/
virtual void on_menu_popup_propiedades();
virtual void save(FILE *archivo);
virtual bool check_connection();
-// virtual ConnectorType is_connection_area(int _a, int _b);
+ virtual void set_default_connector();
virtual ConnectorType get_connector_type(int _a, int _b);
private:
Glib::RefPtr<Gdk::Pixbuf> imageN; // 0
return UNDEF;
}
-/*
-ConnectorType Union::is_connection_area(int _a, int _b)
+void Union::set_default_connector()
{
- switch ( imgActual) {
- case 0: if ( ((_a <= x+10) && (_a > x+1) && (_b<= y + 22) && (_b >= y+10))
- retur
- ((_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) && (_b<= y+image->get_height()-10) && (_b >= y+image->get_height()-22)) ||
- ((_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;
+ if (is_union) {
+ connect_vec[0].type = IN;
+ connect_vec[1].type = IN;
+ connect_vec[2].type = OUT;
+ } else {
+ connect_vec[0].type = OUT;
+ connect_vec[1].type = OUT;
+ connect_vec[2].type = IN;
}
- return false;
-}*/
+}
virtual void on_menu_popup_propiedades();
virtual void save(FILE *archivo);
virtual bool check_connection();
- //virtual ConnectorType is_connection_area(int _a, int _b);
+ virtual void set_default_connector();
virtual ConnectorType get_connector_type(int _a, int _b);
private:
Glib::RefPtr<Gdk::Pixbuf> imageN; // 0