public ChoroplethServerLayerProperties(ESRI.ArcGIS.Client.Map myMap, DashboardHelper dashboardHelper, IMapControl mapControl) { InitializeComponent(); this.myMap = myMap; this.dashboardHelper = dashboardHelper; this.mapControl = mapControl; provider = new ChoroplethServerLayerProvider(myMap); provider.FeatureLoaded += new FeatureLoadedHandler(provider_FeatureLoaded); FillComboBoxes(); mapControl.MapDataChanged += new EventHandler(mapControl_MapDataChanged); btnShapeFile.Click += new RoutedEventHandler(btnShapeFile_Click); cbxDataKey.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged); cbxShapeKey.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged); cbxValue.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged); cbxClasses.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged); rctHighColor.MouseUp += new MouseButtonEventHandler(rctHighColor_MouseUp); rctLowColor.MouseUp += new MouseButtonEventHandler(rctLowColor_MouseUp); rctFilter.MouseUp += new MouseButtonEventHandler(rctFilter_MouseUp); }
public void CreateFromXml(System.Xml.XmlElement element) { currentElement = element; if (Provider == null) { Provider = new ChoroplethServerLayerProvider(myMap); Provider.FeatureLoaded += new FeatureLoadedHandler(provider_FeatureLoaded); } base.CreateFromXml(element, Provider); foreach (System.Xml.XmlElement child in element.ChildNodes) { if (child.Name.Equals("shapeFile")) { object[] shapeFileProperties = Provider.Load(child.InnerText); if (shapeFileProperties != null) { if (shapeFileProperties.Length == 2) { boundryFilePath = shapeFileProperties[0].ToString(); FeatureLayer graphicsLayer = (FeatureLayer)shapeFileProperties[1]; // if (shapeAttributes != null) // { // cbxShapeKey.Items.Clear(); // foreach (string key in shapeAttributes.Keys) // { // cbxShapeKey.Items.Add(key); // } // } } } } } string shapefileurl = ""; foreach (System.Xml.XmlElement child in element.ChildNodes) { if (child.Name.Equals("shapeFile")) { shapefileurl = child.InnerText; } if (child.Name.Equals("selectMapFeature")) { cbxMapFeatureText = child.InnerText; } } if (shapefileurl.ToLowerInvariant() == "http://services.nationalmap.gov/arcgis/rest/services/govunits/mapserver/13" && string.IsNullOrEmpty(cbxMapFeatureText) == true) { cbxMapserverText = "NationalMap.gov - New York County Boundaries"; } else if (shapefileurl.ToLowerInvariant() == "http://services.nationalmap.gov/arcgis/rest/services/govunits/mapserver/19" && string.IsNullOrEmpty(cbxMapFeatureText) == true) { cbxMapserverText = "NationalMap.gov - Rhode Island Zip Code Boundaries"; } else if (shapefileurl.ToLowerInvariant() == "http://services.nationalmap.gov/arcgis/rest/services/govunits/mapserver/17" && string.IsNullOrEmpty(cbxMapFeatureText) == true) { cbxMapserverText = "NationalMap.gov - U.S. State Boundaries"; } else if (shapefileurl.ToLowerInvariant() == "http://services.nationalmap.gov/arcgis/rest/services/tnm_blank_us/mapserver/17" && string.IsNullOrEmpty(cbxMapFeatureText) == true) { cbxMapserverText = "NationalMap.gov - World Boundaries"; } else { string lastchar = shapefileurl.Substring(shapefileurl.Length - 1, 1); string lastonebeforechar = shapefileurl.Substring(shapefileurl.Length - 2, 1); if (char.IsNumber(lastchar, 0) == true && char.IsNumber(lastonebeforechar, 0) == false) { txtMapserverText = shapefileurl.Substring(0, shapefileurl.Length - 2); } else if (char.IsNumber(lastchar, 0) == true && char.IsNumber(lastonebeforechar, 0) == true) { txtMapserverText = shapefileurl.Substring(0, shapefileurl.Length - 3); } } string sUrl = GetformattedUrl(shapefileurl); }