Search Results for

    Show / Hide Table of Contents

    Class Polygon

    Represents a polygon with linear edges, which may include holes. The outer boundary (shell) and inner boundaries (holes) of the polygon are represented by {@link LinearRing}s. The boundary rings of the polygon may have any orientation. Polygons are closed, simple geometries by definition.

    The polygon model conforms to the assertions specified in the OpenGIS Simple Features Specification for SQL.

    A Polygon is topologically valid if and only if:
    • the coordinates which define it are valid coordinates
    • the linear rings for the shell and holes are valid (i.e. are closed and do not self-intersect)
    • holes touch the shell or another hole at at most one point (which implies that the rings of the shell and holes must not cross)
    • the interior of the polygon is connected, or equivalently no sequence of touching holes makes the interior of the polygon disconnected (i.e. effectively split the polygon into two pieces).
    Inheritance
    object
    Geometry
    Polygon
    Implements
    IComparable
    IComparable<Geometry>
    IPolygonal
    Inherited Members
    Geometry.TypeNamePoint
    Geometry.TypeNameMultiPoint
    Geometry.TypeNameLineString
    Geometry.TypeNameLinearRing
    Geometry.TypeNameMultiLineString
    Geometry.TypeNamePolygon
    Geometry.TypeNameMultiPolygon
    Geometry.TypeNameGeometryCollection
    Geometry.Factory
    Geometry.UserData
    Geometry.SRID
    Geometry.HasNonEmptyElements(Geometry[])
    Geometry.HasNullElements(object[])
    Geometry.HasNullElements<T>(IEnumerable<T>)
    Geometry.PrecisionModel
    Geometry.NumGeometries
    Geometry.GetGeometryN(int)
    Geometry.IsSimple
    Geometry.IsValid
    Geometry.Distance(Geometry)
    Geometry.IsWithinDistance(Geometry, double)
    Geometry.Centroid
    Geometry.InteriorPoint
    Geometry.PointOnSurface
    Geometry.HasDimension(Dimension)
    Geometry.Envelope
    Geometry.EnvelopeInternal
    Geometry.GeometryChanged()
    Geometry.GeometryChangedAction()
    Geometry.Disjoint(Geometry)
    Geometry.Touches(Geometry)
    Geometry.Intersects(Geometry)
    Geometry.Crosses(Geometry)
    Geometry.Within(Geometry)
    Geometry.Contains(Geometry)
    Geometry.Overlaps(Geometry)
    Geometry.Covers(Geometry)
    Geometry.CoveredBy(Geometry)
    Geometry.Relate(Geometry, string)
    Geometry.Relate(Geometry)
    Geometry.Equals(Geometry)
    Geometry.EqualsTopologically(Geometry)
    Geometry.Equals(object)
    Geometry.GetHashCode()
    Geometry.ToString()
    Geometry.ToText()
    Geometry.AsText()
    Geometry.ToBinary()
    Geometry.AsBinary()
    Geometry.ToGMLFeature()
    Geometry.Buffer(double)
    Geometry.Buffer(double, EndCapStyle)
    Geometry.Buffer(double, int)
    Geometry.Buffer(double, int, EndCapStyle)
    Geometry.Buffer(double, BufferParameters)
    Geometry.Intersection(Geometry)
    Geometry.Union(Geometry)
    Geometry.Difference(Geometry)
    Geometry.SymmetricDifference(Geometry)
    Geometry.Union()
    Geometry.EqualsExact(Geometry)
    Geometry.EqualsNormalized(Geometry)
    Geometry.Copy()
    Geometry.Normalized()
    Geometry.CompareTo(object)
    Geometry.CompareTo(Geometry)
    Geometry.CompareTo(object, IComparer<CoordinateSequence>)
    Geometry.IsEquivalentClass(Geometry)
    Geometry.CheckNotGeometryCollection(Geometry)
    Geometry.IsGeometryCollection
    Geometry.Compare(List<Geometry>, List<Geometry>)
    Geometry.Equal(Coordinate, Coordinate, double)
    Geometry.DefaultFactory
    Geometry.CreateArray(int, double)
    Geometry.CreateArray(CoordinateSequence, Ordinate)
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: NetTopologySuite.Geometries
    Assembly: NetTopologySuite.dll
    Syntax
    [Serializable]
    public class Polygon : Geometry, IComparable, IComparable<Geometry>, IPolygonal

    Constructors

    | Edit this page View Source

    Polygon(LinearRing)

    Constructs a Polygon with the given exterior boundary.

    Declaration
    public Polygon(LinearRing shell)
    Parameters
    Type Name Description
    LinearRing shell

    The outer boundary of the new Polygon, or null or an empty LinearRing if the empty polygon is to be created.

    | Edit this page View Source

    Polygon(LinearRing, GeometryFactory)

    Constructs a Polygon with the given exterior boundary.

    Declaration
    public Polygon(LinearRing shell, GeometryFactory factory)
    Parameters
    Type Name Description
    LinearRing shell

    The outer boundary of the new Polygon, or null or an empty LinearRing if the empty polygon is to be created.

    GeometryFactory factory
    | Edit this page View Source

    Polygon(LinearRing, LinearRing[])

    Initializes a new instance of the Polygon class.

    Declaration
    public Polygon(LinearRing shell, LinearRing[] holes)
    Parameters
    Type Name Description
    LinearRing shell

    The outer boundary of the new Polygon, or null or an empty LinearRing if the empty point is to be created.

    LinearRing[] holes

    The inner boundaries of the new Polygon , or null or empty LinearRings if the empty point is to be created.

    Remarks

    For create this Geometry is used a standard GeometryFactory with PrecisionModel == Floating.

    | Edit this page View Source

    Polygon(LinearRing, LinearRing[], GeometryFactory)

    Constructs a Polygon with the given exterior boundary and interior boundaries.

    Declaration
    public Polygon(LinearRing shell, LinearRing[] holes, GeometryFactory factory)
    Parameters
    Type Name Description
    LinearRing shell

    The outer boundary of the new Polygon, or null or an empty LinearRing if the empty point is to be created.

    LinearRing[] holes

    The inner boundaries of the new Polygon , or null or empty LinearRings if the empty point is to be created.

    GeometryFactory factory

    Fields

    | Edit this page View Source

    Empty

    Represents an empty Polygon.

    Declaration
    public static readonly Polygon Empty
    Field Value
    Type Description
    Polygon

    Properties

    | Edit this page View Source

    Area

    Returns the area of this Polygon

    Declaration
    public override double Area { get; }
    Property Value
    Type Description
    double
    Overrides
    Geometry.Area
    | Edit this page View Source

    Boundary

    Declaration
    public override Geometry Boundary { get; }
    Property Value
    Type Description
    Geometry
    Overrides
    Geometry.Boundary
    | Edit this page View Source

    BoundaryDimension

    Returns the dimension of this Geometrys inherent boundary.

    Declaration
    public override Dimension BoundaryDimension { get; }
    Property Value
    Type Description
    Dimension

    The dimension of the boundary of the class implementing this interface, whether or not this object is the empty point. Returns Dimension.False if the boundary is the empty point.

    Overrides
    Geometry.BoundaryDimension
    | Edit this page View Source

    Coordinate

    Returns a vertex of this Geometry (usually, but not necessarily, the first one).

    Declaration
    public override Coordinate Coordinate { get; }
    Property Value
    Type Description
    Coordinate

    a Coordinate which is a vertex of this Geometry.

    Overrides
    Geometry.Coordinate
    Remarks

    The returned coordinate should not be assumed to be an actual Coordinate object used in the internal representation.

    | Edit this page View Source

    Coordinates

    Returns an array containing the values of all the vertices for this geometry.

    Declaration
    public override Coordinate[] Coordinates { get; }
    Property Value
    Type Description
    Coordinate[]

    The vertices of this Geometry.

    Overrides
    Geometry.Coordinates
    Remarks

    If the geometry is a composite, the array will contain all the vertices for the components, in the order in which the components occur in the geometry.

    In general, the array cannot be assumed to be the actual internal storage for the vertices. Thus modifying the array may not modify the geometry itself. Use the SetOrdinate(int, int, double) method (possibly on the components) to modify the underlying data. If the coordinates are modified, GeometryChanged() must be called afterwards.

    See Also
    GeometryChanged()
    SetOrdinate(int, int, double)
    SetOrdinate(int, Ordinate, double)
    | Edit this page View Source

    Dimension

    Returns the dimension of this geometry.

    Declaration
    public override Dimension Dimension { get; }
    Property Value
    Type Description
    Dimension

    The topological dimensions of this geometry

    Overrides
    Geometry.Dimension
    Remarks

    The dimension of a geometry is is the topological dimension of its embedding in the 2-D Euclidean plane. In the NTS spatial model, dimension values are in the set {0,1,2}.

    Note that this is a different concept to the dimension of the vertex Coordinates. The geometry dimension can never be greater than the coordinate dimension. For example, a 0-dimensional geometry (e.g. a Point) may have a coordinate dimension of 3 (X,Y,Z).

    | Edit this page View Source

    ExteriorRing

    Declaration
    public LineString ExteriorRing { get; }
    Property Value
    Type Description
    LineString
    | Edit this page View Source

    GeometryType

    Returns the name of this object's interface.

    Declaration
    public override string GeometryType { get; }
    Property Value
    Type Description
    string

    "Polygon"

    Overrides
    Geometry.GeometryType
    | Edit this page View Source

    Holes

    Declaration
    public LinearRing[] Holes { get; }
    Property Value
    Type Description
    LinearRing[]
    | Edit this page View Source

    InteriorRings

    Declaration
    public LineString[] InteriorRings { get; }
    Property Value
    Type Description
    LineString[]
    | Edit this page View Source

    IsEmpty

    Declaration
    public override bool IsEmpty { get; }
    Property Value
    Type Description
    bool
    Overrides
    Geometry.IsEmpty
    | Edit this page View Source

    IsRectangle

    Tests whether this is a rectangular Polygon.

    Declaration
    public override bool IsRectangle { get; }
    Property Value
    Type Description
    bool

    true if the geometry is a rectangle.

    Overrides
    Geometry.IsRectangle
    | Edit this page View Source

    Length

    Returns the perimeter of this Polygon.

    Declaration
    public override double Length { get; }
    Property Value
    Type Description
    double
    Overrides
    Geometry.Length
    | Edit this page View Source

    NumInteriorRings

    Declaration
    public int NumInteriorRings { get; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    NumPoints

    Returns the count of this Geometrys vertices. The Geometry s contained by composite Geometrys must be Geometry's; that is, they must implement NumPoints.

    Declaration
    public override int NumPoints { get; }
    Property Value
    Type Description
    int

    The number of vertices in this Geometry.

    Overrides
    Geometry.NumPoints
    | Edit this page View Source

    OgcGeometryType

    Gets the OGC geometry type

    Declaration
    public override OgcGeometryType OgcGeometryType { get; }
    Property Value
    Type Description
    OgcGeometryType
    Overrides
    Geometry.OgcGeometryType
    | Edit this page View Source

    Shell

    Declaration
    public LinearRing Shell { get; }
    Property Value
    Type Description
    LinearRing
    | Edit this page View Source

    SortIndex

    Gets a value to sort the geometry

    Declaration
    protected override Geometry.SortIndexValue SortIndex { get; }
    Property Value
    Type Description
    Geometry.SortIndexValue
    Overrides
    Geometry.SortIndex
    Remarks

    NOTE:
    For JTS v1.17 this property's getter has been renamed to getTypeCode(). In order not to break binary compatibility we did not follow.

    Methods

    | Edit this page View Source

    Apply(ICoordinateFilter)

    Performs an operation with or on this Geometry's coordinates.

    Declaration
    public override void Apply(ICoordinateFilter filter)
    Parameters
    Type Name Description
    ICoordinateFilter filter

    The filter to apply to this Geometry's coordinates

    Overrides
    Geometry.Apply(ICoordinateFilter)
    Remarks

    If this method modifies any coordinate values, GeometryChanged() must be called to update the geometry state. Note that you cannot use this method to modify this Geometry if its underlying CoordinateSequence's #get method returns a copy of the Coordinate, rather than the actual Coordinate stored (if it even stores Coordinate objects at all).

    | Edit this page View Source

    Apply(ICoordinateSequenceFilter)

    Performs an operation on the coordinates in this Geometry's CoordinateSequences.

    Declaration
    public override void Apply(ICoordinateSequenceFilter filter)
    Parameters
    Type Name Description
    ICoordinateSequenceFilter filter

    The filter to apply

    Overrides
    Geometry.Apply(ICoordinateSequenceFilter)
    Remarks

    If the filter reports that a coordinate value has been changed, GeometryChanged() will be called automatically.

    | Edit this page View Source

    Apply(IEntireCoordinateSequenceFilter)

    Performs an operation on this Geometry's CoordinateSequences.

    Declaration
    public override void Apply(IEntireCoordinateSequenceFilter filter)
    Parameters
    Type Name Description
    IEntireCoordinateSequenceFilter filter

    The filter to apply

    Overrides
    Geometry.Apply(IEntireCoordinateSequenceFilter)
    Remarks

    If the filter reports that a coordinate value has been changed, GeometryChanged() will be called automatically.

    | Edit this page View Source

    Apply(IGeometryComponentFilter)

    Performs an operation with or on this Geometry and its component Geometry's. Only GeometryCollections and Polygons have component Geometry's; for Polygons they are the LinearRings of the shell and holes.

    Declaration
    public override void Apply(IGeometryComponentFilter filter)
    Parameters
    Type Name Description
    IGeometryComponentFilter filter

    The filter to apply to this Geometry.

    Overrides
    Geometry.Apply(IGeometryComponentFilter)
    | Edit this page View Source

    Apply(IGeometryFilter)

    Performs an operation with or on this Geometry and its subelement Geometrys (if any). Only GeometryCollections and subclasses have subelement Geometry's.

    Declaration
    public override void Apply(IGeometryFilter filter)
    Parameters
    Type Name Description
    IGeometryFilter filter

    The filter to apply to this Geometry (and its children, if it is a GeometryCollection).

    Overrides
    Geometry.Apply(IGeometryFilter)
    | Edit this page View Source

    CompareToSameClass(object)

    Declaration
    protected override int CompareToSameClass(object o)
    Parameters
    Type Name Description
    object o
    Returns
    Type Description
    int
    Overrides
    Geometry.CompareToSameClass(object)
    | Edit this page View Source

    CompareToSameClass(object, IComparer<CoordinateSequence>)

    Declaration
    protected override int CompareToSameClass(object other, IComparer<CoordinateSequence> comparer)
    Parameters
    Type Name Description
    object other
    IComparer<CoordinateSequence> comparer
    Returns
    Type Description
    int
    Overrides
    Geometry.CompareToSameClass(object, IComparer<CoordinateSequence>)
    | Edit this page View Source

    ComputeEnvelopeInternal()

    Declaration
    protected override Envelope ComputeEnvelopeInternal()
    Returns
    Type Description
    Envelope
    Overrides
    Geometry.ComputeEnvelopeInternal()
    | Edit this page View Source

    ConvexHull()

    Declaration
    public override Geometry ConvexHull()
    Returns
    Type Description
    Geometry
    Overrides
    Geometry.ConvexHull()
    | Edit this page View Source

    CopyInternal()

    An internal method to copy subclass-specific geometry data.

    Declaration
    protected override Geometry CopyInternal()
    Returns
    Type Description
    Geometry

    A copy of the target geometry object.

    Overrides
    Geometry.CopyInternal()
    | Edit this page View Source

    EqualsExact(Geometry, double)

    Declaration
    public override bool EqualsExact(Geometry other, double tolerance)
    Parameters
    Type Name Description
    Geometry other
    double tolerance
    Returns
    Type Description
    bool
    Overrides
    Geometry.EqualsExact(Geometry, double)
    | Edit this page View Source

    GetInteriorRingN(int)

    Declaration
    public LineString GetInteriorRingN(int n)
    Parameters
    Type Name Description
    int n
    Returns
    Type Description
    LineString
    | Edit this page View Source

    GetOrdinates(Ordinate)

    Gets an array of double ordinate values

    Declaration
    public override double[] GetOrdinates(Ordinate ordinate)
    Parameters
    Type Name Description
    Ordinate ordinate

    The ordinate index

    Returns
    Type Description
    double[]

    An array of ordinate values

    Overrides
    Geometry.GetOrdinates(Ordinate)
    | Edit this page View Source

    Normalize()

    Declaration
    public override void Normalize()
    Overrides
    Geometry.Normalize()
    | Edit this page View Source

    Reverse()

    Computes a new geometry which has all component coordinate sequences in reverse order (opposite orientation) to this one.

    Declaration
    [Obsolete("Call Geometry.Reverse()")]
    public override Geometry Reverse()
    Returns
    Type Description
    Geometry

    A reversed geometry

    Overrides
    Geometry.Reverse()
    Remarks

    Don't override this function, implement ReverseInternal().

    | Edit this page View Source

    ReverseInternal()

    The actual implementation of the Reverse() function for POLYGONs

    Declaration
    protected override Geometry ReverseInternal()
    Returns
    Type Description
    Geometry

    A reversed geometry

    Overrides
    Geometry.ReverseInternal()

    Implements

    IComparable
    IComparable<T>
    IPolygonal

    Extension Methods

    PolygonalExtracter.GetPolygonals<TCollection>(Geometry)
    PolygonalExtracter.GetPolygonals<TCollection>(Geometry, TCollection)
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX