SubtractAreaTool.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/edit/qt/tools/SubtratAreaTool.cpp
22 
23  \brief This class implements a concrete tool to subtract geometries.
24 */
25 
26 #ifndef __TERRALIB_EDIT_QT_INTERNAL_SUBTRACTAREATOOL_H
27 #define __TERRALIB_EDIT_QT_INTERNAL_SUBTRACTAREATOOL_H
28 
29 // TerraLib
30 #include "../../../geometry/Envelope.h"
31 #ifndef Q_MOC_RUN
32 #include "../../../maptools/AbstractLayer.h"
33 #include "../core/command/AddCommand.h"
34 #include "../core/UndoStackManager.h"
35 #include "CreateLineTool.h"
36 #endif
37 #include "../Config.h"
38 
39 // Qt
40 #include <QPointF>
41 
42 namespace te
43 {
44  namespace qt
45  {
46  namespace widgets
47  {
48  class Canvas;
49  class MapDisplay;
50  }
51  }
52 
53  namespace edit
54  {
55 
57  {
58  Q_OBJECT
59 
60  public:
61  SubtractAreaTool(te::qt::widgets::MapDisplay* display, const te::map::AbstractLayerPtr& layer, const te::edit::MouseEventEdition mouseEventToSave, QObject* parent = 0);
62 
64 
65  //@}
66 
67  /** @name AbstractTool Methods
68  * Methods related with tool behavior.
69  */
70  //@{
71 
72  bool mousePressEvent(QMouseEvent* e);
73 
74  bool mouseMoveEvent(QMouseEvent* e);
75 
76  bool mouseDoubleClickEvent(QMouseEvent* e);
77 
78  bool mouseReleaseEvent(QMouseEvent* e);
79 
80  //@}
81 
82  private:
83 
84  bool run();
85 
86  void drawPolygon();
87 
88  void draw();
89 
90  void storeFeature();
91 
92  void storeUndoCommand();
93 
94  void pickFeature(const QPointF& pos);
95 
96  te::gm::Envelope buildEnvelope(const QPointF& pos);
97 
98  te::gm::Geometry* buildPolygon();
99 
100  void clear();
101 
102  protected:
103 
106 
107  };
108 
109  } // end namespace edit
110 } // end namespace te
111 
112 #endif // __TERRALIB_EDIT_QT_INTERNAL_AGGREGATEAREATOOL_H
#define TEEDITQTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:60
UndoStackManager & m_stack
This class implements a concrete tool to create lines.
This class implements a concrete tool to create lines.
MouseEventEdition m_mouseEventToSave
A widget to control the display of a set of layers.
Definition: MapDisplay.h:69
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
URI C++ Library.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:74
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
MouseEventEdition
Defines which mouse event will be used in the tool to complete an operation.
Definition: Utils.h:104