All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Modules Pages
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 {
25 public abstract void addPositionListener(PositionListener listener);
26
30 public abstract void startLogRecording();
31
32 public abstract void addCheckPoint(LocationPoint point);
33
34 public abstract void stopLogRecording();
35
36 public abstract void addLocationMeasurement(GlobalPoint point, double accuracy, String provider);
37
45 public abstract void removePositionListener(PositionListener listener);
46
47 private static final class CppProxy extends NavigationManager
48 {
49 private final long nativeRef;
50 private final AtomicBoolean destroyed = new AtomicBoolean(false);
51
52 private CppProxy(long nativeRef)
53 {
54 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
55 this.nativeRef = nativeRef;
56 }
57
58 private native void nativeDestroy(long nativeRef);
59 public void _djinni_private_destroy()
60 {
61 boolean destroyed = this.destroyed.getAndSet(true);
62 if (!destroyed) nativeDestroy(this.nativeRef);
63 }
64 protected void finalize() throws java.lang.Throwable
65 {
66 _djinni_private_destroy();
67 super.finalize();
68 }
69
70 // NavigationManager methods
71
72 @Override
73 public void addPositionListener(PositionListener listener)
74 {
75 assert !this.destroyed.get() : "trying to use a destroyed object";
76 native_addPositionListener(this.nativeRef, listener);
77 }
78 private native void native_addPositionListener(long _nativeRef, PositionListener listener);
79
80 @Override
81 public void startLogRecording()
82 {
83 assert !this.destroyed.get() : "trying to use a destroyed object";
84 native_startLogRecording(this.nativeRef);
85 }
86 private native void native_startLogRecording(long _nativeRef);
87
88 @Override
89 public void addCheckPoint(LocationPoint point)
90 {
91 assert !this.destroyed.get() : "trying to use a destroyed object";
92 native_addCheckPoint(this.nativeRef, point);
93 }
94 private native void native_addCheckPoint(long _nativeRef, LocationPoint point);
95
96 @Override
97 public void stopLogRecording()
98 {
99 assert !this.destroyed.get() : "trying to use a destroyed object";
100 native_stopLogRecording(this.nativeRef);
101 }
102 private native void native_stopLogRecording(long _nativeRef);
103
104 @Override
105 public void addLocationMeasurement(GlobalPoint point, double accuracy, String provider)
106 {
107 assert !this.destroyed.get() : "trying to use a destroyed object";
108 native_addLocationMeasurement(this.nativeRef, point, accuracy, provider);
109 }
110 private native void native_addLocationMeasurement(long _nativeRef, GlobalPoint point, double accuracy, String provider);
111
112 @Override
113 public void removePositionListener(PositionListener listener)
114 {
115 assert !this.destroyed.get() : "trying to use a destroyed object";
116 native_removePositionListener(this.nativeRef, listener);
117 }
118 private native void native_removePositionListener(long _nativeRef, PositionListener listener);
119 }
120}