GEOS 3.15.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
29namespace geos {
30namespace noding {
31class SegmentString;
32}
33}
34
35namespace geos {
36namespace noding { // geos.noding
37
60
61public:
62
63 FastNodingValidator(const std::vector<std::unique_ptr<SegmentString>>& newSegStrings)
64 :
65 li(), // robust...
66 segInt(),
67 isValidVar(true)
68 {
69 segStrings.resize(newSegStrings.size());
70 for (std::size_t i = 0; i < newSegStrings.size(); ++i) {
71 segStrings[i] = newSegStrings[i].get();
72 }
73 }
74
81 bool
83 {
84 execute();
85 return isValidVar;
86 }
87
94 std::string getErrorMessage() const;
95
103
104private:
105
107
108 std::vector<SegmentString*> segStrings;
109
110 std::unique_ptr<NodingIntersectionFinder> segInt;
111
112 bool isValidVar;
113
114 void
115 execute()
116 {
117 if(segInt.get() != nullptr) {
118 return;
119 }
120 checkInteriorIntersections();
121 }
122
123 void checkInteriorIntersections();
124
125 // Declare type as noncopyable
126 FastNodingValidator(const FastNodingValidator& other) = delete;
127 FastNodingValidator& operator=(const FastNodingValidator& rhs) = delete;
128};
129
130} // namespace geos.noding
131} // namespace geos
132
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:82
Basic namespace for all GEOS functionalities.
Definition geos.h:38