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
61 public abstract void removePositionListener(PositionListener listener);
62
63 private static final class CppProxy extends NavigationManager
64 {
65 private final long nativeRef;
66 private final AtomicBoolean destroyed = new AtomicBoolean(false);
67
68 private CppProxy(long nativeRef)
69 {
70 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
71 this.nativeRef = nativeRef;
72 }
73
74 private native void nativeDestroy(long nativeRef);
75 public void _djinni_private_destroy()
76 {
77 boolean destroyed = this.destroyed.getAndSet(true);
78 if (!destroyed) nativeDestroy(this.nativeRef);
79 }
80 protected void finalize() throws java.lang.Throwable
81 {
82 _djinni_private_destroy();
83 super.finalize();
84 }
85
86 // NavigationManager methods
87
88 @Override
89 public void addPositionListener(PositionListener listener)
90 {
91 assert !this.destroyed.get() : "trying to use a destroyed object";
92 native_addPositionListener(this.nativeRef, listener);
93 }
94 private native void native_addPositionListener(long _nativeRef, PositionListener listener);
95
96 @Override
97 public void startLogRecording()
98 {
99 assert !this.destroyed.get() : "trying to use a destroyed object";
100 native_startLogRecording(this.nativeRef);
101 }
102 private native void native_startLogRecording(long _nativeRef);
103
104 @Override
105 public void addCheckPoint(LocationPoint point)
106 {
107 assert !this.destroyed.get() : "trying to use a destroyed object";
108 native_addCheckPoint(this.nativeRef, point);
109 }
110 private native void native_addCheckPoint(long _nativeRef, LocationPoint point);
111
112 @Override
113 public void stopLogRecording()
114 {
115 assert !this.destroyed.get() : "trying to use a destroyed object";
116 native_stopLogRecording(this.nativeRef);
117 }
118 private native void native_stopLogRecording(long _nativeRef);
119
120 @Override
121 public void addLocationMeasurement(GlobalPoint point, float accuracy, String provider)
122 {
123 assert !this.destroyed.get() : "trying to use a destroyed object";
124 native_addLocationMeasurement(this.nativeRef, point, accuracy, provider);
125 }
126 private native void native_addLocationMeasurement(long _nativeRef, GlobalPoint point, float accuracy, String provider);
127
128 @Override
129 public void removePositionListener(PositionListener listener)
130 {
131 assert !this.destroyed.get() : "trying to use a destroyed object";
132 native_removePositionListener(this.nativeRef, listener);
133 }
134 private native void native_removePositionListener(long _nativeRef, PositionListener listener);
135 }
136}