1 //------------------------------------------------------------------------------
2 // <copyright file="DbGeometry.cs" company="Microsoft">
3 //      Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 //
6 // @owner  willa
7 // @backupOwner Microsoft
8 //------------------------------------------------------------------------------
9 
10 using System.Data.Common.Internal;
11 using System.ComponentModel.DataAnnotations;
12 using System.Data.Spatial.Internal;
13 using System.Diagnostics;
14 using System.Runtime.Serialization;
15 using System.Globalization;
16 
17 namespace System.Data.Spatial
18 {
19     [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Db")]
20     [DataContract]
21     [Serializable]
22     [BindableType]
23     public class DbGeometry
24     {
25         private DbSpatialServices spatialSvcs;
26         private object providerValue;
27 
DbGeometry(DbSpatialServices spatialServices, object spatialProviderValue)28         internal DbGeometry(DbSpatialServices spatialServices, object spatialProviderValue)
29         {
30             Debug.Assert(spatialServices != null, "Spatial services are required");
31             Debug.Assert(spatialProviderValue != null, "Provider value is required");
32 
33             this.spatialSvcs = spatialServices;
34             this.providerValue = spatialProviderValue;
35         }
36 
37         /// <summary>
38         /// Gets the default coordinate system id (SRID) for geometry values.
39         /// </summary>
40         public static int DefaultCoordinateSystemId { get { return 0; } }
41 
42         /// <summary>
43         /// Gets a representation of this DbGeometry value that is specific to the underlying provider that constructed it.
44         /// </summary>
45         public object ProviderValue { get { return this.providerValue; } }
46 
47         /// <summary>
48         /// Gets or sets a data contract serializable well known representation of this DbGeometry value.
49         /// </summary>
50         [DataMember(Name = "Geometry")]
51         public DbGeometryWellKnownValue WellKnownValue
52         {
53             get { return this.spatialSvcs.CreateWellKnownValue(this); }
54             set
55             {
56                 if (this.spatialSvcs != null)
57                 {
58                     throw SpatialExceptions.WellKnownValueSerializationPropertyNotDirectlySettable();
59                 }
60 
61                 DbSpatialServices resolvedServices = DbSpatialServices.Default;
62                 this.providerValue = resolvedServices.CreateProviderValue(value);
63                 this.spatialSvcs = resolvedServices;
64             }
65         }
66 
67         #region Well Known Binary Static Constructors
68 
69         /// <summary>
70         /// Creates a new <see cref="DbGeometry"/> value based on the specified well known binary value.
71         /// </summary>
72         /// <param name="wellKnownBinary">A byte array that contains a well known binary representation of the geometry value.</param>
73         /// <returns>A new DbGeometry value as defined by the well known binary value with the default geometry coordinate system identifier (<see cref="DbGeometry.DefaultCoordinateSystemId"/>).</returns>
74         /// <exception cref="ArgumentNullException"><paramref name="wellKnownBinary"/> is null.</exception>
FromBinary(byte[] wellKnownBinary)75         public static DbGeometry FromBinary(byte[] wellKnownBinary)
76         {
77             wellKnownBinary.CheckNull("wellKnownBinary");
78             return DbSpatialServices.Default.GeometryFromBinary(wellKnownBinary);
79         }
80 
81         /// <summary>
82         /// Creates a new <see cref="DbGeometry"/> value based on the specified well known binary value and coordinate system identifier (SRID).
83         /// </summary>
84         /// <param name="wellKnownBinary">A byte array that contains a well known binary representation of the geometry value.</param>
85         /// <param name="coordinateSystemId">The identifier of the coordinate system that the new DbGeometry value should use.</param>
86         /// <returns>A new DbGeometry value as defined by the well known binary value with the specified coordinate system identifier.</returns>
87         /// <exception cref="ArgumentNullException"><paramref name="wellKnownBinary"/> is null.</exception>
88         /// <exception cref="ArgumentException"><paramref name="coordinateSystemId"/> is not valid.</exception>
FromBinary(byte[] wellKnownBinary, int coordinateSystemId)89         public static DbGeometry FromBinary(byte[] wellKnownBinary, int coordinateSystemId)
90         {
91             wellKnownBinary.CheckNull("wellKnownBinary");
92             return DbSpatialServices.Default.GeometryFromBinary(wellKnownBinary, coordinateSystemId);
93         }
94 
95         /// <summary>
96         /// Creates a new <see cref="DbGeometry"/> line value based on the specified well known binary value and coordinate system identifier (SRID).
97         /// </summary>
98         /// <param name="lineWellKnownBinary">A byte array that contains a well known binary representation of the geometry value.</param>
99         /// <param name="coordinateSystemId">The identifier of the coordinate system that the new DbGeometry value should use.</param>
100         /// <returns>A new DbGeometry value as defined by the well known binary value with the specified coordinate system identifier.</returns>
101         /// <exception cref="ArgumentNullException"><paramref name="lineWellKnownBinary"/> is null.</exception>
102         /// <exception cref="ArgumentException"><paramref name="coordinateSystemId"/> is not valid.</exception>
LineFromBinary(byte[] lineWellKnownBinary, int coordinateSystemId)103         public static DbGeometry LineFromBinary(byte[] lineWellKnownBinary, int coordinateSystemId)
104         {
105             lineWellKnownBinary.CheckNull("lineWellKnownBinary");
106             return DbSpatialServices.Default.GeometryLineFromBinary(lineWellKnownBinary, coordinateSystemId);
107         }
108 
109         /// <summary>
110         /// Creates a new <see cref="DbGeometry"/> point value based on the specified well known binary value and coordinate system identifier (SRID).
111         /// </summary>
112         /// <param name="pointWellKnownBinary">A byte array that contains a well known binary representation of the geometry value.</param>
113         /// <param name="coordinateSystemId">The identifier of the coordinate system that the new DbGeometry value should use.</param>
114         /// <returns>A new DbGeometry value as defined by the well known binary value with the specified coordinate system identifier.</returns>
115         /// <exception cref="ArgumentNullException"><paramref name="pointWellKnownBinary"/> is null.</exception>
116         /// <exception cref="ArgumentException"><paramref name="coordinateSystemId"/> is not valid.</exception>
PointFromBinary(byte[] pointWellKnownBinary, int coordinateSystemId)117         public static DbGeometry PointFromBinary(byte[] pointWellKnownBinary, int coordinateSystemId)
118         {
119             pointWellKnownBinary.CheckNull("pointWellKnownBinary");
120             return DbSpatialServices.Default.GeometryPointFromBinary(pointWellKnownBinary, coordinateSystemId);
121         }
122 
123         /// <summary>
124         /// Creates a new <see cref="DbGeometry"/> polygon value based on the specified well known binary value and coordinate system identifier (SRID).
125         /// </summary>
126         /// <param name="polygonWellKnownBinary">A byte array that contains a well known binary representation of the geometry value.</param>
127         /// <param name="coordinateSystemId">The identifier of the coordinate system that the new DbGeometry value should use.</param>
128         /// <returns>A new DbGeometry value as defined by the well known binary value with the specified coordinate system identifier.</returns>
129         /// <exception cref="ArgumentNullException"><paramref name="polygonWellKnownBinary"/> is null.</exception>
130         /// <exception cref="ArgumentException"><paramref name="coordinateSystemId"/> is not valid.</exception>
PolygonFromBinary(byte[] polygonWellKnownBinary, int coordinateSystemId)131         public static DbGeometry PolygonFromBinary(byte[] polygonWellKnownBinary, int coordinateSystemId)
132         {
133             polygonWellKnownBinary.CheckNull("polygonWellKnownBinary");
134             return DbSpatialServices.Default.GeometryPolygonFromBinary(polygonWellKnownBinary, coordinateSystemId);
135         }
136 
137         /// <summary>
138         /// Creates a new <see cref="DbGeometry"/> multi-line value based on the specified well known binary value and coordinate system identifier (SRID).
139         /// </summary>
140         /// <param name="multiLineWellKnownBinary">A byte array that contains a well known binary representation of the geometry value.</param>
141         /// <param name="coordinateSystemId">The identifier of the coordinate system that the new DbGeometry value should use.</param>
142         /// <returns>A new DbGeometry value as defined by the well known binary value with the specified coordinate system identifier.</returns>
143         /// <exception cref="ArgumentNullException"><paramref name="multiLineWellKnownBinary"/> is null.</exception>
144         /// <exception cref="ArgumentException"><paramref name="coordinateSystemId"/> is not valid.</exception>
145         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "MultiLine", Justification = "Match OGC, EDM")]
146         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multi", Justification = "Match OGC, EDM")]
147         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "multiLine", Justification = "Match OGC, EDM")]
148         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "multi", Justification = "Match OGC, EDM")]
MultiLineFromBinary(byte[] multiLineWellKnownBinary, int coordinateSystemId)149         public static DbGeometry MultiLineFromBinary(byte[] multiLineWellKnownBinary, int coordinateSystemId)
150         {
151             multiLineWellKnownBinary.CheckNull("multiLineWellKnownBinary");
152             return DbSpatialServices.Default.GeometryMultiLineFromBinary(multiLineWellKnownBinary, coordinateSystemId);
153         }
154 
155         /// <summary>
156         /// Creates a new <see cref="DbGeometry"/> multi-point value based on the specified well known binary value and coordinate system identifier (SRID).
157         /// </summary>
158         /// <param name="multiPointWellKnownBinary">A byte array that contains a well known binary representation of the geometry value.</param>
159         /// <param name="coordinateSystemId">The identifier of the coordinate system that the new DbGeometry value should use.</param>
160         /// <returns>A new DbGeometry value as defined by the well known binary value with the specified coordinate system identifier.</returns>
161         /// <exception cref="ArgumentNullException"><paramref name="multiPointWellKnownBinary"/> is null.</exception>
162         /// <exception cref="ArgumentException"><paramref name="coordinateSystemId"/> is not valid.</exception>
163         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "MultiPoint", Justification = "Match OGC, EDM")]
164         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multi", Justification = "Match OGC, EDM")]
165         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "multiPoint", Justification = "Match OGC, EDM")]
166         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "multi", Justification = "Match OGC, EDM")]
MultiPointFromBinary(byte[] multiPointWellKnownBinary, int coordinateSystemId)167         public static DbGeometry MultiPointFromBinary(byte[] multiPointWellKnownBinary, int coordinateSystemId)
168         {
169             multiPointWellKnownBinary.CheckNull("multiPointWellKnownBinary");
170             return DbSpatialServices.Default.GeometryMultiPointFromBinary(multiPointWellKnownBinary, coordinateSystemId);
171         }
172 
173         /// <summary>
174         /// Creates a new <see cref="DbGeometry"/> multi-polygon value based on the specified well known binary value and coordinate system identifier (SRID).
175         /// </summary>
176         /// <param name="multiPolygonWellKnownBinary">A byte array that contains a well known binary representation of the geometry value.</param>
177         /// <param name="coordinateSystemId">The identifier of the coordinate system that the new DbGeometry value should use.</param>
178         /// <returns>A new DbGeometry value as defined by the well known binary value with the specified coordinate system identifier.</returns>
179         /// <exception cref="ArgumentNullException"><paramref name="multiPolygonWellKnownBinary"/> is null.</exception>
180         /// <exception cref="ArgumentException"><paramref name="coordinateSystemId"/> is not valid.</exception>
181         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multi", Justification = "Match OGC, EDM")]
182         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "multi", Justification = "Match OGC, EDM")]
MultiPolygonFromBinary(byte[] multiPolygonWellKnownBinary, int coordinateSystemId)183         public static DbGeometry MultiPolygonFromBinary(byte[] multiPolygonWellKnownBinary, int coordinateSystemId)
184         {
185             multiPolygonWellKnownBinary.CheckNull("multiPolygonWellKnownBinary");
186             return DbSpatialServices.Default.GeometryMultiPolygonFromBinary(multiPolygonWellKnownBinary, coordinateSystemId);
187         }
188 
189         /// <summary>
190         /// Creates a new <see cref="DbGeometry"/> collection value based on the specified well known binary value and coordinate system identifier (SRID).
191         /// </summary>
192         /// <param name="geometryCollectionWellKnownBinary">A byte array that contains a well known binary representation of the geometry value.</param>
193         /// <param name="coordinateSystemId">The identifier of the coordinate system that the new DbGeometry value should use.</param>
194         /// <returns>A new DbGeometry value as defined by the well known binary value with the specified coordinate system identifier.</returns>
195         /// <exception cref="ArgumentNullException"><paramref name="geometryCollectionWellKnownBinary"/> is null.</exception>
196         /// <exception cref="ArgumentException"><paramref name="coordinateSystemId"/> is not valid.</exception>
GeometryCollectionFromBinary(byte[] geometryCollectionWellKnownBinary, int coordinateSystemId)197         public static DbGeometry GeometryCollectionFromBinary(byte[] geometryCollectionWellKnownBinary, int coordinateSystemId)
198         {
199             geometryCollectionWellKnownBinary.CheckNull("geometryCollectionWellKnownBinary");
200             return DbSpatialServices.Default.GeometryCollectionFromBinary(geometryCollectionWellKnownBinary, coordinateSystemId);
201         }
202 
203         #endregion
204 
205         #region GML Static Constructors
206 
207         /// <summary>
208         /// Creates a new <see cref="DbGeometry"/> value based on the specified Geography Markup Language (GML) value.
209         /// </summary>
210         /// <param name="geometryMarkup">A string that contains a Geography Markup Language (GML) representation of the geometry value.</param>
211         /// <returns>A new DbGeometry value as defined by the GML value with the default geometry coordinate system identifier (SRID) (<see cref="DbGeometry.DefaultCoordinateSystemId"/>).</returns>
212         /// <exception cref="ArgumentNullException"><paramref name="geometryMarkup"/> is null.</exception>
213         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gml")]
FromGml(string geometryMarkup)214         public static DbGeometry FromGml(string geometryMarkup)
215         {
216             geometryMarkup.CheckNull("geometryMarkup");
217             return DbSpatialServices.Default.GeometryFromGml(geometryMarkup);
218         }
219 
220         /// <summary>
221         /// Creates a new <see cref="DbGeometry"/> value based on the specified Geography Markup Language (GML) value and coordinate system identifier (SRID).
222         /// </summary>
223         /// <param name="geometryMarkup">A string that contains a Geography Markup Language (GML) representation of the geometry value.</param>
224         /// <param name="coordinateSystemId">The identifier of the coordinate system that the new DbGeometry value should use.</param>
225         /// <returns>A new DbGeometry value as defined by the GML value with the specified coordinate system identifier.</returns>
226         /// <exception cref="ArgumentNullException"><paramref name="geometryMarkup"/> is null.</exception>
227         /// <exception cref="ArgumentException"><paramref name="coordinateSystemId"/> is not valid.</exception>
228         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gml")]
FromGml(string geometryMarkup, int coordinateSystemId)229         public static DbGeometry FromGml(string geometryMarkup, int coordinateSystemId)
230         {
231             geometryMarkup.CheckNull("geometryMarkup");
232             return DbSpatialServices.Default.GeometryFromGml(geometryMarkup, coordinateSystemId);
233         }
234 
235         #endregion
236 
237         #region Well Known Text Static Constructors
238 
239         /// <summary>
240         /// Creates a new <see cref="DbGeometry"/> value based on the specified well known text value.
241         /// </summary>
242         /// <param name="wellKnownText">A string that contains a well known text representation of the geometry value.</param>
243         /// <returns>A new DbGeometry value as defined by the well known text value with the default geometry coordinate system identifier (SRID) (<see cref="DbGeometry.DefaultCoordinateSystemId"/>).</returns>
244         /// <exception cref="ArgumentNullException"><paramref name="wellKnownText"/> is null.</exception>
FromText(string wellKnownText)245         public static DbGeometry FromText(string wellKnownText)
246         {
247             wellKnownText.CheckNull("wellKnownText");
248             return DbSpatialServices.Default.GeometryFromText(wellKnownText);
249         }
250 
251         /// <summary>
252         /// Creates a new <see cref="DbGeometry"/> value based on the specified well known text value and coordinate system identifier (SRID).
253         /// </summary>
254         /// <param name="wellKnownText">A string that contains a well known text representation of the geometry value.</param>
255         /// <param name="coordinateSystemId">The identifier of the coordinate system that the new DbGeometry value should use.</param>
256         /// <returns>A new DbGeometry value as defined by the well known text value with the specified coordinate system identifier.</returns>
257         /// <exception cref="ArgumentNullException"><paramref name="wellKnownText"/> is null.</exception>
258         /// <exception cref="ArgumentException"><paramref name="coordinateSystemId"/> is not valid.</exception>
FromText(string wellKnownText, int coordinateSystemId)259         public static DbGeometry FromText(string wellKnownText, int coordinateSystemId)
260         {
261             wellKnownText.CheckNull("wellKnownText");
262             return DbSpatialServices.Default.GeometryFromText(wellKnownText, coordinateSystemId);
263         }
264 
265         /// <summary>
266         /// Creates a new <see cref="DbGeometry"/> line value based on the specified well known text value and coordinate system identifier (SRID).
267         /// </summary>
268         /// <param name="lineWellKnownText">A string that contains a well known text representation of the geometry value.</param>
269         /// <param name="coordinateSystemId">The identifier of the coordinate system that the new DbGeometry value should use.</param>
270         /// <returns>A new DbGeometry value as defined by the well known text value with the specified coordinate system identifier.</returns>
271         /// <exception cref="ArgumentNullException"><paramref name="lineWellKnownText"/> is null.</exception>
272         /// <exception cref="ArgumentException"><paramref name="coordinateSystemId"/> is not valid.</exception>
LineFromText(string lineWellKnownText, int coordinateSystemId)273         public static DbGeometry LineFromText(string lineWellKnownText, int coordinateSystemId)
274         {
275             lineWellKnownText.CheckNull("lineWellKnownText");
276             return DbSpatialServices.Default.GeometryLineFromText(lineWellKnownText, coordinateSystemId);
277         }
278 
279         /// <summary>
280         /// Creates a new <see cref="DbGeometry"/> point value based on the specified well known text value and coordinate system identifier (SRID).
281         /// </summary>
282         /// <param name="pointWellKnownText">A string that contains a well known text representation of the geometry value.</param>
283         /// <param name="coordinateSystemId">The identifier of the coordinate system that the new DbGeometry value should use.</param>
284         /// <returns>A new DbGeometry value as defined by the well known text value with the specified coordinate system identifier.</returns>
285         /// <exception cref="ArgumentNullException"><paramref name="pointWellKnownText"/> is null.</exception>
286         /// <exception cref="ArgumentException"><paramref name="coordinateSystemId"/> is not valid.</exception>
PointFromText(string pointWellKnownText, int coordinateSystemId)287         public static DbGeometry PointFromText(string pointWellKnownText, int coordinateSystemId)
288         {
289             pointWellKnownText.CheckNull("pointWellKnownText");
290             return DbSpatialServices.Default.GeometryPointFromText(pointWellKnownText, coordinateSystemId);
291         }
292 
293         /// <summary>
294         /// Creates a new <see cref="DbGeometry"/> polygon value based on the specified well known text value and coordinate system identifier (SRID).
295         /// </summary>
296         /// <param name="polygonWellKnownText">A string that contains a well known text representation of the geometry value.</param>
297         /// <param name="coordinateSystemId">The identifier of the coordinate system that the new DbGeometry value should use.</param>
298         /// <returns>A new DbGeometry value as defined by the well known text value with the specified coordinate system identifier.</returns>
299         /// <exception cref="ArgumentNullException"><paramref name="polygonWellKnownText"/> is null.</exception>
300         /// <exception cref="ArgumentException"><paramref name="coordinateSystemId"/> is not valid.</exception>
PolygonFromText(string polygonWellKnownText, int coordinateSystemId)301         public static DbGeometry PolygonFromText(string polygonWellKnownText, int coordinateSystemId)
302         {
303             polygonWellKnownText.CheckNull("polygonWellKnownText");
304             return DbSpatialServices.Default.GeometryPolygonFromText(polygonWellKnownText, coordinateSystemId);
305         }
306 
307         /// <summary>
308         /// Creates a new <see cref="DbGeometry"/> multi-line value based on the specified well known text value and coordinate system identifier (SRID).
309         /// </summary>
310         /// <param name="multiLineWellKnownText">A string that contains a well known text representation of the geometry value.</param>
311         /// <param name="coordinateSystemId">The identifier of the coordinate system that the new DbGeometry value should use.</param>
312         /// <returns>A new DbGeometry value as defined by the well known text value with the specified coordinate system identifier.</returns>
313         /// <exception cref="ArgumentNullException"><paramref name="multiLineWellKnownText"/> is null.</exception>
314         /// <exception cref="ArgumentException"><paramref name="coordinateSystemId"/> is not valid.</exception>
315         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "MultiLine", Justification = "Match OGC, EDM")]
316         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multi", Justification = "Match OGC, EDM")]
317         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "multiLine", Justification = "Match OGC, EDM")]
318         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "multi", Justification = "Match OGC, EDM")]
MultiLineFromText(string multiLineWellKnownText, int coordinateSystemId)319         public static DbGeometry MultiLineFromText(string multiLineWellKnownText, int coordinateSystemId)
320         {
321             multiLineWellKnownText.CheckNull("multiLineWellKnownText");
322             return DbSpatialServices.Default.GeometryMultiLineFromText(multiLineWellKnownText, coordinateSystemId);
323         }
324 
325         /// <summary>
326         /// Creates a new <see cref="DbGeometry"/> multi-point value based on the specified well known text value and coordinate system identifier (SRID).
327         /// </summary>
328         /// <param name="multiPointWellKnownText">A string that contains a well known text representation of the geometry value.</param>
329         /// <param name="coordinateSystemId">The identifier of the coordinate system that the new DbGeometry value should use.</param>
330         /// <returns>A new DbGeometry value as defined by the well known text value with the specified coordinate system identifier.</returns>
331         /// <exception cref="ArgumentNullException"><paramref name="multiPointWellKnownText"/> is null.</exception>
332         /// <exception cref="ArgumentException"><paramref name="coordinateSystemId"/> is not valid.</exception>
333         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "MultiPoint", Justification = "Match OGC, EDM")]
334         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multi", Justification = "Match OGC, EDM")]
335         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "multiPoint", Justification = "Match OGC, EDM")]
336         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "multi", Justification = "Match OGC, EDM")]
MultiPointFromText(string multiPointWellKnownText, int coordinateSystemId)337         public static DbGeometry MultiPointFromText(string multiPointWellKnownText, int coordinateSystemId)
338         {
339             multiPointWellKnownText.CheckNull("multiPointWellKnownText");
340             return DbSpatialServices.Default.GeometryMultiPointFromText(multiPointWellKnownText, coordinateSystemId);
341         }
342 
343         /// <summary>
344         /// Creates a new <see cref="DbGeometry"/> multi-polygon value based on the specified well known text value and coordinate system identifier (SRID).
345         /// </summary>
346         /// <param name="multiPolygonWellKnownText">A string that contains a well known text representation of the geometry value.</param>
347         /// <param name="coordinateSystemId">The identifier of the coordinate system that the new DbGeometry value should use.</param>
348         /// <returns>A new DbGeometry value as defined by the well known text value with the specified coordinate system identifier.</returns>
349         /// <exception cref="ArgumentNullException"><paramref name="multiPolygonWellKnownText"/> is null.</exception>
350         /// <exception cref="ArgumentException"><paramref name="coordinateSystemId"/> is not valid.</exception>
351         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multi", Justification = "Match OGC, EDM")]
352         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "multi", Justification = "Match OGC, EDM")]
MultiPolygonFromText(string multiPolygonWellKnownText, int coordinateSystemId)353         public static DbGeometry MultiPolygonFromText(string multiPolygonWellKnownText, int coordinateSystemId)
354         {
355             multiPolygonWellKnownText.CheckNull("multiPolygonWellKnownText");
356             return DbSpatialServices.Default.GeometryMultiPolygonFromText(multiPolygonWellKnownText, coordinateSystemId);
357         }
358 
359         /// <summary>
360         /// Creates a new <see cref="DbGeometry"/> collection value based on the specified well known text value and coordinate system identifier (SRID).
361         /// </summary>
362         /// <param name="geometryCollectionWellKnownText">A string that contains a well known text representation of the geometry value.</param>
363         /// <param name="coordinateSystemId">The identifier of the coordinate system that the new DbGeometry value should use.</param>
364         /// <returns>A new DbGeometry value as defined by the well known text value with the specified coordinate system identifier.</returns>
365         /// <exception cref="ArgumentNullException"><paramref name="geometryCollectionWellKnownText"/> is null.</exception>
366         /// <exception cref="ArgumentException"><paramref name="coordinateSystemId"/> is not valid.</exception>
GeometryCollectionFromText(string geometryCollectionWellKnownText, int coordinateSystemId)367         public static DbGeometry GeometryCollectionFromText(string geometryCollectionWellKnownText, int coordinateSystemId)
368         {
369             geometryCollectionWellKnownText.CheckNull("geometryCollectionWellKnownText");
370             return DbSpatialServices.Default.GeometryCollectionFromText(geometryCollectionWellKnownText, coordinateSystemId);
371         }
372 
373         #endregion
374 
375         #region Geometry Instance Properties
376 
377         /// </summary>
378         /// Gets the coordinate system identifier (SRID) of the coordinate system used by this DbGeometry value.
379         /// </summary>
380         public int CoordinateSystemId { get { return this.spatialSvcs.GetCoordinateSystemId(this); } }
381 
382         /// </summary>
383         /// Gets the boundary of this DbGeometry value.
384         /// </summary>
385         public DbGeometry Boundary { get { return this.spatialSvcs.GetBoundary(this); } }
386 
387         /// <summary>
388         /// Gets the dimension of the given <see cref="DbGeometry"/> value or, if the value is a collection, the dimension of its largest element.
389         /// </summary>
390         public int        Dimension { get { return this.spatialSvcs.GetDimension(this); } }
391 
392         /// <summary>
393         /// Gets the envelope (minimum bounding box) of this DbGeometry value, as a geometry value.
394         /// </summary>
395         public DbGeometry Envelope { get { return this.spatialSvcs.GetEnvelope(this); } }
396 
397         /// </summary>
398         /// Gets the spatial type name, as a string, of this DbGeometry value.
399         /// </summary>
400         public string     SpatialTypeName { get { return this.spatialSvcs.GetSpatialTypeName(this); } }
401 
402         /// </summary>
403         /// Gets a Boolean value indicating whether this DbGeometry value represents the empty geometry.
404         /// </summary>
405         public bool IsEmpty { get { return this.spatialSvcs.GetIsEmpty(this); } }
406 
407         /// </summary>
408         /// Gets a Boolean value indicating whether this DbGeometry is simple.
409         /// </summary>
410         public bool IsSimple { get { return this.spatialSvcs.GetIsSimple(this); } }
411 
412         /// </summary>
413         /// Gets a Boolean value indicating whether this DbGeometry value is considered valid.
414         /// </summary>
415         public bool       IsValid { get { return this.spatialSvcs.GetIsValid(this); } }
416 
417         #endregion
418 
419         #region Geometry Well Known Format Conversion
420 
421         /// <summary>
422         /// Generates the well known text representation of this DbGeometry value.  Includes only X and Y coordinates for points.
423         /// </summary>
424         /// <returns>A string containing the well known text representation of this DbGeometry value.</returns>
AsText()425         public string AsText() { return this.spatialSvcs.AsText(this); }
426 
427         /// <summary>
428         /// Generates the well known text representation of this DbGeometry value.  Includes X coordinate, Y coordinate, Elevation (Z) and Measure (M) for points.
429         /// </summary>
430         /// <returns>A string containing the well known text representation of this DbGeometry value.</returns>
AsTextIncludingElevationAndMeasure()431         internal string AsTextIncludingElevationAndMeasure() { return this.spatialSvcs.AsTextIncludingElevationAndMeasure(this); }
432 
433         /// <summary>
434         /// Generates the well known binary representation of this DbGeometry value.
435         /// </summary>
436         /// <returns>A byte array containing the well known binary representation of this DbGeometry value.</returns>
AsBinary()437         public byte[] AsBinary() { return this.spatialSvcs.AsBinary(this); }
438 
439         // Non-OGC
440         /// <summary>
441         /// Generates the Geography Markup Language (GML) representation of this DbGeometry value.
442         /// </summary>
443         /// <returns>A string containing the GML representation of this DbGeometry value.</returns>
444         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gml")]
AsGml()445         public string AsGml() { return this.spatialSvcs.AsGml(this); }
446 
447         #endregion
448 
449         #region Geometry Operations - Spatial Relation
450 
451         /// <summary>
452         /// Determines whether this DbGeometry is spatially equal to the specified DbGeometry argument.
453         /// </summary>
454         /// <param name="other">The geometry value that should be compared with this geometry value for equality.</param>
455         /// <returns><c>true</c> if <paramref name="other"/> is spatially equal to this geometry value; otherwise <c>false</c>.</returns>
456         /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
SpatialEquals(DbGeometry other)457         public bool SpatialEquals(DbGeometry other)
458         {
459             other.CheckNull("other");
460             return this.spatialSvcs.SpatialEquals(this, other);
461         }
462 
463         /// <summary>
464         /// Determines whether this DbGeometry is spatially disjoint from the specified DbGeometry argument.
465         /// </summary>
466         /// <param name="other">The geometry value that should be compared with this geometry value for disjointness.</param>
467         /// <returns><c>true</c> if <paramref name="other"/> is disjoint from this geometry value; otherwise <c>false</c>.</returns>
468         /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
Disjoint(DbGeometry other)469         public bool Disjoint(DbGeometry other)
470         {
471             other.CheckNull("other");
472             return this.spatialSvcs.Disjoint(this, other);
473         }
474 
475         /// <summary>
476         /// Determines whether this DbGeometry value spatially intersects the specified DbGeometry argument.
477         /// </summary>
478         /// <param name="other">The geometry value that should be compared with this geometry value for intersection.</param>
479         /// <returns><c>true</c> if <paramref name="other"/> intersects this geometry value; otherwise <c>false</c>.</returns>
480         /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
Intersects(DbGeometry other)481         public bool Intersects(DbGeometry other)
482         {
483             other.CheckNull("other");
484             return this.spatialSvcs.Intersects(this, other);
485         }
486 
487         /// <summary>
488         /// Determines whether this DbGeometry value spatially touches the specified DbGeometry argument.
489         /// </summary>
490         /// <param name="other">The geometry value that should be compared with this geometry value.</param>
491         /// <returns><c>true</c> if <paramref name="other"/> touches this geometry value; otherwise <c>false</c>.</returns>
492         /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
Touches(DbGeometry other)493         public bool Touches(DbGeometry other)
494         {
495             other.CheckNull("other");
496             return this.spatialSvcs.Touches(this, other);
497         }
498 
499         /// <summary>
500         /// Determines whether this DbGeometry value spatially crosses the specified DbGeometry argument.
501         /// </summary>
502         /// <param name="other">The geometry value that should be compared with this geometry value.</param>
503         /// <returns><c>true</c> if <paramref name="other"/> crosses this geometry value; otherwise <c>false</c>.</returns>
504         /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
Crosses(DbGeometry other)505         public bool Crosses(DbGeometry other)
506         {
507             other.CheckNull("other");
508             return this.spatialSvcs.Crosses(this, other);
509         }
510 
511         /// <summary>
512         /// Determines whether this DbGeometry value is spatially within the specified DbGeometry argument.
513         /// </summary>
514         /// <param name="other">The geometry value that should be compared with this geometry value for containment.</param>
515         /// <returns><c>true</c> if this geometry value is within <paramref name="other"/>; otherwise <c>false</c>.</returns>
516         /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
Within(DbGeometry other)517         public bool Within(DbGeometry other)
518         {
519             other.CheckNull("other");
520             return this.spatialSvcs.Within(this, other);
521         }
522 
523         /// <summary>
524         /// Determines whether this DbGeometry value spatially contains the specified DbGeometry argument.
525         /// </summary>
526         /// <param name="other">The geometry value that should be compared with this geometry value for containment.</param>
527         /// <returns><c>true</c> if this geometry value contains <paramref name="other"/>; otherwise <c>false</c>.</returns>
528         /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
Contains(DbGeometry other)529         public bool Contains(DbGeometry other)
530         {
531             other.CheckNull("other");
532             return this.spatialSvcs.Contains(this, other);
533         }
534 
535         /// <summary>
536         /// Determines whether this DbGeometry value spatially overlaps the specified DbGeometry argument.
537         /// </summary>
538         /// <param name="other">The geometry value that should be compared with this geometry value for overlap.</param>
539         /// <returns><c>true</c> if this geometry value overlaps <paramref name="other"/>; otherwise <c>false</c>.</returns>
540         /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
Overlaps(DbGeometry other)541         public bool Overlaps(DbGeometry other)
542         {
543             other.CheckNull("other");
544             return this.spatialSvcs.Overlaps(this, other);
545         }
546 
547         /// <summary>
548         /// Determines whether this DbGeometry value spatially relates to the specified DbGeometry argument according to the
549         /// given Dimensionally Extended Nine-Intersection Model (DE-9IM) intersection pattern.
550         /// </summary>
551         /// <param name="other">The geometry value that should be compared with this geometry value for relation.</param>
552         /// <param name="matrix">A string that contains the text representation of the (DE-9IM) intersection pattern that defines the relation.</param>
553         /// <returns><c>true</c> if this geometry value relates to <paramref name="other"/> according to the specified intersection pattern matrix; otherwise <c>false</c>.</returns>
554         /// <exception cref="ArgumentNullException"><paramref name="other"/> or <paramref name="matrix"/> is null.</exception>
Relate(DbGeometry other, string matrix)555         public bool Relate(DbGeometry other, string matrix)
556         {
557             other.CheckNull("other");
558             matrix.CheckNull("matrix");
559             return this.spatialSvcs.Relate(this, other, matrix);
560         }
561 
562         #endregion
563 
564         #region Geometry Operations - Spatial Analysis
565 
566         /// <summary>
567         /// Creates a geometry value representing all points less than or equal to <paramref name="distance"/> from this DbGeometry value.
568         /// </summary>
569         /// <param name="distance">A double value specifying how far from this geometry value to buffer.</param>
570         /// <returns>A new DbGeometry value representing all points less than or equal to <paramref name="distance"/> from this geometry value.</returns>
571         /// <exception cref="ArgumentNullException"><paramref name="distance"/> is null.</exception>
Buffer(double? distance)572         public DbGeometry Buffer(double? distance)
573         {
574             if (!distance.HasValue)
575             {
576                 throw EntityUtil.ArgumentNull("distance");
577             }
578             return this.spatialSvcs.Buffer(this, distance.Value);
579         }
580 
581         /// <summary>
582         /// Computes the distance between the closest points in this DbGeometry value and another DbGeometry value.
583         /// </summary>
584         /// <param name="other">The geometry value for which the distance from this value should be computed.</param>
585         /// <returns>A double value that specifies the distance between the two closest points in this geometry value and <paramref name="other"/>.</returns>
586         /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
Distance(DbGeometry other)587         public double? Distance(DbGeometry other)
588         {
589             other.CheckNull("other");
590             return this.spatialSvcs.Distance(this, other);
591         }
592 
593         /// <summary>
594         /// Gets the convex hull of this DbGeometry value as another DbGeometry value.
595         /// </summary>
596         public DbGeometry ConvexHull { get { return this.spatialSvcs.GetConvexHull(this); } }
597 
598         /// <summary>
599         /// Computes the intersection of this DbGeometry value and another DbGeometry value.
600         /// </summary>
601         /// <param name="other">The geometry value for which the intersection with this value should be computed.</param>
602         /// <returns>A new DbGeometry value representing the intersection between this geometry value and <paramref name="other"/>.</returns>
603         /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
Intersection(DbGeometry other)604         public DbGeometry Intersection(DbGeometry other)
605         {
606             other.CheckNull("other");
607             return this.spatialSvcs.Intersection(this, other);
608         }
609 
610         /// <summary>
611         /// Computes the union of this DbGeometry value and another DbGeometry value.
612         /// </summary>
613         /// <param name="other">The geometry value for which the union with this value should be computed.</param>
614         /// <returns>A new DbGeometry value representing the union between this geometry value and <paramref name="other"/>.</returns>
615         /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
Union(DbGeometry other)616         public DbGeometry Union(DbGeometry other)
617         {
618             other.CheckNull("other");
619             return this.spatialSvcs.Union(this, other);
620         }
621 
622         /// <summary>
623         /// Computes the difference between this DbGeometry value and another DbGeometry value.
624         /// </summary>
625         /// <param name="other">The geometry value for which the difference with this value should be computed.</param>
626         /// <returns>A new DbGeometry value representing the difference between this geometry value and <paramref name="other"/>.</returns>
627         /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
Difference(DbGeometry other)628         public DbGeometry Difference(DbGeometry other)
629         {
630             other.CheckNull("other");
631             return this.spatialSvcs.Difference(this, other);
632         }
633 
634         /// <summary>
635         /// Computes the symmetric difference between this DbGeometry value and another DbGeometry value.
636         /// </summary>
637         /// <param name="other">The geometry value for which the symmetric difference with this value should be computed.</param>
638         /// <returns>A new DbGeometry value representing the symmetric difference between this geometry value and <paramref name="other"/>.</returns>
639         /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
SymmetricDifference(DbGeometry other)640         public DbGeometry SymmetricDifference(DbGeometry other)
641         {
642             other.CheckNull("other");
643             return this.spatialSvcs.SymmetricDifference(this, other);
644         }
645 
646         #endregion
647 
648         #region Geometry Collection
649 
650         /// <summary>
651         /// Gets the number of elements in this DbGeometry value, if it represents a geometry collection.
652         /// <returns>The number of elements in this geometry value, if it represents a collection of other geometry values; otherwise <c>null</c>.</returns>
653         /// </summary>
654         public int? ElementCount { get { return this.spatialSvcs.GetElementCount(this); } }
655 
656         /// <summary>
657         /// Returns an element of this DbGeometry value from a specific position, if it represents a geometry collection.
658         /// <param name="index">The position within this geometry value from which the element should be taken.</param>
659         /// <returns>The element in this geometry value at the specified position, if it represents a collection of other geometry values; otherwise <c>null</c>.</returns>
660         /// </summary>
ElementAt(int index)661         public DbGeometry ElementAt(int index)
662         {
663             return this.spatialSvcs.ElementAt(this, index);
664         }
665 
666         #endregion
667 
668         #region Point
669 
670         /// <summary>
671         /// Gets the X coordinate of this DbGeometry value, if it represents a point.
672         /// <returns>The X coordinate value of this geometry value, if it represents a point; otherwise <c>null</c>.</returns>
673         /// </summary>
674         public double? XCoordinate { get { return this.spatialSvcs.GetXCoordinate(this); } }
675 
676         /// <summary>
677         /// Gets the Y coordinate of this DbGeometry value, if it represents a point.
678         /// <returns>The Y coordinate value of this geometry value, if it represents a point; otherwise <c>null</c>.</returns>
679         /// </summary>
680         public double? YCoordinate { get { return this.spatialSvcs.GetYCoordinate(this); } }
681 
682         /// <summary>
683         /// Gets the elevation (Z coordinate) of this DbGeometry value, if it represents a point.
684         /// <returns>The elevation (Z coordinate) of this geometry value, if it represents a point; otherwise <c>null</c>.</returns>
685         /// </summary>
686         public double? Elevation { get { return this.spatialSvcs.GetElevation(this); } }
687 
688         /// <summary>
689         /// Gets the Measure (M coordinate) of this DbGeometry value, if it represents a point.
690         /// <returns>The Measure (M coordinate) value of this geometry value, if it represents a point; otherwise <c>null</c>.</returns>
691         /// </summary>
692         public double? Measure { get { return this.spatialSvcs.GetMeasure(this); } }
693 
694         #endregion
695 
696         #region Curve
697 
698         /// <summary>
699         /// Gets a nullable double value that indicates the length of this DbGeometry value, which may be null if this value does not represent a curve.
700         /// </summary>
701         public double? Length { get { return this.spatialSvcs.GetLength(this); } }
702 
703         /// <summary>
704         /// Gets a DbGeometry value representing the start point of this value, which may be null if this DbGeometry value does not represent a curve.
705         /// </summary>
706         public DbGeometry StartPoint { get { return this.spatialSvcs.GetStartPoint(this); } }
707 
708         /// <summary>
709         /// Gets a DbGeometry value representing the start point of this value, which may be null if this DbGeometry value does not represent a curve.
710         /// </summary>
711         public DbGeometry EndPoint { get { return this.spatialSvcs.GetEndPoint(this); } }
712 
713         /// <summary>
714         /// Gets a nullable Boolean value indicating whether this DbGeometry value is closed, which may be null if this value does not represent a curve.
715         /// </summary>
716         public bool? IsClosed { get { return this.spatialSvcs.GetIsClosed(this); } }
717 
718         /// <summary>
719         /// Gets a nullable Boolean value indicating whether this DbGeometry value is a ring, which may be null if this value does not represent a curve.
720         /// </summary>
721         public bool? IsRing { get { return this.spatialSvcs.GetIsRing(this); } }
722 
723         #endregion
724 
725         #region LineString, Line, LinearRing
726 
727         /// <summary>
728         /// Gets the number of points in this DbGeometry value, if it represents a linestring or linear ring.
729         /// <returns>The number of elements in this geometry value, if it represents a linestring or linear ring; otherwise <c>null</c>.</returns>
730         /// </summary>
731         public int? PointCount { get { return this.spatialSvcs.GetPointCount(this); } }
732 
733         /// <summary>
734         /// Returns an element of this DbGeometry value from a specific position, if it represents a linestring or linear ring.
735         /// <param name="index">The position within this geometry value from which the element should be taken.</param>
736         /// <returns>The element in this geometry value at the specified position, if it represents a linestring or linear ring; otherwise <c>null</c>.</returns>
737         /// </summary>
PointAt(int index)738         public DbGeometry PointAt(int index)
739         {
740             return this.spatialSvcs.PointAt(this, index);
741         }
742 
743         #endregion
744 
745         #region Surface
746 
747         /// <summary>
748         /// Gets a nullable double value that indicates the area of this DbGeometry value, which may be null if this value does not represent a surface.
749         /// </summary>
750         public double? Area { get { return this.spatialSvcs.GetArea(this); } }
751 
752         /// <summary>
753         /// Gets the DbGeometry value that represents the centroid of this DbGeometry value, which may be null if this value does not represent a surface.
754         /// </summary>
755         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Centroid", Justification = "Naming convention prescribed by OGC specification")]
756         public DbGeometry Centroid { get { return this.spatialSvcs.GetCentroid(this); } }
757 
758         /// <summary>
759         /// Gets a point on the surface of this DbGeometry value, which may be null if this value does not represent a surface.
760         /// </summary>
761         public DbGeometry PointOnSurface { get { return this.spatialSvcs.GetPointOnSurface(this); } }
762 
763         #endregion
764 
765         #region Polygon
766 
767         /// <summary>
768         /// Gets the DbGeometry value that represents the exterior ring of this DbGeometry value, which may be null if this value does not represent a polygon.
769         /// </summary>
770         public DbGeometry ExteriorRing { get { return this.spatialSvcs.GetExteriorRing(this); } }
771 
772         /// <summary>
773         /// Gets the number of interior rings in this DbGeometry value, if it represents a polygon.
774         /// <returns>The number of elements in this geometry value, if it represents a polygon; otherwise <c>null</c>.</returns>
775         /// </summary>
776         public int? InteriorRingCount { get { return this.spatialSvcs.GetInteriorRingCount(this); } }
777 
778         /// <summary>
779         /// Returns an interior ring from this DbGeometry value at a specific position, if it represents a polygon.
780         /// <param name="index">The position within this geometry value from which the interior ring should be taken.</param>
781         /// <returns>The interior ring in this geometry value at the specified position, if it represents a polygon; otherwise <c>null</c>.</returns>
782         /// </summary>
InteriorRingAt(int index)783         public DbGeometry InteriorRingAt(int index)
784         {
785             return this.spatialSvcs.InteriorRingAt(this, index);
786         }
787 
788         #endregion
789 
790         #region ToString
791         /// <summary>
792         /// Returns a string representation of the geometry value.
793         /// </summary>
ToString()794         public override string ToString()
795         {
796             return string.Format(CultureInfo.InvariantCulture, "SRID={1};{0}", this.WellKnownValue.WellKnownText ?? base.ToString(), this.CoordinateSystemId);
797         }
798         #endregion
799     }
800 }
801