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(); } } } }
public void UpdateColorSwatchAndLegend() { MapCore mapCore = base.GetMapCore(); if (mapCore != null) { Field field = this.GetField(); if (this.ShowInColorSwatch) { foreach (PredefinedSymbol predefinedSymbol3 in this.PredefinedSymbols) { if (predefinedSymbol3.Visible) { SwatchColor swatchColor = mapCore.ColorSwatchPanel.Colors.Add(""); swatchColor.automaticallyAdded = true; swatchColor.Color = predefinedSymbol3.Color; swatchColor.SecondaryColor = predefinedSymbol3.SecondaryColor; swatchColor.GradientType = predefinedSymbol3.GradientType; swatchColor.HatchStyle = predefinedSymbol3.HatchStyle; if (field != null && field.IsNumeric()) { swatchColor.FromValue = field.ConvertToDouble(field.Parse(predefinedSymbol3.FromValueInt)); swatchColor.ToValue = field.ConvertToDouble(field.Parse(predefinedSymbol3.ToValueInt)); } else { swatchColor.TextValue = predefinedSymbol3.FromValueInt; } } } } if (this.ShowInLegend != string.Empty && this.ShowInLegend != "(none)") { Legend legend = (Legend)mapCore.Legends.GetByName(this.ShowInLegend); if (legend != null) { foreach (PredefinedSymbol predefinedSymbol4 in this.PredefinedSymbols) { if (predefinedSymbol4.Visible) { LegendItem legendItem = legend.Items.Add(""); legendItem.automaticallyAdded = true; legendItem.ShadowOffset = predefinedSymbol4.ShadowOffset; legendItem.Text = this.GetLegendText(field, predefinedSymbol4.FromValueInt, predefinedSymbol4.ToValueInt); if (!string.IsNullOrEmpty(predefinedSymbol4.Image)) { LegendCell legendCell = new LegendCell(LegendCellType.Image, predefinedSymbol4.Image); legendCell.ImageTranspColor = predefinedSymbol4.ImageTransColor; legendCell.Margins.Top = 15; legendCell.Margins.Bottom = 15; LegendCell cell = new LegendCell(LegendCellType.Text, "#LEGENDTEXT", ContentAlignment.MiddleLeft); legendItem.Cells.Add(legendCell); legendItem.Cells.Add(cell); } else { legendItem.ItemStyle = LegendItemStyle.Symbol; legendItem.MarkerStyle = predefinedSymbol4.MarkerStyle; legendItem.MarkerColor = predefinedSymbol4.Color; legendItem.MarkerWidth = (float)((predefinedSymbol4.Width < 0.0010000000474974513) ? 13.0 : predefinedSymbol4.Width); legendItem.MarkerHeight = (float)((predefinedSymbol4.Height < 0.0010000000474974513) ? 13.0 : predefinedSymbol4.Height); legendItem.MarkerGradientType = predefinedSymbol4.GradientType; legendItem.MarkerHatchStyle = predefinedSymbol4.HatchStyle; legendItem.MarkerSecondaryColor = predefinedSymbol4.SecondaryColor; legendItem.MarkerBorderColor = predefinedSymbol4.BorderColor; legendItem.MarkerBorderWidth = predefinedSymbol4.BorderWidth; legendItem.MarkerBorderStyle = predefinedSymbol4.BorderStyle; } } } } } } }
public void GetOptimalIntervals(Field field, ArrayList sortedList, object fromValue, object toValue, int intervalCount, ref object[] fromValues, ref object[] toValues) { if (sortedList.Count == 0 || AspNetCore.Reporting.Map.WebForms.Field.ToStringInvariant(fromValue) == AspNetCore.Reporting.Map.WebForms.Field.ToStringInvariant(toValue)) { this.GetEqualIntervals(field, fromValue, toValue, intervalCount, ref fromValues, ref toValues); } else { intervalCount = Math.Min(intervalCount, sortedList.Count); if (intervalCount < 4) { if (intervalCount < 1) { intervalCount = 1; } this.GetEqualIntervals(field, fromValue, toValue, intervalCount, ref fromValues, ref toValues); } else { if (intervalCount > sortedList.Count - 3) { intervalCount = sortedList.Count - 3; } if (intervalCount < 4) { if (intervalCount < 1) { intervalCount = 1; } this.GetEqualIntervals(field, fromValue, toValue, intervalCount, ref fromValues, ref toValues); } else { ArrayList arrayList = new ArrayList(); for (int i = 0; i < sortedList.Count; i++) { arrayList.Add(field.ConvertToDouble(sortedList[i])); } int[] jenksBreaks = this.GetJenksBreaks(arrayList, intervalCount); fromValues = new object[jenksBreaks.Length]; toValues = new object[jenksBreaks.Length]; fromValues[0] = this.GetRoundedAverage(field, sortedList[0], sortedList[0], true); object roundedAverage = this.GetRoundedAverage(field, sortedList[jenksBreaks[0] - 1], sortedList[jenksBreaks[0]], true); toValues[0] = roundedAverage; for (int j = 1; j < fromValues.Length - 1; j++) { fromValues[j] = roundedAverage; roundedAverage = this.GetRoundedAverage(field, sortedList[jenksBreaks[j] - 1], sortedList[jenksBreaks[j]], true); toValues[j] = roundedAverage; } fromValues[fromValues.Length - 1] = roundedAverage; toValues[fromValues.Length - 1] = this.GetRoundedAverage(field, sortedList[sortedList.Count - 1], sortedList[sortedList.Count - 1], false); if (this.FromValue != string.Empty) { fromValues[0] = field.Parse(this.FromValue); } if (this.ToValue != string.Empty) { toValues[toValues.Length - 1] = field.Parse(this.ToValue); } } } } }
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(); } } } }
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(); } } } }