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