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

# PointLocator.h

    00001 /**********************************************************************
    00002  * $Id: PointLocator.h 1820 2006-09-06 16:54:23Z mloskot $
    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/geom/Location.h> // for inlines
    00021
    00022 // Forward declarations
    00023 namespace geos {
    00024         namespace geom {
    00025                 class Coordinate;
    00026                 class Geometry;
    00027                 class LinearRing;
    00028                 class LineString;
    00029                 class Polygon;
    00030         }
    00031 }
    00032
    00033 namespace geos {
    00034 namespace algorithm { // geos::algorithm
    00035
    00053 class PointLocator {
    00054 public:
    00055         PointLocator() {}
    00056         ~PointLocator() {}
    00057
    00068         int locate(const geom::Coordinate& p, const geom::Geometry *geom);
    00069
    00078         bool intersects(const geom::Coordinate& p, const geom::Geometry *geom) {
    00079                 return locate(p, geom) != geom::Location::EXTERIOR;
    00080         }
    00081
    00082 private:
    00083
    00084         bool isIn;         // true if the point lies in or on any Geometry element
    00085
    00086         int numBoundaries;    // the number of sub-elements whose boundaries the point lies in
    00087
    00088         void computeLocation(const geom::Coordinate& p, const geom::Geometry *geom);
    00089
    00090         void updateLocationInfo(int loc);
    00091
    00092         int locate(const geom::Coordinate& p, const geom::LineString *l);
    00093
    00094         int locateInPolygonRing(const geom::Coordinate& p, const geom::LinearRing *ring);
    00095
    00096         int locate(const geom::Coordinate& p, const geom::Polygon *poly);
    00097
    00098 };
    00099
    00100 } // namespace geos::algorithm
    00101 } // namespace geos
    00102
    00103
    00104 #endif // GEOS_ALGORITHM_POINTLOCATOR_H
    00105
    00106 /**********************************************************************
    00107  * $Log$
    00108  * Revision 1.1  2006/03/09 16:46:48  strk
    00109  * geos::geom namespace definition, first pass at headers split
    00110  *
    00111  **********************************************************************/
    00112