@wemap/geo 11.3.1 → 11.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
@@ -1388,19 +1388,19 @@ const _GeoGraphProjectionHandler = class {
1388
1388
  get maxDistance() {
1389
1389
  return this._maxDistance;
1390
1390
  }
1391
- _shouldProjectOnEdgeAndNodes(edge, location, useBearing, useMultiLevelSegments, acceptEdgeFn) {
1391
+ _shouldProjectOnEdgeAndVertices(edge, location, useBearing, useMultiLevelSegments, acceptEdgeFn) {
1392
1392
  if (!acceptEdgeFn(edge)) {
1393
1393
  return [false, false, false];
1394
1394
  }
1395
1395
  let checkEdge = Level.intersect(location.level, edge.level);
1396
- let checkNode1 = Level.intersect(location.level, edge.vertex1.coords.level);
1397
- let checkNode2 = Level.intersect(location.level, edge.vertex2.coords.level);
1398
- checkNode1 = checkNode1 || edge.vertex1.io && location.level === null;
1399
- checkNode2 = checkNode2 || edge.vertex2.io && location.level === null;
1396
+ let checkVertex1 = Level.intersect(location.level, edge.vertex1.coords.level);
1397
+ let checkVertex2 = Level.intersect(location.level, edge.vertex2.coords.level);
1398
+ checkVertex1 = checkVertex1 || edge.vertex1.io && location.level === null;
1399
+ checkVertex2 = checkVertex2 || edge.vertex2.io && location.level === null;
1400
1400
  if (!useMultiLevelSegments) {
1401
1401
  checkEdge = checkEdge && !Level.isRange(edge.level);
1402
- checkNode1 = checkNode1 && !Level.isRange(edge.vertex1.coords.level);
1403
- checkNode2 = checkNode2 && !Level.isRange(edge.vertex2.coords.level);
1402
+ checkVertex1 = checkVertex1 && !Level.isRange(edge.vertex1.coords.level);
1403
+ checkVertex2 = checkVertex2 && !Level.isRange(edge.vertex2.coords.level);
1404
1404
  }
1405
1405
  if (useBearing) {
1406
1406
  if (checkEdge) {
@@ -1409,18 +1409,18 @@ const _GeoGraphProjectionHandler = class {
1409
1409
  checkEdge = false;
1410
1410
  }
1411
1411
  }
1412
- checkNode1 = false;
1413
- checkNode2 = false;
1412
+ checkVertex1 = false;
1413
+ checkVertex2 = false;
1414
1414
  }
1415
- return [checkEdge, checkNode1, checkNode2];
1415
+ return [checkEdge, checkVertex1, checkVertex2];
1416
1416
  }
1417
1417
  static _assignLatLngLevel(fromCoordinates, toCoordinates) {
1418
1418
  toCoordinates.lat = fromCoordinates.lat;
1419
1419
  toCoordinates.lng = fromCoordinates.lng;
1420
1420
  toCoordinates.level = Level.clone(fromCoordinates.level);
1421
1421
  }
1422
- static _handleLevelsWithIONodes(projection, location, projectionNode) {
1423
- if (location.level === null && projectionNode.io) {
1422
+ static _handleLevelsWithIOVertices(projection, location, projectionVertex) {
1423
+ if (location.level === null && projectionVertex.io) {
1424
1424
  projection.level = null;
1425
1425
  }
1426
1426
  }
@@ -1438,33 +1438,33 @@ const _GeoGraphProjectionHandler = class {
1438
1438
  return distanceOfNewProjection < distanceFromNearestElement && (!useDistance || distanceOfNewProjection <= this._maxDistance);
1439
1439
  };
1440
1440
  for (const edge of this.graph.edges) {
1441
- const [checkEdge, checkNode1, checkNode2] = this._shouldProjectOnEdgeAndNodes(
1441
+ const [checkEdge, checkVertex1, checkVertex2] = this._shouldProjectOnEdgeAndVertices(
1442
1442
  edge,
1443
1443
  location,
1444
1444
  useBearing,
1445
1445
  useMultiLevelSegments,
1446
1446
  acceptEdgeFn
1447
1447
  );
1448
- if (checkNode1) {
1449
- const distNode1 = location.distanceTo(edge.vertex1.coords);
1450
- if (isProjectionBetter(distNode1) || distNode1 <= EPS_MM) {
1451
- distanceFromNearestElement = distNode1;
1448
+ if (checkVertex1) {
1449
+ const distVertex1 = location.distanceTo(edge.vertex1.coords);
1450
+ if (isProjectionBetter(distVertex1) || distVertex1 <= EPS_MM) {
1451
+ distanceFromNearestElement = distVertex1;
1452
1452
  nearestElement = edge.vertex1;
1453
1453
  _GeoGraphProjectionHandler._assignLatLngLevel(edge.vertex1.coords, projection);
1454
- _GeoGraphProjectionHandler._handleLevelsWithIONodes(projection, location, edge.vertex1);
1455
- if (distNode1 <= EPS_MM) {
1454
+ _GeoGraphProjectionHandler._handleLevelsWithIOVertices(projection, location, edge.vertex1);
1455
+ if (distVertex1 <= EPS_MM) {
1456
1456
  break;
1457
1457
  }
1458
1458
  }
1459
1459
  }
1460
- if (checkNode2) {
1461
- const distNode2 = location.distanceTo(edge.vertex2.coords);
1462
- if (isProjectionBetter(distNode2) || distNode2 <= EPS_MM) {
1463
- distanceFromNearestElement = distNode2;
1460
+ if (checkVertex2) {
1461
+ const distVertex2 = location.distanceTo(edge.vertex2.coords);
1462
+ if (isProjectionBetter(distVertex2) || distVertex2 <= EPS_MM) {
1463
+ distanceFromNearestElement = distVertex2;
1464
1464
  nearestElement = edge.vertex2;
1465
1465
  _GeoGraphProjectionHandler._assignLatLngLevel(edge.vertex2.coords, projection);
1466
- _GeoGraphProjectionHandler._handleLevelsWithIONodes(projection, location, edge.vertex2);
1467
- if (distNode2 <= EPS_MM) {
1466
+ _GeoGraphProjectionHandler._handleLevelsWithIOVertices(projection, location, edge.vertex2);
1467
+ if (distVertex2 <= EPS_MM) {
1468
1468
  break;
1469
1469
  }
1470
1470
  }
@@ -1543,13 +1543,13 @@ class NoRouteFoundError extends Error {
1543
1543
  }
1544
1544
  get startStr() {
1545
1545
  if (this.start instanceof GeoGraphVertex) {
1546
- return `GraphNode ${this.start.coords.toString()}`;
1546
+ return `GeoGraphVertex ${this.start.coords.toString()}`;
1547
1547
  }
1548
1548
  return this.start.toString();
1549
1549
  }
1550
1550
  get endStr() {
1551
1551
  if (this.end instanceof GeoGraphVertex) {
1552
- return `GraphNode ${this.end.coords.toString()}`;
1552
+ return `GeoGraphVertex ${this.end.coords.toString()}`;
1553
1553
  }
1554
1554
  return this.end.toString();
1555
1555
  }