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, 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 
109 
110  //@}
111 
112  private:
113 
114  double m_tol;
116  std::vector<te::edit::Feature*> m_vecFeatures;
117 
118  void draw();
119  void pickFeatures();
120  void splitPolygon(std::size_t index);
122 
123  };
124 
125  } // end namespace edit
126 } // end namespace te
127 
128 #endif // __TERRALIB_EDIT_QT_INTERNAL_SPLITPOLYGONTOOL_H
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::edit::CreateLineTool
This class implements a concrete tool to create lines.
Definition: CreateLineTool.h:63
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
CreateLineTool.h
This class implements a concrete tool to create lines.
te::edit::SplitPolygonTool::resetVisualizationTool
void resetVisualizationTool()
te::edit::SplitPolygonTool::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::SplitPolygonTool
This class implements a concrete tool to split polygons.
Definition: SplitPolygonTool.h:70
te::edit::SplitPolygonTool::m_tol
double m_tol
Definition: SplitPolygonTool.h:114
te::edit::SplitPolygonTool::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::SplitPolygonTool::m_oidSet
te::da::ObjectIdSet * m_oidSet
Definition: SplitPolygonTool.h:115
te::edit::SplitPolygonTool::SplitPolygonTool
SplitPolygonTool(te::qt::widgets::MapDisplay *display, const te::map::AbstractLayerPtr &layer, QObject *parent=0)
It constructs a split polygon tool associated with the given map display.
te::edit::SplitPolygonTool::draw
void draw()
GeometriesUpdateTool.h
te::edit::SplitPolygonTool::~SplitPolygonTool
~SplitPolygonTool()
Destructor.
te::edit::SplitPolygonTool::mouseDoubleClickEvent
bool mouseDoubleClickEvent(QMouseEvent *e)
This event handler can be reimplemented in a concrete tool class to receive mouse double click events...
te::edit::SplitPolygonTool::m_vecFeatures
std::vector< te::edit::Feature * > m_vecFeatures
Definition: SplitPolygonTool.h:116
te::edit::SplitPolygonTool::editingFinished
void editingFinished()
te::edit::SplitPolygonTool::pickFeatures
void pickFeatures()
te::edit::SplitPolygonTool::mouseReleaseEvent
bool mouseReleaseEvent(QMouseEvent *e)
This event handler can be reimplemented in a concrete tool class to receive mouse release events for ...
te::edit::SplitPolygonTool::splitPolygon
void splitPolygon(std::size_t index)
te::da::ObjectIdSet
This class represents a set of unique ids created in the same context. i.e. from the same data set.
Definition: ObjectIdSet.h:56