private int GetPathLength(AbstractNode startNode, AbstractNode goalNode) { clusterMap.Start = startNode.LocationL1; clusterMap.Goal = goalNode.LocationL1; int count; //Call A* List <PathFinderNode> intraPath = FGAlgorythm.GetPathByMap(clusterMap); if (intraPath == null) { return(0); } else { count = intraPath.Count - 1; //write path to AbstractGraph List <AbstractNode> path = new List <AbstractNode>(); foreach (PathFinderNode item in intraPath) { Location location = new Location(item.X, item.Y, item.Z); AbstractNode abstractNode = new AbstractNode() { LocationL0 = LocationConvertor.L1ToL0(location, _cluster) }; path.Add(abstractNode); } AbstractGraph.IntraPathes[startNode.Id, goalNode.Id] = path; } return(count); }
public static void GetPath(IMap Map) { //Create the copy of map for map with abstract nodes output AbstractGraph.MapMatrixL1 = (int[, , ])Map.Matrix.Clone(); int abstractMatrixSize = (Map.Matrix.GetUpperBound(0) + 1) * 10; //int abstractMatrixSize = Map.MaxMatrixPoint.X * Map.MaxMatrixPoint.Y; AbstractGraph.WeightMatrix = new int[abstractMatrixSize, abstractMatrixSize]; AbstractGraph.IntraPathes = new List <AbstractNode> [abstractMatrixSize, abstractMatrixSize]; ClusterBuilder clusterBuilder = new ClusterBuilder(Map); AbstractGraph.Clusters = clusterBuilder.GetClusters(); StartGoalAdd startGoal = new StartGoalAdd(Map); // ClustersIterator clustersIterator = //new ClustersIterator(new SetEdgesWeight()); ClustersIterator clustersIterato1r = new ClustersIterator(new SetInterEdge()); ClustersIterator clustersIterator2 = new ClustersIterator(new SetIntraEdge()); AbstractGraph.CutMatrix(); AbstractGraph.SetNodesList(); List <PathFinderNode> abstractPath = FGAlgorythm.GetPathByGraph(new Graph1(Map)); PathConvertor pathConvertor = new PathConvertor(); List <AbstractNode> convertedPath = pathConvertor.Convert(abstractPath); PathRefinement.Refine(convertedPath); _ = AbstractGraph.WeightMatrix; _ = AbstractGraph.Path; _ = AbstractGraph.Clusters; _ = AbstractGraph.Nodes; _ = AbstractGraph.IntraPathes; }