Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Visualization.Test/3.2/MainForm.cs @ 1875

Last change on this file since 1875 was 1530, checked in by gkronber, 16 years ago

Moved source files of plugins Hive ... Visualization.Test into version-specific sub-folders. #576

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