@wemap/providers 11.0.0-alpha.17 → 11.0.0-alpha.19
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/dist/index.js +28 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -28
- package/dist/index.mjs.map +1 -1
- package/helpers/CustomMapProvider.ts +4 -10
- package/index.ts +4 -3
- package/package.json +11 -10
- package/src/mapmatching/MapMatchingHandler.spec.ts +23 -25
- package/src/mapmatching/MapMatchingHandler.ts +33 -40
- package/src/providers/attitude/absolute/AbsoluteAttitudeFromBrowserProvider.ts +3 -3
- package/src/providers/imu/ImuProvider.ts +2 -2
- package/src/providers/vision/ArCoreProvider.ts +1 -1
- package/src/providers/vision/vps/VpsProvider.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -749,7 +749,7 @@ class ImuProvider extends Provider {
|
|
|
749
749
|
} = e.accelerationIncludingGravity;
|
|
750
750
|
if (typeof x === "number" && typeof y === "number" && typeof z === "number") {
|
|
751
751
|
acc = [x, y, z];
|
|
752
|
-
if (utils.BrowserUtils.
|
|
752
|
+
if (utils.BrowserUtils.getName() === utils.Browser.SAFARI || utils.BrowserUtils.getName() === utils.Browser.IOS_WEBVIEW) {
|
|
753
753
|
acc[0] *= -1;
|
|
754
754
|
acc[1] *= -1;
|
|
755
755
|
acc[2] *= -1;
|
|
@@ -2235,7 +2235,7 @@ class AbsoluteAttitudeFromBrowser extends Provider {
|
|
|
2235
2235
|
}
|
|
2236
2236
|
start() {
|
|
2237
2237
|
const subscribe = () => {
|
|
2238
|
-
switch (utils.BrowserUtils.
|
|
2238
|
+
switch (utils.BrowserUtils.getName()) {
|
|
2239
2239
|
case utils.Browser.CHROME:
|
|
2240
2240
|
window.addEventListener(
|
|
2241
2241
|
"deviceorientationabsolute",
|
|
@@ -2276,7 +2276,7 @@ class AbsoluteAttitudeFromBrowser extends Provider {
|
|
|
2276
2276
|
}
|
|
2277
2277
|
}
|
|
2278
2278
|
stop() {
|
|
2279
|
-
switch (utils.BrowserUtils.
|
|
2279
|
+
switch (utils.BrowserUtils.getName()) {
|
|
2280
2280
|
case utils.Browser.CHROME:
|
|
2281
2281
|
window.removeEventListener(
|
|
2282
2282
|
"deviceorientationabsolute",
|
|
@@ -2647,7 +2647,7 @@ const _MapMatchingHandler = class extends Provider {
|
|
|
2647
2647
|
__publicField(this, "_minStepsForOrientationMatching", _MapMatchingHandler.DEFAULT_MIN_STEPS_FOR_ORIENTATION_MATCHING);
|
|
2648
2648
|
__publicField(this, "_lastProjectionsWindowSize", _MapMatchingHandler.DEFAULT_LAST_PROJECTIONS_WINDOW_SIZE);
|
|
2649
2649
|
__publicField(this, "_lastProjectionsEdgeAngleThreshold", _MapMatchingHandler.DEFAULT_LAST_PROJECTIONS_EDGE_ANGLE_THRESHOLD);
|
|
2650
|
-
__publicField(this, "
|
|
2650
|
+
__publicField(this, "_geoGraphProjectionHandler");
|
|
2651
2651
|
__publicField(this, "_internalProvidersStarted", false);
|
|
2652
2652
|
__publicField(this, "_straightLineProviderId");
|
|
2653
2653
|
__publicField(this, "_turnProviderId");
|
|
@@ -2659,18 +2659,18 @@ const _MapMatchingHandler = class extends Provider {
|
|
|
2659
2659
|
__publicField(this, "getName", () => "MapMatchingHandler");
|
|
2660
2660
|
__publicField(this, "availability", () => Promise.resolve());
|
|
2661
2661
|
__publicField(this, "_manageStartStop", () => {
|
|
2662
|
-
if (this.
|
|
2662
|
+
if (this.graph && !this._internalProvidersStarted) {
|
|
2663
2663
|
this._startInternalProviders();
|
|
2664
|
-
} else if (!this.
|
|
2664
|
+
} else if (!this.graph && this._internalProvidersStarted) {
|
|
2665
2665
|
this._stopInternalProviders();
|
|
2666
2666
|
}
|
|
2667
2667
|
});
|
|
2668
|
-
this.
|
|
2669
|
-
this.
|
|
2670
|
-
this.
|
|
2668
|
+
this._geoGraphProjectionHandler = new geo.GeoGraphProjectionHandler();
|
|
2669
|
+
this._geoGraphProjectionHandler.maxDistance = _MapMatchingHandler.DEFAULT_MM_MAX_DIST;
|
|
2670
|
+
this._geoGraphProjectionHandler.maxAngleBearing = _MapMatchingHandler.DEFAULT_MM_MAX_ANGLE;
|
|
2671
2671
|
}
|
|
2672
2672
|
start() {
|
|
2673
|
-
if (this.
|
|
2673
|
+
if (this.graph) {
|
|
2674
2674
|
this._startInternalProviders();
|
|
2675
2675
|
}
|
|
2676
2676
|
}
|
|
@@ -2698,19 +2698,19 @@ const _MapMatchingHandler = class extends Provider {
|
|
|
2698
2698
|
get enabled() {
|
|
2699
2699
|
return ProvidersOptions.useMapMatching;
|
|
2700
2700
|
}
|
|
2701
|
-
get
|
|
2702
|
-
return this.
|
|
2701
|
+
get graph() {
|
|
2702
|
+
return this._geoGraphProjectionHandler.graph;
|
|
2703
2703
|
}
|
|
2704
|
-
set
|
|
2705
|
-
this.
|
|
2704
|
+
set graph(graph) {
|
|
2705
|
+
this._geoGraphProjectionHandler.graph = graph;
|
|
2706
2706
|
this._itineraryInfoManager = null;
|
|
2707
|
-
this.notify({ ...
|
|
2707
|
+
this.notify({ ...graph && { graph } });
|
|
2708
2708
|
this._manageStartStop();
|
|
2709
2709
|
if (this.canUseMapMatching())
|
|
2710
2710
|
;
|
|
2711
2711
|
}
|
|
2712
2712
|
set itinerary(itinerary) {
|
|
2713
|
-
this.
|
|
2713
|
+
this._geoGraphProjectionHandler.graph = itinerary ? itinerary.toGraph() : null;
|
|
2714
2714
|
this._itineraryInfoManager = new routers.ItineraryInfoManager(itinerary);
|
|
2715
2715
|
this.notify({ ...itinerary && { itinerary } });
|
|
2716
2716
|
this._manageStartStop();
|
|
@@ -2719,7 +2719,7 @@ const _MapMatchingHandler = class extends Provider {
|
|
|
2719
2719
|
}
|
|
2720
2720
|
}
|
|
2721
2721
|
canUseMapMatching() {
|
|
2722
|
-
return this.enabled && this.
|
|
2722
|
+
return this.enabled && this.graph;
|
|
2723
2723
|
}
|
|
2724
2724
|
_notifyPositionFromItineraryInput(itinerary) {
|
|
2725
2725
|
if (!this._useItineraryStartAsPosition || itinerary.from) {
|
|
@@ -2856,7 +2856,7 @@ const _MapMatchingHandler = class extends Provider {
|
|
|
2856
2856
|
}
|
|
2857
2857
|
const firstProjection = this._lastProjections[0];
|
|
2858
2858
|
return !this._lastProjections.some(
|
|
2859
|
-
(projection) => !(projection.nearestElement instanceof geo.
|
|
2859
|
+
(projection) => !(projection.nearestElement instanceof geo.GeoGraphEdge) || !(firstProjection.nearestElement instanceof geo.GeoGraphEdge) || maths.diffAngleLines(projection.nearestElement.bearing, firstProjection.nearestElement.bearing) > this._lastProjectionsEdgeAngleThreshold
|
|
2860
2860
|
);
|
|
2861
2861
|
}
|
|
2862
2862
|
_nodeHasTurn(node) {
|
|
@@ -2872,12 +2872,12 @@ const _MapMatchingHandler = class extends Provider {
|
|
|
2872
2872
|
return false;
|
|
2873
2873
|
}
|
|
2874
2874
|
_hasTurnInCircle(center, radius) {
|
|
2875
|
-
const network = this.
|
|
2875
|
+
const network = this._geoGraphProjectionHandler.graph;
|
|
2876
2876
|
if (!network) {
|
|
2877
2877
|
return false;
|
|
2878
2878
|
}
|
|
2879
|
-
return network.
|
|
2880
|
-
(
|
|
2879
|
+
return network.vertices.filter(
|
|
2880
|
+
(vertex) => vertex.coords.distanceTo(center) <= radius && geo.Level.intersect(vertex.coords.level, center.level)
|
|
2881
2881
|
).some(this._nodeHasTurn);
|
|
2882
2882
|
}
|
|
2883
2883
|
tryOrientationMatching(projection) {
|
|
@@ -2888,7 +2888,7 @@ const _MapMatchingHandler = class extends Provider {
|
|
|
2888
2888
|
return;
|
|
2889
2889
|
}
|
|
2890
2890
|
const { nearestElement, origin } = projection;
|
|
2891
|
-
if (!(nearestElement instanceof geo.
|
|
2891
|
+
if (!(nearestElement instanceof geo.GeoGraphEdge)) {
|
|
2892
2892
|
return;
|
|
2893
2893
|
}
|
|
2894
2894
|
let matchingDirection;
|
|
@@ -2908,13 +2908,13 @@ const _MapMatchingHandler = class extends Provider {
|
|
|
2908
2908
|
this._countStepsFromLastMatching = 0;
|
|
2909
2909
|
}
|
|
2910
2910
|
getProjection(position, useDistance, useBearing) {
|
|
2911
|
-
return this.
|
|
2911
|
+
return this._geoGraphProjectionHandler.getProjection(position, useDistance, useBearing);
|
|
2912
2912
|
}
|
|
2913
2913
|
get maxDistance() {
|
|
2914
|
-
return this.
|
|
2914
|
+
return this._geoGraphProjectionHandler.maxDistance;
|
|
2915
2915
|
}
|
|
2916
2916
|
set maxDistance(maxDistance) {
|
|
2917
|
-
this.
|
|
2917
|
+
this._geoGraphProjectionHandler.maxDistance = maxDistance;
|
|
2918
2918
|
}
|
|
2919
2919
|
get minDistance() {
|
|
2920
2920
|
return this._mapMatchingMinDistance;
|
|
@@ -2923,10 +2923,10 @@ const _MapMatchingHandler = class extends Provider {
|
|
|
2923
2923
|
this._mapMatchingMinDistance = minDistance;
|
|
2924
2924
|
}
|
|
2925
2925
|
get maxAngleBearing() {
|
|
2926
|
-
return this.
|
|
2926
|
+
return this._geoGraphProjectionHandler.maxAngleBearing;
|
|
2927
2927
|
}
|
|
2928
2928
|
set maxAngleBearing(maxAngleBearing) {
|
|
2929
|
-
this.
|
|
2929
|
+
this._geoGraphProjectionHandler.maxAngleBearing = maxAngleBearing;
|
|
2930
2930
|
}
|
|
2931
2931
|
get useItineraryStartAsPosition() {
|
|
2932
2932
|
return this._useItineraryStartAsPosition;
|
|
@@ -3268,6 +3268,7 @@ exports.RelativeAttitudeFromBrowserProvider = RelativeAttitudeFromBrowser$1;
|
|
|
3268
3268
|
exports.RelativeAttitudeFromEkfProvider = RelativeAttitudeFromEkfProvider;
|
|
3269
3269
|
exports.RelativeAttitudeFromInertialProvider = RelativeAttitudeFromInertialProvider;
|
|
3270
3270
|
exports.RelativeAttitudeProvider = RelativeAttitudeProvider$1;
|
|
3271
|
+
exports.RelativeRotationCalc = RelativeRotationCalc;
|
|
3271
3272
|
exports.StepDetectionMinMaxPeaks2 = StepDetectionMinMaxPeaks2;
|
|
3272
3273
|
exports.StepDetectionMinMaxPeaks3 = StepDetectionMinMaxPeaks3;
|
|
3273
3274
|
exports.StepProvider = StepProvider$1;
|