GEOS  3.13.0dev
SnapRoundingIntersectionAdder.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2020 Paul Ramsey <pramsey@cleverelephant.ca>
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 #pragma once
16 
17 #include <geos/export.h>
18 
19 #include <vector>
20 #include <memory>
21 
22 #include <geos/noding/Noder.h> // for inheritance
23 #include <geos/algorithm/LineIntersector.h> // for composition
24 #include <geos/geom/Coordinate.h> // for use in vector
25 #include <geos/geom/CoordinateSequence.h>
26 #include <geos/geom/PrecisionModel.h> // for inlines (should drop)
27 #include <geos/noding/SegmentIntersector.h>
28 
29 
30 // Forward declarations
31 namespace geos {
32 namespace geom {
33 class PrecisionModel;
34 }
35 namespace noding {
36 class SegmentString;
37 class NodedSegmentString;
38 namespace snapround {
39 class HotPixel;
40 }
41 }
42 }
43 
44 namespace geos {
45 namespace noding { // geos::noding
46 namespace snapround { // geos::noding::snapround
47 
64 class GEOS_DLL SnapRoundingIntersectionAdder: public SegmentIntersector { // implements SegmentIntersector
65 
66 private:
67 
69  geom::CoordinateSequence intersections;
70  // const geom::PrecisionModel* pm;
71  double nearnessTol;
72 
86  void processNearVertex(const geom::CoordinateSequence& seq0,
87  std::size_t ptIndex,
88  const geom::CoordinateSequence& seq1,
89  std::size_t segIndex,
90  SegmentString* edge);
91 
92  bool isNearSegmentInterior(const geom::CoordinateXY& p, const geom::CoordinateXY& p0, const geom::CoordinateXY& p1) const;
93 
94 public:
95 
96  SnapRoundingIntersectionAdder(double p_nearnessTol)
98  , intersections(geom::CoordinateSequence::XYZM(0))
99  , nearnessTol(p_nearnessTol)
100  {}
101 
102  geom::CoordinateSequence getIntersections() { return std::move(intersections); };
103 
112  void processIntersections(SegmentString* e0, std::size_t segIndex0, SegmentString* e1, std::size_t segIndex1) override;
113 
118  bool isDone() const override { return false; }
119 
120 
121 };
122 
123 } // namespace geos::noding::snapround
124 } // namespace geos::noding
125 } // namespace geos
126 
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition: LineIntersector.h:53
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:56
Processes possible intersections detected by a Noder.
Definition: noding/SegmentIntersector.h:45
An interface for classes which represent a sequence of contiguous line segments.
Definition: SegmentString.h:47
Definition: SnapRoundingIntersectionAdder.h:64
void processIntersections(SegmentString *e0, std::size_t segIndex0, SegmentString *e1, std::size_t segIndex1) override
bool isDone() const override
Definition: SnapRoundingIntersectionAdder.h:118
static CoordinateSequence XYZM(std::size_t size)
Definition: CoordinateSequence.h:146
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25