All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ItemController.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 ItemController.h
22 
23  \brief Abstract class to represent a controller. "Controller" part of MVC component. All classes representing the controller of a component must inherit from this class.
24 
25  \ingroup layout
26 */
27 
28 #ifndef __TERRALIB_LAYOUT_INTERNAL_ITEM_CONTROLLER_H
29 #define __TERRALIB_LAYOUT_INTERNAL_ITEM_CONTROLLER_H
30 
31 // TerraLib
32 #include "../../../../geometry/Envelope.h"
33 #include "../../../../geometry/Coord2D.h"
34 #include "../../../../color/RGBAColor.h"
35 #include "../../enum/AbstractType.h"
36 #include "../../enum/EnumType.h"
37 #include "../../Config.h"
38 
39 namespace te
40 {
41  namespace layout
42  {
43  class Observable;
44  class Observer;
45  class Properties;
46 
47  /*!
48  \brief Abstract class to represent a controller. "Controller" part of MVC component. All classes representing the controller of a component must inherit from this class.
49 
50  \ingroup layout
51  */
53  {
54  public:
55 
56  /*!
57  \brief Constructor
58 
59  \param o "Model" part of MVC component
60  */
62 
63  /*!
64  \brief Destructor
65  */
66  virtual ~ItemController();
67 
68  /*!
69  \brief Change coordinate llx,lly of the MVC component.
70 
71  \param x llx
72  \param y lly
73  */
74  virtual void setPosition(const double& x, const double& y);
75 
76  /*!
77  \brief Redraws the MVC component.
78  Creates the ContextItem object and configures it. Calls the draw method of the model.
79  */
80  virtual void redraw();
81 
82  /*!
83  \brief Returns the "Model" part of the MVC component.
84 
85  \return model
86  */
87  const Observable* getModel();
88 
89  /*!
90  \brief Returns the "View" part of the MVC component.
91 
92  \return view
93  */
94  const Observer* getView();
95 
96  /*!
97  \brief Change the bounding rectangle.
98 
99  \param bounding rectangle
100  */
101  virtual void setBox(te::gm::Envelope box);
102 
103  /*!
104  \brief Checks if the coordinate is contained within the bounding rectangle.
105 
106  \param coord coordinated to be verified
107  \return true if contains, false otherwise
108  */
109  virtual bool contains(const te::gm::Coord2D &coord) const;
110 
111  protected:
112 
113  /*!
114  \brief Call factory to create the "View" part of the MVC component and passes the model and himself as controller.
115  */
116  virtual void create();
117 
118  Observable* m_model; //!< "Model" part of the MVC component.
119  Observer* m_view; //!< "View" part of the MVC component.
120  };
121  }
122 }
123 
124 #endif
125 
126 
Abstract class to represent an observable. "Model" part of MVC component.
Definition: Observable.h:56
#define TELAYOUTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:99
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
Abstract class to represent a controller. "Controller" part of MVC component. All classes representin...
Observable * m_model
"Model" part of the MVC component.
Abstract class to represent an observer. "View" part of MVC component.
Definition: Observer.h:48
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
Observer * m_view
"View" part of the MVC component.