@wemap/providers 10.4.0 → 10.4.1
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/package.json
CHANGED
|
@@ -301,12 +301,13 @@ class MapMatchingHandler extends Provider {
|
|
|
301
301
|
|
|
302
302
|
if (!projectionWithBearing) {
|
|
303
303
|
// Verify if the newPosition is far enough from the network to be used by the system.
|
|
304
|
-
const projectionWithoutBearing = this.getProjection(newPosition, true, false);
|
|
305
|
-
if (!projectionWithoutBearing) {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
}
|
|
304
|
+
// const projectionWithoutBearing = this.getProjection(newPosition, true, false);
|
|
305
|
+
// if (!projectionWithoutBearing) {
|
|
306
|
+
// In this case, the newPosition is far enough and can be used safely.
|
|
307
|
+
AbsolutePosition.notify(positionEvent);
|
|
309
308
|
return true;
|
|
309
|
+
// }
|
|
310
|
+
// return true;
|
|
310
311
|
}
|
|
311
312
|
|
|
312
313
|
// newPosition must not be used after this line
|
|
@@ -15,7 +15,8 @@ import AvailabilityHelper from '../../../events/AvailabilityHelper.js';
|
|
|
15
15
|
class AbsolutePosition extends Provider {
|
|
16
16
|
|
|
17
17
|
// Use the new absolute position if its accuracy is at least x times better than the last one.
|
|
18
|
-
static ACCURACY_RELOC_RATIO = 1
|
|
18
|
+
static ACCURACY_RELOC_RATIO = 1;
|
|
19
|
+
// static ACCURACY_RELOC_RATIO = 1.5;
|
|
19
20
|
|
|
20
21
|
/** @type {boolean} */
|
|
21
22
|
static USE_MM_FOR_FEED = true;
|
|
@@ -181,6 +182,9 @@ class AbsolutePosition extends Provider {
|
|
|
181
182
|
// is why the 3.b. condition has been added.
|
|
182
183
|
// TODO: add a routine to augment the current position accuracy when the page is in background
|
|
183
184
|
const isFarEnough = lastPosition.distanceTo(newPosition) > lastPosition.accuracy + newPosition.accuracy;
|
|
185
|
+
if (isFarEnough) {
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
184
188
|
|
|
185
189
|
// 3.b. Added on 16/06/22
|
|
186
190
|
// The goal of this condition is to avoid continuous jumps between positions from two providers
|
|
@@ -334,8 +338,8 @@ class AbsolutePosition extends Provider {
|
|
|
334
338
|
if (!value || value.data.accuracy === null || value.data.time === null) {
|
|
335
339
|
return best;
|
|
336
340
|
}
|
|
337
|
-
const {accuracy: curAccuracy, time: curTime} = value.data;
|
|
338
|
-
const {accuracy: bestAccuracy, time: bestTime} = best.data;
|
|
341
|
+
const { accuracy: curAccuracy, time: curTime } = value.data;
|
|
342
|
+
const { accuracy: bestAccuracy, time: bestTime } = best.data;
|
|
339
343
|
// 1.3888 corresponds to 1.3888 m/s (5 km/h)
|
|
340
344
|
return curAccuracy < (bestAccuracy + 1.3888 * (curTime - bestTime)) ? value : best;
|
|
341
345
|
}, null);
|