Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/HeuristicLab.Netron-3.0.2672.12446/NetronForm.cs @ 2861

Last change on this file since 2861 was 2782, checked in by mkommend, 15 years ago

added test application for netron (ticket #867)

File size: 3.5 KB
RevLine 
[2782]1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Data;
5using System.Drawing;
6using System.Linq;
7using System.Text;
8using System.Windows.Forms;
9using Netron.Diagramming.Core;
10
11namespace HeuristicLab.Netron {
12  public partial class NetronForm : Form {
13    public NetronForm() {
14      InitializeComponent();
15      ClassShape shape1 = new ClassShape();
16      shape1.Location = new Point(200, 200);
17      shape1.Name = "Shape 1";
18      IConnector c1b = shape1.Connectors.Where(c => c.Name == "Bottom connector").First();
19      IConnector c1t = shape1.Connectors.Where(c => c.Name == "Top connector").First();
20
21      ClassShape shape2 = new ClassShape();
22      shape2.Location = new Point(300, 300);
23      shape2.Name = "Shape 2";
24      IConnector c2b = shape2.Connectors.Where(c => c.Name == "Bottom connector").First();
25      IConnector c2t = shape2.Connectors.Where(c => c.Name == "Top connector").First();
26
27      ClassShape shape3 = new ClassShape();
28      shape3.Location = new Point(400, 400);
29      shape3.Name = "Shape 3";
30      IConnector c3b = shape3.Connectors.Where(c => c.Name == "Bottom connector").First();
31      IConnector c3t = shape3.Connectors.Where(c => c.Name == "Top connector").First();
32
33      ClassShape shape4 = new ClassShape();
34      shape4.Location = new Point(500, 500);
35      shape4.Name = "Shape 4";
36      IConnector c4b = shape4.Connectors.Where(c => c.Name == "Bottom connector").First();
37      IConnector c4t = shape4.Connectors.Where(c => c.Name == "Top connector").First();
38
39      ClassShape shape5 = new ClassShape();
40      shape5.Location = new Point(600, 600);
41      shape5.Name = "Shape 5";
42      IConnector c5b = shape5.Connectors.Where(c => c.Name == "Bottom connector").First();
43      IConnector c5t = shape5.Connectors.Where(c => c.Name == "Top connector").First();
44
45      Connection c1 = new Connection(c1b.Point, c2t.Point, netronVisualization.Controller.Model);
46      c1b.AttachConnector(c1.From);
47      c2t.AttachConnector(c1.To);
48
49      Connection c2 = new Connection(c1b.Point, c3t.Point, netronVisualization.Controller.Model);
50      c1b.AttachConnector(c2.From);
51      c3t.AttachConnector(c2.To);
52
53      Connection c3 = new Connection(c2b.Point, c4t.Point, netronVisualization.Controller.Model);
54      c2b.AttachConnector(c3.From);
55      c4t.AttachConnector(c3.To);
56
57      Connection c4 = new Connection(c3b.Point, c4t.Point, netronVisualization.Controller.Model);
58      c3b.AttachConnector(c4.From);
59      c4t.AttachConnector(c4.To);
60
61      Connection c5 = new Connection(c4b.Point, c5t.Point, netronVisualization.Controller.Model);
62      c4b.AttachConnector(c5.From);
63      c5t.AttachConnector(c5.To);
64
65      netronVisualization.Controller.Model.AddShape(shape1);
66      netronVisualization.Controller.Model.AddShape(shape2);
67      netronVisualization.Controller.Model.AddShape(shape3);
68      netronVisualization.Controller.Model.AddShape(shape4);
69      netronVisualization.Controller.Model.AddShape(shape5);
70
71      netronVisualization.Controller.Model.AddConnection(c1);
72      netronVisualization.Controller.Model.AddConnection(c2);
73      netronVisualization.Controller.Model.AddConnection(c3);
74      netronVisualization.Controller.Model.AddConnection(c4);
75      netronVisualization.Controller.Model.AddConnection(c5);
76
77      netronVisualization.Controller.View.Invalidate();
78      netronVisualization.Controller.Model.LayoutRoot = shape1;
79      netronVisualization.Controller.RunActivity("Standard TreeLayout");
80    }
81  }
82}
Note: See TracBrowser for help on using the repository browser.