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 {
36 public abstract boolean setPosition(LocationPoint point);
37
55 public abstract boolean setPositionAnimated(LocationPoint point, float duration, AnimationType type);
56
72 public abstract boolean setBitmap(android.graphics.Bitmap bitmap);
73
90 public abstract boolean setSize(float width, float height);
91
107 public abstract boolean setCollisionEnabled(boolean enabled);
108
124 public abstract boolean setAngle(float angle);
125
143 public abstract boolean setAngleAnimated(float angle, float duration, AnimationType type);
144
161 public abstract boolean setBuffer(float width, float height);
162
179 public abstract boolean setOffset(float width, float height);
180
196 public abstract boolean setPriority(float priority);
197
213 public abstract boolean setFlat(boolean flat);
214
215 private static final class CppProxy extends IconMapObject
216 {
217 private final long nativeRef;
218 private final AtomicBoolean destroyed = new AtomicBoolean(false);
219
220 private CppProxy(long nativeRef)
221 {
222 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
223 this.nativeRef = nativeRef;
224 }
225
226 private native void nativeDestroy(long nativeRef);
227 public void _djinni_private_destroy()
228 {
229 boolean destroyed = this.destroyed.getAndSet(true);
230 if (!destroyed) nativeDestroy(this.nativeRef);
231 }
232 protected void finalize() throws java.lang.Throwable
233 {
234 _djinni_private_destroy();
235 super.finalize();
236 }
237
238 // IconMapObject methods
239
240 @Override
241 public boolean setPosition(LocationPoint point)
242 {
243 assert !this.destroyed.get() : "trying to use a destroyed object";
244 return native_setPosition(this.nativeRef, point);
245 }
246 private native boolean native_setPosition(long _nativeRef, LocationPoint point);
247
248 @Override
249 public boolean setPositionAnimated(LocationPoint point, float duration, AnimationType type)
250 {
251 assert !this.destroyed.get() : "trying to use a destroyed object";
252 return native_setPositionAnimated(this.nativeRef, point, duration, type);
253 }
254 private native boolean native_setPositionAnimated(long _nativeRef, LocationPoint point, float duration, AnimationType type);
255
256 @Override
257 public boolean setBitmap(android.graphics.Bitmap bitmap)
258 {
259 assert !this.destroyed.get() : "trying to use a destroyed object";
260 return native_setBitmap(this.nativeRef, bitmap);
261 }
262 private native boolean native_setBitmap(long _nativeRef, android.graphics.Bitmap bitmap);
263
264 @Override
265 public boolean setSize(float width, float height)
266 {
267 assert !this.destroyed.get() : "trying to use a destroyed object";
268 return native_setSize(this.nativeRef, width, height);
269 }
270 private native boolean native_setSize(long _nativeRef, float width, float height);
271
272 @Override
273 public boolean setCollisionEnabled(boolean enabled)
274 {
275 assert !this.destroyed.get() : "trying to use a destroyed object";
276 return native_setCollisionEnabled(this.nativeRef, enabled);
277 }
278 private native boolean native_setCollisionEnabled(long _nativeRef, boolean enabled);
279
280 @Override
281 public boolean setAngle(float angle)
282 {
283 assert !this.destroyed.get() : "trying to use a destroyed object";
284 return native_setAngle(this.nativeRef, angle);
285 }
286 private native boolean native_setAngle(long _nativeRef, float angle);
287
288 @Override
289 public boolean setAngleAnimated(float angle, float duration, AnimationType type)
290 {
291 assert !this.destroyed.get() : "trying to use a destroyed object";
292 return native_setAngleAnimated(this.nativeRef, angle, duration, type);
293 }
294 private native boolean native_setAngleAnimated(long _nativeRef, float angle, float duration, AnimationType type);
295
296 @Override
297 public boolean setBuffer(float width, float height)
298 {
299 assert !this.destroyed.get() : "trying to use a destroyed object";
300 return native_setBuffer(this.nativeRef, width, height);
301 }
302 private native boolean native_setBuffer(long _nativeRef, float width, float height);
303
304 @Override
305 public boolean setOffset(float width, float height)
306 {
307 assert !this.destroyed.get() : "trying to use a destroyed object";
308 return native_setOffset(this.nativeRef, width, height);
309 }
310 private native boolean native_setOffset(long _nativeRef, float width, float height);
311
312 @Override
313 public boolean setPriority(float priority)
314 {
315 assert !this.destroyed.get() : "trying to use a destroyed object";
316 return native_setPriority(this.nativeRef, priority);
317 }
318 private native boolean native_setPriority(long _nativeRef, float priority);
319
320 @Override
321 public boolean setFlat(boolean flat)
322 {
323 assert !this.destroyed.get() : "trying to use a destroyed object";
324 return native_setFlat(this.nativeRef, flat);
325 }
326 private native boolean native_setFlat(long _nativeRef, boolean flat);
327
328 // MapObject methods
329
330 @Override
331 public int getId()
332 {
333 assert !this.destroyed.get() : "trying to use a destroyed object";
334 return native_getId(this.nativeRef);
335 }
336 private native int native_getId(long _nativeRef);
337
338 @Override
339 public MapObjectType getType()
340 {
341 assert !this.destroyed.get() : "trying to use a destroyed object";
342 return native_getType(this.nativeRef);
343 }
344 private native MapObjectType native_getType(long _nativeRef);
345
346 @Override
347 public byte[] getData()
348 {
349 assert !this.destroyed.get() : "trying to use a destroyed object";
350 return native_getData(this.nativeRef);
351 }
352 private native byte[] native_getData(long _nativeRef);
353
354 @Override
355 public boolean setVisible(boolean visible)
356 {
357 assert !this.destroyed.get() : "trying to use a destroyed object";
358 return native_setVisible(this.nativeRef, visible);
359 }
360 private native boolean native_setVisible(long _nativeRef, boolean visible);
361
362 @Override
363 public boolean setInteractive(boolean interactive)
364 {
365 assert !this.destroyed.get() : "trying to use a destroyed object";
366 return native_setInteractive(this.nativeRef, interactive);
367 }
368 private native boolean native_setInteractive(long _nativeRef, boolean interactive);
369
370 @Override
371 public void setData(byte[] data)
372 {
373 assert !this.destroyed.get() : "trying to use a destroyed object";
374 native_setData(this.nativeRef, data);
375 }
376 private native void native_setData(long _nativeRef, byte[] data);
377
378 @Override
379 public boolean setTitle(String title)
380 {
381 assert !this.destroyed.get() : "trying to use a destroyed object";
382 return native_setTitle(this.nativeRef, title);
383 }
384 private native boolean native_setTitle(long _nativeRef, String title);
385
386 @Override
387 public boolean setAlpha(float alpha)
388 {
389 assert !this.destroyed.get() : "trying to use a destroyed object";
390 return native_setAlpha(this.nativeRef, alpha);
391 }
392 private native boolean native_setAlpha(long _nativeRef, float alpha);
393 }
394}