//--------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner willa // @backupOwner Microsoft //--------------------------------------------------------------------- using System.Data.Common.Utils; namespace System.Data.Spatial { /// /// A provider-independent service API for geospatial (Geometry/Geography) type support. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Db")] [Serializable] public abstract class DbSpatialServices { private static readonly Singleton defaultServices = new Singleton(LoadDefaultServices); public static DbSpatialServices Default { get { return defaultServices.Value; } } protected DbSpatialServices() { } // For CTP1 use the SQL types whenever they are available. // in future we will have to consider providing a more pluggable // story here so that users can specify what spatial services they want to use by default. static DbSpatialServices LoadDefaultServices() { if (System.Data.SqlClient.SqlProviderServices.SqlTypesAssemblyIsAvailable) { return System.Data.SqlClient.SqlSpatialServices.Instance; } else { return DefaultSpatialServices.Instance; } } #region Geography API /// /// This method is intended for use by derived implementations of after suitable validation of the specified provider value to ensure it is suitable for use with the derived implementation. /// /// The spatial services instance that the returned value will depend on for its implementation of spatial functionality. /// /// A new instance that contains the specified and uses the specified as its spatial implementation /// or is null. protected static DbGeography CreateGeography(DbSpatialServices spatialServices, object providerValue) { spatialServices.CheckNull("spatialServices"); providerValue.CheckNull("providerValue"); return new DbGeography(spatialServices, providerValue); } /// /// Creates a new value based on a provider-specific value that is compatible with this spatial services implementation. /// /// A provider-specific value that this spatial services implementation is capable of interpreting as a geography value. /// A new DbGeography value backed by this spatial services implementation and the specified provider value. /// is null. /// is not compatible with this spatial services implementation. public abstract DbGeography GeographyFromProviderValue(object providerValue); /// /// Creates a provider-specific value compatible with this spatial services implementation based on the specified well known representation. /// /// An instance of that contains the well known representation of a geography value. /// A provider-specific value that encodes the information contained in in a fashion compatible with this spatial services implementation. /// is null. public abstract object CreateProviderValue(DbGeographyWellKnownValue wellKnownValue); /// /// Creates an instance of that represents the specified value using one or both of the standard well known spatial formats. /// /// /// The well known representation of , as a new . /// is null. /// is not compatible with this spatial services implementation. public abstract DbGeographyWellKnownValue CreateWellKnownValue(DbGeography geographyValue); #region Geography Constructors - well known binary /// /// Creates a new value based on the specified well known binary value. /// /// A byte array that contains a well known binary representation of the geography value. /// A new DbGeography value as defined by the well known binary value with the default DbGeography coordinate system identifier (SRID) (). /// is null. public abstract DbGeography GeographyFromBinary(byte[] wellKnownBinary); /// /// Creates a new value based on the specified well known binary value and coordinate system identifier (SRID). /// /// A byte array that contains a well known binary representation of the geography value. /// The identifier of the coordinate system that the new DbGeography value should use. /// A new DbGeography value as defined by the well known binary value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. public abstract DbGeography GeographyFromBinary(byte[] wellKnownBinary, int coordinateSystemId); /// /// Creates a new line value based on the specified well known binary value and coordinate system identifier (SRID). /// /// A byte array that contains a well known binary representation of the geography value. /// The identifier of the coordinate system that the new DbGeography value should use. /// A new DbGeography value as defined by the well known binary value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. public abstract DbGeography GeographyLineFromBinary(byte[] lineWellKnownBinary, int coordinateSystemId); /// /// Creates a new point value based on the specified well known binary value and coordinate system identifier (SRID). /// /// A byte array that contains a well known binary representation of the geography value. /// The identifier of the coordinate system that the new DbGeography value should use. /// A new DbGeography value as defined by the well known binary value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. public abstract DbGeography GeographyPointFromBinary(byte[] pointWellKnownBinary, int coordinateSystemId); /// /// Creates a new polygon value based on the specified well known binary value and coordinate system identifier (SRID). /// /// A byte array that contains a well known binary representation of the geography value. /// The identifier of the coordinate system that the new DbGeography value should use. /// A new DbGeography value as defined by the well known binary value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. public abstract DbGeography GeographyPolygonFromBinary(byte[] polygonWellKnownBinary, int coordinateSystemId); /// /// Creates a new multiline value based on the specified well known binary value and coordinate system identifier (SRID). /// /// A byte array that contains a well known binary representation of the geography value. /// The identifier of the coordinate system that the new DbGeography value should use. /// A new DbGeography value as defined by the well known binary value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "MultiLine", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multi", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "multiLine", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "multi", Justification = "Match OGC, EDM")] public abstract DbGeography GeographyMultiLineFromBinary(byte[] multiLineWellKnownBinary, int coordinateSystemId); /// /// Creates a new multipoint value based on the specified well known binary value and coordinate system identifier (SRID). /// /// A byte array that contains a well known binary representation of the geography value. /// The identifier of the coordinate system that the new DbGeography value should use. /// A new DbGeography value as defined by the well known binary value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "MultiPoint", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multi", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "multiPoint", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "multi", Justification = "Match OGC, EDM")] public abstract DbGeography GeographyMultiPointFromBinary(byte[] multiPointWellKnownBinary, int coordinateSystemId); /// /// Creates a new multipolygon value based on the specified well known binary value and coordinate system identifier (SRID). /// /// A byte array that contains a well known binary representation of the geography value. /// The identifier of the coordinate system that the new DbGeography value should use. /// A new DbGeography value as defined by the well known binary value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multi", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "multi", Justification = "Match OGC, EDM")] public abstract DbGeography GeographyMultiPolygonFromBinary(byte[] multiPolygonWellKnownBinary, int coordinateSystemId); /// /// Creates a new collection value based on the specified well known binary value and coordinate system identifier (SRID). /// /// A byte array that contains a well known binary representation of the geography value. /// The identifier of the coordinate system that the new DbGeography value should use. /// A new DbGeography value as defined by the well known binary value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. public abstract DbGeography GeographyCollectionFromBinary(byte[] geographyCollectionWellKnownBinary, int coordinateSystemId); #endregion #region Geography Constructors - well known text /// /// Creates a new value based on the specified well known text value. /// /// A string that contains a well known text representation of the geography value. /// A new DbGeography value as defined by the well known text value with the default DbGeography coordinate system identifier (SRID) (). /// is null. public abstract DbGeography GeographyFromText(string wellKnownText); /// /// Creates a new value based on the specified well known text value and coordinate system identifier (SRID). /// /// A string that contains a well known text representation of the geography value. /// The identifier of the coordinate system that the new DbGeography value should use. /// A new DbGeography value as defined by the well known text value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. public abstract DbGeography GeographyFromText(string wellKnownText, int coordinateSystemId); /// /// Creates a new line value based on the specified well known text value and coordinate system identifier (SRID). /// /// A string that contains a well known text representation of the geography value. /// The identifier of the coordinate system that the new DbGeography value should use. /// A new DbGeography value as defined by the well known text value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. public abstract DbGeography GeographyLineFromText(string lineWellKnownText, int coordinateSystemId); /// /// Creates a new point value based on the specified well known text value and coordinate system identifier (SRID). /// /// A string that contains a well known text representation of the geography value. /// The identifier of the coordinate system that the new DbGeography value should use. /// A new DbGeography value as defined by the well known text value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. public abstract DbGeography GeographyPointFromText(string pointWellKnownText, int coordinateSystemId); /// /// Creates a new polygon value based on the specified well known text value and coordinate system identifier (SRID). /// /// A string that contains a well known text representation of the geography value. /// The identifier of the coordinate system that the new DbGeography value should use. /// A new DbGeography value as defined by the well known text value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. public abstract DbGeography GeographyPolygonFromText(string polygonWellKnownText, int coordinateSystemId); /// /// Creates a new multiline value based on the specified well known text value and coordinate system identifier (SRID). /// /// A string that contains a well known text representation of the geography value. /// The identifier of the coordinate system that the new DbGeography value should use. /// A new DbGeography value as defined by the well known text value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "MultiLine", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multi", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "multiLine", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "multi", Justification = "Match OGC, EDM")] public abstract DbGeography GeographyMultiLineFromText(string multiLineWellKnownText, int coordinateSystemId); /// /// Creates a new multipoint value based on the specified well known text value and coordinate system identifier (SRID). /// /// A string that contains a well known text representation of the geography value. /// The identifier of the coordinate system that the new DbGeography value should use. /// A new DbGeography value as defined by the well known text value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "MultiPoint", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multi", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "multiPoint", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "multi", Justification = "Match OGC, EDM")] public abstract DbGeography GeographyMultiPointFromText(string multiPointWellKnownText, int coordinateSystemId); /// /// Creates a new multipolygon value based on the specified well known text value and coordinate system identifier (SRID). /// /// A string that contains a well known text representation of the geography value. /// The identifier of the coordinate system that the new DbGeography value should use. /// A new DbGeography value as defined by the well known text value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multi", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "multi", Justification = "Match OGC, EDM")] public abstract DbGeography GeographyMultiPolygonFromText(string multiPolygonWellKnownText, int coordinateSystemId); /// /// Creates a new collection value based on the specified well known text value and coordinate system identifier (SRID). /// /// A string that contains a well known text representation of the geography value. /// The identifier of the coordinate system that the new DbGeography value should use. /// A new DbGeography value as defined by the well known text value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. public abstract DbGeography GeographyCollectionFromText(string geographyCollectionWellKnownText, int coordinateSystemId); #endregion #region Geography Constructors - Geography Markup Language (GML) /// /// Creates a new value based on the specified Geography Markup Language (GML) value. /// /// A string that contains a Geometry Markup Language (GML) representation of the geography value. /// A new DbGeography value as defined by the GML value with the default DbGeography coordinate system identifier (SRID) (). /// is null. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gml")] public abstract DbGeography GeographyFromGml(string geographyMarkup); /// /// Creates a new value based on the specified Geography Markup Language (GML) value and coordinate system identifier (SRID). /// /// A string that contains a Geometry Markup Language (GML) representation of the geography value. /// The identifier of the coordinate system that the new DbGeography value should use. /// A new DbGeography value as defined by the GML value with the specified coordinate system identifier (SRID). /// is null. /// is not valid. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gml")] public abstract DbGeography GeographyFromGml(string geographyMarkup, int coordinateSystemId); #endregion #region Geography Instance Property Accessors /// /// Gets the coordinate system identifier (SRID) of the coordinate system used by the given value. /// /// The geography value from which the coordinate system id should be retrieved. /// The integer coordinate system id value from . /// is null. /// is not compatible with this spatial services implementation. public abstract int GetCoordinateSystemId(DbGeography geographyValue); /// /// Gets the dimension of the given value or, if the value is a collections, the largest element dimension. /// /// The geography value for which the dimension value should be retrieved. /// The dimension of , or the largest element dimension if is a collection. /// is null. /// is not compatible with this spatial services implementation. public abstract int GetDimension(DbGeography geographyValue); /// /// Gets the spatial type name, as a string, of the given value. /// /// The geography value from which the spatial type name should be retrieved. /// The string spatial type from . /// is null. /// is not compatible with this spatial services implementation. public abstract string GetSpatialTypeName(DbGeography geographyValue); /// /// Gets a Boolean value indicating whether the given value represents the empty geography. /// /// The geography value from which the IsEmpty property should be retrieved. /// true if represents the empty geography; otherwise false. /// is null. /// is not compatible with this spatial services implementation. public abstract bool GetIsEmpty(DbGeography geographyValue); #endregion #region Geography Well Known Format Conversion /// /// Gets the well known text representation of the given value. This value should include only the Longitude and Latitude of points. /// /// The geography value for which the well known text should be generated. /// A string containing the well known text representation of /// is null. /// is not compatible with this spatial services implementation. public abstract string AsText(DbGeography geographyValue); /// /// Gets the well known text representation of the given value, including Longitude, Latitude, Elevation (Z) and Measure (M) for points. /// /// The geography value for which the well known text should be generated. /// A string containing the well known text representation of /// is null. /// is not compatible with this spatial services implementation. public virtual string AsTextIncludingElevationAndMeasure(DbGeography geographyValue) { return null; } /// /// Gets the well known binary representation of the given value. /// /// The geography value for which the well known binary should be generated. /// A byte[] containing the well known binary representation of /// is null. /// is not compatible with this spatial services implementation. public abstract byte[] AsBinary(DbGeography geographyValue); // Non-OGC /// /// Generates the Geography Markup Language (GML) representation of this value. /// /// The geography value for which the GML should be generated. /// A string containing the GML representation of this DbGeography value. /// is null. /// is not compatible with this spatial services implementation. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gml")] public abstract string AsGml(DbGeography geographyValue); #endregion #region Geography Instance Methods - Spatial Relation /// /// Determines whether the two given values are spatially equal. /// /// The first geography value to compare for equality. /// The second geography value to compare for equality. /// true if is spatially equal to ; otherwise false. /// or is null. /// or is not compatible with this spatial services implementation. public abstract bool SpatialEquals(DbGeography geographyValue, DbGeography otherGeography); /// /// Determines whether the two given values are spatially disjoint. /// /// The first geography value to compare for disjointness. /// The second geography value to compare for disjointness. /// true if is disjoint from ; otherwise false. /// or is null. /// or is not compatible with this spatial services implementation. public abstract bool Disjoint(DbGeography geographyValue, DbGeography otherGeography); /// /// Determines whether the two given values spatially intersect. /// /// The first geography value to compare for intersection. /// The second geography value to compare for intersection. /// true if intersects ; otherwise false. /// or is null. /// or is not compatible with this spatial services implementation. public abstract bool Intersects(DbGeography geographyValue, DbGeography otherGeography); #endregion #region Geography Instance Methods - Spatial Analysis /// /// Creates a geography value representing all points less than or equal to from the given value. /// /// The geography value. /// A double value specifying how far from to buffer. /// A new DbGeography value representing all points less than or equal to from . /// is null. /// is not compatible with this spatial services implementation. public abstract DbGeography Buffer(DbGeography geographyValue, double distance); /// /// Computes the distance between the closest points in two values. /// /// The first geography value. /// The second geography value. /// A double value that specifies the distance between the two closest points in and . /// or is null. /// or is not compatible with this spatial services implementation. public abstract double Distance(DbGeography geographyValue, DbGeography otherGeography); /// /// Computes the intersection of two values. /// /// The first geography value. /// The second geography value. /// A new DbGeography value representing the intersection of and . /// or is null. /// or is not compatible with this spatial services implementation. public abstract DbGeography Intersection(DbGeography geographyValue, DbGeography otherGeography); /// /// Computes the union of two values. /// /// The first geography value. /// The second geography value. /// A new DbGeography value representing the union of and . /// or is null. /// or is not compatible with this spatial services implementation. public abstract DbGeography Union(DbGeography geographyValue, DbGeography otherGeography); /// /// Computes the difference of two values. /// /// The first geography value. /// The second geography value. /// A new DbGeography value representing the difference of and . /// or is null. /// or is not compatible with this spatial services implementation. public abstract DbGeography Difference(DbGeography geographyValue, DbGeography otherGeography); /// /// Computes the symmetric difference of two values. /// /// The first geography value. /// The second geography value. /// A new DbGeography value representing the symmetric difference of and . /// or is null. /// or is not compatible with this spatial services implementation. public abstract DbGeography SymmetricDifference(DbGeography geographyValue, DbGeography otherGeography); #endregion #region Geography Collection /// /// Returns the number of elements in the given value, if it represents a geography collection. /// The geography value, which need not represent a geography collection. /// The number of elements in , if it represents a collection of other geography values; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract int? GetElementCount(DbGeography geographyValue); /// /// Returns an element of the given value, if it represents a geography collection. /// The geography value, which need not represent a geography collection. /// The position within the geography value from which the element should be taken. /// The element in at position , if it represents a collection of other geography values; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract DbGeography ElementAt(DbGeography geographyValue, int index); #endregion #region Point /// /// Returns the Latitude coordinate of the given value, if it represents a point. /// The geography value, which need not represent a point. /// The Latitude coordinate of , if it represents a point; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract double? GetLatitude(DbGeography geographyValue); /// /// Returns the Longitude coordinate of the given value, if it represents a point. /// The geography value, which need not represent a point. /// The Longitude coordinate of , if it represents a point; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract double? GetLongitude(DbGeography geographyValue); /// /// Returns the elevation (Z coordinate) of the given value, if it represents a point. /// The geography value, which need not represent a point. /// The elevation (Z coordinate) of , if it represents a point; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract double? GetElevation(DbGeography geographyValue); /// /// Returns the M (Measure) coordinate of the given value, if it represents a point. /// The geography value, which need not represent a point. /// The M (Measure) coordinate of , if it represents a point; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract double? GetMeasure(DbGeography geographyValue); #endregion #region Curve /// /// Returns a nullable double value that indicates the length of the given value, which may be null if the value does not represent a curve. /// The geography value, which need not represent a curve. /// The length of , if it represents a curve; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract double? GetLength(DbGeography geographyValue); /// /// Returns a value that represents the start point of the given DbGeography value, which may be null if the value does not represent a curve. /// The geography value, which need not represent a curve. /// The start point of , if it represents a curve; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract DbGeography GetStartPoint(DbGeography geographyValue); /// /// Returns a value that represents the end point of the given DbGeography value, which may be null if the value does not represent a curve. /// The geography value, which need not represent a curve. /// The end point of , if it represents a curve; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract DbGeography GetEndPoint(DbGeography geographyValue); /// /// Returns a nullable Boolean value that whether the given value is closed, which may be null if the value does not represent a curve. /// The geography value, which need not represent a curve. /// true if represents a closed curve; false if represents a curve that is not closed; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract bool? GetIsClosed(DbGeography geographyValue); #endregion #region LineString, Line, LinearRing /// /// Returns the number of points in the given value, if it represents a linestring or linear ring. /// The geography value, which need not represent a linestring or linear ring. /// The number of elements in , if it represents a linestring or linear ring; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract int? GetPointCount(DbGeography geographyValue); /// /// Returns a point element of the given value, if it represents a linestring or linear ring. /// The geography value, which need not represent a linestring or linear ring. /// The position within the geography value from which the element should be taken. /// The point in at position , if it represents a linestring or linear ring; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract DbGeography PointAt(DbGeography geographyValue, int index); #endregion #region Surface /// /// Returns a nullable double value that indicates the area of the given value, which may be null if the value does not represent a surface. /// The geography value, which need not represent a surface. /// The area of , if it represents a surface; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract double? GetArea(DbGeography geographyValue); #endregion #endregion #region Geometry API /// /// This method is intended for use by derived implementations of after suitable validation of the specified provider value to ensure it is suitable for use with the derived implementation. /// /// The spatial services instance that the returned value will depend on for its implementation of spatial functionality. /// /// A new instance that contains the specified and uses the specified as its spatial implementation /// or is null. protected static DbGeometry CreateGeometry(DbSpatialServices spatialServices, object providerValue) { spatialServices.CheckNull("spatialServices"); providerValue.CheckNull("providerValue"); return new DbGeometry(spatialServices, providerValue); } /// /// Creates a provider-specific value compatible with this spatial services implementation based on the specified well known representation. /// /// An instance of that contains the well known representation of a geometry value. /// A provider-specific value that encodes the information contained in in a fashion compatible with this spatial services implementation. /// is null. public abstract object CreateProviderValue(DbGeometryWellKnownValue wellKnownValue); /// /// Creates an instance of that represents the specified value using one or both of the standard well known spatial formats. /// /// /// The well known representation of , as a new . /// is null. /// is not compatible with this spatial services implementation. public abstract DbGeometryWellKnownValue CreateWellKnownValue(DbGeometry geometryValue); /// /// Creates a new value based on a provider-specific value that is compatible with this spatial services implementation. /// /// A provider-specific value that this spatial services implementation is capable of interpreting as a geometry value. /// A new DbGeometry value backed by this spatial services implementation and the specified provider value. /// is null. /// is not compatible with this spatial services implementation. public abstract DbGeometry GeometryFromProviderValue(object providerValue); #region Geometry Constructors - well known binary /// /// Creates a new value based on the specified well known binary value. /// /// A byte array that contains a well known binary representation of the geometry value. /// A new DbGeometry value as defined by the well known binary value with the default DbGeometry coordinate system identifier (SRID) (). /// is null. public abstract DbGeometry GeometryFromBinary(byte[] wellKnownBinary); /// /// Creates a new value based on the specified well known binary value and coordinate system identifier (SRID). /// /// A byte array that contains a well known binary representation of the geometry value. /// The identifier of the coordinate system that the new DbGeometry value should use. /// A new DbGeometry value as defined by the well known binary value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. public abstract DbGeometry GeometryFromBinary(byte[] wellKnownBinary, int coordinateSystemId); /// /// Creates a new line value based on the specified well known binary value and coordinate system identifier (SRID). /// /// A byte array that contains a well known binary representation of the geometry value. /// The identifier of the coordinate system that the new DbGeometry value should use. /// A new DbGeometry value as defined by the well known binary value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. public abstract DbGeometry GeometryLineFromBinary(byte[] lineWellKnownBinary, int coordinateSystemId); /// /// Creates a new point value based on the specified well known binary value and coordinate system identifier (SRID). /// /// A byte array that contains a well known binary representation of the geometry value. /// The identifier of the coordinate system that the new DbGeometry value should use. /// A new DbGeometry value as defined by the well known binary value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. public abstract DbGeometry GeometryPointFromBinary(byte[] pointWellKnownBinary, int coordinateSystemId); /// /// Creates a new polygon value based on the specified well known binary value and coordinate system identifier (SRID). /// /// A byte array that contains a well known binary representation of the geometry value. /// The identifier of the coordinate system that the new DbGeometry value should use. /// A new DbGeometry value as defined by the well known binary value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. public abstract DbGeometry GeometryPolygonFromBinary(byte[] polygonWellKnownBinary, int coordinateSystemId); /// /// Creates a new multiline value based on the specified well known binary value and coordinate system identifier (SRID). /// /// A byte array that contains a well known binary representation of the geometry value. /// The identifier of the coordinate system that the new DbGeometry value should use. /// A new DbGeometry value as defined by the well known binary value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "MultiLine", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multi", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "multiLine", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "multi", Justification = "Match OGC, EDM")] public abstract DbGeometry GeometryMultiLineFromBinary(byte[] multiLineWellKnownBinary, int coordinateSystemId); /// /// Creates a new multipoint value based on the specified well known binary value and coordinate system identifier (SRID). /// /// A byte array that contains a well known binary representation of the geometry value. /// The identifier of the coordinate system that the new DbGeometry value should use. /// A new DbGeometry value as defined by the well known binary value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "MultiPoint", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multi", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "multiPoint", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "multi", Justification = "Match OGC, EDM")] public abstract DbGeometry GeometryMultiPointFromBinary(byte[] multiPointWellKnownBinary, int coordinateSystemId); /// /// Creates a new multipolygon value based on the specified well known binary value and coordinate system identifier (SRID). /// /// A byte array that contains a well known binary representation of the geometry value. /// The identifier of the coordinate system that the new DbGeometry value should use. /// A new DbGeometry value as defined by the well known binary value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multi", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "multi", Justification = "Match OGC, EDM")] public abstract DbGeometry GeometryMultiPolygonFromBinary(byte[] multiPolygonWellKnownBinary, int coordinateSystemId); /// /// Creates a new collection value based on the specified well known binary value and coordinate system identifier (SRID). /// /// A byte array that contains a well known binary representation of the geometry value. /// The identifier of the coordinate system that the new DbGeometry value should use. /// A new DbGeometry value as defined by the well known binary value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. public abstract DbGeometry GeometryCollectionFromBinary(byte[] geometryCollectionWellKnownBinary, int coordinateSystemId); #endregion #region Geometry Constructors - well known text /// /// Creates a new value based on the specified well known text value. /// /// A string that contains a well known text representation of the geometry value. /// A new DbGeometry value as defined by the well known text value with the default DbGeometry coordinate system identifier (SRID) (). /// is null. public abstract DbGeometry GeometryFromText(string wellKnownText); /// /// Creates a new value based on the specified well known text value and coordinate system identifier (SRID). /// /// A string that contains a well known text representation of the geometry value. /// The identifier of the coordinate system that the new DbGeometry value should use. /// A new DbGeometry value as defined by the well known text value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. public abstract DbGeometry GeometryFromText(string wellKnownText, int coordinateSystemId); /// /// Creates a new line value based on the specified well known text value and coordinate system identifier (SRID). /// /// A string that contains a well known text representation of the geometry value. /// The identifier of the coordinate system that the new DbGeometry value should use. /// A new DbGeometry value as defined by the well known text value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. public abstract DbGeometry GeometryLineFromText(string lineWellKnownText, int coordinateSystemId); /// /// Creates a new point value based on the specified well known text value and coordinate system identifier (SRID). /// /// A string that contains a well known text representation of the geometry value. /// The identifier of the coordinate system that the new DbGeometry value should use. /// A new DbGeometry value as defined by the well known text value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. public abstract DbGeometry GeometryPointFromText(string pointWellKnownText, int coordinateSystemId); /// /// Creates a new polygon value based on the specified well known text value and coordinate system identifier (SRID). /// /// A string that contains a well known text representation of the geometry value. /// The identifier of the coordinate system that the new DbGeometry value should use. /// A new DbGeometry value as defined by the well known text value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. public abstract DbGeometry GeometryPolygonFromText(string polygonWellKnownText, int coordinateSystemId); /// /// Creates a new multiline value based on the specified well known text value and coordinate system identifier (SRID). /// /// A string that contains a well known text representation of the geometry value. /// The identifier of the coordinate system that the new DbGeometry value should use. /// A new DbGeometry value as defined by the well known text value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "MultiLine", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multi", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "multiLine", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "multi", Justification = "Match OGC, EDM")] public abstract DbGeometry GeometryMultiLineFromText(string multiLineWellKnownText, int coordinateSystemId); /// /// Creates a new multipoint value based on the specified well known text value and coordinate system identifier (SRID). /// /// A string that contains a well known text representation of the geometry value. /// The identifier of the coordinate system that the new DbGeometry value should use. /// A new DbGeometry value as defined by the well known text value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "MultiPoint", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multi", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "multiPoint", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "multi", Justification = "Match OGC, EDM")] public abstract DbGeometry GeometryMultiPointFromText(string multiPointWellKnownText, int coordinateSystemId); /// /// Creates a new multipolygon value based on the specified well known text value and coordinate system identifier (SRID). /// /// A string that contains a well known text representation of the geometry value. /// The identifier of the coordinate system that the new DbGeometry value should use. /// A new DbGeometry value as defined by the well known text value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multi", Justification = "Match OGC, EDM")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "multi", Justification = "Match OGC, EDM")] public abstract DbGeometry GeometryMultiPolygonFromText(string multiPolygonKnownText, int coordinateSystemId); /// /// Creates a new collection value based on the specified well known text value and coordinate system identifier (SRID). /// /// A string that contains a well known text representation of the geometry value. /// The identifier of the coordinate system that the new DbGeometry value should use. /// A new DbGeometry value as defined by the well known text value with the specified coordinate system identifier (SRID) (). /// is null. /// is not valid. public abstract DbGeometry GeometryCollectionFromText(string geometryCollectionWellKnownText, int coordinateSystemId); #endregion #region Geometry Constructors - Geography Markup Language (GML) /// /// Creates a new value based on the specified Geography Markup Language (GML) value. /// /// A string that contains a Geography Markup Language (GML) representation of the geometry value. /// A new DbGeometry value as defined by the GML value with the default DbGeometry coordinate system identifier (SRID) (). /// is null. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gml")] public abstract DbGeometry GeometryFromGml(string geometryMarkup); /// /// Creates a new value based on the specified Geography Markup Language (GML) value and coordinate system identifier (SRID). /// /// A string that contains a Geography Markup Language (GML) representation of the geometry value. /// The identifier of the coordinate system that the new DbGeometry value should use. /// A new DbGeometry value as defined by the GML value with the specified coordinate system identifier (SRID). /// is null. /// is not valid. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gml")] public abstract DbGeometry GeometryFromGml(string geometryMarkup, int coordinateSystemId); #endregion #region Geometry Instance Property Accessors /// /// Gets the coordinate system id (SRID) of the coordinate system used by the given value. /// /// The geometry value from which the coordinate system id should be retrieved. /// The integer coordinate system id value from . /// is null. /// is not compatible with this spatial services implementation. public abstract int GetCoordinateSystemId(DbGeometry geometryValue); /// /// Gets the boundary of the given value. /// /// The geometry value from which the Boundary value should be retrieved. /// The boundary of , as a value. /// is null. /// is not compatible with this spatial services implementation. public abstract DbGeometry GetBoundary(DbGeometry geometryValue); /// /// Gets the dimension of the given value or, if the value is a collections, the largest element dimension. /// /// The geometry value for which the dimension value should be retrieved. /// The dimension of , or the largest element dimension if is a collection. /// is null. /// is not compatible with this spatial services implementation. public abstract int GetDimension(DbGeometry geometryValue); /// /// Gets the envelope (minimum bounding box) of the given value, as a geometry value. /// /// The geometry value for which the envelope value should be retrieved. /// The envelope of , as a value. /// is null. /// is not compatible with this spatial services implementation. public abstract DbGeometry GetEnvelope(DbGeometry geometryValue); /// /// Gets the spatial type name, as a string, of the given value. /// /// The geometry value from which the spatial type name should be retrieved. /// The string spatial type name from . /// is null. /// is not compatible with this spatial services implementation. public abstract string GetSpatialTypeName(DbGeometry geometryValue); /// /// Gets a Boolean value indicating whether the given value represents the empty geometry. /// /// The geometry value from which the IsEmpty property should be retrieved. /// true if represents the empty geometry; otherwise false. /// is null. /// is not compatible with this spatial services implementation. public abstract bool GetIsEmpty(DbGeometry geometryValue); /// /// Gets a Boolean value indicating whether the given value is simple, according to the conditions required for its geometry type. /// /// The geometry value from which the IsSimple property should be retrieved. /// true if satisifies the conditions required for an instance of its geometry type to be considered simple; otherwise false. /// is null. /// is not compatible with this spatial services implementation. public abstract bool GetIsSimple(DbGeometry geometryValue); /// /// Gets a Boolean value indicating whether the given value is valid. /// /// The geometry value from which the IsValid property should be retrieved. /// true if is considered valid; otherwise false. /// is null. /// is not compatible with this spatial services implementation. public abstract bool GetIsValid(DbGeometry geometryValue); #endregion #region Geometry Well Known Format Conversion /// /// Gets the well known text representation of the given value, including only X and Y coordinates for points. /// /// The geometry value for which the well known text should be generated. /// A string containing the well known text representation of /// is null. /// is not compatible with this spatial services implementation. public abstract string AsText(DbGeometry geometryValue); /// /// Gets the well known text representation of the given value, including X coordinate, Y coordinate, Elevation (Z) and Measure (M) for points. /// /// The geometry value for which the well known text should be generated. /// A string containing the well known text representation of /// is null. /// is not compatible with this spatial services implementation. public virtual string AsTextIncludingElevationAndMeasure(DbGeometry geometryValue) { return null; } /// /// Gets the well known binary representation of the given value. /// /// The geometry value for which the well known binary should be generated. /// A byte[] containing the well known binary representation of /// is null. /// is not compatible with this spatial services implementation. public abstract byte[] AsBinary(DbGeometry geometryValue); // Non-OGC /// /// Generates the Geography Markup Language (GML) representation of this value. /// /// The geometry value for which the GML should be generated. /// A string containing the GML representation of this DbGeometry value. /// is null. /// is not compatible with this spatial services implementation. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gml")] public abstract string AsGml(DbGeometry geometryValue); #endregion #region Geometry Instance Methods - Spatial Relation /// /// Determines whether the two given values are spatially equal. /// /// The first geometry value to compare for equality. /// The second geometry value to compare for equality. /// true if is spatially equal to ; otherwise false. /// or is null. /// or is not compatible with this spatial services implementation. public abstract bool SpatialEquals(DbGeometry geometryValue, DbGeometry otherGeometry); /// /// Determines whether the two given values are spatially disjoint. /// /// The first geometry value to compare for disjointness. /// The second geometry value to compare for disjointness. /// true if is disjoint from ; otherwise false. /// or is null. /// or is not compatible with this spatial services implementation. public abstract bool Disjoint(DbGeometry geometryValue, DbGeometry otherGeometry); /// /// Determines whether the two given values spatially intersect. /// /// The first geometry value to compare for intersection. /// The second geometry value to compare for intersection. /// true if intersects ; otherwise false. /// or is null. /// or is not compatible with this spatial services implementation. public abstract bool Intersects(DbGeometry geometryValue, DbGeometry otherGeometry); /// /// Determines whether the two given values spatially touch. /// /// The first geometry value. /// The second geometry value. /// true if touches ; otherwise false. /// or is null. /// or is not compatible with this spatial services implementation. public abstract bool Touches(DbGeometry geometryValue, DbGeometry otherGeometry); /// /// Determines whether the two given values spatially cross. /// /// The first geometry value. /// The second geometry value. /// true if crosses ; otherwise false. /// or is null. /// or is not compatible with this spatial services implementation. public abstract bool Crosses(DbGeometry geometryValue, DbGeometry otherGeometry); /// /// Determines whether one value is spatially within the other. /// /// The first geometry value. /// The second geometry value. /// true if is within ; otherwise false. /// or is null. /// or is not compatible with this spatial services implementation. public abstract bool Within(DbGeometry geometryValue, DbGeometry otherGeometry); /// /// Determines whether one value spatially contains the other. /// /// The first geometry value. /// The second geometry value. /// true if contains ; otherwise false. /// or is null. /// or is not compatible with this spatial services implementation. public abstract bool Contains(DbGeometry geometryValue, DbGeometry otherGeometry); /// /// Determines whether the two given values spatially overlap. /// /// The first geometry value. /// The second geometry value. /// true if overlaps ; otherwise false. /// or is null. /// or is not compatible with this spatial services implementation. public abstract bool Overlaps(DbGeometry geometryValue, DbGeometry otherGeometry); /// /// Determines whether the two given values are spatially related according to the /// given Dimensionally Extended Nine-Intersection Model (DE-9IM) intersection pattern. /// /// The first geometry value. /// The geometry value that should be compared with the first geometry value for relation. /// A string that contains the text representation of the (DE-9IM) intersection pattern that defines the relation. /// true if this value relates to according to the specified intersection pattern matrix; otherwise false. /// , or is null. /// or is not compatible with this spatial services implementation. public abstract bool Relate(DbGeometry geometryValue, DbGeometry otherGeometry, string matrix); #endregion #region Geometry Instance Methods - Spatial Analysis /// /// Creates a geometry value representing all points less than or equal to from the given value. /// /// The geometry value. /// A double value specifying how far from to buffer. /// A new DbGeometry value representing all points less than or equal to from . /// is null. /// is not compatible with this spatial services implementation. public abstract DbGeometry Buffer(DbGeometry geometryValue, double distance); /// /// Computes the distance between the closest points in two values. /// /// The first geometry value. /// The second geometry value. /// A double value that specifies the distance between the two closest points in and . /// or is null. /// or is not compatible with this spatial services implementation. public abstract double Distance(DbGeometry geometryValue, DbGeometry otherGeometry); /// /// Gets the convex hull of the given value. /// /// The geometry value for which the convex hull should be computed. /// A new DbGeometry value that contains the convex hull of . /// is null. /// is not compatible with this spatial services implementation. public abstract DbGeometry GetConvexHull(DbGeometry geometryValue); /// /// Computes the intersection of two values. /// /// The first geometry value. /// The second geometry value. /// A new DbGeometry value representing the intersection of and . /// or is null. /// or is not compatible with this spatial services implementation. public abstract DbGeometry Intersection(DbGeometry geometryValue, DbGeometry otherGeometry); /// /// Computes the union of two values. /// /// The first geometry value. /// The second geometry value. /// A new DbGeometry value representing the union of and . /// or is null. /// or is not compatible with this spatial services implementation. public abstract DbGeometry Union(DbGeometry geometryValue, DbGeometry otherGeometry); /// /// Computes the difference between two values. /// /// The first geometry value. /// The second geometry value. /// A new DbGeometry value representing the difference between and . /// or is null. /// or is not compatible with this spatial services implementation. public abstract DbGeometry Difference(DbGeometry geometryValue, DbGeometry otherGeometry); /// /// Computes the symmetric difference between two values. /// /// The first geometry value. /// The second geometry value. /// A new DbGeometry value representing the symmetric difference between and . /// or is null. /// or is not compatible with this spatial services implementation. public abstract DbGeometry SymmetricDifference(DbGeometry geometryValue, DbGeometry otherGeometry); #endregion #region Geometry Collection /// /// Returns the number of elements in the given value, if it represents a geometry collection. /// The geometry value, which need not represent a geometry collection. /// The number of elements in , if it represents a collection of other geometry values; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract int? GetElementCount(DbGeometry geometryValue); /// /// Returns an element of the given value, if it represents a geometry collection. /// The geometry value, which need not represent a geometry collection. /// The position within the geometry value from which the element should be taken. /// The element in at position , if it represents a collection of other geometry values; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract DbGeometry ElementAt(DbGeometry geometryValue, int index); #endregion #region Point /// /// Returns the X coordinate of the given value, if it represents a point. /// The geometry value, which need not represent a point. /// The X coordinate of , if it represents a point; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract double? GetXCoordinate(DbGeometry geometryValue); /// /// Returns the Y coordinate of the given value, if it represents a point. /// The geometry value, which need not represent a point. /// The Y coordinate of , if it represents a point; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract double? GetYCoordinate(DbGeometry geometryValue); /// /// Returns the elevation (Z) of the given value, if it represents a point. /// The geometry value, which need not represent a point. /// The elevation (Z) of , if it represents a point; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract double? GetElevation(DbGeometry geometryValue); /// /// Returns the M (Measure) coordinate of the given value, if it represents a point. /// The geometry value, which need not represent a point. /// The M (Measure) coordinate of , if it represents a point; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract double? GetMeasure(DbGeometry geometryValue); #endregion #region Curve /// /// Returns a nullable double value that indicates the length of the given value, which may be null if the value does not represent a curve. /// The geometry value, which need not represent a curve. /// The length of , if it represents a curve; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract double? GetLength(DbGeometry geometryValue); /// /// Returns a value that represents the start point of the given DbGeometry value, which may be null if the value does not represent a curve. /// The geometry value, which need not represent a curve. /// The start point of , if it represents a curve; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract DbGeometry GetStartPoint(DbGeometry geometryValue); /// /// Returns a value that represents the end point of the given DbGeometry value, which may be null if the value does not represent a curve. /// The geometry value, which need not represent a curve. /// The end point of , if it represents a curve; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract DbGeometry GetEndPoint(DbGeometry geometryValue); /// /// Returns a nullable Boolean value that whether the given value is closed, which may be null if the value does not represent a curve. /// The geometry value, which need not represent a curve. /// true if represents a closed curve; false if represents a curve that is not closed; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract bool? GetIsClosed(DbGeometry geometryValue); /// /// Returns a nullable Boolean value that whether the given value is a ring, which may be null if the value does not represent a curve. /// The geometry value, which need not represent a curve. /// true if represents a ring; false if represents a curve that is not a ring; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract bool? GetIsRing(DbGeometry geometryValue); #endregion #region LineString, Line, LinearRing /// /// Returns the number of points in the given value, if it represents a linestring or linear ring. /// The geometry value, which need not represent a linestring or linear ring. /// The number of elements in , if it represents a linestring or linear ring; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract int? GetPointCount(DbGeometry geometryValue); /// /// Returns a point element of the given value, if it represents a linestring or linear ring. /// The geometry value, which need not represent a linestring or linear ring. /// The position within the geometry value from which the element should be taken. /// The point in at position , if it represents a linestring or linear ring; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract DbGeometry PointAt(DbGeometry geometryValue, int index); #endregion #region Surface /// /// Returns a nullable double value that indicates the area of the given value, which may be null if the value does not represent a surface. /// The geometry value, which need not represent a surface. /// The area of , if it represents a surface; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract double? GetArea(DbGeometry geometryValue); /// /// Returns a value that represents the centroid of the given DbGeometry value, which may be null if the value does not represent a surface. /// The geometry value, which need not represent a surface. /// The centroid of , if it represents a surface; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Centroid", Justification = "Naming convention prescribed by OGC specification")] public abstract DbGeometry GetCentroid(DbGeometry geometryValue); /// /// Returns a value that represents a point on the surface of the given DbGeometry value, which may be null if the value does not represent a surface. /// The geometry value, which need not represent a surface. /// A DbGeometry value representing a point on , if it represents a surface; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract DbGeometry GetPointOnSurface(DbGeometry geometryValue); #endregion #region Polygon /// /// Returns a value that represents the exterior ring of the given DbGeometry value, which may be null if the value does not represent a polygon. /// The geometry value, which need not represent a polygon. /// A DbGeometry value representing the exterior ring on , if it represents a polygon; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract DbGeometry GetExteriorRing(DbGeometry geometryValue); /// /// Returns the number of interior rings in the given value, if it represents a polygon. /// The geometry value, which need not represent a polygon. /// The number of elements in , if it represents a polygon; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract int? GetInteriorRingCount(DbGeometry geometryValue); /// /// Returns an interior ring from the the given value, if it represents a polygon. /// The geometry value, which need not represent a polygon. /// The position within the geometry value from which the element should be taken. /// The interior ring in at position , if it represents a polygon; otherwise null. /// /// is null. /// is not compatible with this spatial services implementation. public abstract DbGeometry InteriorRingAt(DbGeometry geometryValue, int index); #endregion #endregion } }