Loading...
Searching...
No Matches
CoordinateSnapper.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/geometry/CoordinateSnapper.h
22 \brief Algorithms to snap existing "close" coordinates to each other based uppon a given tolerance, ensuring that they now have the exactly same location.
23 */
24
25#ifndef __TERRALIB_GEOMETRY_INTERNAL_COORDINATESNAPPER_H
26#define __TERRALIB_GEOMETRY_INTERNAL_COORDINATESNAPPER_H
27
28#include "Config.h"
29
31
32#include <vector>
33
34struct CoordIndexInternal;
35struct CoordIndexData;
36struct CoordIndex;
37
38namespace te
39{
40 namespace gm
41 {
42 struct Coord2D;
43 class Envelope;
44 class Geometry;
45 class GeometryPtr;
46
47 /*!
48 \class CoordinateSnapper
49
50 \brief Algorithm to snap existing "close" coordinates to each other based uppon a given tolerance, ensuring that they now have the exactly same location.
51
52 \ingroup vp
53
54 \sa GeometrySnapper
55 */
57 {
58 public:
59
60 /*!
61 \brief Algorithm to snap existing "close" coordinates to each other based uppon a given tolerance, ensuring that they now have the exactly same location.
62
63 \param vecGeometries The geometry list to be analysed
64 \param distance The distance to be considered for the snapping of the coordinates.
65
66 \return The resulting snapped geometries
67 */
68 static te::gm::GeometryVector snapCoordinates(const te::gm::GeometryVectorConst& vecGeometries, double distance, bool validateResult = true);
69
70 /*!
71 \brief Algorithm to snap existing "close" coordinates to each other based uppon a given tolerance, ensuring that they now have the exactly same location.
72
73 \param geometry The geometry to be analysed
74 \param distance The distance to be considered for the snapping of the coordinates.
75
76 \return The resulting snapped geometry
77 */
78 static te::gm::GeometryPtr snapCoordinates(const te::gm::Geometry* geometry, double distance, bool validateResult = true);
79
80 protected:
81
82 /*!
83 \brief Populates the coordinate index considering the coordinates of the given geometry
84
85 \param geometry The geometry from which the coordinates will be added to the coordinate index
86 \param coordIndex The index to be populated
87 */
88 static void populateCoordIndex(const te::gm::Geometry* geometry, CoordIndex& coordIndex);
89
90 /*!
91 \brief Populates the coordinate index considering the coordinates of the given geometry vector
92
93 \param vecGeometries The geometries from which the coordinates will be added to the coordinate index
94 \param coordIndex The index to be populated
95 */
96 static void populateCoordIndex(const te::gm::GeometryVectorConst& vecGeometries, CoordIndex& coordIndex);
97
98 /*!
99 \brief Analyses all the coordinates in the coordinate index, detecting clusters and the snapping them to each detected cluster
100
101 \param distance The distance to be considered when detecting clusters and snapping geometries
102 \param coordIndex The index to be populated
103 */
104 static void snapToClusters(double distance, CoordIndex& coordIndex);
105
106 /*!
107 \brief Snaps the geometry coordinates to the existing clusters in the coordinate index
108
109 \param geometry The geometry to be snapped
110 \param distance The distance to be considered when detecting clusters and snapping geometries
111 \param coordIndex The coordinate index containing the clusters
112 */
113 static te::gm::Geometry* snapCoordinates(const te::gm::Geometry* geometry, double distance, CoordIndex& coordIndex, bool& wasChanged);
114
115 /*!
116 \brief Snaps the geometries coordinates to the existing clusters in the coordinate index
117
118 \param vecGeometries The geometries to be snapped
119 \param distance The distance to be considered when detecting clusters and snapping geometries
120 \param coordIndex The coordinate index containing the clusters
121 */
122 static te::gm::GeometryVector snapCoordinates(const te::gm::GeometryVectorConst& vecGeometries, double distance, bool validateResult, CoordIndex& coordIndex);
123 };
124 }
125}
126#endif // __TERRALIB_GEOMETRY_INTERNAL_COORDINATESNAPPER_H
Algorithm to snap existing "close" coordinates to each other based uppon a given tolerance,...
static te::gm::Geometry * snapCoordinates(const te::gm::Geometry *geometry, double distance, CoordIndex &coordIndex, bool &wasChanged)
Snaps the geometry coordinates to the existing clusters in the coordinate index.
static te::gm::GeometryVector snapCoordinates(const te::gm::GeometryVectorConst &vecGeometries, double distance, bool validateResult=true)
Algorithm to snap existing "close" coordinates to each other based uppon a given tolerance,...
static te::gm::GeometryPtr snapCoordinates(const te::gm::Geometry *geometry, double distance, bool validateResult=true)
Algorithm to snap existing "close" coordinates to each other based uppon a given tolerance,...
static void populateCoordIndex(const te::gm::Geometry *geometry, CoordIndex &coordIndex)
Populates the coordinate index considering the coordinates of the given geometry.
static void populateCoordIndex(const te::gm::GeometryVectorConst &vecGeometries, CoordIndex &coordIndex)
Populates the coordinate index considering the coordinates of the given geometry vector.
static void snapToClusters(double distance, CoordIndex &coordIndex)
Analyses all the coordinates in the coordinate index, detecting clusters and the snapping them to eac...
static te::gm::GeometryVector snapCoordinates(const te::gm::GeometryVectorConst &vecGeometries, double distance, bool validateResult, CoordIndex &coordIndex)
Snaps the geometries coordinates to the existing clusters in the coordinate index.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
std::vector< te::gm::Geometry * > GeometryVector
std::vector< const te::gm::Geometry * > GeometryVectorConst
TerraLib.
#define TEGEOMEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:76
Proxy configuration file for TerraView (see terraview_config.h).
Utility classes, structures and definitions for Vector Processing.