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 #include "GeometriesUpdateTool.h"
41 #include "../../Utils.h"
42 #endif
43 #include "../Config.h"
44 
45 // STL
46 #include <vector>
47 
48 namespace te
49 {
50  namespace gm
51  {
52  class Geometry;
53  }
54 
55  namespace qt
56  {
57  namespace widgets
58  {
59  class MapDisplay;
60  }
61  }
62 
63  namespace edit
64  {
65  /*!
66  \class SplitPolygonTool
67 
68  \brief This class implements a concrete tool to split polygons.
69  */
71  {
72  Q_OBJECT
73 
74  public:
75 
76  /** @name Initializer Methods
77  * Methods related to instantiation and destruction.
78  */
79  //@{
80 
81  /*!
82  \brief It constructs a split polygon tool associated with the given map display.
83 
84  \param display The map display associated with the tool.
85  \param parent The tool's parent.
86 
87  \note The tool will NOT take the ownership of the given pointers.
88  */
89  SplitPolygonTool(te::qt::widgets::MapDisplay* display, const te::map::AbstractLayerPtr& layer, const te::edit::MouseEventEdition mouseEventToSave, QObject* parent = 0);
90 
91  /*! \brief Destructor. */
93 
94  //@}
95 
96  /** @name AbstractTool Methods
97  * Methods related with tool behavior.
98  */
99  //@{
100 
101  bool mousePressEvent(QMouseEvent* e);
102 
103  bool mouseMoveEvent(QMouseEvent* e);
104 
105  bool mouseDoubleClickEvent(QMouseEvent* e);
106 
107  bool mouseReleaseEvent(QMouseEvent* e);
108 
109  void resetVisualizationTool();
110 
111  //@}
112 
113  private:
114 
115  double m_tol;
117  std::vector<te::edit::Feature*> m_vecFeature;
119 
120  void draw();
121  void pickFeatures();
122  void splitPolygon(std::size_t index);
123  void startSplit();
124 
125  };
126 
127  } // end namespace edit
128 } // end namespace te
129 
130 #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:104