MakeGeometryValid.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 MakeGeometryValid.h
22 
23  \brief Functions to make geometry valid.
24 
25  \ingroup vp
26  */
27 
28 #ifndef __TERRALIB_VP_INTERNAL_MAKEGEOMETRYVALID_H
29 #define __TERRALIB_VP_INTERNAL_MAKEGEOMETRYVALID_H
30 
31 //Terralib
32 
33 #include "../common/Static.h"
34 
35 #include "../dataaccess/dataset/ObjectIdSet.h"
36 
37 #include "Config.h"
38 
39 namespace te
40 {
41  namespace da
42  {
43  class DataAccessPtr;
44  }
45 
46  namespace vp
47  {
48  /*!
49  \class MakeGeometryValid
50 
51  \brief A static class with methods to make geometry valid.
52  */
54  {
55  public:
56 
57  /*!
58  \brief This method gets the datasource capabilities and calls the specific function to fix geometry.
59 
60  \param dataSource The data source information.
61  \param dataSetName The input data name.
62  \param errorMessage Variable to catch any error occurred during execution.
63  \param oidSet Set of object ids to filter iconsistent geometries.
64 
65  \return True, if the function was executed successfully and the geometries fixed was updated.
66  */
67  static bool makeValid(const te::da::DataAccessPtr& dataAccess,
68  std::string& errorMessage,
69  te::da::ObjectIdSet* oidSet = 0);
70 
71  private:
72 
73  /*!
74  \brief It tries to fix invalid geometry by SQL clause ST_MakeValid and updates the source data.
75 
76  \param dataSource The data source information.
77  \param dataSetName The input data name.
78  \param errorMessage Variable to catch any error occurred during execution.
79 
80  \return True, if the query was executed successfully and the geometries fixed was updated.
81 
82  \note The layer must be inserted in a database with spatial extent.
83  */
84  static bool makeValidQuery(const te::da::DataAccessPtr& dataAccess,
85  std::string& errorMessage,
86  te::da::ObjectIdSet* oidSet = 0);
87 
88  /*!
89  \brief It tries to fix invalid geometry by GEOS and updates the source data.
90 
91  \param dataSource The data source information.
92  \param dataSetName The input data name.
93  \param errorMessage Variable to catch any error occurred during execution.
94 
95  \return True, if the query was executed successfully and the geometries fixed was updated.
96  */
97  static bool makeValidMemory(const te::da::DataAccessPtr& dataAccess,
98  std::string& errorMessage,
99  te::da::ObjectIdSet* oidSet = 0);
100  };
101  }
102 }
103 #endif // __TERRALIB_VP_INTERNAL_MAKEGEOMETRYVALID_H
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::vp::MakeGeometryValid::makeValid
static bool makeValid(const te::da::DataAccessPtr &dataAccess, std::string &errorMessage, te::da::ObjectIdSet *oidSet=0)
This method gets the datasource capabilities and calls the specific function to fix geometry.
te::da::DataAccessPtr
Definition: DataAccess.h:318
te::vp::MakeGeometryValid
A static class with methods to make geometry valid.
Definition: MakeGeometryValid.h:54
te::vp::MakeGeometryValid::makeValidMemory
static bool makeValidMemory(const te::da::DataAccessPtr &dataAccess, std::string &errorMessage, te::da::ObjectIdSet *oidSet=0)
It tries to fix invalid geometry by GEOS and updates the source data.
TEVPEXPORT
#define TEVPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
te::common::Static
A base type for static classes.
Definition: Static.h:44
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::vp::MakeGeometryValid::makeValidQuery
static bool makeValidQuery(const te::da::DataAccessPtr &dataAccess, std::string &errorMessage, te::da::ObjectIdSet *oidSet=0)
It tries to fix invalid geometry by SQL clause ST_MakeValid and updates the source data.
te::da::ObjectIdSet
This class represents a set of unique ids created in the same context. i.e. from the same data set.
Definition: ObjectIdSet.h:56