Loading...
Searching...
No Matches
PolygonMapObject.java
Go to the documentation of this file.
1package com.navigine.idl.java;
2
3import java.util.concurrent.atomic.AtomicBoolean;
4
18public abstract class PolygonMapObject extends MapObject {
34 public abstract boolean setPolygon(LocationPolygon polygon);
35
54 public abstract boolean setColor(float red, float green, float blue, float alpha);
55
71 public abstract boolean setOrder(int order);
72
73 private static final class CppProxy extends PolygonMapObject
74 {
75 private final long nativeRef;
76 private final AtomicBoolean destroyed = new AtomicBoolean(false);
77
78 private CppProxy(long nativeRef)
79 {
80 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
81 this.nativeRef = nativeRef;
82 }
83
84 private native void nativeDestroy(long nativeRef);
85 public void _djinni_private_destroy()
86 {
87 boolean destroyed = this.destroyed.getAndSet(true);
88 if (!destroyed) nativeDestroy(this.nativeRef);
89 }
90 protected void finalize() throws java.lang.Throwable
91 {
92 _djinni_private_destroy();
93 super.finalize();
94 }
95
96 // PolygonMapObject methods
97
98 @Override
99 public boolean setPolygon(LocationPolygon polygon)
100 {
101 assert !this.destroyed.get() : "trying to use a destroyed object";
102 return native_setPolygon(this.nativeRef, polygon);
103 }
104 private native boolean native_setPolygon(long _nativeRef, LocationPolygon polygon);
105
106 @Override
107 public boolean setColor(float red, float green, float blue, float alpha)
108 {
109 assert !this.destroyed.get() : "trying to use a destroyed object";
110 return native_setColor(this.nativeRef, red, green, blue, alpha);
111 }
112 private native boolean native_setColor(long _nativeRef, float red, float green, float blue, float alpha);
113
114 @Override
115 public boolean setOrder(int order)
116 {
117 assert !this.destroyed.get() : "trying to use a destroyed object";
118 return native_setOrder(this.nativeRef, order);
119 }
120 private native boolean native_setOrder(long _nativeRef, int order);
121
122 // MapObject methods
123
124 @Override
125 public int getId()
126 {
127 assert !this.destroyed.get() : "trying to use a destroyed object";
128 return native_getId(this.nativeRef);
129 }
130 private native int native_getId(long _nativeRef);
131
132 @Override
133 public MapObjectType getType()
134 {
135 assert !this.destroyed.get() : "trying to use a destroyed object";
136 return native_getType(this.nativeRef);
137 }
138 private native MapObjectType native_getType(long _nativeRef);
139
140 @Override
141 public byte[] getData()
142 {
143 assert !this.destroyed.get() : "trying to use a destroyed object";
144 return native_getData(this.nativeRef);
145 }
146 private native byte[] native_getData(long _nativeRef);
147
148 @Override
149 public boolean setVisible(boolean visible)
150 {
151 assert !this.destroyed.get() : "trying to use a destroyed object";
152 return native_setVisible(this.nativeRef, visible);
153 }
154 private native boolean native_setVisible(long _nativeRef, boolean visible);
155
156 @Override
157 public boolean setInteractive(boolean interactive)
158 {
159 assert !this.destroyed.get() : "trying to use a destroyed object";
160 return native_setInteractive(this.nativeRef, interactive);
161 }
162 private native boolean native_setInteractive(long _nativeRef, boolean interactive);
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 @Override
181 public boolean setAlpha(float alpha)
182 {
183 assert !this.destroyed.get() : "trying to use a destroyed object";
184 return native_setAlpha(this.nativeRef, alpha);
185 }
186 private native boolean native_setAlpha(long _nativeRef, float alpha);
187 }
188}