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 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); }
public XRootNamespace(BoundingBox root) { this.doc=new XDocument(root.Untyped); this.rootObject=root; }