GEOS 3.15.0dev
GeometryNoder.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2012 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 * NOTE: this is not in JTS. JTS has a snapround/GeometryNoder though
16 *
17 **********************************************************************/
18
19#pragma once
20
21#include <geos/export.h>
22#include <geos/noding/SegmentString.h> // for NonConstVect
23
24#include <memory> // for unique_ptr
25
26// Forward declarations
27namespace geos {
28namespace algorithm {
29class CircularArcIntersector;
30}
31namespace geom {
32class Geometry;
33}
34namespace noding {
35class ArcIntersectionAdder;
36class Noder;
37}
38}
39
40namespace geos {
41namespace noding { // geos.noding
42
43class GEOS_DLL GeometryNoder {
44public:
45
46 static std::unique_ptr<geom::Geometry> node(const geom::Geometry& geom);
47
48 static std::unique_ptr<geom::Geometry> node(const geom::Geometry& geom1, const geom::Geometry& geom2);
49
50 GeometryNoder(const geom::Geometry& g);
51
52 GeometryNoder(const geom::Geometry& g1, const geom::Geometry& g2);
53
54 ~GeometryNoder();
55
56 std::unique_ptr<geom::Geometry> getNoded();
57
58 void setOnlyFirstGeomEdges(bool onlyFirstGeomEdges);
59
60 void setPreserveCompoundCurves(bool preserve);
61
62 // Declare type as noncopyable
63 GeometryNoder(GeometryNoder const&) = delete;
64 GeometryNoder& operator=(GeometryNoder const&) = delete;
65
66private:
67
68 bool isInResult(const PathString& ps) const;
69
70 const geom::Geometry* argGeom1;
71 const geom::Geometry* argGeom2;
72 const bool argGeomHasCurves;
73 bool argGeomHasCompoundCurves;
74 bool onlyFirstGeomEdges;
75 bool preserveCompoundCurves;
76
77 std::unique_ptr<Noder> noder;
78 std::unique_ptr<algorithm::CircularArcIntersector> m_cai;
79 std::unique_ptr<ArcIntersectionAdder> m_aia;
80
81 void extractPathStrings(const geom::Geometry& g, std::vector<std::unique_ptr<PathString>>& to);
82
83 Noder& getNoder();
84
85 std::unique_ptr<geom::Geometry> toGeometry(std::vector<std::unique_ptr<PathString>>& noded) const;
86
87};
88
89} // namespace geos.noding
90} // namespace geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38