GEOS  3.11.0rc0
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/PrecisionModel.h> // for inlines (should drop)
26 #include <geos/noding/SegmentIntersector.h>
27 
28 
29 // Forward declarations
30 namespace geos {
31 namespace geom {
32 class PrecisionModel;
33 }
34 namespace noding {
35 class SegmentString;
36 class NodedSegmentString;
37 namespace snapround {
38 class HotPixel;
39 }
40 }
41 }
42 
43 namespace geos {
44 namespace noding { // geos::noding
45 namespace snapround { // geos::noding::snapround
46 
63 class GEOS_DLL SnapRoundingIntersectionAdder: public SegmentIntersector { // implements SegmentIntersector
64 
65 private:
66 
68  std::unique_ptr<std::vector<geom::Coordinate>> intersections;
69  // const geom::PrecisionModel* pm;
70  double nearnessTol;
71 
85  void processNearVertex(const geom::Coordinate& p, SegmentString* edge, std::size_t segIndex,
86  const geom::Coordinate& p0, const geom::Coordinate& p1);
87 
88 
89 public:
90 
91  SnapRoundingIntersectionAdder(double p_nearnessTol)
93  , intersections(new std::vector<geom::Coordinate>)
94  , nearnessTol(p_nearnessTol)
95  {}
96 
97  std::unique_ptr<std::vector<geom::Coordinate>> getIntersections() { return std::move(intersections); };
98 
107  void processIntersections(SegmentString* e0, std::size_t segIndex0, SegmentString* e1, std::size_t segIndex1) override;
108 
113  bool isDone() const override { return false; }
114 
115 
116 };
117 
118 } // namespace geos::noding::snapround
119 } // namespace geos::noding
120 } // namespace geos
121 
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition: LineIntersector.h:50
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:58
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:45
Definition: SnapRoundingIntersectionAdder.h:63
void processIntersections(SegmentString *e0, std::size_t segIndex0, SegmentString *e1, std::size_t segIndex1) override
bool isDone() const override
Definition: SnapRoundingIntersectionAdder.h:113
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25