Class RoadAStar


  • public class RoadAStar
    extends AStar<RoadPath,​RoadSegment,​RoadConnection>
    This class provides an implementation of the A* algorithm dedicated to roads.
    Since:
    14.0
    Version:
    17.0 2020-01-04 14:41:55
    Author:
    Stéphane GALLAND
    Maven Group Id:
    org.arakhne.afc.gis
    Maven Artifact Id:
    gisroad
    • Method Detail

      • solve

        public RoadPath solve​(RoadConnection startPoint,
                              RoadConnection endPoint)
        Description copied from class: AStar
        Run the A* algorithm assuming that the graph is oriented is an orientation tool was passed to the constructor.

        The orientation of the graph may also be overridden by the implementations of the A* nodes.

        Overrides:
        solve in class AStar<RoadPath,​RoadSegment,​RoadConnection>
        Parameters:
        startPoint - is the starting point.
        endPoint - is the point to reach.
        Returns:
        the found path, or null if none found.
      • solve

        public RoadPath solve​(Point2D<?,​?> startPoint,
                              Point2D<?,​?> endPoint,
                              RoadNetwork network)
        Run the A* algorithm from the nearest segment to startPoint to the nearest segment to endPoint.
        Parameters:
        startPoint - is the starting point.
        endPoint - is the point to reach.
        network - is the road network to explore.
        Returns:
        the found path, or null if none found.
      • solve

        public RoadPath solve​(RoadConnection startPoint,
                              Point2D<?,​?> endPoint,
                              RoadNetwork network)
        Run the A* algorithm from the nearest segment to startPoint to the nearest segment to endPoint.
        Parameters:
        startPoint - is the starting point.
        endPoint - is the point to reach.
        network - is the road network to explore.
        Returns:
        the found path, or null if none found.
      • solve

        public RoadPath solve​(Point2D<?,​?> startPoint,
                              RoadConnection endPoint,
                              RoadNetwork network)
        Run the A* algorithm from the nearest segment to startPoint to the nearest segment to endPoint.
        Parameters:
        startPoint - is the starting point.
        endPoint - is the point to reach.
        network - is the road network to explore.
        Returns:
        the found path, or null if none found.
      • translateCandidate

        protected AStarNode<RoadSegment,​RoadConnection> translateCandidate​(RoadConnection endPoint,
                                                                                 AStarNode<RoadSegment,​RoadConnection> node)
        Description copied from class: AStar
        Translate the A* node. This function is invoked prior to any treatment with the given A* node. It is assumed that this function replies a good translation of the given node for the A* algorithm; or it replies null if the given node is the target node of the A* algorithm, ie. it corresponds to the given endPoint.

        By default, this function replies the node itself.

        Overrides:
        translateCandidate in class AStar<RoadPath,​RoadSegment,​RoadConnection>
        Parameters:
        endPoint - is the end point given to solve function.
        node - is the current A* node to translate.
        Returns:
        the translation of the node, or null if the node corresponds to the endPoint.
      • invalidPathSegmentFound

        protected boolean invalidPathSegmentFound​(int index,
                                                  RoadSegment segment,
                                                  RoadPath path)
        Description copied from class: AStar
        Invoked when a segment could not be added into the path.

        In standard AStar implementation, this function replies false.

        Overrides:
        invalidPathSegmentFound in class AStar<RoadPath,​RoadSegment,​RoadConnection>
        Parameters:
        index - is the index of the invalid segment.
        segment - is the segment that cannot be added
        path - is the current state of the path.
        Returns:
        true if the path building should continue, false if the path building should stop and replies a null path.