Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

PointLocator.h

00001 /**********************************************************************
00002  * $Id: PointLocator.h 2556 2009-06-06 22:22:28Z strk $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
00007  * Copyright (C) 2005-2006 Refractions Research Inc.
00008  * Copyright (C) 2001-2002 Vivid Solutions Inc.
00009  *
00010  * This is free software; you can redistribute and/or modify it under
00011  * the terms of the GNU Lesser General Public Licence as published
00012  * by the Free Software Foundation. 
00013  * See the COPYING file for more information.
00014  *
00015  **********************************************************************/
00016 
00017 #ifndef GEOS_ALGORITHM_POINTLOCATOR_H
00018 #define GEOS_ALGORITHM_POINTLOCATOR_H
00019 
00020 #include <geos/export.h>
00021 #include <geos/geom/Location.h> // for inlines
00022 
00023 // Forward declarations
00024 namespace geos {
00025         namespace geom {
00026                 class Coordinate;
00027                 class Geometry;
00028                 class LinearRing;
00029                 class LineString;
00030                 class Polygon;
00031         }
00032 }
00033 
00034 namespace geos {
00035 namespace algorithm { // geos::algorithm
00036 
00054 class GEOS_DLL PointLocator {
00055 public:
00056         PointLocator() {}
00057         ~PointLocator() {}
00058 
00069         int locate(const geom::Coordinate& p, const geom::Geometry *geom);
00070 
00079         bool intersects(const geom::Coordinate& p, const geom::Geometry *geom) {
00080                 return locate(p, geom) != geom::Location::EXTERIOR;
00081         }
00082 
00083 private:
00084 
00085         bool isIn;         // true if the point lies in or on any Geometry element
00086 
00087         int numBoundaries;    // the number of sub-elements whose boundaries the point lies in
00088 
00089         void computeLocation(const geom::Coordinate& p, const geom::Geometry *geom);
00090 
00091         void updateLocationInfo(int loc);
00092 
00093         int locate(const geom::Coordinate& p, const geom::LineString *l);
00094 
00095         int locateInPolygonRing(const geom::Coordinate& p, const geom::LinearRing *ring);
00096 
00097         int locate(const geom::Coordinate& p, const geom::Polygon *poly);
00098 
00099 };
00100 
00101 } // namespace geos::algorithm
00102 } // namespace geos
00103 
00104 
00105 #endif // GEOS_ALGORITHM_POINTLOCATOR_H
00106 
00107 /**********************************************************************
00108  * $Log$
00109  * Revision 1.1  2006/03/09 16:46:48  strk
00110  * geos::geom namespace definition, first pass at headers split
00111  *
00112  **********************************************************************/
00113 

Generated on Thu Jun 11 06:17:01 2009 for GEOS by  doxygen 1.4.4