public CustomWidth Add(string name)
        {
            CustomWidth customWidth = new CustomWidth();

            customWidth.Name = name;
            this.Add(customWidth);
            return(customWidth);
        }
예제 #2
0
        public override object GetValue(object component)
        {
            CustomWidth customWidth = (CustomWidth)component;

            if (this.Name == "FromValue")
            {
                return(this.field.Parse(customWidth.FromValue));
            }
            return(this.field.Parse(customWidth.ToValue));
        }
예제 #3
0
        public override void SetValue(object component, object value)
        {
            CustomWidth customWidth = (CustomWidth)component;

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

            if (rule == null)
            {
                return(null);
            }
            return(rule.GetField());
        }
        public override void RegenerateRanges()
        {
            if (this.UseCustomWidths)
            {
                foreach (CustomWidth customWidth10 in this.CustomWidths)
                {
                    customWidth10.AffectedElements.Clear();
                }
            }
            MapCore mapCore = base.GetMapCore();

            if (mapCore != null && mapCore.Paths.Count != 0 && (!this.UseCustomWidths || this.CustomWidths.Count != 0))
            {
                if (!this.UseCustomWidths)
                {
                    this.CustomWidths.Clear();
                }
                if (base.PathField == "(Name)")
                {
                    if (this.UseCustomWidths)
                    {
                        int num = 0;
                        foreach (Path path4 in mapCore.Paths)
                        {
                            if (num == this.CustomWidths.Count)
                            {
                                break;
                            }
                            CustomWidth customWidth2 = this.CustomWidths[num++];
                            customWidth2.FromValueInt = path4.Name;
                            customWidth2.ToValueInt   = path4.Name;
                        }
                    }
                    else
                    {
                        float[] widths = base.GetWidths(this.FromWidth, this.ToWidth, mapCore.Paths.Count);
                        int     num3   = 0;
                        foreach (Path path5 in mapCore.Paths)
                        {
                            if (path5.Category == this.Category)
                            {
                                CustomWidth customWidth3 = this.CustomWidths.Add(string.Empty);
                                customWidth3.Width        = widths[num3++];
                                customWidth3.FromValueInt = path5.Name;
                                customWidth3.ToValueInt   = path5.Name;
                                customWidth3.Text         = base.Text;
                                customWidth3.ToolTip      = base.ToolTip;
                            }
                        }
                    }
                    this.UpdateLegend();
                }
                else
                {
                    Field field = this.GetField();
                    if (field != null)
                    {
                        if (field.IsNumeric())
                        {
                            int    intervalCount = (!this.UseCustomWidths) ? this.WidthCount : this.CustomWidths.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)
                            {
                                base.GetRangeFromPaths(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.UseCustomWidths)
                            {
                                int num5 = 0;
                                foreach (CustomWidth customWidth11 in this.CustomWidths)
                                {
                                    if (num5 < array.Length)
                                    {
                                        customWidth11.FromValueInt = AspNetCore.Reporting.Map.WebForms.Field.ToStringInvariant(array[num5]);
                                        customWidth11.ToValueInt   = AspNetCore.Reporting.Map.WebForms.Field.ToStringInvariant(array2[num5]);
                                        customWidth11.VisibleInt   = true;
                                    }
                                    else
                                    {
                                        customWidth11.FromValueInt = AspNetCore.Reporting.Map.WebForms.Field.ToStringInvariant(array2[array2.Length - 1]);
                                        customWidth11.ToValueInt   = AspNetCore.Reporting.Map.WebForms.Field.ToStringInvariant(array2[array2.Length - 1]);
                                        customWidth11.VisibleInt   = false;
                                    }
                                    num5++;
                                }
                            }
                            else
                            {
                                float[] widths2 = base.GetWidths(this.FromWidth, this.ToWidth, array.Length);
                                for (int i = 0; i < array.Length; i++)
                                {
                                    CustomWidth customWidth5 = this.CustomWidths.Add(string.Empty);
                                    customWidth5.Width        = widths2[i];
                                    customWidth5.FromValueInt = AspNetCore.Reporting.Map.WebForms.Field.ToStringInvariant(array[i]);
                                    customWidth5.ToValueInt   = AspNetCore.Reporting.Map.WebForms.Field.ToStringInvariant(array2[i]);
                                    customWidth5.Text         = base.Text;
                                    customWidth5.ToolTip      = base.ToolTip;
                                }
                            }
                        }
                        else if (field.Type == typeof(string))
                        {
                            Hashtable hashtable = new Hashtable();
                            foreach (Path path6 in base.GetMapCore().Paths)
                            {
                                if (path6.Category == this.Category)
                                {
                                    string text = (string)path6[field.Name];
                                    if (text != null)
                                    {
                                        hashtable[text] = 0;
                                    }
                                }
                            }
                            if (this.UseCustomWidths)
                            {
                                ArrayList arrayList = new ArrayList();
                                arrayList.AddRange(hashtable.Keys);
                                arrayList.Sort();
                                int num6 = 0;
                                foreach (object item in arrayList)
                                {
                                    if (num6 == this.CustomWidths.Count)
                                    {
                                        break;
                                    }
                                    CustomWidth customWidth6 = this.CustomWidths[num6++];
                                    customWidth6.FromValueInt = (string)item;
                                    customWidth6.ToValueInt   = (string)item;
                                }
                            }
                            else
                            {
                                float[] widths3 = base.GetWidths(this.FromWidth, this.ToWidth, hashtable.Keys.Count);
                                int     num8    = 0;
                                foreach (object key in hashtable.Keys)
                                {
                                    CustomWidth customWidth7 = this.CustomWidths.Add(string.Empty);
                                    customWidth7.Width        = widths3[num8++];
                                    customWidth7.FromValueInt = (string)key;
                                    customWidth7.ToValueInt   = (string)key;
                                    customWidth7.Text         = base.Text;
                                    customWidth7.ToolTip      = base.ToolTip;
                                }
                            }
                        }
                        else if (this.UseCustomWidths)
                        {
                            this.CustomWidths[0].FromValueInt = "False";
                            this.CustomWidths[0].ToValueInt   = "False";
                            if (this.CustomWidths.Count > 1)
                            {
                                this.CustomWidths[1].FromValueInt = "True";
                                this.CustomWidths[1].ToValueInt   = "True";
                            }
                        }
                        else
                        {
                            CustomWidth customWidth8 = this.CustomWidths.Add(string.Empty);
                            customWidth8.Width        = this.FromWidth;
                            customWidth8.FromValueInt = "False";
                            customWidth8.ToValueInt   = "False";
                            customWidth8.Text         = base.Text;
                            customWidth8.ToolTip      = base.ToolTip;
                            CustomWidth customWidth9 = this.CustomWidths.Add(string.Empty);
                            customWidth9.Width        = this.ToWidth;
                            customWidth9.FromValueInt = "True";
                            customWidth9.ToValueInt   = "True";
                            customWidth9.Text         = base.Text;
                            customWidth9.ToolTip      = base.ToolTip;
                        }
                        this.UpdateLegend();
                    }
                }
            }
        }
 protected override void OnInsertComplete(int index, object value)
 {
     base.OnInsertComplete(index, value);
     CustomWidth customWidth = (CustomWidth)value;
 }
 public void Remove(CustomWidth value)
 {
     base.List.Remove(value);
 }
 public int Add(CustomWidth value)
 {
     return(base.List.Add(value));
 }