/// <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>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]) }; }