/// <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>Indicates whether the 2 geometries are disjoint or not.</summary> /// <param name="geometry">The geometry to test against.</param> /// <returns><c>true</c> if the 2 geometries are disjoint, or else <c>false</c>.</returns> public bool Disjoint(ISimpleGeometry geometry) { SpatialGeography other = ToGeography(geometry); return(_Geography.Disjoint(other._Geography)); }
/// <summary>Returns the shortest distance between any 2 points in the 2 geometries.</summary> /// <param name="geometry">The geometry to calculate the distance from.</param> /// <returns>The shortest distance between any 2 points in the 2 geometries.</returns> public double Distance(ISimpleGeometry geometry) { SpatialGeography other = ToGeography(geometry); return(_Geography.Distance(other._Geography).Value); }
/// <summary>Indicates whether the 2 geometries intersect or not.</summary> /// <param name="geometry">The geometry to test against.</param> /// <returns><c>true</c> if the 2 geometries intersect, or else <c>false</c>.</returns> public bool Intersects(ISimpleGeometry geometry) { SpatialGeography other = ToGeography(geometry); return(_Geography.Intersects(other._Geography)); }