Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        /// <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;
        }
Exemplo n.º 4
0
        /// <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);
        }