Search Results for

    Show / Hide Table of Contents

    Class GeoPolygon

    A polygon describes a shape comprised of 3 or more line segments for a geospatial GeoWithin(IEmbeddedObject?, GeoShapeBase) query.

    Inheritance
    object
    GeoShapeBase
    GeoPolygon
    Namespace: Realms
    Assembly: Realm.dll
    Syntax
    public class GeoPolygon : GeoShapeBase
    Remarks

    A polygon comprises of one outer ring and 0 or more rings representing holes with the following restrictions:

    • Each ring must consist of at least 3 distinct points (vertices). The first and the last point must be the same to indicate a closed ring (meaning you need at least 4 points to define the polygon).
    • Rings may not cross, i.e. the boundary of a ring may not intersect both the interior and exterior of any other ring.
    • Rings may not share edges, i.e. if a ring contains an edge AB, then no other ring may contain AB or BA.
    • Rings may share vertices, however no vertex may appear twice in a single ring.
    • No ring may be empty.

    Holes may be nested inside each other, in which case a location will be considered "inside" the polygon if it is included in an odd number of rings. For example, a polygon representing a square with side 10 centered at (0,0) with holes representing squares with sides 5 and 2, centered at (0,0) will include the location (1, 1) because it is contained in 3 rings, but not (3, 3), because it is contained in 2.

    Constructors

    | Edit this page View Source

    GeoPolygon(params GeoPoint[])

    Initializes a new instance of the GeoPolygon class from a collection of GeoPoints with no holes.

    Declaration
    public GeoPolygon(params GeoPoint[] outerRing)
    Parameters
    Type Name Description
    GeoPoint[] outerRing

    The points representing the outer ring of the polygon.

    Remarks

    outerRing must contain at least 3 unique points. The first and the last point may be identical, but no other duplicates are allowed. Each subsequent pair of points represents an edge in the polygon with the first and the last points being implicitly connected.

    | Edit this page View Source

    GeoPolygon(IEnumerable<GeoPoint>, params IEnumerable<GeoPoint>[])

    Initializes a new instance of the GeoPolygon class with an outer ring and a collection of holes.

    Declaration
    public GeoPolygon(IEnumerable<GeoPoint> outerRing, params IEnumerable<GeoPoint>[] holes)
    Parameters
    Type Name Description
    IEnumerable<GeoPoint> outerRing

    A collection of GeoPoints representing the outer ring of the polygon.

    IEnumerable<GeoPoint>[] holes

    A collection of collections of GeoPoints representing the inner rings of the polygon.

    Remarks

    outerRing must contain at least 3 unique points. The first and the last point may be identical, but no other duplicates are allowed. Each subsequent pair of points represents an edge in the polygon with the first and the last points being implicitly connected.
    Each collection in holes must contain at least 3 unique points with the same rules as for outerRing.
    No two rings may intersect or share an edge, though they may share vertices.
    A point is considered "inside" the polygon if it is contained by an odd number of rings and "outside" if it's contained by an even number of rings.

    Properties

    | Edit this page View Source

    Holes

    Gets the holes in the polygon.

    Declaration
    public IReadOnlyList<IReadOnlyList<GeoPoint>> Holes { get; }
    Property Value
    Type Description
    IReadOnlyList<IReadOnlyList<GeoPoint>>

    The holes (if any) in the polygon.

    | Edit this page View Source

    OuterRing

    Gets the outer ring of the polygon.

    Declaration
    public IReadOnlyList<GeoPoint> OuterRing { get; }
    Property Value
    Type Description
    IReadOnlyList<GeoPoint>

    The polygon's outer ring.

    Methods

    | Edit this page View Source

    ToString()

    Returns a string representation of the value.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string representation of the value.

    Overrides
    object.ToString()
    • Edit this page
    • View Source
    In this article
    Back to top Copyright © 2020-2024 Realm
    Generated by DocFX