コード例 #1
0
        public void RegisterYComp(YCompClient ycompClient)
        {
            if (this.ycompStream != null)
            {
                throw new Exception("there is already a ycomp stream registered");
            }

            this.ycompStream = ycompClient.ycompStream;

            foreach (NodeRealizer nr in registeredNodeRealizers.Keys)
            {
                ycompStream.Write("addNodeRealizer \"" + nr.Name + "\" \""
                                  + VCGDumper.GetColor(nr.BorderColor) + "\" \""
                                  + VCGDumper.GetColor(nr.Color) + "\" \""
                                  + VCGDumper.GetColor(nr.TextColor) + "\" \""
                                  + VCGDumper.GetNodeShape(nr.Shape) + "\"\n");
            }
            foreach (EdgeRealizer er in registeredEdgeRealizers.Keys)
            {
                ycompStream.Write("addEdgeRealizer \"" + er.Name + "\" \""
                                  + VCGDumper.GetColor(er.Color) + "\" \""
                                  + VCGDumper.GetColor(er.TextColor) + "\" \""
                                  + er.LineWidth + "\" \""
                                  + VCGDumper.GetLineStyle(er.LineStyle) + "\"\n");
            }
        }
コード例 #2
0
ファイル: YCompClient.cs プロジェクト: tmaierhofer/grgen
        /// <summary>
        /// Creates a new YCompClient instance and connects to the local YComp server.
        /// If it is not available a SocketException is thrown
        /// </summary>
        public YCompClient(INamedGraph graph, String layoutModule, int connectionTimeout, int port, DumpInfo dumpInfo)
        {
            this.graph    = graph;
            this.dumpInfo = dumpInfo;

            int startTime = Environment.TickCount;

            do
            {
                try
                {
                    ycompClient = new TcpClient("localhost", port);
                }
                catch (SocketException)
                {
                    ycompClient = null;
                    Thread.Sleep(1000);
                }
            } while(ycompClient == null && Environment.TickCount - startTime < connectionTimeout);

            if (ycompClient == null)
            {
                throw new Exception("Connection timeout!");
            }

            ycompStream = new YCompStream(ycompClient);

            SetLayout(layoutModule);

            NormalNodeRealizer  = GetNodeRealizer(GrColor.Yellow, GrColor.DarkYellow, GrColor.Black, GrNodeShape.Box);
            MatchedNodeRealizer = GetNodeRealizer(GrColor.Khaki, GrColor.DarkYellow, GrColor.Black, GrNodeShape.Box);
            NewNodeRealizer     = GetNodeRealizer(GrColor.LightRed, GrColor.DarkYellow, GrColor.Black, GrNodeShape.Box);
            DeletedNodeRealizer = GetNodeRealizer(GrColor.LightGrey, GrColor.DarkYellow, GrColor.Black, GrNodeShape.Box);

            NormalEdgeRealizer  = GetEdgeRealizer(GrColor.DarkYellow, GrColor.Black, 1, GrLineStyle.Continuous);
            MatchedEdgeRealizer = GetEdgeRealizer(GrColor.DarkYellow, GrColor.Black, 2, GrLineStyle.Continuous);
            NewEdgeRealizer     = GetEdgeRealizer(GrColor.LightRed, GrColor.Black, 2, GrLineStyle.Continuous);
            DeletedEdgeRealizer = GetEdgeRealizer(GrColor.LightGrey, GrColor.Black, 2, GrLineStyle.Continuous);

            dumpInfo.OnNodeTypeAppearanceChanged += new NodeTypeAppearanceChangedHandler(OnNodeTypeAppearanceChanged);
            dumpInfo.OnEdgeTypeAppearanceChanged += new EdgeTypeAppearanceChangedHandler(OnEdgeTypeAppearanceChanged);
            dumpInfo.OnTypeInfotagsChanged       += new TypeInfotagsChangedHandler(OnTypeInfotagsChanged);
        }
コード例 #3
0
ファイル: YCompClient.cs プロジェクト: GunterMueller/grgen
        /// <summary>
        /// Creates a new YCompClient instance and connects to the local YComp server.
        /// If it is not available a SocketException is thrown
        /// </summary>
        public YCompClient(INamedGraph graph, String layoutModule, int connectionTimeout, int port,
                           DumpInfo dumpInfo, ElementRealizers realizers, Dictionary <string, IObject> nameToClassObject)
        {
            this.graph    = graph;
            this.dumpInfo = dumpInfo;

            int startTime = Environment.TickCount;

            do
            {
                try
                {
                    ycompClient = new TcpClient("localhost", port);
                }
                catch (SocketException)
                {
                    ycompClient = null;
                    Thread.Sleep(1000);
                }
            }while(ycompClient == null && Environment.TickCount - startTime < connectionTimeout);

            if (ycompClient == null)
            {
                throw new Exception("Connection timeout!");
            }

            ycompStream = new YCompStream(ycompClient);

            SetLayout(layoutModule);

            dumpInfo.OnNodeTypeAppearanceChanged += new NodeTypeAppearanceChangedHandler(OnNodeTypeAppearanceChanged);
            dumpInfo.OnEdgeTypeAppearanceChanged += new EdgeTypeAppearanceChangedHandler(OnEdgeTypeAppearanceChanged);
            dumpInfo.OnTypeInfotagsChanged       += new TypeInfotagsChangedHandler(OnTypeInfotagsChanged);

            this.realizers = realizers;
            realizers.RegisterYComp(this);

            this.nameToClassObject = nameToClassObject;
            // TODO: Add group related events
        }
コード例 #4
0
ファイル: YCompClient.cs プロジェクト: jblomer/GrGen.NET
        /// <summary>
        /// Creates a new YCompClient instance and connects to the local YComp server.
        /// If it is not available a SocketException is thrown
        /// </summary>
        public YCompClient(INamedGraph graph, String layoutModule, int connectionTimeout, int port, DumpInfo dumpInfo, ElementRealizers realizers)
        {
            this.graph = graph;
            this.dumpInfo = dumpInfo;

            int startTime = Environment.TickCount;

            do
            {
                try
                {
                    ycompClient = new TcpClient("localhost", port);
                }
                catch(SocketException)
                {
                    ycompClient = null;
                    Thread.Sleep(1000);
                }
            } while(ycompClient == null && Environment.TickCount - startTime < connectionTimeout);

            if(ycompClient == null)
                throw new Exception("Connection timeout!");

            ycompStream = new YCompStream(ycompClient);

            SetLayout(layoutModule);

            dumpInfo.OnNodeTypeAppearanceChanged += new NodeTypeAppearanceChangedHandler(OnNodeTypeAppearanceChanged);
            dumpInfo.OnEdgeTypeAppearanceChanged += new EdgeTypeAppearanceChangedHandler(OnEdgeTypeAppearanceChanged);
            dumpInfo.OnTypeInfotagsChanged += new TypeInfotagsChangedHandler(OnTypeInfotagsChanged);

            this.realizers = realizers;
            realizers.RegisterYComp(this);

            // TODO: Add group related events
        }
コード例 #5
0
 public void UnregisterYComp()
 {
     ycompStream = null;
 }