All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
BuildGraphicsItem.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 BuildGraphicsItem.h
22 
23  \brief Class responsible for creating or building graphics objects. All objects are children of QGraphicsItem and ItemObserver.
24  An object of a type is created from a coordinated. Also an object of a type can be built from the properties saved in a template.
25  Only place where the model and the controller is instantiated and the MVC component is created.
26 
27  \ingroup layout
28 */
29 
30 #ifndef __TERRALIB_LAYOUT_INTERNAL_BUILD_GRAPHICS_ITEM_H
31 #define __TERRALIB_LAYOUT_INTERNAL_BUILD_GRAPHICS_ITEM_H
32 
33 //TerraLib
34 #include "../../core/AbstractBuildGraphicsItem.h"
35 #include "../../core/Config.h"
36 
37 // Qt
38 #include <QObject>
39 
40 class QGraphicsItem;
41 
42 namespace te
43 {
44  namespace layout
45  {
46  class ItemModelObservable;
47 
48  /*!
49  \brief Class responsible for creating or building graphics objects. All objects are children of QGraphicsItem and ItemObserver.
50  An object of a type is created from a coordinated. Also an object of a type can be built from the properties saved in a template.
51  Only place where the model and the controller is instantiated and the MVC component is created.
52 
53  \ingroup layout
54 
55  \sa te::layout::AbstractBuildGraphicsItem
56  */
58  {
59  Q_OBJECT //for slots/signals
60 
61  public:
62 
63  /*!
64  \brief Constructor
65  */
67 
68  /*!
69  \brief Destructor
70  */
71  virtual ~BuildGraphicsItem();
72 
73  /*!
74  \brief Method to build a graphics object from the properties.
75 
76  \param props properties
77  \param draw graphics object has or not to be drawing
78 
79  \return z value
80  */
81  QGraphicsItem* rebuildItem(te::layout::Properties* props, bool draw = true);
82 
83  /*!
84  \brief Method to create a graphic object from the properties.
85 
86  \param mode type of the object will created
87  \param coordinate represent the x,y coordinate
88  \param draw graphics object has or not to be drawing
89 
90  \return z value
91  */
92  QGraphicsItem* createItem(te::layout::EnumType* mode, const te::gm::Coord2D& coordinate, bool draw = true);
93 
94  /*!
95  \brief Method to create a graphic object from the type.
96 
97  \param mode type of the object will created
98 
99  \return item value
100  */
101  QGraphicsItem* createItem(te::layout::EnumType* type, bool draw = true);
102 
103  /*!
104  \brief Checks whether the coordinated intersects an item and adds a child.
105  Checks ItemModelObservable::isEnableChildren().
106 
107  \param x axis x coordinate
108  \param y axis y coordinate
109  */
110  virtual bool addChild(QGraphicsItem* child, int x, int y);
111 
112  signals:
113 
114  void addChildFinalized(QGraphicsItem* parent, QGraphicsItem* child);
115 
116  protected:
117 
118  /*!
119  \brief Creates the name of the new graphic object. Adds the number that corresponds to how many objects of this type have already been created.
120 
121  \param name of the class type of the graphic object
122  \param type of the object
123 
124  \return name
125  */
126  std::string nameItem(te::layout::EnumType* type);
127 
128  /*!
129  \brief After component construction, this method checks and adds a child, position and zValue. If necessary, also redraws.
130 
131  \param item built item
132  \param draw if true the component will be redraw, false otherwise
133  */
134  virtual void afterBuild(QGraphicsItem* item, bool draw = true);
135 
136  /*!
137  \brief Create graphic object of type PaperItem
138 
139  \return new object
140  */
141  QGraphicsItem* createPaper();
142 
143  /*!
144  \brief Create graphic object of type MapItem
145 
146  \return new object
147  */
148  QGraphicsItem* createMap();
149 
150  /*!
151  \brief Create graphic object of type GridMapItem
152 
153  \return new object
154  */
155  QGraphicsItem* createGridMap();
156 
157  /*!
158  \brief Create graphic object of type TextItem
159 
160  \return new object
161  */
162  QGraphicsItem* createText();
163 
164  /*!
165  \brief Create graphic object of type RectangleItem
166 
167  \return new object
168  */
169  QGraphicsItem* createRectangle();
170 
171  /*!
172  \brief Create graphic object of type LegendItem
173 
174  \return new object
175  */
176  QGraphicsItem* createLegend();
177 
178  /*!
179  \brief Create graphic object of type ScaleItem
180 
181  \return new object
182  */
183  QGraphicsItem* createScale();
184 
185  /*!
186  \brief Create graphic object of type ItemGroup
187 
188  \return new object
189  */
190  QGraphicsItem* createItemGroup();
191 
192  /*!
193  \brief Create graphic object of type MovingItemGroup
194 
195  \return new object
196  */
197  QGraphicsItem* createMovingItemGroup();
198 
199  /*!
200  \brief Create graphic object of type ImageItem
201 
202  \return new object
203  */
204  QGraphicsItem* createImage();
205 
206  /*!
207  \brief Create graphic object of type ArrowItem
208 
209  \return new object
210  */
211  QGraphicsItem* createArrow();
212 
213  /*!
214  \brief Create graphic object of type EllipseItem
215 
216  \return new object
217  */
218  QGraphicsItem* createEllipse();
219 
220  /*!
221  \brief Create graphic object of type PointItem
222 
223  \return new object
224  */
225  QGraphicsItem* createPoint();
226 
227  /*!
228  \brief Create graphic object of type TextGridItem
229 
230  \return new object
231  */
232  QGraphicsItem* createTextGrid();
233 
234  /*!
235  \brief Create graphic object of type TitleItem
236 
237  \return new object
238  */
239  QGraphicsItem* createTitle();
240 
241  /*!
242  \brief Create graphic object of type LegendChildItem
243 
244  \return new object
245  */
246  QGraphicsItem* createLegendChild();
247 
248  /*!
249  \brief Create graphic object of type LineItem
250 
251  \return new object
252  */
253  QGraphicsItem* createLine();
254 
255  /*!
256  \brief Create graphic object of type PolygonItem
257 
258  \return new object
259  */
260  QGraphicsItem* createPolygon();
261 
262  /*!
263  \brief Create graphic object of type Balloon
264 
265  \return new object
266  */
267  QGraphicsItem* createBalloon();
268 
269  /*!
270  \brief Create graphic object of type BarCode
271 
272  \return new object
273  */
274  QGraphicsItem* createBarCode();
275 
276  /*!
277  \brief Create graphic object of type GridPlanarItem
278 
279  \return new object
280  */
281  QGraphicsItem* createGridPlanar();
282 
283  /*!
284  \brief Create graphic object of type GridGeodesicItem
285 
286  \return new object
287  */
288  QGraphicsItem* createGridGeodesic();
289 
290  /*!
291  \brief Create graphic object of type NorthItem
292 
293  \return new object
294  */
295  QGraphicsItem* createNorth();
296 
297  /*!
298  \brief Create graphic object of type MapLocationItem
299 
300  \return new object
301  */
302  QGraphicsItem* createMapLocation();
303  };
304  }
305 }
306 
307 #endif
308 
309 
#define TELAYOUTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:99
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
Class responsible for creating or building graphics objects. All objects are children of QGraphicsIte...
Class that represents the value of an enumeration. An enumeration is made of "1..n" objects EnumType...
Definition: EnumType.h:48
Abstract class for build graphics MVC components.