GEOS 3.3.4

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

- File List

OverlayResultValidator.h
1 /**********************************************************************
2 * $Id: OverlayResultValidator.h 3255 2011-03-01 17:56:10Z mloskot $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2006 Refractions Research Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 ***********************************************************************
15 *
16 * Last port: operation/overlay/validate/OverlayResultValidator.java rev. 1.4 (JTS-1.10)
17 *
18 **********************************************************************/
19
20 #ifndef GEOS_OP_OVERLAY_OVERLAYRESULTVALIDATOR_H
21 #define GEOS_OP_OVERLAY_OVERLAYRESULTVALIDATOR_H
22
23 #include <geos/export.h>
24 #include <geos/operation/overlay/OverlayOp.h> // for OpCode enum
25 #include <geos/operation/overlay/validate/FuzzyPointLocator.h> // composition
26 #include <geos/geom/Location.h> // for Location::Value type
27
28 #include <vector>
29
30 #ifdef _MSC_VER
31 #pragma warning(push)
32 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
33 #endif
34
35 // Forward declarations
36 namespace geos {
37 namespace geom {
38 class Geometry;
39 class Coordinate;
40 }
41 }
42
43 namespace geos {
44 namespace operation { // geos::operation
45 namespace overlay { // geos::operation::overlay
46 namespace validate { // geos::operation::overlay::validate
47
65 class GEOS_DLL OverlayResultValidator {
66
67 public:
68
69 static bool isValid(
70 const geom::Geometry& geom0,
71 const geom::Geometry& geom1,
72 OverlayOp::OpCode opCode,
73 const geom::Geometry& result);
74
75 OverlayResultValidator(
76 const geom::Geometry& geom0,
77 const geom::Geometry& geom1,
78 const geom::Geometry& result);
79
80 bool isValid(OverlayOp::OpCode opCode);
81
82 geom::Coordinate& getInvalidLocation() {
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::Value>& 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);
122 OverlayResultValidator& operator=(const OverlayResultValidator& rhs);
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
134 #endif // ndef GEOS_OP_OVERLAY_OVERLAYRESULTVALIDATOR_H
135
136 /**********************************************************************
137 * $Log$
138 **********************************************************************/
139