DeleteGeometryByAreaTool.h
Go to the documentation of this file.
1 /* Copyright (C) 2001-2009 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/edit/qt/tools/DeleteGeometryByAreaTool.h
22 
23  \brief This class implements a concrete tool to remove geometries by drawing an area (polygon).
24 */
25 
26 #ifndef __TERRALIB_EDIT_QT_INTERNAL_DELETEGEOMETRYBYAREATOOL_H
27 #define __TERRALIB_EDIT_QT_INTERNAL_DELETEGEOMETRYBYAREATOOL_H
28 
29 // TerraLib
30 #ifndef Q_MOC_RUN
31 #include "../../../dataaccess/dataset/ObjectId.h"
32 #include "../../../geometry/Envelope.h"
33 #include "../../../geometry/Geometry.h"
34 #include "../../../geometry/Utils.h"
35 #include "../../../maptools/AbstractLayer.h"
36 #include "../../Utils.h"
37 #endif
38 #include "../Config.h"
39 #include "GeometriesUpdateTool.h"
40 
41 // Qt
42 #include <QPointF>
43 
44 namespace te
45 {
46  namespace qt
47  {
48  namespace widgets
49  {
50  class Canvas;
51  class MapDisplay;
52  }
53  }
54 
55  namespace edit
56  {
57 // Forward declaration
58  class Feature;
59 
60  /*!
61  \class DeleteGeometryByTool
62 
63  \brief This class implements a concrete tool to remove geometries by drawing an area (polygon).
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 remove geometries tool associated with the given map display.
78 
79  \param display The map display associated with the tool.
80  \param parent The tool's parent.
81 
82  \note The tool will NOT take the ownership of the given pointers.
83  */
85 
86  /*! \brief Destructor. */
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  private:
105 
106  void draw();
107 
108  void drawPolygon();
109 
111 
112  te::gm::Envelope buildEnvelope(const QPointF& pos);
113 
115 
116  void updateCursor();
117 
118  void storeFeature();
119 
120  protected:
121 
122  std::vector<te::gm::Coord2D> m_coords; //!< The coord list managed by this tool.
123  te::gm::Coord2D m_lastPos; //!< The last position captured on mouse move event.
124  bool m_selectionStarted; //!< Flag that indicates if selection operation was started.
125  bool m_keepPreviousSelection; //!< Flag that indicates if the tool must keep the previous selection.
126  bool m_selectionByPointing; //!< Flag that indicates if the selection is by pointing.
128 
129  };
130  } // end namespace edit
131 } // end namespace te
132 
133 #endif // __TERRALIB_EDIT_QT_INTERNAL_DELETEGEOMETRYBYAREATOOL_H
te::gm::Envelope
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::edit::DeleteGeometryByAreaTool::m_selectionStarted
bool m_selectionStarted
Flag that indicates if selection operation was started.
Definition: DeleteGeometryByAreaTool.h:124
te::qt::widgets::MapDisplay
A widget to control the display of a set of layers.
Definition: MapDisplay.h:72
te::map::AbstractLayerPtr
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
Definition: AbstractLayer.h:626
TEEDITQTEXPORT
#define TEEDITQTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:60
te::edit::DeleteGeometryByAreaTool::m_area
te::gm::Geometry * m_area
Definition: DeleteGeometryByAreaTool.h:127
te::edit::DeleteGeometryByAreaTool::storeFeature
void storeFeature()
te::edit::DeleteGeometryByAreaTool::mouseMoveEvent
bool mouseMoveEvent(QMouseEvent *e)
This event handler can be reimplemented in a concrete tool class to receive mouse move events for the...
te::edit::DeleteGeometryByAreaTool::executeSelection
void executeSelection(const te::gm::Envelope &e)
te::edit::DeleteGeometryByAreaTool::draw
void draw()
te::edit::DeleteGeometryByAreaTool::mouseReleaseEvent
bool mouseReleaseEvent(QMouseEvent *e)
This event handler can be reimplemented in a concrete tool class to receive mouse release events for ...
te::edit::DeleteGeometryByAreaTool::mousePressEvent
bool mousePressEvent(QMouseEvent *e)
This event handler can be reimplemented in a concrete tool class to receive mouse press events for th...
te::edit::DeleteGeometryByAreaTool::drawPolygon
void drawPolygon()
te::edit::DeleteGeometryByAreaTool::buildPolygon
te::gm::Geometry * buildPolygon()
te::edit::DeleteGeometryByAreaTool::m_selectionByPointing
bool m_selectionByPointing
Flag that indicates if the selection is by pointing.
Definition: DeleteGeometryByAreaTool.h:126
te::edit::DeleteGeometryByAreaTool
Definition: DeleteGeometryByAreaTool.h:66
te::gm::Coord2D
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:41
GeometriesUpdateTool.h
te::edit::DeleteGeometryByAreaTool::updateCursor
void updateCursor()
te::edit::DeleteGeometryByAreaTool::~DeleteGeometryByAreaTool
~DeleteGeometryByAreaTool()
Destructor.
te::edit::DeleteGeometryByAreaTool::m_coords
std::vector< te::gm::Coord2D > m_coords
The coord list managed by this tool.
Definition: DeleteGeometryByAreaTool.h:122
te::edit::GeometriesUpdateTool
Definition: GeometriesUpdateTool.h:60
te::gm::Geometry
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
te::edit::DeleteGeometryByAreaTool::m_lastPos
te::gm::Coord2D m_lastPos
The last position captured on mouse move event.
Definition: DeleteGeometryByAreaTool.h:123
te::edit::DeleteGeometryByAreaTool::buildEnvelope
te::gm::Envelope buildEnvelope(const QPointF &pos)
te::edit::DeleteGeometryByAreaTool::m_keepPreviousSelection
bool m_keepPreviousSelection
Flag that indicates if the tool must keep the previous selection.
Definition: DeleteGeometryByAreaTool.h:125
te::edit::DeleteGeometryByAreaTool::DeleteGeometryByAreaTool
DeleteGeometryByAreaTool(te::qt::widgets::MapDisplay *display, const te::map::AbstractLayerPtr &layer, QObject *parent=0)
It constructs a remove geometries tool associated with the given map display.