Esempio n. 1
0
        public CustomWidth Add(string name)
        {
            CustomWidth customWidth = new CustomWidth();

            customWidth.Name = name;
            Add(customWidth);
            return(customWidth);
        }
        public override object GetValue(object component)
        {
            CustomWidth customWidth = (CustomWidth)component;

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

            if (Name == "FromValue")
            {
                customWidth.FromValue = Field.ToStringInvariant(value);
            }
            else
            {
                customWidth.ToValue = Field.ToStringInvariant(value);
            }
        }
Esempio n. 4
0
 public void Remove(CustomWidth value)
 {
     base.List.Remove(value);
 }
Esempio n. 5
0
 public int Add(CustomWidth value)
 {
     return(base.List.Add(value));
 }
Esempio n. 6
0
 private Field GetField(CustomWidth customWidth)
 {
     return(customWidth?.GetRule()?.GetField());
 }
        internal override void RegenerateRanges()
        {
            if (UseCustomWidths)
            {
                foreach (CustomWidth customWidth9 in CustomWidths)
                {
                    customWidth9.AffectedElements.Clear();
                }
            }
            MapCore mapCore = GetMapCore();

            if (mapCore == null || mapCore.Paths.Count == 0 || (UseCustomWidths && CustomWidths.Count == 0))
            {
                return;
            }
            if (!UseCustomWidths)
            {
                CustomWidths.Clear();
            }
            if (base.PathField == "(Name)")
            {
                if (UseCustomWidths)
                {
                    int num = 0;
                    foreach (Path path4 in mapCore.Paths)
                    {
                        if (num == CustomWidths.Count)
                        {
                            break;
                        }
                        CustomWidth customWidth = CustomWidths[num++];
                        customWidth.FromValueInt = path4.Name;
                        customWidth.ToValueInt   = path4.Name;
                    }
                }
                else
                {
                    float[] widths = GetWidths(FromWidth, ToWidth, mapCore.Paths.Count);
                    int     num2   = 0;
                    foreach (Path path5 in mapCore.Paths)
                    {
                        if (path5.Category == Category)
                        {
                            CustomWidth customWidth2 = CustomWidths.Add(string.Empty);
                            customWidth2.Width        = widths[num2++];
                            customWidth2.FromValueInt = path5.Name;
                            customWidth2.ToValueInt   = path5.Name;
                            customWidth2.Text         = base.Text;
                            customWidth2.ToolTip      = base.ToolTip;
                        }
                    }
                }
                UpdateLegend();
                return;
            }
            Field field = GetField();

            if (field == null)
            {
                return;
            }
            if (field.IsNumeric())
            {
                int    intervalCount = (!UseCustomWidths) ? WidthCount : CustomWidths.Count;
                object obj           = null;
                object obj2          = null;
                if (FromValue != string.Empty)
                {
                    obj = field.Parse(FromValue);
                }
                if (ToValue != string.Empty)
                {
                    obj2 = field.Parse(ToValue);
                }
                if (obj == null || obj2 == null)
                {
                    GetRangeFromPaths(field, intervalCount, ref obj, ref obj2);
                }
                object[] fromValues = null;
                object[] toValues   = null;
                if (DataGrouping == DataGrouping.EqualInterval)
                {
                    GetEqualIntervals(field, obj, obj2, intervalCount, ref fromValues, ref toValues);
                }
                else if (DataGrouping == DataGrouping.EqualDistribution)
                {
                    ArrayList sortedValues = GetSortedValues(field, obj, obj2);
                    GetEqualDistributionIntervals(field, sortedValues, obj, obj2, intervalCount, ref fromValues, ref toValues);
                }
                else if (DataGrouping == DataGrouping.Optimal)
                {
                    ArrayList sortedValues2 = GetSortedValues(field, obj, obj2);
                    GetOptimalIntervals(field, sortedValues2, obj, obj2, intervalCount, ref fromValues, ref toValues);
                }
                if (UseCustomWidths)
                {
                    int num3 = 0;
                    foreach (CustomWidth customWidth10 in CustomWidths)
                    {
                        if (num3 < fromValues.Length)
                        {
                            customWidth10.FromValueInt = Microsoft.Reporting.Map.WebForms.Field.ToStringInvariant(fromValues[num3]);
                            customWidth10.ToValueInt   = Microsoft.Reporting.Map.WebForms.Field.ToStringInvariant(toValues[num3]);
                            customWidth10.VisibleInt   = true;
                        }
                        else
                        {
                            customWidth10.FromValueInt = Microsoft.Reporting.Map.WebForms.Field.ToStringInvariant(toValues[toValues.Length - 1]);
                            customWidth10.ToValueInt   = Microsoft.Reporting.Map.WebForms.Field.ToStringInvariant(toValues[toValues.Length - 1]);
                            customWidth10.VisibleInt   = false;
                        }
                        num3++;
                    }
                }
                else
                {
                    float[] widths2 = GetWidths(FromWidth, ToWidth, fromValues.Length);
                    for (int i = 0; i < fromValues.Length; i++)
                    {
                        CustomWidth customWidth4 = CustomWidths.Add(string.Empty);
                        customWidth4.Width        = widths2[i];
                        customWidth4.FromValueInt = Microsoft.Reporting.Map.WebForms.Field.ToStringInvariant(fromValues[i]);
                        customWidth4.ToValueInt   = Microsoft.Reporting.Map.WebForms.Field.ToStringInvariant(toValues[i]);
                        customWidth4.Text         = base.Text;
                        customWidth4.ToolTip      = base.ToolTip;
                    }
                }
            }
            else if (field.Type == typeof(string))
            {
                Hashtable hashtable = new Hashtable();
                foreach (Path path6 in GetMapCore().Paths)
                {
                    if (path6.Category == Category)
                    {
                        string text = (string)path6[field.Name];
                        if (text != null)
                        {
                            hashtable[text] = 0;
                        }
                    }
                }
                if (UseCustomWidths)
                {
                    ArrayList arrayList = new ArrayList();
                    arrayList.AddRange(hashtable.Keys);
                    arrayList.Sort();
                    int num4 = 0;
                    foreach (object item in arrayList)
                    {
                        if (num4 == CustomWidths.Count)
                        {
                            break;
                        }
                        CustomWidth customWidth5 = CustomWidths[num4++];
                        customWidth5.FromValueInt = (string)item;
                        customWidth5.ToValueInt   = (string)item;
                    }
                }
                else
                {
                    float[] widths3 = GetWidths(FromWidth, ToWidth, hashtable.Keys.Count);
                    int     num5    = 0;
                    foreach (object key in hashtable.Keys)
                    {
                        CustomWidth customWidth6 = CustomWidths.Add(string.Empty);
                        customWidth6.Width        = widths3[num5++];
                        customWidth6.FromValueInt = (string)key;
                        customWidth6.ToValueInt   = (string)key;
                        customWidth6.Text         = base.Text;
                        customWidth6.ToolTip      = base.ToolTip;
                    }
                }
            }
            else if (UseCustomWidths)
            {
                CustomWidths[0].FromValueInt = "False";
                CustomWidths[0].ToValueInt   = "False";
                if (CustomWidths.Count > 1)
                {
                    CustomWidths[1].FromValueInt = "True";
                    CustomWidths[1].ToValueInt   = "True";
                }
            }
            else
            {
                CustomWidth customWidth7 = CustomWidths.Add(string.Empty);
                customWidth7.Width        = FromWidth;
                customWidth7.FromValueInt = "False";
                customWidth7.ToValueInt   = "False";
                customWidth7.Text         = base.Text;
                customWidth7.ToolTip      = base.ToolTip;
                CustomWidth customWidth8 = CustomWidths.Add(string.Empty);
                customWidth8.Width        = ToWidth;
                customWidth8.FromValueInt = "True";
                customWidth8.ToValueInt   = "True";
                customWidth8.Text         = base.Text;
                customWidth8.ToolTip      = base.ToolTip;
            }
            UpdateLegend();
        }