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