GEOS  3.13.1
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
25 namespace geos {
26 namespace geom {
27  class Geometry;
28  class Envelope;
29 }
30 namespace noding {
31  class SegmentString;
32 }
33 namespace operation {
34 namespace relateng {
35  class RelateSegmentString;
36  class EdgeSegmentIntersector;
37 }
38 }
39 }
40 
41 
44 using geos::index::strtree::TemplateSTRtree;
46 using geos::operation::relateng::EdgeSegmentIntersector;
47 
48 
49 namespace geos { // geos.
50 namespace operation { // geos.operation
51 namespace relateng { // geos.operation.relateng
52 
53 class GEOS_DLL EdgeSetIntersector {
54 
55 private:
56 
57  // Members
58  TemplateSTRtree<const MonotoneChain*> index;
59  // HPRtree index = new HPRtree();
60  const Envelope* envelope = nullptr;
61  std::deque<MonotoneChain> monoChains;
62  std::size_t overlapCounter = 0;
63 
64 
65  // Methods
66 
67  void addToIndex(const SegmentString* segStr);
68 
69  void addEdges(std::vector<const SegmentString*>& segStrings);
70 
71 
72 public:
73 
74  EdgeSetIntersector(
75  std::vector<const SegmentString*>& edgesA,
76  std::vector<const SegmentString*>& edgesB,
77  const Envelope* env)
78  : envelope(env)
79  {
80  addEdges(edgesA);
81  addEdges(edgesB);
82  // build index to ensure thread-safety
83  // index.build();
84  };
85 
86  void process(EdgeSegmentIntersector& intersector);
87 
88 
89 };
90 
91 } // namespace geos.operation.relateng
92 } // namespace geos.operation
93 } // namespace geos
94 
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
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25