All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OutsideModelObservable.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file OutsideModelObservable.h
22 
23  \brief Abstract class to represent an observable. "Model" part of MVC widget. All classes representing the model of a widget must inherit from this class.
24 
25  \ingroup layout
26 */
27 
28 #ifndef __TERRALIB_LAYOUT_INTERNAL_OUTSIDE_MODEL_H
29 #define __TERRALIB_LAYOUT_INTERNAL_OUTSIDE_MODEL_H
30 
31 // TerraLib
32 #include "Observable.h"
33 #include "../../property/Properties.h"
34 #include "../../ContextItem.h"
35 #include "../../../../geometry/Envelope.h"
36 #include "../../../../geometry/Coord2D.h"
37 #include "../../Config.h"
38 
39 // STL
40 #include <set>
41 
42 namespace te
43 {
44  namespace layout
45  {
46  class Observer;
47 
48  /*!
49  \brief Abstract class to represent an observable. "Model" part of MVC widget. All classes representing the model of a widget must inherit from this class.
50 
51  \ingroup layout
52 
53  \sa te::layout::Observable
54  */
56  {
57  public:
58 
59  /*!
60  \brief Constructor
61  */
63 
64  /*!
65  \brief Destructor
66  */
67  virtual ~OutsideModelObservable();
68 
69  /*!
70  \brief Reimplemented from Observable
71  */
72  virtual bool addObserver(Observer* o);
73 
74  /*!
75  \brief Reimplemented from Observable
76  */
77  virtual bool removeObserver(Observer* o);
78 
79  /*!
80  \brief Reimplemented from Observable
81  */
82  virtual te::gm::Envelope getBox();
83 
84  /*!
85  \brief Change the bounding rectangle.
86 
87  \param bounding rectangle
88  */
89  virtual void setBox(te::gm::Envelope box);
90 
91  /*!
92  \brief Returns the background color of the MVC widget.
93 
94  \return background color
95  */
96  virtual int getColor();
97 
98  /*!
99  \brief Change the background color of the MVC widget.
100 
101  \param color background color
102  */
103  virtual void setColor(int color);
104 
105  /*!
106  \brief Change coordinate llx,lly of the MVC widget.
107 
108  \param x llx
109  \param y lly
110  */
111  virtual void setPosition(const double& x, const double& y);
112 
113  /*!
114  \brief Reimplemented from Observable
115  */
116  virtual EnumType* getType();
117 
118  /*!
119  \brief Reimplemented from Observable
120  */
121  virtual void setType(EnumType* type);
122 
123  /*!
124  \brief Reimplemented from Observable
125  */
126  virtual std::string getName();
127 
128  /*!
129  \brief Reimplemented from Observable
130  */
131  virtual int getZValue();
132 
133  /*!
134  \brief Reimplemented from Observable
135  */
136  virtual void setZValue(int zValue);
137 
138  /*!
139  \brief Reimplemented from Observable
140  */
141  virtual void updateProperties(te::layout::Properties* properties);
142 
143  /*!
144  \brief Reimplemented from Observable
145  */
146  virtual Properties* getProperties() const;
147 
148  /*!
149  \brief Reimplemented from Observable
150  */
151  virtual te::layout::Properties* getPublicProperties() const;
152 
153  /*!
154  \brief Reimplemented from Observable
155  */
156  virtual int getId();
157 
158  /*!
159  \brief Reimplemented from Observable
160  */
161  virtual void setId( int id );
162 
163  /*!
164  \brief Reimplemented from Observable
165  */
166  virtual int getHashCode();
167 
168  /*!
169  \brief Reimplemented from Observable
170  */
171  virtual void setResizable(bool resize);
172 
173  /*!
174  \brief Reimplemented from Observable
175  */
176  virtual bool isResizable();
177 
178  protected:
179 
180  /*!
181  \brief Reimplemented from Observable
182  */
183  virtual void notifyAll(ContextItem context);
184 
185  virtual int calculateHashCode();
186 
187  protected:
188 
189  std::set<Observer*> m_observers; //!< set of observers of this object
190  te::gm::Envelope m_box; //!< bounding rectangle
191  te::gm::Coord2D m_centerCoordinate; //!< center coordinate of the bounding rectangle
192  int m_color; //!< background color
193  Properties* m_properties; //!< properties
194  Properties* m_publicProperties; //!< public properties
195  EnumType* m_type; //!< type of the MVC widget
196  int m_zValue; //!< The Z value decides the stacking order of drawing
197  int m_id; //!< hashcode
198  bool m_resizable; //!< true if resizable, false otherwise
200  std::string m_name; //!< name of the MVC widget
201  };
202  }
203 }
204 
205 #endif
Abstract class to represent an observable. "Model" part of MVC component.
Definition: Observable.h:56
Class responsible for maintaining the drawing context of a MVC component. It is always used by the "M...
Definition: ContextItem.h:49
std::string m_name
name of the MVC widget
EnumType * m_type
type of the MVC widget
#define TELAYOUTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:99
std::set< Observer * > m_observers
set of observers of this object
te::gm::Coord2D m_centerCoordinate
center coordinate of the bounding rectangle
Abstract class to represent an observable. "Model" part of MVC component.
The Properties class represents a persistent set of properties. The Properties can be saved to a file...
Definition: Properties.h:52
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
int m_zValue
The Z value decides the stacking order of drawing.
Abstract class to represent an observer. "View" part of MVC component.
Definition: Observer.h:48
bool m_resizable
true if resizable, false otherwise
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
Abstract class to represent an observable. "Model" part of MVC widget. All classes representing the m...
Class that represents the value of an enumeration. An enumeration is made of "1..n" objects EnumType...
Definition: EnumType.h:48
Properties * m_publicProperties
public properties
te::gm::Envelope m_box
bounding rectangle