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 {
26 public abstract boolean setPosition(LocationPoint point);
27
37 public abstract boolean setPositionAnimated(LocationPoint point, float duration, AnimationType type);
38
49 public abstract boolean setColor(float red, float green, float blue, float alpha);
50
58 public abstract boolean setRadius(float radius);
59
67 public abstract boolean setCollisionEnabled(boolean enabled);
68
77 public abstract boolean setBuffer(float width, float height);
78
87 public abstract boolean setOffset(float width, float height);
88
96 public abstract boolean setPriority(float priority);
97
108 public abstract boolean setOutlineColor(float red, float green, float blue, float alpha);
109
117 public abstract boolean setOutlineRadius(float radius);
118
126 public abstract boolean setOutlineAlpha(float alpha);
127
128 private static final class CppProxy extends CircleMapObject
129 {
130 private final long nativeRef;
131 private final AtomicBoolean destroyed = new AtomicBoolean(false);
132
133 private CppProxy(long nativeRef)
134 {
135 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
136 this.nativeRef = nativeRef;
137 }
138
139 private native void nativeDestroy(long nativeRef);
140 public void _djinni_private_destroy()
141 {
142 boolean destroyed = this.destroyed.getAndSet(true);
143 if (!destroyed) nativeDestroy(this.nativeRef);
144 }
145 protected void finalize() throws java.lang.Throwable
146 {
147 _djinni_private_destroy();
148 super.finalize();
149 }
150
151 // CircleMapObject methods
152
153 @Override
154 public boolean setPosition(LocationPoint point)
155 {
156 assert !this.destroyed.get() : "trying to use a destroyed object";
157 return native_setPosition(this.nativeRef, point);
158 }
159 private native boolean native_setPosition(long _nativeRef, LocationPoint point);
160
161 @Override
162 public boolean setPositionAnimated(LocationPoint point, float duration, AnimationType type)
163 {
164 assert !this.destroyed.get() : "trying to use a destroyed object";
165 return native_setPositionAnimated(this.nativeRef, point, duration, type);
166 }
167 private native boolean native_setPositionAnimated(long _nativeRef, LocationPoint point, float duration, AnimationType type);
168
169 @Override
170 public boolean setColor(float red, float green, float blue, float alpha)
171 {
172 assert !this.destroyed.get() : "trying to use a destroyed object";
173 return native_setColor(this.nativeRef, red, green, blue, alpha);
174 }
175 private native boolean native_setColor(long _nativeRef, float red, float green, float blue, float alpha);
176
177 @Override
178 public boolean setRadius(float radius)
179 {
180 assert !this.destroyed.get() : "trying to use a destroyed object";
181 return native_setRadius(this.nativeRef, radius);
182 }
183 private native boolean native_setRadius(long _nativeRef, float radius);
184
185 @Override
186 public boolean setCollisionEnabled(boolean enabled)
187 {
188 assert !this.destroyed.get() : "trying to use a destroyed object";
189 return native_setCollisionEnabled(this.nativeRef, enabled);
190 }
191 private native boolean native_setCollisionEnabled(long _nativeRef, boolean enabled);
192
193 @Override
194 public boolean setBuffer(float width, float height)
195 {
196 assert !this.destroyed.get() : "trying to use a destroyed object";
197 return native_setBuffer(this.nativeRef, width, height);
198 }
199 private native boolean native_setBuffer(long _nativeRef, float width, float height);
200
201 @Override
202 public boolean setOffset(float width, float height)
203 {
204 assert !this.destroyed.get() : "trying to use a destroyed object";
205 return native_setOffset(this.nativeRef, width, height);
206 }
207 private native boolean native_setOffset(long _nativeRef, float width, float height);
208
209 @Override
210 public boolean setPriority(float priority)
211 {
212 assert !this.destroyed.get() : "trying to use a destroyed object";
213 return native_setPriority(this.nativeRef, priority);
214 }
215 private native boolean native_setPriority(long _nativeRef, float priority);
216
217 @Override
218 public boolean setOutlineColor(float red, float green, float blue, float alpha)
219 {
220 assert !this.destroyed.get() : "trying to use a destroyed object";
221 return native_setOutlineColor(this.nativeRef, red, green, blue, alpha);
222 }
223 private native boolean native_setOutlineColor(long _nativeRef, float red, float green, float blue, float alpha);
224
225 @Override
226 public boolean setOutlineRadius(float radius)
227 {
228 assert !this.destroyed.get() : "trying to use a destroyed object";
229 return native_setOutlineRadius(this.nativeRef, radius);
230 }
231 private native boolean native_setOutlineRadius(long _nativeRef, float radius);
232
233 @Override
234 public boolean setOutlineAlpha(float alpha)
235 {
236 assert !this.destroyed.get() : "trying to use a destroyed object";
237 return native_setOutlineAlpha(this.nativeRef, alpha);
238 }
239 private native boolean native_setOutlineAlpha(long _nativeRef, float alpha);
240
241 // MapObject methods
242
243 @Override
244 public int getId()
245 {
246 assert !this.destroyed.get() : "trying to use a destroyed object";
247 return native_getId(this.nativeRef);
248 }
249 private native int native_getId(long _nativeRef);
250
251 @Override
252 public MapObjectType getType()
253 {
254 assert !this.destroyed.get() : "trying to use a destroyed object";
255 return native_getType(this.nativeRef);
256 }
257 private native MapObjectType native_getType(long _nativeRef);
258
259 @Override
260 public byte[] getData()
261 {
262 assert !this.destroyed.get() : "trying to use a destroyed object";
263 return native_getData(this.nativeRef);
264 }
265 private native byte[] native_getData(long _nativeRef);
266
267 @Override
268 public boolean setVisible(boolean visible)
269 {
270 assert !this.destroyed.get() : "trying to use a destroyed object";
271 return native_setVisible(this.nativeRef, visible);
272 }
273 private native boolean native_setVisible(long _nativeRef, boolean visible);
274
275 @Override
276 public boolean setInteractive(boolean interactive)
277 {
278 assert !this.destroyed.get() : "trying to use a destroyed object";
279 return native_setInteractive(this.nativeRef, interactive);
280 }
281 private native boolean native_setInteractive(long _nativeRef, boolean interactive);
282
283 @Override
284 public void setData(byte[] data)
285 {
286 assert !this.destroyed.get() : "trying to use a destroyed object";
287 native_setData(this.nativeRef, data);
288 }
289 private native void native_setData(long _nativeRef, byte[] data);
290
291 @Override
292 public boolean setTitle(String title)
293 {
294 assert !this.destroyed.get() : "trying to use a destroyed object";
295 return native_setTitle(this.nativeRef, title);
296 }
297 private native boolean native_setTitle(long _nativeRef, String title);
298
299 @Override
300 public boolean setAlpha(float alpha)
301 {
302 assert !this.destroyed.get() : "trying to use a destroyed object";
303 return native_setAlpha(this.nativeRef, alpha);
304 }
305 private native boolean native_setAlpha(long _nativeRef, float alpha);
306 }
307}