public override object Clone() { var gradientTheme = new GradientTheme { AttributeName = AttributeName, minValue = minValue, maxValue = maxValue, fillColorBlend = (null != FillColorBlend) ? (ColorBlend)FillColorBlend.Clone() : null, lineColorBlend = (null != LineColorBlend) ? (ColorBlend)LineColorBlend.Clone() : null, textColorBlend = (null != TextColorBlend) ? (ColorBlend)TextColorBlend.Clone() : null, numberOfClasses = numberOfClasses, minColor = minColor, maxColor = maxColor }; gradientTheme.themeItems.AddRange(ThemeItems.Select(ti => (IThemeItem)((GradientThemeItem)ti).Clone())); gradientTheme.minItem = (GradientThemeItem)gradientTheme.themeItems.First(); gradientTheme.maxItem = (GradientThemeItem)gradientTheme.themeItems.Last(); if (NoDataValues != null) { gradientTheme.noDataValues = NoDataValues.Cast <object>().ToArray(); } return(gradientTheme); }
private IVectorStyle CalculateStyle(IVectorStyle min, IVectorStyle max, double value) { IVectorStyle style = new VectorStyle(); double dFrac = Fraction(value); float fFrac = Convert.ToSingle(dFrac); style.Enabled = (dFrac > 0.5 ? min.Enabled : max.Enabled); style.EnableOutline = (dFrac > 0.5 ? min.EnableOutline : max.EnableOutline); if (FillColorBlend != null) { style.Fill = new System.Drawing.SolidBrush(FillColorBlend.GetColor(fFrac)); } else if (min.Fill != null && max.Fill != null) { style.Fill = InterpolateBrush(min.Fill, max.Fill, value); } if (min.Line != null && max.Line != null) { style.Line = InterpolatePen(min.Line, max.Line, value); } if (LineColorBlend != null) { style.Line.Color = LineColorBlend.GetColor(fFrac); } if (min.Outline != null && max.Outline != null) { style.Outline = InterpolatePen(min.Outline, max.Outline, value); } style.MinVisible = InterpolateDouble(min.MinVisible, max.MinVisible, value); style.MaxVisible = InterpolateDouble(min.MaxVisible, max.MaxVisible, value); style.Symbol = (dFrac > 0.5 ? min.Symbol : max.Symbol); style.SymbolOffset = (dFrac > 0.5 ? min.SymbolOffset : max.SymbolOffset); //We don't interpolate the offset but let it follow the symbol instead style.SymbolScale = InterpolateFloat(min.SymbolScale, max.SymbolScale, value); return(style); }
public override object Clone() { var gradientTheme = new GradientTheme(attributeName, minValue, maxValue, (IStyle)MinStyle.Clone(), (IStyle)MaxStyle.Clone(), (null != FillColorBlend) ? (ColorBlend)FillColorBlend.Clone() : null, (null != LineColorBlend) ? (ColorBlend)LineColorBlend.Clone() : null, (null != TextColorBlend) ? (ColorBlend)TextColorBlend.Clone() : null, numberOfClasses); gradientTheme.ThemeItems.Clear(); foreach (var themeItem in ThemeItems) { gradientTheme.ThemeItems.Add((IThemeItem)((GradientThemeItem)themeItem).Clone()); } if (NoDataValues != null) { gradientTheme.NoDataValues = NoDataValues.Cast <object>().ToArray(); } return(gradientTheme); }