Example #1
0
        private static void TypesTest()
        {
            const string sourceId = "C++_netstream_test";
            ulong        timeId   = 0L;
            var          stream   = new NetStreamSender("default", "localhost", 2001);

            stream.AddGraphAttribute(sourceId, timeId++, "int", 1);
            stream.AddGraphAttribute(sourceId, timeId++, "float", (float)1);
            stream.AddGraphAttribute(sourceId, timeId++, "double", 1.0);
            stream.AddGraphAttribute(sourceId, timeId++, "long", 1L);
            stream.AddGraphAttribute(sourceId, timeId++, "byte", (char)0);
            stream.AddGraphAttribute(sourceId, timeId++, "boolean", true);

            int[] v = { 1776, 7, 4 };
            stream.AddGraphAttribute(sourceId, timeId++, "intArray", v);

            float[] v2 = { 1776.3f, 7.3f };
            stream.AddGraphAttribute(sourceId, timeId++, "floatArray", v2);

            double[] v3 = { 776.3, .3 };
            stream.AddGraphAttribute(sourceId, timeId++, "doubleArray", v3);

            long[] v4 = { 1776, 7, 4 };
            stream.AddGraphAttribute(sourceId, timeId++, "longArray", v4);

            char[] v5 = { '0', (char)0, 'z' };
            stream.AddGraphAttribute(sourceId, timeId++, "byteArray", v5);

            bool[] v6 = { true, false };
            stream.AddGraphAttribute(sourceId, timeId++, "booleanArray", v6);

            stream.AddGraphAttribute(sourceId, timeId++, "string", "true");
            stream.Close();
        }
Example #2
0
        private static void AddNodeWithLabel(NetStreamSender stream, string sourceId, ref ulong timeId, string name)
        {
            if (lastNode != null)
                stream.RemoveNodeAttribute(sourceId, timeId++, lastNode, "ui.class");

            stream.AddNode(sourceId, timeId++, name);
            stream.AddNodeAttribute(sourceId, timeId++, name, "ui.label", name);
            stream.AddNodeAttribute(sourceId, timeId++, name, "ui.class", "active");
            lastNode = name;
        }
Example #3
0
        private static void AddEdgeWithLabel(NetStreamSender stream, string sourceId, ref ulong timeId, string name, string nodeFrom, string nodeTo)
        {
            if (lastEdge != null)
                stream.RemoveEdgeAttribute(sourceId, timeId++, lastEdge, "ui.class");

            stream.AddEdge(sourceId, timeId++, name, nodeFrom, nodeTo, false);
            stream.AddEdgeAttribute(sourceId, timeId++, name, "ui.label", name);
            stream.AddEdgeAttribute(sourceId, timeId++, name, "ui.class", "active");
            lastEdge = name;
        }
Example #4
0
        private static void AddNodeWithLabel(NetStreamSender stream, string sourceId, ref ulong timeId, string name)
        {
            if (lastNode != null)
            {
                stream.RemoveNodeAttribute(sourceId, timeId++, lastNode, "ui.class");
            }

            stream.AddNode(sourceId, timeId++, name);
            stream.AddNodeAttribute(sourceId, timeId++, name, "ui.label", name);
            stream.AddNodeAttribute(sourceId, timeId++, name, "ui.class", "active");
            lastNode = name;
        }
Example #5
0
        private static void AddEdgeWithLabel(NetStreamSender stream, string sourceId, ref ulong timeId, string name, string nodeFrom, string nodeTo)
        {
            if (lastEdge != null)
            {
                stream.RemoveEdgeAttribute(sourceId, timeId++, lastEdge, "ui.class");
            }

            stream.AddEdge(sourceId, timeId++, name, nodeFrom, nodeTo, false);
            stream.AddEdgeAttribute(sourceId, timeId++, name, "ui.label", name);
            stream.AddEdgeAttribute(sourceId, timeId++, name, "ui.class", "active");
            lastEdge = name;
        }
Example #6
0
        private static void Endless()
        {
            const string sourceId = "C++_netstream_test";
            ulong        timeId   = 0L;
            var          stream   = new NetStreamSender("default", "localhost", 2001);
            const string n1       = "node";

            while (timeId < 1000)
            {
                stream.AddNode(sourceId, timeId++, n1 + timeId);
            }
            stream.Close();
        }
Example #7
0
        private static void Example()
        {
            const string sourceId = "C++_netstream_test";
            ulong        timeId   = 0L;
            var          stream   = new NetStreamSender("default", "localhost", 2001);
            const string style    = "node {" +
                                    " shape: rounded-box;" +
                                    " fill-color: grey;" +
                                    " fill-mode: dyn-plain;" +
                                    " size-mode: fit;" +
                                    "}" +
                                    "node.active {" +
                                    " fill-color: green;" +
                                    " size:20px;" +
                                    "}" +
                                    "edge {" +
                                    " shape: cubic-curve;" +
                                    " size: 1px;" +
                                    " arrow-shape: arrow;" +
                                    "}" +
                                    "edge.active {" +
                                    " fill-color: green;" +
                                    " size: 5px;" +
                                    "}";

            stream.AddGraphAttribute(sourceId, timeId++, "stylesheet", style);
            stream.AddGraphAttribute(sourceId, timeId++, "ui.antialias", true);
            stream.AddGraphAttribute(sourceId, timeId++, "ui.quality", true);
            stream.AddGraphAttribute(sourceId, timeId++, "layout.stabilization-limit", 0);
            for (int i = 0; i < 500; i++)
            {
                var n1 = i.ToString();
                AddNodeWithLabel(stream, sourceId, ref timeId, n1);
                if (i > 0)
                {
                    var n2 = (i - 1).ToString();
                    var n3 = (i / 2).ToString();
                    var e1 = n1 + "-" + n2;
                    var e2 = n1 + "-" + n3;

                    AddEdgeWithLabel(stream, sourceId, ref timeId, e1, n1, n2);

                    if (!e1.Equals(e2))
                    {
                        AddEdgeWithLabel(stream, sourceId, ref timeId, e2, n1, n3);
                    }
                }
                //Thread.Sleep(100);
            }
            stream.Close();
        }
Example #8
0
        private static void EventsTest()
        {
            const string sourceId = "C++_netstream_test";
            ulong        timeId   = 0L;
            var          stream   = new NetStreamSender("localhost", 2001);

            stream.AddNode(sourceId, timeId++, "node0");
            stream.AddEdge(sourceId, timeId++, "edge", "node0", "node1", true);
            stream.AddNodeAttribute(sourceId, timeId++, "node0", "nodeAttribute", 0);
            stream.ChangeNodeAttribute(sourceId, timeId++, "node0", "nodeAttribute", 0, 1);
            stream.RemoveNodeAttribute(sourceId, timeId++, "node0", "nodeAttribute");
            stream.AddEdgeAttribute(sourceId, timeId++, "edge", "edgeAttribute", 0);
            stream.ChangeEdgeAttribute(sourceId, timeId++, "edge", "edgeAttribute", 0, 1);
            stream.RemoveEdgeAttribute(sourceId, timeId++, "edge", "edgeAttribute");
            stream.AddGraphAttribute(sourceId, timeId++, "graphAttribute", 0);
            stream.ChangeGraphAttribute(sourceId, timeId++, "graphAttribute", 0, 1);
            stream.RemoveGraphAttribute(sourceId, timeId++, "graphAttribute");
            stream.StepBegins(sourceId, timeId++, 1.1);
            stream.RemoveEdge(sourceId, timeId++, "edge");
            stream.RemoveNode(sourceId, timeId++, "node0");
            stream.GraphClear(sourceId, timeId++);
            stream.Close();
        }
Example #9
0
 private static void EventsTest()
 {
     const string sourceId = "C++_netstream_test";
     ulong timeId = 0L;
     var stream = new NetStreamSender("localhost", 2001);
     stream.AddNode(sourceId, timeId++, "node0");
     stream.AddEdge(sourceId, timeId++, "edge", "node0", "node1", true);
     stream.AddNodeAttribute(sourceId, timeId++, "node0", "nodeAttribute", 0);
     stream.ChangeNodeAttribute(sourceId, timeId++, "node0", "nodeAttribute", 0, 1);
     stream.RemoveNodeAttribute(sourceId, timeId++, "node0", "nodeAttribute");
     stream.AddEdgeAttribute(sourceId, timeId++, "edge", "edgeAttribute", 0);
     stream.ChangeEdgeAttribute(sourceId, timeId++, "edge", "edgeAttribute", 0, 1);
     stream.RemoveEdgeAttribute(sourceId, timeId++, "edge", "edgeAttribute");
     stream.AddGraphAttribute(sourceId, timeId++, "graphAttribute", 0);
     stream.ChangeGraphAttribute(sourceId, timeId++, "graphAttribute", 0, 1);
     stream.RemoveGraphAttribute(sourceId, timeId++, "graphAttribute");
     stream.StepBegins(sourceId, timeId++, 1.1);
     stream.RemoveEdge(sourceId, timeId++, "edge");
     stream.RemoveNode(sourceId, timeId++, "node0");
     stream.GraphClear(sourceId, timeId++);
     stream.Close();
 }
Example #10
0
 private static void Endless()
 {
     const string sourceId = "C++_netstream_test";
     ulong timeId = 0L;
     var stream = new NetStreamSender("default", "localhost", 2001);
     const string n1 = "node";
     while (timeId < 1000)
     {
         stream.AddNode(sourceId, timeId++, n1 + timeId);
     }
     stream.Close();
 }
Example #11
0
        private static void TypesTest()
        {
            const string sourceId = "C++_netstream_test";
            ulong timeId = 0L;
            var stream = new NetStreamSender("default", "localhost", 2001);

            stream.AddGraphAttribute(sourceId, timeId++, "int", 1);
            stream.AddGraphAttribute(sourceId, timeId++, "float", (float) 1);
            stream.AddGraphAttribute(sourceId, timeId++, "double", 1.0);
            stream.AddGraphAttribute(sourceId, timeId++, "long", 1L);
            stream.AddGraphAttribute(sourceId, timeId++, "byte", (char) 0);
            stream.AddGraphAttribute(sourceId, timeId++, "boolean", true);

            int[] v = {1776, 7, 4};
            stream.AddGraphAttribute(sourceId, timeId++, "intArray", v);

            float[] v2 = {1776.3f, 7.3f};
            stream.AddGraphAttribute(sourceId, timeId++, "floatArray", v2);

            double[] v3 = {776.3, .3};
            stream.AddGraphAttribute(sourceId, timeId++, "doubleArray", v3);

            long[] v4 = {1776, 7, 4};
            stream.AddGraphAttribute(sourceId, timeId++, "longArray", v4);

            char[] v5 = {'0', (char) 0, 'z'};
            stream.AddGraphAttribute(sourceId, timeId++, "byteArray", v5);

            bool[] v6 = {true, false};
            stream.AddGraphAttribute(sourceId, timeId++, "booleanArray", v6);

            stream.AddGraphAttribute(sourceId, timeId++, "string", "true");
            stream.Close();
        }
Example #12
0
        private static void Example()
        {
            const string sourceId = "C++_netstream_test";
            ulong timeId = 0L;
            var stream = new NetStreamSender("default", "localhost", 2001);
            const string style = "node {" +
                " shape: rounded-box;" +
                " fill-color: grey;" +
                " fill-mode: dyn-plain;" +
                " size-mode: fit;" +
                "}" +
                "node.active {" +
                " fill-color: green;" +
                " size:20px;" +
                "}" +
                "edge {" +
                " shape: cubic-curve;" +
                " size: 1px;" +
                " arrow-shape: arrow;" +
                "}" +
                "edge.active {" +
                " fill-color: green;" +
                " size: 5px;" +
                "}";
            stream.AddGraphAttribute(sourceId, timeId++, "stylesheet", style);
            stream.AddGraphAttribute(sourceId, timeId++, "ui.antialias", true);
            stream.AddGraphAttribute(sourceId, timeId++, "ui.quality", true);
            stream.AddGraphAttribute(sourceId, timeId++, "layout.stabilization-limit", 0);
            for (int i = 0; i < 500; i++)
            {
                var n1 = i.ToString();
                AddNodeWithLabel(stream, sourceId, ref timeId, n1);
                if (i > 0)
                {
                    var n2 = (i - 1).ToString();
                    var n3 = (i/2).ToString();
                    var e1 = n1 + "-" + n2;
                    var e2 = n1 + "-" + n3;

                    AddEdgeWithLabel(stream, sourceId, ref timeId, e1, n1, n2);

                    if (!e1.Equals(e2))
                        AddEdgeWithLabel(stream, sourceId, ref timeId, e2, n1, n3);
                }
                //Thread.Sleep(100);
            }
            stream.Close();
        }