PointLocator.h

00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2005-2011 Refractions Research Inc.
00007  * Copyright (C) 2001-2002 Vivid Solutions 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: algorithm/PointLocator.java r320 (JTS-1.12)
00017  *
00018  **********************************************************************/
00019 
00020 #ifndef GEOS_ALGORITHM_POINTLOCATOR_H
00021 #define GEOS_ALGORITHM_POINTLOCATOR_H
00022 
00023 #include <geos/export.h>
00024 #include <geos/geom/Location.h> // for inlines
00025 
00026 // Forward declarations
00027 namespace geos {
00028         namespace geom {
00029                 class Coordinate;
00030                 class Geometry;
00031                 class LinearRing;
00032                 class LineString;
00033                 class Polygon;
00034         }
00035 }
00036 
00037 namespace geos {
00038 namespace algorithm { // geos::algorithm
00039 
00057 class GEOS_DLL PointLocator {
00058 public:
00059         PointLocator() {}
00060         ~PointLocator() {}
00061 
00072         int locate(const geom::Coordinate& p, const geom::Geometry *geom);
00073 
00082         bool intersects(const geom::Coordinate& p, const geom::Geometry *geom) {
00083                 return locate(p, geom) != geom::Location::EXTERIOR;
00084         }
00085 
00086 private:
00087 
00088         bool isIn;         // true if the point lies in or on any Geometry element
00089 
00090         int numBoundaries;    // the number of sub-elements whose boundaries the point lies in
00091 
00092         void computeLocation(const geom::Coordinate& p, const geom::Geometry *geom);
00093 
00094         void updateLocationInfo(int loc);
00095 
00096         int locate(const geom::Coordinate& p, const geom::LineString *l);
00097 
00098         int locateInPolygonRing(const geom::Coordinate& p, const geom::LinearRing *ring);
00099 
00100         int locate(const geom::Coordinate& p, const geom::Polygon *poly);
00101 
00102 };
00103 
00104 } // namespace geos::algorithm
00105 } // namespace geos
00106 
00107 
00108 #endif // GEOS_ALGORITHM_POINTLOCATOR_H
00109 

Generated on 23 Sep 2013 for GEOS by  doxygen 1.4.7