@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,Map<javafx.geometry.Point2D,Double>> |
heuristicMap
A map of heuristic from a node to each other node in the graph.
|
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 Map<javafx.geometry.Point2D,Double> |
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,Map<javafx.geometry.Point2D,Double>> |
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() |
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,Map<javafx.geometry.Point2D,Double>> heuristicMap
private int width
private int height
@PostConstruct private void initialize()
void initImage()
throws IOException
IOExceptionvoid createGraph()
private Map<javafx.geometry.Point2D,Double> 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,Map<javafx.geometry.Point2D,Double>> 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-2016 Sahits GmbH. All Rights Reserved.