31 #include "../../property/Property.h"
32 #include "../../property/Properties.h"
33 #include "../singleton/Context.h"
34 #include "../../enum/Enums.h"
42 m_publicProperties(0),
68 if(m_publicProperties)
70 delete m_publicProperties;
71 m_publicProperties = 0;
77 std::pair<std::set<Observer*>::iterator,
bool> p = m_observers.insert(o);
87 int num = m_observers.erase(o);
97 std::set<Observer*>::iterator it;
98 for(it = m_observers.begin(); it != m_observers.end(); ++it)
100 (*it)->updateObserver(context);
128 double x2 = x + m_box.getWidth();
131 double y2 = y + m_box.getHeight();
138 m_properties->
clear();
143 m_properties->addProperty(pro_name);
145 m_properties->setTypeObj(m_type);
195 m_resizable = resize;
210 int nameLength = m_name.length();
215 type = m_type->getId();
218 int propertiesLength = 0;
226 propertiesLength = getProperties()->getProperties().size();
230 int hashcode = (nameLength +
id + type + propertiesLength) * 5;
233 std::time_t now = std::time(0);
235 std::tm *ltm = localtime(&now);
241 int year = 1900 + ltm->tm_year;
242 int month = 1 + ltm->tm_mon;
243 int day = ltm->tm_mday;
244 int hour = 1 + ltm->tm_hour;
245 int numberSecond = 1 + ltm->tm_min;
246 int numberMilliseconds = 1 + ltm->tm_sec;
248 hashcode *= year + month + day;
249 hashcode *= hour + numberSecond + numberMilliseconds;
256 if(!m_properties || m_publicProperties)
261 m_publicProperties->
clear();
263 std::vector<Property>::iterator it = m_properties->getProperties().begin();
265 for( ; it != m_properties->getProperties().end() ; ++it )
269 m_publicProperties->addProperty(*it);
273 m_publicProperties->setTypeObj(m_type);
275 return m_publicProperties;
virtual void setZValue(int zValue)
Reimplemented from Observable.
virtual void updateProperties(te::layout::Properties *properties)
Reimplemented from Observable.
Class responsible for maintaining the drawing context of a MVC component. It is always used by the "M...
Properties * m_properties
properties
virtual void setId(int id)
Reimplemented from Observable.
virtual bool removeObserver(Observer *o)
Reimplemented from Observable.
Class to represent a graphic object (MVC component) and widget object (MVC widget) type enumeration...
virtual EnumType * getType()
Reimplemented from Observable.
std::string m_name
name of the MVC widget
EnumType * m_type
type of the MVC widget
virtual void setHashCode(int hashCode)
Sets the hashcode of a MVC component.
Abstract class to represent an observer. "View" part of MVC component.
virtual bool isResizable()
Reimplemented from Observable.
The Properties class represents a persistent set of properties. The Properties can be saved to a file...
virtual std::vector< Property > getProperties()
Returns set of all properties.
virtual EnumType * getObjectUnknown() const
Returns value that represents unknown type belonging to enumeration.
virtual Properties * getProperties() const
Reimplemented from Observable.
Abstract class to represent an observer. "View" part of MVC component.
virtual void setColor(int color)
Change the background color of the MVC widget.
static Enums & getInstance()
It returns a reference to the singleton instance.
An Envelope defines a 2D rectangular region.
OutsideModelObservable()
Constructor.
virtual void setPosition(const double &x, const double &y)
Change coordinate llx,lly of the MVC widget.
virtual te::gm::Envelope getBox()
Reimplemented from Observable.
virtual void setBox(te::gm::Envelope box)
Change the bounding rectangle.
virtual int getColor()
Returns the background color of the MVC widget.
virtual int getId()
Reimplemented from Observable.
virtual te::layout::Properties * getPublicProperties() const
Reimplemented from Observable.
Abstract class to represent an observable. "Model" part of MVC widget. All classes representing the m...
virtual int calculateHashCode()
Returns a new hashcode.
Class that represents the value of an enumeration. An enumeration is made of "1..n" objects EnumType...
virtual void notifyAll(ContextItem context)
Reimplemented from Observable.
virtual bool clear()
Clear set of properties of this object.
Properties * m_publicProperties
public properties
virtual int getZValue()
Reimplemented from Observable.
void setName(std::string name)
Sets the name of this property.
virtual void setResizable(bool resize)
Reimplemented from Observable.
virtual void setType(EnumType *type)
Reimplemented from Observable.
virtual ~OutsideModelObservable()
Destructor.
virtual bool addObserver(Observer *o)
Reimplemented from Observable.
virtual std::string getName()
Reimplemented from Observable.
A property acts like a attribute member of a object and stores the state of this attribute. A set of properties stores the state of an object. Any data type, not included in the convertValue method in the class te::layout::Variant, it will be by default "std::string" value.
virtual int getHashCode()
Reimplemented from Observable.