Loading...
Searching...
No Matches
NavigationManager.java
Go to the documentation of this file.
1package com.navigine.idl.java;
2
3import java.util.concurrent.atomic.AtomicBoolean;
4
16public abstract class NavigationManager {
33 public abstract void addPositionListener(PositionListener listener);
34
38 public abstract void startLogRecording();
39
40 public abstract void addCheckPoint(LocationPoint point);
41
42 public abstract void stopLogRecording();
43
44 public abstract void addLocationMeasurement(GlobalPoint point, float accuracy, String provider);
45
63 public abstract void removePositionListener(PositionListener listener);
64
65 private static final class CppProxy extends NavigationManager
66 {
67 private final long nativeRef;
68 private final AtomicBoolean destroyed = new AtomicBoolean(false);
69
70 private CppProxy(long nativeRef)
71 {
72 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
73 this.nativeRef = nativeRef;
74 }
75
76 private native void nativeDestroy(long nativeRef);
77 public void _djinni_private_destroy()
78 {
79 boolean destroyed = this.destroyed.getAndSet(true);
80 if (!destroyed) nativeDestroy(this.nativeRef);
81 }
82 protected void finalize() throws java.lang.Throwable
83 {
84 _djinni_private_destroy();
85 super.finalize();
86 }
87
88 // NavigationManager methods
89
90 @Override
91 public void addPositionListener(PositionListener listener)
92 {
93 assert !this.destroyed.get() : "trying to use a destroyed object";
94 native_addPositionListener(this.nativeRef, listener);
95 }
96 private native void native_addPositionListener(long _nativeRef, PositionListener listener);
97
98 @Override
99 public void startLogRecording()
100 {
101 assert !this.destroyed.get() : "trying to use a destroyed object";
102 native_startLogRecording(this.nativeRef);
103 }
104 private native void native_startLogRecording(long _nativeRef);
105
106 @Override
107 public void addCheckPoint(LocationPoint point)
108 {
109 assert !this.destroyed.get() : "trying to use a destroyed object";
110 native_addCheckPoint(this.nativeRef, point);
111 }
112 private native void native_addCheckPoint(long _nativeRef, LocationPoint point);
113
114 @Override
115 public void stopLogRecording()
116 {
117 assert !this.destroyed.get() : "trying to use a destroyed object";
118 native_stopLogRecording(this.nativeRef);
119 }
120 private native void native_stopLogRecording(long _nativeRef);
121
122 @Override
123 public void addLocationMeasurement(GlobalPoint point, float accuracy, String provider)
124 {
125 assert !this.destroyed.get() : "trying to use a destroyed object";
126 native_addLocationMeasurement(this.nativeRef, point, accuracy, provider);
127 }
128 private native void native_addLocationMeasurement(long _nativeRef, GlobalPoint point, float accuracy, String provider);
129
130 @Override
131 public void removePositionListener(PositionListener listener)
132 {
133 assert !this.destroyed.get() : "trying to use a destroyed object";
134 native_removePositionListener(this.nativeRef, listener);
135 }
136 private native void native_removePositionListener(long _nativeRef, PositionListener listener);
137 }
138}