GEOS 3.8.1
OverlapUnion.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://trac.osgeo.org/geos
5 *
6 * Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 **********************************************************************
14 *
15 * Last port: ORIGINAL WORK, generalization of CascadedPolygonUnion
16 *
17 **********************************************************************/
18
19#ifndef GEOS_OP_UNION_OVERLAPUNION_H
20#define GEOS_OP_UNION_OVERLAPUNION_H
21
22#include <geos/export.h>
23
24#include <vector>
25#include <algorithm>
26#include <unordered_set>
27
28#include <geos/geom/Geometry.h>
29
30// Forward declarations
31namespace geos {
32namespace geom {
33class Envelope;
34class LineSegment;
35}
36}
37
38namespace geos {
39namespace operation { // geos::operation
40namespace geounion { // geos::operation::geounion
41
90class GEOS_DLL OverlapUnion {
91
92public:
93
94 OverlapUnion(const geom::Geometry* p_g0, const geom::Geometry* p_g1)
95 : g0(p_g0), g1(p_g1)
96 {
97 geomFactory = g0->getFactory();
98 isUnionSafe = false;
99 };
100
101 std::unique_ptr<geom::Geometry> doUnion();
102
103private:
104
105 const geom::GeometryFactory* geomFactory;
106 const geom::Geometry* g0;
107 const geom::Geometry* g1;
108 bool isUnionSafe;
109
110 geom::Envelope overlapEnvelope(const geom::Geometry* geom0, const geom::Geometry* geom1);
111 std::unique_ptr<geom::Geometry> extractByEnvelope(const geom::Envelope& env, const geom::Geometry* geom, std::vector<std::unique_ptr<geom::Geometry>>& disjointGeoms);
112 std::unique_ptr<geom::Geometry> combine(std::unique_ptr<geom::Geometry>& unionGeom, std::vector<std::unique_ptr<geom::Geometry>>& disjointPolys);
113 std::unique_ptr<geom::Geometry> unionFull(const geom::Geometry* geom0, const geom::Geometry* geom1);
114 std::unique_ptr<geom::Geometry> unionBuffer(const geom::Geometry* geom0, const geom::Geometry* geom1);
115 bool isBorderSegmentsSame(const geom::Geometry* result, const geom::Envelope& env);
116 bool isEqual(std::vector<geom::LineSegment>& segs0, std::vector<geom::LineSegment>& segs1);
117 std::vector<geom::LineSegment> extractBorderSegments(const geom::Geometry* geom0, const geom::Geometry* geom1, const geom::Envelope& env);
118 void extractBorderSegments(const geom::Geometry* geom, const geom::Envelope& penv, std::vector<geom::LineSegment>& psegs);
119
120};
121
122} // namespace geos::operation::union
123} // namespace geos::operation
124} // namespace geos
125
126#endif
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:58
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:68
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
Definition: OverlapUnion.h:90
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25