Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 1187 was 1187, checked in by dwagner, 15 years ago

Added OptionsDialog, min and max lines and fixed bug in auto-adjust. (#478) (#345)

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