1 package cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages;
2
3
4 import java.util.*;import javax.vecmath.*;import cz.cuni.amis.pogamut.base.communication.messages.*;import cz.cuni.amis.pogamut.base.communication.worldview.*;import cz.cuni.amis.pogamut.base.communication.worldview.event.*;import cz.cuni.amis.pogamut.base.communication.worldview.object.*;import cz.cuni.amis.pogamut.multi.communication.worldview.object.*;import cz.cuni.amis.pogamut.base.communication.translator.event.*;import cz.cuni.amis.pogamut.multi.communication.translator.event.*;import cz.cuni.amis.pogamut.base3d.worldview.object.*;import cz.cuni.amis.pogamut.base3d.worldview.object.event.*;import cz.cuni.amis.pogamut.ut2004.communication.messages.*;import cz.cuni.amis.pogamut.ut2004.communication.worldview.objects.*;import cz.cuni.amis.pogamut.ut2004multi.communication.worldview.objects.*;import cz.cuni.amis.pogamut.ut2004.communication.translator.itemdescriptor.*;import cz.cuni.amis.pogamut.ut2004.communication.messages.ItemType.Category;import cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId;import cz.cuni.amis.utils.exception.*;import cz.cuni.amis.pogamut.base.communication.translator.event.IWorldObjectUpdateResult.Result;import cz.cuni.amis.utils.SafeEquals;import cz.cuni.amis.pogamut.base.agent.*;import cz.cuni.amis.pogamut.multi.agent.*;import cz.cuni.amis.pogamut.multi.communication.worldview.property.*;import cz.cuni.amis.pogamut.ut2004multi.communication.worldview.property.*;import cz.cuni.amis.utils.token.*;import cz.cuni.amis.utils.*;
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 public abstract class NavPointLocal
28 extends InfoMessage
29 implements ILocalWorldObject
30
31 ,ILocalGBViewable
32 {
33
34
35
36
37
38
39 public NavPointLocal()
40 {
41 }
42
43
44
45
46 protected long SimTime;
47
48
49
50
51 @Override
52 public long getSimTime() {
53 return SimTime;
54 }
55
56
57
58
59 protected void setSimTime(long SimTime) {
60 this.SimTime = SimTime;
61 }
62
63
64 @Override
65 public abstract
66 NavPointLocal clone();
67
68 @Override
69 public Class getCompositeClass() {
70 return NavPoint.class;
71 }
72
73
74
75
76
77
78
79
80 public abstract UnrealId getId()
81 ;
82
83
84
85
86
87
88 public abstract boolean isVisible()
89 ;
90
91
92
93
94 public NavPointLocal getLocal() {
95 return this;
96 }
97 public ISharedWorldObject getShared() {
98 throw new UnsupportedOperationException("Could not return LOCAL");
99 }
100 public IStaticWorldObject getStatic() {
101 throw new UnsupportedOperationException("Could not return LOCAL");
102 }
103
104
105 @Override
106 public ILocalWorldObjectUpdatedEvent createDisappearEvent() {
107 return new ObjectDisappeared(this, getSimTime());
108 }
109
110 public static class ObjectDisappeared implements ILocalWorldObjectUpdatedEvent
111 {
112
113 public ObjectDisappeared(NavPointLocal obj, long time) {
114 this.obj = obj;
115 this.time = time;
116 }
117
118 private NavPointLocal obj;
119 private long time;
120
121 @Override
122 public WorldObjectId getId() {
123 return obj.getId();
124 }
125
126
127
128
129 @Override
130 public long getSimTime() {
131 return time;
132 }
133
134 @Override
135 public IWorldObjectUpdateResult<ILocalWorldObject> update(ILocalWorldObject obj)
136 {
137 if (obj == null) {
138 throw new PogamutException("Can't 'disappear' null!", this);
139 }
140 if (!(obj instanceof NavPointLocalImpl)) {
141 throw new PogamutException("Can't update different class than NavPointLocalImpl, got class " + obj.getClass().getSimpleName() + "!", this);
142 }
143 NavPointLocalImpl toUpdate = (NavPointLocalImpl)obj;
144 if (toUpdate.Visible) {
145 toUpdate.Visible = false;
146 return new IWorldObjectUpdateResult.WorldObjectUpdateResult(IWorldObjectUpdateResult.Result.UPDATED, obj);
147 } else {
148 return new IWorldObjectUpdateResult.WorldObjectUpdateResult(IWorldObjectUpdateResult.Result.SAME, obj);
149 }
150 }
151
152 }
153
154
155
156 public String toString() {
157 return
158 super.toString() + "[" +
159
160 "Id = " + String.valueOf(getId()
161 ) + " | " +
162
163 "Visible = " + String.valueOf(isVisible()
164 ) + " | " +
165
166 "]";
167 }
168
169
170 public String toHtmlString() {
171 return super.toString() + "[<br/>" +
172
173 "<b>Id</b> = " + String.valueOf(getId()
174 ) + " <br/> " +
175
176 "<b>Visible</b> = " + String.valueOf(isVisible()
177 ) + " <br/> " +
178
179 "<br/>]";
180 }
181
182
183
184
185
186
187
188
189
190
191 }
192