View Javadoc

1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   
6   package cz.cuni.amis.pogamut.ut2004.communication.worldview.map;
7   
8   import java.util.HashSet;
9   import java.util.Set;
10  
11  import cz.cuni.amis.pogamut.base3d.worldview.object.Location;
12  import cz.cuni.amis.pogamut.unreal.communication.worldview.map.IUnrealWaypoint;
13  import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.NavPoint;
14  import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.NavPointNeighbourLink;
15  
16  /**
17   * Something like NavPoint but without all ugly changes necessary for serialization
18   * @author Honza
19   */
20  public class Waypoint implements IUnrealWaypoint {
21      private String id;
22      private Location location;
23  
24      private Set<Waylink> outgoing = new HashSet<Waylink>();
25  
26      
27      public String getID() {
28      	return id;
29      }
30      
31      public Waypoint(NavPoint nav) {
32          this.id = nav.getId().getStringId();
33          this.location = new Location(nav.getLocation());
34          
35          for (NavPointNeighbourLink edge : nav.getOutgoingEdges().values()) {
36              outgoing.add(new Waylink(this, edge));
37          }
38      }
39  
40      @Override
41      public Location getLocation() {
42          return new Location(location);
43      }
44  
45      @Override
46      public Set<Waylink> getOutgoingEdges() {
47          return outgoing;
48      }
49  }