} // private Layer createLayer(string id, bool vis) private void getLyrSignature(Map map, ESRI.ArcGIS.Client.Layer l) { // get all Layer parameters string typ = lyr.GetType().ToString(); string[] parts = typ.Split(new string[] { "." }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length > 0) { typ = parts[parts.Length - 1]; } lyrType = typ; lyrName = MapApplication.GetLayerName(l); popupOn = ESRI.ArcGIS.Client.Extensibility.LayerProperties.GetIsPopupEnabled(l); // sublayers popups on/off http://forums.arcgis.com/threads/58106-Popup-for-visible-layers-only?highlight=popups var ids = ESRI.ArcGIS.Mapping.Core.LayerExtensions.GetIdentifyLayerIds(l); //var ids = new System.Collections.ObjectModel.Collection<int>(); var xmlszn = new System.Xml.Serialization.XmlSerializer(typeof(System.Collections.ObjectModel.Collection <int>)); var sw = new StringWriter(); xmlszn.Serialize(sw, ids); identifyLayerIds = string.Format("{0}", sw.ToString().Trim()); if (typ == "ArcGISTiledMapServiceLayer") { var lr = (ArcGISTiledMapServiceLayer)lyr; lyrUrl = lr.Url; proxy = lr.ProxyURL; } else if (typ == "OpenStreetMapLayer") { var lr = lyr as ESRI.ArcGIS.Client.Toolkit.DataSources.OpenStreetMapLayer; lyrUrl = "http://www.openstreetmap.org/"; } else if (typ == "ArcGISDynamicMapServiceLayer") { var lr = (ArcGISDynamicMapServiceLayer)lyr; lyrUrl = lr.Url; proxy = lr.ProxyURL; imageFormat = lr.ImageFormat; } else if (typ == "FeatureLayer") { var lr = (FeatureLayer)lyr; lyrUrl = lr.Url; renderer = getRenderer(lr); proxy = lr.ProxyUrl; } else if (typ == "GraphicsLayer") { var lr = (GraphicsLayer)lyr; lyrUrl = getContent(lr); renderer = getRenderer(lr); proxy = ""; } return; } // private string getLyrSignature(Map map, ESRI.ArcGIS.Client.Layer lyr)
public VLayer(VLayerDescription ld) { lyr = null; lyrName = ld.name; lyrUrl = ld.url; lyrType = ld.type; selected = false; proxy = ld.proxy; if (ld.imageFormat == "PNG32") { imageFormat = ArcGISDynamicMapServiceLayer.RestImageFormat.PNG32; } helpCreateLayer(ld.id, true); } // public VLayer(VLayerDescription ld)
} // public VLayer(VLayerDescription ld) public VLayer(JsonObject js) //var vLyr = new VLayer(jsLyr); { lyr = null; lyrName = js["name"]; lyrUrl = js["url"]; lyrType = js["type"]; proxy = getFromJson(js, "proxy"); selected = getBoolFromJson(js, "selected"); popupOn = getBoolFromJson(js, "popupEnabled"); identifyLayerIds = getFromJson(js, "identifyLayerIds"); renderer = getFromJson(js, "renderer"); try { _opacity = getFromJson(js, "opacity"); } catch (Exception ex) { string.Format("VLayer(JsonObject) can't find 'opacity': {0}", ex.Message).clog(); } try { imageFormat = (ArcGISDynamicMapServiceLayer.RestImageFormat)(int) getFromJson(js, "ImageFormat"); } catch (Exception ex) { string.Format("VLayer(JsonObject) can't find 'ImageFormat': {0}", ex.Message).clog(); } helpCreateLayer(js["id"], js["visible"]); } // public VLayer(JsonObject js)