/// <summary> /// Recompoute join path for given join /// </summary> /// <param name="join">Join which path will be recomputed</param> private void refreshJoinPath(JoinDrawing join) { //TODO avoid uneccessary path finding Navigator = new SceneNavigator(Items); Navigator.EnsureGraphInitialized(); if (Output.DiagramContext.Diagram.UseJoinAvoidance) { Navigator.Graph.Explore(join.From, join.To); join.PointPath = Navigator.Graph.FindPath(join.From, join.To); } else { join.PointPath = new[] { join.From.GlobalConnectPoint, join.To.GlobalConnectPoint }; } }
/// <summary> /// Add join into <see cref="Output"/> /// </summary> /// <param name="join">Added join</param> /// <param name="fromItem">Owner of join start connector</param> /// <param name="toItem">Owner of join end connector</param> internal void AddJoin(JoinDrawing join, DiagramItem fromItem, DiagramItem toItem) { var from = fromItem.GetConnector(join.Definition.From); var to = toItem.GetConnector(join.Definition.To); join.From = from; join.To = to; FollowConnectorPosition.Attach(from, this, (p) => { refreshJoinPath(join); }); FollowConnectorPosition.Attach(to, this, (p) => { refreshJoinPath(join); }); _joins.Add(join); Output.AddJoin(join); }
/// <summary> /// Adds the join to the canvas. /// </summary> /// <param name="join">The join.</param> internal void AddJoin(JoinDrawing join) { Children.Add(join); }