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.udk.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.udk.communication.messages.gbinfomessages.NavPoint;
13  import cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages.NavPointNeighbourLink;
14  import cz.cuni.amis.pogamut.unreal.communication.worldview.map.IUnrealWaypoint;
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      public Waypoint(NavPoint nav) {
27          this.id = nav.getId().getStringId();
28          this.location = new Location(nav.getLocation());
29          
30          for (NavPointNeighbourLink edge : nav.getOutgoingEdges().values()) {
31              outgoing.add(new Waylink(this, edge));
32          }
33      }
34      
35      @Override
36      public String getID() {
37      	return id;
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  }