Selection.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 terralib/qt/widgets/tools/Selection.h
22 
23  \brief This class implements a concrete tool to select layer features using an extent.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_INTERNAL_SELECTION_H
27 #define __TERRALIB_QT_WIDGETS_INTERNAL_SELECTION_H
28 
29 // TerraLib
30 #ifndef Q_MOC_RUN
31 #include "../../../maptools/AbstractLayer.h"
32 #endif
33 #include "../Config.h"
34 #include "RubberBand.h"
35 
36 // Qt
37 #include <QColor>
38 
39 // STL
40 #include <list>
41 #include <vector>
42 
43 namespace te
44 {
45 // Forward declaration
46  namespace gm
47  {
48  class Geometry;
49  }
50 
51  namespace qt
52  {
53  namespace widgets
54  {
55 // Forward declaration
56  class MapDisplay;
57 
58  /*!
59  \class Selection
60 
61  \brief This class implements a concrete tool to select layer features using an extent.
62 
63  \ingroup widgets
64  */
66  {
67  Q_OBJECT
68 
69  public:
70 
71  /** @name Initializer Methods
72  * Methods related to instantiation and destruction.
73  */
74  //@{
75 
76  /*!
77  \brief It constructs a selection tool associated with the given map display.
78 
79  \param display The map display associated with the tool.
80  \param cursor The tool cursor.
81  \param layer The layer list that will be selected.
82  \param parent The tool's parent.
83 
84  \note The tool will NOT take the ownership of the given pointers.
85  */
86  Selection(MapDisplay* display, const QCursor& cursor, const std::list<te::map::AbstractLayerPtr>& layers, QObject* parent = 0);
87 
88  /*! \brief Destructor. */
89  ~Selection();
90 
91  //@}
92 
93  /** @name AbstractTool Methods
94  * Methods related with tool behavior.
95  */
96  //@{
97 
98  bool mousePressEvent(QMouseEvent* e);
99 
100  bool mouseMoveEvent(QMouseEvent* e);
101 
102  bool mouseReleaseEvent(QMouseEvent* e);
103 
104  //@}
105 
106  public slots:
107 
108  void setLayers(const std::list<te::map::AbstractLayerPtr>& layers);
109 
110  private:
111 
112  void executeSelection(const te::map::AbstractLayerPtr& layer, const te::gm::Envelope& e);
113 
114  signals:
115 
116  /*! This signal is emitted when the layer selection changed. */
117  void layerSelectedObjectsChanged(const te::map::AbstractLayerPtr& layer);
118 
119  private:
120 
121  std::list<te::map::AbstractLayerPtr> m_layers; //!< The layer list that will be selected.
122  bool m_selectionStarted; //!< Flag that indicates if selection operation was started.
123  bool m_keepPreviousSelection; //!< Flag that indicates if the tool must keep the previous selection.
124  bool m_selectionByPointing; //!< Flag that indicates if the selection is by pointing.
125  };
126 
127  } // end namespace widgets
128  } // end namespace qt
129 } // end namespace te
130 
131 #endif // __TERRALIB_QT_WIDGETS_INTERNAL_SELECTION_H
bool m_selectionByPointing
Flag that indicates if the selection is by pointing.
Definition: Selection.h:124
This is a utility class tool that provides a rectangle that can indicate a boundary.
A widget to control the display of a set of layers.
Definition: MapDisplay.h:69
This class implements a concrete tool to select layer features using an extent.
Definition: Selection.h:65
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
bool m_selectionStarted
Flag that indicates if selection operation was started.
Definition: Selection.h:122
URI C++ Library.
bool m_keepPreviousSelection
Flag that indicates if the tool must keep the previous selection.
Definition: Selection.h:123
This class provides a rectangle that can indicate a boundary.
Definition: RubberBand.h:52
std::list< te::map::AbstractLayerPtr > m_layers
The layer list that will be selected.
Definition: Selection.h:121
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr