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