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