Class AStarGraphProvider

  • All Implemented Interfaces:
    MapGrid

    @Component
    @Lazy
    public class AStarGraphProvider
    extends BaseGraphCalulationService
    Factory class to provide the graph for the AStar path finding calculation
    Author:
    Andi Hotz, (c) Sahits GmbH, 2016 Created on Jan 01, 2016
    • Field Detail

      • serverThreadPool

        @Autowired
        @Qualifier("serverThreadPool")
        private java.util.concurrent.Executor serverThreadPool
      • clientServerEventBus

        @Autowired
        @Qualifier("serverClientEventBus")
        private com.google.common.eventbus.AsyncEventBus clientServerEventBus
      • lock

        private final java.lang.Object lock
      • width

        private int width
      • height

        private int height
      • graph

        private GraphAStar<javafx.geometry.Point2D> graph
      • heuristic

        private java.util.Map<javafx.geometry.Point2D,​com.carrotsearch.hppc.ObjectDoubleMap<javafx.geometry.Point2D>> heuristic
      • initialized

        private boolean initialized
    • Constructor Detail

      • AStarGraphProvider

        public AStarGraphProvider()
    • Method Detail

      • init

        @PostConstruct
        private void init()
      • createGraph

        void createGraph()
      • addDestinationPoint

        public void addDestinationPoint​(javafx.geometry.Point2D newPoint,
                                        boolean isCity)
        Add a new destination Node to the graph. The new point is added to the heuristic as target and to the graph together with edges to its nearest neighbors and they back to the new node.
        Parameters:
        newPoint - new location to add to the graph
        isCity - flag indicating if the new location is a city, which means the coordinates may not be located in the sea area.
      • addDestinationPointInternal

        void addDestinationPointInternal​(javafx.geometry.Point2D newPoint,
                                         boolean isCity)
      • addSourcePointInternal

        void addSourcePointInternal​(javafx.geometry.Point2D source,
                                    boolean isCity)
      • calculateWeight

        protected double calculateWeight​(javafx.geometry.Point2D from,
                                         javafx.geometry.Point2D to)
        Description copied from class: BaseGraphCalulationService
        Calculate the weight between two nodes.
        Specified by:
        calculateWeight in class BaseGraphCalulationService
        Parameters:
        from - source node
        to - destination node
        Returns:
        weight of the edge from node from to to
      • addEdges

        private void addEdges​(javafx.geometry.Point2D from,
                              javafx.geometry.Point2D to,
                              boolean isCity,
                              boolean initial)
      • initImage

        void initImage()
      • getGraph

        public GraphAStar<javafx.geometry.Point2D> getGraph()