public void Connects_GetDirectedEdges_EdgesWithoutArrowsAreExcluded_withArrowHeads2() { var page1 = this.GetNewPage(); var shapes = this.draw_standard_shapes(page1); this.connect(shapes[0], shapes[1], true, true); this.connect(shapes[1], shapes[2], true, true); var options1 = new VA.DocumentAnalysis.ConnectionAnalyzerOptions(); options1.NoArrowsHandling = VA.DocumentAnalysis.NoArrowsHandling.ExcludeEdge; var edges1 = VA.DocumentAnalysis.ConnectionAnalyzer.GetDirectedEdges(page1, options1); var map1 = new ConnectivityMap(edges1); Assert.AreEqual(3, map1.CountFromNodes()); Assert.IsTrue(map1.HasConnectionFromTo("A", "B")); Assert.IsTrue(map1.HasConnectionFromTo("B", "A")); Assert.IsTrue(map1.HasConnectionFromTo("B", "C")); Assert.IsTrue(map1.HasConnectionFromTo("C", "B")); Assert.AreEqual(1, map1.CountConnectionsFrom("A")); Assert.AreEqual(2, map1.CountConnectionsFrom("B")); Assert.AreEqual(1, map1.CountConnectionsFrom("C")); var options2 = new VA.DocumentAnalysis.ConnectionAnalyzerOptions(); options2.NoArrowsHandling = VA.DocumentAnalysis.NoArrowsHandling.TreatEdgeAsBidirectional; var edges2 = VA.DocumentAnalysis.ConnectionAnalyzer.GetDirectedEdgesTransitive(page1, options2); var map2 = new ConnectivityMap(edges2); Assert.AreEqual(3, map2.CountFromNodes()); Assert.IsTrue(map2.HasConnectionFromTo("A", "B")); Assert.IsTrue(map2.HasConnectionFromTo("B", "A")); Assert.IsTrue(map2.HasConnectionFromTo("B", "C")); Assert.IsTrue(map2.HasConnectionFromTo("C", "B")); Assert.IsTrue(map2.HasConnectionFromTo("A", "C")); Assert.IsTrue(map2.HasConnectionFromTo("C", "A")); Assert.AreEqual(2, map2.CountConnectionsFrom("A")); Assert.AreEqual(2, map2.CountConnectionsFrom("B")); Assert.AreEqual(2, map2.CountConnectionsFrom("C")); page1.Delete(0); }
private VA.DocumentAnalysis.ConnectionAnalyzerOptions _get_directed_edge_handling() { var flag = new VA.DocumentAnalysis.ConnectionAnalyzerOptions(); flag.NoArrowsHandling = VA.DocumentAnalysis.NoArrowsHandling.ExcludeEdge; if (this.Raw) { flag.DirectionSource = VA.DocumentAnalysis.DirectionSource.UseConnectionOrder; } else { flag.DirectionSource = VA.DocumentAnalysis.DirectionSource.UseConnectorArrows; flag.NoArrowsHandling = this.TreatUndirectedAsBidirectional ? VA.DocumentAnalysis.NoArrowsHandling.TreatEdgeAsBidirectional : VA.DocumentAnalysis.NoArrowsHandling.ExcludeEdge; } return(flag); }
public void PathAnalysis_GetDirectEdgesRaw() { var page1 = this.GetNewPage(); var shapes = this.draw_standard_shapes(page1); this.connect(shapes[0], shapes[1], false, false); this.connect(shapes[1], shapes[2], false, false); var options = new VA.DocumentAnalysis.ConnectionAnalyzerOptions(); options.DirectionSource = VA.DocumentAnalysis.DirectionSource.UseConnectionOrder; var edges = VA.DocumentAnalysis.ConnectionAnalyzer.GetDirectedEdges(page1, options); var map = new ConnectivityMap(edges); Assert.AreEqual(2, map.CountFromNodes()); Assert.IsTrue(map.HasConnectionFromTo("A", "B")); Assert.IsTrue(map.HasConnectionFromTo("B", "C")); Assert.AreEqual(1, map.CountConnectionsFrom("A")); Assert.AreEqual(1, map.CountConnectionsFrom("B")); page1.Delete(0); }
public void Connects_GetDirectedEdges_EdgesWithoutArrowsAreExcluded() { var page1 = this.GetNewPage(); var shapes = this.draw_standard_shapes(page1); this.connect(shapes[0], shapes[1], false, false); this.connect(shapes[1], shapes[2], false, false); var options = new VA.DocumentAnalysis.ConnectionAnalyzerOptions(); options.NoArrowsHandling = VA.DocumentAnalysis.NoArrowsHandling.ExcludeEdge; var edges1 = VA.DocumentAnalysis.ConnectionAnalyzer.GetDirectedEdges(page1, options); var map1 = new ConnectivityMap(edges1); Assert.AreEqual(0, map1.CountFromNodes()); var edges2 = VA.DocumentAnalysis.ConnectionAnalyzer.GetDirectedEdgesTransitive(page1, options); var map2 = new ConnectivityMap(edges2); Assert.AreEqual(0, map2.CountFromNodes()); page1.Delete(0); }
public static void PathAnalysis() { var page = SampleEnvironment.Application.ActiveDocument.Pages.Add(); page.DrawRectangle(0, 0, 1, 1); var s0 = page.DrawRectangle(0, 0, 1, 1); var s1 = page.DrawRectangle(3, 0, 4, 1); var s2 = page.DrawRectangle(1.5, 1.5, 2.5, 2.5); var s3 = page.DrawRectangle(0, 3, 1, 4); var s4 = page.DrawRectangle(3, 3, 4, 4); var s5 = page.DrawRectangle(3, 6, 4, 7); var s6 = page.DrawRectangle(7, 8, 8, 9); s0.Text = "s0"; s1.Text = "s1"; s2.Text = "s2"; s3.Text = "s3"; s4.Text = "s4"; s5.Text = "s5"; s6.Text = "s6"; var basic_stencil = page.Application.Documents.OpenStencil("basic_u.vss"); var connec_stencil = page.Application.Documents.OpenStencil("connec_u.vss"); var connector = connec_stencil.Masters["Dynamic Connector"]; // connect shapes - but leave s0 alone var dir = IVisio.VisAutoConnectDir.visAutoConnectDirNone; s1.AutoConnect(s2, dir, null); s2.AutoConnect(s3, dir, null); s3.AutoConnect(s2, dir, null); s3.AutoConnect(s4, dir, null); s5.AutoConnect(s6, dir, null); var options0 = new VisioAutomation.DocumentAnalysis.ConnectionAnalyzerOptions(); options0.DirectionSource = VisioAutomation.DocumentAnalysis.DirectionSource.UseConnectionOrder; var normal_edges = VisioAutomation.DocumentAnalysis.ConnectionAnalyzer.GetDirectedEdges(page, options0); var options1 = new VisioAutomation.DocumentAnalysis.ConnectionAnalyzerOptions(); options1.NoArrowsHandling = VisioAutomation.DocumentAnalysis.NoArrowsHandling.ExcludeEdge; var options2 = new VisioAutomation.DocumentAnalysis.ConnectionAnalyzerOptions(); options2.NoArrowsHandling = VisioAutomation.DocumentAnalysis.NoArrowsHandling.TreatEdgeAsBidirectional; var tc_edges_0 = VisioAutomation.DocumentAnalysis.ConnectionAnalyzer.GetDirectedEdgesTransitive(page, options1); var tc_edges_1 = VisioAutomation.DocumentAnalysis.ConnectionAnalyzer.GetDirectedEdgesTransitive(page, options2); var legend0 = page.DrawRectangle(5, 0, 6.5, 6); var sb0 = new System.Text.StringBuilder(); sb0.AppendLine("Connections"); foreach (var e in normal_edges) { string s = string.Format("{0} - {1}", e.From.Text, e.To.Text); sb0.AppendLine(s); } legend0.Text = sb0.ToString(); var legend1 = page.DrawRectangle(6.5, 0, 8.5, 6); var sb1 = new System.Text.StringBuilder(); sb1.AppendLine("Transitive closure (treat edges as bidirectional)"); foreach (var e in tc_edges_1) { string s = string.Format("{0} -> {1}", e.From.Text, e.To.Text); sb1.AppendLine(s); } legend1.Text = sb1.ToString(); }
public List <VA.DocumentAnalysis.ConnectorEdge> GetDirectedEdgesOnPage(TargetPage targetpage, VA.DocumentAnalysis.ConnectionAnalyzerOptions flag) { targetpage = targetpage.ResolveToPage(this._client); var directed_edges = VA.DocumentAnalysis.ConnectionAnalyzer.GetDirectedEdges(targetpage.Page, flag); return(directed_edges); }
/// <summary> /// Returns all the connected pairs of shapes in the active page /// </summary> /// <param name="flag"></param> /// <returns></returns> public List <VA.DocumentAnalysis.ConnectorEdge> GetTransitiveClosureOnActivePage(VisioScripting.TargetPage targetpage, VA.DocumentAnalysis.ConnectionAnalyzerOptions flag) { targetpage = targetpage.ResolveToPage(this._client); return(VA.DocumentAnalysis.ConnectionAnalyzer.GetDirectedEdgesTransitive(targetpage.Page, flag)); }
/// <summary> /// Returns all the connected pairs of shapes in the active page /// </summary> /// <param name="flag"></param> /// <returns></returns> public List <VA.DocumentAnalysis.ConnectorEdge> GetTransitiveClosureOnActivePage(VA.DocumentAnalysis.ConnectionAnalyzerOptions flag) { var cmdtarget = this._client.GetCommandTargetPage(); return(VA.DocumentAnalysis.ConnectionAnalyzer.GetDirectedEdgesTransitive(cmdtarget.ActivePage, flag)); }