/// <summary> /// Returns all the connected pairs of shapes in the active page /// </summary> /// <param name="flag"></param> /// <returns></returns> public IList<ConnectorEdge> GetTransitiveClosure(ConnectorEdgeHandling flag) { this.AssertApplicationAvailable(); this.AssertDocumentAvailable(); var app = this.Client.VisioApplication; return PathAnalysis.GetTransitiveClosure(app.ActivePage, flag); }
public IList<ConnectorEdge> GetDirectedEdges(ConnectorEdgeHandling flag) { this.AssertApplicationAvailable(); this.AssertDocumentAvailable(); var directed_edges = PathAnalysis.GetDirectedEdges(this.Client.VisioApplication.ActivePage, flag); return directed_edges; }
public IList <ConnectorEdge> GetDirectedEdges(ConnectorEdgeHandling flag) { this.AssertApplicationAvailable(); this.AssertDocumentAvailable(); var directed_edges = PathAnalysis.GetDirectedEdges(this.Client.VisioApplication.ActivePage, flag); return(directed_edges); }
/// <summary> /// Returns all the connected pairs of shapes in the active page /// </summary> /// <param name="flag"></param> /// <returns></returns> public IList <ConnectorEdge> GetTransitiveClosure(ConnectorEdgeHandling flag) { this.AssertApplicationAvailable(); this.AssertDocumentAvailable(); var app = this.Client.VisioApplication; return(PathAnalysis.GetTransitiveClosure(app.ActivePage, flag)); }
public static IList <ConnectorEdge> GetTransitiveClosure( IVisio.Page page, ConnectorEdgeHandling flag) { if (page == null) { throw new System.ArgumentNullException("page"); } var directed_edges = GetDirectedEdges(page, flag) .Select(e => new DirectedEdge <IVisio.Shape, IVisio.Shape>(e.From, e.To, e.Connector)); var closure = GetClosureFromEdges(directed_edges) .Select(x => new ConnectorEdge(null, x.From, x.To)).ToList(); return(closure); }
/// <summary> /// Returns all the directed,connected pairs of shapes in the page /// </summary> /// <param name="page"></param> /// <param name="flag"></param> /// <returns></returns> public static IList <ConnectorEdge> GetDirectedEdges( IVisio.Page page, ConnectorEdgeHandling flag) { if (page == null) { throw new System.ArgumentNullException("page"); } var edges = GetDirectedEdgesRaw(page); if (flag == ConnectorEdgeHandling.Raw) { return(edges); } // At this point we know we need to analyze the connetor arrows to produce the correct results var connnector_ids = edges.Select(e => e.Connector.ID).ToList(); // Get the arrows for each connector var src_beginarrow = VA.ShapeSheet.SRCConstants.BeginArrow; var src_endarrow = VA.ShapeSheet.SRCConstants.EndArrow; var query = new VA.ShapeSheet.Query.CellQuery(); var col_beginarrow = query.Columns.Add(src_beginarrow, "BeginArrow"); var col_endarrow = query.Columns.Add(src_endarrow, "EndArrow"); var arrow_table = query.GetResults <int>(page, connnector_ids); IList <ConnectorEdge> directed_edges = new List <ConnectorEdge>(); int connector_index = 0; foreach (var e in edges) { int beginarrow = arrow_table[connector_index][col_beginarrow.Ordinal]; int endarrow = arrow_table[connector_index][col_endarrow.Ordinal]; if ((beginarrow < 1) && (endarrow < 1)) { // the line has no arrows if (flag == ConnectorEdgeHandling.Arrow_TreatConnectorsWithoutArrowsAsBidirectional) { // in this case treat the connector as pointing in both directions var de1 = new ConnectorEdge(e.Connector, e.To, e.From); var de2 = new ConnectorEdge(e.Connector, e.From, e.To); directed_edges.Add(de1); directed_edges.Add(de2); } else if (flag == ConnectorEdgeHandling.Arrow_ExcludeConnectorsWithoutArrows) { // in this case ignore the connector completely } else { throw new AutomationException("Internal error"); } } else { // The connector has either a from-arrow, a to-arrow, or both // handle if it has a from arrow if (beginarrow > 0) { var de = new ConnectorEdge(e.Connector, e.To, e.From); directed_edges.Add(de); } // handle if it has a to arrow if (endarrow > 0) { var de = new ConnectorEdge(e.Connector, e.From, e.To); directed_edges.Add(de); } } connector_index++; } return(directed_edges); }