private SimpleFeature.GeomtryTypes.Point GetPoint(string wkt) { OpenSMIL.Server.SimpleFeature.IO.SimpleWKTReader wktReader = new SimpleWKTReader(); ISimpleGeometry geometry = wktReader.Parse(wkt); return(geometry.Centroid); }
private static Binary GetBinary(ISimpleGeometry geometry) { if (geometry == null) { return(null); } Binary ret = null; var sgw = geometry as SqlServer.SqlGeography; if ((sgw == null) || !sgw.CoordinateSystem.IsEquivalentTo(ServiceLocator.Current.GetInstance <ICoordinateSystemProvider>().Wgs84)) { var b = new SqlServer.SqlGeometryBuilder(ServiceLocator.Current.GetInstance <ICoordinateSystemProvider>().Wgs84); geometry.Populate(b); sgw = (SqlServer.SqlGeography)b.ConstructedGeometry; } using (var ms = new MemoryStream()) using (var bw = new BinaryWriter(ms)) { ((SqlTypes.SqlGeography)sgw).Write(bw); ret = new Binary(ms.ToArray()); } return(ret); }
/// <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(SqlGeometry.ToGeometry(this).Contains(geometry)); }
private void ConvertFullRecordField(Types.AbstractRecord fullRecord, IRecord record, Filter.XPathTypeNavigator navigator) { var r = fullRecord as Types.Record; if (navigator.LocalName == "BoundingBox") { object value = navigator.GetValue(record); if (value == null) { return; } // Covariance is a feature of .NET 4.0 http://msdn.microsoft.com/en-us/library/dd233059.aspx var ensg = value as IEnumerable <ISimpleGeometry>; if (ensg == null) { var geom = value as ISimpleGeometry; if (geom != null) { ensg = new ISimpleGeometry[] { geom } } ; } foreach (ISimpleGeometry g in ensg) { try { var box = new Ows100.BoundingBox(); box.InitFromGeometry(g); r.BoundingBox.Add(box); } catch (Exception ex) { try { Logger.Error(CultureInfo.InvariantCulture, m => m("Exception {0} occured while creating bounding box for geometry \"{1}\". Message: \"{2}\".", ex.GetType(), g, ex.Message)); } catch (Exception eex) { Logger.Error(CultureInfo.InvariantCulture, m => m("Exception {0} occured while logging exception {1}. Message: \"{2}\".", eex.GetType(), ex.GetType(), eex.Message)); } } } return; } IList <DC11.DCelement> elements = CreateRecordField(record, navigator); foreach (DC11.DCelement e in elements) { r.Content.DCelement.Add(e); } }
private static SharpGeometry Convert(ISimpleGeometry geometry) { var sg = geometry as SharpGeometry; if (sg != null) { return(sg); } var sgb = new SharpGeometryBuilder(); geometry.Populate(sgb); return((SharpGeometry)sgb.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="SqlGeometry" />.</summary> /// <param name="geometry">The geometry to convert.</param> /// <returns>The converted geometry.</returns> public static SqlGeometry ToGeometry(ISimpleGeometry geometry) { var sg = geometry as SqlGeometry; if (sg != null) { return(sg); } var sgb = new SqlGeometryBuilderWrapper(); geometry.Populate(sgb); return(sgb.ConstructedGeometry); }
/// <summary>Fills the current bounding box with the specified geometry information.</summary> /// <param name="g">THe geometry to fill this bounding box with.</param> public void InitFromGeometry(ISimpleGeometry g) { if (g == null) { LowerCorner = null; UpperCorner = null; return; } CoordinateSystem = g.CoordinateSystem; var lc = new List <double>(2); var uc = new List <double>(2); ISimpleGeometry env = g.Envelope(); var envelope = env as Gml.V311.Envelope; if (envelope == null) { envelope = new Gml.V311.Envelope(); env.Populate(envelope); } Debug.Assert(envelope != null); lc.Add(envelope.lowerCorner.TypedValue[0]); lc.Add(envelope.lowerCorner.TypedValue[1]); uc.Add(envelope.upperCorner.TypedValue[0]); uc.Add(envelope.upperCorner.TypedValue[1]); // Bug in LinqToXsd : serialization is culture dependent... //LowerCorner=lc; //UpperCorner=uc; LowerCorner = new List <double>(); foreach (XElement el in Untyped.Descendants("{http://www.opengis.net/ows}LowerCorner")) { el.Value = string.Join( " ", lc.Select <double, string>(d => d.ToString(CultureInfo.InvariantCulture)) ); } UpperCorner = new List <double>(); foreach (XElement el in Untyped.Descendants("{http://www.opengis.net/ows}UpperCorner")) { el.Value = string.Join( " ", uc.Select <double, string>(d => d.ToString(CultureInfo.InvariantCulture)) ); } }
private static FdoGeometry Convert(ISimpleGeometry geometry) { var sg = geometry as FdoGeometry; if (sg != null) { return(sg.Clone()); } var sgb = new FdoGeometryBuilder(); geometry.Populate(sgb); return(sgb.ConstructedGeometry); }
/// <summary>Fills the current bounding box with the specified geometry information.</summary> /// <param name="g">THe geometry to fill this bounding box with.</param> public void InitFromGeometry(ISimpleGeometry g) { if (g==null) { LowerCorner=null; UpperCorner=null; return; } CoordinateSystem=g.CoordinateSystem; var lc=new List<double>(2); var uc=new List<double>(2); ISimpleGeometry env=g.Envelope(); var envelope=env as Gml.V311.Envelope; if (envelope==null) { envelope=new Gml.V311.Envelope(); env.Populate(envelope); } Debug.Assert(envelope!=null); lc.Add(envelope.lowerCorner.TypedValue[0]); lc.Add(envelope.lowerCorner.TypedValue[1]); uc.Add(envelope.upperCorner.TypedValue[0]); uc.Add(envelope.upperCorner.TypedValue[1]); // Bug in LinqToXsd : serialization is culture dependent... //LowerCorner=lc; //UpperCorner=uc; LowerCorner=new List<double>(); foreach (XElement el in Untyped.Descendants("{http://www.opengis.net/ows}LowerCorner")) el.Value=string.Join( " ", lc.Select<double, string>(d => d.ToString(CultureInfo.InvariantCulture)) ); UpperCorner=new List<double>(); foreach (XElement el in Untyped.Descendants("{http://www.opengis.net/ows}UpperCorner")) el.Value=string.Join( " ", uc.Select<double, string>(d => d.ToString(CultureInfo.InvariantCulture)) ); }
/// <summary>Fills the current bounding box with the specified geometry information.</summary> /// <param name="g">THe geometry to fill this bounding box with.</param> public void InitFromGeometry(ISimpleGeometry g) { if (g == null) { westBoundLongitude = null; eastBoundLongitude = null; southBoundLatitude = null; northBoundLatitude = null; return; } var lc = new List <decimal>(2); var uc = new List <decimal>(2); // Make sure it is WGS 84, and a GML 3.1.1 instance var builder = new Ogc.Gml.V311.GmlGeometryBuilder(CommonServiceLocator.GetCoordinateSystemProvider().Wgs84); g.Populate(builder); var envelope = builder.ConstructedGeometry.Envelope() as Ogc.Gml.V311.Envelope; lc.Add(Convert.ToDecimal(envelope.lowerCorner.TypedValue[0])); lc.Add(Convert.ToDecimal(envelope.lowerCorner.TypedValue[1])); uc.Add(Convert.ToDecimal(envelope.upperCorner.TypedValue[0])); uc.Add(Convert.ToDecimal(envelope.upperCorner.TypedValue[1])); westBoundLongitude = new Gco.Decimal_PropertyType() { Decimal = new Gco.Decimal(lc[0]) }; eastBoundLongitude = new Gco.Decimal_PropertyType() { Decimal = new Gco.Decimal(uc[0]) }; southBoundLatitude = new Gco.Decimal_PropertyType() { Decimal = new Gco.Decimal(lc[1]) }; northBoundLatitude = new Gco.Decimal_PropertyType() { Decimal = new Gco.Decimal(uc[1]) }; }
private void _WriteBox() { var geometry = _Tap as ISimpleGeometry; if (geometry != null) { ISimpleGeometry envelope = null; try { envelope = geometry.Envelope(); } catch { // Empty } if (envelope != null) { var sink = new JsonEnvelopeSink(_Writer); envelope.Populate(sink); } } }
/// <summary>Fills the current bounding box with the specified geometry information.</summary> /// <param name="g">THe geometry to fill this bounding box with.</param> public void InitFromGeometry(ISimpleGeometry g) { if (g==null) { westBoundLongitude=null; eastBoundLongitude=null; southBoundLatitude=null; northBoundLatitude=null; return; } var lc=new List<decimal>(2); var uc=new List<decimal>(2); // Make sure it is WGS 84, and a GML 3.1.1 instance var builder=new Ogc.Gml.V311.GmlGeometryBuilder(CommonServiceLocator.GetCoordinateSystemProvider().Wgs84); g.Populate(builder); var envelope=builder.ConstructedGeometry.Envelope() as Ogc.Gml.V311.Envelope; lc.Add(Convert.ToDecimal(envelope.lowerCorner.TypedValue[0])); lc.Add(Convert.ToDecimal(envelope.lowerCorner.TypedValue[1])); uc.Add(Convert.ToDecimal(envelope.upperCorner.TypedValue[0])); uc.Add(Convert.ToDecimal(envelope.upperCorner.TypedValue[1])); westBoundLongitude=new Gco.Decimal_PropertyType() { Decimal=new Gco.Decimal(lc[0]) }; eastBoundLongitude=new Gco.Decimal_PropertyType() { Decimal=new Gco.Decimal(uc[0]) }; southBoundLatitude=new Gco.Decimal_PropertyType() { Decimal=new Gco.Decimal(lc[1]) }; northBoundLatitude=new Gco.Decimal_PropertyType() { Decimal=new Gco.Decimal(uc[1]) }; }
/// <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) { SharpGeometry other=Convert(geometry); return _Geometry.Contains(other._Geometry); }
/// <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) { SqlGeometry other = ToGeometry(geometry); return(_Geometry.STIntersects(other._Geometry).Value); }
/// <summary>Indicates whether the current geometry is within 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 is within the specified <paramref name="geometry" />, or else <c>false</c>.</returns> public bool Within(ISimpleGeometry geometry) { SqlGeometry other = ToGeometry(geometry); return(_Geometry.STWithin(other._Geometry).Value); }
/// <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) { SqlGeometry other = ToGeometry(geometry); return(_Geometry.STDisjoint(other._Geometry).Value); }
/// <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>Indicates whether the current geometry is within 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 is within the specified <paramref name="geometry" />, or else <c>false</c>.</returns> public bool Within(ISimpleGeometry geometry) { SpatialGeometry other=ToGeometry(geometry); return _Geometry.Within(other._Geometry); }
/// <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) { SqlGeography other=ToGeography(geometry); return _Geography.STIntersects(other._Geography).Value; }
/// <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) { throw new NotSupportedException(); }
/// <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) { SharpGeometry other = Convert(geometry); return(_Geometry.Contains(other._Geometry)); }
/// <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) { SharpGeometry other = Convert(geometry); return(_Geometry.Intersects(other._Geometry)); }
/// <summary>Indicates whether the current geometry overlaps 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 overlaps the specified <paramref name="geometry" />, or else <c>false</c>.</returns> public bool Overlaps(ISimpleGeometry geometry) { SharpGeometry other = Convert(geometry); return(_Geometry.Overlaps(other._Geometry)); }
/// <summary>Indicates whether the current geometry is within 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 is within the specified <paramref name="geometry" />, or else <c>false</c>.</returns> public bool Within(ISimpleGeometry geometry) { SharpGeometry other = Convert(geometry); return(_Geometry.Within(other._Geometry)); }
/// <summary>Indicates whether the 2 geometries touch themselves or not.</summary> /// <param name="geometry">The geometry to test against.</param> /// <returns><c>true</c> if the 2 geometries touch themselves, or else <c>false</c>.</returns> public bool Touches(ISimpleGeometry geometry) { SharpGeometry other = Convert(geometry); return(_Geometry.Touches(other._Geometry)); }
/// <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) { SharpGeometry other = Convert(geometry); return(_Geometry.Disjoint(other._Geometry)); }
/// <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) { SharpGeometry other=Convert(geometry); return _Geometry.Intersects(other._Geometry); }
/// <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) { SqlGeography other=ToGeography(geometry); return _Geography.STDistance(other._Geography).Value; }
/// <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); }
/// <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) { using (FdoGeometry other=Convert(geometry)) return FSpatial.SpatialUtility.Evaluate(_Geometry, FFilter.SpatialOperations.SpatialOperations_Contains, other._Geometry); }
/// <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) { SpatialGeometry other=ToGeometry(geometry); return _Geometry.Intersects(other._Geometry); }
private static FdoGeometry Convert(ISimpleGeometry geometry) { var sg=geometry as FdoGeometry; if (sg!=null) return sg.Clone(); var sgb=new FdoGeometryBuilder(); geometry.Populate(sgb); return sgb.ConstructedGeometry; }
/// <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) { SharpGeometry other = Convert(geometry); return(_Geometry.Distance(other._Geometry)); }
/// <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>Indicates whether the 2 geometries touch themselves or not.</summary> /// <param name="geometry">The geometry to test against.</param> /// <returns><c>true</c> if the 2 geometries touch themselves, or else <c>false</c>.</returns> public bool Touches(ISimpleGeometry geometry) { SqlGeometry other = ToGeometry(geometry); return(_Geometry.STTouches(other._Geometry).Value); }
/// <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 current geometry overlaps 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 overlaps the specified <paramref name="geometry" />, or else <c>false</c>.</returns> public bool Overlaps(ISimpleGeometry geometry) { SqlGeometry other = ToGeometry(geometry); return(_Geometry.STOverlaps(other._Geometry).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)); }
/// <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) { SqlGeometry other = ToGeometry(geometry); return(_Geometry.STContains(other._Geometry).Value); }
private static SharpGeometry Convert(ISimpleGeometry geometry) { var sg=geometry as SharpGeometry; if (sg!=null) return sg; var sgb=new SharpGeometryBuilder(); geometry.Populate(sgb); return (SharpGeometry)sgb.ConstructedGeometry; }
private static byte[] GetBinary(ISimpleGeometry geometry) { if (geometry==null) return null; byte[] ret=null; var sgw=geometry as SqlServer.SqlGeometry; if ((sgw==null) || !sgw.CoordinateSystem.IsEquivalentTo(ServiceLocator.Current.GetInstance<ICoordinateSystemProvider>().Wgs84)) { var b=new SqlServer.SqlGeometryBuilder(ServiceLocator.Current.GetInstance<ICoordinateSystemProvider>().Wgs84); geometry.Populate(b); sgw=(SqlServer.SqlGeometry)b.ConstructedGeometry; } using (var ms=new MemoryStream()) using (var bw=new BinaryWriter(ms)) { ((SqlTypes.SqlGeometry)sgw).Write(bw); ret=ms.ToArray(); } return ret; }
/// <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) { SpatialGeometry other=ToGeometry(geometry); return _Geometry.Disjoint(other._Geometry); }
/// <summary>Indicates whether the current geometry overlaps 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 overlaps the specified <paramref name="geometry" />, or else <c>false</c>.</returns> public bool Overlaps(ISimpleGeometry geometry) { SharpGeometry other=Convert(geometry); return _Geometry.Overlaps(other._Geometry); }
/// <summary>Indicates whether the current geometry is within 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 is within the specified <paramref name="geometry" />, or else <c>false</c>.</returns> public bool Within(ISimpleGeometry geometry) { SharpGeometry other=Convert(geometry); return _Geometry.Within(other._Geometry); }
/// <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) { SqlGeography other=ToGeography(geometry); return _Geography.STDisjoint(other._Geography).Value; }
/// <summary>Indicates whether the 2 geometries touch themselves or not.</summary> /// <param name="geometry">The geometry to test against.</param> /// <returns><c>true</c> if the 2 geometries touch themselves, or else <c>false</c>.</returns> public bool Touches(ISimpleGeometry geometry) { SqlGeometry other=ToGeometry(geometry); return _Geometry.STTouches(other._Geometry).Value; }
/// <summary>Converts the specified <paramref name="geometry" /> into a <see cref="SqlGeography" />.</summary> /// <param name="geometry">The geometry to convert.</param> /// <returns>The converted geometry.</returns> public static SqlGeography ToGeography(ISimpleGeometry geometry) { var sg=geometry as SqlGeography; if (sg!=null) return sg; var sgb=new SqlGeographyBuilderWrapper(); geometry.Populate(sgb); return sgb.ConstructedGeometry; }
/// <summary>Indicates whether the current geometry is within 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 is within the specified <paramref name="geometry" />, or else <c>false</c>.</returns> public bool Within(ISimpleGeometry geometry) { SqlGeometry other=ToGeometry(geometry); return _Geometry.STWithin(other._Geometry).Value; }
/// <summary>Indicates whether the 2 geometries touch themselves or not.</summary> /// <param name="geometry">The geometry to test against.</param> /// <returns><c>true</c> if the 2 geometries touch themselves, or else <c>false</c>.</returns> public bool Touches(ISimpleGeometry geometry) { SpatialGeometry other=ToGeometry(geometry); return _Geometry.Touches(other._Geometry); }
/// <summary>Indicates whether the current geometry overlaps 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 overlaps the specified <paramref name="geometry" />, or else <c>false</c>.</returns> public bool Overlaps(ISimpleGeometry geometry) { SqlGeometry other=ToGeometry(geometry); return _Geometry.STOverlaps(other._Geometry).Value; }
/// <summary>Indicates whether the current geometry overlaps 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 overlaps the specified <paramref name="geometry" />, or else <c>false</c>.</returns> public bool Overlaps(ISimpleGeometry geometry) { SpatialGeometry other=ToGeometry(geometry); return _Geometry.Overlaps(other._Geometry); }
/// <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) { SqlGeometry other=ToGeometry(geometry); return _Geometry.STContains(other._Geometry).Value; }
/// <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) { SpatialGeometry other=ToGeometry(geometry); return _Geometry.Contains(other._Geometry); }
/// <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) { SqlGeometry other = ToGeometry(geometry); return(_Geometry.STDistance(other._Geometry).Value); }
/// <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) { SpatialGeometry other=ToGeometry(geometry); return _Geometry.Distance(other._Geometry).Value; }
/// <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) { using (FdoGeometry other = Convert(geometry)) return(FSpatial.SpatialUtility.Evaluate(_Geometry, FFilter.SpatialOperations.SpatialOperations_Contains, other._Geometry)); }
private void ConvertFullRecordField(Types.AbstractRecord fullRecord, IRecord record, Filter.XPathTypeNavigator navigator) { var r=fullRecord as Types.Record; if (navigator.LocalName=="BoundingBox") { object value=navigator.GetValue(record); if (value==null) return; // Covariance is a feature of .NET 4.0 http://msdn.microsoft.com/en-us/library/dd233059.aspx var ensg=value as IEnumerable<ISimpleGeometry>; if (ensg==null) { var geom=value as ISimpleGeometry; if (geom!=null) ensg=new ISimpleGeometry[] { geom }; } foreach (ISimpleGeometry g in ensg) { try { var box=new Ows100.BoundingBox(); box.InitFromGeometry(g); r.BoundingBox.Add(box); } catch (Exception ex) { try { Logger.Error(CultureInfo.InvariantCulture, m => m("Exception {0} occured while creating bounding box for geometry \"{1}\". Message: \"{2}\".", ex.GetType(), g, ex.Message)); } catch (Exception eex) { Logger.Error(CultureInfo.InvariantCulture, m => m("Exception {0} occured while logging exception {1}. Message: \"{2}\".", eex.GetType(), ex.GetType(), eex.Message)); } } } return; } IList<DC11.DCelement> elements=CreateRecordField(record, navigator); foreach (DC11.DCelement e in elements) r.Content.DCelement.Add(e); }
/// <summary>Indicates whether the 2 geometries touch themselves or not.</summary> /// <param name="geometry">The geometry to test against.</param> /// <returns><c>true</c> if the 2 geometries touch themselves, or else <c>false</c>.</returns> public bool Touches(ISimpleGeometry geometry) { SharpGeometry other=Convert(geometry); return _Geometry.Touches(other._Geometry); }