Ejemplo n.º 1
0
        private void CreateThemeItems(IStyle minStyle, IStyle maxStyle, int numberOfThemeItems)
        {
            minItem = new GradientThemeItem(minStyle, string.Format("{0:g4}", minValue), string.Format("{0:g4}", minValue));
            themeItems.Add(minItem);

            maxItem = new GradientThemeItem(maxStyle, string.Format("{0:g4}", maxValue),
                                            string.Format("{0:g4}", maxValue));

            if (maxValue != minValue)                                           //don't generate in between items if min == max
            {
                double step = (maxValue - minValue) / (numberOfThemeItems - 1); //for 3 themeItems step should be halfway the data
                for (int i = 1; i <= numberOfThemeItems - 2; i++)
                {
                    double value             = minValue + i * step;
                    IStyle style             = GetStyle(value);
                    var    gradientThemeItem = new GradientThemeItem(style, string.Format("{0:g4}", value), string.Format("{0:g4}", value));
                    themeItems.Add(gradientThemeItem);
                }
            }

            themeItems.Add(maxItem);
        }
Ejemplo n.º 2
0
        public GradientTheme(string columnName, double minValue, double maxValue, IStyle minStyle, IStyle maxStyle,
                             ColorBlend fillColorBlend, ColorBlend lineColorBlend, ColorBlend textColorBlend, int numberOfClasses)
        {
            this.minValue = minValue;
            this.maxValue = maxValue;

            this.fillColorBlend = fillColorBlend;
            this.lineColorBlend = lineColorBlend;
            this.textColorBlend = textColorBlend;

            attributeName = columnName;

            //create themeitems only for the extremes. Other values are interpolated.
            minItem = new GradientThemeItem(minStyle, string.Format("{0:g4}", minValue), string.Format("{0:g4}", minValue));
            themeItems.Add(minItem);

            maxItem = new GradientThemeItem(maxStyle, string.Format("{0:g4}", maxValue),
                                            string.Format("{0:g4}", maxValue));

            double step = (maxValue - minValue) / numberOfClasses;

            for (int i = 1; i <= numberOfClasses - 2; i++)
            {
                double value             = minValue + i * step;
                IStyle style             = GetStyle(value);
                var    gradientThemeItem = new GradientThemeItem(style, string.Format("{0:g4}", value), string.Format("{0:g4}", value));
                themeItems.Add(gradientThemeItem);
            }

            themeItems.Add(maxItem);

            minColor       = ThemeHelper.ExtractFillColorFromThemeItem(minItem);
            minItem.Symbol = ((VectorStyle)minStyle).LegendSymbol;
            maxColor       = ThemeHelper.ExtractFillColorFromThemeItem(maxItem);
            maxItem.Symbol = ((VectorStyle)maxStyle).LegendSymbol;
        }
Ejemplo n.º 3
0
 public GradientThemeItem(GradientThemeItem another)
 {
     label = another.Label;
     style = (IStyle) another.Style.Clone();
     range = another.Range.Clone() as string;
 }
Ejemplo n.º 4
0
 public GradientThemeItem(GradientThemeItem another)
 {
     label = another.Label;
     style = (IStyle)another.Style.Clone();
     range = another.Range.Clone() as string;
 }
Ejemplo n.º 5
0
        private static GradientTheme GetGradientTheme(theme theme)
        {
            var themeGradient = (themeGradient)theme.Item;
            var minStyle = (IStyle)GetStyleConverter().ConvertFrom(themeGradient.minStyle);
            var maxStyle = (IStyle)GetStyleConverter().ConvertFrom(themeGradient.maxStyle);


            var gradTheme = new GradientTheme(themeGradient.columnName,
                                              themeGradient.minValue,
                                              themeGradient.maxValue,
                                              minStyle,
                                              maxStyle,
                                              // Color blend properties
                                              (themeGradient.fillColorBlends != null)
                                                  ? createColorBlendForTheme(themeGradient.fillColorBlends)
                                                  : null,
                                              (themeGradient.lineColorBlends != null)
                                                  ? createColorBlendForTheme(themeGradient.lineColorBlends)
                                                  : null,
                                              (themeGradient.textColorBlends != null)
                                                  ? createColorBlendForTheme(themeGradient.textColorBlends)
                                                  : null)
                                {
                                    NoDataValues = ConvertNoDataValues(themeGradient.noDataValues, themeGradient.noDataValueType)
                                };

            gradTheme.ThemeItems.Clear();

            foreach (themeItem gradThemeItem in themeGradient.gradientThemeItems)
            {
                var themeStyle = GetStyle(gradThemeItem);
                var gradientThemeItem = new GradientThemeItem(themeStyle, gradThemeItem.label, gradThemeItem.intervalMaxValue.ToString());
                
                gradTheme.ThemeItems.Add(gradientThemeItem);
            }

            return gradTheme;
        }