Loading...
Searching...
No Matches
LayerEvents.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 LayerEvents.h
22
23 \brief Contains a list of the layer events.
24*/
25
26#ifndef __TERRALIB_QT_AF_EVENTS_INTERNAL_LAYEREVENTS_H
27#define __TERRALIB_QT_AF_EVENTS_INTERNAL_LAYEREVENTS_H
28
29#include "../../../maptools/Enums.h"
30#include "../../../maptools/AbstractLayer.h"
31//#include "../../widgets/layer/explorer/AbstractTreeItem.h"
32#include "Event.h"
33#include "Enums.h"
34
35// Qt
36#include <QAction>
37#include <QColor>
38
39// STL
40#include <memory>
41
42namespace te
43{
44// Forward declaration
45 namespace da
46 {
47 class DataSet;
48 }
49
50 namespace gm
51 {
52 class Envelope;
53 }
54
55 namespace se
56 {
57 class Rule;
58 class Style;
59 }
60
61 namespace qt
62 {
63 namespace af
64 {
65 namespace evt
66 {
67 /*!
68 \struct LayerAdded
69
70 \brief This event signals that a new layer was created.
71 */
72 struct LayerAdded : public Event
73 {
74 /*!
75 \brief Constructor.
76
77 \param layer The layer to be added.
78 \param parentLayer The parent layer where the new layer will be added.
79 */
82 m_layer(layer),
83 m_parentLayer(parentLayer)
84 {
85 }
86
87 te::map::AbstractLayerPtr m_layer; //!< The layer to be added.
88 te::map::AbstractLayerPtr m_parentLayer; //!< The parent layer where the layer will be added.
89 };
90
91 /*!
92 \struct LayersAdded
93
94 \brief This event signals that a list of layers have been created.
95 */
96 struct LayersAdded : public Event
97 {
98 /*!
99 \brief Constructor.
100
101 \param layers The layer to be added.
102 \param parentLayer The parent layer where the new layer will be added.
103 */
104 LayersAdded(const std::list<te::map::AbstractLayerPtr> layers, const te::map::AbstractLayerPtr& parentLayer = te::map::AbstractLayerPtr())
106 m_layers(layers),
107 m_parentLayer(parentLayer)
108 {
109 }
110
111 std::list<te::map::AbstractLayerPtr> m_layers; //!< The layers to be added.
112 te::map::AbstractLayerPtr m_parentLayer; //!< The parent layer where the layers will be added.
113 };
114
115 /*!
116 \struct ItemOfLayerRemoved
117
118 \brief This event signals that a item belonging to a layer will be removed from the layer explorer.
119 */
120 //struct ItemOfLayerRemoved : public Event
121 //{
122 // /*!
123 // \brief Constructor.
124
125 // \param item Item belonging to a layer to be removed from the layer explorer.
126 // */
127 // ItemOfLayerRemoved(te::qt::widgets::AbstractTreeItem* item)
128 // : Event(ITEM_OF_LAYER_REMOVED),
129 // m_item(item)
130 // {
131 // }
132
133 // te::qt::widgets::AbstractTreeItem* m_item; //!< Item of the layer to be removed.
134 //};
135
136 /*!
137 \struct LayerRemoved
138
139 \brief This event signals that a layer is to be removed from the layer explorer.
140 */
141 struct LayerRemoved : public Event
142 {
143 /*!
144 \brief Constructor.
145
146 \param layer Layer to be removed.
147 */
148 LayerRemoved(const std::list<te::map::AbstractLayerPtr>& layers, const bool& redraw = true)
150 m_layers(layers),
151 m_redraw(redraw)
152 {
153 }
154
155 std::list<te::map::AbstractLayerPtr> m_layers; //!< Layer removed.
156 bool m_redraw; //!< This flag is used to redraw layers after a layers was removed
157 };
158
159 /*!
160 \struct LayerVisibilityChanged
161
162 \brief This event signals that the layer visibility has changed.
163 */
165 {
166 /*!
167 \brief Constructor.
168
169 \param layer The layer whose visibility has changed.
170
171 \param visibility The new visibility state: VISIBLE, NOT_VISIBLE, PARTIALLY_VISIBLE.
172 */
175 {
176 }
177 };
178
179 /*!
180 \struct LayerSelected
181
182 \brief This event indicates that the layer has been selected.
183 */
184 struct LayerSelected : public Event
185 {
186 /*!
187 \brief Construtor.
188
189 \param layer The new selected layer.
190 */
193 m_layer(layer)
194 {
195 }
196
197 te::map::AbstractLayerPtr m_layer; //!< Pointer to the selected layer.
198 };
199
200 /*!
201 \struct LayerSelectedObjectsChanged
202
203 \brief This event indicates that the selected objects of the layer were changed.
204 */
206 {
207 /*!
208 \brief Constructor
209
210 \param layer The layer whose selected objects were changed.
211 */
214 m_layer(layer),
215 m_envelope(e)
216 {
217 }
218
219 te::map::AbstractLayerPtr m_layer; //!< Layer whose selected objects were changed.
220 te::gm::Envelope* m_envelope; //!< The box of the last selected object.
221 };
222
223 /*!
224 \struct HighlightLayerObjects
225
226 \brief This event indicates that the objects of the given layer must be highlighted.
227 */
229 {
230 /*!
231 \brief Constructor
232
233 \param layer The layer whose objects must be highlighted.
234 \param dataset The dataset that represents the objects that must be highlighted.
235 */
238 m_layer(layer),
239 m_dataset(dataset),
240 m_style(style)
241 {
242 assert(m_dataset);
243 }
244
245 te::map::AbstractLayerPtr m_layer; //!< The layer whose objects must be highlighted.
246 te::da::DataSet* m_dataset; //!< The dataset that represents the objects that must be highlighted.
247 te::se::Style* m_style; //!< The color used to highlight.
248 };
249
250 /*!
251 \struct LayerStyleSelected
252
253 \brief This event indicates that the layer style was selected on the layer explorer.
254 */
255 struct LayerStyleSelected : public Event
256 {
257 /*!
258 \brief Construtor.
259
260 \param layer The layer that has the selected style.
261 */
264 m_layer(layer),
265 m_style(style),
266 m_rule(rule)
267 {
268 }
269
270 te::map::AbstractLayerPtr m_layer; //!< Layer whose style was selected.
271 te::se::Style* m_style; //!< Style selected (could be visual or selection style)
272 te::se::Rule* m_rule; //!< Rule whose style was selected.
273 };
274
275 /*!
276 \struct LayerPopUpAddAction
277
278 \brief This event is used to add a action in a layer tree pop up
279 */
281 {
282 /*!
283 \brief Construtor.
284
285 \param action The action to be added to the context menu.
286 \param itemType The type of the selected item.
287 \param menuSelectionType The selection type of the context menu
288 */
289 LayerPopUpAddAction(QAction* action, std::string itemType, int menuSelectionType)
291 m_action(action),
292 m_itemType(itemType),
293 m_menuSelectionType(menuSelectionType)
294 {
295 }
296
297 QAction* m_action; //!< The action to be added in pop up menu
298 std::string m_itemType; //!< The type of the selected item
299 int m_menuSelectionType; //!< The selection type of the context menu
300 };
301
302 /*!
303 \struct LayerPopUpRemoveAction
304
305 \brief This event is used to remove a action in a layer tree pop up
306 */
308 {
309 /*!
310 \brief Construtor.
311
312 \param action The action to be removed.
313 */
314 LayerPopUpRemoveAction(QAction* action)
316 m_action(action)
317 {
318 }
319
320 QAction* m_action; //!< Action to be removed in the pop up menu
321 };
322
323 /*!
324 \struct GetLayerSelected
325
326 \brief This event is used to get a single layer selected in layer tree
327 */
328 struct GetLayerSelected : public Event
329 {
330 /*!
331 \brief Construtor.
332
333 \param layer The layer that has the selected style.
334 */
336 {
337 }
338
339 te::map::AbstractLayerPtr m_layer; //!< Layer selected.
340 };
341
343 {
345 {
346 }
347
348 std::list<te::map::AbstractLayerPtr> m_layers;
349 };
350
351 /*!
352 \struct GetLayerSelected
353
354 \brief This event is used to get a single layer selected in layer tree
355 */
356 struct LayerChanged : public Event
357 {
358 /*!
359 \brief Construtor.
360
361 \param layer The layer that has the selected style.
362 */
363 LayerChanged(te::map::AbstractLayer* layer, bool redraw = false) :
365 m_layer(layer),
366 m_redraw(redraw)
367 {
368 }
369
370 te::map::AbstractLayer* m_layer; //!< Layer selected.
371 bool m_redraw; //!< Flag used to indicate if has to redraw the layer
372 };
373 }
374 }
375 }
376}
377
378#endif //__TERRALIB_QT_AF_EVENTS_INTERNAL_LAYEREVENTS_H
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:114
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
This is the base class for layers.
Definition: AbstractLayer.h:78
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
Definition: Rule.h:77
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
Definition: Style.h:66
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
@ LAYER_CHANGED
Definition: Enums.h:57
@ GET_LAYER_SELECTED
Definition: Enums.h:58
@ LAYER_SELECTED
Definition: Enums.h:49
@ LAYER_VISIBILITY_CHANGED
Definition: Enums.h:50
@ GET_AVAILABLE_LAYERS
Definition: Enums.h:78
@ LAYERS_ADDED
Definition: Enums.h:46
@ LAYER_REMOVED
Definition: Enums.h:47
@ LAYER_SELECTED_OBJECTS_CHANGED
Definition: Enums.h:51
@ LAYER_POPUP_ADD_ACTION
Definition: Enums.h:55
@ LAYER_STYLE_SELECTED
Definition: Enums.h:53
@ LAYER_POPUP_REMOVE_ACTION
Definition: Enums.h:56
@ HIGHLIGHT_LAYER_OBJECTS
Definition: Enums.h:52
TerraLib.
This file contains a class to represent an event.
A base class for application events.
Definition: Event.h:60
std::list< te::map::AbstractLayerPtr > m_layers
Definition: LayerEvents.h:348
This event is used to get a single layer selected in layer tree.
Definition: LayerEvents.h:329
te::map::AbstractLayerPtr m_layer
Layer selected.
Definition: LayerEvents.h:339
This event indicates that the objects of the given layer must be highlighted.
Definition: LayerEvents.h:229
te::se::Style * m_style
The color used to highlight.
Definition: LayerEvents.h:247
HighlightLayerObjects(te::map::AbstractLayerPtr layer, te::da::DataSet *dataset, te::se::Style *style)
Constructor.
Definition: LayerEvents.h:236
te::map::AbstractLayerPtr m_layer
The layer whose objects must be highlighted.
Definition: LayerEvents.h:245
te::da::DataSet * m_dataset
The dataset that represents the objects that must be highlighted.
Definition: LayerEvents.h:246
This event signals that a new layer was created.
Definition: LayerEvents.h:73
te::map::AbstractLayerPtr m_layer
The layer to be added.
Definition: LayerEvents.h:87
te::map::AbstractLayerPtr m_parentLayer
The parent layer where the layer will be added.
Definition: LayerEvents.h:88
LayerAdded(const te::map::AbstractLayerPtr &layer, const te::map::AbstractLayerPtr &parentLayer=te::map::AbstractLayerPtr())
Constructor.
Definition: LayerEvents.h:80
te::map::AbstractLayer * m_layer
Layer selected.
Definition: LayerEvents.h:370
LayerChanged(te::map::AbstractLayer *layer, bool redraw=false)
Construtor.
Definition: LayerEvents.h:363
bool m_redraw
Flag used to indicate if has to redraw the layer.
Definition: LayerEvents.h:371
This event is used to add a action in a layer tree pop up.
Definition: LayerEvents.h:281
int m_menuSelectionType
The selection type of the context menu.
Definition: LayerEvents.h:299
std::string m_itemType
The type of the selected item.
Definition: LayerEvents.h:298
LayerPopUpAddAction(QAction *action, std::string itemType, int menuSelectionType)
Construtor.
Definition: LayerEvents.h:289
QAction * m_action
The action to be added in pop up menu.
Definition: LayerEvents.h:297
This event is used to remove a action in a layer tree pop up.
Definition: LayerEvents.h:308
QAction * m_action
Action to be removed in the pop up menu.
Definition: LayerEvents.h:320
LayerPopUpRemoveAction(QAction *action)
Construtor.
Definition: LayerEvents.h:314
LayerRemoved(const std::list< te::map::AbstractLayerPtr > &layers, const bool &redraw=true)
Constructor.
Definition: LayerEvents.h:148
bool m_redraw
This flag is used to redraw layers after a layers was removed.
Definition: LayerEvents.h:156
std::list< te::map::AbstractLayerPtr > m_layers
Layer removed.
Definition: LayerEvents.h:155
This event indicates that the selected objects of the layer were changed.
Definition: LayerEvents.h:206
LayerSelectedObjectsChanged(te::map::AbstractLayerPtr layer, te::gm::Envelope *e=0)
Constructor.
Definition: LayerEvents.h:212
te::gm::Envelope * m_envelope
The box of the last selected object.
Definition: LayerEvents.h:220
te::map::AbstractLayerPtr m_layer
Layer whose selected objects were changed.
Definition: LayerEvents.h:219
This event indicates that the layer has been selected.
Definition: LayerEvents.h:185
LayerSelected(te::map::AbstractLayerPtr layer)
Construtor.
Definition: LayerEvents.h:191
te::map::AbstractLayerPtr m_layer
Pointer to the selected layer.
Definition: LayerEvents.h:197
This event indicates that the layer style was selected on the layer explorer.
Definition: LayerEvents.h:256
LayerStyleSelected(te::map::AbstractLayerPtr layer, te::se::Style *style, te::se::Rule *rule)
Construtor.
Definition: LayerEvents.h:262
te::map::AbstractLayerPtr m_layer
Layer whose style was selected.
Definition: LayerEvents.h:270
te::se::Rule * m_rule
Rule whose style was selected.
Definition: LayerEvents.h:272
te::se::Style * m_style
Style selected (could be visual or selection style)
Definition: LayerEvents.h:271
This event signals that the layer visibility has changed.
Definition: LayerEvents.h:165
This event signals that a list of layers have been created.
Definition: LayerEvents.h:97
LayersAdded(const std::list< te::map::AbstractLayerPtr > layers, const te::map::AbstractLayerPtr &parentLayer=te::map::AbstractLayerPtr())
Constructor.
Definition: LayerEvents.h:104
te::map::AbstractLayerPtr m_parentLayer
The parent layer where the layers will be added.
Definition: LayerEvents.h:112
std::list< te::map::AbstractLayerPtr > m_layers
The layers to be added.
Definition: LayerEvents.h:111
Enumerations of XML module.