X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/2695534342641710721ae3d842915094b384f9db..789188ab0bf658fdf35c99e7bd2cfabab41091f2:/Constructor/item.cpp?ds=sidebyside diff --git a/Constructor/item.cpp b/Constructor/item.cpp index b4a42fe..4bec05d 100644 --- a/Constructor/item.cpp +++ b/Constructor/item.cpp @@ -1,5 +1,5 @@ #include "item.h" -#include +#include "workplace.h" CItem::CItem(const char *filename):Gtk::DrawingArea() { @@ -9,6 +9,13 @@ CItem::CItem(const char *filename):Gtk::DrawingArea() CItem::CItem() { + Glib::RefPtr ref; + ref = Gnome::Glade::Xml::create("constructor.glade", "item_pty_wnd"); + ref->get_widget_derived("item_pty_wnd",property_wnd); + caudal_max = 0.0; + is_union = true; + is_connected = false; + property_wnd->item = this; menu_image_propiedades.set(Gtk::Stock::PREFERENCES, Gtk::ICON_SIZE_MENU); menu_image_delete.set(Gtk::Stock::CANCEL, Gtk::ICON_SIZE_MENU); menu_image_rotar.set(Gtk::Stock::REFRESH, Gtk::ICON_SIZE_MENU); @@ -54,20 +61,67 @@ void CItem::on_menu_popup_conectar() { } +int CItem::get_position_x() +{ + return x; +} + +int CItem::get_position_y() +{ + return y; +} + +int CItem::get_id() +{ + return ID; +} + +double CItem::get_caudal() +{ + return caudal_max; +} + + +Glib::ustring CItem::get_name() +{ + return name; +} + +Glib::ustring CItem::get_other_name(int _id) +{ + std::list::iterator i = listaItems->begin(); + while ( i != listaItems->end() ) { + if ( (*i)->get_id() == _id ) + return (*i)->get_name(); + i++; + } + return name; +} + +int CItem::get_img_actual() +{ + return imgActual; +} + void CItem::set_position(int _x, int _y) { this->x = _x; this->y = _y; } -int CItem::get_position_x() +void CItem::set_id(int _id) { - return x; + ID = _id; } -int CItem::get_position_y() +void CItem::set_caudal(double _caudal) { - return y; + caudal_max = _caudal; +} + +void CItem::set_name(Glib::ustring _name) +{ + name = _name; } bool CItem::is_occupied_area(int _a, int _b) @@ -77,12 +131,25 @@ bool CItem::is_occupied_area(int _a, int _b) else return false; } -void CItem::set_id(int _id) +ConnectorType CItem::is_other_connection_area(int _a, int _b, CItem **_item) { - ID = _id; + ConnectorType temp2; + std::list::iterator i = listaItems->begin(); + while ( i != listaItems->end() ) { + CItem *temp = *i; + if (temp != this) + if ( (temp2 = temp->get_connector_type(_a,_b)) != UNDEF ) { + *_item = temp; + return temp2; + } + i++; + } + return UNDEF; } - -int CItem::get_id() +ConnectorType CItem::get_connector_type( int _a, int _b ) +{ + return UNDEF; +} +void CItem::set_default_connector() { - return ID; }