All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LayerEvents.h
Go to the documentation of this file.
1 /* Copyright (C) 2008-2013 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 <QtGui/QAction>
37 #include <QtGui/QColor>
38 
39 // STL
40 #include <memory>
41 
42 namespace te
43 {
44 // Forward declaration
45  namespace da
46  {
47  class DataSet;
48  }
49 
50  namespace qt
51  {
52  namespace af
53  {
54  namespace evt
55  {
56  /*!
57  \struct LayerAdded
58 
59  \brief This event signals that a new layer was created.
60  */
61  struct LayerAdded : public Event
62  {
63  /*!
64  \brief Constructor.
65 
66  \param layer The layer to be added.
67  \param parentLayer The parent layer where the new layer will be added.
68  */
71  m_layer(layer),
72  m_parentLayer(parentLayer)
73  {
74  }
75 
76  te::map::AbstractLayerPtr m_layer; //!< Tha layer to be added.
77  te::map::AbstractLayerPtr m_parentLayer; //!< The parent layer where the layer will be added.
78  };
79 
80  /*!
81  \struct ItemOfLayerRemoved
82 
83  \brief This event signals that a item belonging to a layer will be removed from the layer explorer.
84  */
85  struct ItemOfLayerRemoved : public Event
86  {
87  /*!
88  \brief Constructor.
89 
90  \param item Item belonging to a layer to be removed from the layer explorer.
91  */
94  m_item(item)
95  {
96  }
97 
98  te::qt::widgets::AbstractTreeItem* m_item; //!< Item of the layer to be removed.
99  };
100 
101  /*!
102  \struct LayerRemoved
103 
104  \brief This event signals that a layer is to be removed from the layer explorer.
105  */
106  struct LayerRemoved : public Event
107  {
108  /*!
109  \brief Constructor.
110 
111  \param layer Layer to be removed.
112  */
114  : Event(LAYER_REMOVED),
115  m_layer(layer)
116  {
117  }
118 
119  te::map::AbstractLayerPtr m_layer; //!< Layer removed.
120  };
121 
122  /*!
123  \struct LayerVisibilityChanged
124 
125  \brief This event signals that the layer visibility has changed.
126  */
128  {
129  /*!
130  \brief Constructor.
131 
132  \param layer The layer whose visibility has changed.
133 
134  \param visibility The new visibility state: VISIBLE, NOT_VISIBLE, PARTIALLY_VISIBLE.
135  */
138  m_layer(layer),
139  m_visibility(visibility)
140  {
141  }
142 
143  te::map::AbstractLayerPtr m_layer; //!< Layer whose visibility has changed.
144  te::map::Visibility m_visibility; //!< Layer visibility.
145  };
146 
147  /*!
148  \struct LayerSelected
149 
150  \brief This event indicates that the layer has been selected.
151  */
152  struct LayerSelected : public Event
153  {
154  /*!
155  \brief Construtor.
156 
157  \param layer The new selected layer.
158  */
161  m_layer(layer)
162  {
163  }
164 
165  te::map::AbstractLayerPtr m_layer; //!< Pointer to the selected layer.
166  };
167 
168  /*!
169  \struct LayerSelectedObjectsChanged
170 
171  \brief This event indicates that the selected objects of the layer were changed.
172  */
174  {
175  /*!
176  \brief Constructor
177 
178  \param layer The layer whose selected objects were changed.
179  */
182  m_layer(layer)
183  {
184  }
185 
186  te::map::AbstractLayerPtr m_layer; //!< Layer whose selected objects were changed.
187  };
188 
189  /*!
190  \struct HighlightLayerObjects
191 
192  \brief This event indicates that the objects of the given layer must be highlighted.
193  */
194  struct HighlightLayerObjects : public Event
195  {
196  /*!
197  \brief Constructor
198 
199  \param layer The layer whose objects must be highlighted.
200  \param dataset The dataset that represents the objects that must be highlighted.
201  */
204  m_layer(layer),
205  m_dataset(dataset),
206  m_color(color)
207  {
208  assert(m_dataset);
209  }
210 
211  te::map::AbstractLayerPtr m_layer; //!< The layer whose objects must be highlighted.
212  te::da::DataSet* m_dataset; //!< The dataset that represents the objects that must be highlighted.
213  QColor m_color; //!< The color used to highlight.
214  };
215 
216  /*!
217  \struct LayerStyleSelected
218 
219  \brief This event indicates that the layer style was selected on the layer explorer.
220  */
221  struct LayerStyleSelected : public Event
222  {
223  /*!
224  \brief Construtor.
225 
226  \param layer The layer that has the selected style.
227  */
230  m_layer(layer)
231  {
232  }
233 
234  te::map::AbstractLayerPtr m_layer; //!< Layer whose style was selected.
235  };
236 
237  /*!
238  \struct LayerPopUpAddAction
239 
240  \brief This event is used to add a action in a layer tree pop up
241  */
242  struct LayerPopUpAddAction : public Event
243  {
244  /*!
245  \brief Construtor.
246 
247  \param action The action to be added to the context menu.
248  \param itemType The type of the selected item.
249  \param menuSelectionType The selection type of the context menu
250  */
251  LayerPopUpAddAction(QAction* action, std::string itemType, int menuSelectionType)
253  m_action(action),
254  m_itemType(itemType),
255  m_menuSelectionType(menuSelectionType)
256  {
257  }
258 
259  QAction* m_action; //!< The action to be added in pop up menu
260  std::string m_itemType; //!< The type of the selected item
261  int m_menuSelectionType; //!< The selection type of the context menu
262  };
263 
264  /*!
265  \struct LayerPopUpRemoveAction
266 
267  \brief This event is used to remove a action in a layer tree pop up
268  */
270  {
271  /*!
272  \brief Construtor.
273 
274  \param action The action to be removed.
275  */
276  LayerPopUpRemoveAction(QAction* action)
278  m_action(action)
279  {
280  }
281 
282  QAction* m_action; //!< Action to be removed in the pop up menu
283  };
284 
285  /*!
286  \struct GetLayerSelected
287 
288  \brief This event is used to get a single layer selected in layer tree
289  */
290  struct GetLayerSelected : public Event
291  {
292  /*!
293  \brief Construtor.
294 
295  \param layer The layer that has the selected style.
296  */
298  {
299  }
300 
301  te::map::AbstractLayerPtr m_layer; //!< Layer selected.
302  };
303  }
304  }
305  }
306 }
307 
308 #endif //__TERRALIB_QT_AF_EVENTS_INTERNAL_LAYEREVENTS_H
te::map::AbstractLayerPtr m_layer
Pointer to the selected layer.
Definition: LayerEvents.h:165
te::map::AbstractLayerPtr m_layer
Layer whose style was selected.
Definition: LayerEvents.h:234
LayerSelectedObjectsChanged(te::map::AbstractLayerPtr layer)
Constructor.
Definition: LayerEvents.h:180
This event is used to add a action in a layer tree pop up.
Definition: LayerEvents.h:242
te::map::AbstractLayerPtr m_layer
Tha layer to be added.
Definition: LayerEvents.h:76
te::map::AbstractLayerPtr m_layer
Layer selected.
Definition: LayerEvents.h:301
This event indicates that the layer has been selected.
Definition: LayerEvents.h:152
QAction * m_action
Action to be removed in the pop up menu.
Definition: LayerEvents.h:282
LayerSelected(te::map::AbstractLayerPtr layer)
Construtor.
Definition: LayerEvents.h:159
This event is used to get a single layer selected in layer tree.
Definition: LayerEvents.h:290
Visibility
Each layer can have three states of visibility.
Definition: Enums.h:138
te::map::AbstractLayerPtr m_layer
Layer whose selected objects were changed.
Definition: LayerEvents.h:186
This event signals that the layer visibility has changed.
Definition: LayerEvents.h:127
QColor m_color
The color used to highlight.
Definition: LayerEvents.h:213
HighlightLayerObjects(te::map::AbstractLayerPtr layer, te::da::DataSet *dataset, const QColor &color)
Constructor.
Definition: LayerEvents.h:202
te::map::AbstractLayerPtr m_parentLayer
The parent layer where the layer will be added.
Definition: LayerEvents.h:77
This event indicates that the objects of the given layer must be highlighted.
Definition: LayerEvents.h:194
LayerPopUpRemoveAction(QAction *action)
Construtor.
Definition: LayerEvents.h:276
This event signals that a new layer was created.
Definition: LayerEvents.h:61
te::da::DataSet * m_dataset
The dataset that represents the objects that must be highlighted.
Definition: LayerEvents.h:212
int m_menuSelectionType
The selection type of the context menu.
Definition: LayerEvents.h:261
te::map::AbstractLayerPtr m_layer
Layer removed.
Definition: LayerEvents.h:119
This event indicates that the layer style was selected on the layer explorer.
Definition: LayerEvents.h:221
te::map::Visibility m_visibility
Layer visibility.
Definition: LayerEvents.h:144
te::qt::widgets::AbstractTreeItem * m_item
Item of the layer to be removed.
Definition: LayerEvents.h:98
The class that represents an item in a LayerTreeModel.
This event signals that a item belonging to a layer will be removed from the layer explorer...
Definition: LayerEvents.h:85
te::map::AbstractLayerPtr m_layer
The layer whose objects must be highlighted.
Definition: LayerEvents.h:211
This event is used to remove a action in a layer tree pop up.
Definition: LayerEvents.h:269
te::map::AbstractLayerPtr m_layer
Layer whose visibility has changed.
Definition: LayerEvents.h:143
ItemOfLayerRemoved(te::qt::widgets::AbstractTreeItem *item)
Constructor.
Definition: LayerEvents.h:92
std::string m_itemType
The type of the selected item.
Definition: LayerEvents.h:260
A base class for application events.
Definition: Event.h:59
This event signals that a layer is to be removed from the layer explorer.
Definition: LayerEvents.h:106
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
LayerRemoved(te::map::AbstractLayerPtr layer)
Constructor.
Definition: LayerEvents.h:113
This event indicates that the selected objects of the layer were changed.
Definition: LayerEvents.h:173
QAction * m_action
The action to be added in pop up menu.
Definition: LayerEvents.h:259
LayerPopUpAddAction(QAction *action, std::string itemType, int menuSelectionType)
Construtor.
Definition: LayerEvents.h:251
LayerStyleSelected(te::map::AbstractLayerPtr layer)
Construtor.
Definition: LayerEvents.h:228
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:111
LayerVisibilityChanged(te::map::AbstractLayerPtr layer, te::map::Visibility visibility)
Constructor.
Definition: LayerEvents.h:136