Loading...
Searching...
No Matches
OverlapFixer.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 OverlapFixer.h
22
23 \brief Algorithm to detect and fix overlaps in a list of polygons
24
25 \ingroup vp
26 */
27
28#ifndef __TERRALIB_VP_INTERNAL_OVERLAPFIXER_H
29#define __TERRALIB_VP_INTERNAL_OVERLAPFIXER_H
30
31// Terralib
32#include "Config.h"
33
34#include "../geometry/CommonDataStructures.h"
35#include "../geometry/Geometry.h"
36
37#include <memory>
38#include <vector>
39
40class GeometryInfoOverlap;
41struct OverlapReport;
42struct SingleFixReport;
43
44namespace te
45{
46 namespace vp
47 {
48 /*!
49 \class OverlapFixerReport
50
51 \brief OverlapFixerReport represents the report of the fix operation, for each input geometry and for the generated intersection fragments.
52 */
54 {
55 public:
56 enum class FixResult
57 {
58 UNCHANGED, FIXED, REMOVED, NEW
59 };
60
61 public:
62 //!< Constructor
64
65 //!< Constructor
67
68 //!< Destructor
70
71 std::unique_ptr<te::gm::Geometry> m_geometry; //!< The resulting geometry of the fixer operation
72 FixResult m_result; //!< The result of the fixer operation
73 };
74
75 /*!
76 \class OverlapFixer
77
78 \brief OverlapFixerReport is a class containing algorithms to detect and fix overlaps from a list of polygons or multipolygons
79 */
81 {
82 public:
83
84 /*!
85 \brief Fix the existing overlaps of the polygons ou multipolygons from the given vecGeometries vector
86
87 \param vecGeometries The input geometries to be analysed
88
89 \return A vector containing the fixed geometries
90 */
91 static std::vector<OverlapFixerReport*> fix(const te::gm::GeometryVector& vecGeometries);
92
93 /*!
94 \brief Detects all the existing overlaps from the given geometries
95
96 \param vecGeometries The input geometries to be analysed
97
98 \return A vector containing the intersection fragments
99 */
101
102 /*!
103 \brief Algorithm to detect overlaps. This algorith does a deep and exausting geometry analysis and doesnt generate false positives
104
105 \param geometryA The input geometry A
106 \param geometryB The input geometry B
107
108 \return TRUE if there is at least one overlap between the given geometries. FALSE otherwise
109 */
110 static bool hasOverlaps(const te::gm::Geometry* geometryA, const te::gm::Geometry* geometryB);
111
112 protected:
113
114 /*!
115 \brief Internal method that detects all the existing overlaps from the given geometries
116
117 \param vecGeometries The input geometries to be analysed
118
119 \return A vector containing the intersection fragments
120 */
121 static te::gm::GeometryVector detectOverlaps(const std::vector<GeometryInfoOverlap*>& vecGeometries);
122
123 /*!
124 \brief Internal method to fix the existing overlaps of the polygons ou multipolygons from the given vecGeometries vector considering the given intersection fragments
125
126 \param vecGeometries The input geometries to be fixed
127 \param vecFragments The intersection fragments to be used to fix the geometries
128 */
129 static void fixOverlaps(std::vector<GeometryInfoOverlap*>& vecGeometries, const te::gm::GeometryVector& vecFragments);
130
131 /*!
132 \brief Internal method to fix the existing overlaps of the polygons ou multipolygons from the given vecGeometries vector
133
134 \param vecGeometries The input geometries to be analysed
135
136 \return A vector containing the fixed geometries
137 */
138 static te::gm::GeometryVector fixOverlaps(std::vector<GeometryInfoOverlap*>& vecGeometries);
139
140 /*!
141 \brief Internal method to fix the possible overlaps within the intersection fragments themselves
142
143 \param vecFragments A vector containing all detected intersection fragments
144
145 \return A vector containing the intersection fragments without any overlaps between the geometries
146 */
148 };
149 }
150}
151#endif // __TERRALIB_VP_INTERNAL_OVERLAPFIXER_H
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
OverlapFixerReport represents the report of the fix operation, for each input geometry and for the ge...
Definition: OverlapFixer.h:54
std::unique_ptr< te::gm::Geometry > m_geometry
The resulting geometry of the fixer operation.
Definition: OverlapFixer.h:71
OverlapFixerReport(te::gm::Geometry *geometry, FixResult result)
Destructor.
OverlapFixerReport()
< Constructor
FixResult m_result
The result of the fixer operation.
Definition: OverlapFixer.h:72
OverlapFixerReport is a class containing algorithms to detect and fix overlaps from a list of polygon...
Definition: OverlapFixer.h:81
static void fixOverlaps(std::vector< GeometryInfoOverlap * > &vecGeometries, const te::gm::GeometryVector &vecFragments)
Internal method to fix the existing overlaps of the polygons ou multipolygons from the given vecGeome...
static te::gm::GeometryVector detectOverlaps(const te::gm::GeometryVector &vecGeometries)
Detects all the existing overlaps from the given geometries.
static te::gm::GeometryVector fixFragmentsOverlaps(const te::gm::GeometryVector &vecFragments)
Internal method to fix the possible overlaps within the intersection fragments themselves.
static te::gm::GeometryVector fixOverlaps(std::vector< GeometryInfoOverlap * > &vecGeometries)
Internal method to fix the existing overlaps of the polygons ou multipolygons from the given vecGeome...
static te::gm::GeometryVector detectOverlaps(const std::vector< GeometryInfoOverlap * > &vecGeometries)
Internal method that detects all the existing overlaps from the given geometries.
static std::vector< OverlapFixerReport * > fix(const te::gm::GeometryVector &vecGeometries)
Fix the existing overlaps of the polygons ou multipolygons from the given vecGeometries vector.
static bool hasOverlaps(const te::gm::Geometry *geometryA, const te::gm::Geometry *geometryB)
Algorithm to detect overlaps. This algorith does a deep and exausting geometry analysis and doesnt ge...
std::vector< te::gm::Geometry * > GeometryVector
TerraLib.
#define TEVPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
Proxy configuration file for TerraView (see terraview_config.h).