FixGeometry.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 FixGeometry.h
22 
23  \brief Functrions to fix geometry.
24 
25  \ingroup vp
26  */
27 
28 #ifndef __TERRALIB_VP_INTERNAL_FIXGEOMETRY_H
29 #define __TERRALIB_VP_INTERNAL_FIXGEOMETRY_H
30 
31 //Terralib
32 
33 #include "../common/Static.h"
34 
35 #include "../dataaccess/dataset/DataSet.h"
36 #include "../dataaccess/dataset/DataSetType.h"
37 #include "../dataaccess/datasource/DataSource.h"
38 #include "../dataaccess/dataset/ObjectIdSet.h"
39 
40 #include "../datatype/Property.h"
41 
42 #include "../geometry/Enums.h"
43 #include "../memory/DataSet.h"
44 
45 #include "Algorithm.h"
46 #include "AlgorithmParams.h"
47 #include "Config.h"
48 
49 namespace te
50 {
51  namespace vp
52  {
53  /*!
54  \class FixGeometry
55 
56  \brief A static class with methods to fix geometry.
57  */
59  {
60  public:
61 
62  /*!
63  \brief This method gets the datasource capabilities and calls the specific function to fix geometry.
64 
65  \param dataSource The data source information.
66  \param dataSetName The input data name.
67  \param errorMessage Variable to catch any error occurred during execution.
68  \param oidSet Set of object ids to filter iconsistent geometries.
69 
70  \return True, if the function was executed successfully and the geometries fixed was updated.
71  */
72  static bool makeValid(const te::da::DataSourcePtr dataSource,
73  const std::string dataSetName,
74  std::string errorMessage,
75  te::da::ObjectIdSet* oidSet = 0);
76 
77  private:
78 
79  /*!
80  \brief It tries to fix invalid geometry by SQL clause ST_MakeValid and updates the source data.
81 
82  \param dataSource The data source information.
83  \param dataSetName The input data name.
84  \param errorMessage Variable to catch any error occurred during execution.
85 
86  \return True, if the query was executed successfully and the geometries fixed was updated.
87 
88  \note The layer must be inserted in a database with spatial extent.
89  */
90  static bool makeValidGeometryQuery(const te::da::DataSourcePtr dataSource,
91  const std::string dataSetName,
92  std::string errorMessage,
93  te::da::ObjectIdSet* oidSet = 0);
94 
95  /*!
96  \brief It tries to fix invalid geometry by GEOS and updates the source data.
97 
98  \param dataSource The data source information.
99  \param dataSetName The input data name.
100  \param errorMessage Variable to catch any error occurred during execution.
101 
102  \return True, if the query was executed successfully and the geometries fixed was updated.
103  */
104  static bool makeValidGeometryMemory(const te::da::DataSourcePtr dataSource,
105  const std::string dataSetName,
106  std::string errorMessage,
107  te::da::ObjectIdSet* oidSet = 0);
108  };
109  }
110 }
111 #endif // __TERRALIB_VP_INTERNAL_DISSOLVE_H
#define TEVPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
A static class with methods to fix geometry.
Definition: FixGeometry.h:58
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1440
Algorithm Parameters.
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.
Configuration flags for the Terrralib Vector Processing module.
A base type for static classes.
Definition: Static.h:43