C# Class Spatial4n.Core.Context.SpatialContext

This is a facade to most of Spatial4j, holding things like {@link DistanceUnits}, {@link DistanceCalculator}, and the coordinate world boundaries, and acting as a factory for the {@link Shape}s.

A SpatialContext has public constructors, but note the convenience instance {@link #GEO}. Also, if you wish to construct one based on configuration information then consider using {@link SpatialContextFactory}.

Thread-safe & immutable.

ファイルを表示 Open project: synhershko/Spatial4n Class Usage Examples

Public Properties

Property Type Description
GEO SpatialContext

Public Methods

Method Description
GetDistCalc ( ) : DistanceCalculator
GetWorldBounds ( ) : Rectangle

The extent of x & y coordinates should fit within the return'ed rectangle. Do *NOT* invoke reset() on this return type.

IsGeo ( ) : bool

Is this a geospatial context (true) or simply 2d spatial (false).

MakeCircle ( System.Point point, double distance ) : Circle

Construct a circle. The units of "distance" should be the same as x & y.

MakeCircle ( double x, double y, double distance ) : Circle

Construct a circle. The units of "distance" should be the same as x & y.

MakePoint ( double x, double y ) : System.Point

Construct a point.

MakeRectangle ( System.Point lowerLeft, System.Point upperRight ) : Rectangle

Construct a rectangle. The parameters will be normalized.

MakeRectangle ( double minX, double maxX, double minY, double maxY ) : Rectangle

Construct a rectangle. If just one longitude is on the dateline (+/- 180) then potentially adjust its sign to ensure the rectangle does not cross the dateline.

SpatialContext ( bool geo ) : System
SpatialContext ( bool geo, DistanceCalculator calculator, Rectangle worldBounds ) : System

ToString ( ) : String
VerifyX ( double x ) : void

Ensure fits in {@link #getWorldBounds()}

VerifyY ( double y ) : void

Ensure fits in {@link #getWorldBounds()}

Protected Methods

Method Description
MakeShapeReadWriter ( ) : ShapeReadWriter

Private Methods

Method Description
ReadShape ( String value ) : Shape
ToString ( Shape shape ) : String

Method Details

GetDistCalc() public method

public GetDistCalc ( ) : DistanceCalculator
return DistanceCalculator

GetWorldBounds() public method

The extent of x & y coordinates should fit within the return'ed rectangle. Do *NOT* invoke reset() on this return type.
public GetWorldBounds ( ) : Rectangle
return Rectangle

IsGeo() public method

Is this a geospatial context (true) or simply 2d spatial (false).
public IsGeo ( ) : bool
return bool

MakeCircle() public method

Construct a circle. The units of "distance" should be the same as x & y.
public MakeCircle ( System.Point point, double distance ) : Circle
point System.Point
distance double
return Circle

MakeCircle() public method

Construct a circle. The units of "distance" should be the same as x & y.
public MakeCircle ( double x, double y, double distance ) : Circle
x double
y double
distance double
return Circle

MakePoint() public method

Construct a point.
public MakePoint ( double x, double y ) : System.Point
x double
y double
return System.Point

MakeRectangle() public method

Construct a rectangle. The parameters will be normalized.
public MakeRectangle ( System.Point lowerLeft, System.Point upperRight ) : Rectangle
lowerLeft System.Point
upperRight System.Point
return Rectangle

MakeRectangle() public method

Construct a rectangle. If just one longitude is on the dateline (+/- 180) then potentially adjust its sign to ensure the rectangle does not cross the dateline.
public MakeRectangle ( double minX, double maxX, double minY, double maxY ) : Rectangle
minX double
maxX double
minY double
maxY double
return Rectangle

MakeShapeReadWriter() protected method

protected MakeShapeReadWriter ( ) : ShapeReadWriter
return Spatial4n.Core.Io.ShapeReadWriter

SpatialContext() public method

public SpatialContext ( bool geo ) : System
geo bool
return System

SpatialContext() public method

public SpatialContext ( bool geo, DistanceCalculator calculator, Rectangle worldBounds ) : System
geo bool Establishes geo vs cartesian / Euclidean.
calculator DistanceCalculator Optional; defaults to Haversine or cartesian depending on units.
worldBounds Rectangle Optional; defaults to GEO_WORLDBOUNDS or MAX_WORLDBOUNDS depending on units.
return System

ToString() public method

public ToString ( ) : String
return String

VerifyX() public method

Ensure fits in {@link #getWorldBounds()}
public VerifyX ( double x ) : void
x double
return void

VerifyY() public method

Ensure fits in {@link #getWorldBounds()}
public VerifyY ( double y ) : void
y double
return void

Property Details

GEO public_oe static_oe property

A popular default SpatialContext implementation for geospatial.
public static SpatialContext,Spatial4n.Core.Context GEO
return SpatialContext