Loading...
Searching...
No Matches
IconMapObject.java
Go to the documentation of this file.
1package com.navigine.idl.java;
2
3import java.util.concurrent.atomic.AtomicBoolean;
4
20public abstract class IconMapObject extends MapObject {
28 public abstract boolean setPosition(LocationPoint point);
29
39 public abstract boolean setPositionAnimated(LocationPoint point, float duration, AnimationType type);
40
48 public abstract boolean setBitmap(android.graphics.Bitmap bitmap);
49
58 public abstract boolean setSize(float width, float height);
59
67 public abstract boolean setCollisionEnabled(boolean enabled);
68
76 public abstract boolean setAngle(float angle);
77
87 public abstract boolean setAngleAnimated(double angle, float duration, AnimationType type);
88
97 public abstract boolean setBuffer(float width, float height);
98
107 public abstract boolean setOffset(float width, float height);
108
116 public abstract boolean setPriority(float priority);
117
125 public abstract boolean setFlat(boolean flat);
126
127 private static final class CppProxy extends IconMapObject
128 {
129 private final long nativeRef;
130 private final AtomicBoolean destroyed = new AtomicBoolean(false);
131
132 private CppProxy(long nativeRef)
133 {
134 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
135 this.nativeRef = nativeRef;
136 }
137
138 private native void nativeDestroy(long nativeRef);
139 public void _djinni_private_destroy()
140 {
141 boolean destroyed = this.destroyed.getAndSet(true);
142 if (!destroyed) nativeDestroy(this.nativeRef);
143 }
144 protected void finalize() throws java.lang.Throwable
145 {
146 _djinni_private_destroy();
147 super.finalize();
148 }
149
150 // IconMapObject methods
151
152 @Override
153 public boolean setPosition(LocationPoint point)
154 {
155 assert !this.destroyed.get() : "trying to use a destroyed object";
156 return native_setPosition(this.nativeRef, point);
157 }
158 private native boolean native_setPosition(long _nativeRef, LocationPoint point);
159
160 @Override
161 public boolean setPositionAnimated(LocationPoint point, float duration, AnimationType type)
162 {
163 assert !this.destroyed.get() : "trying to use a destroyed object";
164 return native_setPositionAnimated(this.nativeRef, point, duration, type);
165 }
166 private native boolean native_setPositionAnimated(long _nativeRef, LocationPoint point, float duration, AnimationType type);
167
168 @Override
169 public boolean setBitmap(android.graphics.Bitmap bitmap)
170 {
171 assert !this.destroyed.get() : "trying to use a destroyed object";
172 return native_setBitmap(this.nativeRef, bitmap);
173 }
174 private native boolean native_setBitmap(long _nativeRef, android.graphics.Bitmap bitmap);
175
176 @Override
177 public boolean setSize(float width, float height)
178 {
179 assert !this.destroyed.get() : "trying to use a destroyed object";
180 return native_setSize(this.nativeRef, width, height);
181 }
182 private native boolean native_setSize(long _nativeRef, float width, float height);
183
184 @Override
185 public boolean setCollisionEnabled(boolean enabled)
186 {
187 assert !this.destroyed.get() : "trying to use a destroyed object";
188 return native_setCollisionEnabled(this.nativeRef, enabled);
189 }
190 private native boolean native_setCollisionEnabled(long _nativeRef, boolean enabled);
191
192 @Override
193 public boolean setAngle(float angle)
194 {
195 assert !this.destroyed.get() : "trying to use a destroyed object";
196 return native_setAngle(this.nativeRef, angle);
197 }
198 private native boolean native_setAngle(long _nativeRef, float angle);
199
200 @Override
201 public boolean setAngleAnimated(double angle, float duration, AnimationType type)
202 {
203 assert !this.destroyed.get() : "trying to use a destroyed object";
204 return native_setAngleAnimated(this.nativeRef, angle, duration, type);
205 }
206 private native boolean native_setAngleAnimated(long _nativeRef, double angle, float duration, AnimationType type);
207
208 @Override
209 public boolean setBuffer(float width, float height)
210 {
211 assert !this.destroyed.get() : "trying to use a destroyed object";
212 return native_setBuffer(this.nativeRef, width, height);
213 }
214 private native boolean native_setBuffer(long _nativeRef, float width, float height);
215
216 @Override
217 public boolean setOffset(float width, float height)
218 {
219 assert !this.destroyed.get() : "trying to use a destroyed object";
220 return native_setOffset(this.nativeRef, width, height);
221 }
222 private native boolean native_setOffset(long _nativeRef, float width, float height);
223
224 @Override
225 public boolean setPriority(float priority)
226 {
227 assert !this.destroyed.get() : "trying to use a destroyed object";
228 return native_setPriority(this.nativeRef, priority);
229 }
230 private native boolean native_setPriority(long _nativeRef, float priority);
231
232 @Override
233 public boolean setFlat(boolean flat)
234 {
235 assert !this.destroyed.get() : "trying to use a destroyed object";
236 return native_setFlat(this.nativeRef, flat);
237 }
238 private native boolean native_setFlat(long _nativeRef, boolean flat);
239
240 // MapObject methods
241
242 @Override
243 public int getId()
244 {
245 assert !this.destroyed.get() : "trying to use a destroyed object";
246 return native_getId(this.nativeRef);
247 }
248 private native int native_getId(long _nativeRef);
249
250 @Override
251 public MapObjectType getType()
252 {
253 assert !this.destroyed.get() : "trying to use a destroyed object";
254 return native_getType(this.nativeRef);
255 }
256 private native MapObjectType native_getType(long _nativeRef);
257
258 @Override
259 public byte[] getData()
260 {
261 assert !this.destroyed.get() : "trying to use a destroyed object";
262 return native_getData(this.nativeRef);
263 }
264 private native byte[] native_getData(long _nativeRef);
265
266 @Override
267 public boolean setVisible(boolean visible)
268 {
269 assert !this.destroyed.get() : "trying to use a destroyed object";
270 return native_setVisible(this.nativeRef, visible);
271 }
272 private native boolean native_setVisible(long _nativeRef, boolean visible);
273
274 @Override
275 public boolean setInteractive(boolean interactive)
276 {
277 assert !this.destroyed.get() : "trying to use a destroyed object";
278 return native_setInteractive(this.nativeRef, interactive);
279 }
280 private native boolean native_setInteractive(long _nativeRef, boolean interactive);
281
282 @Override
283 public void setData(byte[] data)
284 {
285 assert !this.destroyed.get() : "trying to use a destroyed object";
286 native_setData(this.nativeRef, data);
287 }
288 private native void native_setData(long _nativeRef, byte[] data);
289
290 @Override
291 public boolean setTitle(String title)
292 {
293 assert !this.destroyed.get() : "trying to use a destroyed object";
294 return native_setTitle(this.nativeRef, title);
295 }
296 private native boolean native_setTitle(long _nativeRef, String title);
297
298 @Override
299 public boolean setAlpha(float alpha)
300 {
301 assert !this.destroyed.get() : "trying to use a destroyed object";
302 return native_setAlpha(this.nativeRef, alpha);
303 }
304 private native boolean native_setAlpha(long _nativeRef, float alpha);
305 }
306}