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

# OverlayResultValidator.h

    00001 /**********************************************************************
    00002  * $Id: OverlayResultValidator.h 1941 2006-12-13 10:55:55Z strk $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2006 Refractions Research Inc.
    00008  *
    00009  * This is free software; you can redistribute and/or modify it under
    00010  * the terms of the GNU Lesser General Public Licence as published
    00011  * by the Free Software Foundation.
    00012  * See the COPYING file for more information.
    00013  *
    00014  ***********************************************************************
    00015  *
    00016  * Last port: operation/overlay/validate/OverlayResultValidator.java rev. 1.1
    00017  * (we should move in GEOS too, probably)
    00018  *
    00019  **********************************************************************/
    00020
    00021 #ifndef GEOS_OP_OVERLAY_OVERLAYRESULTVALIDATOR_H
    00022 #define GEOS_OP_OVERLAY_OVERLAYRESULTVALIDATOR_H
    00023
    00024 #include <geos/operation/overlay/OverlayOp.h> // for OpCode enum
    00025 #include <geos/operation/overlay/FuzzyPointLocator.h>
    00026 #include <geos/geom/Location.h> // for Location::Value type
    00027
    00028 #include <vector>
    00029
    00030 // Forward declarations
    00031 namespace geos {
    00032         namespace geom {
    00033                 class Geometry;
    00034                 class Coordinate;
    00035         }
    00036 }
    00037
    00038 namespace geos {
    00039 namespace operation { // geos::operation
    00040 namespace overlay { // geos::operation::overlay
    00041
    00055 class OverlayResultValidator {
    00056
    00057 public:
    00058
    00059         static bool isValid(
    00060                         const geom::Geometry& geom0,
    00061                         const geom::Geometry& geom1,
    00062                         OverlayOp::OpCode opCode,
    00063                         const geom::Geometry& result);
    00064
    00065         OverlayResultValidator(
    00066                         const geom::Geometry& geom0,
    00067                         const geom::Geometry& geom1,
    00068                         const geom::Geometry& result);
    00069
    00070         bool isValid(OverlayOp::OpCode opCode);
    00071
    00072         geom::Coordinate& getInvalidLocation() {
    00073                 return invalidLocation;
    00074         }
    00075
    00076 private:
    00077
    00078         const geom::Geometry& g0;
    00079
    00080         const geom::Geometry& g1;
    00081
    00082         const geom::Geometry& gres;
    00083
    00084         FuzzyPointLocator fpl0;
    00085
    00086         FuzzyPointLocator fpl1;
    00087
    00088         FuzzyPointLocator fplres;
    00089
    00090         geom::Coordinate invalidLocation;
    00091
    00092         static double _TOLERANCE; // 0.000001
    00093
    00094         std::vector<geom::Coordinate> testCoords;
    00095
    00096         void addTestPts(const geom::Geometry& g);
    00097
    00098         void addVertices(const geom::Geometry& g);
    00099
    00100         bool testValid(OverlayOp::OpCode overlayOp);
    00101
    00102         bool testValid(OverlayOp::OpCode overlayOp, const geom::Coordinate& pt);
    00103
    00104         bool isValidResult(OverlayOp::OpCode overlayOp,
    00105                         std::vector<geom::Location::Value>& location);
    00106 };
    00107
    00108 } // namespace geos::operation::overlay
    00109 } // namespace geos::operation
    00110 } // namespace geos
    00111
    00112 #endif // ndef GEOS_OP_OVERLAY_OVERLAYRESULTVALIDATOR_H
    00113
    00114 /**********************************************************************
    00115  * $Log$
    00116  **********************************************************************/
    00117