Netstream.NetStreamSender.AddGraphAttribute C# (CSharp) Метод

AddGraphAttribute() публичный Метод

public AddGraphAttribute ( String sourceId, ulong timeId, String attribute, Object value ) : void
sourceId String
timeId ulong
attribute String
value Object
Результат void
        public void AddGraphAttribute(String sourceId, ulong timeId, String attribute, Object value)
        {
            NetStreamStorage buff = new NetStreamStorage().
                EncodeArray(_streamIdArray).
                EncodeEvent(NetStreamEvent.AddGraphAttr).
                EncodeString(sourceId).
                EncodeNative(timeId).
                EncodeString(attribute).
                EncodeValueWithType(value);
            DoSend(buff);
        }

Usage Example

Пример #1
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();
        }
All Usage Examples Of Netstream.NetStreamSender::AddGraphAttribute