@Component @Lazy public class AStarHeuristicProvider extends BaseGraphCalulationService
| Modifier and Type | Field and Description |
|---|---|
private com.google.common.eventbus.AsyncEventBus |
clientServerEventBus |
private int |
height |
private Map<javafx.geometry.Point2D,com.carrotsearch.hppc.ObjectDoubleMap<javafx.geometry.Point2D>> |
heuristicMap
A map of heuristic from a node to each other node in the graph.
|
private boolean |
initializing |
private Object |
lock |
private org.apache.logging.log4j.Logger |
logger |
private ExecutorService |
serverThreadPool |
private int |
width |
imageService, map, pointInternerCHECK_DISTANCE, DIAG_CHECK_DISTANCE| Constructor and Description |
|---|
AStarHeuristicProvider() |
| Modifier and Type | Method and Description |
|---|---|
void |
addSourceNodeToHeuristic(javafx.geometry.Point2D source)
Add a new target node to the heuristic.
|
void |
addTargetNodeToHeuristic(javafx.geometry.Point2D target)
Add a new target node to the heuristic.
|
private com.carrotsearch.hppc.ObjectDoubleMap<javafx.geometry.Point2D> |
calculateHeuristicForSource(javafx.geometry.Point2D source,
List<ch.sahits.game.openpatrician.model.city.ICity> cities) |
protected double |
calculateWeight(javafx.geometry.Point2D from,
javafx.geometry.Point2D to)
Calculate the weight between two nodes.
|
(package private) void |
createGraph() |
javafx.geometry.Point2D |
findClosest(javafx.geometry.Point2D point)
Find the closest point in the graph for a defined point.
|
Map<javafx.geometry.Point2D,com.carrotsearch.hppc.ObjectDoubleMap<javafx.geometry.Point2D>> |
getHeuristic()
Retrieve the heuristic map.
|
boolean |
heuristicForSourceAvailable(javafx.geometry.Point2D source)
Check if the heuristic for a target location is calculated.
|
private void |
initialize() |
(package private) void |
initImage() |
void |
registerGameLoad(GameStateChange gameStateChange) |
getPoint, getSegments, getTangentialSegments, isOnSeaprivate final org.apache.logging.log4j.Logger logger
@Autowired @Qualifier(value="serverThreadPool") private ExecutorService serverThreadPool
@Autowired @Qualifier(value="serverClientEventBus") private com.google.common.eventbus.AsyncEventBus clientServerEventBus
private final Object lock
private final Map<javafx.geometry.Point2D,com.carrotsearch.hppc.ObjectDoubleMap<javafx.geometry.Point2D>> heuristicMap
private int width
private int height
private boolean initializing
@PostConstruct private void initialize()
public void registerGameLoad(GameStateChange gameStateChange)
void initImage()
throws IOException
IOExceptionvoid createGraph()
private com.carrotsearch.hppc.ObjectDoubleMap<javafx.geometry.Point2D> calculateHeuristicForSource(javafx.geometry.Point2D source,
List<ch.sahits.game.openpatrician.model.city.ICity> cities)
protected double calculateWeight(javafx.geometry.Point2D from,
javafx.geometry.Point2D to)
BaseGraphCalulationServicecalculateWeight in class BaseGraphCalulationServicefrom - source nodeto - destination nodefrom to topublic boolean heuristicForSourceAvailable(javafx.geometry.Point2D source)
source - locationpublic Map<javafx.geometry.Point2D,com.carrotsearch.hppc.ObjectDoubleMap<javafx.geometry.Point2D>> getHeuristic()
public void addTargetNodeToHeuristic(javafx.geometry.Point2D target)
target - location to be added.public void addSourceNodeToHeuristic(javafx.geometry.Point2D source)
source - location to be added.public javafx.geometry.Point2D findClosest(javafx.geometry.Point2D point)
point - for which the closest defined point should be looked up.pointCopyright © 2011-2017 Sahits GmbH. All Rights Reserved.