GEOS 3.4.2

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

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
74 OverlayResultValidator(
75 const geom::Geometry& geom0,
76 const geom::Geometry& geom1,
77 const geom::Geometry& result);
78
79 bool isValid(OverlayOp::OpCode opCode);
80
81 geom::Coordinate& getInvalidLocation() {
82 return invalidLocation;
83 }
84
85 private:
86
87 double boundaryDistanceTolerance;
88
89 const geom::Geometry& g0;
90
91 const geom::Geometry& g1;
92
93 const geom::Geometry& gres;
94
95 FuzzyPointLocator fpl0;
96
97 FuzzyPointLocator fpl1;
98
99 FuzzyPointLocator fplres;
100
101 geom::Coordinate invalidLocation;
102
103 std::vector<geom::Coordinate> testCoords;
104
105 void addTestPts(const geom::Geometry& g);
106
107 void addVertices(const geom::Geometry& g);
108
109 bool testValid(OverlayOp::OpCode overlayOp);
110
111 bool testValid(OverlayOp::OpCode overlayOp, const geom::Coordinate& pt);
112
113 bool isValidResult(OverlayOp::OpCode overlayOp,
114 std::vector<geom::Location::Value>& location);
115
116 static double computeBoundaryDistanceTolerance(
117 const geom::Geometry& g0, const geom::Geometry& g1);
118
119 // Declare type as noncopyable
120 OverlayResultValidator(const OverlayResultValidator& other);
121 OverlayResultValidator& operator=(const OverlayResultValidator& rhs);
122 };
123
124 } // namespace geos::operation::overlay::validate
125 } // namespace geos::operation::overlay
126 } // namespace geos::operation
127 } // namespace geos
128
129 #ifdef _MSC_VER
130 #pragma warning(pop)
131 #endif
132
133 #endif // ndef GEOS_OP_OVERLAY_OVERLAYRESULTVALIDATOR_H