PointLocator.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2005-2011 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************
*
* Last port: algorithm/PointLocator.java 95fbe34b (JTS-1.15.2-SNAPSHOT)
*
**********************************************************************/
#pragma once
#include <geos/export.h>
#include <geos/geom/Location.h> // for inlines
// Forward declarations
namespace geos {
namespace geom {
class CoordinateXY;
class Geometry;
class LinearRing;
class LineString;
class Polygon;
class Point;
}
}
namespace geos {
namespace algorithm { // geos::algorithm
class GEOS_DLL PointLocator {
public:
PointLocator() {}
~PointLocator() {}
geom::Location locate(const geom::CoordinateXY& p, const geom::Geometry* geom);
bool
intersects(const geom::CoordinateXY& p, const geom::Geometry* geom)
{
return locate(p, geom) != geom::Location::EXTERIOR;
}
private:
bool isIn; // true if the point lies in or on any Geometry element
int numBoundaries; // the number of sub-elements whose boundaries the point lies in
void computeLocation(const geom::CoordinateXY& p, const geom::Geometry* geom);
void updateLocationInfo(geom::Location loc);
geom::Location locate(const geom::CoordinateXY& p, const geom::Point* pt);
geom::Location locate(const geom::CoordinateXY& p, const geom::LineString* l);
geom::Location locateInPolygonRing(const geom::CoordinateXY& p, const geom::LinearRing* ring);
geom::Location locate(const geom::CoordinateXY& p, const geom::Polygon* poly);
};
} // namespace geos::algorithm
} // namespace geos
geos::algorithm::PointLocator::intersects
bool intersects(const geom::CoordinateXY &p, const geom::Geometry *geom)
Definition PointLocator.h:80
geos::algorithm::PointLocator::locate
geom::Location locate(const geom::CoordinateXY &p, const geom::Geometry *geom)
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:196
geos::geom::LineString
Definition LineString.h:66
geos::geom::LinearRing
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple.
Definition LinearRing.h:54
geos::geom::Point
Definition Point.h:61
geos::geom::Polygon
Represents a linear polygon, which may include holes.
Definition Polygon.h:61
geos::algorithm::locate
Classes which determine the Location of points in geometries.
Definition IndexedPointInAreaLocator.h:40
geos::algorithm
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:32
geos::geom
Definition Angle.h:26
geos::geom::Location
Location
Constants representing the location of a point relative to a geometry.
Definition Location.h:32
geos::geom::Location::EXTERIOR
@ EXTERIOR
Definition Location.h:57
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38