Class SimplePointInAreaLocator
Computes the location of points
relative to an areal Geometry,
using a simple O(n) algorithm.
The algorithm used reports if a point lies in the interior, exterior, or exactly on the boundary of the Geometry.
Instance methods are provided to implement the interface IPointOnGeometryLocator. However, they provide no performance advantage over the class methods.
This algorithm is suitable for use in cases where only a few points will be tested. If many points will be tested, IndexedPointInAreaLocator may provide better performance.
Implements
Inherited Members
Namespace: NetTopologySuite.Algorithm.Locate
Assembly: NetTopologySuite.dll
Syntax
public class SimplePointInAreaLocator : IPointOnGeometryLocator
Remarks
The algorithm used is only guaranteed to return correct results for points which are not on the boundary of the Geometry.
Constructors
| Edit this page View SourceSimplePointInAreaLocator(Geometry)
Initializes a new instance of the SimplePointInAreaLocator class, using the provided areal geometry.
Declaration
public SimplePointInAreaLocator(Geometry geom)
Parameters
| Type | Name | Description |
|---|---|---|
| Geometry | geom | The areal geometry to locate in. |
Methods
| Edit this page View SourceContainsPointInPolygon(Coordinate, Polygon)
Determines whether a point lies in a Polygon. If the point lies on the polygon boundary it is considered to be inside.
Declaration
public static bool ContainsPointInPolygon(Coordinate p, Polygon poly)
Parameters
| Type | Name | Description |
|---|---|---|
| Coordinate | p | The point to test |
| Polygon | poly | The areal geometry to test |
Returns
| Type | Description |
|---|---|
| bool |
|
IsContained(Coordinate, Geometry)
Determines whether a point is contained in a Geometry, or lies on its boundary. This is a convenience method for
Location.Exterior != Locate(p, geom)
Declaration
public static bool IsContained(Coordinate p, Geometry geom)
Parameters
| Type | Name | Description |
|---|---|---|
| Coordinate | p | The point to test. |
| Geometry | geom | The geometry to test. |
Returns
| Type | Description |
|---|---|
| bool | true if the point lies in or on the geometry. |
Locate(Coordinate)
Declaration
public Location Locate(Coordinate p)
Parameters
| Type | Name | Description |
|---|---|---|
| Coordinate | p | The point to test |
Returns
| Type | Description |
|---|---|
| Location | The Location of the point in the geometry. |
Locate(Coordinate, Geometry)
Declaration
public static Location Locate(Coordinate p, Geometry geom)
Parameters
| Type | Name | Description |
|---|---|---|
| Coordinate | p | The point to test |
| Geometry | geom | The areal geometry to test |
Returns
| Type | Description |
|---|---|
| Location | The Location of the point in the geometry |