예제 #1
0
        public NetGraphDocumentControl(IDocumentObject document)
        {
            _document = (NetGraphDocument)document;
            _templates = new Dictionary<string, GraphNodeTemplate>();

            AddNodeTemplate(ServerEndpointConfig.NodeName, "SERVER{0}", GraphNodeShape.Ellipse, 100.0f, 100.0f,
                Color.Purple, Color.Black, Color.Red, Color.White, Color.WhiteSmoke, typeof(ServerEndpointConfig));
            AddNodeTemplate(ClientEndpointConfig.NodeName, "CLIENT{0}", GraphNodeShape.Ellipse, 100.0f, 100.0f,
                Color.LightGoldenrodYellow, Color.Black, Color.Red, Color.Black, Color.Black, typeof(ClientEndpointConfig));
            AddNodeTemplate(EditPacketNodeConfig.NodeName, "EDIT{0}", GraphNodeShape.RoundedRectangle, 100.0f, 50.0f,
                Color.Sienna, Color.Black, Color.Red, Color.Black, Color.Black, typeof(EditPacketNodeConfig));
            AddNodeTemplate(LogPacketConfig.NodeName, "LOG{0}", GraphNodeShape.RoundedRectangle, 100.0f, 50.0f,
                Color.Silver, Color.Black, Color.Red, Color.Black, Color.Black, typeof(LogPacketConfig));
            AddNodeTemplate(DirectNodeConfig.NodeName, "NOP{0}", GraphNodeShape.RoundedRectangle, 100.0f, 50.0f,
                Color.SlateBlue, Color.Black, Color.Red, Color.Black, Color.Black, typeof(DirectNodeConfig));
            AddNodeTemplate(DelayNodeConfig.NodeName, "DELAY{0}", GraphNodeShape.RoundedRectangle, 100.0f, 50.0f,
                Color.SlateBlue, Color.Black, Color.Red, Color.Black, Color.Black, typeof(DelayNodeConfig));
            AddNodeTemplate(DynamicNodeConfig.NodeName, "DYN{0}", GraphNodeShape.RoundedRectangle, 100.0f, 50.0f,
                Color.AliceBlue, Color.Black, Color.Red, Color.Black, Color.Black, typeof(DynamicNodeConfig));
            AddNodeTemplate(LibraryNodeConfig.NodeName, "LIB{0}", GraphNodeShape.RoundedRectangle, 100.0f, 50.0f,
                Color.Blue, Color.Black, Color.Red, Color.White, Color.WhiteSmoke, typeof(LibraryNodeConfig));
            AddNodeTemplate(NetGraphContainerConfig.NodeName, "GRAPH{0}", GraphNodeShape.RoundedRectangle, 100.0f, 50.0f,
                Color.Aqua, Color.Black, Color.Red, Color.Black, Color.Black, typeof(NetGraphContainerConfig));
            AddNodeTemplate(DecisionNodeConfig.NodeName, "IF{0}", GraphNodeShape.Rhombus, 100.0f, 80.0f,
                Color.Crimson, Color.Black, Color.Red, Color.Black, Color.Black, typeof(DecisionNodeConfig));
            AddNodeTemplate(SwitchNodeConfig.NodeName, "SWITCH{0}", GraphNodeShape.Rhombus, 100.0f, 80.0f,
                Color.Yellow, Color.Black, Color.Red, Color.Black, Color.Black, typeof(SwitchNodeConfig));
            AddNodeTemplate(SslLayerSectionNodeConfig.NodeName, "SSL{0}", GraphNodeShape.RoundedRectangle, 100.0f, 50.0f,
                Color.BlanchedAlmond, Color.Black, Color.Red, Color.Black, Color.Black, typeof(SslLayerSectionNodeConfig));
            AddNodeTemplate(LayerSectionNodeConfig.NodeName, "LAYER{0}", GraphNodeShape.RoundedRectangle, 100.0f, 50.0f,
                Color.Coral, Color.Black, Color.Red, Color.Black, Color.Black, typeof(LayerSectionNodeConfig));

            InitializeComponent();
            PopulateGraphFromDocument();
        }
예제 #2
0
        public ForceDirectedLayout(NetGraphDocument graph, Func <BaseNodeConfig, PointD> initialPositions = null)
        {
            Graph                  = graph;
            NodePositions          = new Dictionary <BaseNodeConfig, PointD>();
            SpringForce            = (d => 2 * Math.Log(d));
            ElectricForce          = (d => 1 / (d * d));
            TemperatureAttenuation = DefaultTemperatureAttenuation;

            Initialize(initialPositions);
        }
예제 #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="document">The netgraph document to test</param>
 public NetGraphTestDocument(NetGraphDocument document)
 {
     _document = document;
 }
예제 #4
0
        private void BuildDefaultProxyNetgraph(NetGraphDocument document)
        {
            List<BaseNodeConfig> nodes = new List<BaseNodeConfig>();

            ServerEndpointConfig server = new ServerEndpointConfig();
            server.Label = "SERVER";
            server.X = 80;
            server.Y = 150;
            nodes.Add(server);

            ClientEndpointConfig client = new ClientEndpointConfig();
            client.Label = "CLIENT";
            client.X = 280;
            client.Y = 150;
            nodes.Add(client);

            LogPacketConfig logout = new LogPacketConfig();
            logout.Label = "LOGOUT";
            logout.X = 180;
            logout.Y = 60;
            logout.Color = ColorValue.Pink;
            logout.Tag = "Out";
            nodes.Add(logout);

            LogPacketConfig login = new LogPacketConfig();
            login.Label = "LOGIN";
            login.X = 180;
            login.Y = 240;
            login.Color = ColorValue.Powderblue;
            login.Tag = "In";
            nodes.Add(login);

            List<LineConfig> lines = new List<LineConfig>();
            lines.Add(new LineConfig(server, logout, false, null, false));
            lines.Add(new LineConfig(logout, client, false, null, false));
            lines.Add(new LineConfig(client, login, false, null, false));
            lines.Add(new LineConfig(login, server, false, null, false));

            document.UpdateGraph(nodes.ToArray(), lines.ToArray());
        }
예제 #5
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="document">The netgraph document to test</param>
 public NetGraphTestDocument(NetGraphDocument document)
 {
     _document = document;
 }