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 void CalculateLabelStyle(LabelStyle?style, LabelStyle?min, LabelStyle?max, double value) { if (style == null) { return; } style.CollisionDetection = min?.CollisionDetection ?? false; style.Enabled = InterpolateBool(min?.Enabled ?? false, max?.Enabled ?? false, value); style.LabelColumn = InterpolateString(min?.LabelColumn, max?.LabelColumn, value); var fontSize = InterpolateDouble(min?.Font.Size, max?.Font.Size, value); style.Font = new Font { FontFamily = min?.Font.FontFamily, Size = fontSize }; if (min?.BackColor != null && max?.BackColor != null) { style.BackColor = InterpolateBrush(min.BackColor, max.BackColor, value); } style.ForeColor = TextColorBlend == null? InterpolateColor(min?.ForeColor, max?.ForeColor, value) : TextColorBlend.GetColor(Convert.ToSingle(Fraction(value))); if (min?.Halo != null && max?.Halo != null) { style.Halo = InterpolatePen(min.Halo, max.Halo, value); } var x = InterpolateDouble(min?.Offset.X, max?.Offset.X, value); var y = InterpolateDouble(min?.Offset.Y, max?.Offset.Y, value); style.Offset = new Offset { X = x, Y = y }; style.LabelColumn = min?.LabelColumn; }
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); }