Loading...
Searching...
No Matches
CircleMapObject.java
Go to the documentation of this file.
1package com.navigine.idl.java;
2
3import java.util.concurrent.atomic.AtomicBoolean;
4
18public abstract class CircleMapObject extends MapObject {
34 public abstract boolean setPosition(LocationPoint point);
35
53 public abstract boolean setPositionAnimated(LocationPoint point, float duration, AnimationType type);
54
73 public abstract boolean setColor(float red, float green, float blue, float alpha);
74
90 public abstract boolean setRadius(float radius);
91
107 public abstract boolean setCollisionEnabled(boolean enabled);
108
125 public abstract boolean setBuffer(float width, float height);
126
143 public abstract boolean setOffset(float width, float height);
144
160 public abstract boolean setPriority(float priority);
161
180 public abstract boolean setOutlineColor(float red, float green, float blue, float alpha);
181
197 public abstract boolean setOutlineRadius(float radius);
198
214 public abstract boolean setOutlineAlpha(float alpha);
215
216 private static final class CppProxy extends CircleMapObject
217 {
218 private final long nativeRef;
219 private final AtomicBoolean destroyed = new AtomicBoolean(false);
220
221 private CppProxy(long nativeRef)
222 {
223 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
224 this.nativeRef = nativeRef;
225 }
226
227 private native void nativeDestroy(long nativeRef);
228 public void _djinni_private_destroy()
229 {
230 boolean destroyed = this.destroyed.getAndSet(true);
231 if (!destroyed) nativeDestroy(this.nativeRef);
232 }
233 protected void finalize() throws java.lang.Throwable
234 {
235 _djinni_private_destroy();
236 super.finalize();
237 }
238
239 // CircleMapObject methods
240
241 @Override
242 public boolean setPosition(LocationPoint point)
243 {
244 assert !this.destroyed.get() : "trying to use a destroyed object";
245 return native_setPosition(this.nativeRef, point);
246 }
247 private native boolean native_setPosition(long _nativeRef, LocationPoint point);
248
249 @Override
250 public boolean setPositionAnimated(LocationPoint point, float duration, AnimationType type)
251 {
252 assert !this.destroyed.get() : "trying to use a destroyed object";
253 return native_setPositionAnimated(this.nativeRef, point, duration, type);
254 }
255 private native boolean native_setPositionAnimated(long _nativeRef, LocationPoint point, float duration, AnimationType type);
256
257 @Override
258 public boolean setColor(float red, float green, float blue, float alpha)
259 {
260 assert !this.destroyed.get() : "trying to use a destroyed object";
261 return native_setColor(this.nativeRef, red, green, blue, alpha);
262 }
263 private native boolean native_setColor(long _nativeRef, float red, float green, float blue, float alpha);
264
265 @Override
266 public boolean setRadius(float radius)
267 {
268 assert !this.destroyed.get() : "trying to use a destroyed object";
269 return native_setRadius(this.nativeRef, radius);
270 }
271 private native boolean native_setRadius(long _nativeRef, float radius);
272
273 @Override
274 public boolean setCollisionEnabled(boolean enabled)
275 {
276 assert !this.destroyed.get() : "trying to use a destroyed object";
277 return native_setCollisionEnabled(this.nativeRef, enabled);
278 }
279 private native boolean native_setCollisionEnabled(long _nativeRef, boolean enabled);
280
281 @Override
282 public boolean setBuffer(float width, float height)
283 {
284 assert !this.destroyed.get() : "trying to use a destroyed object";
285 return native_setBuffer(this.nativeRef, width, height);
286 }
287 private native boolean native_setBuffer(long _nativeRef, float width, float height);
288
289 @Override
290 public boolean setOffset(float width, float height)
291 {
292 assert !this.destroyed.get() : "trying to use a destroyed object";
293 return native_setOffset(this.nativeRef, width, height);
294 }
295 private native boolean native_setOffset(long _nativeRef, float width, float height);
296
297 @Override
298 public boolean setPriority(float priority)
299 {
300 assert !this.destroyed.get() : "trying to use a destroyed object";
301 return native_setPriority(this.nativeRef, priority);
302 }
303 private native boolean native_setPriority(long _nativeRef, float priority);
304
305 @Override
306 public boolean setOutlineColor(float red, float green, float blue, float alpha)
307 {
308 assert !this.destroyed.get() : "trying to use a destroyed object";
309 return native_setOutlineColor(this.nativeRef, red, green, blue, alpha);
310 }
311 private native boolean native_setOutlineColor(long _nativeRef, float red, float green, float blue, float alpha);
312
313 @Override
314 public boolean setOutlineRadius(float radius)
315 {
316 assert !this.destroyed.get() : "trying to use a destroyed object";
317 return native_setOutlineRadius(this.nativeRef, radius);
318 }
319 private native boolean native_setOutlineRadius(long _nativeRef, float radius);
320
321 @Override
322 public boolean setOutlineAlpha(float alpha)
323 {
324 assert !this.destroyed.get() : "trying to use a destroyed object";
325 return native_setOutlineAlpha(this.nativeRef, alpha);
326 }
327 private native boolean native_setOutlineAlpha(long _nativeRef, float alpha);
328
329 // MapObject methods
330
331 @Override
332 public int getId()
333 {
334 assert !this.destroyed.get() : "trying to use a destroyed object";
335 return native_getId(this.nativeRef);
336 }
337 private native int native_getId(long _nativeRef);
338
339 @Override
340 public MapObjectType getType()
341 {
342 assert !this.destroyed.get() : "trying to use a destroyed object";
343 return native_getType(this.nativeRef);
344 }
345 private native MapObjectType native_getType(long _nativeRef);
346
347 @Override
348 public byte[] getData()
349 {
350 assert !this.destroyed.get() : "trying to use a destroyed object";
351 return native_getData(this.nativeRef);
352 }
353 private native byte[] native_getData(long _nativeRef);
354
355 @Override
356 public boolean setVisible(boolean visible)
357 {
358 assert !this.destroyed.get() : "trying to use a destroyed object";
359 return native_setVisible(this.nativeRef, visible);
360 }
361 private native boolean native_setVisible(long _nativeRef, boolean visible);
362
363 @Override
364 public boolean setInteractive(boolean interactive)
365 {
366 assert !this.destroyed.get() : "trying to use a destroyed object";
367 return native_setInteractive(this.nativeRef, interactive);
368 }
369 private native boolean native_setInteractive(long _nativeRef, boolean interactive);
370
371 @Override
372 public void setData(byte[] data)
373 {
374 assert !this.destroyed.get() : "trying to use a destroyed object";
375 native_setData(this.nativeRef, data);
376 }
377 private native void native_setData(long _nativeRef, byte[] data);
378
379 @Override
380 public boolean setTitle(String title)
381 {
382 assert !this.destroyed.get() : "trying to use a destroyed object";
383 return native_setTitle(this.nativeRef, title);
384 }
385 private native boolean native_setTitle(long _nativeRef, String title);
386
387 @Override
388 public boolean setAlpha(float alpha)
389 {
390 assert !this.destroyed.get() : "trying to use a destroyed object";
391 return native_setAlpha(this.nativeRef, alpha);
392 }
393 private native boolean native_setAlpha(long _nativeRef, float alpha);
394 }
395}