GEOS  3.11.0rc0
OverlayResultValidator.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: operation/overlay/validate/OverlayResultValidator.java rev. 1.4 (JTS-1.10)
16  *
17  **********************************************************************/
18 
19 #pragma once
20 
21 #include <geos/export.h>
22 #include <geos/operation/overlay/OverlayOp.h> // for OpCode enum
23 #include <geos/operation/overlay/validate/FuzzyPointLocator.h> // composition
24 #include <geos/geom/Location.h> // for Location::Value type
25 
26 #include <vector>
27 
28 #ifdef _MSC_VER
29 #pragma warning(push)
30 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
31 #endif
32 
33 // Forward declarations
34 namespace geos {
35 namespace geom {
36 class Geometry;
37 class Coordinate;
38 }
39 }
40 
41 namespace geos {
42 namespace operation { // geos::operation
43 namespace overlay { // geos::operation::overlay
44 namespace validate { // geos::operation::overlay::validate
45 
63 class GEOS_DLL OverlayResultValidator {
64 
65 public:
66 
67  static bool isValid(
68  const geom::Geometry& geom0,
69  const geom::Geometry& geom1,
70  OverlayOp::OpCode opCode,
71  const geom::Geometry& result);
72 
74  const geom::Geometry& geom0,
75  const geom::Geometry& geom1,
76  const geom::Geometry& result);
77 
78  bool isValid(OverlayOp::OpCode opCode);
79 
81  getInvalidLocation()
82  {
83  return invalidLocation;
84  }
85 
86 private:
87 
88  double boundaryDistanceTolerance;
89 
90  const geom::Geometry& g0;
91 
92  const geom::Geometry& g1;
93 
94  const geom::Geometry& gres;
95 
96  FuzzyPointLocator fpl0;
97 
98  FuzzyPointLocator fpl1;
99 
100  FuzzyPointLocator fplres;
101 
102  geom::Coordinate invalidLocation;
103 
104  std::vector<geom::Coordinate> testCoords;
105 
106  void addTestPts(const geom::Geometry& g);
107 
108  void addVertices(const geom::Geometry& g);
109 
110  bool testValid(OverlayOp::OpCode overlayOp);
111 
112  bool testValid(OverlayOp::OpCode overlayOp, const geom::Coordinate& pt);
113 
114  bool isValidResult(OverlayOp::OpCode overlayOp,
115  std::vector<geom::Location>& location);
116 
117  static double computeBoundaryDistanceTolerance(
118  const geom::Geometry& g0, const geom::Geometry& g1);
119 
120  // Declare type as noncopyable
121  OverlayResultValidator(const OverlayResultValidator& other) = delete;
122  OverlayResultValidator& operator=(const OverlayResultValidator& rhs) = delete;
123 };
124 
125 } // namespace geos::operation::overlay::validate
126 } // namespace geos::operation::overlay
127 } // namespace geos::operation
128 } // namespace geos
129 
130 #ifdef _MSC_VER
131 #pragma warning(pop)
132 #endif
133 
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:58
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:186
OpCode
The spatial functions supported by this class.
Definition: OverlayOp.h:78
Finds the most likely Location of a point relative to the polygonal components of a geometry,...
Definition: FuzzyPointLocator.h:57
Validates that the result of an overlay operation is geometrically correct within a determined tolera...
Definition: OverlayResultValidator.h:63
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25