View Javadoc

1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   
6   package nl.tudelft.goal.ut2004.visualizer.map;
7   
8   import java.awt.Color;
9   import java.util.ArrayList;
10  import java.util.List;
11  
12  import nl.tudelft.goal.ut2004.visualizer.timeline.map.DefaultFadeLine;
13  import nl.tudelft.goal.ut2004.visualizer.timeline.map.IFadeLine;
14  import nl.tudelft.goal.ut2004.visualizer.timeline.map.IRenderableUTAgent;
15  import cz.cuni.amis.introspection.Folder;
16  import cz.cuni.amis.pogamut.base.agent.IAgentId;
17  import cz.cuni.amis.pogamut.base.agent.exceptions.AgentException;
18  import cz.cuni.amis.pogamut.base.agent.state.level0.IAgentState;
19  import cz.cuni.amis.pogamut.base.communication.command.IAct;
20  import cz.cuni.amis.pogamut.base.communication.worldview.IWorldView;
21  import cz.cuni.amis.pogamut.base.component.bus.IComponentBus;
22  import cz.cuni.amis.pogamut.base.component.exception.ComponentCantStartException;
23  import cz.cuni.amis.pogamut.base.utils.logging.IAgentLogger;
24  import cz.cuni.amis.pogamut.base3d.worldview.object.Location;
25  import cz.cuni.amis.pogamut.base3d.worldview.object.Rotation;
26  import cz.cuni.amis.pogamut.base3d.worldview.object.Velocity;
27  import cz.cuni.amis.pogamut.unreal.bot.IUnrealBot;
28  import cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId;
29  import cz.cuni.amis.utils.exception.PogamutException;
30  import cz.cuni.amis.utils.flag.ImmutableFlag;
31  
32  /**
33   * Simple proxy from IUTAgent to IRenderableUTAgent.
34   * 
35   * @author Honza
36   */
37  final class ProxyRenderableAgent implements IRenderableUTAgent {
38  	private int glName;
39  	private IUnrealBot agent;
40  	private Color color;
41  
42  	private static IFadeLine emptyFade = new DefaultFadeLine();
43  
44  	public ProxyRenderableAgent(IUnrealBot agent, Color color, int glName) {
45  		this.agent = agent;
46  		this.glName = glName;
47  		this.color = color;
48  	}
49  
50  	@Override
51  	public Color getColor() {
52  		return color;
53  	}
54  
55  	@Override
56  	public IFadeLine getFadeLine() {
57  		return emptyFade;
58  	}
59  
60  	@Override
61  	public List<String> getAssociatedInfo() {
62  		return new ArrayList<String>(0);
63  	}
64  
65  	// TODO(MP): Not rendering map events.
66  	// @Override
67  	// public List<MapEvent> getMapEvents() {
68  	// return new ArrayList<MapEvent>();
69  	// }
70  
71  	@Override
72  	public Object getDataSource() {
73  		return agent;
74  	}
75  
76  	@Override
77  	public int getGLName() {
78  		return glName;
79  	}
80  
81  	@Override
82  	public void respawn() throws PogamutException {
83  		agent.respawn();
84  	}
85  
86  	/*
87  	 * TODO
88  	 * 
89  	 * @Override public void setBoolConfigure(BoolBotParam param, boolean value) { agent.setBoolConfigure(param, value); }
90  	 * 
91  	 * @Override public boolean getBoolConfigure(BoolBotParam param) { return getBoolConfigure(param); }
92  	 */
93  	@Override
94  	public IAct getAct() {
95  		return agent.getAct();
96  	}
97  
98  	@Override
99  	public String getName() {
100 		return agent.getName();
101 	}
102 
103 	@Override
104 	public IAgentLogger getLogger() {
105 		return agent.getLogger();
106 	}
107 
108 	@Override
109 	public ImmutableFlag<IAgentState> getState() {
110 		return agent.getState();
111 	}
112 
113 	@Override
114 	public void start() throws AgentException {
115 		agent.start();
116 	}
117 
118 	@Override
119 	public void startPaused() throws ComponentCantStartException {
120 		agent.startPaused();
121 	}
122 
123 	@Override
124 	public void pause() throws AgentException {
125 		agent.pause();
126 	}
127 
128 	@Override
129 	public void resume() throws AgentException {
130 		agent.resume();
131 	}
132 
133 	@Override
134 	public void stop() {
135 		agent.stop();
136 	}
137 
138 	@Override
139 	public void kill() {
140 		agent.kill();
141 	}
142 
143 	@Override
144 	public Folder getIntrospection() {
145 		return agent.getIntrospection();
146 	}
147 
148 	@Override
149 	public Location getLocation() {
150 		return agent.getLocation();
151 	}
152 
153 	@Override
154 	public Velocity getVelocity() {
155 		return agent.getVelocity();
156 	}
157 
158 	@Override
159 	public Rotation getRotation() {
160 		return agent.getRotation();
161 	}
162 
163 	@Override
164 	public IWorldView getWorldView() {
165 		throw new UnsupportedOperationException("Not supported yet.");
166 	}
167 
168 	@Override
169 	public IAgentId getComponentId() {
170 		throw new UnsupportedOperationException("Not supported yet.");
171 	}
172 
173 	@Override
174 	public IComponentBus getEventBus() {
175 		throw new UnsupportedOperationException("Not supported yet.");
176 	}
177 
178 }