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"); } }
/// <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); }
/// <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 }
/// <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 }
public void UnregisterYComp() { ycompStream = null; }