venue-js 1.4.0-next.21 → 1.4.0-next.23
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/data/index.js +28 -19
- package/dist/data/index.js.map +1 -1
- package/dist/data/index.mjs +28 -19
- package/dist/data/index.mjs.map +1 -1
- package/dist/index.js +183 -174
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/data/index.js
CHANGED
|
@@ -918,7 +918,7 @@ var createElevatorNodeMap = (elevatorLikeRelationships, unitOpenings, options) =
|
|
|
918
918
|
const level = levels.find((level2) => level2.id === destination.properties.level_id);
|
|
919
919
|
return { opening, level };
|
|
920
920
|
});
|
|
921
|
-
const intermediaryOpeningAndLevels = intermediary.map((unitTypeAndId) => {
|
|
921
|
+
const intermediaryOpeningAndLevels = (intermediary || []).map((unitTypeAndId) => {
|
|
922
922
|
const openings = unitOpenings[unitTypeAndId.id];
|
|
923
923
|
const unit = units.find((unit2) => unit2.id === unitTypeAndId.id);
|
|
924
924
|
const level = levels.find((level2) => level2.id === unit.properties.level_id);
|
|
@@ -962,11 +962,13 @@ var createEscalatorNodeMap = (relationships, options) => {
|
|
|
962
962
|
const {
|
|
963
963
|
properties: { direction, origin, destination }
|
|
964
964
|
} = relationship;
|
|
965
|
-
(
|
|
966
|
-
|
|
967
|
-
(
|
|
965
|
+
if (origin && destination) {
|
|
966
|
+
(0, import_set.default)(nodeMap, `${origin.id}.${destination.id}`, distanceOptions.baseDistance);
|
|
967
|
+
if (direction === "undirected") {
|
|
968
|
+
(0, import_set.default)(nodeMap, `${destination.id}.${origin.id}`, distanceOptions.baseDistance);
|
|
969
|
+
}
|
|
970
|
+
counter++;
|
|
968
971
|
}
|
|
969
|
-
counter++;
|
|
970
972
|
}
|
|
971
973
|
const t1 = performance.now();
|
|
972
974
|
trace("nav", ` \u2502 \u251C\u2500 add ${counter} escalator relationships`, t1 - t0);
|
|
@@ -1019,7 +1021,9 @@ var createStairNodeMap = (elevatorLikeRelationships, unitOpenings, options) => {
|
|
|
1019
1021
|
const intermediaryOpeningAndLevels = intermediary.map((unitTypeAndId) => {
|
|
1020
1022
|
const openings2 = unitOpenings[unitTypeAndId.id];
|
|
1021
1023
|
const unit = units.find((unit2) => unit2.id === unitTypeAndId.id);
|
|
1024
|
+
if (!unit) return [];
|
|
1022
1025
|
const level = levels.find((level2) => level2.id === unit.properties.level_id);
|
|
1026
|
+
if (!level) return [];
|
|
1023
1027
|
return openings2.map((opening) => ({ opening, level }));
|
|
1024
1028
|
}).flat();
|
|
1025
1029
|
const connections = [...intermediaryOpeningAndLevels, destinationOpeningAndLevel];
|
|
@@ -1091,17 +1095,19 @@ var createPOINodeMap = (features, getFeatureUnit, unitOpenings) => {
|
|
|
1091
1095
|
features.forEach((feat) => {
|
|
1092
1096
|
try {
|
|
1093
1097
|
const locatedOnUnitId = getFeatureUnit(feat);
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1098
|
+
if (locatedOnUnitId) {
|
|
1099
|
+
const openings = unitOpenings[locatedOnUnitId] ?? [];
|
|
1100
|
+
const center7 = (0, import_center4.center)(feat);
|
|
1101
|
+
for (const opening of openings) {
|
|
1102
|
+
try {
|
|
1103
|
+
const openingCenter = (0, import_center4.center)(opening);
|
|
1104
|
+
const dis = (0, import_distance2.distance)(center7, openingCenter, { units: "meters" }) + BASE_POI_BASEDISTANCE;
|
|
1105
|
+
import_lodash9.default.set(nodeMap, `${opening.id}.${feat.id}`, dis);
|
|
1106
|
+
import_lodash9.default.set(nodeMap, `${feat.id}.${opening.id}`, dis);
|
|
1107
|
+
counter++;
|
|
1108
|
+
} catch (err) {
|
|
1109
|
+
console.log(err, opening);
|
|
1110
|
+
}
|
|
1105
1111
|
}
|
|
1106
1112
|
}
|
|
1107
1113
|
} catch (err) {
|
|
@@ -1203,7 +1209,7 @@ var prepareGraph = (options) => {
|
|
|
1203
1209
|
unitOpenings,
|
|
1204
1210
|
options
|
|
1205
1211
|
);
|
|
1206
|
-
const amenityNodeMap = createPOINodeMap(amenities, (amenity) => amenity.properties.unit_ids[0], unitOpenings);
|
|
1212
|
+
const amenityNodeMap = createPOINodeMap(amenities, (amenity) => amenity.properties.unit_ids?.[0] || null, unitOpenings);
|
|
1207
1213
|
const anchorsNodeMap = createPOINodeMap(anchors, (anchor) => anchor.properties.unit_id, unitOpenings);
|
|
1208
1214
|
const walkwayUnits = units.filter((unit) => unit.properties.category === "walkway");
|
|
1209
1215
|
const kioskNodeMap = createPOINodeMap(kiosks, (kiosk) => findContainingUnit(kiosk, walkwayUnits)?.id, unitOpenings);
|
|
@@ -2253,7 +2259,9 @@ var createLandmarkUtils = (options) => {
|
|
|
2253
2259
|
const locationType = occupant.properties.unit_id ? "unit" : "kiosk";
|
|
2254
2260
|
const locationId = locationType === "unit" ? occupant.properties.unit_id : occupant.properties.kiosk_id;
|
|
2255
2261
|
const location = locationType === "unit" ? findByIdSync(locationId) : findByIdSync(locationId);
|
|
2256
|
-
|
|
2262
|
+
if (!location) return null;
|
|
2263
|
+
const level = location.properties.level_id ? findByIdSync(location.properties.level_id) : null;
|
|
2264
|
+
if (!level) return null;
|
|
2257
2265
|
return {
|
|
2258
2266
|
name: occupant.properties.name,
|
|
2259
2267
|
point: (0, import_center8.center)(location.geometry).geometry.coordinates,
|
|
@@ -2263,7 +2271,7 @@ var createLandmarkUtils = (options) => {
|
|
|
2263
2271
|
};
|
|
2264
2272
|
};
|
|
2265
2273
|
const landmarks = [
|
|
2266
|
-
...occupants.map(occupantToLandmark)
|
|
2274
|
+
...compact(occupants.map(occupantToLandmark))
|
|
2267
2275
|
];
|
|
2268
2276
|
const findNearbyLandmarks = (point2, levelId) => {
|
|
2269
2277
|
if (point2 === null || levelId === null) return [];
|
|
@@ -2353,6 +2361,7 @@ var getNavigateClient = (options) => {
|
|
|
2353
2361
|
trace("nav", "\u2713 findRoute", 0);
|
|
2354
2362
|
const t02 = performance.now();
|
|
2355
2363
|
const path = graph.path(routeOriginParam, routeDestinationParam);
|
|
2364
|
+
if (path === null) return { steps: [], distance: 0, duration: 0 };
|
|
2356
2365
|
const t12 = performance.now();
|
|
2357
2366
|
trace("nav", " \u251C\u2500 path (dijkstra)", t12 - t02);
|
|
2358
2367
|
const waypoints = waypointUtils.toWaypoints(path);
|