public void LoadClassDependencies(DetermineClassDeps dcd, bool treatExternalTypesAsSingleImutable) { foreach (TypeDefinition tdef in dcd.ClassDependencies.Keys) { string className = tdef.FullName; foreach (UsedClass uc in dcd.ClassDependencies[tdef]) { string refclassName = uc.Type.FullName; if (!String.IsNullOrEmpty(_examininationNSN)) { if (! ( (tdef.FullName.StartsWith(_examininationNSP) || tdef.FullName.StartsWith(_examininationNSN)) && (uc.Type.FullName.StartsWith(_examininationNSN) || uc.Type.FullName.StartsWith(_examininationNSP)) )) { continue; } } TypeVertex usingVertex = GetVertex(tdef, className, dcd); TypeVertex refVertex = GetVertex(uc.Type, refclassName, dcd); if (AllowParallel || !this.ContainsEdge(usingVertex, refVertex)) { NamedEdge edge = (NamedEdge)this.AddEdge(usingVertex, refVertex); edge.Name = uc.Use.ToString(); } } } }
/// <summary> /// Format edge event handler /// </summary> /// <param name="sender"></param> /// <param name="args"></param> public void FormatEdge(Object sender, FormatEdgeEventArgs args) { NamedEdge e = (NamedEdge)args.Edge; args.EdgeFormatter.Label.Value = ((NamedEdge)args.Edge).Name; // setting the vertex name if (CurrentEdgePath != null) { if (CurrentEdgePath.Contains(e)) { args.EdgeFormatter.Label.Value = String.Format("{0} ({1})", e.Name, m_CurrentEdgePath.IndexOf(e) ); args.EdgeFormatter.Style = GraphvizEdgeStyle.Bold; args.EdgeFormatter.Label.FontColor = Color.DarkGreen; args.EdgeFormatter.StrokeColor = Color.DarkGreen; } else { args.EdgeFormatter.Label.FontColor = Color.Gray; args.EdgeFormatter.StrokeColor = Color.Gray; args.EdgeFormatter.Style = GraphvizEdgeStyle.Unspecified; } } }
public void FinishEdge(Object sender, EdgeEventArgs args) { NamedEdge e = (NamedEdge)args.Edge; NamedVertex v = (NamedVertex)args.Edge.Target; Console.WriteLine("-- {0}, {1}", e.Name, v.Name ); }
void gv_FormatEdge(object sender, FormatEdgeEventArgs e) { NamedEdge edge = e.Edge as NamedEdge; if (edge == null) { return; } e.EdgeFormatter.Label.Value = edge.Name; }
void EnsureEdgeFacesOutsideForHomothety(NamedEdge theChangedEdge, ref Vector3 leftPosition, ref Vector3 rightPosition, ref Vector3 topPosition, ref Vector3 bottomPosition) { switch (theChangedEdge) { case NamedEdge.Left: if (rightPosition.x < leftPosition.x) { leftPosition.x = rightPosition.x; } if (topPosition.y < bottomPosition.y) { topPosition.y = bottomPosition.y = center.y; } break; case NamedEdge.Right: if (rightPosition.x < leftPosition.x) { rightPosition.x = leftPosition.x; } if (topPosition.y < bottomPosition.y) { topPosition.y = bottomPosition.y = center.y; } break; case NamedEdge.Top: if (topPosition.y < bottomPosition.y) { topPosition.y = bottomPosition.y; } if (rightPosition.x < leftPosition.x) { rightPosition.x = leftPosition.x = center.x; } break; case NamedEdge.Bottom: if (topPosition.y < bottomPosition.y) { bottomPosition.y = topPosition.y; } if (rightPosition.x < leftPosition.x) { rightPosition.x = leftPosition.x = center.x; } break; } }
public XmlSerializationTest() { m_Graph = new AdjacencyGraph( new NamedVertexProvider(), new NamedEdgeProvider(), true ); u = (NamedVertex)Graph.AddVertex(); u.Name = "u"; v = (NamedVertex)Graph.AddVertex(); v.Name = "v"; w = (NamedVertex)Graph.AddVertex(); w.Name = "w"; uv = (NamedEdge)Graph.AddEdge(u, v); uv.Name = "uv"; uw = (NamedEdge)Graph.AddEdge(u, w); uw.Name = "uw"; }
public static AdjacencyGraph Fsm() { // create a new adjacency graph AdjacencyGraph g = new BidirectionalGraph( new NamedVertexProvider(), new NamedEdgeProvider(), true); NamedEdge e = null; NamedVertex s0 = (NamedVertex)g.AddVertex(); s0.Name = "S0"; NamedVertex s1 = (NamedVertex)g.AddVertex(); s1.Name = "S1"; NamedVertex s2 = (NamedVertex)g.AddVertex(); s2.Name = "S2"; NamedVertex s3 = (NamedVertex)g.AddVertex(); s3.Name = "S3"; NamedVertex s4 = (NamedVertex)g.AddVertex(); s4.Name = "S4"; NamedVertex s5 = (NamedVertex)g.AddVertex(); s5.Name = "S5"; e = (NamedEdge)g.AddEdge(s0, s1); e.Name = "StartCalc"; e = (NamedEdge)g.AddEdge(s1, s0); e.Name = "StopCalc"; e = (NamedEdge)g.AddEdge(s1, s1); e.Name = "SelectStandard"; e = (NamedEdge)g.AddEdge(s1, s1); e.Name = "ClearDisplay"; e = (NamedEdge)g.AddEdge(s1, s2); e.Name = "SelectScientific"; e = (NamedEdge)g.AddEdge(s1, s3); e.Name = "EnterDecNumber"; e = (NamedEdge)g.AddEdge(s2, s1); e.Name = "SelectStandard"; e = (NamedEdge)g.AddEdge(s2, s2); e.Name = "SelectScientific"; e = (NamedEdge)g.AddEdge(s2, s2); e.Name = "ClearDisplay"; e = (NamedEdge)g.AddEdge(s2, s4); e.Name = "EnterDecNumber"; e = (NamedEdge)g.AddEdge(s2, s5); e.Name = "StopCalc"; e = (NamedEdge)g.AddEdge(s3, s0); e.Name = "StopCalc"; e = (NamedEdge)g.AddEdge(s3, s1); e.Name = "ClearDisplay"; e = (NamedEdge)g.AddEdge(s3, s3); e.Name = "SelectStandard"; e = (NamedEdge)g.AddEdge(s3, s3); e.Name = "EnterDecNumber"; e = (NamedEdge)g.AddEdge(s3, s4); e.Name = "SelectScientific"; e = (NamedEdge)g.AddEdge(s4, s2); e.Name = "ClearDisplay"; e = (NamedEdge)g.AddEdge(s4, s3); e.Name = "SelectStandard"; e = (NamedEdge)g.AddEdge(s4, s4); e.Name = "SelectScientific"; e = (NamedEdge)g.AddEdge(s4, s4); e.Name = "EnterDecNumber"; e = (NamedEdge)g.AddEdge(s4, s5); e.Name = "StopCalc"; e = (NamedEdge)g.AddEdge(s5, s2); e.Name = "StartCalc"; return(g); }
NamedEdge DrawSliders(ref Vector3 leftPosition, ref Vector3 rightPosition, ref Vector3 topPosition, ref Vector3 bottomPosition) { NamedEdge theChangedEdge = NamedEdge.None; using (new Handles.DrawingScope(m_MonochromeHandleColor)) { EditorGUI.BeginChangeCheck(); Slider1D(m_ControlIDs[(int)NamedEdge.Left], ref leftPosition, Vector3.left, EditorSnapSettings.scale); if (EditorGUI.EndChangeCheck()) { theChangedEdge = NamedEdge.Left; } EditorGUI.BeginChangeCheck(); Slider1D(m_ControlIDs[(int)NamedEdge.Right], ref rightPosition, Vector3.right, EditorSnapSettings.scale); if (EditorGUI.EndChangeCheck()) { theChangedEdge = NamedEdge.Right; } EditorGUI.BeginChangeCheck(); Slider1D(m_ControlIDs[(int)NamedEdge.Top], ref topPosition, Vector3.up, EditorSnapSettings.scale); if (EditorGUI.EndChangeCheck()) { theChangedEdge = NamedEdge.Top; } EditorGUI.BeginChangeCheck(); Slider1D(m_ControlIDs[(int)NamedEdge.Bottom], ref bottomPosition, Vector3.down, EditorSnapSettings.scale); if (EditorGUI.EndChangeCheck()) { theChangedEdge = NamedEdge.Bottom; } } return(theChangedEdge); }
/// <summary> /// Updates an edge that has not been created with the provider /// </summary> /// <param name="e">edge to update</param> public void UpdateEdge(NamedEdge e) { e.ID = m_NextID++; }
public void Run() { // create an adjacency graph AdjacencyGraph g = new AdjacencyGraph( new NamedVertexProvider(), new NamedEdgeProvider(), true ); // create a clustered graph ClusteredAdjacencyGraph cg = new ClusteredAdjacencyGraph(g); // adding some vertices to the main graph NamedVertex a = cg.AddVertex() as NamedVertex; a.Name = "a"; NamedVertex b = cg.AddVertex() as NamedVertex; b.Name = "b"; NamedVertex c = cg.AddVertex() as NamedVertex; c.Name = "c"; NamedEdge ab = cg.AddEdge(a, b) as NamedEdge; ab.Name = "ab"; NamedEdge ac = cg.AddEdge(a, c) as NamedEdge; ac.Name = "ac"; // adding a cluster ClusteredAdjacencyGraph cg1 = cg.AddCluster(); // adding vertices and edges to the cluster NamedVertex d = cg1.AddVertex() as NamedVertex; d.Name = "d"; NamedVertex e = cg1.AddVertex() as NamedVertex; e.Name = "e"; NamedVertex f = cg1.AddVertex() as NamedVertex; f.Name = "f"; NamedEdge de = cg1.AddEdge(d, e) as NamedEdge; de.Name = "de"; NamedEdge df = cg1.AddEdge(d, f) as NamedEdge; df.Name = "df"; // adding a second cluster ClusteredAdjacencyGraph cg2 = cg.AddCluster(); // adding vertices NamedVertex h = cg2.AddVertex() as NamedVertex; h.Name = "h"; NamedVertex i = cg2.AddVertex() as NamedVertex; i.Name = "i"; NamedEdge hi = cg2.AddEdge(h, i) as NamedEdge; hi.Name = "hi"; // adding a sub-sub-cluster ClusteredAdjacencyGraph cg21 = cg2.AddCluster(); // adding vertices NamedVertex k = cg21.AddVertex() as NamedVertex; k.Name = "k"; NamedVertex l = cg21.AddVertex() as NamedVertex; l.Name = "l"; NamedEdge ak = cg.AddEdge(a, k) as NamedEdge; ak.Name = "ak"; NamedEdge kl = cg21.AddEdge(k, l) as NamedEdge; kl.Name = "kl"; // interconnecting NamedEdge cd = cg.AddEdge(c, d) as NamedEdge; cd.Name = "cd"; NamedEdge bh = cg.AddEdge(b, h) as NamedEdge; bh.Name = "bh"; NamedEdge ei = cg.AddEdge(e, i) as NamedEdge; ei.Name = "ei"; GraphvizAlgorithm gw = new GraphvizAlgorithm( cg, "../cluster", GraphvizImageType.Svgz ); gw.FormatVertex += new FormatVertexEventHandler(this.FormatVertex); gw.FormatEdge += new FormatEdgeEventHandler(this.FormatEdge); gw.Write("cluster"); cg2.Colapsed = true; gw.Write("cluster_collapsed"); }