GEOS  3.9.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 #ifndef GEOS_NODING_FASTNODINGVALIDATOR_H
20 #define GEOS_NODING_FASTNODINGVALIDATOR_H
21 
22 #include <geos/noding/NodingIntersectionFinder.h> // for composition
23 #include <geos/algorithm/LineIntersector.h> // for composition
24 
25 #include <memory>
26 #include <string>
27 #include <cassert>
28 
29 // Forward declarations
30 namespace geos {
31 namespace noding {
32 class SegmentString;
33 }
34 }
35 
36 namespace geos {
37 namespace noding { // geos.noding
38 
61 
62 public:
63 
64  FastNodingValidator(std::vector<noding::SegmentString*>& newSegStrings)
65  :
66  li(), // robust...
67  segStrings(newSegStrings),
68  segInt(),
69  isValidVar(true)
70  {
71  }
72 
79  bool
81  {
82  execute();
83  return isValidVar;
84  }
85 
92  std::string getErrorMessage() const;
93 
100  void checkValid();
101 
102 private:
103 
105 
106  std::vector<noding::SegmentString*>& segStrings;
107 
108  std::unique_ptr<NodingIntersectionFinder> segInt;
109 
110  bool isValidVar;
111 
112  void
113  execute()
114  {
115  if(segInt.get() != nullptr) {
116  return;
117  }
118  checkInteriorIntersections();
119  }
120 
121  void checkInteriorIntersections();
122 
123  // Declare type as noncopyable
124  FastNodingValidator(const FastNodingValidator& other) = delete;
125  FastNodingValidator& operator=(const FastNodingValidator& rhs) = delete;
126 };
127 
128 } // namespace geos.noding
129 } // namespace geos
130 
131 #endif // GEOS_NODING_FASTNODINGVALIDATOR_H
std::string getErrorMessage() const
Returns an error message indicating the segments containing the intersection.
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
Validates that a collection of SegmentStrings is correctly noded.
Definition: FastNodingValidator.h:60
bool isValid()
Checks for an intersection and reports if one is found.
Definition: FastNodingValidator.h:80
void checkValid()
Checks for an intersection and throws a TopologyException if one is found.