View Javadoc

1   package cz.cuni.amis.pogamut.ut2004.agent.navigation.astar;
2   
3   import cz.cuni.amis.pogamut.base3d.worldview.object.Location;
4   import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.NavPoint;
5   
6   public class UT2004AStarGoalNavPoint extends UT2004AStarGoal {
7   
8   	private NavPoint goalNavPoint;
9   
10  	public UT2004AStarGoalNavPoint(NavPoint goalNavPoint) {
11  		this.goalNavPoint = goalNavPoint;
12  	}
13  	
14  	public NavPoint getGoalNavPoint() {
15  		return goalNavPoint;
16  	}
17  
18  	/**
19  	 * Using Euclidian distance via {@link Location#getDistance(Location)}. 
20  	 */
21  	@Override
22  	public int getEstimatedDistanceToGoal(NavPoint node) {
23  		return (int) goalNavPoint.getLocation().getDistance(node.getLocation());
24  	}
25  
26  	@Override
27  	public boolean isGoalReached(NavPoint actualNode) {
28  		return actualNode.getId().equals(goalNavPoint.getId());
29  	}
30  
31  }