Exemplo n.º 1
0
        public AvidPathfindingResult GetShortestPaths(AvidModel model, AvidWindow start, AvidWindow destination, AvidPathingOptions options)
        {
            AvidModelWindow startWnd       = model.ProjectWindow(start);
            AvidModelWindow destinationWnd = model.ProjectWindow(destination);

            InitializeNodes(model, startWnd, destinationWnd);

            var validLeaves = BuildTree(startWnd, destinationWnd, options);

            var result = new AvidPathfindingResult
            {
                PathExists = validLeaves.Length > 0
            };

            if (result.PathExists)
            {
                result.MinimalDistance = validLeaves[0].NodeDistance;
                result.AllShortestPaths.AddRange(validLeaves.Select(lf => TracePath(lf, startWnd, destinationWnd)));
            }
            return(result);
        }