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 {
26 public abstract boolean setPolygon(LocationPolygon polygon);
27
38 public abstract boolean setColor(float red, float green, float blue, float alpha);
39
47 public abstract boolean setOrder(int order);
48
49 private static final class CppProxy extends PolygonMapObject
50 {
51 private final long nativeRef;
52 private final AtomicBoolean destroyed = new AtomicBoolean(false);
53
54 private CppProxy(long nativeRef)
55 {
56 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
57 this.nativeRef = nativeRef;
58 }
59
60 private native void nativeDestroy(long nativeRef);
61 public void _djinni_private_destroy()
62 {
63 boolean destroyed = this.destroyed.getAndSet(true);
64 if (!destroyed) nativeDestroy(this.nativeRef);
65 }
66 protected void finalize() throws java.lang.Throwable
67 {
68 _djinni_private_destroy();
69 super.finalize();
70 }
71
72 // PolygonMapObject methods
73
74 @Override
75 public boolean setPolygon(LocationPolygon polygon)
76 {
77 assert !this.destroyed.get() : "trying to use a destroyed object";
78 return native_setPolygon(this.nativeRef, polygon);
79 }
80 private native boolean native_setPolygon(long _nativeRef, LocationPolygon polygon);
81
82 @Override
83 public boolean setColor(float red, float green, float blue, float alpha)
84 {
85 assert !this.destroyed.get() : "trying to use a destroyed object";
86 return native_setColor(this.nativeRef, red, green, blue, alpha);
87 }
88 private native boolean native_setColor(long _nativeRef, float red, float green, float blue, float alpha);
89
90 @Override
91 public boolean setOrder(int order)
92 {
93 assert !this.destroyed.get() : "trying to use a destroyed object";
94 return native_setOrder(this.nativeRef, order);
95 }
96 private native boolean native_setOrder(long _nativeRef, int order);
97
98 // MapObject methods
99
100 @Override
101 public int getId()
102 {
103 assert !this.destroyed.get() : "trying to use a destroyed object";
104 return native_getId(this.nativeRef);
105 }
106 private native int native_getId(long _nativeRef);
107
108 @Override
109 public MapObjectType getType()
110 {
111 assert !this.destroyed.get() : "trying to use a destroyed object";
112 return native_getType(this.nativeRef);
113 }
114 private native MapObjectType native_getType(long _nativeRef);
115
116 @Override
117 public byte[] getData()
118 {
119 assert !this.destroyed.get() : "trying to use a destroyed object";
120 return native_getData(this.nativeRef);
121 }
122 private native byte[] native_getData(long _nativeRef);
123
124 @Override
125 public boolean setVisible(boolean visible)
126 {
127 assert !this.destroyed.get() : "trying to use a destroyed object";
128 return native_setVisible(this.nativeRef, visible);
129 }
130 private native boolean native_setVisible(long _nativeRef, boolean visible);
131
132 @Override
133 public boolean setInteractive(boolean interactive)
134 {
135 assert !this.destroyed.get() : "trying to use a destroyed object";
136 return native_setInteractive(this.nativeRef, interactive);
137 }
138 private native boolean native_setInteractive(long _nativeRef, boolean interactive);
139
140 @Override
141 public void setData(byte[] data)
142 {
143 assert !this.destroyed.get() : "trying to use a destroyed object";
144 native_setData(this.nativeRef, data);
145 }
146 private native void native_setData(long _nativeRef, byte[] data);
147
148 @Override
149 public boolean setTitle(String title)
150 {
151 assert !this.destroyed.get() : "trying to use a destroyed object";
152 return native_setTitle(this.nativeRef, title);
153 }
154 private native boolean native_setTitle(long _nativeRef, String title);
155
156 @Override
157 public boolean setAlpha(float alpha)
158 {
159 assert !this.destroyed.get() : "trying to use a destroyed object";
160 return native_setAlpha(this.nativeRef, alpha);
161 }
162 private native boolean native_setAlpha(long _nativeRef, float alpha);
163 }
164}