@wemap/routers 12.4.0 → 12.5.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/dist/index.js +20 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -20
- package/dist/index.mjs.map +1 -1
- package/index.ts +2 -2
- package/package.json +2 -2
- package/src/graph/GraphRouter.spec.ts +8 -1
- package/src/graph/GraphRouter.ts +1 -1
- package/src/wemap-multi/{CustomNetworkMap.spec.ts → CustomGraphMap.spec.ts} +8 -8
- package/src/wemap-multi/{CustomNetworkMap.ts → CustomGraphMap.ts} +2 -4
- package/src/wemap-multi/{CustomNetworkMapTester.spec.ts → CustomGraphMapTester.spec.ts} +3 -3
- package/src/wemap-multi/{CustomNetworkMapTester.ts → CustomGraphMapTester.ts} +13 -14
- package/src/wemap-multi/WemapMultiRouter.spec.ts +3 -3
- package/src/wemap-multi/WemapMultiRouter.ts +6 -6
package/dist/index.mjs
CHANGED
|
@@ -2619,7 +2619,7 @@ class GraphRouter extends GraphRouterEngine {
|
|
|
2619
2619
|
const distVertexAVertex1 = vertexA.distanceTo(edge.vertex1);
|
|
2620
2620
|
for (let j = i + 1; j < vertices.length; j++) {
|
|
2621
2621
|
const vertexB = vertices[j];
|
|
2622
|
-
const distVertexBVertex1 =
|
|
2622
|
+
const distVertexBVertex1 = vertexB.distanceTo(edge.vertex1);
|
|
2623
2623
|
const reverse = distVertexBVertex1 < distVertexAVertex1;
|
|
2624
2624
|
const newEdge = !reverse ? new Edge(vertexA, vertexB, newEdgesOptions) : new Edge(vertexB, vertexA, newEdgesOptions);
|
|
2625
2625
|
createdEdges.add(newEdge);
|
|
@@ -3869,11 +3869,11 @@ class WemapMultiRouter {
|
|
|
3869
3869
|
get rname() {
|
|
3870
3870
|
return "wemap-multi";
|
|
3871
3871
|
}
|
|
3872
|
-
addIOMap(
|
|
3873
|
-
this.maps.push(
|
|
3872
|
+
addIOMap(customGraphMap) {
|
|
3873
|
+
this.maps.push(customGraphMap);
|
|
3874
3874
|
}
|
|
3875
|
-
removeIOMap(
|
|
3876
|
-
this.maps = this.maps.filter((map) => map !==
|
|
3875
|
+
removeIOMap(customGraphMap) {
|
|
3876
|
+
this.maps = this.maps.filter((map) => map !== customGraphMap);
|
|
3877
3877
|
}
|
|
3878
3878
|
removeAllMaps() {
|
|
3879
3879
|
this.maps = [];
|
|
@@ -4023,7 +4023,7 @@ class WemapMultiRouter {
|
|
|
4023
4023
|
throw new Error("Should never happen");
|
|
4024
4024
|
}
|
|
4025
4025
|
}
|
|
4026
|
-
class
|
|
4026
|
+
class CustomGraphMap {
|
|
4027
4027
|
constructor(graph, entryPoints, bounds = null, name = null) {
|
|
4028
4028
|
__publicField(this, "name");
|
|
4029
4029
|
__publicField(this, "graph");
|
|
@@ -4100,7 +4100,7 @@ class CustomNetworkMap {
|
|
|
4100
4100
|
errors.routingBoundsNotFound = true;
|
|
4101
4101
|
}
|
|
4102
4102
|
callbackErrors == null ? void 0 : callbackErrors(errors);
|
|
4103
|
-
return new
|
|
4103
|
+
return new CustomGraphMap(graph, entryPoints, bounds, name);
|
|
4104
4104
|
}
|
|
4105
4105
|
isPointInside(coordinates) {
|
|
4106
4106
|
return pointInPolygon([coordinates.lng, coordinates.lat], this.bounds);
|
|
@@ -4176,42 +4176,42 @@ class CustomNetworkMap {
|
|
|
4176
4176
|
return this.router.calculateShortestPathToMultipleDestinations(start, ends, options);
|
|
4177
4177
|
}
|
|
4178
4178
|
}
|
|
4179
|
-
class
|
|
4179
|
+
class CustomGraphMapTester {
|
|
4180
4180
|
static createReport(osmXmlString) {
|
|
4181
4181
|
var _a;
|
|
4182
|
-
let
|
|
4183
|
-
const
|
|
4182
|
+
let customGraphMapErrors;
|
|
4183
|
+
const customGraphMap = CustomGraphMap.fromOsmXml(osmXmlString, null, (e) => customGraphMapErrors = e);
|
|
4184
4184
|
const errors = [];
|
|
4185
|
-
if ((
|
|
4185
|
+
if ((customGraphMapErrors == null ? void 0 : customGraphMapErrors.couldNotParseFile) || !customGraphMap) {
|
|
4186
4186
|
errors.push({
|
|
4187
4187
|
type: "could-not-parse-file"
|
|
4188
4188
|
});
|
|
4189
4189
|
return { errors };
|
|
4190
4190
|
}
|
|
4191
|
-
const components =
|
|
4191
|
+
const components = customGraphMap.router.calculateComponents();
|
|
4192
4192
|
if (components.length > 1) {
|
|
4193
4193
|
errors.push({
|
|
4194
4194
|
type: "multiple-graph-components",
|
|
4195
4195
|
data: components
|
|
4196
4196
|
});
|
|
4197
4197
|
}
|
|
4198
|
-
if (
|
|
4198
|
+
if (customGraphMapErrors == null ? void 0 : customGraphMapErrors.routingBoundsNotFound) {
|
|
4199
4199
|
errors.push({
|
|
4200
4200
|
type: "routing-bounds-not-found"
|
|
4201
4201
|
});
|
|
4202
4202
|
}
|
|
4203
|
-
if ((_a =
|
|
4203
|
+
if ((_a = customGraphMapErrors == null ? void 0 : customGraphMapErrors.routingIoNotFound) == null ? void 0 : _a.length) {
|
|
4204
4204
|
errors.push({
|
|
4205
4205
|
type: "routing-io-not-on-graph",
|
|
4206
|
-
data:
|
|
4206
|
+
data: customGraphMapErrors.routingIoNotFound
|
|
4207
4207
|
});
|
|
4208
4208
|
}
|
|
4209
|
-
return {
|
|
4209
|
+
return { customGraphMap, errors };
|
|
4210
4210
|
}
|
|
4211
4211
|
static reportToJson(report) {
|
|
4212
|
-
var _a;
|
|
4212
|
+
var _a, _b;
|
|
4213
4213
|
return {
|
|
4214
|
-
graph: (_a = report.
|
|
4214
|
+
graph: (_b = (_a = report.customGraphMap) == null ? void 0 : _a.graph) == null ? void 0 : _b.toCompressedJson(),
|
|
4215
4215
|
errors: report.errors.map((error) => {
|
|
4216
4216
|
if (error.type === "multiple-graph-components") {
|
|
4217
4217
|
return { type: error.type, data: error.data.map((c) => c.map((v) => v.id)) };
|
|
@@ -4325,8 +4325,8 @@ class ItineraryInfoManager {
|
|
|
4325
4325
|
}
|
|
4326
4326
|
export {
|
|
4327
4327
|
CitywayRemoteRouter$1 as CitywayRemoteRouter,
|
|
4328
|
-
|
|
4329
|
-
|
|
4328
|
+
CustomGraphMap,
|
|
4329
|
+
CustomGraphMapTester,
|
|
4330
4330
|
DeutscheBahnRemoteRouter$1 as DeutscheBahnRemoteRouter,
|
|
4331
4331
|
Edge,
|
|
4332
4332
|
Graph,
|