GEOS: PointLocator.h Source File

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

- File List

# PointLocator.h

    00001 /**********************************************************************
    00002  * $Id: PointLocator.h 3174 2011-02-02 19:24:03Z strk $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2005-2011 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  * Last port: algorithm/PointLocator.java r320 (JTS-1.12)
    00018  *
    00019  **********************************************************************/
    00020
    00021 #ifndef GEOS_ALGORITHM_POINTLOCATOR_H
    00022 #define GEOS_ALGORITHM_POINTLOCATOR_H
    00023
    00024 #include <geos/export.h>
    00025 #include <geos/geom/Location.h> // for inlines
    00026
    00027 // Forward declarations
    00028 namespace geos {
    00029         namespace geom {
    00030                 class Coordinate;
    00031                 class Geometry;
    00032                 class LinearRing;
    00033                 class LineString;
    00034                 class Polygon;
    00035         }
    00036 }
    00037
    00038 namespace geos {
    00039 namespace algorithm { // geos::algorithm
    00040
    00058 class GEOS_DLL PointLocator {
    00059 public:
    00060         PointLocator() {}
    00061         ~PointLocator() {}
    00062
    00073         int locate(const geom::Coordinate& p, const geom::Geometry *geom);
    00074
    00083         bool intersects(const geom::Coordinate& p, const geom::Geometry *geom) {
    00084                 return locate(p, geom) != geom::Location::EXTERIOR;
    00085         }
    00086
    00087 private:
    00088
    00089         bool isIn;         // true if the point lies in or on any Geometry element
    00090
    00091         int numBoundaries;    // the number of sub-elements whose boundaries the point lies in
    00092
    00093         void computeLocation(const geom::Coordinate& p, const geom::Geometry *geom);
    00094
    00095         void updateLocationInfo(int loc);
    00096
    00097         int locate(const geom::Coordinate& p, const geom::LineString *l);
    00098
    00099         int locateInPolygonRing(const geom::Coordinate& p, const geom::LinearRing *ring);
    00100
    00101         int locate(const geom::Coordinate& p, const geom::Polygon *poly);
    00102
    00103 };
    00104
    00105 } // namespace geos::algorithm
    00106 } // namespace geos
    00107
    00108
    00109 #endif // GEOS_ALGORITHM_POINTLOCATOR_H
    00110
    00111 /**********************************************************************
    00112  * $Log$
    00113  * Revision 1.1  2006/03/09 16:46:48  strk
    00114  * geos::geom namespace definition, first pass at headers split
    00115  *
    00116  **********************************************************************/
    00117