/// <summary> /// Sets the calculation type /// </summary> /// <param name="calculator"></param> private void SetHeuristictype(AStarHeuristicType calculator) { switch (calculator) { case AStarHeuristicType.FastSearch: _calculationMethod = CalculateHeuristicFast; break; case AStarHeuristicType.Between: _calculationMethod = CalculateHeuristicBetween; break; case AStarHeuristicType.ShortestPath: _calculationMethod = CalculateHeuristicShortestRoute; break; case AStarHeuristicType.ExperimentalSearch: _calculationMethod = CalculateHeuristicExperimental; break; } }
/// <summary> /// Sets the calculation type /// </summary> /// <param name="calculator"></param> private void setHeuristictype(AStarHeuristicType calculator) { switch (calculator) { case AStarHeuristicType.FAST_SEARCH: this.CalculationMethod = CalculateHeuristicFast; break; case AStarHeuristicType.BETWEEN: this.CalculationMethod = CalculateHeuristicBetween; break; case AStarHeuristicType.SHORTEST_PATH: this.CalculationMethod = CalculateHeuristicShortestRoute; break; case AStarHeuristicType.EXPERIMENTAL_SEARCH: this.CalculationMethod = CalculateHeuristicExperimental; break; } }
/// <summary> /// Creates a new AstarSolver /// </summary> /// <param name="inGrid">The inut grid</param> /// <param name="allowDiagonal">Indication if diagonal is allowed</param> /// <param name="calculator">The Calculator method</param> /// <param name="width"></param> /// <param name="height"></param> public AStarSolver(bool allowDiagonal, AStarHeuristicType calculator, TPathNode inGrid, int width, int height) { SetHeuristictype(calculator); _allowDiagonal = allowDiagonal; PrepareMap(inGrid, width, height); }