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