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
60 private static final class CppProxy extends CircleMapObject
61 {
62 private final long nativeRef;
63 private final AtomicBoolean destroyed = new AtomicBoolean(false);
64
65 private CppProxy(long nativeRef)
66 {
67 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
68 this.nativeRef = nativeRef;
69 }
70
71 private native void nativeDestroy(long nativeRef);
72 public void _djinni_private_destroy()
73 {
74 boolean destroyed = this.destroyed.getAndSet(true);
75 if (!destroyed) nativeDestroy(this.nativeRef);
76 }
77 protected void finalize() throws java.lang.Throwable
78 {
79 _djinni_private_destroy();
80 super.finalize();
81 }
82
83 // CircleMapObject methods
84
85 @Override
86 public boolean setPosition(LocationPoint point)
87 {
88 assert !this.destroyed.get() : "trying to use a destroyed object";
89 return native_setPosition(this.nativeRef, point);
90 }
91 private native boolean native_setPosition(long _nativeRef, LocationPoint point);
92
93 @Override
94 public boolean setPositionAnimated(LocationPoint point, float duration, AnimationType type)
95 {
96 assert !this.destroyed.get() : "trying to use a destroyed object";
97 return native_setPositionAnimated(this.nativeRef, point, duration, type);
98 }
99 private native boolean native_setPositionAnimated(long _nativeRef, LocationPoint point, float duration, AnimationType type);
100
101 @Override
102 public boolean setColor(float red, float green, float blue, float alpha)
103 {
104 assert !this.destroyed.get() : "trying to use a destroyed object";
105 return native_setColor(this.nativeRef, red, green, blue, alpha);
106 }
107 private native boolean native_setColor(long _nativeRef, float red, float green, float blue, float alpha);
108
109 @Override
110 public boolean setRadius(float radius)
111 {
112 assert !this.destroyed.get() : "trying to use a destroyed object";
113 return native_setRadius(this.nativeRef, radius);
114 }
115 private native boolean native_setRadius(long _nativeRef, float radius);
116
117 // MapObject methods
118
119 @Override
120 public int getId()
121 {
122 assert !this.destroyed.get() : "trying to use a destroyed object";
123 return native_getId(this.nativeRef);
124 }
125 private native int native_getId(long _nativeRef);
126
127 @Override
128 public MapObjectType getType()
129 {
130 assert !this.destroyed.get() : "trying to use a destroyed object";
131 return native_getType(this.nativeRef);
132 }
133 private native MapObjectType native_getType(long _nativeRef);
134
135 @Override
136 public byte[] getData()
137 {
138 assert !this.destroyed.get() : "trying to use a destroyed object";
139 return native_getData(this.nativeRef);
140 }
141 private native byte[] native_getData(long _nativeRef);
142
143 @Override
144 public boolean setVisible(boolean visible)
145 {
146 assert !this.destroyed.get() : "trying to use a destroyed object";
147 return native_setVisible(this.nativeRef, visible);
148 }
149 private native boolean native_setVisible(long _nativeRef, boolean visible);
150
151 @Override
152 public boolean setInteractive(boolean interactive)
153 {
154 assert !this.destroyed.get() : "trying to use a destroyed object";
155 return native_setInteractive(this.nativeRef, interactive);
156 }
157 private native boolean native_setInteractive(long _nativeRef, boolean interactive);
158
159 @Override
160 public boolean setStyle(String style)
161 {
162 assert !this.destroyed.get() : "trying to use a destroyed object";
163 return native_setStyle(this.nativeRef, style);
164 }
165 private native boolean native_setStyle(long _nativeRef, String style);
166
167 @Override
168 public void setData(byte[] data)
169 {
170 assert !this.destroyed.get() : "trying to use a destroyed object";
171 native_setData(this.nativeRef, data);
172 }
173 private native void native_setData(long _nativeRef, byte[] data);
174
175 @Override
176 public boolean setTitle(String title)
177 {
178 assert !this.destroyed.get() : "trying to use a destroyed object";
179 return native_setTitle(this.nativeRef, title);
180 }
181 private native boolean native_setTitle(long _nativeRef, String title);
182 }
183}