private Dictionary <string, Extent> BuildExtentOptions(IAGSObject svc) { Dictionary <string, Extent> result; try { this.BuildDocExtentOptions(); Dictionary <string, Extent> dictionary = new Dictionary <string, Extent>(); if (svc.Properties.ContainsKey("Full Extent") && this.ValidateExtent(svc.Properties["Full Extent"] as Extent)) { dictionary.Add(AfaStrings.ServiceFullExtent, svc.Properties["Full Extent"] as Extent); } if (svc.Properties.ContainsKey("Initial Extent") && this.ValidateExtent(svc.Properties["Initial Extent"] as Extent)) { dictionary.Add(AfaStrings.ServiceInitialExtent, svc.Properties["Initial Extent"] as Extent); } if (svc.Properties.ContainsKey("Extent") && this.ValidateExtent(svc.Properties["Extent"] as Extent)) { dictionary.Add(AfaStrings.ServiceExtent, svc.Properties["Extent"] as Extent); } foreach (KeyValuePair <string, Extent> current in this.DocExtentOptions) { dictionary.Add(current.Key, current.Value); } if (this.CustomExtent == null) { dictionary.Add(AfaStrings.Custom, this.DefaultExtent); } else { dictionary.Add(AfaStrings.Custom, this.CustomExtent); } result = dictionary; } catch { result = null; } return(result); }
public static string GetWKTFrom(object obj) { if (obj == null) { return(null); } string result; try { string text = ""; IAGSObject iAGSObject = obj as IAGSObject; if (iAGSObject != null) { if (iAGSObject.Properties.ContainsKey("Full Extent")) { Extent extent = iAGSObject.Properties["Full Extent"] as Extent; text = extent.SpatialReference; } else if (iAGSObject.Properties.ContainsKey("Initial Extent")) { Extent extent2 = iAGSObject.Properties["Initial Extent"] as Extent; text = extent2.SpatialReference; } else if (iAGSObject.Properties.ContainsKey("WKT")) { text = iAGSObject.Properties["WKT"].ToString(); } else if (iAGSObject.Properties.ContainsKey("WKID")) { text = iAGSObject.Properties["WKID"].ToString(); } else if (iAGSObject.Properties.ContainsKey("WKID")) { text = iAGSObject.Properties["WKID"].ToString(); } } SpatialReference spatialReference = obj as SpatialReference; if (spatialReference != null) { result = AGSSpatialReference.GetSpRefString(spatialReference); } else { Extent extent3 = obj as Extent; if (extent3 != null) { result = extent3.SpatialReference; } else { result = text; } } } catch { result = ""; } return(result); }