예제 #1
0
        /// <summary>Indicates whether the current geometry contains the specified <paramref name="geometry" /> or not.</summary>
        /// <param name="geometry">The geometry to test against.</param>
        /// <returns><c>true</c> if the current geometry contains the specified <paramref name="geometry" />, or else <c>false</c>.</returns>
        public bool Contains(ISimpleGeometry geometry)
        {
            // Transform into SqlGeometry, then calculate
            // We would do this if we dealt with geometries anyway. Not sure it makes much sense, though...

            return(SpatialGeometry.ToGeometry(this).Contains(geometry));
        }
예제 #2
0
        /// <summary>Returns the centroid for the current geometry.</summary>
        /// <returns>The centroid for the current geometry.</returns>
        public ISimpleGeometry Centroid()
        {
            // Transform into SqlGeometry, calculate, then back to SqlGeography
            // We would do this if we dealt with geometries anyway. Not sure it makes much sense, though...

            return(ToGeography(SpatialGeometry.ToGeometry(this).Centroid()));
        }
예제 #3
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);
        }