Class GeometryCollection
Basic implementation of GeometryCollection.
Implements
Inherited Members
Namespace: NetTopologySuite.Geometries
Assembly: NetTopologySuite.dll
Syntax
[Serializable]
public class GeometryCollection : Geometry, IComparable, IComparable<Geometry>, IReadOnlyList<Geometry>, IReadOnlyCollection<Geometry>, IEnumerable<Geometry>, IEnumerable
Constructors
| Edit this page View SourceGeometryCollection(Geometry[])
Declaration
public GeometryCollection(Geometry[] geometries)
Parameters
| Type | Name | Description |
|---|---|---|
| Geometry[] | geometries | The |
Remarks
For create this Geometry is used a standard GeometryFactory
with PrecisionModel == Floating.
GeometryCollection(Geometry[], GeometryFactory)
Declaration
public GeometryCollection(Geometry[] geometries, GeometryFactory factory)
Parameters
| Type | Name | Description |
|---|---|---|
| Geometry[] | geometries | The |
| GeometryFactory | factory |
Fields
| Edit this page View SourceEmpty
Represents an empty GeometryCollection.
Declaration
public static readonly GeometryCollection Empty
Field Value
| Type | Description |
|---|---|
| GeometryCollection |
Properties
| Edit this page View SourceArea
Returns the area of this GeometryCollection.
Declaration
public override double Area { get; }
Property Value
| Type | Description |
|---|---|
| double |
Overrides
| Edit this page View SourceBoundary
Returns the boundary, or an empty geometry of appropriate dimension
if this Geometry is empty.
For a discussion of this function, see the OpenGIS Simple
Features Specification. As stated in SFS Section 2.1.13.1, "the boundary
of a Geometry is a set of Geometries of the next lower dimension."
Declaration
public override Geometry Boundary { get; }
Property Value
| Type | Description |
|---|---|
| Geometry | The closure of the combinatorial boundary of this |
Overrides
| Edit this page View SourceBoundaryDimension
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
|
Overrides
| Edit this page View SourceCoordinate
Returns a vertex of this geometry
(usually, but not necessarily, the first one),
or null if the geometry is empty.
Declaration
public override Coordinate Coordinate { get; }
Property Value
| Type | Description |
|---|---|
| Coordinate | A coordinate which is a vertex of this |
Overrides
Remarks
The returned coordinate should not be assumed to be an actual Coordinate object used in the internal representation.
Coordinates
Collects all coordinates of all subgeometries into an Array. Note that while changes to the coordinate objects themselves may modify the Geometries in place, the returned Array as such is only a temporary container which is not synchronized back.
Declaration
public override Coordinate[] Coordinates { get; }
Property Value
| Type | Description |
|---|---|
| Coordinate[] | The collected coordinates. |
Overrides
| Edit this page View SourceCount
Returns the number of geometries contained by this GeometryCollection.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
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
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).
See Also
| Edit this page View SourceGeometries
Declaration
public Geometry[] Geometries { get; protected set; }
Property Value
| Type | Description |
|---|---|
| Geometry[] |
GeometryType
Returns the name of this object's interface.
Declaration
public override string GeometryType { get; }
Property Value
| Type | Description |
|---|---|
| string | "GeometryCollection" |
Overrides
| Edit this page View SourceIsEmpty
Tests whether the set of points covered in this Geometry is empty.
A collection containing only empty elements is reported as empty.
To check structural emptiness use NumGeometries.
Declaration
public override bool IsEmpty { get; }
Property Value
| Type | Description |
|---|---|
| bool |
|
Overrides
| Edit this page View SourceIsHomogeneous
Return true if all features in collection are of the same type.
Declaration
public bool IsHomogeneous { get; }
Property Value
| Type | Description |
|---|---|
| bool |
this[int]
Returns the iTh element in the collection.
Declaration
public Geometry this[int i] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | i |
Property Value
| Type | Description |
|---|---|
| Geometry |
Length
Returns the length of this GeometryCollection.
Declaration
public override double Length { get; }
Property Value
| Type | Description |
|---|---|
| double |
Overrides
| Edit this page View SourceNumGeometries
Returns the number of Geometryes in a GeometryCollection, or 1, if the geometry is not a collection.
Declaration
public override int NumGeometries { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
| Edit this page View SourceNumPoints
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 |
Overrides
| Edit this page View SourceOgcGeometryType
Gets the OGC geometry type
Declaration
public override OgcGeometryType OgcGeometryType { get; }
Property Value
| Type | Description |
|---|---|
| OgcGeometryType |
Overrides
| Edit this page View SourceSortIndex
Gets a value to sort the geometry
Declaration
protected override Geometry.SortIndexValue SortIndex { get; }
Property Value
| Type | Description |
|---|---|
| Geometry.SortIndexValue |
Overrides
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 SourceApply(ICoordinateFilter)
Declaration
public override void Apply(ICoordinateFilter filter)
Parameters
| Type | Name | Description |
|---|---|---|
| ICoordinateFilter | filter |
Overrides
| Edit this page View SourceApply(ICoordinateSequenceFilter)
Declaration
public override void Apply(ICoordinateSequenceFilter filter)
Parameters
| Type | Name | Description |
|---|---|---|
| ICoordinateSequenceFilter | filter |
Overrides
| Edit this page View SourceApply(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
Remarks
If the filter reports that a coordinate value has been changed, GeometryChanged() will be called automatically.
Apply(IGeometryComponentFilter)
Declaration
public override void Apply(IGeometryComponentFilter filter)
Parameters
| Type | Name | Description |
|---|---|---|
| IGeometryComponentFilter | filter |
Overrides
| Edit this page View SourceApply(IGeometryFilter)
Declaration
public override void Apply(IGeometryFilter filter)
Parameters
| Type | Name | Description |
|---|---|---|
| IGeometryFilter | filter |
Overrides
| Edit this page View SourceCompareToSameClass(object)
Returns whether this Geometry is greater than, equal to,
or less than another Geometry having the same class.
Declaration
protected override int CompareToSameClass(object o)
Parameters
| Type | Name | Description |
|---|---|---|
| object | o | A |
Returns
| Type | Description |
|---|---|
| int | A positive number, 0, or a negative number, depending on whether
this object is greater than, equal to, or less than |
Overrides
| Edit this page View SourceCompareToSameClass(object, IComparer<CoordinateSequence>)
Returns whether this Geometry is greater than, equal to,
or less than another Geometry of the same class.
using the given IComparer<T>.
Declaration
protected override int CompareToSameClass(object o, IComparer<CoordinateSequence> comp)
Parameters
| Type | Name | Description |
|---|---|---|
| object | o | A |
| IComparer<CoordinateSequence> | comp | The comparer |
Returns
| Type | Description |
|---|---|
| int | A positive number, 0, or a negative number, depending on whether
this object is greater than, equal to, or less than |
Overrides
| Edit this page View SourceComputeEnvelopeInternal()
Declaration
protected override Envelope ComputeEnvelopeInternal()
Returns
| Type | Description |
|---|---|
| Envelope |
Overrides
| Edit this page View SourceCopyInternal()
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
| Edit this page View SourceEqualsExact(Geometry, double)
Declaration
public override bool EqualsExact(Geometry other, double tolerance)
Parameters
| Type | Name | Description |
|---|---|---|
| Geometry | other | |
| double | tolerance |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
| Edit this page View SourceGetEnumerator()
Declaration
public IEnumerator<Geometry> GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator<Geometry> |
GetGeometryN(int)
Returns an element Geometry from a GeometryCollection,
or this, if the geometry is not a collection.
Declaration
public override Geometry GetGeometryN(int n)
Parameters
| Type | Name | Description |
|---|---|---|
| int | n | The index of the geometry element. |
Returns
| Type | Description |
|---|---|
| Geometry | The n'th geometry contained in this geometry. |
Overrides
| Edit this page View SourceGetOrdinates(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
| Edit this page View SourceHasDimension(Dimension)
Tests whether an atomic geometry or any element of a collection
has the specified dimension.
In particular, this can be used with mixed-dimension GeometryCollections
to test if they contain an element of the specified dimension.
Declaration
public override bool HasDimension(Dimension dim)
Parameters
| Type | Name | Description |
|---|---|---|
| Dimension | dim | The dimension to test |
Returns
| Type | Description |
|---|---|
| bool |
|
Overrides
See Also
| Edit this page View SourceNormalize()
Declaration
public override void Normalize()
Overrides
| Edit this page View SourceReverse()
Creates a GeometryCollection with every component reversed. The order of the components in the collection are not reversed.
Declaration
[Obsolete("Call Geometry.Reverse()")]
public override Geometry Reverse()
Returns
| Type | Description |
|---|---|
| Geometry |
Overrides
| Edit this page View SourceReverseInternal()
The actual implementation of the Reverse() function for GeometryCollections.
Declaration
protected override Geometry ReverseInternal()
Returns
| Type | Description |
|---|---|
| Geometry | A reversed geometry |