venue-js 1.4.0-next.20 → 1.4.0-next.22
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.d.mts +1 -1
- package/dist/data/index.d.ts +1 -1
- package/dist/data/index.js +38 -32
- package/dist/data/index.js.map +1 -1
- package/dist/data/index.mjs +32 -26
- package/dist/data/index.mjs.map +1 -1
- package/dist/{index-X4qpYAhF.d.mts → index-CrxL_5B7.d.mts} +2 -2
- package/dist/{index-X4qpYAhF.d.ts → index-CrxL_5B7.d.ts} +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +193 -187
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/data/index.mjs
CHANGED
|
@@ -870,7 +870,7 @@ var createElevatorNodeMap = (elevatorLikeRelationships, unitOpenings, options) =
|
|
|
870
870
|
const level = levels.find((level2) => level2.id === destination.properties.level_id);
|
|
871
871
|
return { opening, level };
|
|
872
872
|
});
|
|
873
|
-
const intermediaryOpeningAndLevels = intermediary.map((unitTypeAndId) => {
|
|
873
|
+
const intermediaryOpeningAndLevels = (intermediary || []).map((unitTypeAndId) => {
|
|
874
874
|
const openings = unitOpenings[unitTypeAndId.id];
|
|
875
875
|
const unit = units.find((unit2) => unit2.id === unitTypeAndId.id);
|
|
876
876
|
const level = levels.find((level2) => level2.id === unit.properties.level_id);
|
|
@@ -914,11 +914,13 @@ var createEscalatorNodeMap = (relationships, options) => {
|
|
|
914
914
|
const {
|
|
915
915
|
properties: { direction, origin, destination }
|
|
916
916
|
} = relationship;
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
917
|
+
if (origin && destination) {
|
|
918
|
+
set(nodeMap, `${origin.id}.${destination.id}`, distanceOptions.baseDistance);
|
|
919
|
+
if (direction === "undirected") {
|
|
920
|
+
set(nodeMap, `${destination.id}.${origin.id}`, distanceOptions.baseDistance);
|
|
921
|
+
}
|
|
922
|
+
counter++;
|
|
920
923
|
}
|
|
921
|
-
counter++;
|
|
922
924
|
}
|
|
923
925
|
const t1 = performance.now();
|
|
924
926
|
trace("nav", ` \u2502 \u251C\u2500 add ${counter} escalator relationships`, t1 - t0);
|
|
@@ -1043,17 +1045,19 @@ var createPOINodeMap = (features, getFeatureUnit, unitOpenings) => {
|
|
|
1043
1045
|
features.forEach((feat) => {
|
|
1044
1046
|
try {
|
|
1045
1047
|
const locatedOnUnitId = getFeatureUnit(feat);
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1048
|
+
if (locatedOnUnitId) {
|
|
1049
|
+
const openings = unitOpenings[locatedOnUnitId] ?? [];
|
|
1050
|
+
const center7 = turfCenter2(feat);
|
|
1051
|
+
for (const opening of openings) {
|
|
1052
|
+
try {
|
|
1053
|
+
const openingCenter = turfCenter2(opening);
|
|
1054
|
+
const dis = distance(center7, openingCenter, { units: "meters" }) + BASE_POI_BASEDISTANCE;
|
|
1055
|
+
_5.set(nodeMap, `${opening.id}.${feat.id}`, dis);
|
|
1056
|
+
_5.set(nodeMap, `${feat.id}.${opening.id}`, dis);
|
|
1057
|
+
counter++;
|
|
1058
|
+
} catch (err) {
|
|
1059
|
+
console.log(err, opening);
|
|
1060
|
+
}
|
|
1057
1061
|
}
|
|
1058
1062
|
}
|
|
1059
1063
|
} catch (err) {
|
|
@@ -1100,13 +1104,13 @@ var createUnitOpenings = (relationships, units, openings) => {
|
|
|
1100
1104
|
});
|
|
1101
1105
|
units.forEach((unit) => {
|
|
1102
1106
|
const unitId = unit.id;
|
|
1103
|
-
const
|
|
1104
|
-
const relationshipIntermediaryTypeAndId =
|
|
1105
|
-
(relationship) => relationship.properties.intermediary[0]
|
|
1107
|
+
const connectedRelationship = relationshipMap.get(unitId) || [];
|
|
1108
|
+
const relationshipIntermediaryTypeAndId = compact(connectedRelationship.map(
|
|
1109
|
+
(relationship) => relationship.properties.intermediary?.[0]
|
|
1106
1110
|
// Assuming intermediary is always an array
|
|
1107
|
-
);
|
|
1111
|
+
));
|
|
1108
1112
|
const relationshipIntermediary = relationshipIntermediaryTypeAndId.map(({ id }) => {
|
|
1109
|
-
return openings.find((opening) => opening.id === id);
|
|
1113
|
+
return openings.find((opening) => !!opening && opening.id === id);
|
|
1110
1114
|
});
|
|
1111
1115
|
openingConnections[unitId] = uniqBy(
|
|
1112
1116
|
[...openingConnections[unitId] || [], ...relationshipIntermediary],
|
|
@@ -1131,8 +1135,7 @@ var prepareGraph = (options) => {
|
|
|
1131
1135
|
relationships = [],
|
|
1132
1136
|
openings = [],
|
|
1133
1137
|
units = [],
|
|
1134
|
-
kiosks = []
|
|
1135
|
-
levels = []
|
|
1138
|
+
kiosks = []
|
|
1136
1139
|
}
|
|
1137
1140
|
} = options;
|
|
1138
1141
|
const {
|
|
@@ -1156,7 +1159,7 @@ var prepareGraph = (options) => {
|
|
|
1156
1159
|
unitOpenings,
|
|
1157
1160
|
options
|
|
1158
1161
|
);
|
|
1159
|
-
const amenityNodeMap = createPOINodeMap(amenities, (amenity) => amenity.properties.unit_ids[0], unitOpenings);
|
|
1162
|
+
const amenityNodeMap = createPOINodeMap(amenities, (amenity) => amenity.properties.unit_ids?.[0] || null, unitOpenings);
|
|
1160
1163
|
const anchorsNodeMap = createPOINodeMap(anchors, (anchor) => anchor.properties.unit_id, unitOpenings);
|
|
1161
1164
|
const walkwayUnits = units.filter((unit) => unit.properties.category === "walkway");
|
|
1162
1165
|
const kioskNodeMap = createPOINodeMap(kiosks, (kiosk) => findContainingUnit(kiosk, walkwayUnits)?.id, unitOpenings);
|
|
@@ -2206,7 +2209,9 @@ var createLandmarkUtils = (options) => {
|
|
|
2206
2209
|
const locationType = occupant.properties.unit_id ? "unit" : "kiosk";
|
|
2207
2210
|
const locationId = locationType === "unit" ? occupant.properties.unit_id : occupant.properties.kiosk_id;
|
|
2208
2211
|
const location = locationType === "unit" ? findByIdSync(locationId) : findByIdSync(locationId);
|
|
2209
|
-
|
|
2212
|
+
if (!location) return null;
|
|
2213
|
+
const level = location.properties.level_id ? findByIdSync(location.properties.level_id) : null;
|
|
2214
|
+
if (!level) return null;
|
|
2210
2215
|
return {
|
|
2211
2216
|
name: occupant.properties.name,
|
|
2212
2217
|
point: center5(location.geometry).geometry.coordinates,
|
|
@@ -2216,7 +2221,7 @@ var createLandmarkUtils = (options) => {
|
|
|
2216
2221
|
};
|
|
2217
2222
|
};
|
|
2218
2223
|
const landmarks = [
|
|
2219
|
-
...occupants.map(occupantToLandmark)
|
|
2224
|
+
...compact(occupants.map(occupantToLandmark))
|
|
2220
2225
|
];
|
|
2221
2226
|
const findNearbyLandmarks = (point2, levelId) => {
|
|
2222
2227
|
if (point2 === null || levelId === null) return [];
|
|
@@ -2306,6 +2311,7 @@ var getNavigateClient = (options) => {
|
|
|
2306
2311
|
trace("nav", "\u2713 findRoute", 0);
|
|
2307
2312
|
const t02 = performance.now();
|
|
2308
2313
|
const path = graph.path(routeOriginParam, routeDestinationParam);
|
|
2314
|
+
if (path === null) return { steps: [], distance: 0, duration: 0 };
|
|
2309
2315
|
const t12 = performance.now();
|
|
2310
2316
|
trace("nav", " \u251C\u2500 path (dijkstra)", t12 - t02);
|
|
2311
2317
|
const waypoints = waypointUtils.toWaypoints(path);
|