@wemap/positioning 14.2.0-beta.0 → 14.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -5
- package/dist/index.js +163 -44
- package/dist/src/location-sources/GnssWifiLocationSource.d.ts.map +1 -1
- package/dist/src/location-sources/LocationSource.d.ts +12 -1
- package/dist/src/location-sources/LocationSource.d.ts.map +1 -1
- package/dist/src/location-sources/VPSLocationSource.d.ts +69 -36
- package/dist/src/location-sources/VPSLocationSource.d.ts.map +1 -1
- package/dist/src/types.d.ts +10 -0
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -22,11 +22,7 @@ GPS and WiFi-based positioning for outdoor navigation. Includes PDR and optional
|
|
|
22
22
|
```typescript
|
|
23
23
|
import { VPSLocationSource } from '@wemap/positioning';
|
|
24
24
|
|
|
25
|
-
const locationSource = new VPSLocationSource(
|
|
26
|
-
vps: {
|
|
27
|
-
endpoint: 'https://vps.example.com'
|
|
28
|
-
}
|
|
29
|
-
});
|
|
25
|
+
const locationSource = new VPSLocationSource();
|
|
30
26
|
|
|
31
27
|
locationSource.onUpdate((pose) => {
|
|
32
28
|
console.log('Position:', pose.position);
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbsoluteAttitudeProvider, AbsolutePositionProvider, GnssWifiProvider, MapMatchingHandler, PositionSmoother, ProvidersOptions, VpsProvider } from "@wemap/providers";
|
|
1
|
+
import { AbsoluteAttitudeProvider, AbsolutePositionProvider, GnssWifiProvider, MapMatchingHandler, PositionSmoother, ProvidersOptions, VpsBackgroundScanner, VpsProvider } from "@wemap/providers";
|
|
2
2
|
import { CoreConfig } from "@wemap/core";
|
|
3
3
|
import { Coordinates, UserPosition } from "@wemap/geo";
|
|
4
4
|
var LocationSource = class {
|
|
@@ -6,6 +6,8 @@ var LocationSource = class {
|
|
|
6
6
|
updateCallbacks = /* @__PURE__ */ new Set();
|
|
7
7
|
errorCallbacks = /* @__PURE__ */ new Set();
|
|
8
8
|
isStarted = !1;
|
|
9
|
+
_locationState = "no_positioning";
|
|
10
|
+
locationStateCallbacks = /* @__PURE__ */ new Set();
|
|
9
11
|
onUpdate(e) {
|
|
10
12
|
if (this.updateCallbacks.add(e), Object.keys(this.currentPose).length > 0) try {
|
|
11
13
|
e({ ...this.currentPose });
|
|
@@ -23,85 +25,157 @@ var LocationSource = class {
|
|
|
23
25
|
this.errorCallbacks.delete(e);
|
|
24
26
|
}
|
|
25
27
|
configureMapMatching(e) {
|
|
26
|
-
e?.minDistance !== void 0 && (MapMatchingHandler.minDistance = e.minDistance), e?.maxDistance !== void 0 && (MapMatchingHandler.maxDistance = e.maxDistance), e?.maxAngleBearing !== void 0 && (MapMatchingHandler.maxAngleBearing = e.maxAngleBearing), e?.minDistance === void 0 && e?.maxDistance === void 0 && (MapMatchingHandler.minDistance = 5, MapMatchingHandler.maxDistance = 30);
|
|
28
|
+
e?.minDistance !== void 0 && (MapMatchingHandler.minDistance = e.minDistance), e?.maxDistance !== void 0 && (MapMatchingHandler.maxDistance = e.maxDistance), e?.maxAngleBearing !== void 0 && (MapMatchingHandler.maxAngleBearing = e.maxAngleBearing), e?.minDistance === void 0 && e?.maxDistance === void 0 && (MapMatchingHandler.minDistance = 5, MapMatchingHandler.maxDistance = 30), e?.useOrientationMatching !== void 0 && (MapMatchingHandler.useOrientationMatching = e.useOrientationMatching), e?.useStrict !== void 0 && (MapMatchingHandler.useStrict = e.useStrict);
|
|
27
29
|
}
|
|
28
30
|
mergeAndEmitUpdate(e) {
|
|
29
31
|
e.position !== void 0 && (this.currentPose.position = e.position), e.attitude !== void 0 && (this.currentPose.attitude = e.attitude), e.inclination !== void 0 && (this.currentPose.inclination = e.inclination), e.time !== void 0 && (this.currentPose.time = e.time), e.accuracy !== void 0 && (this.currentPose.accuracy = e.accuracy), this.emitUpdate({ ...this.currentPose });
|
|
30
32
|
}
|
|
31
33
|
emitUpdate(e) {
|
|
32
|
-
this.updateCallbacks.forEach((
|
|
34
|
+
this.updateCallbacks.forEach((h) => {
|
|
33
35
|
try {
|
|
34
|
-
|
|
36
|
+
h(e);
|
|
35
37
|
} catch (e) {
|
|
36
38
|
console.error(`Error in ${this.constructor.name} callback:`, e);
|
|
37
39
|
}
|
|
38
40
|
});
|
|
39
41
|
}
|
|
40
42
|
emitError(e) {
|
|
41
|
-
this.errorCallbacks.forEach((
|
|
43
|
+
this.errorCallbacks.forEach((h) => {
|
|
42
44
|
try {
|
|
43
|
-
|
|
45
|
+
h(e);
|
|
44
46
|
} catch (e) {
|
|
45
47
|
console.error(`Error in ${this.constructor.name} error callback:`, e);
|
|
46
48
|
}
|
|
47
49
|
});
|
|
48
50
|
}
|
|
49
|
-
|
|
51
|
+
get locationState() {
|
|
52
|
+
return this._locationState;
|
|
53
|
+
}
|
|
54
|
+
onLocationStateChange(e) {
|
|
55
|
+
this.locationStateCallbacks.add(e);
|
|
56
|
+
}
|
|
57
|
+
offLocationStateChange(e) {
|
|
58
|
+
this.locationStateCallbacks.delete(e);
|
|
59
|
+
}
|
|
60
|
+
setLocationState(e) {
|
|
61
|
+
this._locationState !== e && (this._locationState = e, this.locationStateCallbacks.forEach((h) => {
|
|
62
|
+
h(e);
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
}, DEFAULT_BACKGROUND_SCAN_INTERVAL_MS = 3e4, DEFAULT_BACKGROUND_SCAN_ENABLED = !0, DEFAULT_DEGRADED_LOCATION_STATE_THRESHOLD = 50, DEFAULT_NO_POSITIONING_LOCATION_STATE_THRESHOLD = 100, VPSLocationSource = class extends LocationSource {
|
|
50
66
|
absolutePositionProviderId = null;
|
|
51
67
|
absoluteAttitudeProviderId = null;
|
|
52
68
|
vpsProviderListenerId = null;
|
|
53
69
|
positionSmoother;
|
|
54
|
-
|
|
70
|
+
_scanStatus = "stopped";
|
|
55
71
|
scanPromise = null;
|
|
72
|
+
scanResolve = null;
|
|
56
73
|
firstScan = !1;
|
|
74
|
+
lastPosition = null;
|
|
75
|
+
lastScanPosition = null;
|
|
76
|
+
distanceSinceLastScan = 0;
|
|
77
|
+
backgroundScanEnabled;
|
|
78
|
+
_backgroundScanStatus;
|
|
79
|
+
scanStatusCallbacks = /* @__PURE__ */ new Set();
|
|
80
|
+
backgroundScanStatusCallbacks = /* @__PURE__ */ new Set();
|
|
81
|
+
backgroundScanner = null;
|
|
82
|
+
lastBackgroundCandidatePosition = null;
|
|
83
|
+
ACCURACY_BACKGROUND_SCAN_THRESHOLD = 15;
|
|
84
|
+
degradedLocationStateThreshold;
|
|
85
|
+
noPositioningLocationStateThreshold;
|
|
57
86
|
constructor(e = {}) {
|
|
58
|
-
super(), this.configureVpsProvider(e.vps), this.configureMapMatching(e), e.usePositionSmoother !== !1 && (this.positionSmoother = new PositionSmoother((e) => {
|
|
87
|
+
super(), this.backgroundScanEnabled = e.vps?.backgroundScan ?? DEFAULT_BACKGROUND_SCAN_ENABLED, this.degradedLocationStateThreshold = e.vps?.degradedLocationStateThreshold ?? DEFAULT_DEGRADED_LOCATION_STATE_THRESHOLD, this.noPositioningLocationStateThreshold = e.vps?.noPositioningLocationStateThreshold ?? DEFAULT_NO_POSITIONING_LOCATION_STATE_THRESHOLD, this.configureVpsProvider(e.vps), this.configureMapMatching(e), e.usePositionSmoother !== !1 && (this.positionSmoother = new PositionSmoother((e) => {
|
|
59
88
|
this.mergeAndEmitUpdate({
|
|
60
89
|
position: e,
|
|
61
90
|
time: "time" in e ? e.time : Date.now(),
|
|
62
91
|
accuracy: "accuracy" in e ? e.accuracy : void 0
|
|
63
92
|
});
|
|
64
93
|
})), ProvidersOptions.ignoreProviders = ["GnssWifi"];
|
|
94
|
+
let h = e.vps?.backgroundScanIntervalMs ?? DEFAULT_BACKGROUND_SCAN_INTERVAL_MS;
|
|
95
|
+
this.backgroundScanner = new VpsBackgroundScanner({
|
|
96
|
+
enabled: this.backgroundScanEnabled,
|
|
97
|
+
intervalMs: h
|
|
98
|
+
}, (e) => this.handleBackgroundVpsEvent(e), (e) => {
|
|
99
|
+
this.emitError(e);
|
|
100
|
+
}), this._backgroundScanStatus = this.backgroundScanEnabled ? "idle" : "disabled", this.backgroundScanner && this.backgroundScanner.onStatusChange((e) => {
|
|
101
|
+
this.setBackgroundScanStatus(e);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
get scanStatus() {
|
|
105
|
+
return this._scanStatus;
|
|
106
|
+
}
|
|
107
|
+
get backgroundScanStatus() {
|
|
108
|
+
return this._backgroundScanStatus;
|
|
109
|
+
}
|
|
110
|
+
onScanStatusChange(e) {
|
|
111
|
+
return this.scanStatusCallbacks.add(e), () => {
|
|
112
|
+
this.offScanStatusChange(e);
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
offScanStatusChange(e) {
|
|
116
|
+
this.scanStatusCallbacks.delete(e);
|
|
117
|
+
}
|
|
118
|
+
onBackgroundScanStatusChange(e) {
|
|
119
|
+
return this.backgroundScanStatusCallbacks.add(e), () => {
|
|
120
|
+
this.offBackgroundScanStatusChange(e);
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
offBackgroundScanStatusChange(e) {
|
|
124
|
+
this.backgroundScanStatusCallbacks.delete(e);
|
|
125
|
+
}
|
|
126
|
+
setScanStatus(e) {
|
|
127
|
+
this._scanStatus !== e && (this._scanStatus = e, this.scanStatusCallbacks.forEach((h) => {
|
|
128
|
+
try {
|
|
129
|
+
h(e);
|
|
130
|
+
} catch (e) {
|
|
131
|
+
console.error("[VPSLocationSource] Error in scanStatus listener", e);
|
|
132
|
+
}
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
setBackgroundScanStatus(e) {
|
|
136
|
+
this._backgroundScanStatus !== e && (this._backgroundScanStatus = e, this.backgroundScanStatusCallbacks.forEach((h) => {
|
|
137
|
+
try {
|
|
138
|
+
h(e);
|
|
139
|
+
} catch (e) {
|
|
140
|
+
console.error("[VPSLocationSource] Error in backgroundScanStatus listener", e);
|
|
141
|
+
}
|
|
142
|
+
}));
|
|
65
143
|
}
|
|
66
144
|
configureVpsProvider(e) {
|
|
67
|
-
let
|
|
68
|
-
if (!
|
|
69
|
-
let
|
|
70
|
-
|
|
71
|
-
let
|
|
72
|
-
|
|
73
|
-
let
|
|
74
|
-
|
|
75
|
-
let
|
|
76
|
-
|
|
145
|
+
let h = CoreConfig.getConfig()?.arNavigationData?.providers?.vps, g = e?.endpoint ?? h?.endpoint;
|
|
146
|
+
if (!g) throw Error("VPSLocationSource requires an endpoint URL. Provide it in config or ensure CoreConfig is initialized with arNavigationData.providers.vps.endpoint");
|
|
147
|
+
let _ = new URL(g);
|
|
148
|
+
_.href += "geopose", VpsProvider.endpoint = _.toString();
|
|
149
|
+
let v = e?.minInclinationForRequest ?? (h?.minInclinationForRequest ? h.minInclinationForRequest * Math.PI / 180 : void 0);
|
|
150
|
+
v !== void 0 && (VpsProvider.minInclinationForRequest = v);
|
|
151
|
+
let y = e?.waitTimeMinInclinationForRequest ?? h?.waitTimeMinInclinationForRequest;
|
|
152
|
+
y !== void 0 && (VpsProvider.waitTimeMinInclinationForRequest = y);
|
|
153
|
+
let b = e?.useCoarsePose ?? h?.useCoarsePose;
|
|
154
|
+
b !== void 0 && (VpsProvider.useCoarsePose = b), e?.requestCaller !== void 0 && (VpsProvider.requestCaller = e.requestCaller);
|
|
77
155
|
}
|
|
78
156
|
async start() {
|
|
79
|
-
this.isStarted
|
|
157
|
+
this.isStarted || (this.setupListeners(), this.isStarted = !0, this.backgroundScanEnabled ? this.backgroundScanner?.schedule() : this.setBackgroundScanStatus("disabled"));
|
|
80
158
|
}
|
|
81
159
|
async stop() {
|
|
82
|
-
this.isStarted
|
|
160
|
+
this.isStarted && (this.vpsProviderListenerId !== null && (VpsProvider.removeEventListener(this.vpsProviderListenerId), this.vpsProviderListenerId = null, VpsProvider.stop()), this.absolutePositionProviderId !== null && (AbsolutePositionProvider.removeEventListener(this.absolutePositionProviderId), this.absolutePositionProviderId = null), this.absoluteAttitudeProviderId !== null && (AbsoluteAttitudeProvider.removeEventListener(this.absoluteAttitudeProviderId), this.absoluteAttitudeProviderId = null), this.backgroundScanner?.clear(), this.setBackgroundScanStatus(this.backgroundScanEnabled ? "idle" : "disabled"), this.isStarted = !1, this.setLocationState("no_positioning"));
|
|
83
161
|
}
|
|
84
162
|
async startScan() {
|
|
163
|
+
return await this.backgroundScanner?.cancelRunningScan(), this.startScanInternal();
|
|
164
|
+
}
|
|
165
|
+
async startScanInternal() {
|
|
85
166
|
if (this.firstScan = !0, this.isStarted || await this.start(), await this.setupListeners(), this.vpsProviderListenerId !== null) return this.scanPromise ?? Promise.resolve(!1);
|
|
86
167
|
let e = await VpsProvider.getAvailability();
|
|
87
168
|
if (e instanceof Error) throw e;
|
|
88
|
-
return this.
|
|
89
|
-
this.vpsProviderListenerId = VpsProvider.addEventListener((
|
|
90
|
-
this.stopScan();
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
d.position = u.absolutePosition;
|
|
94
|
-
let e = "time" in u.absolutePosition ? u.absolutePosition.time : Date.now(), f = "accuracy" in u.absolutePosition ? u.absolutePosition.accuracy : void 0;
|
|
95
|
-
d.time = e, f !== void 0 && (d.accuracy = f);
|
|
96
|
-
}
|
|
97
|
-
u.absoluteAttitude && (d.attitude = u.absoluteAttitude), this.mergeAndEmitUpdate(d), e(!0);
|
|
98
|
-
}, (u) => {
|
|
99
|
-
this.emitError(u), e(!1);
|
|
169
|
+
return this.setScanStatus("scanning"), this.scanPromise = new Promise((e) => {
|
|
170
|
+
this.scanResolve = e, this.vpsProviderListenerId = VpsProvider.addEventListener((h) => {
|
|
171
|
+
this.scanResolve = null, this.stopScan(), this.handleVpsEvent(h), this.backgroundScanner?.schedule(), e(!0);
|
|
172
|
+
}, (h) => {
|
|
173
|
+
this.scanResolve = null, this.emitError(h), this.backgroundScanner?.schedule(), e(!1);
|
|
100
174
|
});
|
|
101
175
|
}), this.scanPromise;
|
|
102
176
|
}
|
|
103
|
-
async stopScan() {
|
|
104
|
-
this.vpsProviderListenerId !== null && (VpsProvider.removeEventListener(this.vpsProviderListenerId), this.vpsProviderListenerId = null, VpsProvider.stop(), this.
|
|
177
|
+
async stopScan(e = !1) {
|
|
178
|
+
e && this.scanResolve && (this.scanResolve(!1), this.scanResolve = null), this.vpsProviderListenerId !== null && (VpsProvider.removeEventListener(this.vpsProviderListenerId), this.vpsProviderListenerId = null, VpsProvider.stop(), this.setScanStatus("stopped"));
|
|
105
179
|
}
|
|
106
180
|
async setupListeners() {
|
|
107
181
|
if (!this.absolutePositionProviderId && this.firstScan && (await AbsolutePositionProvider.getAvailability() instanceof Error || (this.absolutePositionProviderId = AbsolutePositionProvider.addEventListener((e) => {
|
|
@@ -109,8 +183,8 @@ var LocationSource = class {
|
|
|
109
183
|
}, (e) => {
|
|
110
184
|
this.emitError(e);
|
|
111
185
|
}))), !this.absoluteAttitudeProviderId && this.firstScan) {
|
|
112
|
-
let
|
|
113
|
-
|
|
186
|
+
let h = await AbsoluteAttitudeProvider.getAvailability();
|
|
187
|
+
h instanceof Error ? console.warn("AbsoluteAttitudeProvider not available:", h) : this.absoluteAttitudeProviderId = AbsoluteAttitudeProvider.addEventListener((e) => {
|
|
114
188
|
this.mergeAndEmitUpdate({
|
|
115
189
|
attitude: e,
|
|
116
190
|
time: "time" in e ? e.time : Date.now()
|
|
@@ -121,12 +195,57 @@ var LocationSource = class {
|
|
|
121
195
|
}
|
|
122
196
|
}
|
|
123
197
|
handleAbsolutePosition(e) {
|
|
124
|
-
this.positionSmoother ? this.positionSmoother.feed(e) : this.mergeAndEmitUpdate({
|
|
198
|
+
this.updateDistanceAndLocationState(e), this.positionSmoother ? this.positionSmoother.feed(e) : this.mergeAndEmitUpdate({
|
|
125
199
|
position: e,
|
|
126
200
|
time: "time" in e ? e.time : Date.now(),
|
|
127
201
|
accuracy: "accuracy" in e ? e.accuracy : void 0
|
|
128
202
|
});
|
|
129
203
|
}
|
|
204
|
+
handleVpsEvent(e) {
|
|
205
|
+
let h = {};
|
|
206
|
+
if (e.absolutePosition) {
|
|
207
|
+
this.registerScanSuccess(e.absolutePosition), h.position = e.absolutePosition;
|
|
208
|
+
let g = "time" in e.absolutePosition ? e.absolutePosition.time : Date.now(), _ = "accuracy" in e.absolutePosition ? e.absolutePosition.accuracy : void 0;
|
|
209
|
+
h.time = g, _ !== void 0 && (h.accuracy = _);
|
|
210
|
+
}
|
|
211
|
+
e.absoluteAttitude && (h.attitude = e.absoluteAttitude), this.mergeAndEmitUpdate(h);
|
|
212
|
+
}
|
|
213
|
+
getCurrentAbsolutePosition() {
|
|
214
|
+
let e = this.currentPose.position;
|
|
215
|
+
return !e || !("latitude" in e) || !("longitude" in e) ? null : e;
|
|
216
|
+
}
|
|
217
|
+
handleBackgroundVpsEvent(e) {
|
|
218
|
+
let h = e.absolutePosition;
|
|
219
|
+
if (!h) {
|
|
220
|
+
this.backgroundScanner?.schedule();
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
let g = this.getCurrentAbsolutePosition();
|
|
224
|
+
if (!this.lastBackgroundCandidatePosition) {
|
|
225
|
+
if (g && h.distanceTo(g) < this.ACCURACY_BACKGROUND_SCAN_THRESHOLD) {
|
|
226
|
+
this.handleVpsEvent(e), this.backgroundScanner?.schedule();
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
this.lastBackgroundCandidatePosition = h, this.backgroundScanner?.runNow();
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
let _ = this.lastBackgroundCandidatePosition;
|
|
233
|
+
this.lastBackgroundCandidatePosition = null;
|
|
234
|
+
let v = !1;
|
|
235
|
+
g && h.distanceTo(g) < this.ACCURACY_BACKGROUND_SCAN_THRESHOLD && (v = !0), !v && _ && h.distanceTo(_) < this.ACCURACY_BACKGROUND_SCAN_THRESHOLD && (v = !0), v && this.handleVpsEvent(e), this.backgroundScanner?.schedule();
|
|
236
|
+
}
|
|
237
|
+
registerScanSuccess(e) {
|
|
238
|
+
this.lastScanPosition = e, this.lastPosition = e, this.distanceSinceLastScan = 0, this.setLocationState("accurate");
|
|
239
|
+
}
|
|
240
|
+
updateDistanceAndLocationState(e) {
|
|
241
|
+
if (this.scanStatus === "scanning") return;
|
|
242
|
+
if (!this.lastPosition) {
|
|
243
|
+
this.lastPosition = e;
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
let h = this.lastPosition.distanceTo(e);
|
|
247
|
+
this.lastPosition = e, this.lastScanPosition && (this.distanceSinceLastScan += h, this.distanceSinceLastScan >= this.noPositioningLocationStateThreshold ? this.setLocationState("no_positioning") : this.distanceSinceLastScan >= this.degradedLocationStateThreshold ? this.setLocationState("degraded") : this.setLocationState("accurate"));
|
|
248
|
+
}
|
|
130
249
|
}, GnssWifiLocationSource = class extends LocationSource {
|
|
131
250
|
absolutePositionProviderId = null;
|
|
132
251
|
absoluteAttitudeProviderId = null;
|
|
@@ -144,15 +263,15 @@ var LocationSource = class {
|
|
|
144
263
|
}, !1);
|
|
145
264
|
}
|
|
146
265
|
configureGnssWifi(e) {
|
|
147
|
-
let
|
|
148
|
-
|
|
266
|
+
let h = CoreConfig.getConfig()?.arNavigationData?.providers, _ = e ?? h?.gnssWifi;
|
|
267
|
+
_ && (_.discardPositionsAbove !== void 0 && (GnssWifiProvider.discardPositionsAbove = _.discardPositionsAbove), _.enableHighAccuracy !== void 0 && (GnssWifiProvider.enableHighAccuracy = _.enableHighAccuracy));
|
|
149
268
|
}
|
|
150
269
|
async start() {
|
|
151
270
|
if (!this.isStarted) try {
|
|
152
271
|
let e = await AbsolutePositionProvider.getAvailability();
|
|
153
272
|
if (e instanceof Error) throw e;
|
|
154
273
|
if (this.absolutePositionProviderId = AbsolutePositionProvider.addEventListener((e) => {
|
|
155
|
-
this.positionSmoother ? this.positionSmoother.feed(e) : this.mergeAndEmitUpdate({
|
|
274
|
+
this.setLocationState("accurate"), this.positionSmoother ? this.positionSmoother.feed(e) : this.mergeAndEmitUpdate({
|
|
156
275
|
position: e,
|
|
157
276
|
time: "time" in e ? e.time : Date.now(),
|
|
158
277
|
accuracy: "accuracy" in e ? e.accuracy : void 0
|
|
@@ -170,8 +289,8 @@ var LocationSource = class {
|
|
|
170
289
|
}
|
|
171
290
|
}
|
|
172
291
|
async startAttitude() {
|
|
173
|
-
let
|
|
174
|
-
|
|
292
|
+
let h = await AbsoluteAttitudeProvider.getAvailability();
|
|
293
|
+
h instanceof Error ? console.warn("AbsoluteAttitudeProvider not available:", h) : this.absoluteAttitudeProviderId = AbsoluteAttitudeProvider.addEventListener((e) => {
|
|
175
294
|
this.mergeAndEmitUpdate({
|
|
176
295
|
attitude: e,
|
|
177
296
|
time: "time" in e ? e.time : Date.now()
|
|
@@ -184,7 +303,7 @@ var LocationSource = class {
|
|
|
184
303
|
this.absoluteAttitudeProviderId !== null && (AbsoluteAttitudeProvider.removeEventListener(this.absoluteAttitudeProviderId), this.absoluteAttitudeProviderId = null);
|
|
185
304
|
}
|
|
186
305
|
async stop() {
|
|
187
|
-
this.isStarted
|
|
306
|
+
this.isStarted && (this.absolutePositionProviderId !== null && (AbsolutePositionProvider.removeEventListener(this.absolutePositionProviderId), this.absolutePositionProviderId = null), this.absoluteAttitudeProviderId !== null && (AbsoluteAttitudeProvider.removeEventListener(this.absoluteAttitudeProviderId), this.absoluteAttitudeProviderId = null), this.isStarted = !1, this.setLocationState("no_positioning"));
|
|
188
307
|
}
|
|
189
308
|
}, MapMatching = class {
|
|
190
309
|
static itinerary = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GnssWifiLocationSource.d.ts","sourceRoot":"","sources":["../../../src/location-sources/GnssWifiLocationSource.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,4BAA6B,SAAQ,qBAAqB;IACzE,uCAAuC;IACvC,iBAAiB;IACjB,QAAQ,CAAC,EAAE;QACT,sDAAsD;QACtD,qBAAqB,CAAC,EAAE,MAAM,CAAC;QAC/B,uDAAuD;QACvD,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC9B,CAAC;IACF,6DAA6D;IAC7D,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,sBAAuB,SAAQ,cAAc;IACxD,OAAO,CAAC,0BAA0B,CAAuB;IACzD,OAAO,CAAC,0BAA0B,CAAuB;IACzD,OAAO,CAAC,gBAAgB,CAAC,CAAmB;IAC5C,OAAO,CAAC,MAAM,CAA+B;gBAEjC,MAAM,GAAE,4BAAiC;IA8BrD,OAAO,CAAC,iBAAiB;IAenB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"GnssWifiLocationSource.d.ts","sourceRoot":"","sources":["../../../src/location-sources/GnssWifiLocationSource.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,4BAA6B,SAAQ,qBAAqB;IACzE,uCAAuC;IACvC,iBAAiB;IACjB,QAAQ,CAAC,EAAE;QACT,sDAAsD;QACtD,qBAAqB,CAAC,EAAE,MAAM,CAAC;QAC/B,uDAAuD;QACvD,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC9B,CAAC;IACF,6DAA6D;IAC7D,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,sBAAuB,SAAQ,cAAc;IACxD,OAAO,CAAC,0BAA0B,CAAuB;IACzD,OAAO,CAAC,0BAA0B,CAAuB;IACzD,OAAO,CAAC,gBAAgB,CAAC,CAAmB;IAC5C,OAAO,CAAC,MAAM,CAA+B;gBAEjC,MAAM,GAAE,4BAAiC;IA8BrD,OAAO,CAAC,iBAAiB;IAenB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAiD5B;;;;;;;;;;OAUG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAmBpC;;;;;;;;;OASG;IACG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAO7B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAkB5B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ILocationSource } from '../ILocationSource';
|
|
2
|
-
import { PartialPose, Pose, MapMatchingOptions } from '../types';
|
|
2
|
+
import { PartialPose, Pose, MapMatchingOptions, LocationState } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Base class for all location sources
|
|
5
5
|
*
|
|
@@ -32,6 +32,8 @@ export declare abstract class LocationSource implements ILocationSource {
|
|
|
32
32
|
protected updateCallbacks: Set<(data: PartialPose) => void>;
|
|
33
33
|
protected errorCallbacks: Set<(error: Error) => void>;
|
|
34
34
|
isStarted: boolean;
|
|
35
|
+
private _locationState;
|
|
36
|
+
private locationStateCallbacks;
|
|
35
37
|
/**
|
|
36
38
|
* Start the location source and begin emitting updates
|
|
37
39
|
*/
|
|
@@ -98,5 +100,14 @@ export declare abstract class LocationSource implements ILocationSource {
|
|
|
98
100
|
* @param error - Error to emit
|
|
99
101
|
*/
|
|
100
102
|
protected emitError(error: Error): void;
|
|
103
|
+
/**
|
|
104
|
+
* Get the current location state
|
|
105
|
+
*
|
|
106
|
+
* @returns The current location state
|
|
107
|
+
*/
|
|
108
|
+
get locationState(): LocationState;
|
|
109
|
+
onLocationStateChange(callback: (status: LocationState) => void): void;
|
|
110
|
+
offLocationStateChange(callback: (status: LocationState) => void): void;
|
|
111
|
+
protected setLocationState(locationState: LocationState): void;
|
|
101
112
|
}
|
|
102
113
|
//# sourceMappingURL=LocationSource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocationSource.d.ts","sourceRoot":"","sources":["../../../src/location-sources/LocationSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"LocationSource.d.ts","sourceRoot":"","sources":["../../../src/location-sources/LocationSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAErF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,8BAAsB,cAAe,YAAW,eAAe;IAC7D,SAAS,CAAC,WAAW,EAAE,IAAI,CAAM;IACjC,SAAS,CAAC,eAAe,aAAkB,WAAW,KAAK,IAAI,EAAI;IACnE,SAAS,CAAC,cAAc,cAAmB,KAAK,KAAK,IAAI,EAAI;IACtD,SAAS,UAAS;IAEzB,OAAO,CAAC,cAAc,CAAmC;IACzD,OAAO,CAAC,sBAAsB,CAA8C;IAE5E;;OAEG;IACH,QAAQ,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAE9B;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,GAAG,IAAI;IAa9C;;;;OAIG;IACH,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,GAAG,IAAI;IAI/C;;;;OAIG;IACH,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI;IAI/C;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI;IAIhD;;;;OAIG;IACH,SAAS,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,IAAI;IA0BlE;;;;OAIG;IACH,SAAS,CAAC,kBAAkB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAsB5D;;;;OAIG;IACH,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAU7C;;;;OAIG;IACH,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAUvC;;;;OAIG;IACH,IAAI,aAAa,IAAI,aAAa,CAEjC;IAEM,qBAAqB,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,GAAG,IAAI;IAItE,sBAAsB,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,GAAG,IAAI;IAI9E,SAAS,CAAC,gBAAgB,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI;CAS/D"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VpsBackgroundScanStatus } from '../../../providers';
|
|
1
2
|
import { LocationSourceOptions } from '../types';
|
|
2
3
|
import { LocationSource } from './LocationSource';
|
|
3
4
|
/**
|
|
@@ -17,51 +18,66 @@ export interface VPSLocationSourceConfig extends LocationSourceOptions {
|
|
|
17
18
|
useCoarsePose?: boolean;
|
|
18
19
|
/** Request caller identifier */
|
|
19
20
|
requestCaller?: string;
|
|
21
|
+
/** If true, automatically start a new scan 30s after the last scan if no scan was triggered in between */
|
|
22
|
+
backgroundScan?: boolean;
|
|
23
|
+
/** Interval in ms before triggering a background scan when no scan was triggered (default: 30000) */
|
|
24
|
+
backgroundScanIntervalMs?: number;
|
|
25
|
+
/** Threshold for degraded location state (default: 50m) */
|
|
26
|
+
degradedLocationStateThreshold?: number;
|
|
27
|
+
/** Threshold for no positioning location state (default: 100m) */
|
|
28
|
+
noPositioningLocationStateThreshold?: number;
|
|
20
29
|
};
|
|
21
30
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*
|
|
25
|
-
* This source provides:
|
|
26
|
-
* - **VPS**: Visual positioning using camera (provides position and attitude)
|
|
27
|
-
* - **PDR**: Pedestrian Dead Reckoning via AbsolutePositionProvider (provides continuous position updates)
|
|
28
|
-
* - **AbsoluteAttitude**: Device orientation tracking
|
|
29
|
-
*
|
|
30
|
-
* VPS (Visual Positioning System) uses the device camera to identify the user's
|
|
31
|
-
* location by matching visual features. After an initial VPS scan, PDR provides
|
|
32
|
-
* continuous position updates as the user moves.
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```typescript
|
|
36
|
-
* import { VPSLocationSource } from '@wemap/positioning';
|
|
37
|
-
*
|
|
38
|
-
* const vpsSource = new VPSLocationSource({
|
|
39
|
-
* usePositionSmoother: true
|
|
40
|
-
* });
|
|
41
|
-
*
|
|
42
|
-
* vpsSource.onUpdate((pose) => {
|
|
43
|
-
* console.log('Position:', pose.position);
|
|
44
|
-
* console.log('Attitude:', pose.attitude);
|
|
45
|
-
* });
|
|
46
|
-
*
|
|
47
|
-
* await vpsSource.start();
|
|
48
|
-
*
|
|
49
|
-
* // Start VPS scan (requires camera access)
|
|
50
|
-
* const scanSuccess = await vpsSource.startScan();
|
|
51
|
-
* if (scanSuccess) {
|
|
52
|
-
* console.log('VPS scan successful!');
|
|
53
|
-
* }
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
31
|
+
export type ScanStatus = 'scanning' | 'stopped';
|
|
32
|
+
export type BackgroundScanStatus = VpsBackgroundScanStatus;
|
|
56
33
|
export declare class VPSLocationSource extends LocationSource {
|
|
57
34
|
private absolutePositionProviderId;
|
|
58
35
|
private absoluteAttitudeProviderId;
|
|
59
36
|
private vpsProviderListenerId;
|
|
60
37
|
private positionSmoother?;
|
|
61
|
-
|
|
38
|
+
private _scanStatus;
|
|
62
39
|
private scanPromise;
|
|
40
|
+
private scanResolve;
|
|
63
41
|
private firstScan;
|
|
42
|
+
private lastPosition;
|
|
43
|
+
private lastScanPosition;
|
|
44
|
+
private distanceSinceLastScan;
|
|
45
|
+
private readonly backgroundScanEnabled;
|
|
46
|
+
private _backgroundScanStatus;
|
|
47
|
+
private scanStatusCallbacks;
|
|
48
|
+
private backgroundScanStatusCallbacks;
|
|
49
|
+
private backgroundScanner;
|
|
50
|
+
private lastBackgroundCandidatePosition;
|
|
51
|
+
private readonly ACCURACY_BACKGROUND_SCAN_THRESHOLD;
|
|
52
|
+
private degradedLocationStateThreshold;
|
|
53
|
+
private noPositioningLocationStateThreshold;
|
|
64
54
|
constructor(config?: VPSLocationSourceConfig);
|
|
55
|
+
/**
|
|
56
|
+
* Current scan status (manual or background).
|
|
57
|
+
*/
|
|
58
|
+
get scanStatus(): ScanStatus;
|
|
59
|
+
/**
|
|
60
|
+
* Current background scan scheduler status.
|
|
61
|
+
*/
|
|
62
|
+
get backgroundScanStatus(): BackgroundScanStatus;
|
|
63
|
+
/**
|
|
64
|
+
* Listen to changes of the main scan status.
|
|
65
|
+
*/
|
|
66
|
+
onScanStatusChange(callback: (status: ScanStatus) => void): () => void;
|
|
67
|
+
/**
|
|
68
|
+
* Stop listening to changes of the main scan status.
|
|
69
|
+
*/
|
|
70
|
+
offScanStatusChange(callback: (status: ScanStatus) => void): void;
|
|
71
|
+
/**
|
|
72
|
+
* Listen to changes of the background scan status.
|
|
73
|
+
*/
|
|
74
|
+
onBackgroundScanStatusChange(callback: (status: BackgroundScanStatus) => void): () => void;
|
|
75
|
+
/**
|
|
76
|
+
* Stop listening to changes of the background scan status.
|
|
77
|
+
*/
|
|
78
|
+
offBackgroundScanStatusChange(callback: (status: BackgroundScanStatus) => void): void;
|
|
79
|
+
private setScanStatus;
|
|
80
|
+
private setBackgroundScanStatus;
|
|
65
81
|
private configureVpsProvider;
|
|
66
82
|
start(): Promise<void>;
|
|
67
83
|
stop(): Promise<void>;
|
|
@@ -72,6 +88,9 @@ export declare class VPSLocationSource extends LocationSource {
|
|
|
72
88
|
* called when the user wants to determine their initial position. The scan
|
|
73
89
|
* will continue until a successful match is found or an error occurs.
|
|
74
90
|
*
|
|
91
|
+
* When background scan is enabled, a manual call to startScan() cancels any
|
|
92
|
+
* ongoing background scan and clears the 30s idle timer.
|
|
93
|
+
*
|
|
75
94
|
* **Note**: This requires camera permissions and the user should point the
|
|
76
95
|
* camera at recognizable visual features in the environment.
|
|
77
96
|
*
|
|
@@ -90,6 +109,7 @@ export declare class VPSLocationSource extends LocationSource {
|
|
|
90
109
|
* ```
|
|
91
110
|
*/
|
|
92
111
|
startScan(): Promise<boolean>;
|
|
112
|
+
private startScanInternal;
|
|
93
113
|
/**
|
|
94
114
|
* Stop the VPS scan
|
|
95
115
|
*
|
|
@@ -100,8 +120,21 @@ export declare class VPSLocationSource extends LocationSource {
|
|
|
100
120
|
* await vpsSource.stopScan();
|
|
101
121
|
* ```
|
|
102
122
|
*/
|
|
103
|
-
|
|
123
|
+
/**
|
|
124
|
+
* @param cancelled If true, resolve the current scan promise with false (e.g. when manual scan cancels a background scan)
|
|
125
|
+
*/
|
|
126
|
+
stopScan(cancelled?: boolean): Promise<void>;
|
|
104
127
|
private setupListeners;
|
|
105
128
|
private handleAbsolutePosition;
|
|
129
|
+
private handleVpsEvent;
|
|
130
|
+
private getCurrentAbsolutePosition;
|
|
131
|
+
/**
|
|
132
|
+
* Handle background VPS result with two-step validation logic:
|
|
133
|
+
* R1: if close to current position (< 15m), accept; otherwise request R2 immediately.
|
|
134
|
+
* R2: if close to current position or close to R1 (< 15m), accept; otherwise wait for next interval.
|
|
135
|
+
*/
|
|
136
|
+
private handleBackgroundVpsEvent;
|
|
137
|
+
private registerScanSuccess;
|
|
138
|
+
private updateDistanceAndLocationState;
|
|
106
139
|
}
|
|
107
140
|
//# sourceMappingURL=VPSLocationSource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VPSLocationSource.d.ts","sourceRoot":"","sources":["../../../src/location-sources/VPSLocationSource.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VPSLocationSource.d.ts","sourceRoot":"","sources":["../../../src/location-sources/VPSLocationSource.ts"],"names":[],"mappings":"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"}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -54,6 +54,10 @@ export interface MapMatchingOptions {
|
|
|
54
54
|
maxDistance?: number;
|
|
55
55
|
/** Minimum distance in meters from route to consider a match */
|
|
56
56
|
minDistance?: number;
|
|
57
|
+
/** Whether to use orientation matching (defaults to true) */
|
|
58
|
+
useOrientationMatching?: boolean;
|
|
59
|
+
/** Whether to use strict map matching (defaults to false) */
|
|
60
|
+
useStrict?: boolean;
|
|
57
61
|
}
|
|
58
62
|
/**
|
|
59
63
|
* Base options for location sources
|
|
@@ -62,4 +66,10 @@ export interface LocationSourceOptions extends MapMatchingOptions {
|
|
|
62
66
|
/** Whether to use position smoothing (defaults to true) */
|
|
63
67
|
usePositionSmoother?: boolean;
|
|
64
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* State of the location source
|
|
71
|
+
*
|
|
72
|
+
* The location state is used to track the accuracy of the location source.
|
|
73
|
+
*/
|
|
74
|
+
export type LocationState = 'accurate' | 'degraded' | 'no_positioning';
|
|
65
75
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEzD;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,IAAI;IACnB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,YAAY,GAAG,gBAAgB,CAAC;IAC3C,uDAAuD;IACvD,QAAQ,CAAC,EAAE,QAAQ,GAAG,gBAAgB,CAAC;IACvC,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEzD;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,IAAI;IACnB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,YAAY,GAAG,gBAAgB,CAAC;IAC3C,uDAAuD;IACvD,QAAQ,CAAC,EAAE,QAAQ,GAAG,gBAAgB,CAAC;IACvC,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,6DAA6D;IAC7D,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D,2DAA2D;IAC3D,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wemap/positioning",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"dist"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@wemap/core": "14.
|
|
22
|
-
"@wemap/geo": "14.
|
|
23
|
-
"@wemap/providers": "14.
|
|
24
|
-
"@wemap/routers": "14.
|
|
25
|
-
"@wemap/utils": "14.
|
|
21
|
+
"@wemap/core": "14.3.0",
|
|
22
|
+
"@wemap/geo": "14.3.0",
|
|
23
|
+
"@wemap/providers": "14.3.0",
|
|
24
|
+
"@wemap/routers": "14.3.0",
|
|
25
|
+
"@wemap/utils": "14.3.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@wemap/maths-legacy": "^13.3.0"
|