GEOS  3.13.0dev
FastNodingValidator.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/FastNodingValidator.java rev. ??? (JTS-1.8)
16  *
17  **********************************************************************/
18 
19 #pragma once
20 
21 #include <geos/noding/NodingIntersectionFinder.h> // for composition
22 #include <geos/algorithm/LineIntersector.h> // for composition
23 
24 #include <memory>
25 #include <string>
26 #include <cassert>
27 
28 // Forward declarations
29 namespace geos {
30 namespace noding {
31 class SegmentString;
32 }
33 }
34 
35 namespace geos {
36 namespace noding { // geos.noding
37 
60 
61 public:
62 
63  FastNodingValidator(std::vector<noding::SegmentString*>& newSegStrings)
64  :
65  li(), // robust...
66  segStrings(newSegStrings),
67  segInt(),
68  isValidVar(true)
69  {
70  }
71 
78  bool
80  {
81  execute();
82  return isValidVar;
83  }
84 
91  std::string getErrorMessage() const;
92 
99  void checkValid();
100 
101 private:
102 
104 
105  std::vector<noding::SegmentString*>& segStrings;
106 
107  std::unique_ptr<NodingIntersectionFinder> segInt;
108 
109  bool isValidVar;
110 
111  void
112  execute()
113  {
114  if(segInt.get() != nullptr) {
115  return;
116  }
117  checkInteriorIntersections();
118  }
119 
120  void checkInteriorIntersections();
121 
122  // Declare type as noncopyable
123  FastNodingValidator(const FastNodingValidator& other) = delete;
124  FastNodingValidator& operator=(const FastNodingValidator& rhs) = delete;
125 };
126 
127 } // namespace geos.noding
128 } // namespace geos
129 
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition: LineIntersector.h:53
Validates that a collection of SegmentStrings is correctly noded.
Definition: FastNodingValidator.h:59
void checkValid()
Checks for an intersection and throws a TopologyException if one is found.
std::string getErrorMessage() const
Returns an error message indicating the segments containing the intersection.
bool isValid()
Checks for an intersection and reports if one is found.
Definition: FastNodingValidator.h:79
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25