SplitPolygonTool.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/SplitPolygonTool.h
22 
23  \brief This class implements a concrete tool to split polygons.
24 */
25 
26 #ifndef __TERRALIB_EDIT_QT_INTERNAL_SPLITPOLYGONTOOL_H
27 #define __TERRALIB_EDIT_QT_INTERNAL_SPLITPOLYGONTOOL_H
28 
29 // TerraLib
30 #include "../../../geometry/Coord2D.h"
31 #ifndef Q_MOC_RUN
32 #include "../../../dataaccess/dataset/ObjectIdSet.h"
33 #include "../../../geometry/GeometryCollection.h"
34 #include "../../../geometry/GeometryProperty.h"
35 #include "../../../geometry/MultiPolygon.h"
36 #include "../../../geometry/Utils.h"
37 #include "../../../maptools/AbstractLayer.h"
38 #include "../../../qt/widgets/canvas/Canvas.h"
39 #include "CreateLineTool.h"
40 #endif
41 #include "../Config.h"
42 #include "GeometriesUpdateTool.h"
43 
44 // STL
45 #include <vector>
46 
47 namespace te
48 {
49  namespace gm
50  {
51  class Geometry;
52  }
53 
54  namespace qt
55  {
56  namespace widgets
57  {
58  class MapDisplay;
59  }
60  }
61 
62  namespace edit
63  {
64  /*!
65  \class SplitPolygonTool
66 
67  \brief This class implements a concrete tool to split polygons.
68  */
70  {
71  Q_OBJECT
72 
73  public:
74 
75  /** @name Initializer Methods
76  * Methods related to instantiation and destruction.
77  */
78  //@{
79 
80  /*!
81  \brief It constructs a split polygon tool associated with the given map display.
82 
83  \param display The map display associated with the tool.
84  \param parent The tool's parent.
85 
86  \note The tool will NOT take the ownership of the given pointers.
87  */
88  SplitPolygonTool(te::qt::widgets::MapDisplay* display, const te::map::AbstractLayerPtr& layer, const te::edit::MouseEventEdition mouseEventToSave, QObject* parent = 0);
89 
90  /*! \brief Destructor. */
92 
93  //@}
94 
95  /** @name AbstractTool Methods
96  * Methods related with tool behavior.
97  */
98  //@{
99 
100  bool mousePressEvent(QMouseEvent* e);
101 
102  bool mouseMoveEvent(QMouseEvent* e);
103 
104  bool mouseDoubleClickEvent(QMouseEvent* e);
105 
106  bool mouseReleaseEvent(QMouseEvent* e);
107 
108  void resetVisualizationTool();
109 
110  //@}
111 
112  private:
113 
114  double m_tol;
116  std::vector<te::edit::Feature*> m_vecFeature;
118 
119  void draw();
120  void pickFeatures();
121  void splitPolygon(std::size_t index);
122  void startSplit();
123 
124  };
125 
126  } // end namespace edit
127 } // end namespace te
128 
129 #endif // __TERRALIB_EDIT_QT_INTERNAL_SPLITPOLYGONTOOL_H
#define TEEDITQTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:60
This class implements a concrete tool to create lines.
This class implements a concrete tool to create lines.
MouseEventEdition m_mouseEventToSave
std::vector< te::edit::Feature * > m_vecFeature
A widget to control the display of a set of layers.
Definition: MapDisplay.h:69
te::da::ObjectIdSet * m_oidSet
This class implements a concrete tool to split polygons.
This class represents a set of unique ids created in the same context. i.e. from the same data set...
Definition: ObjectIdSet.h:55
URI C++ Library.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
MouseEventEdition
Defines which mouse event will be used in the tool to complete an operation.
Definition: Utils.h:102