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 #include "../../../geometry/Geometry.h"
32 #include "../../../geometry/GeometryCollection.h"
33 #include "../../../geometry/GeometryProperty.h"
34 #include "../../../dataaccess/dataset/ObjectId.h"
35 #include "../../../dataaccess/dataset/ObjectIdSet.h"
36 #include "../../../maptools/AbstractLayer.h"
37 #include "GeometriesUpdateTool.h"
38 #include "../Config.h"
39 
40 // STL
41 #include <vector>
42 
43 namespace te
44 {
45  namespace gm
46  {
47  class Geometry;
48  }
49 
50  namespace qt
51  {
52  namespace widgets
53  {
54  class MapDisplay;
55  }
56  }
57 
58  namespace edit
59  {
60 
62  {
63  Q_OBJECT
64 
65  public:
66 
67  MergeGeometriesTool(te::qt::widgets::MapDisplay* display, const te::map::AbstractLayerPtr& layer, const QCursor& cursor, QObject* parent = 0);
68 
69  /*! \brief Destructor. */
71 
72  void cancelEditionTool();
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:66
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