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