GEOS  3.13.0dev
NodingValidator.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 #pragma once
16 
17 #include <geos/export.h>
18 
19 #include <vector>
20 #include <iostream>
21 
22 #include <geos/algorithm/LineIntersector.h>
23 //#include <geos/geom/Coordinate.h>
24 
25 // Forward declarations
26 namespace geos {
27 namespace geom {
28 class Coordinate;
29 }
30 namespace noding {
31 class SegmentString;
32 }
33 }
34 
35 namespace geos {
36 namespace noding { // geos.noding
37 
45 class GEOS_DLL NodingValidator {
46 private:
48  const std::vector<SegmentString*>& segStrings;
49 
54  void checkCollapses() const;
55 
56  void checkCollapses(const SegmentString& ss) const;
57 
58  void checkCollapse(const geom::Coordinate& p0, const geom::Coordinate& p1,
59  const geom::Coordinate& p2) const;
60 
65  void checkInteriorIntersections();
66 
67  void checkInteriorIntersections(const SegmentString& ss0,
68  const SegmentString& ss1);
69 
70  void checkInteriorIntersections(
71  const SegmentString& e0, std::size_t segIndex0,
72  const SegmentString& e1, std::size_t segIndex1);
73 
78  void checkEndPtVertexIntersections() const;
79 
80  void checkEndPtVertexIntersections(const geom::Coordinate& testPt,
81  const std::vector<SegmentString*>& segStrings) const;
82 
87  bool hasInteriorIntersection(const algorithm::LineIntersector& aLi,
88  const geom::Coordinate& p0, const geom::Coordinate& p1) const;
89 
90  // Declare type as noncopyable
91  NodingValidator(const NodingValidator& other) = delete;
92  NodingValidator& operator=(const NodingValidator& rhs) = delete;
93 
94 public:
95 
96  NodingValidator(const std::vector<SegmentString*>& newSegStrings):
97  segStrings(newSegStrings)
98  {}
99 
100  ~NodingValidator() {}
101 
102  void checkValid();
103 
104 };
105 
106 
107 } // namespace geos.noding
108 } // namespace geos
109 
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition: LineIntersector.h:53
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:216
Validates that a collection of SegmentStrings is correctly noded. Throws a TopologyException if a nod...
Definition: NodingValidator.h:45
An interface for classes which represent a sequence of contiguous line segments.
Definition: SegmentString.h:47
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25