Interface IShape
The base interface defining a geometric shape. Shape instances should be
instantiated via one of the create* methods on a SpatialContext or
by reading WKT which calls those methods; they should not
be
created directly.
Shapes are generally immutable and thread-safe. If a particular shape has a
Reset(...)
method then its use means the shape is actually
mutable. Mutating shape state is considered expert and should be done with care.
Assembly: Spatial4n.dll
Syntax
public interface IShape
Properties
Name | Description |
---|---|
BoundingBox | Get the bounding box for this IShape. This means the shape is within the bounding box and that it touches each side of the rectangle.
Postcondition: |
Center | Returns the center point of this shape. This is usually the same as
Postcondition: |
HasArea | Does the shape have area? This will be false for points and lines. It will also be false for shapes that normally have area but are constructed in a degenerate case as to not have area (e.g. a circle with 0 radius or rectangle with no height or no width). |
IsEmpty | Shapes can be "empty", which is to say it exists nowhere. The underlying coordinates are typically NaN. |
Methods
Name | Description |
---|---|
Equals(Object) | The sub-classes of IShape generally implement the same contract for System.Object.Equals(System.Object) and System.Object.GetHashCode() amongst the same sub-interface type. This means, for example, that multiple Point implementations of different classes are equal if they share the same x & y. |
GetArea(SpatialContext) | Calculates the area of the shape, in square-degrees. If ctx is null then simple Euclidean calculations will be used. This figure can be an estimate. |
GetBuffered(Double, SpatialContext) | Returns a buffered version of this shape. The buffer is usually a rounded-corner buffer, although some shapes might buffer differently. This is an optional operation. |
Relate(IShape) | Describe the relationship between the two objects. For example If the shapes are equal then the result is CONTAINS (preferred) or WITHIN. |