public CustomColor Add(string name)
        {
            CustomColor customColor = new CustomColor();

            customColor.Name = name;
            this.Add(customColor);
            return(customColor);
        }
        public override object GetValue(object component)
        {
            CustomColor customColor = (CustomColor)component;

            if (this.Name == "FromValue")
            {
                return(this.field.Parse(customColor.FromValue));
            }
            return(this.field.Parse(customColor.ToValue));
        }
 public void ApplyCustomColorAttributes(CustomColor customColor)
 {
     this.UseInternalProperties = true;
     this.BorderColorInt        = customColor.BorderColor;
     this.ColorInt          = customColor.Color;
     this.SecondaryColorInt = customColor.SecondaryColor;
     this.GradientTypeInt   = customColor.GradientType;
     this.HatchStyleInt     = customColor.HatchStyle;
     this.TextInt           = customColor.Text;
     this.ToolTipInt        = customColor.ToolTip;
 }
        public override void SetValue(object component, object value)
        {
            CustomColor customColor = (CustomColor)component;

            if (this.Name == "FromValue")
            {
                customColor.FromValue = Field.ToStringInvariant(value);
            }
            else
            {
                customColor.ToValue = Field.ToStringInvariant(value);
            }
        }
        private Field GetField(CustomColor customColor)
        {
            if (customColor == null)
            {
                return(null);
            }
            RuleBase rule = customColor.GetRule();

            if (rule == null)
            {
                return(null);
            }
            return(rule.GetField());
        }
Beispiel #6
0
        public void RegenerateColorRanges()
        {
            if (this.UseCustomColors)
            {
                foreach (CustomColor customColor10 in this.CustomColors)
                {
                    customColor10.AffectedElements.Clear();
                }
            }
            MapCore mapCore = base.GetMapCore();

            if (mapCore != null && mapCore.Shapes.Count != 0 && (!this.UseCustomColors || this.CustomColors.Count != 0))
            {
                if (!this.UseCustomColors)
                {
                    this.CustomColors.Clear();
                }
                if (this.ShapeField == "(Name)")
                {
                    if (this.UseCustomColors)
                    {
                        int num = 0;
                        foreach (Shape shape4 in mapCore.Shapes)
                        {
                            if (num == this.CustomColors.Count)
                            {
                                break;
                            }
                            CustomColor customColor2 = this.CustomColors[num++];
                            customColor2.FromValueInt = shape4.Name;
                            customColor2.ToValueInt   = shape4.Name;
                        }
                    }
                    else
                    {
                        Color[] colors = base.GetColors(this.ColoringMode, this.ColorPalette, this.FromColor, this.MiddleColor, this.ToColor, mapCore.Shapes.Count);
                        int     num3   = 0;
                        foreach (Shape shape5 in mapCore.Shapes)
                        {
                            if (shape5.Category == this.Category)
                            {
                                CustomColor customColor3 = this.CustomColors.Add(string.Empty);
                                customColor3.Color          = colors[num3++];
                                customColor3.SecondaryColor = this.SecondaryColor;
                                customColor3.BorderColor    = this.BorderColor;
                                customColor3.GradientType   = this.GradientType;
                                customColor3.HatchStyle     = this.HatchStyle;
                                customColor3.FromValueInt   = shape5.Name;
                                customColor3.ToValueInt     = shape5.Name;
                                customColor3.Text           = this.Text;
                                customColor3.ToolTip        = this.ToolTip;
                            }
                        }
                    }
                    this.UpdateColorSwatchAndLegend();
                }
                else
                {
                    Field field = this.GetField();
                    if (field != null)
                    {
                        if (field.IsNumeric())
                        {
                            int    intervalCount = (!this.UseCustomColors) ? this.ColorCount : this.CustomColors.Count;
                            object obj           = null;
                            object obj2          = null;
                            if (this.FromValue != string.Empty)
                            {
                                obj = field.Parse(this.FromValue);
                            }
                            if (this.ToValue != string.Empty)
                            {
                                obj2 = field.Parse(this.ToValue);
                            }
                            if (obj == null || obj2 == null)
                            {
                                this.GetRangeFromShapes(field, intervalCount, ref obj, ref obj2);
                            }
                            object[] array  = null;
                            object[] array2 = null;
                            if (this.DataGrouping == DataGrouping.EqualInterval)
                            {
                                base.GetEqualIntervals(field, obj, obj2, intervalCount, ref array, ref array2);
                            }
                            else if (this.DataGrouping == DataGrouping.EqualDistribution)
                            {
                                ArrayList sortedValues = this.GetSortedValues(field, obj, obj2);
                                base.GetEqualDistributionIntervals(field, sortedValues, obj, obj2, intervalCount, ref array, ref array2);
                            }
                            else if (this.DataGrouping == DataGrouping.Optimal)
                            {
                                ArrayList sortedValues2 = this.GetSortedValues(field, obj, obj2);
                                base.GetOptimalIntervals(field, sortedValues2, obj, obj2, intervalCount, ref array, ref array2);
                            }
                            if (this.UseCustomColors)
                            {
                                int num5 = 0;
                                foreach (CustomColor customColor11 in this.CustomColors)
                                {
                                    if (num5 < array.Length)
                                    {
                                        customColor11.FromValueInt = AspNetCore.Reporting.Map.WebForms.Field.ToStringInvariant(array[num5]);
                                        customColor11.ToValueInt   = AspNetCore.Reporting.Map.WebForms.Field.ToStringInvariant(array2[num5]);
                                        customColor11.VisibleInt   = true;
                                    }
                                    else
                                    {
                                        customColor11.FromValueInt = AspNetCore.Reporting.Map.WebForms.Field.ToStringInvariant(array2[array2.Length - 1]);
                                        customColor11.ToValueInt   = AspNetCore.Reporting.Map.WebForms.Field.ToStringInvariant(array2[array2.Length - 1]);
                                        customColor11.VisibleInt   = false;
                                    }
                                    num5++;
                                }
                            }
                            else
                            {
                                Color[] colors2 = base.GetColors(this.ColoringMode, this.ColorPalette, this.FromColor, this.MiddleColor, this.ToColor, array.Length);
                                for (int i = 0; i < array.Length; i++)
                                {
                                    CustomColor customColor5 = this.CustomColors.Add(string.Empty);
                                    customColor5.Color          = colors2[i];
                                    customColor5.SecondaryColor = this.SecondaryColor;
                                    customColor5.BorderColor    = this.BorderColor;
                                    customColor5.GradientType   = this.GradientType;
                                    customColor5.HatchStyle     = this.HatchStyle;
                                    customColor5.FromValueInt   = AspNetCore.Reporting.Map.WebForms.Field.ToStringInvariant(array[i]);
                                    customColor5.ToValueInt     = AspNetCore.Reporting.Map.WebForms.Field.ToStringInvariant(array2[i]);
                                    customColor5.Text           = this.Text;
                                    customColor5.ToolTip        = this.ToolTip;
                                }
                            }
                        }
                        else if (field.Type == typeof(string))
                        {
                            Hashtable hashtable = new Hashtable();
                            foreach (Shape shape6 in base.GetMapCore().Shapes)
                            {
                                if (shape6.Category == this.Category)
                                {
                                    string text = (string)shape6[field.Name];
                                    if (text != null)
                                    {
                                        hashtable[text] = 0;
                                    }
                                }
                            }
                            if (this.UseCustomColors)
                            {
                                ArrayList arrayList = new ArrayList();
                                arrayList.AddRange(hashtable.Keys);
                                arrayList.Sort();
                                int num6 = 0;
                                foreach (object item in arrayList)
                                {
                                    if (num6 == this.CustomColors.Count)
                                    {
                                        break;
                                    }
                                    CustomColor customColor6 = this.CustomColors[num6++];
                                    customColor6.FromValueInt = (string)item;
                                    customColor6.ToValueInt   = (string)item;
                                }
                            }
                            else
                            {
                                Color[] colors3 = base.GetColors(this.ColoringMode, this.ColorPalette, this.FromColor, this.MiddleColor, this.ToColor, hashtable.Keys.Count);
                                int     num8    = 0;
                                foreach (object key in hashtable.Keys)
                                {
                                    CustomColor customColor7 = this.CustomColors.Add(string.Empty);
                                    customColor7.Color          = colors3[num8++];
                                    customColor7.SecondaryColor = this.SecondaryColor;
                                    customColor7.BorderColor    = this.BorderColor;
                                    customColor7.GradientType   = this.GradientType;
                                    customColor7.HatchStyle     = this.HatchStyle;
                                    customColor7.FromValueInt   = (string)key;
                                    customColor7.ToValueInt     = (string)key;
                                    customColor7.Text           = this.Text;
                                    customColor7.ToolTip        = this.ToolTip;
                                }
                            }
                        }
                        else if (this.UseCustomColors)
                        {
                            this.CustomColors[0].FromValueInt = "False";
                            this.CustomColors[0].ToValueInt   = "False";
                            if (this.CustomColors.Count > 1)
                            {
                                this.CustomColors[1].FromValueInt = "True";
                                this.CustomColors[1].ToValueInt   = "True";
                            }
                        }
                        else
                        {
                            CustomColor customColor8 = this.CustomColors.Add(string.Empty);
                            customColor8.Color          = this.FromColor;
                            customColor8.SecondaryColor = this.SecondaryColor;
                            customColor8.BorderColor    = this.BorderColor;
                            customColor8.GradientType   = this.GradientType;
                            customColor8.HatchStyle     = this.HatchStyle;
                            customColor8.FromValueInt   = "False";
                            customColor8.ToValueInt     = "False";
                            customColor8.Text           = this.Text;
                            customColor8.ToolTip        = this.ToolTip;
                            CustomColor customColor9 = this.CustomColors.Add(string.Empty);
                            customColor9.Color          = this.ToColor;
                            customColor9.SecondaryColor = this.SecondaryColor;
                            customColor9.BorderColor    = this.BorderColor;
                            customColor9.GradientType   = this.GradientType;
                            customColor9.HatchStyle     = this.HatchStyle;
                            customColor9.FromValueInt   = "True";
                            customColor9.ToValueInt     = "True";
                            customColor9.Text           = this.Text;
                            customColor9.ToolTip        = this.ToolTip;
                        }
                        this.UpdateColorSwatchAndLegend();
                    }
                }
            }
        }
 protected override void OnInsertComplete(int index, object value)
 {
     base.OnInsertComplete(index, value);
     CustomColor customColor = (CustomColor)value;
 }
 public void Remove(CustomColor value)
 {
     base.List.Remove(value);
 }
 public int Add(CustomColor value)
 {
     return(base.List.Add(value));
 }