proximiio-js-library 1.16.2 → 1.17.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.
@@ -847,19 +847,25 @@ export class Wayfinding {
847
847
  return path;
848
848
  }
849
849
  _calculateWallOffsetPointList(currentPoint, previousPoint) {
850
- const pointList = this._getPointList();
850
+ let pointList = this._getPointList();
851
851
  let currentPointIndex = pointList.indexOf(currentPoint);
852
- const previousPointIndex = pointList.indexOf(previousPoint);
853
- const offsetPointList = [];
852
+ let previousPointIndex = pointList.indexOf(previousPoint);
853
+ let offsetPointList = [];
854
854
  let currentOffsetPoint = currentPoint;
855
855
  // a) offset current point
856
856
  if (currentPointIndex >= 0 && this.wallOffsets[currentPointIndex]) {
857
857
  currentOffsetPoint = this.wallOffsets[currentPointIndex];
858
858
  }
859
859
  offsetPointList.push(currentOffsetPoint);
860
+
861
+ const visitedIndices = new Set(); // <-- track visited offset indices
862
+ if (currentPointIndex >= 0) {
863
+ visitedIndices.add(currentPointIndex);
864
+ }
865
+
860
866
  let potentialOffsetPoints;
861
867
  do {
862
- const line = turf.lineString([previousPoint.geometry.coordinates, currentOffsetPoint.geometry.coordinates]);
868
+ let line = turf.lineString([previousPoint.geometry.coordinates, currentOffsetPoint.geometry.coordinates]);
863
869
  potentialOffsetPoints = [];
864
870
  this.wallOffsetLineList.forEach((wallOffsetLine, index) => {
865
871
  // Do not process wall offsets from another floor
@@ -870,9 +876,13 @@ export class Wayfinding {
870
876
  if (index === previousPointIndex || index === currentPointIndex) {
871
877
  return;
872
878
  }
873
- const intersection = turf.lineIntersect(line, wallOffsetLine);
879
+ // Do not process already visited offset points // <-- skip visited
880
+ if (visitedIndices.has(index)) {
881
+ return;
882
+ }
883
+ let intersection = turf.lineIntersect(line, wallOffsetLine);
874
884
  if (intersection.features.length > 0) {
875
- const offsetPoint = this.wallOffsets[index];
885
+ let offsetPoint = this.wallOffsets[index];
876
886
  // store distance to previousPoint
877
887
  offsetPoint.properties.distance = this._distance(intersection.features[0], currentOffsetPoint);
878
888
  offsetPoint.properties.offsetIndex = index;
@@ -883,9 +893,11 @@ export class Wayfinding {
883
893
  potentialOffsetPoints.sort((a, b) => a.properties.distance - b.properties.distance);
884
894
  currentOffsetPoint = potentialOffsetPoints[0];
885
895
  currentPointIndex = currentOffsetPoint.properties.offsetIndex;
896
+ visitedIndices.add(currentPointIndex); // <-- mark as visited
886
897
  offsetPointList.push(currentOffsetPoint);
887
898
  }
888
899
  } while (potentialOffsetPoints.length > 0);
900
+
889
901
  return offsetPointList.reverse();
890
902
  }
891
903
  _getIntersectingOffsetPoints(current, previous) {
@@ -1203,56 +1215,53 @@ export class Wayfinding {
1203
1215
  _getNeighbours(point, startPoint, endPoint) {
1204
1216
  let neighbours = [];
1205
1217
  if (point === startPoint) {
1206
- const levelPoints = this._getPointList().filter((proposedPoint) =>
1218
+ let levelPoints = this._getPointList().filter((proposedPoint) =>
1207
1219
  this._isPointOnLevel(proposedPoint, point.properties.level),
1208
1220
  );
1209
1221
  neighbours = this._findNeighbours(point, startPoint, endPoint, levelPoints);
1210
1222
  neighbours = neighbours.filter((neighbourPoint) => {
1211
- const level = point.properties.level;
1212
- const revolvingDoorBlock =
1223
+ // if (neighbourPoint === endPoint) {
1224
+ // console.log('testing endPoint');
1225
+ // }
1226
+ let level = point.properties.level;
1227
+ let revolvingDoorBlock =
1213
1228
  this.configuration.avoidRevolvingDoors &&
1214
1229
  this._testAccessibilityPoiNeighbourhood(point, neighbourPoint, level, this.POI_TYPE.REVOLVING_DOOR);
1215
- const ticketGateBlock =
1230
+ let ticketGateBlock =
1216
1231
  this.configuration.avoidTicketGates &&
1217
1232
  this._testAccessibilityPoiNeighbourhood(point, neighbourPoint, level, this.POI_TYPE.TICKET_GATE);
1218
- const isCrossingTwoPolygon = this._checkIfCrossingTwoPolygon(point, neighbourPoint);
1219
- return !revolvingDoorBlock && !ticketGateBlock && !isCrossingTwoPolygon;
1233
+ return !revolvingDoorBlock && !ticketGateBlock;
1220
1234
  });
1221
1235
  } else {
1222
1236
  // Gather neighbours over all levels
1223
- const points = this._getPointList();
1224
- const pointIndex = points.indexOf(point);
1225
- if (pointIndex >= 0) {
1226
- this.floorData.forEach((_, level) => {
1227
- const levelNeighbourMap = this.neighbourMap[level];
1228
- if (levelNeighbourMap.hasOwnProperty(pointIndex)) {
1229
- levelNeighbourMap[pointIndex].forEach((neighbourIndex) => {
1230
- const neighbourPoint = points[neighbourIndex];
1231
- const revolvingDoorBlock =
1232
- this.configuration.avoidRevolvingDoors &&
1233
- this._testAccessibilityPoiNeighbourhood(point, neighbourPoint, level, this.POI_TYPE.REVOLVING_DOOR);
1234
- const ticketGateBlock =
1235
- this.configuration.avoidTicketGates &&
1236
- this._testAccessibilityPoiNeighbourhood(point, neighbourPoint, level, this.POI_TYPE.TICKET_GATE);
1237
- const isCrossingTwoPolygon = this._checkIfCrossingTwoPolygon(point, neighbourPoint);
1238
- if (
1239
- !neighbours.includes(neighbourPoint) &&
1240
- !revolvingDoorBlock &&
1241
- !ticketGateBlock &&
1242
- !isCrossingTwoPolygon
1243
- ) {
1244
- neighbours.push(neighbourPoint);
1245
- }
1246
- });
1247
- }
1248
- });
1249
- }
1237
+ let points = this._getPointList();
1238
+ let pointIndex = points.indexOf(point);
1239
+ this.floorData.forEach((_, level) => {
1240
+ let levelNeighbourMap = this.neighbourMap[level];
1241
+ if (Object.prototype.hasOwnProperty.call(levelNeighbourMap, pointIndex)) {
1242
+ levelNeighbourMap[pointIndex].forEach((neighbourIndex) => {
1243
+ let neighbourPoint = points[neighbourIndex];
1244
+
1245
+ let revolvingDoorBlock =
1246
+ this.configuration.avoidRevolvingDoors &&
1247
+ this._testAccessibilityPoiNeighbourhood(point, neighbourPoint, level, this.POI_TYPE.REVOLVING_DOOR);
1248
+ let ticketGateBlock =
1249
+ this.configuration.avoidTicketGates &&
1250
+ this._testAccessibilityPoiNeighbourhood(point, neighbourPoint, level, this.POI_TYPE.TICKET_GATE);
1251
+
1252
+ if (!neighbours.includes(neighbourPoint) && !revolvingDoorBlock && !ticketGateBlock) {
1253
+ neighbours.push(neighbourPoint);
1254
+ }
1255
+ });
1256
+ }
1257
+ });
1258
+
1250
1259
  // Test if endpoint is neighbour
1251
1260
  if (
1252
1261
  (point.properties.level !== undefined && point.properties.level === endPoint.properties.level) ||
1253
1262
  (point.properties.fixedPointMap != undefined && point.properties.fixedPointMap.has(endPoint.properties.level))
1254
1263
  ) {
1255
- const revolvingDoorBlock =
1264
+ let revolvingDoorBlock =
1256
1265
  this.configuration.avoidRevolvingDoors &&
1257
1266
  this._testAccessibilityPoiNeighbourhood(
1258
1267
  point,
@@ -1260,7 +1269,7 @@ export class Wayfinding {
1260
1269
  endPoint.properties.level,
1261
1270
  this.POI_TYPE.REVOLVING_DOOR,
1262
1271
  );
1263
- const ticketGateBlock =
1272
+ let ticketGateBlock =
1264
1273
  this.configuration.avoidTicketGates &&
1265
1274
  this._testAccessibilityPoiNeighbourhood(
1266
1275
  point,
@@ -1268,8 +1277,8 @@ export class Wayfinding {
1268
1277
  endPoint.properties.level,
1269
1278
  this.POI_TYPE.TICKET_GATE,
1270
1279
  );
1271
- const isCrossingTwoPolygon = this._checkIfCrossingTwoPolygon(point, endPoint);
1272
- if (!revolvingDoorBlock && !ticketGateBlock && !isCrossingTwoPolygon) {
1280
+
1281
+ if (!revolvingDoorBlock && !ticketGateBlock) {
1273
1282
  // Endpoint is fixed on corridor
1274
1283
  if (endPoint.properties.onCorridor) {
1275
1284
  if (endPoint.properties.neighbours.includes(point)) {
@@ -1282,9 +1291,10 @@ export class Wayfinding {
1282
1291
  ) {
1283
1292
  neighbours.push(endPoint);
1284
1293
  }
1294
+
1285
1295
  // End point is not on corridor, therefore should be in the area
1286
1296
  } else {
1287
- const unwrapped = this._unwrapLevelChangerPoint(point, endPoint.properties.level);
1297
+ let unwrapped = this._unwrapLevelChangerPoint(point, endPoint.properties.level);
1288
1298
  let allowedIntersections = 1;
1289
1299
  if (unwrapped.properties.isCorridorPoint || unwrapped.properties.onCorridor) {
1290
1300
  allowedIntersections--;
@@ -1296,7 +1306,9 @@ export class Wayfinding {
1296
1306
  }
1297
1307
  }
1298
1308
  }
1299
- return neighbours.filter((neighbour) => {
1309
+
1310
+ const beforeFilterCount = neighbours.length;
1311
+ const filteredNeighbours = neighbours.filter((neighbour) => {
1300
1312
  if (this.configuration.avoidElevators && neighbour.properties.type === this.POI_TYPE.ELEVATOR) {
1301
1313
  return false;
1302
1314
  } else if (this.configuration.avoidEscalators && neighbour.properties.type === this.POI_TYPE.ESCALATOR) {
@@ -1307,11 +1319,11 @@ export class Wayfinding {
1307
1319
  return false;
1308
1320
  } else if (this.configuration.avoidRamps && neighbour.properties.ramp) {
1309
1321
  return false;
1310
- } else if (this.configuration.avoidHills && neighbour.properties.hill) {
1311
- return false;
1312
1322
  }
1313
1323
  return true;
1314
1324
  });
1325
+
1326
+ return filteredNeighbours;
1315
1327
  }
1316
1328
  /**
1317
1329
  *
@@ -1682,58 +1694,59 @@ export class Wayfinding {
1682
1694
  return this._getFixPointInArea(endPoint);
1683
1695
  }
1684
1696
  _getFixPointInArea(point) {
1685
- const floorData = this.floorData.get(point.properties.level);
1686
- // If point is located without accessible area, do nothing
1687
- let pointFound = undefined;
1688
- if (floorData?.areas.length > 0) {
1689
- floorData.areas.forEach((polygon) => {
1690
- if (turf.booleanContains(polygon, point)) {
1691
- pointFound = point;
1692
- return;
1693
- }
1694
- });
1697
+ let floorData = this.floorData.get(point.properties.level);
1698
+
1699
+ if (!floorData) {
1700
+ return point;
1695
1701
  }
1696
- if (pointFound !== undefined) {
1697
- return pointFound;
1702
+
1703
+ // If point is located without accessible area, do nothing
1704
+ let areaList = floorData.areas;
1705
+ for (let index in areaList) {
1706
+ let polygon = areaList[index];
1707
+ if (turf.booleanContains(polygon, point)) {
1708
+ return point;
1709
+ }
1698
1710
  }
1711
+
1699
1712
  // Find nearest wall to stick to
1700
1713
  let bestWall = null;
1701
1714
  let bestWallDistance = Infinity;
1702
- if (floorData?.wallFeatures.length > 0) {
1703
- floorData.wallFeatures.forEach((wall) => {
1704
- const distance = turf.pointToLineDistance(point.geometry.coordinates, wall, { units: this.UNIT_TYPE });
1705
- if (distance <= bestWallDistance) {
1706
- bestWall = wall;
1707
- bestWallDistance = distance;
1708
- }
1709
- });
1710
- }
1711
- const levelCorridorFeatures = this.corridorLineFeatures.filter(
1715
+ floorData.wallFeatures.forEach((wall) => {
1716
+ let distance = turf.pointToLineDistance(point.geometry.coordinates, wall, { units: 'meters' });
1717
+ if (distance < bestWallDistance) {
1718
+ bestWall = wall;
1719
+ bestWallDistance = distance;
1720
+ }
1721
+ });
1722
+
1723
+ let levelCorridorFeatures = this.corridorLineFeatures.filter(
1712
1724
  (corridorLine) => corridorLine.properties.level === point.properties.level,
1713
1725
  );
1714
1726
  let bestCorridorIndex = null;
1715
1727
  let bestCorridorDistance = Infinity;
1716
1728
  levelCorridorFeatures.forEach((corridor) => {
1717
- const corridorIndex = this.corridorLineFeatures.indexOf(corridor);
1718
- const corridorDistance = turf.pointToLineDistance(point.geometry.coordinates, corridor, {
1719
- units: this.UNIT_TYPE,
1720
- });
1729
+ let corridorIndex = this.corridorLineFeatures.indexOf(corridor);
1730
+ let corridorDistance = turf.pointToLineDistance(point.geometry.coordinates, corridor, { units: 'meters' });
1721
1731
  if (corridorDistance < bestCorridorDistance) {
1722
1732
  bestCorridorIndex = corridorIndex;
1723
1733
  bestCorridorDistance = corridorDistance;
1724
1734
  }
1725
1735
  });
1736
+
1726
1737
  // Test if area or corridor is closer, create appropriate fixed point
1727
1738
  if (bestWall === null && bestCorridorIndex === null) {
1728
1739
  // could not find neither close area or corridor
1729
1740
  return point;
1730
1741
  } else {
1731
1742
  let fixedPoint;
1743
+
1732
1744
  // Corridor is closer
1733
- if (bestCorridorIndex !== undefined && bestCorridorDistance < bestWallDistance) {
1745
+ if (bestCorridorIndex !== null && bestCorridorDistance < bestWallDistance) {
1734
1746
  // Create fixed point on line itself
1735
- const line = this.corridorLineFeatures[bestCorridorIndex];
1747
+ let line = this.corridorLineFeatures[bestCorridorIndex];
1736
1748
  fixedPoint = turf.nearestPointOnLine(line, point);
1749
+
1737
1750
  // Mark this fixed point is on corridor, preset neighbours
1738
1751
  fixedPoint.properties.onCorridor = true;
1739
1752
  fixedPoint.properties.corridorIndex = bestCorridorIndex;
@@ -1754,11 +1767,11 @@ export class Wayfinding {
1754
1767
  } else if (this.corridorLineFeatures[bestCorridorIndex].properties.swapDirection != true) {
1755
1768
  fixedPoint.properties.neighbours.push(this.corridorLinePointPairs[bestCorridorIndex][0]);
1756
1769
  // include only intersection points after this point
1757
- const distance = this._distance(fixedPoint, this.corridorLinePointPairs[bestCorridorIndex][0]);
1758
- const pointsBefore = line.properties.intersectionPointList.filter(
1770
+ let distance = this._distance(fixedPoint, this.corridorLinePointPairs[bestCorridorIndex][0]);
1771
+ let pointsBefore = line.properties.intersectionPointList.filter(
1759
1772
  (point) => this._distance(point, this.corridorLinePointPairs[bestCorridorIndex][0]) < distance,
1760
1773
  );
1761
- const pointsAfter = line.properties.intersectionPointList.filter(
1774
+ let pointsAfter = line.properties.intersectionPointList.filter(
1762
1775
  (point) => this._distance(point, this.corridorLinePointPairs[bestCorridorIndex][0]) >= distance,
1763
1776
  );
1764
1777
  fixedPoint.properties.neighbours.push(...pointsAfter);
@@ -1766,11 +1779,11 @@ export class Wayfinding {
1766
1779
  } else {
1767
1780
  fixedPoint.properties.neighbours.push(this.corridorLinePointPairs[bestCorridorIndex][1]);
1768
1781
  // include only intersection points before this point
1769
- const distance = this._distance(fixedPoint, this.corridorLinePointPairs[bestCorridorIndex][0]);
1770
- const pointsBefore = line.properties.intersectionPointList.filter(
1782
+ let distance = this._distance(fixedPoint, this.corridorLinePointPairs[bestCorridorIndex][0]);
1783
+ let pointsBefore = line.properties.intersectionPointList.filter(
1771
1784
  (point) => this._distance(point, this.corridorLinePointPairs[bestCorridorIndex][0]) <= distance,
1772
1785
  );
1773
- const pointsAfter = line.properties.intersectionPointList.filter(
1786
+ let pointsAfter = line.properties.intersectionPointList.filter(
1774
1787
  (point) => this._distance(point, this.corridorLinePointPairs[bestCorridorIndex][0]) > distance,
1775
1788
  );
1776
1789
  fixedPoint.properties.neighbours.push(...pointsBefore);
@@ -1779,12 +1792,16 @@ export class Wayfinding {
1779
1792
  // Wall is closer
1780
1793
  } else if (bestWall !== null) {
1781
1794
  // Create fixed point inside area
1782
- const nearestPoint = turf.nearestPointOnLine(bestWall, point);
1783
- const bearing = turf.bearing(point, nearestPoint);
1784
- fixedPoint = turf.destination(point.geometry.coordinates, bestWallDistance + 0.05, bearing, this.UNIT_TYPE);
1795
+ let nearestPoint = turf.nearestPointOnLine(bestWall, point);
1796
+ let bearing = turf.bearing(point, nearestPoint);
1797
+ fixedPoint = turf.destination(point.geometry.coordinates, bestWallDistance + 0.05, bearing, {
1798
+ units: 'meters',
1799
+ });
1785
1800
  }
1801
+
1786
1802
  // Mark level of fixed point
1787
1803
  fixedPoint.properties.level = point.properties.level;
1804
+
1788
1805
  // Return created point
1789
1806
  return fixedPoint;
1790
1807
  }
@@ -72,11 +72,13 @@ if(e.properties.level!==i.properties.level)continue;const o=this._distance(e,i);
72
72
  .5>o&&p.push(e)}t=t.filter(e=>!p.includes(e)),p=[];// Simplify the route by omitting corners that are basically straight
73
73
  for(let s=1;s<t.length-1;s++){const e=t[s-1],i=t[s],n=t[s+1];// Different floors nothing to do
74
74
  if(e.properties.level!==i.properties.level||e.properties.level!==n.properties.level)continue;const a=this.bearing(e.geometry.coordinates,i.geometry.coordinates),l=this.bearing(i.geometry.coordinates,n.geometry.coordinates);let d=o(a-l);d>r&&(d-=r),.03488888>d&&p.push(i)}// let pathCoordinates = path.map(point => point.geometry.coordinates);
75
- return t=t.filter(e=>!p.includes(e)),t}_calculateWallOffsetPointList(e,r){const i=this._getPointList();let o=i.indexOf(e);const t=i.indexOf(r),s=[];let p=e;// a) offset current point
76
- 0<=o&&this.wallOffsets[o]&&(p=this.wallOffsets[o]),s.push(p);let n;do{const i=turf.lineString([r.geometry.coordinates,p.geometry.coordinates]);n=[],this.wallOffsetLineList.forEach((r,s)=>{// Do not process wall offsets from another floor
77
- if(r.properties.level===e.properties.level&&s!==t&&s!==o)// Do not process wall offsets with previous or current point
78
- {const e=turf.lineIntersect(i,r);if(0<e.features.length){const r=this.wallOffsets[s];// store distance to previousPoint
79
- r.properties.distance=this._distance(e.features[0],p),r.properties.offsetIndex=s,n.push(r)}}}),0<n.length&&(n.sort((e,r)=>e.properties.distance-r.properties.distance),p=n[0],o=p.properties.offsetIndex,s.push(p))}while(0<n.length);return s.reverse()}_getIntersectingOffsetPoints(e,r){if(e===r||e.properties.level!==r.properties.level)return[];const i=turf.lineString([e.geometry.coordinates,r.geometry.coordinates]),o=[];return this.wallOffsetLineList.forEach((r,t)=>{if(r.properties.level===e.properties.level&&0<turf.lineIntersect(i,r).features.length){const i=this.wallOffsets[t];i.properties.distance=turf.pointToLineDistance(e.geometry.coordinates,r,{units:this.UNIT_TYPE}),o.push(i)}}),o.sort((e,r)=>r.properties.distance-r.properties.distance),o}clearData(){this.floorData&&this.floorData.forEach(e=>{for(const r in e.points){const i=e.points[r];delete i.properties.cameFrom,delete i.properties.gscore,delete i.properties.fscore}}),this.levelChangerList&&this.levelChangerList.forEach(e=>{e.properties.fixedPointMap.forEach(e=>{delete e.properties.cameFrom,delete e.properties.gscore,delete e.properties.fscore})}),this.corridorLinePoints&&this.corridorLinePoints.forEach(e=>{delete e.properties.cameFrom,delete e.properties.gscore,delete e.properties.fscore})}/**
75
+ return t=t.filter(e=>!p.includes(e)),t}_calculateWallOffsetPointList(e,r){let i=this._getPointList(),o=i.indexOf(e),t=i.indexOf(r),s=[],p=e;// a) offset current point
76
+ 0<=o&&this.wallOffsets[o]&&(p=this.wallOffsets[o]),s.push(p);const n=new Set;// <-- track visited offset indices
77
+ 0<=o&&n.add(o);let a;do{let i=turf.lineString([r.geometry.coordinates,p.geometry.coordinates]);a=[],this.wallOffsetLineList.forEach((r,s)=>{// Do not process wall offsets from another floor
78
+ if(r.properties.level===e.properties.level&&s!==t&&s!==o&&!n.has(s))// Do not process already visited offset points // <-- skip visited
79
+ // Do not process wall offsets with previous or current point
80
+ {let e=turf.lineIntersect(i,r);if(0<e.features.length){let r=this.wallOffsets[s];// store distance to previousPoint
81
+ r.properties.distance=this._distance(e.features[0],p),r.properties.offsetIndex=s,a.push(r)}}}),0<a.length&&(a.sort((e,r)=>e.properties.distance-r.properties.distance),p=a[0],o=p.properties.offsetIndex,n.add(o),s.push(p))}while(0<a.length);return s.reverse()}_getIntersectingOffsetPoints(e,r){if(e===r||e.properties.level!==r.properties.level)return[];const i=turf.lineString([e.geometry.coordinates,r.geometry.coordinates]),o=[];return this.wallOffsetLineList.forEach((r,t)=>{if(r.properties.level===e.properties.level&&0<turf.lineIntersect(i,r).features.length){const i=this.wallOffsets[t];i.properties.distance=turf.pointToLineDistance(e.geometry.coordinates,r,{units:this.UNIT_TYPE}),o.push(i)}}),o.sort((e,r)=>r.properties.distance-r.properties.distance),o}clearData(){this.floorData&&this.floorData.forEach(e=>{for(const r in e.points){const i=e.points[r];delete i.properties.cameFrom,delete i.properties.gscore,delete i.properties.fscore}}),this.levelChangerList&&this.levelChangerList.forEach(e=>{e.properties.fixedPointMap.forEach(e=>{delete e.properties.cameFrom,delete e.properties.gscore,delete e.properties.fscore})}),this.corridorLinePoints&&this.corridorLinePoints.forEach(e=>{delete e.properties.cameFrom,delete e.properties.gscore,delete e.properties.fscore})}/**
80
82
  *
81
83
  * @param startPoint {Feature<Point>}
82
84
  * @param endPoint {Feature<Point>}
@@ -142,10 +144,13 @@ if(null===p)break;if(p===o){let t;try{t=this.reconstructPath(p)}catch(e){return}
142
144
  * @param endPoint {Feature<Point>}
143
145
  * @return {Point[]}
144
146
  * @private
145
- */_getNeighbours(e,r,i){let o=[];if(e===r){const t=this._getPointList().filter(r=>this._isPointOnLevel(r,e.properties.level));o=this._findNeighbours(e,r,i,t),o=o.filter(r=>{const i=e.properties.level,o=this.configuration.avoidRevolvingDoors&&this._testAccessibilityPoiNeighbourhood(e,r,i,this.POI_TYPE.REVOLVING_DOOR),t=this.configuration.avoidTicketGates&&this._testAccessibilityPoiNeighbourhood(e,r,i,this.POI_TYPE.TICKET_GATE),s=this._checkIfCrossingTwoPolygon(e,r);return!o&&!t&&!s})}else{// Gather neighbours over all levels
146
- const r=this._getPointList(),t=r.indexOf(e);// Test if endpoint is neighbour
147
- if(0<=t&&this.floorData.forEach((i,s)=>{const p=this.neighbourMap[s];p.hasOwnProperty(t)&&p[t].forEach(i=>{const t=r[i],p=this.configuration.avoidRevolvingDoors&&this._testAccessibilityPoiNeighbourhood(e,t,s,this.POI_TYPE.REVOLVING_DOOR),n=this.configuration.avoidTicketGates&&this._testAccessibilityPoiNeighbourhood(e,t,s,this.POI_TYPE.TICKET_GATE),a=this._checkIfCrossingTwoPolygon(e,t);o.includes(t)||p||n||a||o.push(t)})}),void 0!==e.properties.level&&e.properties.level===i.properties.level||null!=e.properties.fixedPointMap&&e.properties.fixedPointMap.has(i.properties.level)){const r=this.configuration.avoidRevolvingDoors&&this._testAccessibilityPoiNeighbourhood(e,i,i.properties.level,this.POI_TYPE.REVOLVING_DOOR),t=this.configuration.avoidTicketGates&&this._testAccessibilityPoiNeighbourhood(e,i,i.properties.level,this.POI_TYPE.TICKET_GATE),s=this._checkIfCrossingTwoPolygon(e,i);if(!r&&!t&&!s)// Endpoint is fixed on corridor
148
- if(i.properties.onCorridor)i.properties.neighbours.includes(e)?!1!=this.corridorLineFeatures[i.properties.corridorIndex].properties.bidirectional&&o.push(i):void 0!==i.properties.neighboursLeadingTo&&i.properties.neighboursLeadingTo.includes(e)&&o.push(i);else{const r=this._unwrapLevelChangerPoint(e,i.properties.level);let t=1;(r.properties.isCorridorPoint||r.properties.onCorridor)&&t--,this._countIntersections(r,i,t)&&o.push(i)}}}return o.filter(e=>{if(this.configuration.avoidElevators&&e.properties.type===this.POI_TYPE.ELEVATOR)return!1;return!(this.configuration.avoidEscalators&&e.properties.type===this.POI_TYPE.ESCALATOR)&&!(this.configuration.avoidStaircases&&e.properties.type===this.POI_TYPE.STAIRCASE)&&!(this.configuration.avoidNarrowPaths&&e.properties.narrowPath)&&!(this.configuration.avoidRamps&&e.properties.ramp)&&!(this.configuration.avoidHills&&e.properties.hill)})}/**
147
+ */_getNeighbours(e,r,i){let o=[];if(e===r){let t=this._getPointList().filter(r=>this._isPointOnLevel(r,e.properties.level));o=this._findNeighbours(e,r,i,t),o=o.filter(r=>{// if (neighbourPoint === endPoint) {
148
+ // console.log('testing endPoint');
149
+ // }
150
+ let i=e.properties.level,o=this.configuration.avoidRevolvingDoors&&this._testAccessibilityPoiNeighbourhood(e,r,i,this.POI_TYPE.REVOLVING_DOOR),t=this.configuration.avoidTicketGates&&this._testAccessibilityPoiNeighbourhood(e,r,i,this.POI_TYPE.TICKET_GATE);return!o&&!t})}else{// Gather neighbours over all levels
151
+ let r=this._getPointList(),t=r.indexOf(e);// Test if endpoint is neighbour
152
+ if(this.floorData.forEach((i,s)=>{let p=this.neighbourMap[s];Object.prototype.hasOwnProperty.call(p,t)&&p[t].forEach(i=>{let t=r[i],p=this.configuration.avoidRevolvingDoors&&this._testAccessibilityPoiNeighbourhood(e,t,s,this.POI_TYPE.REVOLVING_DOOR),n=this.configuration.avoidTicketGates&&this._testAccessibilityPoiNeighbourhood(e,t,s,this.POI_TYPE.TICKET_GATE);o.includes(t)||p||n||o.push(t)})}),void 0!==e.properties.level&&e.properties.level===i.properties.level||null!=e.properties.fixedPointMap&&e.properties.fixedPointMap.has(i.properties.level)){let r=this.configuration.avoidRevolvingDoors&&this._testAccessibilityPoiNeighbourhood(e,i,i.properties.level,this.POI_TYPE.REVOLVING_DOOR),t=this.configuration.avoidTicketGates&&this._testAccessibilityPoiNeighbourhood(e,i,i.properties.level,this.POI_TYPE.TICKET_GATE);if(!r&&!t)// Endpoint is fixed on corridor
153
+ if(i.properties.onCorridor)i.properties.neighbours.includes(e)?!1!=this.corridorLineFeatures[i.properties.corridorIndex].properties.bidirectional&&o.push(i):void 0!==i.properties.neighboursLeadingTo&&i.properties.neighboursLeadingTo.includes(e)&&o.push(i);else{let r=this._unwrapLevelChangerPoint(e,i.properties.level),t=1;(r.properties.isCorridorPoint||r.properties.onCorridor)&&t--,this._countIntersections(r,i,t)&&o.push(i)}}}const t=o.length,s=o.filter(e=>{if(this.configuration.avoidElevators&&e.properties.type===this.POI_TYPE.ELEVATOR)return!1;return!(this.configuration.avoidEscalators&&e.properties.type===this.POI_TYPE.ESCALATOR)&&!(this.configuration.avoidStaircases&&e.properties.type===this.POI_TYPE.STAIRCASE)&&!(this.configuration.avoidNarrowPaths&&e.properties.narrowPath)&&!(this.configuration.avoidRamps&&e.properties.ramp)});return s}/**
149
154
  *
150
155
  * @param pointA {Feature<Point>}
151
156
  * @param pointB {Feature<Point>}
@@ -205,17 +210,17 @@ return i.forEach(i=>{const t=this._distance(e,i)+this._distance(i,r)+10;t<o&&(o=
205
210
  */_distance(e,r){let i=0;return r.properties.level!==e.properties.level&&(i=10),turf.distance(e,r,{units:this.UNIT_TYPE})+i}/**
206
211
  *
207
212
  * @private
208
- */_getFixEndPoint(e,r){var i=Math.abs;const o=this.levelChangerList.find(r=>r.id===e.id);if(o!==void 0&&o.properties.fixedPointMap!==void 0){let t;o.properties.fixedPointMap.forEach((e,o)=>{(t===void 0||i(t-r)>i(o-r))&&(t=o)}),e=this._copyPoint(e),e.properties.level=t}return this._getFixPointInArea(e)}_getFixPointInArea(e){const r=this.floorData.get(e.properties.level);// If point is located without accessible area, do nothing
209
- let i;if(0<r?.areas.length&&r.areas.forEach(r=>{if(turf.booleanContains(r,e))return void(i=e)}),void 0!==i)return i;// Find nearest wall to stick to
210
- let o=null,t=1/0;0<r?.wallFeatures.length&&r.wallFeatures.forEach(r=>{const i=turf.pointToLineDistance(e.geometry.coordinates,r,{units:this.UNIT_TYPE});i<=t&&(o=r,t=i)});const s=this.corridorLineFeatures.filter(r=>r.properties.level===e.properties.level);let p=null,n=1/0;// Test if area or corridor is closer, create appropriate fixed point
211
- if(s.forEach(r=>{const i=this.corridorLineFeatures.indexOf(r),o=turf.pointToLineDistance(e.geometry.coordinates,r,{units:this.UNIT_TYPE});o<n&&(p=i,n=o)}),null===o&&null===p)// could not find neither close area or corridor
213
+ */_getFixEndPoint(e,r){var i=Math.abs;const o=this.levelChangerList.find(r=>r.id===e.id);if(o!==void 0&&o.properties.fixedPointMap!==void 0){let t;o.properties.fixedPointMap.forEach((e,o)=>{(t===void 0||i(t-r)>i(o-r))&&(t=o)}),e=this._copyPoint(e),e.properties.level=t}return this._getFixPointInArea(e)}_getFixPointInArea(e){let r=this.floorData.get(e.properties.level);if(!r)return e;// If point is located without accessible area, do nothing
214
+ let i=r.areas;for(let r in i){let o=i[r];if(turf.booleanContains(o,e))return e}// Find nearest wall to stick to
215
+ let o=null,t=1/0;r.wallFeatures.forEach(r=>{let i=turf.pointToLineDistance(e.geometry.coordinates,r,{units:"meters"});i<t&&(o=r,t=i)});let s=this.corridorLineFeatures.filter(r=>r.properties.level===e.properties.level),p=null,n=1/0;// Test if area or corridor is closer, create appropriate fixed point
216
+ if(s.forEach(r=>{let i=this.corridorLineFeatures.indexOf(r),o=turf.pointToLineDistance(e.geometry.coordinates,r,{units:"meters"});o<n&&(p=i,n=o)}),null===o&&null===p)// could not find neither close area or corridor
212
217
  return e;else{let r;// Corridor is closer
213
- if(void 0!==p&&n<t){// Create fixed point on line itself
214
- const i=this.corridorLineFeatures[p];if(r=turf.nearestPointOnLine(i,e),r.properties.onCorridor=!0,r.properties.corridorIndex=p,r.properties.neighbours||(r.properties.neighbours=[]),!1!=this.corridorLineFeatures[p].properties.bidirectional)r.properties.neighbours.push(this.corridorLinePointPairs[p][0],this.corridorLinePointPairs[p][1]),r.properties.neighbours.push(...i.properties.intersectionPointList),r.properties.neighboursLeadingTo=[this.corridorLinePointPairs[p][0],this.corridorLinePointPairs[p][1],...i.properties.intersectionPointList];else if(!0!=this.corridorLineFeatures[p].properties.swapDirection){r.properties.neighbours.push(this.corridorLinePointPairs[p][0]);// include only intersection points after this point
215
- const e=this._distance(r,this.corridorLinePointPairs[p][0]),o=i.properties.intersectionPointList.filter(r=>this._distance(r,this.corridorLinePointPairs[p][0])<e),t=i.properties.intersectionPointList.filter(r=>this._distance(r,this.corridorLinePointPairs[p][0])>=e);r.properties.neighbours.push(...t),r.properties.neighboursLeadingTo=o}else{r.properties.neighbours.push(this.corridorLinePointPairs[p][1]);// include only intersection points before this point
216
- const e=this._distance(r,this.corridorLinePointPairs[p][0]),o=i.properties.intersectionPointList.filter(r=>this._distance(r,this.corridorLinePointPairs[p][0])<=e),t=i.properties.intersectionPointList.filter(r=>this._distance(r,this.corridorLinePointPairs[p][0])>e);r.properties.neighbours.push(...o),r.properties.neighboursLeadingTo=t}// Wall is closer
218
+ if(null!==p&&n<t){// Create fixed point on line itself
219
+ let i=this.corridorLineFeatures[p];if(r=turf.nearestPointOnLine(i,e),r.properties.onCorridor=!0,r.properties.corridorIndex=p,r.properties.neighbours||(r.properties.neighbours=[]),!1!=this.corridorLineFeatures[p].properties.bidirectional)r.properties.neighbours.push(this.corridorLinePointPairs[p][0],this.corridorLinePointPairs[p][1]),r.properties.neighbours.push(...i.properties.intersectionPointList),r.properties.neighboursLeadingTo=[this.corridorLinePointPairs[p][0],this.corridorLinePointPairs[p][1],...i.properties.intersectionPointList];else if(!0!=this.corridorLineFeatures[p].properties.swapDirection){r.properties.neighbours.push(this.corridorLinePointPairs[p][0]);// include only intersection points after this point
220
+ let e=this._distance(r,this.corridorLinePointPairs[p][0]),o=i.properties.intersectionPointList.filter(r=>this._distance(r,this.corridorLinePointPairs[p][0])<e),t=i.properties.intersectionPointList.filter(r=>this._distance(r,this.corridorLinePointPairs[p][0])>=e);r.properties.neighbours.push(...t),r.properties.neighboursLeadingTo=o}else{r.properties.neighbours.push(this.corridorLinePointPairs[p][1]);// include only intersection points before this point
221
+ let e=this._distance(r,this.corridorLinePointPairs[p][0]),o=i.properties.intersectionPointList.filter(r=>this._distance(r,this.corridorLinePointPairs[p][0])<=e),t=i.properties.intersectionPointList.filter(r=>this._distance(r,this.corridorLinePointPairs[p][0])>e);r.properties.neighbours.push(...o),r.properties.neighboursLeadingTo=t}// Wall is closer
217
222
  }else if(null!==o){// Create fixed point inside area
218
- const i=turf.nearestPointOnLine(o,e),s=turf.bearing(e,i);r=turf.destination(e.geometry.coordinates,t+.05,s,this.UNIT_TYPE)}// Mark level of fixed point
223
+ let i=turf.nearestPointOnLine(o,e),s=turf.bearing(e,i);r=turf.destination(e.geometry.coordinates,t+.05,s,{units:"meters"})}// Mark level of fixed point
219
224
  // Return created point
220
225
  return r.properties.level=e.properties.level,r}}/**
221
226
  * @param point {Feature <Point>}
@@ -2330,7 +2330,6 @@ export class Map {
2330
2330
  this.amenityIds.push(featureVar.id);
2331
2331
  this.filteredAmenities.push(featureVar.id);
2332
2332
  }
2333
- this.filterOutFeatures();
2334
2333
  this.geojsonSource.update(featureVar);
2335
2334
  }
2336
2335
  if (!isTemporary) {
@@ -2339,6 +2338,7 @@ export class Map {
2339
2338
  features: featureVars.map((f) => f.JsonDynamicStrip),
2340
2339
  });
2341
2340
  }
2341
+ this.filterOutFeatures();
2342
2342
  this.onFeaturesChange();
2343
2343
  this.onFeatureUpdateListener.next(featureVars);
2344
2344
  return featureVars;
@@ -3704,9 +3704,7 @@ export class Map {
3704
3704
  startTime = currentTime;
3705
3705
  const elapsedTime = currentTime - startTime;
3706
3706
  const t = elapsedTime / (totalDuration > 0 ? totalDuration : 3);
3707
- console.log('animate the position', t, elapsedTime, totalDuration);
3708
3707
  if (t >= 1) {
3709
- console.log('t >= 1, should continue on next step');
3710
3708
  if (!this.useCustomPosition) {
3711
3709
  // Stop the animation if we reached the end
3712
3710
  if (this.defaultOptions.routeAnimation.looping &&
@@ -105,7 +105,7 @@ export const getFeatures = ({ initPolygons, polygonLayers, autoLabelLines, hidde
105
105
  };
106
106
  }
107
107
  }
108
- originalFeatures = Object.assign({}, res.data);
108
+ originalFeatures = JSON.parse(JSON.stringify(res.data));
109
109
  if (polygonBufferDistance !== 0 && (polygonTypesToScale === null || polygonTypesToScale === void 0 ? void 0 : polygonTypesToScale.length) > 0) {
110
110
  res.data.features = res.data.features.map((feature) => {
111
111
  try {
@@ -123,7 +123,7 @@ export const getFeatures = ({ initPolygons, polygonLayers, autoLabelLines, hidde
123
123
  });
124
124
  }
125
125
  res.data.features = res.data.features.map((feature) => {
126
- feature.geometry.coordinates = shortenCoordinates({ coords: feature.geometry.coordinates, decimals: 8 });
126
+ feature.geometry.coordinates = shortenCoordinates({ coords: feature.geometry.coordinates, decimals: 10 });
127
127
  rewind(feature, false);
128
128
  return feature;
129
129
  });