Loading...
Searching...
No Matches
SafeOverlay.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/algorithms/SafeOverlay.h
22
23 \brief A class containing helper methods to make overlay algorithms more robust and safer to execute when dealing with invalid geometries.
24 */
25
26#ifndef __TERRALIB_GEOMETRY_INTERNAL_SAFEOVERLAY_H
27#define __TERRALIB_GEOMETRY_INTERNAL_SAFEOVERLAY_H
28
29 // TerraLib
30#include "../Config.h"
31
32//STL
33#include <memory>
34#include <utility>
35
36namespace te
37{
38 namespace gm
39 {
40 class Envelope;
41 class Geometry;
42 class GeometryPtr;
43
44 using GeometryPair = std::pair<te::gm::GeometryPtr, te::gm::GeometryPtr>;
45
46 /*!
47 \class SafeOverlay
48
49 \brief A class containing helper methods to make overlay algorithms more robust and safer to execute when dealing with invalid geometries.
50 \description When some exception is thrown during the execution of the basic overlay algorithms,
51 this class will handle it, try to make the geoemtries valid, and try again
52 */
54 {
55 public:
56
57 //!< Constructor
58 SafeOverlay() = delete;
59
60 //!< Destructor
61 ~SafeOverlay() = delete;
62
63 //!< Tries to clip the geometry. If an exception is thrown, it tries to make the geometry valid and retry again
64 static te::gm::Geometry* ClipGeometry(const te::gm::Geometry* geometry, const te::gm::Envelope& envelope);
65
66 //!< Tries to make the difference. If an exception is thrown, it tries to make the geometry valid and retry again
68
69 //!< Tries to make the intersection. If an exception is thrown, it tries to make the geometry valid and retry again
71
72 //!< Tries to make the geometry pair valid. If it is unable to do that, it will throw an exception
73 static std::unique_ptr<te::gm::GeometryPair> MakeValid(const te::gm::Geometry* g1, const te::gm::Geometry* g2);
74 };
75 } //namespace gm
76} //namespace te
77
78#endif // __TERRALIB_GEOMETRY_INTERNAL_SAFEOVERLAY_H
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
A class containing helper methods to make overlay algorithms more robust and safer to execute when de...
Definition: SafeOverlay.h:54
static te::gm::GeometryPtr Difference(const te::gm::Geometry *g1, const te::gm::Geometry *g2)
Tries to make the intersection. If an exception is thrown, it tries to make the geometry valid and re...
static te::gm::GeometryPtr Intersection(const te::gm::Geometry *g1, const te::gm::Geometry *g2)
Tries to make the geometry pair valid. If it is unable to do that, it will throw an exception.
static te::gm::Geometry * ClipGeometry(const te::gm::Geometry *geometry, const te::gm::Envelope &envelope)
Tries to make the difference. If an exception is thrown, it tries to make the geometry valid and retr...
SafeOverlay()=delete
< Constructor
~SafeOverlay()=delete
Tries to clip the geometry. If an exception is thrown, it tries to make the geometry valid and retry ...
static std::unique_ptr< te::gm::GeometryPair > MakeValid(const te::gm::Geometry *g1, const te::gm::Geometry *g2)
std::pair< te::gm::GeometryPtr, te::gm::GeometryPtr > GeometryPair
Definition: SafeOverlay.h:44
TerraLib.
#define TEGEOMEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:76