GEOS  3.8.0dev
SimpleSnapRounder.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2006 Refractions Research Inc.
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  * Last port: noding/snapround/SimpleSnapRounder.java r320 (JTS-1.12)
16  *
17  **********************************************************************/
18 
19 #ifndef GEOS_NODING_SNAPROUND_SIMPLESNAPROUNDER_H
20 #define GEOS_NODING_SNAPROUND_SIMPLESNAPROUNDER_H
21 
22 #include <geos/export.h>
23 
24 #include <vector>
25 
26 #include <geos/inline.h>
27 
28 #include <geos/noding/Noder.h> // for inheritance
29 #include <geos/algorithm/LineIntersector.h> // for composition
30 #include <geos/geom/Coordinate.h> // for use in vector
31 #include <geos/geom/PrecisionModel.h> // for inlines (should drop)
32 
33 // Forward declarations
34 namespace geos {
35 namespace geom {
36 //class PrecisionModel;
37 }
38 namespace algorithm {
39 class LineIntersector;
40 }
41 namespace noding {
42 class SegmentString;
43 class NodedSegmentString;
44 namespace snapround {
45 class HotPixel;
46 }
47 }
48 }
49 
50 namespace geos {
51 namespace noding { // geos::noding
52 namespace snapround { // geos::noding::snapround
53 
73 class GEOS_DLL SimpleSnapRounder: public Noder { // implements NoderIface
74 
75 public:
76 
78 
79  std::vector<SegmentString*>* getNodedSubstrings() const override;
80 
81  void computeNodes(std::vector<SegmentString*>* inputSegmentStrings) override;
82 
83  void add(const SegmentString* segStr);
84 
92  void computeVertexSnaps(const std::vector<SegmentString*>& edges);
93 
94 private:
95 
96  const geom::PrecisionModel& pm;
98  double scaleFactor;
99  std::vector<SegmentString*>* nodedSegStrings;
100 
101  void checkCorrectness(std::vector<SegmentString*>& inputSegmentStrings);
102 
103  void snapRound(std::vector<SegmentString*>* segStrings,
105 
117  void findInteriorIntersections(std::vector<SegmentString*>& segStrings,
118  algorithm::LineIntersector& li, std::vector<geom::Coordinate>& ret);
119 
126  void computeSnaps(const std::vector<SegmentString*>& segStrings,
127  std::vector<geom::Coordinate>& snapPts);
128 
129  void computeSnaps(NodedSegmentString* ss, std::vector<geom::Coordinate>& snapPts);
130 
136  void computeVertexSnaps(NodedSegmentString* e0, NodedSegmentString* e1);
137 
138  // Declare type as noncopyable
139  SimpleSnapRounder(const SimpleSnapRounder& other) = delete;
140  SimpleSnapRounder& operator=(const SimpleSnapRounder& rhs) = delete;
141 };
142 
143 } // namespace geos::noding::snapround
144 } // namespace geos::noding
145 } // namespace geos
146 
147 #endif // GEOS_NODING_SNAPROUND_SIMPLESNAPROUNDER_H
Uses Snap Rounding to compute a rounded, fully noded arrangement from a set of SegmentStrings.
Definition: SimpleSnapRounder.h:73
An interface for classes which represent a sequence of contiguous line segments.
Definition: SegmentString.h:46
Represents a list of contiguous line segments, and supports noding the segments.
Definition: NodedSegmentString.h:57
Specifies the precision model of the Coordinate in a Geometry.
Definition: PrecisionModel.h:87
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition: LineIntersector.h:49
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
Computes all intersections between segments in a set of SegmentString.
Definition: Noder.h:49