FixGeometryTopology.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 FixGeometryTopology.h
22 
23  \brief Functions to fix geometry topology.
24  */
25 
26 #ifndef __TERRALIB_GEOMETRY_INTERNAL_FIXGEOMETRYTOPOLOGY_H
27 #define __TERRALIB_GEOMETRY_INTERNAL_FIXGEOMETRYTOPOLOGY_H
28 
29 //Terralib
30 
31 #include "../common/Static.h"
32 
33 #include "Enums.h"
34 #include "Validation.h"
35 
36 #include "Config.h"
37 
38 #include <vector>
39 
40 namespace te
41 {
42  namespace gm
43  {
44  class Geometry;
45 
46  /*!
47  \class FixGeometryTopology
48 
49  \brief A static class with methods to fix geometry topology.
50  */
52  {
53  public:
54 
55  /*!
56  \brief This method gets a topologically inconsistent geometry and calls specific functions to fix this geometry.
57 
58  \param geometryToFix Input Geometry to fix.
59  \param fixedGeometryVector A vector with the result of fixed geometries.
60  \param topologyError If any error occurs, TopologyValidationError struct is populated with error message and geometry coordinate.
61 
62  \return True, if the function was executed successfully and the geometry was fixed correctly.
63  */
64  static bool fixTopology(const te::gm::Geometry& geometry,
65  std::vector<te::gm::Geometry*>& fixedGeometryVector,
66  TopologyValidationError topologyError);
67 
68  private:
69 
70  /*!
71  \brief This function closes an opened geometry ring.
72 
73  \param geometryToFix Input Geometry to fix.
74  \param topologyError If any error occurs, TopologyValidationError struct is populated with error message and geometry coordinate.
75 
76  \return True, if the the function was executed successfully and the geometry was fixed correctly.
77 
78  \note This function is only used for Geometries of Polygon and MultiPolygon types.
79  */
80  static bool closeGeometryRing(const te::gm::Geometry& geometry,
81  TopologyValidationError topologyError);
82 
83  /*!
84  \brief This function fixes geometries with self-intersection.
85 
86  \param geometryToFix Input Geometry to fix.
87  \param fixedGeometryVector A vector with the result of fixed geometries.
88  \param topologyError If any error occurs, TopologyValidationError struct is populated with error message and geometry coordinate.
89 
90  \return True, if the the function was executed successfully and the geometry was fixed correctly.
91  */
92  static bool fixSelfIntersection(const te::gm::Geometry& geometry,
93  std::vector<te::gm::Geometry*>& fixedGeometryVector,
94  TopologyValidationError topologyError);
95  };
96  }
97 }
98 #endif // __TERRALIB_GEOMETRY_INTERNAL_FIXGEOMETRYTOPOLOGY_H
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::gm::FixGeometryTopology
A static class with methods to fix geometry topology.
Definition: FixGeometryTopology.h:52
te::gm::FixGeometryTopology::fixSelfIntersection
static bool fixSelfIntersection(const te::gm::Geometry &geometry, std::vector< te::gm::Geometry * > &fixedGeometryVector, TopologyValidationError topologyError)
This function fixes geometries with self-intersection.
TEGEOMEXPORT
#define TEGEOMEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:76
Enums.h
Enumerations of XML module.
Validation.h
A list of Validation functions for the Geometry Module.
te::common::Static
A base type for static classes.
Definition: Static.h:44
te::gm::FixGeometryTopology::closeGeometryRing
static bool closeGeometryRing(const te::gm::Geometry &geometry, TopologyValidationError topologyError)
This function closes an opened geometry ring.
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::gm::TopologyValidationError
This struct contains informations about GEOS TopologyValidationError.
Definition: Validation.h:54
te::gm::Geometry
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
te::gm::FixGeometryTopology::fixTopology
static bool fixTopology(const te::gm::Geometry &geometry, std::vector< te::gm::Geometry * > &fixedGeometryVector, TopologyValidationError topologyError)
This method gets a topologically inconsistent geometry and calls specific functions to fix this geome...