[1240] | 1 | using System;
|
---|
| 2 | using System.Drawing;
|
---|
[636] | 3 | using System.Windows.Forms;
|
---|
| 4 |
|
---|
| 5 | namespace HeuristicLab.Visualization.Test {
|
---|
| 6 | public partial class MainForm : Form {
|
---|
[1240] | 7 | private readonly Canvas canvas;
|
---|
| 8 |
|
---|
[636] | 9 | public MainForm() {
|
---|
| 10 | InitializeComponent();
|
---|
| 11 |
|
---|
[1240] | 12 | canvas = canvasUI.Canvas;
|
---|
[636] | 13 |
|
---|
| 14 | CreateLeftWorldShape();
|
---|
| 15 | CreateMiddleCompositeShape();
|
---|
| 16 | CreateRightWorldShape();
|
---|
| 17 | CreateSimpleRectangleShape();
|
---|
| 18 |
|
---|
| 19 | canvasUI.Invalidate();
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | private void CreateSimpleRectangleShape() {
|
---|
| 23 | // simple rectangle shape
|
---|
[1038] | 24 | RectangleShape rect7 = new RectangleShape(5, 5, 50, 50, Color.Black);
|
---|
[1240] | 25 | canvas.AddShape(rect7);
|
---|
[636] | 26 | }
|
---|
| 27 |
|
---|
| 28 | private void CreateRightWorldShape() {
|
---|
| 29 | // right world shape
|
---|
[1240] | 30 | WorldShape rightWorld = new WorldShape();
|
---|
| 31 | rightWorld.ClippingArea = new RectangleD(-1, -1, 1, 1);
|
---|
| 32 | rightWorld.BoundingBox = new RectangleD(600, 10, 780, 600);
|
---|
[636] | 33 |
|
---|
| 34 | double x1 = -3;
|
---|
| 35 | double y1 = -3;
|
---|
| 36 |
|
---|
| 37 | for (int i = 0; i < 10000; i++) {
|
---|
[1038] | 38 | RectangleShape rect = new RectangleShape(x1, y1, x1 + 0.3, y1 + 0.3, Color.Maroon);
|
---|
[725] | 39 | x1 += 0.4;
|
---|
| 40 | y1 += 0.4;
|
---|
[636] | 41 | rightWorld.AddShape(rect);
|
---|
| 42 | }
|
---|
| 43 |
|
---|
[1240] | 44 | canvas.AddShape(rightWorld);
|
---|
[636] | 45 | }
|
---|
| 46 |
|
---|
| 47 | private void CreateMiddleCompositeShape() {
|
---|
| 48 | // middle composite shape
|
---|
| 49 | CompositeShape middleComp = new CompositeShape();
|
---|
| 50 |
|
---|
[1038] | 51 | RectangleShape rect5 = new RectangleShape(400, 10, 500, 300, Color.Navy);
|
---|
| 52 | RectangleShape rect6 = new RectangleShape(510, 310, 580, 590, Color.Magenta);
|
---|
[636] | 53 |
|
---|
| 54 | middleComp.AddShape(rect5);
|
---|
| 55 | middleComp.AddShape(rect6);
|
---|
| 56 |
|
---|
[1240] | 57 | canvas.AddShape(middleComp);
|
---|
[636] | 58 | }
|
---|
| 59 |
|
---|
| 60 | private void CreateLeftWorldShape() {
|
---|
| 61 | // left world shape
|
---|
[1240] | 62 | WorldShape leftWorld = new WorldShape();
|
---|
| 63 | leftWorld.ClippingArea = new RectangleD(0, 0, 1000, 1000);
|
---|
| 64 | leftWorld.BoundingBox = new RectangleD(10, 10, 380, 590);
|
---|
[636] | 65 |
|
---|
[1038] | 66 | RectangleShape fillRect = new RectangleShape(0, 0, 1000, 1000, Color.LightBlue);
|
---|
[636] | 67 |
|
---|
[1038] | 68 | RectangleShape rect1 = new RectangleShape(100, 100, 500, 500, Color.Red);
|
---|
| 69 | RectangleShape rect2 = new RectangleShape(800, -200, 1200, 500, Color.Green);
|
---|
[636] | 70 |
|
---|
| 71 | CompositeShape comp1 = new CompositeShape();
|
---|
| 72 |
|
---|
[1038] | 73 | RectangleShape rect3 = new RectangleShape(510, 580, 590, 700, Color.Blue);
|
---|
| 74 | RectangleShape rect4 = new RectangleShape(600, 710, 800, 900, Color.Orange);
|
---|
[636] | 75 |
|
---|
| 76 | comp1.AddShape(rect3);
|
---|
| 77 | comp1.AddShape(rect4);
|
---|
| 78 |
|
---|
| 79 | leftWorld.AddShape(fillRect);
|
---|
| 80 | leftWorld.AddShape(rect1);
|
---|
| 81 | leftWorld.AddShape(rect2);
|
---|
| 82 | leftWorld.AddShape(comp1);
|
---|
| 83 |
|
---|
[1240] | 84 | canvas.AddShape(leftWorld);
|
---|
[636] | 85 | }
|
---|
[725] | 86 |
|
---|
[1240] | 87 | private void legendButton_Click(object sender, EventArgs e) {
|
---|
[865] | 88 | LegendForm form = new LegendForm();
|
---|
| 89 | form.Show();
|
---|
| 90 | }
|
---|
[636] | 91 | }
|
---|
| 92 | } |
---|