示例#1
0
        /// <summary>
        /// This methods re-routes a moved tasks connections and any other connections that it now intersects.
        /// It is called when a task is dragged on the diagram.
        /// It is also called when a new task is dropped from the palette.
        /// In this case there are no existing connections to the task but it may intersect other connections
        /// which will need to be re-routed.
        /// </summary>
        /// <param name="task"></param>
        public void ReRouteTask(TaskObj task)
        {
            var taskConnectors  = Connector.GetConnections(task).ToArray();
            var bounds          = DiagramView.View.RoundOutToGrid(task.Symbol.Shape.Bounds);
            var otherConnectors =
                (from c in Connector.Connectors
                 where !taskConnectors.Contains(c)
                 where c.HitsRectangle(bounds)
                 select c).ToList();

            // Need to unroute these first or they interfere with the router heuristics
            foreach (var connector in taskConnectors)
            {
                connector.UnRoute();
            }

            foreach (var connector in otherConnectors)
            {
                connector.UnRoute();
            }

            var router = new ConnectionRouter(this);

            router.MapConnectors();

            foreach (var connector in taskConnectors)
            {
                router.RouteConnection(connector);
            }

            foreach (var connector in otherConnectors)
            {
                router.RouteConnection(connector);
            }
        }
示例#2
0
        public void RouteConnection(Connector conn)
        {
            var router = new ConnectionRouter(this);

            router.MapConnectors();
            router.RouteConnection(conn);
        }
示例#3
0
        public void RouteConnections()
        {
            // TODO: Why is this being recreated?
            var router = new ConnectionRouter(this);

            router.MapConnectors();
            foreach (var connector in Connector.Connectors.Where(c => !c.Routed))
            {
                router.RouteConnection(connector);
            }
        }