Class BaseGraphCalulationService

  • All Implemented Interfaces:
    ch.sahits.game.graphic.image.model.MapGrid
    Direct Known Subclasses:
    AStarGraphProvider, AStarHeuristicProvider

    public abstract class BaseGraphCalulationService
    extends java.lang.Object
    implements ch.sahits.game.graphic.image.model.MapGrid
    Service providing methods for the calculation of the heuristic and the graph.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2016 Created on Jan 01, 2016
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected ch.sahits.game.graphic.image.IMapImageServiceFacade imageService  
      protected ch.sahits.game.openpatrician.model.map.IMap map  
      protected com.google.common.collect.Interner<javafx.geometry.Point2D> pointInterner  
      • Fields inherited from interface ch.sahits.game.graphic.image.model.MapGrid

        CHECK_DISTANCE, DIAG_CHECK_DISTANCE
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract double calculateWeight​(javafx.geometry.Point2D from, javafx.geometry.Point2D to)
      Calculate the weight between two nodes.
      protected javafx.geometry.Point2D getPoint​(double x, double y)  
      protected java.util.List<ch.sahits.game.graphic.image.ECircleSegment> getSegments​(javafx.geometry.Point2D from, javafx.geometry.Point2D to)  
      protected java.util.List<ch.sahits.game.graphic.image.ECircleSegment> getTangentialSegments​(javafx.geometry.Point2D from, javafx.geometry.Point2D to)  
      boolean isOnSea​(javafx.geometry.Point2D point)
      Verify that a location is actually on sea.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • imageService

        @Autowired
        protected ch.sahits.game.graphic.image.IMapImageServiceFacade imageService
      • map

        @Autowired
        protected ch.sahits.game.openpatrician.model.map.IMap map
      • pointInterner

        @Autowired
        protected com.google.common.collect.Interner<javafx.geometry.Point2D> pointInterner
    • Constructor Detail

      • BaseGraphCalulationService

        public BaseGraphCalulationService()
    • Method Detail

      • getPoint

        protected javafx.geometry.Point2D getPoint​(double x,
                                                   double y)
      • calculateWeight

        protected abstract double calculateWeight​(javafx.geometry.Point2D from,
                                                  javafx.geometry.Point2D to)
        Calculate the weight between two nodes.
        Parameters:
        from - source node
        to - destination node
        Returns:
        weight of the edge from node from to to
      • getSegments

        protected java.util.List<ch.sahits.game.graphic.image.ECircleSegment> getSegments​(javafx.geometry.Point2D from,
                                                                                          javafx.geometry.Point2D to)
      • getTangentialSegments

        protected java.util.List<ch.sahits.game.graphic.image.ECircleSegment> getTangentialSegments​(javafx.geometry.Point2D from,
                                                                                                    javafx.geometry.Point2D to)
      • isOnSea

        public boolean isOnSea​(javafx.geometry.Point2D point)
        Verify that a location is actually on sea.
        Parameters:
        point - to be checked
        Returns:
        true if the point is at sea.