Exemple #1
0
        void AddRangeButton_Click(object sender, RoutedEventArgs e)
        {
            if (ClassBreaksRenderer == null)
            {
                return;
            }

            ClassBreakConfigControl classBreakConfigControl = null;

            if (ClassBreaksRenderer.Classes.Count < 1) // Empty class break set
            {
                // Assign a first class break and symbolize it using the first class break
                ClassBreakInfo newClassBreak = new ClassBreakInfo()
                {
                    MinimumValue = 0,
                    MaximumValue = 0,
                    Symbol       = ClassBreaksRenderer.DefaultSymbol != null?ClassBreaksRenderer.DefaultSymbol.CloneSymbol() : SymbolUtils.CreateDefaultSymbol(GeometryType),
                };
                classBreakConfigControl = createNewClassBreakConfigControl(newClassBreak);
                ClassBreaksRenderer.Classes.Add(newClassBreak);
            }
            else
            {
                ClassBreakInfo lastClassBreak = ClassBreaksRenderer.Classes[ClassBreaksRenderer.Classes.Count - 1];
                double         currentMaxVal  = lastClassBreak.MaximumValue;
                lastClassBreak.MaximumValue -= Math.Floor((currentMaxVal - lastClassBreak.MinimumValue) / 2); // split class break into two
                ClassBreakInfo newClassBreak = new ClassBreakInfo()
                {
                    MinimumValue = lastClassBreak.MaximumValue + 1,
                    MaximumValue = currentMaxVal,
                    Symbol       = lastClassBreak.Symbol != null?lastClassBreak.Symbol.CloneSymbol() : SymbolUtils.CreateDefaultSymbol(GeometryType),
                };
                classBreakConfigControl = createNewClassBreakConfigControl(newClassBreak);
                ClassBreaksRenderer.Classes.Add(newClassBreak);
            }

            if (ClassBreakConfigItems != null)
            {
                ClassBreakConfigItems.Items.Add(classBreakConfigControl);
                ClassBreakConfigItems.SelectedItem = classBreakConfigControl;
            }
        }
        void AddUniqueValueButton_Click(object sender, RoutedEventArgs e)
        {
            if (UniqueValueRenderer == null)
            {
                return;
            }

            UniqueValueConfigControl uniqueValueConfigControl;
            UniqueValueInfo          newUniqueValue = new UniqueValueInfo()
            {
                Value  = "",        // TODO:- set the default value based on selected attribute
                Symbol = UniqueValueRenderer.DefaultSymbol != null?UniqueValueRenderer.DefaultSymbol.CloneSymbol() : SymbolUtils.CreateDefaultSymbol(GeometryType),
            };

            uniqueValueConfigControl = createNewUniqueValueConfigControl(newUniqueValue);
            UniqueValueRenderer.Infos.Add(newUniqueValue);

            if (UniqueValueConfigItems != null)
            {
                UniqueValueConfigItems.Items.Add(uniqueValueConfigControl);
                UniqueValueConfigItems.SelectedItem = uniqueValueConfigControl;
            }
        }