GEOS 3.14.0dev
operation/relateng/EdgeSetIntersector.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (c) 2024 Martin Davis
7 * Copyright (C) 2024 Paul Ramsey <pramsey@cleverelephant.ca>
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************/
15
16#pragma once
17
18
19#include <geos/index/strtree/TemplateSTRtree.h>
20#include <geos/index/chain/MonotoneChain.h>
21#include <geos/export.h>
22
23
24// Forward declarations
25namespace geos {
26namespace geom {
27 class Geometry;
28 class Envelope;
29}
30namespace noding {
31 class SegmentString;
32}
33namespace operation {
34namespace relateng {
35 class RelateSegmentString;
36 class EdgeSegmentIntersector;
37}
38}
39}
40
41namespace geos { // geos.
42namespace operation { // geos.operation
43namespace relateng { // geos.operation.relateng
44
45class GEOS_DLL EdgeSetIntersector {
46 using Envelope = geos::geom::Envelope;
47 using Geometry = geos::geom::Geometry;
48 template <typename ItemType>
49 using TemplateSTRtree = geos::index::strtree::TemplateSTRtree<ItemType>;
50 using MonotoneChain = geos::index::chain::MonotoneChain;
51 using SegmentString = geos::noding::SegmentString;
52 using EdgeSegmentIntersector = geos::operation::relateng::EdgeSegmentIntersector;
53
54private:
55
56 // Members
57 TemplateSTRtree<const MonotoneChain*> index;
58 // HPRtree index = new HPRtree();
59 const Envelope* envelope = nullptr;
60 std::deque<MonotoneChain> monoChains;
61 std::size_t overlapCounter = 0;
62
63
64 // Methods
65
66 void addToIndex(const SegmentString* segStr);
67
68 void addEdges(std::vector<const SegmentString*>& segStrings);
69
70
71public:
72
73 EdgeSetIntersector(
74 std::vector<const SegmentString*>& edgesA,
75 std::vector<const SegmentString*>& edgesB,
76 const Envelope* env)
77 : envelope(env)
78 {
79 addEdges(edgesA);
80 addEdges(edgesB);
81 // build index to ensure thread-safety
82 // index.build();
83 };
84
85 void process(EdgeSegmentIntersector& intersector);
86
87
88};
89
90} // namespace geos.operation.relateng
91} // namespace geos.operation
92} // namespace geos
93
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition Envelope.h:59
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:197
Monotone Chains are a way of partitioning the segments of a linestring to allow for fast searching of...
Definition index/chain/MonotoneChain.h:85
An interface for classes which represent a sequence of contiguous line segments.
Definition SegmentString.h:47
Basic namespace for all GEOS functionalities.
Definition geos.h:39