Пример #1
0
        public ChoroplethKmlLayerProperties(ESRI.ArcGIS.Client.Map myMap, DashboardHelper dashboardHelper, IMapControl mapControl)
        {
            InitializeComponent();
            this.myMap           = myMap;
            this.dashboardHelper = dashboardHelper;
            this.mapControl      = mapControl;

            Provider = new ChoroplethKmlLayerProvider(myMap);
            Provider.FeatureLoaded += new FeatureLoadedHandler(provider_FeatureLoaded);

            FillComboBoxes();
            mapControl.MapDataChanged    += new EventHandler(mapControl_MapDataChanged);
            cbxDataKey.SelectionChanged  += new SelectionChangedEventHandler(keys_SelectionChanged);
            cbxShapeKey.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged);
            cbxValue.SelectionChanged    += new SelectionChangedEventHandler(keys_SelectionChanged);
            cbxClasses.SelectionChanged  += new SelectionChangedEventHandler(keys_SelectionChanged);
            rctEdit.MouseUp += new MouseButtonEventHandler(rctEdit_MouseUp);

            #region translation;
            lblTitle.Content             = DashboardSharedStrings.GADGET_CONFIG_TITLE_CHOROPLETH;
            lblClasses.Content           = DashboardSharedStrings.GADGET_CLASSES;
            lblShapeKey.Content          = DashboardSharedStrings.GADGET_MAP_FEATURE;
            lblDataKey.Content           = DashboardSharedStrings.GADGET_MAP_DATA;
            lblValueField.Content        = DashboardSharedStrings.GADGET_MAP_VALUE;
            lblMissingValueColor.Content = DashboardSharedStrings.GADGET_MAP_COLOR_MISSING;
            lblLoValueColor.Content      = DashboardSharedStrings.GADGET_LOW_VALUE_COLOR;
            lblHiValueColor.Content      = DashboardSharedStrings.GADGET_HIGH_VALUE_COLOR;
            rctEditToolTip.Content       = DashboardSharedStrings.MAP_LAYER_EDIT;
            #endregion ;//translation
        }
Пример #2
0
        public void CreateFromXml(System.Xml.XmlElement element)
        {
            if (Provider == null)
            {
                Provider = new ChoroplethKmlLayerProvider(myMap);
                Provider.FeatureLoaded += new FeatureLoadedHandler(provider_FeatureLoaded);
            }
            base.CreateFromXml(element, Provider);
            currentElement = element;
            foreach (System.Xml.XmlElement child in element.ChildNodes)
            {
                if (child.Name.Equals("shapeFile") && BoundryFilePathExists(child.InnerText))
                {
                    object[] shapeFileProperties = Provider.Load(child.InnerText);
                    if (shapeFileProperties != null)
                    {
                        if (shapeFileProperties.Length == 2)
                        {
                            boundryFilePath = shapeFileProperties[0].ToString();
                            IDictionary <string, object> shapeAttributes = (IDictionary <string, object>)shapeFileProperties[1];

                            if (shapeAttributes != null)
                            {
                                cbxShapeKey.Items.Clear();
                                foreach (string key in shapeAttributes.Keys)
                                {
                                    cbxShapeKey.Items.Add(key);
                                }
                            }
                        }
                    }
                }

                if (child.Name.Equals("dataKey"))
                {
                    cbxDataKey.SelectionChanged -= new SelectionChangedEventHandler(keys_SelectionChanged);
                    cbxDataKey.SelectedItem      = child.InnerText;
                    cbxDataKey.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged);
                }

                if (child.Name.Equals("shapeKey"))
                {
                    cbxShapeKey.SelectionChanged -= new SelectionChangedEventHandler(keys_SelectionChanged);
                    cbxShapeKey.SelectedItem      = child.InnerText;
                    cbxShapeKey.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged);
                }

                if (child.Name.Equals("classes"))
                {
                    cbxClasses.SelectionChanged -= new SelectionChangedEventHandler(keys_SelectionChanged);
                    cbxClasses.Text              = (Provider._classCount).ToString();
                    cbxClasses.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged);
                }

                if (child.Name.Equals("value"))
                {
                    cbxValue.SelectionChanged -= new SelectionChangedEventHandler(keys_SelectionChanged);
                    cbxValue.SelectedItem      = child.InnerText;
                    cbxValue.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged);
                }

                if (child.Name.Equals("highColor"))
                {
                    rctHighColor.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(child.InnerText));
                }

                if (child.Name.Equals("lowColor"))
                {
                    rctLowColor.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(child.InnerText));
                }

                if (child.Name.Equals("missingColor"))
                {
                    rctMissingColor.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(child.InnerText));
                }
            }
        }