Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Visualization/HorizontalLineShape.cs @ 1233

Last change on this file since 1233 was 1233, checked in by mstoeger, 15 years ago

General housekeeping (#498) Removed some old unused Z-Order values. Replaced some var types by concrete types. Renamed some LineShape properties. Added caching of Pens and Brushes in LineShape and RectangleShape. Put axis tick calculation algorithm into its own class.

File size: 1.8 KB
Line 
1using System.Drawing;
2
3namespace HeuristicLab.Visualization {
4  public class MinMaxLineShape : WorldShape {
5    private readonly LineShape minLineShape;
6    private readonly LineShape maxLineShape;
7
8    /// <summary>
9    /// Initializes the HorizontalLineShape.
10    /// </summary>
11    /// <param name="color">color for the LineShape</param>
12    /// <param name="yMin">y value for lower line</param>
13    /// <param name="yMax">y value for upper line</param>
14    /// <param name="thickness">line thickness</param>
15    /// <param name="style">line style</param>
16    public MinMaxLineShape(double yMin, double yMax, Color color, int thickness, DrawingStyle style) {
17      minLineShape = new LineShape(0, yMin, 1, yMin, color, thickness, style);
18      maxLineShape = new LineShape(0, yMax, 1, yMax, color, thickness, style);
19      shapes.Add(minLineShape);
20      shapes.Add(maxLineShape);
21    }
22
23
24    /// <summary>
25    /// Draws the HorizontalLineShape.
26    /// </summary>
27    /// <param name="graphics">graphics handle to draw to</param>
28    /// <param name="viewport">rectangle in value-coordinates to display</param>
29    /// <param name="clippingArea">rectangle in screen-coordinates to draw</param>
30    public override void Draw(Graphics graphics, Rectangle viewport, RectangleD clippingArea) {
31      minLineShape.X1 = ClippingArea.X1;
32      minLineShape.X2 = ClippingArea.X2;
33      maxLineShape.X1 = ClippingArea.X1;
34      maxLineShape.X2 = ClippingArea.X2;
35      base.Draw(graphics, viewport, clippingArea);
36    }
37
38
39    public double YMin {
40      set {
41        minLineShape.Y1 = value;
42        minLineShape.Y2 = value;
43      }
44    }
45
46    public double YMax {
47      set {
48        maxLineShape.Y1 = value;
49        maxLineShape.Y2 = value;
50      }
51    }
52  }
53}
Note: See TracBrowser for help on using the repository browser.