/// <summary>Generates a geometry from its GML representation.</summary> /// <param name="reader">The stream from which the geometry is deserialized. </param> void IXmlSerializable.ReadXml(XmlReader reader) { var xdoc = new XmlDocument(); xdoc.Load(reader); Gml._Geometry g = Gml._Geometry.Parse(xdoc.DocumentElement.OuterXml); var builder = new SpatialGeometryBuilder(); g.Populate(builder); _Geography = SpatialGeography.ToGeography(builder.ConstructedGeometry); }
/// <summary>Converts the specified <paramref name="geometry" /> into a <see cref="SpatialGeography" />.</summary> /// <param name="geometry">The geometry to convert.</param> /// <returns>The converted geometry.</returns> public static SpatialGeography ToGeography(ISimpleGeometry geometry) { var sg = geometry as SpatialGeography; if (sg != null) { return(sg); } var sgb = new SpatialGeometryBuilder(); geometry.Populate(sgb); return(sgb.ConstructedGeometry as SpatialGeography); }
/// <summary>Converts the specified <paramref name="geometry" /> into a <see cref="SpatialGeometry" />.</summary> /// <param name="geometry">The geometry to convert.</param> /// <returns>The converted geometry.</returns> public static SpatialGeometry ToGeometry(ISimpleGeometry geometry) { var sg=geometry as SpatialGeometry; if (sg!=null) return sg; var sgb=new SpatialGeometryBuilder(); geometry.Populate(sgb); return sgb.ConstructedGeometry as SpatialGeometry; }
/// <summary>Generates a geometry from its GML representation.</summary> /// <param name="reader">The stream from which the geometry is deserialized. </param> void IXmlSerializable.ReadXml(XmlReader reader) { var xdoc=new XmlDocument(); xdoc.Load(reader); Gml._Geometry g=Gml._Geometry.Parse(xdoc.DocumentElement.OuterXml); var builder=new SpatialGeometryBuilder(); g.Populate(builder); _Geometry=SpatialGeometry.ToGeometry(builder.ConstructedGeometry); }