@wemap/routers 12.8.7 → 12.8.9

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
@@ -449,7 +449,7 @@ class StepsBuilder {
449
449
  const forceEndOfLevelChange = Boolean(
450
450
  previousEdgeProperties.incline && previousEdgeProperties.areStairs && (!incline || !areStairs)
451
451
  );
452
- const createNewStep = vertex.properties.isSubwayEntrance;
452
+ const isEntrance = vertex.properties.isSubwayEntrance;
453
453
  const stepName = edge.properties.name || null;
454
454
  const duration = graphRoute.edgesWeights[i];
455
455
  const stepExtras = {
@@ -461,7 +461,7 @@ class StepsBuilder {
461
461
  const splitByLevel = geo.Level.isRange(edge.level) && !geo.Level.isRange(currentCoords.level) || forceLevelChange;
462
462
  splitByAngle = splitByAngle && !(currentCoords.level && geo.Level.isRange(currentCoords.level));
463
463
  const splitByEndOfLevelChange = (previousStep == null ? void 0 : previousStep.levelChange) && !geo.Level.isRange(currentCoords.level) || forceEndOfLevelChange;
464
- const splitStepCondition = splitByAngle || splitByLevel || splitByEndOfLevelChange || createNewStep;
464
+ const splitStepCondition = splitByAngle || splitByLevel || splitByEndOfLevelChange || isEntrance;
465
465
  if (isFirstStep || splitStepCondition) {
466
466
  let levelChange;
467
467
  if (splitByLevel) {
@@ -2788,7 +2788,10 @@ const _OsmGraphUtils = class _OsmGraphUtils {
2788
2788
  })) == null ? void 0 : _a[1]) || null;
2789
2789
  if (vertex) {
2790
2790
  if (!geo.Level.equals(vertex.coords.level, nodeLevel)) {
2791
- vertex.coords.level = geo.Level.intersection(vertex.coords.level, nodeLevel) || nodeLevel;
2791
+ vertex.coords.level = geo.Level.intersection(vertex.coords.level, nodeLevel);
2792
+ if (vertex.coords.level === null) {
2793
+ vertex.coords.level = nodeLevel;
2794
+ }
2792
2795
  }
2793
2796
  return vertex;
2794
2797
  }
@@ -4306,7 +4309,6 @@ class CustomGraphMap {
4306
4309
  }
4307
4310
  static fromOsmXml(osmXmlString, name = null, callbackErrors) {
4308
4311
  const errors = {
4309
- couldNotParseFile: false,
4310
4312
  routingIoNotFound: [],
4311
4313
  routingBoundsNotFound: false
4312
4314
  };
@@ -4314,7 +4316,7 @@ class CustomGraphMap {
4314
4316
  try {
4315
4317
  osmModel = osm.OsmParser.parseOsmXmlString(osmXmlString);
4316
4318
  } catch (e) {
4317
- errors.couldNotParseFile = true;
4319
+ errors.couldNotParseFile = e instanceof Error ? e.message : "Unknown error";
4318
4320
  callbackErrors == null ? void 0 : callbackErrors(errors);
4319
4321
  return;
4320
4322
  }
@@ -4435,7 +4437,8 @@ class CustomGraphMapTester {
4435
4437
  const errors = [];
4436
4438
  if ((customGraphMapErrors == null ? void 0 : customGraphMapErrors.couldNotParseFile) || !customGraphMap) {
4437
4439
  errors.push({
4438
- type: "could-not-parse-file"
4440
+ type: "could-not-parse-file",
4441
+ details: customGraphMapErrors == null ? void 0 : customGraphMapErrors.couldNotParseFile
4439
4442
  });
4440
4443
  return { errors };
4441
4444
  }