MergeGeometriesTool.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/MergeGeometriesTool.h
22 
23 \brief This class implements a concrete tool to merge polygons.
24 */
25 
26 #ifndef __TERRALIB_EDIT_QT_INTERNAL_MERGEGEOMETRIESTOOL_H
27 #define __TERRALIB_EDIT_QT_INTERNAL_MERGEGEOMETRIESTOOL_H
28 
29 // TerraLib
30 #include "../../../geometry/Coord2D.h"
31 #ifndef Q_MOC_RUN
32 #include "../../../geometry/Geometry.h"
33 #include "../../../geometry/GeometryCollection.h"
34 #include "../../../geometry/GeometryProperty.h"
35 #include "../../../dataaccess/dataset/ObjectId.h"
36 #include "../../../dataaccess/dataset/ObjectIdSet.h"
37 #include "../../../maptools/AbstractLayer.h"
38 #endif
39 #include "GeometriesUpdateTool.h"
40 #include "../Config.h"
41 
42 // STL
43 #include <vector>
44 
45 namespace te
46 {
47  namespace gm
48  {
49  class Geometry;
50  }
51 
52  namespace qt
53  {
54  namespace widgets
55  {
56  class MapDisplay;
57  }
58  }
59 
60  namespace edit
61  {
62 
64  {
65  Q_OBJECT
66 
67  public:
68 
69  MergeGeometriesTool(te::qt::widgets::MapDisplay* display, const te::map::AbstractLayerPtr& layer, const QCursor& cursor, QObject* parent = 0);
70 
71  /*! \brief Destructor. */
73 
74  private:
75 
76  void draw();
77 
78  void pickFeature(const te::map::AbstractLayerPtr& layer, const QPointF& pos);
79 
80  te::gm::Envelope buildEnvelope(const QPointF& pos);
81 
82  void storeMergedFeature();
83 
84  void storeUndoCommand();
85 
86  void mergeGeometries();
87 
88  bool spatialRelationDisjoint(te::gm::GeometryCollection& gc);
89 
91 
92  const te::gm::Envelope* getRefEnvelope(te::da::DataSet& ds, te::gm::GeometryProperty& geomProp);
93 
94  void getBaseOID(const te::da::ObjectIdSet& objSet, QString msg);
95 
96  private slots:
97 
98  void onExtentChanged();
99 
100  protected:
101 
102  std::string m_chosenOid;
103 
105 
106  std::vector<Feature*> m_updateWatches;
107 
109 
110  };
111 
112  } // end namespace edit
113 } // end namespace te
114 
115 #endif // __TERRALIB_EDIT_QT_INTERNAL_MERGEGEOMETRIESTOOL_H
Geometric property.
#define TEEDITQTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:60
te::da::ObjectIdSet * m_oidsMerged
A widget to control the display of a set of layers.
Definition: MapDisplay.h:68
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
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.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:112
te::gm::GeometryCollection * m_geocollection
It is a collection of other geometric objects.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
std::vector< Feature * > m_updateWatches