private LabelStyle CalculateStyle(ILabelStyle min, ILabelStyle max, double value) { LabelStyle style = new LabelStyle(); style.CollisionDetection = min.CollisionDetection; style.Enabled = InterpolateBool(min.Enabled, max.Enabled, value); float FontSize = InterpolateFloat(min.Font.Size, max.Font.Size, value); style.Font = new System.Drawing.Font(min.Font.FontFamily, FontSize, min.Font.Style); if (min.BackColor != null && max.BackColor != null) { style.BackColor = InterpolateBrush(min.BackColor, max.BackColor, value); } if (_TextColorBlend != null) { style.ForeColor = LineColorBlend.GetColor(Convert.ToSingle(Fraction(value))); } else { style.ForeColor = InterpolateColor(min.ForeColor, max.ForeColor, value); } if (min.Halo != null && max.Halo != null) { style.Halo = InterpolatePen(min.Halo, max.Halo, value); } style.MinVisible = InterpolateDouble(min.MinVisible, max.MinVisible, value); style.MaxVisible = InterpolateDouble(min.MaxVisible, max.MaxVisible, value); style.Offset = new System.Drawing.PointF(InterpolateFloat(min.Offset.X, max.Offset.X, value), InterpolateFloat(min.Offset.Y, max.Offset.Y, value)); return(style); }
private void CalculateLabelStyle(LabelStyle style, LabelStyle min, LabelStyle max, double value) { style.CollisionDetection = min.CollisionDetection; style.Enabled = InterpolateBool(min.Enabled, max.Enabled, value); style.LabelColumn = InterpolateString(min.LabelColumn, max.LabelColumn, value); double 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) : LineColorBlend.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; }
private void CalculateVectorStyle(VectorStyle style, VectorStyle min, VectorStyle max, double value) { double dFrac = Fraction(value); double fFrac = Convert.ToSingle(dFrac); style.Enabled = (dFrac > 0.5 ? min.Enabled : max.Enabled); if (FillColorBlend != null) { style.Fill = new Brush { Color = 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); } }
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); }