1 | using System.Drawing;
|
---|
2 | using System.Drawing.Drawing2D;
|
---|
3 |
|
---|
4 | namespace 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 | } |
---|