GeometrySnapper.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 GeometrySnapper.h
22 
23  \brief Algorithm to snap geometries to each other based on a given tolerance
24 
25  \ingroup vp
26  */
27 
28 #ifndef __TERRALIB_VP_INTERNAL_GEOMETRYSNAPPER_H
29 #define __TERRALIB_VP_INTERNAL_GEOMETRYSNAPPER_H
30 
31 #include "Config.h"
32 
33 #include "../geometry/CommonDataStructures.h"
34 
35 namespace te
36 {
37  namespace gm
38  {
39  class Geometry;
40  }
41 
42  namespace vp
43  {
44  class FeatureSet;
45 
46  /*!
47  \class GeometrySnapper
48 
49  \brief Algorithm to snap geometries to each other based on a given tolerance
50 
51  \ingroup vp
52 
53  \sa CoordinateSnapper
54  */
56  {
57  public:
58 
59  /*!
60  \brief Algorithm to snap given geometries to each other based on a given tolerance.
61  This algorithm will also detect intersection segments between geometries and create new coordinates when necessary
62 
63  \param geometryVector The geometry list to be analysed
64  \param tolerance The tolerance to be considered for the snapping of the coordinates.
65 
66  \return The resulting snapped geometries
67  */
68  static te::gm::GeometryVector snapGeometries(const te::gm::GeometryVectorConst& geometryVector, double tolerance);
69 
70  /*!
71  \brief Algorithm to snap given geometries to each other based on a given tolerance.
72  This algorithm will also detect intersection segments between geometries and create new coordinates when necessary
73 
74  \param geometryVector The geometry list to be analysed
75  \param tolerance The tolerance to be considered for the snapping of the coordinates.
76 
77  \return The resulting snapped geometries
78  */
79  static te::gm::Geometry* snapGeometries(const te::gm::Geometry* geometry, double tolerance);
80 
81  /*!
82  \brief Algorithm to snap given features to each other based on a given tolerance.
83  This algorithm will also detect intersection segments between features and create new coordinates when necessary
84 
85  \param vecGeometries The geometry list to be analysed
86  \param tolerance The tolerance to be considered for the snapping of the coordinates.
87  \param discardCollapsedFeatures IF TRUE, all collapsed features will be discarded from the resulting featureSet
88 
89  \return The resulting snapped geometries
90  */
91  static te::vp::FeatureSet snapFeatures(const te::vp::FeatureSet& featureSet, double tolerance, bool discardCollapsedFeatures);
92 
93  /*!
94  \brief Algorithm to remove slivers from a geometry.
95 
96  \param geometry The geometry to be analysed
97  \param tolerance The tolerance to be considered for detecting the slivers.
98 
99  \return The resulting geometry
100  */
101  static te::gm::Geometry* removeSlivers(te::gm::Geometry* geometry, double tolerance);
102 
103  /*!
104  \brief Algorithm to remove slivers from geometries.
105 
106  \param geometryVector The geometry list to be analysed
107  \param tolerance The tolerance to be considered for detecting the slivers.
108 
109  \return The resulting geometries
110  */
111  static te::gm::GeometryVector removeSlivers(const te::gm::GeometryVectorConst& geometryVector, double tolerance);
112 
113  /*!
114  \brief Algorithm to remove slivers from features.
115 
116  \param vecGeometries The geometry list to be analysed
117  \param tolerance The tolerance to be considered for detecting the slivers.
118 
119  \param discardCollapsedFeatures IF TRUE, all collapsed features will be discarded from the resulting featureSet
120 
121  \return The resulting features
122  */
123  static te::vp::FeatureSet removeSlivers(const te::vp::FeatureSet& featureSet, double tolerance, bool discardCollapsedFeatures);
124 
125  //!< Discard all the features that are null or empty
127  };
128  }
129 }
130 #endif // __TERRALIB_VP_INTERNAL_GEOMETRYSNAPPER_H
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::vp::GeometrySnapper::discardNullAndEmptyFeatures
static void discardNullAndEmptyFeatures(te::vp::FeatureSet &featureSet)
te::vp::GeometrySnapper::snapGeometries
static te::gm::GeometryVector snapGeometries(const te::gm::GeometryVectorConst &geometryVector, double tolerance)
Algorithm to snap given geometries to each other based on a given tolerance. This algorithm will also...
te::gm::GeometryVectorConst
std::vector< const te::gm::Geometry * > GeometryVectorConst
Definition: CommonDataStructures.h:51
te::gm::GeometryVector
std::vector< te::gm::Geometry * > GeometryVector
Definition: CommonDataStructures.h:50
TEVPEXPORT
#define TEVPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
te::vp::GeometrySnapper::removeSlivers
static te::vp::FeatureSet removeSlivers(const te::vp::FeatureSet &featureSet, double tolerance, bool discardCollapsedFeatures)
Algorithm to remove slivers from features.
te::vp::GeometrySnapper::snapGeometries
static te::gm::Geometry * snapGeometries(const te::gm::Geometry *geometry, double tolerance)
Algorithm to snap given geometries to each other based on a given tolerance. This algorithm will also...
te::vp::GeometrySnapper::removeSlivers
static te::gm::Geometry * removeSlivers(te::gm::Geometry *geometry, double tolerance)
Algorithm to remove slivers from a geometry.
te::vp::FeatureSet
An alias for a set of Features.
Definition: Feature.h:60
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::vp::GeometrySnapper
Algorithm to snap geometries to each other based on a given tolerance.
Definition: GeometrySnapper.h:56
te::vp::GeometrySnapper::snapFeatures
static te::vp::FeatureSet snapFeatures(const te::vp::FeatureSet &featureSet, double tolerance, bool discardCollapsedFeatures)
Algorithm to snap given features to each other based on a given tolerance. This algorithm will also d...
te::gm::Geometry
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
te::vp::GeometrySnapper::removeSlivers
static te::gm::GeometryVector removeSlivers(const te::gm::GeometryVectorConst &geometryVector, double tolerance)
Algorithm to remove slivers from geometries.