@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 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 = vertexA.distanceTo(edge.vertex1);
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(customNetworkMap) {
3875
- this.maps.push(customNetworkMap);
3874
+ addIOMap(customGraphMap) {
3875
+ this.maps.push(customGraphMap);
3876
3876
  }
3877
- removeIOMap(customNetworkMap) {
3878
- this.maps = this.maps.filter((map) => map !== customNetworkMap);
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 CustomNetworkMap {
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 CustomNetworkMap(graph, entryPoints, bounds, name);
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 CustomNetworkMapTester {
4181
+ class CustomGraphMapTester {
4182
4182
  static createReport(osmXmlString) {
4183
4183
  var _a;
4184
- let customNetworkMapErrors;
4185
- const networkMap = CustomNetworkMap.fromOsmXml(osmXmlString, null, (e) => customNetworkMapErrors = e);
4184
+ let customGraphMapErrors;
4185
+ const customGraphMap = CustomGraphMap.fromOsmXml(osmXmlString, null, (e) => customGraphMapErrors = e);
4186
4186
  const errors = [];
4187
- if ((customNetworkMapErrors == null ? void 0 : customNetworkMapErrors.couldNotParseFile) || !networkMap) {
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 = networkMap.router.calculateComponents();
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 (customNetworkMapErrors == null ? void 0 : customNetworkMapErrors.routingBoundsNotFound) {
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 = customNetworkMapErrors == null ? void 0 : customNetworkMapErrors.routingIoNotFound) == null ? void 0 : _a.length) {
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: customNetworkMapErrors.routingIoNotFound
4208
+ data: customGraphMapErrors.routingIoNotFound
4209
4209
  });
4210
4210
  }
4211
- return { graph: networkMap.graph, errors };
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.graph) == null ? void 0 : _a.toCompressedJson(),
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.CustomNetworkMap = CustomNetworkMap;
4330
- exports.CustomNetworkMapTester = CustomNetworkMapTester;
4329
+ exports.CustomGraphMap = CustomGraphMap;
4330
+ exports.CustomGraphMapTester = CustomGraphMapTester;
4331
4331
  exports.DeutscheBahnRemoteRouter = DeutscheBahnRemoteRouter$1;
4332
4332
  exports.Edge = Edge;
4333
4333
  exports.Graph = Graph;