@wemap/routers 14.5.5 → 14.5.6
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
CHANGED
|
@@ -2761,7 +2761,10 @@ var default_rules_default = { rules: [{
|
|
|
2761
2761
|
value: .5
|
|
2762
2762
|
}
|
|
2763
2763
|
]
|
|
2764
|
-
}] },
|
|
2764
|
+
}] }, pathSegmentsCache = /* @__PURE__ */ new Map(), getPathSegments = (e) => {
|
|
2765
|
+
let t = pathSegmentsCache.get(e);
|
|
2766
|
+
return t || (t = e.split("."), pathSegmentsCache.set(e, t)), t;
|
|
2767
|
+
}, matchAll = (e, t) => t.every(({ path: t, value: n }) => getPathSegments(t).reduce((e, t) => {
|
|
2765
2768
|
if (e != null) return e[t];
|
|
2766
2769
|
}, e) === n), createEdgeScope = (e) => ({
|
|
2767
2770
|
tags: e.rawTags,
|
|
@@ -2804,11 +2807,12 @@ var default_rules_default = { rules: [{
|
|
|
2804
2807
|
return this.edgeAcceptOnlyRules.length > 0 ? this.edgeAcceptOnlyRules.some((e) => matchAll(t, e.match)) : this.evaluateAcceptRules(t, this.edgeAcceptRules);
|
|
2805
2808
|
};
|
|
2806
2809
|
weightEdgeFn = (e) => {
|
|
2807
|
-
let t =
|
|
2808
|
-
for (let e of this.edgeWeightRules) if (matchAll(
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2810
|
+
let t = createEdgeScope(e), n = getDurationFromLength(e.length, this.baseSpeedKmh);
|
|
2811
|
+
for (let e of this.edgeWeightRules) if (matchAll(t, e.match)) {
|
|
2812
|
+
if (e.action === "set") return e.value;
|
|
2813
|
+
e.action === "multiply" && (n *= e.value);
|
|
2814
|
+
}
|
|
2815
|
+
return n;
|
|
2812
2816
|
};
|
|
2813
2817
|
weightVertexFn = (e) => {
|
|
2814
2818
|
let t = createVertexScope(e);
|
|
@@ -2914,7 +2918,39 @@ var RoutingError = class e extends Error {
|
|
|
2914
2918
|
}
|
|
2915
2919
|
};
|
|
2916
2920
|
const DefaultGraphRouterRules = new GraphRouterRulesBuilder().build();
|
|
2917
|
-
var
|
|
2921
|
+
var MinHeap = class {
|
|
2922
|
+
dists = [];
|
|
2923
|
+
verts = [];
|
|
2924
|
+
get size() {
|
|
2925
|
+
return this.dists.length;
|
|
2926
|
+
}
|
|
2927
|
+
push(e, t) {
|
|
2928
|
+
this.dists.push(e), this.verts.push(t);
|
|
2929
|
+
let n = this.dists.length - 1;
|
|
2930
|
+
for (; n > 0;) {
|
|
2931
|
+
let e = n - 1 >> 1;
|
|
2932
|
+
if (this.dists[e] <= this.dists[n]) break;
|
|
2933
|
+
this.swap(e, n), n = e;
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
pop() {
|
|
2937
|
+
let e = this.verts[0], t = this.dists.length - 1;
|
|
2938
|
+
this.dists[0] = this.dists[t], this.verts[0] = this.verts[t], this.dists.pop(), this.verts.pop();
|
|
2939
|
+
let n = 0, r = this.dists.length;
|
|
2940
|
+
for (;;) {
|
|
2941
|
+
let e = n, t = 2 * n + 1, i = 2 * n + 2;
|
|
2942
|
+
if (t < r && this.dists[t] < this.dists[e] && (e = t), i < r && this.dists[i] < this.dists[e] && (e = i), e === n) break;
|
|
2943
|
+
this.swap(e, n), n = e;
|
|
2944
|
+
}
|
|
2945
|
+
return e;
|
|
2946
|
+
}
|
|
2947
|
+
swap(e, t) {
|
|
2948
|
+
let n = this.dists[e];
|
|
2949
|
+
this.dists[e] = this.dists[t], this.dists[t] = n;
|
|
2950
|
+
let r = this.verts[e];
|
|
2951
|
+
this.verts[e] = this.verts[t], this.verts[t] = r;
|
|
2952
|
+
}
|
|
2953
|
+
}, GraphRouterEngineResults = class {
|
|
2918
2954
|
prev;
|
|
2919
2955
|
dist;
|
|
2920
2956
|
source;
|
|
@@ -2986,20 +3022,26 @@ var GraphRouterEngineResults = class {
|
|
|
2986
3022
|
e.vertices.forEach((e) => e.id = t++);
|
|
2987
3023
|
}
|
|
2988
3024
|
calculateShortestPathToMultipleDestinationsByVertex(e, t, n = DefaultGraphRouterRules, r = this.graph.vertices, i = this.graph.edges) {
|
|
2989
|
-
let a =
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3025
|
+
let a = r.length, o = Array(a).fill(Number.MAX_VALUE), s = Array(a).fill(null), c = i.filter((e) => (n.acceptEdgeFn?.(e) ?? DefaultGraphRouterRules.acceptEdgeFn?.(e)) && !this.disabledEdges.has(e)), l = n.weightEdgeFn ?? DefaultGraphRouterRules.weightEdgeFn, u = n.weightVertexFn ?? DefaultGraphRouterRules.weightVertexFn, d = Array.from({ length: a }, () => []);
|
|
3026
|
+
for (let e of c) d[e.vertex1.id].push({
|
|
3027
|
+
edge: e,
|
|
3028
|
+
neighbor: e.vertex2
|
|
3029
|
+
}), e.properties.isOneway || d[e.vertex2.id].push({
|
|
3030
|
+
edge: e,
|
|
3031
|
+
neighbor: e.vertex1
|
|
3032
|
+
});
|
|
3033
|
+
let f = Array(a).fill(!1), p = new Set(t);
|
|
3034
|
+
o[e.id] = 0;
|
|
3035
|
+
let m = new MinHeap();
|
|
3036
|
+
for (m.push(0, e); m.size > 0;) {
|
|
3037
|
+
let e = m.pop();
|
|
3038
|
+
if (!f[e.id]) {
|
|
3039
|
+
if (f[e.id] = !0, p.has(e) && (p.delete(e), p.size === 0)) break;
|
|
3040
|
+
for (let { edge: t, neighbor: n } of d[e.id]) {
|
|
3041
|
+
let r = l(t) + u(n), i = o[e.id] + r;
|
|
3042
|
+
i < o[n.id] && (o[n.id] = i, s[n.id] = e, m.push(i, n));
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3003
3045
|
}
|
|
3004
3046
|
return new GraphRouterEngineResults(s, o, e, t, c);
|
|
3005
3047
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphRouterEngine.d.ts","sourceRoot":"","sources":["../../../src/graph/GraphRouterEngine.ts"],"names":[],"mappings":"AAEA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"GraphRouterEngine.d.ts","sourceRoot":"","sources":["../../../src/graph/GraphRouterEngine.ts"],"names":[],"mappings":"AAEA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAqDlD,qBAAa,wBAAwB;IAC1B,IAAI,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC3B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,IAAI,EAAE,CAAC;gBAGjB,IAAI,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,EAC1B,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EAAE,EACjB,KAAK,EAAE,IAAI,EAAE;IASjB,aAAa,CAAC,EAAE,SAAkB,EAAE,IAAI,GAAE,MAAM,EAAO,GAAG,MAAM,EAAE;IAMlE,gBAAgB,CAAC,EAAE,SAAkB;IAKrC,KAAK,CAAC,EAAE,SAAkB;IAqB1B,SAAS,CAAC,KAAK,EAAE,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDzB;AAED,MAAM,CAAC,OAAO,OAAO,iBAAiB;IAElC,aAAa,EAAE,GAAG,CAAC,IAAI,CAAC,CAAa;IACrC,SAAgB,KAAK,EAAE,KAAK,CAAC;gBAEjB,KAAK,EAAE,KAAK;IAMxB,mDAAmD,CAC/C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EAAE,EACjB,KAAK,GAAE,gBAA+B,EACtC,aAAa,WAAsB,EACnC,UAAU,SAAmB,GAC9B,wBAAwB;IA2D3B,6BAA6B,CACzB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,gBAA+B,EACtC,aAAa,WAAsB,EACnC,UAAU,SAAmB,GAC9B,wBAAwB;IAK3B,mBAAmB;IAuCnB,SAAS;;;;;;;;;;;;;CA0BZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphRouterRules.d.ts","sourceRoot":"","sources":["../../../src/graph/GraphRouterRules.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,cAAc,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAElK,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"GraphRouterRules.d.ts","sourceRoot":"","sources":["../../../src/graph/GraphRouterRules.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,cAAc,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAElK,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,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"version": "14.5.
|
|
3
|
+
"version": "14.5.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"@turf/convex": "^6.5.0",
|
|
24
24
|
"@turf/helpers": "^6.5.0",
|
|
25
25
|
"@types/mapbox__polyline": "^1.0.2",
|
|
26
|
-
"@wemap/core": "14.5.
|
|
27
|
-
"@wemap/geo": "14.5.
|
|
28
|
-
"@wemap/osm": "14.5.
|
|
26
|
+
"@wemap/core": "14.5.6",
|
|
27
|
+
"@wemap/geo": "14.5.6",
|
|
28
|
+
"@wemap/osm": "14.5.6",
|
|
29
29
|
"@wemap/salesman.js": "^2.1.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|