Beispiel #1
0
        public void UpdateAutoRanges()
        {
            foreach (PredefinedSymbol predefinedSymbol5 in this.PredefinedSymbols)
            {
                predefinedSymbol5.AffectedSymbols.Clear();
            }
            MapCore mapCore = base.GetMapCore();

            if (mapCore != null && mapCore.Symbols.Count != 0 && this.PredefinedSymbols.Count != 0)
            {
                if (this.SymbolField == "(Name)")
                {
                    int num = 0;
                    foreach (Symbol symbol3 in mapCore.Symbols)
                    {
                        if (num == this.PredefinedSymbols.Count)
                        {
                            break;
                        }
                        PredefinedSymbol predefinedSymbol2 = this.PredefinedSymbols[num++];
                        predefinedSymbol2.FromValueInt = symbol3.Name;
                        predefinedSymbol2.ToValueInt   = symbol3.Name;
                    }
                    this.UpdateColorSwatchAndLegend();
                }
                else
                {
                    Field field = this.GetField();
                    if (field != null)
                    {
                        if (field.IsNumeric())
                        {
                            int    count = this.PredefinedSymbols.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.GetRangeFromSymbols(field, count, ref obj, ref obj2);
                            }
                            object[] array  = null;
                            object[] array2 = null;
                            if (this.DataGrouping == DataGrouping.EqualInterval)
                            {
                                base.GetEqualIntervals(field, obj, obj2, count, ref array, ref array2);
                            }
                            else if (this.DataGrouping == DataGrouping.EqualDistribution)
                            {
                                ArrayList sortedValues = this.GetSortedValues(field, obj, obj2);
                                base.GetEqualDistributionIntervals(field, sortedValues, obj, obj2, count, ref array, ref array2);
                            }
                            else if (this.DataGrouping == DataGrouping.Optimal)
                            {
                                ArrayList sortedValues2 = this.GetSortedValues(field, obj, obj2);
                                base.GetOptimalIntervals(field, sortedValues2, obj, obj2, count, ref array, ref array2);
                            }
                            int num3 = 0;
                            foreach (PredefinedSymbol predefinedSymbol6 in this.PredefinedSymbols)
                            {
                                if (num3 < array.Length)
                                {
                                    predefinedSymbol6.FromValueInt = AspNetCore.Reporting.Map.WebForms.Field.ToStringInvariant(array[num3]);
                                    predefinedSymbol6.ToValueInt   = AspNetCore.Reporting.Map.WebForms.Field.ToStringInvariant(array2[num3]);
                                    predefinedSymbol6.VisibleInt   = true;
                                }
                                else
                                {
                                    predefinedSymbol6.FromValueInt = AspNetCore.Reporting.Map.WebForms.Field.ToStringInvariant(array2[array2.Length - 1]);
                                    predefinedSymbol6.ToValueInt   = AspNetCore.Reporting.Map.WebForms.Field.ToStringInvariant(array2[array2.Length - 1]);
                                    predefinedSymbol6.VisibleInt   = false;
                                }
                                num3++;
                            }
                        }
                        else if (field.Type == typeof(string))
                        {
                            Hashtable hashtable = new Hashtable();
                            foreach (Symbol symbol4 in base.GetMapCore().Symbols)
                            {
                                if (symbol4.Category == this.Category)
                                {
                                    string text = (string)symbol4[field.Name];
                                    if (text != null)
                                    {
                                        hashtable[text] = 0;
                                    }
                                }
                            }
                            ArrayList arrayList = new ArrayList();
                            arrayList.AddRange(hashtable.Keys);
                            arrayList.Sort();
                            int num4 = 0;
                            foreach (object item in arrayList)
                            {
                                if (num4 == this.PredefinedSymbols.Count)
                                {
                                    break;
                                }
                                PredefinedSymbol predefinedSymbol4 = this.PredefinedSymbols[num4++];
                                predefinedSymbol4.FromValueInt = (string)item;
                                predefinedSymbol4.ToValueInt   = (string)item;
                            }
                        }
                        else
                        {
                            this.PredefinedSymbols[0].FromValueInt = "False";
                            this.PredefinedSymbols[0].ToValueInt   = "False";
                            if (this.PredefinedSymbols.Count > 1)
                            {
                                this.PredefinedSymbols[1].FromValueInt = "True";
                                this.PredefinedSymbols[1].ToValueInt   = "True";
                            }
                        }
                        this.UpdateColorSwatchAndLegend();
                    }
                }
            }
        }
Beispiel #2
0
        public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
        {
            PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(value, false);
            GroupRule groupRule = (GroupRule)value;
            Field     field     = groupRule.GetField();
            PropertyDescriptorCollection propertyDescriptorCollection = new PropertyDescriptorCollection(null);

            for (int i = 0; i < properties.Count; i++)
            {
                if (properties[i].IsBrowsable)
                {
                    if (groupRule.UseCustomColors && (properties[i].Name == "ColorCount" || properties[i].Name == "ColoringMode" || properties[i].Name == "ColorPalette" || properties[i].Name == "FromColor" || properties[i].Name == "MiddleColor" || properties[i].Name == "ToColor" || properties[i].Name == "BorderColor" || properties[i].Name == "GradientType" || properties[i].Name == "HatchStyle" || properties[i].Name == "Text" || properties[i].Name == "ToolTip" || properties[i].Name == "SecondaryColor"))
                    {
                        propertyDescriptorCollection.Add(TypeDescriptor.CreateProperty(value.GetType(), properties[i], new ReadOnlyAttribute(true)));
                    }
                    else if (properties[i].Name == "ColorPalette" && groupRule.ColoringMode != ColoringMode.DistinctColors)
                    {
                        propertyDescriptorCollection.Add(TypeDescriptor.CreateProperty(value.GetType(), properties[i], new ReadOnlyAttribute(true)));
                    }
                    else
                    {
                        if ((properties[i].Name == "FromColor" || properties[i].Name == "MiddleColor" || properties[i].Name == "ToColor") && groupRule.ColoringMode == ColoringMode.DistinctColors)
                        {
                            propertyDescriptorCollection.Add(TypeDescriptor.CreateProperty(value.GetType(), properties[i], new ReadOnlyAttribute(true)));
                            continue;
                        }
                        if (properties[i].Name == "CustomColors" && !groupRule.UseCustomColors)
                        {
                            ArrayList arrayList = new ArrayList();
                            foreach (Attribute attribute in properties[i].Attributes)
                            {
                                if (attribute is CategoryAttribute || attribute is DescriptionAttribute)
                                {
                                    arrayList.Add(attribute);
                                }
                            }
                            propertyDescriptorCollection.Add(new ReadOnlyCollectionDescriptor(properties[i].Name, (Attribute[])arrayList.ToArray(typeof(Attribute))));
                        }
                        else if (field != null && (properties[i].Name == "FromValue" || properties[i].Name == "ToValue"))
                        {
                            if (field.IsNumeric())
                            {
                                Attribute[] array = new Attribute[properties[i].Attributes.Count];
                                properties[i].Attributes.CopyTo(array, 0);
                                GroupRulePropertyDescriptor value2 = new GroupRulePropertyDescriptor(field, properties[i].Name, array);
                                propertyDescriptorCollection.Add(value2);
                            }
                            else
                            {
                                propertyDescriptorCollection.Add(TypeDescriptor.CreateProperty(value.GetType(), properties[i], new ReadOnlyAttribute(true)));
                            }
                        }
                        else
                        {
                            propertyDescriptorCollection.Add(properties[i]);
                        }
                    }
                }
            }
            return(propertyDescriptorCollection);
        }
        public override void RegenerateRanges()
        {
            if (this.UseCustomColors)
            {
                foreach (CustomColor customColor10 in this.CustomColors)
                {
                    customColor10.AffectedElements.Clear();
                }
            }
            MapCore mapCore = base.GetMapCore();

            if (mapCore != null && mapCore.Paths.Count != 0 && (!this.UseCustomColors || this.CustomColors.Count != 0))
            {
                if (!this.UseCustomColors)
                {
                    this.CustomColors.Clear();
                }
                if (base.PathField == "(Name)")
                {
                    if (this.UseCustomColors)
                    {
                        int num = 0;
                        foreach (Path path4 in mapCore.Paths)
                        {
                            if (num == this.CustomColors.Count)
                            {
                                break;
                            }
                            CustomColor customColor2 = this.CustomColors[num++];
                            customColor2.FromValueInt = path4.Name;
                            customColor2.ToValueInt   = path4.Name;
                        }
                    }
                    else
                    {
                        Color[] colors = base.GetColors(this.ColoringMode, this.ColorPalette, this.FromColor, this.MiddleColor, this.ToColor, mapCore.Paths.Count);
                        int     num3   = 0;
                        foreach (Path path5 in mapCore.Paths)
                        {
                            if (path5.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   = path5.Name;
                                customColor3.ToValueInt     = path5.Name;
                                customColor3.Text           = base.Text;
                                customColor3.ToolTip        = base.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)
                            {
                                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.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           = base.Text;
                                    customColor5.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.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           = base.Text;
                                    customColor7.ToolTip        = base.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           = base.Text;
                            customColor8.ToolTip        = base.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           = base.Text;
                            customColor9.ToolTip        = base.ToolTip;
                        }
                        this.UpdateColorSwatchAndLegend();
                    }
                }
            }
        }
Beispiel #4
0
        public string GetLegendText(Field field, string fromValue, string toValue)
        {
            object obj  = null;
            object obj2 = null;

            if (field != null)
            {
                obj  = field.Parse(fromValue);
                obj2 = field.Parse(toValue);
            }
            else
            {
                obj  = fromValue;
                obj2 = toValue;
            }
            string empty = string.Empty;

            empty = ((!(this.LegendText == "#FROMVALUE{N0} - #TOVALUE{N0}") || (field != null && field.IsNumeric())) ? this.LegendText : "#VALUE");
            MapCore mapCore = base.GetMapCore();

            empty = mapCore.ResolveKeyword(empty, "#FROMVALUE", obj);
            empty = mapCore.ResolveKeyword(empty, "#TOVALUE", obj2);
            return(mapCore.ResolveKeyword(empty, "#VALUE", obj));
        }
        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();
                    }
                }
            }
        }