Loading...
Searching...
No Matches
FlatIconMapObject.java
Go to the documentation of this file.
1package com.navigine.idl.java;
2
3import java.util.concurrent.atomic.AtomicBoolean;
4
20public abstract class FlatIconMapObject extends IconMapObject {
28 public abstract boolean setAngle(double angle);
29
39 public abstract boolean setAngleAnimated(double angle, float duration, AnimationType type);
40
41 private static final class CppProxy extends FlatIconMapObject
42 {
43 private final long nativeRef;
44 private final AtomicBoolean destroyed = new AtomicBoolean(false);
45
46 private CppProxy(long nativeRef)
47 {
48 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
49 this.nativeRef = nativeRef;
50 }
51
52 private native void nativeDestroy(long nativeRef);
53 public void _djinni_private_destroy()
54 {
55 boolean destroyed = this.destroyed.getAndSet(true);
56 if (!destroyed) nativeDestroy(this.nativeRef);
57 }
58 protected void finalize() throws java.lang.Throwable
59 {
60 _djinni_private_destroy();
61 super.finalize();
62 }
63
64 // FlatIconMapObject methods
65
66 @Override
67 public boolean setAngle(double angle)
68 {
69 assert !this.destroyed.get() : "trying to use a destroyed object";
70 return native_setAngle(this.nativeRef, angle);
71 }
72 private native boolean native_setAngle(long _nativeRef, double angle);
73
74 @Override
75 public boolean setAngleAnimated(double angle, float duration, AnimationType type)
76 {
77 assert !this.destroyed.get() : "trying to use a destroyed object";
78 return native_setAngleAnimated(this.nativeRef, angle, duration, type);
79 }
80 private native boolean native_setAngleAnimated(long _nativeRef, double angle, float duration, AnimationType type);
81
82 // IconMapObject methods
83
84 @Override
85 public boolean setPosition(LocationPoint point)
86 {
87 assert !this.destroyed.get() : "trying to use a destroyed object";
88 return native_setPosition(this.nativeRef, point);
89 }
90 private native boolean native_setPosition(long _nativeRef, LocationPoint point);
91
92 @Override
93 public boolean setPositionAnimated(LocationPoint point, float duration, AnimationType type)
94 {
95 assert !this.destroyed.get() : "trying to use a destroyed object";
96 return native_setPositionAnimated(this.nativeRef, point, duration, type);
97 }
98 private native boolean native_setPositionAnimated(long _nativeRef, LocationPoint point, float duration, AnimationType type);
99
100 @Override
101 public boolean setBitmap(android.graphics.Bitmap bitmap)
102 {
103 assert !this.destroyed.get() : "trying to use a destroyed object";
104 return native_setBitmap(this.nativeRef, bitmap);
105 }
106 private native boolean native_setBitmap(long _nativeRef, android.graphics.Bitmap bitmap);
107
108 @Override
109 public boolean setSize(float width, float height)
110 {
111 assert !this.destroyed.get() : "trying to use a destroyed object";
112 return native_setSize(this.nativeRef, width, height);
113 }
114 private native boolean native_setSize(long _nativeRef, float width, float height);
115
116 @Override
117 public int getId()
118 {
119 assert !this.destroyed.get() : "trying to use a destroyed object";
120 return native_getId(this.nativeRef);
121 }
122 private native int native_getId(long _nativeRef);
123
124 @Override
125 public MapObjectType getType()
126 {
127 assert !this.destroyed.get() : "trying to use a destroyed object";
128 return native_getType(this.nativeRef);
129 }
130 private native MapObjectType native_getType(long _nativeRef);
131
132 @Override
133 public byte[] getData()
134 {
135 assert !this.destroyed.get() : "trying to use a destroyed object";
136 return native_getData(this.nativeRef);
137 }
138 private native byte[] native_getData(long _nativeRef);
139
140 @Override
141 public boolean setVisible(boolean visible)
142 {
143 assert !this.destroyed.get() : "trying to use a destroyed object";
144 return native_setVisible(this.nativeRef, visible);
145 }
146 private native boolean native_setVisible(long _nativeRef, boolean visible);
147
148 @Override
149 public boolean setInteractive(boolean interactive)
150 {
151 assert !this.destroyed.get() : "trying to use a destroyed object";
152 return native_setInteractive(this.nativeRef, interactive);
153 }
154 private native boolean native_setInteractive(long _nativeRef, boolean interactive);
155
156 @Override
157 public boolean setStyle(String style)
158 {
159 assert !this.destroyed.get() : "trying to use a destroyed object";
160 return native_setStyle(this.nativeRef, style);
161 }
162 private native boolean native_setStyle(long _nativeRef, String style);
163
164 @Override
165 public void setData(byte[] data)
166 {
167 assert !this.destroyed.get() : "trying to use a destroyed object";
168 native_setData(this.nativeRef, data);
169 }
170 private native void native_setData(long _nativeRef, byte[] data);
171
172 @Override
173 public boolean setTitle(String title)
174 {
175 assert !this.destroyed.get() : "trying to use a destroyed object";
176 return native_setTitle(this.nativeRef, title);
177 }
178 private native boolean native_setTitle(long _nativeRef, String title);
179 }
180}