venue-js 1.4.0-next.20 → 1.4.0-next.21
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 +12 -13
- package/dist/data/index.js.map +1 -1
- package/dist/data/index.mjs +6 -7
- 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 +167 -168
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -832,7 +832,7 @@ var getSearchClient = ({ occupants, amenities }) => {
|
|
|
832
832
|
var import_boolean_point_in_polygon4 = require("@turf/boolean-point-in-polygon");
|
|
833
833
|
|
|
834
834
|
// src/data/navigate/graph/prepare.ts
|
|
835
|
-
var
|
|
835
|
+
var import_lodash11 = __toESM(require("lodash"));
|
|
836
836
|
var import_node_dijkstra = __toESM(require("node-dijkstra"));
|
|
837
837
|
var import_distance3 = require("@turf/distance");
|
|
838
838
|
var import_center5 = require("@turf/center");
|
|
@@ -1186,13 +1186,13 @@ var createUnitOpenings = (relationships, units, openings) => {
|
|
|
1186
1186
|
});
|
|
1187
1187
|
units.forEach((unit) => {
|
|
1188
1188
|
const unitId = unit.id;
|
|
1189
|
-
const
|
|
1190
|
-
const relationshipIntermediaryTypeAndId =
|
|
1191
|
-
(relationship) => relationship.properties.intermediary[0]
|
|
1189
|
+
const connectedRelationship = relationshipMap.get(unitId) || [];
|
|
1190
|
+
const relationshipIntermediaryTypeAndId = compact(connectedRelationship.map(
|
|
1191
|
+
(relationship) => relationship.properties.intermediary?.[0]
|
|
1192
1192
|
// Assuming intermediary is always an array
|
|
1193
|
-
);
|
|
1193
|
+
));
|
|
1194
1194
|
const relationshipIntermediary = relationshipIntermediaryTypeAndId.map(({ id }) => {
|
|
1195
|
-
return openings.find((opening) => opening.id === id);
|
|
1195
|
+
return openings.find((opening) => !!opening && opening.id === id);
|
|
1196
1196
|
});
|
|
1197
1197
|
openingConnections[unitId] = (0, import_uniqBy.default)(
|
|
1198
1198
|
[...openingConnections[unitId] || [], ...relationshipIntermediary],
|
|
@@ -1217,8 +1217,7 @@ var prepareGraph = (options) => {
|
|
|
1217
1217
|
relationships = [],
|
|
1218
1218
|
openings = [],
|
|
1219
1219
|
units = [],
|
|
1220
|
-
kiosks = []
|
|
1221
|
-
levels = []
|
|
1220
|
+
kiosks = []
|
|
1222
1221
|
}
|
|
1223
1222
|
} = options;
|
|
1224
1223
|
const {
|
|
@@ -1227,7 +1226,7 @@ var prepareGraph = (options) => {
|
|
|
1227
1226
|
ramp: rampRelationships = [],
|
|
1228
1227
|
elevator: elevatorRelationships = [],
|
|
1229
1228
|
stairs: stairsRelationships = []
|
|
1230
|
-
} =
|
|
1229
|
+
} = import_lodash11.default.groupBy(relationships, "properties.category");
|
|
1231
1230
|
const unitOpenings = createUnitOpenings(traversalRelationships, units, openings);
|
|
1232
1231
|
const traversalNodeMap = createTraversalNodeMap(unitOpenings, options);
|
|
1233
1232
|
const escalatorNodeMap = createEscalatorNodeMap(escalatorRelationships, options);
|
|
@@ -1286,7 +1285,7 @@ var prepareGraph = (options) => {
|
|
|
1286
1285
|
};
|
|
1287
1286
|
|
|
1288
1287
|
// src/data/navigate/steps/createStepUtils.ts
|
|
1289
|
-
var
|
|
1288
|
+
var import_lodash13 = require("lodash");
|
|
1290
1289
|
var import_intersectionBy = __toESM(require("lodash/intersectionBy"));
|
|
1291
1290
|
|
|
1292
1291
|
// src/data/navigate/description/describe.ts
|
|
@@ -1310,7 +1309,7 @@ var describeHorizontalStep = (intermediary, toward, landmark) => {
|
|
|
1310
1309
|
};
|
|
1311
1310
|
|
|
1312
1311
|
// src/data/navigate/steps/path/index.ts
|
|
1313
|
-
var
|
|
1312
|
+
var import_lodash12 = __toESM(require("lodash"));
|
|
1314
1313
|
|
|
1315
1314
|
// src/data/navigate/constants.ts
|
|
1316
1315
|
var OBSTACLE_FEATURE_TYPES = [
|
|
@@ -1960,7 +1959,7 @@ var createStepPathUtils = (options) => {
|
|
|
1960
1959
|
const exceptionFeatureIds = [];
|
|
1961
1960
|
const obstacles = findObstaclesFromWalkway(
|
|
1962
1961
|
relatedWalkablePlatform,
|
|
1963
|
-
|
|
1962
|
+
import_lodash12.default.compact(exceptionFeatureIds)
|
|
1964
1963
|
);
|
|
1965
1964
|
const line = findPathOnArea(from, to, {
|
|
1966
1965
|
resolution,
|
|
@@ -2040,7 +2039,7 @@ var createStepUtils = (options) => {
|
|
|
2040
2039
|
return intermediaryTypeAndId.map(({ id }) => findByIdSync(id));
|
|
2041
2040
|
};
|
|
2042
2041
|
const formatCategoryLabel = (category) => {
|
|
2043
|
-
return (0,
|
|
2042
|
+
return (0, import_lodash13.capitalize)(category);
|
|
2044
2043
|
};
|
|
2045
2044
|
const getNextStepIntermediary = (from, to, intermediary) => {
|
|
2046
2045
|
if (to.type === "end") return to.name;
|
|
@@ -2592,7 +2591,7 @@ var getDataClient = (options) => {
|
|
|
2592
2591
|
var import_maptalks_gl = require("maptalks-gl");
|
|
2593
2592
|
var import_transcoders = require("@maptalks/transcoders.draco");
|
|
2594
2593
|
var import_tween = __toESM(require("@tweenjs/tween.js"));
|
|
2595
|
-
var
|
|
2594
|
+
var import_lodash21 = __toESM(require("lodash"));
|
|
2596
2595
|
var import_distance6 = __toESM(require("@turf/distance"));
|
|
2597
2596
|
var import_center13 = __toESM(require("@turf/center"));
|
|
2598
2597
|
var import_three6 = require("three");
|
|
@@ -2673,7 +2672,7 @@ var VENUE_EVENTS = {
|
|
|
2673
2672
|
};
|
|
2674
2673
|
|
|
2675
2674
|
// src/IndoorMap/utils/createElements.js
|
|
2676
|
-
var
|
|
2675
|
+
var import_lodash17 = __toESM(require("lodash"));
|
|
2677
2676
|
var import_maptalks4 = require("maptalks");
|
|
2678
2677
|
var import_center11 = __toESM(require("@turf/center"));
|
|
2679
2678
|
var import_buffer = __toESM(require("@turf/buffer"));
|
|
@@ -2683,7 +2682,7 @@ var import_three4 = require("three");
|
|
|
2683
2682
|
var maptalks = __toESM(require("maptalks"));
|
|
2684
2683
|
var import_maptalks = require("maptalks.three");
|
|
2685
2684
|
var import_three = require("three");
|
|
2686
|
-
var
|
|
2685
|
+
var import_lodash14 = __toESM(require("lodash"));
|
|
2687
2686
|
var OPTIONS = {
|
|
2688
2687
|
altitude: 25,
|
|
2689
2688
|
scale: 15e-5,
|
|
@@ -2716,7 +2715,7 @@ var Billboard = class extends import_maptalks.BaseObject {
|
|
|
2716
2715
|
} = options;
|
|
2717
2716
|
this.properties = { ...properties };
|
|
2718
2717
|
this._createGroup();
|
|
2719
|
-
const divider =
|
|
2718
|
+
const divider = import_lodash14.default.clamp(window.innerWidth / 375 / 1.75, 1, 1.7);
|
|
2720
2719
|
if (showLeg) {
|
|
2721
2720
|
const lineMaterial = new import_three.LineBasicMaterial({
|
|
2722
2721
|
color: legColor,
|
|
@@ -2751,9 +2750,9 @@ var Billboard = class extends import_maptalks.BaseObject {
|
|
|
2751
2750
|
});
|
|
2752
2751
|
const z = layer.altitudeToVector3(altitude, altitude).x;
|
|
2753
2752
|
const position = layer.coordinateToVector3(coordinate, z);
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2753
|
+
import_lodash14.default.set(this.properties, "default.position", position);
|
|
2754
|
+
import_lodash14.default.set(this.properties, "default.altitude", altitude);
|
|
2755
|
+
import_lodash14.default.set(this.properties, "default.scale", scale3);
|
|
2757
2756
|
this.getObject3d().position.copy(position);
|
|
2758
2757
|
}
|
|
2759
2758
|
setLineHeight(altitude) {
|
|
@@ -2769,7 +2768,7 @@ var Billboard = class extends import_maptalks.BaseObject {
|
|
|
2769
2768
|
// src/IndoorMap/object3d/SpriteMarker.ts
|
|
2770
2769
|
var import_maptalks2 = require("maptalks.three");
|
|
2771
2770
|
var import_three2 = require("three");
|
|
2772
|
-
var
|
|
2771
|
+
var import_lodash15 = __toESM(require("lodash"));
|
|
2773
2772
|
var DEFAULT_SCALE = 0.05;
|
|
2774
2773
|
var DEFAULT_ALTITUDE = 0;
|
|
2775
2774
|
var DEFAULT_ALPHATEST = 0.3;
|
|
@@ -2800,7 +2799,7 @@ var SpriteMarker = class extends import_maptalks2.BaseObject {
|
|
|
2800
2799
|
this.properties = { ...properties };
|
|
2801
2800
|
const modifiedAltitude = altitude + 2;
|
|
2802
2801
|
this.#default = { options: { scale: scale3, altitude: modifiedAltitude }, material };
|
|
2803
|
-
this.#highlight =
|
|
2802
|
+
this.#highlight = import_lodash15.default.merge({}, DEFAULT_OPTIONS.highlight, highlight);
|
|
2804
2803
|
if (material && material instanceof import_three2.SpriteMaterial)
|
|
2805
2804
|
material.alphaTest = alphaTest;
|
|
2806
2805
|
const sprite = new import_three2.Sprite(material);
|
|
@@ -2809,7 +2808,7 @@ var SpriteMarker = class extends import_maptalks2.BaseObject {
|
|
|
2809
2808
|
obj3d.add(sprite);
|
|
2810
2809
|
const z = layer.altitudeToVector3(modifiedAltitude, modifiedAltitude).x;
|
|
2811
2810
|
const position = layer.coordinateToVector3(coordinate, z);
|
|
2812
|
-
|
|
2811
|
+
import_lodash15.default.set(this.properties, "default.position", position);
|
|
2813
2812
|
this.getObject3d().position.copy(position);
|
|
2814
2813
|
}
|
|
2815
2814
|
// Different objects need to implement their own methods
|
|
@@ -2951,14 +2950,14 @@ var NavigationPath = class extends import_maptalks3.BaseObject {
|
|
|
2951
2950
|
|
|
2952
2951
|
// src/IndoorMap/utils/geometry.ts
|
|
2953
2952
|
var import_center10 = __toESM(require("@turf/center"));
|
|
2954
|
-
var
|
|
2953
|
+
var import_lodash16 = __toESM(require("lodash"));
|
|
2955
2954
|
var import_line_offset = __toESM(require("@turf/line-offset"));
|
|
2956
2955
|
var getCenterFromGeometry = (geometry) => {
|
|
2957
2956
|
try {
|
|
2958
2957
|
const { type = null, coordinates = null } = geometry;
|
|
2959
2958
|
if (!type || !coordinates) return null;
|
|
2960
2959
|
const centerPoint = (0, import_center10.default)(geometry);
|
|
2961
|
-
return
|
|
2960
|
+
return import_lodash16.default.get(centerPoint, "geometry.coordinates");
|
|
2962
2961
|
} catch (error) {
|
|
2963
2962
|
return null;
|
|
2964
2963
|
}
|
|
@@ -3109,7 +3108,7 @@ var createWaterFixture = (feature2, style, options = {}) => {
|
|
|
3109
3108
|
const { geometry, properties } = feature2;
|
|
3110
3109
|
const { allowOverride, inheritFillColorToLine, zIndex } = options;
|
|
3111
3110
|
const symbolStyle = { ...style };
|
|
3112
|
-
if (allowOverride)
|
|
3111
|
+
if (allowOverride) import_lodash17.default.merge(symbolStyle, properties.style);
|
|
3113
3112
|
if (inheritFillColorToLine) symbolStyle.lineColor = symbolStyle.polygonFill;
|
|
3114
3113
|
return new GeometryType[geometry.type](geometry.coordinates, {
|
|
3115
3114
|
properties: {
|
|
@@ -3125,7 +3124,7 @@ var createVegetationFixture = (feature2, style, options = {}) => {
|
|
|
3125
3124
|
const { geometry, properties } = feature2;
|
|
3126
3125
|
const { allowOverride, inheritFillColorToLine, zIndex } = options;
|
|
3127
3126
|
const symbolStyle = { ...style };
|
|
3128
|
-
if (allowOverride)
|
|
3127
|
+
if (allowOverride) import_lodash17.default.merge(symbolStyle, properties.style);
|
|
3129
3128
|
if (inheritFillColorToLine) symbolStyle.lineColor = symbolStyle.polygonFill;
|
|
3130
3129
|
return new GeometryType[geometry.type](geometry.coordinates, {
|
|
3131
3130
|
properties: {
|
|
@@ -3142,8 +3141,8 @@ var createObstructionalFixture = (feature2, style = {}, options = {}) => {
|
|
|
3142
3141
|
const { model3d } = properties;
|
|
3143
3142
|
const { allowOverride, inheritFillColorToLine, zIndex } = options;
|
|
3144
3143
|
const symbolStyle = { ...style };
|
|
3145
|
-
if (!
|
|
3146
|
-
if (allowOverride)
|
|
3144
|
+
if (!import_lodash17.default.isEmpty(model3d)) return;
|
|
3145
|
+
if (allowOverride) import_lodash17.default.merge(symbolStyle, properties.style);
|
|
3147
3146
|
if (inheritFillColorToLine) symbolStyle.lineColor = symbolStyle.polygonFill;
|
|
3148
3147
|
if (geometry.type === "LineString") {
|
|
3149
3148
|
const polygon2 = createPolygonFromLineString(geometry);
|
|
@@ -3213,7 +3212,7 @@ var createPrincipalOpening = (feature2, style, options = {}) => {
|
|
|
3213
3212
|
const { geometry, properties } = feature2;
|
|
3214
3213
|
const { allowOverride, zIndex } = options;
|
|
3215
3214
|
const symbolStyle = { ...style };
|
|
3216
|
-
if (allowOverride)
|
|
3215
|
+
if (allowOverride) import_lodash17.default.merge(symbolStyle, properties.style);
|
|
3217
3216
|
try {
|
|
3218
3217
|
return new import_maptalks4.LineString(geometry.coordinates, {
|
|
3219
3218
|
properties: {
|
|
@@ -3230,7 +3229,7 @@ var createEmergencyExitOpening = (feature2, style, options = {}) => {
|
|
|
3230
3229
|
const { geometry, properties } = feature2;
|
|
3231
3230
|
const { allowOverride, zIndex } = options;
|
|
3232
3231
|
const symbolStyle = { ...style };
|
|
3233
|
-
if (allowOverride)
|
|
3232
|
+
if (allowOverride) import_lodash17.default.merge(symbolStyle, properties.style);
|
|
3234
3233
|
try {
|
|
3235
3234
|
return new import_maptalks4.LineString(geometry.coordinates, {
|
|
3236
3235
|
properties: {
|
|
@@ -3247,7 +3246,7 @@ var createPedestrianOpening = (feature2, style, options = {}) => {
|
|
|
3247
3246
|
const { geometry, properties, id } = feature2;
|
|
3248
3247
|
const { allowOverride, zIndex } = options;
|
|
3249
3248
|
const symbolStyle = { ...style };
|
|
3250
|
-
if (allowOverride)
|
|
3249
|
+
if (allowOverride) import_lodash17.default.merge(symbolStyle, properties.style);
|
|
3251
3250
|
try {
|
|
3252
3251
|
return new import_maptalks4.LineString(geometry.coordinates, {
|
|
3253
3252
|
properties: {
|
|
@@ -3285,9 +3284,9 @@ var create3DMarker = (coordinates, options, material, threeLayer, markerProperti
|
|
|
3285
3284
|
};
|
|
3286
3285
|
var getExtrudeConfigByFeature = (baseExtrudeConfig, feature2 = {}) => {
|
|
3287
3286
|
const { feature_type: featureType } = feature2;
|
|
3288
|
-
const featureExtrudeConfig =
|
|
3289
|
-
const featureCategory =
|
|
3290
|
-
const baseFeatureExtrudeConfig =
|
|
3287
|
+
const featureExtrudeConfig = import_lodash17.default.get(feature2, "properties.extrude");
|
|
3288
|
+
const featureCategory = import_lodash17.default.get(feature2, "properties.category");
|
|
3289
|
+
const baseFeatureExtrudeConfig = import_lodash17.default.get(
|
|
3291
3290
|
baseExtrudeConfig,
|
|
3292
3291
|
`${featureType}.${featureCategory || featureType}`
|
|
3293
3292
|
);
|
|
@@ -3345,50 +3344,50 @@ var createStyledUIMarkerElement = ({
|
|
|
3345
3344
|
var styledFeatureGenerator = (mapTheme) => {
|
|
3346
3345
|
const getElementSymbol = (key) => {
|
|
3347
3346
|
const [featureType] = key.split(".");
|
|
3348
|
-
const featureTypeTheme =
|
|
3347
|
+
const featureTypeTheme = import_lodash17.default.get(mapTheme, `${featureType}.geometry.symbol`);
|
|
3349
3348
|
if (featureType === key) return featureTypeTheme;
|
|
3350
|
-
const categoryTheme =
|
|
3351
|
-
return
|
|
3349
|
+
const categoryTheme = import_lodash17.default.get(mapTheme, `${key}.geometry.symbol`);
|
|
3350
|
+
return import_lodash17.default.merge({}, featureTypeTheme, categoryTheme);
|
|
3352
3351
|
};
|
|
3353
3352
|
const getLabelSymbol = (key) => {
|
|
3354
3353
|
const [featureType] = key.split(".");
|
|
3355
|
-
const featureTypeTheme =
|
|
3356
|
-
const categoryTheme =
|
|
3357
|
-
const mergedSymbol =
|
|
3358
|
-
let symbols =
|
|
3354
|
+
const featureTypeTheme = import_lodash17.default.get(mapTheme, `${featureType}.label`);
|
|
3355
|
+
const categoryTheme = import_lodash17.default.get(mapTheme, `${key}.label`);
|
|
3356
|
+
const mergedSymbol = import_lodash17.default.merge({}, featureTypeTheme, categoryTheme);
|
|
3357
|
+
let symbols = import_lodash17.default.values(import_lodash17.default.map(mergedSymbol, "symbol"));
|
|
3359
3358
|
const markerIndexToMove = symbols.findIndex(
|
|
3360
3359
|
({ elementType }) => elementType === "label.marker"
|
|
3361
3360
|
);
|
|
3362
3361
|
if (markerIndexToMove >= 0) {
|
|
3363
|
-
const markerSymbolToMove =
|
|
3362
|
+
const markerSymbolToMove = import_lodash17.default.pullAt(symbols, markerIndexToMove)[0];
|
|
3364
3363
|
symbols.push(markerSymbolToMove);
|
|
3365
3364
|
}
|
|
3366
3365
|
return symbols;
|
|
3367
3366
|
};
|
|
3368
3367
|
const getUIMarkerSymbol = (key) => {
|
|
3369
3368
|
const [featureType] = key.split(".");
|
|
3370
|
-
const featureTypeTheme =
|
|
3371
|
-
const categoryTheme =
|
|
3372
|
-
const mergedSymbol =
|
|
3373
|
-
const symbol =
|
|
3369
|
+
const featureTypeTheme = import_lodash17.default.get(mapTheme, `${featureType}.ui.marker`);
|
|
3370
|
+
const categoryTheme = import_lodash17.default.get(mapTheme, `${key}.ui.marker`);
|
|
3371
|
+
const mergedSymbol = import_lodash17.default.merge({}, featureTypeTheme, categoryTheme);
|
|
3372
|
+
const symbol = import_lodash17.default.get(mergedSymbol, "symbol");
|
|
3374
3373
|
return symbol;
|
|
3375
3374
|
};
|
|
3376
3375
|
const getUIMarkerOptions = (key) => {
|
|
3377
3376
|
const [featureType] = key.split(".");
|
|
3378
|
-
const featureTypeTheme =
|
|
3379
|
-
const categoryTheme =
|
|
3380
|
-
const mergedSymbol =
|
|
3381
|
-
const options =
|
|
3377
|
+
const featureTypeTheme = import_lodash17.default.get(mapTheme, `${featureType}.ui.marker`);
|
|
3378
|
+
const categoryTheme = import_lodash17.default.get(mapTheme, `${key}.ui.marker`);
|
|
3379
|
+
const mergedSymbol = import_lodash17.default.merge({}, featureTypeTheme, categoryTheme);
|
|
3380
|
+
const options = import_lodash17.default.get(mergedSymbol, "options");
|
|
3382
3381
|
return options;
|
|
3383
3382
|
};
|
|
3384
3383
|
const getLabelOptions = (key) => {
|
|
3385
3384
|
const [featureType] = key.split(".");
|
|
3386
|
-
const featureTypeSymbol =
|
|
3387
|
-
const categorySymbol =
|
|
3388
|
-
const mergedSymbol =
|
|
3389
|
-
return
|
|
3385
|
+
const featureTypeSymbol = import_lodash17.default.get(mapTheme, `${featureType}.label`);
|
|
3386
|
+
const categorySymbol = import_lodash17.default.get(mapTheme, `${key}.label`);
|
|
3387
|
+
const mergedSymbol = import_lodash17.default.merge({}, featureTypeSymbol, categorySymbol);
|
|
3388
|
+
return import_lodash17.default.reduce(
|
|
3390
3389
|
mergedSymbol,
|
|
3391
|
-
(acc, symbol) => ({ ...acc, ...
|
|
3390
|
+
(acc, symbol) => ({ ...acc, ...import_lodash17.default.get(symbol, "options", {}) }),
|
|
3392
3391
|
{}
|
|
3393
3392
|
);
|
|
3394
3393
|
};
|
|
@@ -3403,13 +3402,13 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
3403
3402
|
};
|
|
3404
3403
|
const generateSpriteHighlightMarkerOption = () => {
|
|
3405
3404
|
return SPRITE_HIGHLIGHT_MARKER_FEATURE.reduce((acc, featCate) => {
|
|
3406
|
-
const categoryKey =
|
|
3405
|
+
const categoryKey = import_lodash17.default.last(featCate.split("-"));
|
|
3407
3406
|
const defaultLabelSymbol = getLabelSymbol(categoryKey);
|
|
3408
3407
|
const highlightLabelSymbol = getLabelSymbol(featCate);
|
|
3409
3408
|
const [defaultBase, defaultIcon] = defaultLabelSymbol;
|
|
3410
3409
|
const [highlightBase, highlightIcon] = highlightLabelSymbol;
|
|
3411
|
-
const base =
|
|
3412
|
-
const icon =
|
|
3410
|
+
const base = import_lodash17.default.merge({}, defaultBase, highlightBase);
|
|
3411
|
+
const icon = import_lodash17.default.merge({}, defaultIcon, highlightIcon);
|
|
3413
3412
|
const material = createSpriteMaterialByLabelSymbol([base, icon]);
|
|
3414
3413
|
const options = getLabelOptions(featCate);
|
|
3415
3414
|
return { ...acc, [featCate]: { material, options } };
|
|
@@ -3419,22 +3418,22 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
3419
3418
|
const spriteHighlightMarkerOptionObj = generateSpriteHighlightMarkerOption();
|
|
3420
3419
|
const getElementOptions = (key) => {
|
|
3421
3420
|
const [featureType] = key.split(".");
|
|
3422
|
-
const featureTypeOptions =
|
|
3421
|
+
const featureTypeOptions = import_lodash17.default.get(
|
|
3423
3422
|
mapTheme,
|
|
3424
3423
|
`${featureType}.geometry.options`
|
|
3425
3424
|
);
|
|
3426
|
-
const categoryOptions =
|
|
3427
|
-
return
|
|
3425
|
+
const categoryOptions = import_lodash17.default.get(mapTheme, `${key}.geometry.options`);
|
|
3426
|
+
return import_lodash17.default.merge({}, featureTypeOptions, categoryOptions);
|
|
3428
3427
|
};
|
|
3429
3428
|
const createOccupantMarker = (feature2, locatedFeature, mapConfig) => {
|
|
3430
3429
|
const { textMarkerType, featureExtrudeConfig } = getFeatureMarkerConfig(
|
|
3431
3430
|
feature2,
|
|
3432
3431
|
mapConfig
|
|
3433
3432
|
);
|
|
3434
|
-
const markerHeight =
|
|
3433
|
+
const markerHeight = import_lodash17.default.get(featureExtrudeConfig, "height", 0);
|
|
3435
3434
|
const { properties, id, feature_type } = feature2;
|
|
3436
3435
|
if (!properties.anchor) return;
|
|
3437
|
-
const mainLocationId =
|
|
3436
|
+
const mainLocationId = import_lodash17.default.get(properties, "unit.id") || import_lodash17.default.get(properties, "kiosk.id");
|
|
3438
3437
|
const isMainLocationFeature = mainLocationId === locatedFeature?.id;
|
|
3439
3438
|
const { geometry: mainLocationGeometry } = properties?.anchor;
|
|
3440
3439
|
const geometry = isMainLocationFeature ? mainLocationGeometry : (0, import_center11.default)(locatedFeature)?.geometry;
|
|
@@ -3444,7 +3443,7 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
3444
3443
|
category: properties.category,
|
|
3445
3444
|
altitude: getAltitude(properties)
|
|
3446
3445
|
};
|
|
3447
|
-
const occupantName =
|
|
3446
|
+
const occupantName = import_lodash17.default.isEmpty(properties.short_name) ? properties.name : properties.short_name;
|
|
3448
3447
|
if (locatedFeature) {
|
|
3449
3448
|
const { feature_type: feature_type2, properties: properties2 } = locatedFeature;
|
|
3450
3449
|
const { category } = properties2;
|
|
@@ -3458,21 +3457,21 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
3458
3457
|
}
|
|
3459
3458
|
return requestedType;
|
|
3460
3459
|
};
|
|
3461
|
-
const logoUrl =
|
|
3462
|
-
const requestedRenderType =
|
|
3460
|
+
const logoUrl = import_lodash17.default.get(properties, "logo.url");
|
|
3461
|
+
const requestedRenderType = import_lodash17.default.get(properties, "render_type", "Name");
|
|
3463
3462
|
const renderType = getValidatedRenderType(requestedRenderType, logoUrl);
|
|
3464
3463
|
if (renderType === "Label") return null;
|
|
3465
3464
|
const renderPriority = properties.render_priority || 3;
|
|
3466
|
-
const labelSymbol = getLabelSymbol(`occupant-${
|
|
3467
|
-
const markerSymbol =
|
|
3468
|
-
const coordinates =
|
|
3465
|
+
const labelSymbol = getLabelSymbol(`occupant-${import_lodash17.default.toLower(renderType)}`);
|
|
3466
|
+
const markerSymbol = import_lodash17.default.last(labelSymbol);
|
|
3467
|
+
const coordinates = import_lodash17.default.get(geometry, "coordinates");
|
|
3469
3468
|
const priorityLabelSymbol = getLabelSymbol(
|
|
3470
|
-
`occupant-${
|
|
3469
|
+
`occupant-${import_lodash17.default.toLower(renderType)}-${renderPriority}`
|
|
3471
3470
|
);
|
|
3472
|
-
const priorityMarkerSymbol =
|
|
3471
|
+
const priorityMarkerSymbol = import_lodash17.default.last(priorityLabelSymbol) || {};
|
|
3473
3472
|
switch (renderType) {
|
|
3474
3473
|
case "Logo":
|
|
3475
|
-
|
|
3474
|
+
import_lodash17.default.set(priorityMarkerSymbol, "markerFile", logoUrl);
|
|
3476
3475
|
return new import_maptalks4.Marker(coordinates, {
|
|
3477
3476
|
properties: {
|
|
3478
3477
|
altitude: getAltitude(properties) + markerHeight,
|
|
@@ -3533,13 +3532,13 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
3533
3532
|
});
|
|
3534
3533
|
}
|
|
3535
3534
|
const uiMarkerSymbol = getUIMarkerSymbol(
|
|
3536
|
-
`occupant-${
|
|
3535
|
+
`occupant-${import_lodash17.default.toLower(renderType)}`
|
|
3537
3536
|
);
|
|
3538
3537
|
const uiMarkerPrioritySymbol = getUIMarkerSymbol(
|
|
3539
|
-
`occupant-${
|
|
3538
|
+
`occupant-${import_lodash17.default.toLower(renderType)}-${renderPriority}`
|
|
3540
3539
|
);
|
|
3541
3540
|
const uiMarkerPriorityOptions = getUIMarkerOptions(
|
|
3542
|
-
`occupant-${
|
|
3541
|
+
`occupant-${import_lodash17.default.toLower(renderType)}-${renderPriority}`
|
|
3543
3542
|
);
|
|
3544
3543
|
const style = { ...uiMarkerSymbol, ...uiMarkerPrioritySymbol };
|
|
3545
3544
|
return new import_maptalks4.ui.UIMarker(coordinates, {
|
|
@@ -3561,7 +3560,7 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
3561
3560
|
const { category, ordinal, style = {} } = properties;
|
|
3562
3561
|
const elementStyle = getElementSymbol(`${feature_type}.${category}`);
|
|
3563
3562
|
const { allowOverride } = getElementOptions(`${feature_type}.${category}`);
|
|
3564
|
-
if (allowOverride)
|
|
3563
|
+
if (allowOverride) import_lodash17.default.merge(elementStyle, style);
|
|
3565
3564
|
const { polygonFill: color } = elementStyle;
|
|
3566
3565
|
const featureProperty = {
|
|
3567
3566
|
id,
|
|
@@ -3650,9 +3649,9 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
3650
3649
|
feature2,
|
|
3651
3650
|
mapConfig
|
|
3652
3651
|
);
|
|
3653
|
-
const markerHeight =
|
|
3652
|
+
const markerHeight = import_lodash17.default.get(featureExtrudeConfig, "height");
|
|
3654
3653
|
const { id, properties } = feature2;
|
|
3655
|
-
const geometry =
|
|
3654
|
+
const geometry = import_lodash17.default.get(feature2, "geometry") || import_lodash17.default.get(feature2, "properties.anchor.geometry");
|
|
3656
3655
|
const coordinates = getCenterFromGeometry(geometry);
|
|
3657
3656
|
const symbol = getElementSymbol("pin-marker");
|
|
3658
3657
|
try {
|
|
@@ -3672,10 +3671,10 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
3672
3671
|
feature2,
|
|
3673
3672
|
mapConfig
|
|
3674
3673
|
);
|
|
3675
|
-
const markerHeight =
|
|
3674
|
+
const markerHeight = import_lodash17.default.get(featureExtrudeConfig, "height", 0);
|
|
3676
3675
|
const { properties, id } = feature2;
|
|
3677
3676
|
const { geometry } = properties.anchor;
|
|
3678
|
-
const logoUrl =
|
|
3677
|
+
const logoUrl = import_lodash17.default.get(properties, "logo.url");
|
|
3679
3678
|
const coordinates = getCenterFromGeometry(geometry);
|
|
3680
3679
|
const [markerBase, markerLabel] = getLabelSymbol(
|
|
3681
3680
|
"highlighted-logo-marker"
|
|
@@ -3745,7 +3744,7 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
3745
3744
|
feature2,
|
|
3746
3745
|
mapConfig
|
|
3747
3746
|
);
|
|
3748
|
-
const markerHeight =
|
|
3747
|
+
const markerHeight = import_lodash17.default.get(featureExtrudeConfig, "height");
|
|
3749
3748
|
const { id, feature_type, properties } = feature2;
|
|
3750
3749
|
if (!properties.anchor) return;
|
|
3751
3750
|
const markerProperties = {
|
|
@@ -3755,8 +3754,8 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
3755
3754
|
altitude: getAltitude(properties) + markerHeight
|
|
3756
3755
|
};
|
|
3757
3756
|
const { geometry } = properties?.anchor;
|
|
3758
|
-
const coordinates =
|
|
3759
|
-
const logoUrl =
|
|
3757
|
+
const coordinates = import_lodash17.default.get(geometry, "coordinates");
|
|
3758
|
+
const logoUrl = import_lodash17.default.get(properties, "logo.url");
|
|
3760
3759
|
if (markerSymbol) {
|
|
3761
3760
|
return new import_maptalks4.Marker(coordinates, {
|
|
3762
3761
|
properties: markerProperties,
|
|
@@ -3771,8 +3770,8 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
3771
3770
|
});
|
|
3772
3771
|
}
|
|
3773
3772
|
const labelSymbol = getLabelSymbol("highlight-occupant-logo");
|
|
3774
|
-
const priorityMarkerSymbol =
|
|
3775
|
-
|
|
3773
|
+
const priorityMarkerSymbol = import_lodash17.default.last(labelSymbol) || {};
|
|
3774
|
+
import_lodash17.default.set(priorityMarkerSymbol, "markerFile", logoUrl);
|
|
3776
3775
|
return new import_maptalks4.Marker(coordinates, {
|
|
3777
3776
|
properties: markerProperties,
|
|
3778
3777
|
symbol: labelSymbol
|
|
@@ -3780,14 +3779,14 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
3780
3779
|
},
|
|
3781
3780
|
createHighlight2DAmenityMarkerFrom3DMarker: (feature2, mapConfig) => {
|
|
3782
3781
|
const { coordinates, units, kiosk } = feature2;
|
|
3783
|
-
const amenityLocatedUnit =
|
|
3782
|
+
const amenityLocatedUnit = import_lodash17.default.first(units);
|
|
3784
3783
|
const unitConfig = getExtrudeConfigByFeature(
|
|
3785
3784
|
mapConfig,
|
|
3786
3785
|
amenityLocatedUnit
|
|
3787
3786
|
);
|
|
3788
|
-
const unitHeight =
|
|
3787
|
+
const unitHeight = import_lodash17.default.get(unitConfig, "height", 0);
|
|
3789
3788
|
const kioskConfig = getExtrudeConfigByFeature(mapConfig, kiosk);
|
|
3790
|
-
const kioskHeight =
|
|
3789
|
+
const kioskHeight = import_lodash17.default.get(kioskConfig, "height", 0);
|
|
3791
3790
|
const markerHeight = unitHeight + kioskHeight;
|
|
3792
3791
|
const symbol = getElementSymbol("highlight-amenity-marker");
|
|
3793
3792
|
return new import_maptalks4.Marker(coordinates, {
|
|
@@ -3863,7 +3862,7 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
3863
3862
|
}
|
|
3864
3863
|
},
|
|
3865
3864
|
createLineStringFromGeometries: (geometries) => {
|
|
3866
|
-
const mergedCoordinates = (0,
|
|
3865
|
+
const mergedCoordinates = (0, import_lodash17.default)(geometries).map((geometry) => {
|
|
3867
3866
|
switch (geometry.type) {
|
|
3868
3867
|
case "Point":
|
|
3869
3868
|
return [
|
|
@@ -3972,29 +3971,29 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
3972
3971
|
create3DAmenityMarker: (feature2, threeLayer, config) => {
|
|
3973
3972
|
const { geometry, properties, feature_type, id } = feature2;
|
|
3974
3973
|
const { category, units, kiosk, is_clickable } = properties;
|
|
3975
|
-
const amenityLocatedUnit =
|
|
3976
|
-
const isLocatedUnitModel3dAvailable = !
|
|
3974
|
+
const amenityLocatedUnit = import_lodash17.default.first(units);
|
|
3975
|
+
const isLocatedUnitModel3dAvailable = !import_lodash17.default.isEmpty(
|
|
3977
3976
|
amenityLocatedUnit?.properties?.model3d
|
|
3978
3977
|
);
|
|
3979
|
-
const isLocatedKioskModel3dAvailable = !
|
|
3978
|
+
const isLocatedKioskModel3dAvailable = !import_lodash17.default.isEmpty(
|
|
3980
3979
|
kiosk?.properties?.model3d
|
|
3981
3980
|
);
|
|
3982
3981
|
const unitConfig = getExtrudeConfigByFeature(config, amenityLocatedUnit);
|
|
3983
|
-
const unitHeight = isLocatedUnitModel3dAvailable ? 0 :
|
|
3982
|
+
const unitHeight = isLocatedUnitModel3dAvailable ? 0 : import_lodash17.default.get(unitConfig, "height", 0);
|
|
3984
3983
|
const kioskConfig = getExtrudeConfigByFeature(config, kiosk);
|
|
3985
|
-
const kioskHeight = isLocatedKioskModel3dAvailable ? 0 :
|
|
3986
|
-
const coordinates =
|
|
3984
|
+
const kioskHeight = isLocatedKioskModel3dAvailable ? 0 : import_lodash17.default.get(kioskConfig, "height", 0);
|
|
3985
|
+
const coordinates = import_lodash17.default.get(geometry, "coordinates");
|
|
3987
3986
|
const markerProperties = {
|
|
3988
3987
|
...properties,
|
|
3989
3988
|
coordinates,
|
|
3990
3989
|
id,
|
|
3991
3990
|
feature_type
|
|
3992
3991
|
};
|
|
3993
|
-
const material =
|
|
3992
|
+
const material = import_lodash17.default.get(
|
|
3994
3993
|
spriteMarkerMaterialObj,
|
|
3995
3994
|
`${feature_type}.${category}`
|
|
3996
3995
|
);
|
|
3997
|
-
const highlightOptions =
|
|
3996
|
+
const highlightOptions = import_lodash17.default.get(
|
|
3998
3997
|
spriteHighlightMarkerOptionObj,
|
|
3999
3998
|
`${PREFIX_HIGHLIGHTED_SYMBOL_KEY}-${feature_type}.${category}`
|
|
4000
3999
|
);
|
|
@@ -4017,24 +4016,24 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
4017
4016
|
const { category, unit, kiosk } = properties;
|
|
4018
4017
|
const amenityLocation = kiosk || unit;
|
|
4019
4018
|
const locationConfig = getExtrudeConfigByFeature(config, amenityLocation);
|
|
4020
|
-
const coordinates =
|
|
4019
|
+
const coordinates = import_lodash17.default.get(geometry, "coordinates");
|
|
4021
4020
|
const markerProperties = {
|
|
4022
4021
|
...properties,
|
|
4023
4022
|
coordinates,
|
|
4024
4023
|
id,
|
|
4025
4024
|
feature_type
|
|
4026
4025
|
};
|
|
4027
|
-
const material =
|
|
4026
|
+
const material = import_lodash17.default.get(
|
|
4028
4027
|
spriteMarkerMaterialObj,
|
|
4029
4028
|
`${feature_type}.${category}`
|
|
4030
4029
|
);
|
|
4031
|
-
const highlightOptions =
|
|
4030
|
+
const highlightOptions = import_lodash17.default.get(
|
|
4032
4031
|
spriteHighlightMarkerOptionObj,
|
|
4033
4032
|
`${PREFIX_HIGHLIGHTED_SYMBOL_KEY}-${feature_type}.${category}`
|
|
4034
4033
|
);
|
|
4035
4034
|
const options = {
|
|
4036
4035
|
scale: 0.05,
|
|
4037
|
-
altitude:
|
|
4036
|
+
altitude: import_lodash17.default.get(locationConfig, "height", 0),
|
|
4038
4037
|
highlight: highlightOptions
|
|
4039
4038
|
};
|
|
4040
4039
|
return create3DMarker(
|
|
@@ -4050,24 +4049,24 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
4050
4049
|
const { category, unit, kiosk } = properties;
|
|
4051
4050
|
const amenityLocation = kiosk || unit;
|
|
4052
4051
|
const locationConfig = getExtrudeConfigByFeature(config, amenityLocation);
|
|
4053
|
-
const coordinates =
|
|
4052
|
+
const coordinates = import_lodash17.default.get(geometry, "coordinates");
|
|
4054
4053
|
const markerProperties = {
|
|
4055
4054
|
...properties,
|
|
4056
4055
|
coordinates,
|
|
4057
4056
|
id,
|
|
4058
4057
|
feature_type
|
|
4059
4058
|
};
|
|
4060
|
-
const material =
|
|
4059
|
+
const material = import_lodash17.default.get(
|
|
4061
4060
|
spriteMarkerMaterialObj,
|
|
4062
4061
|
`${feature_type}.${category}`
|
|
4063
4062
|
);
|
|
4064
|
-
const highlightOptions =
|
|
4063
|
+
const highlightOptions = import_lodash17.default.get(
|
|
4065
4064
|
spriteHighlightMarkerOptionObj,
|
|
4066
4065
|
`${PREFIX_HIGHLIGHTED_SYMBOL_KEY}-${feature_type}.${category}`
|
|
4067
4066
|
);
|
|
4068
4067
|
const options = {
|
|
4069
4068
|
scale: 0.05,
|
|
4070
|
-
altitude:
|
|
4069
|
+
altitude: import_lodash17.default.get(locationConfig, "height", 0),
|
|
4071
4070
|
highlight: highlightOptions
|
|
4072
4071
|
};
|
|
4073
4072
|
return create3DMarker(
|
|
@@ -4079,13 +4078,13 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
4079
4078
|
);
|
|
4080
4079
|
},
|
|
4081
4080
|
createExtrudedUnit: (unit, threeLayer, options) => {
|
|
4082
|
-
const extrudeHeight =
|
|
4081
|
+
const extrudeHeight = import_lodash17.default.get(options, "height");
|
|
4083
4082
|
if (!extrudeHeight) return;
|
|
4084
4083
|
const unitProperty = getFeatureProperties(unit);
|
|
4085
4084
|
const options3d = {
|
|
4086
4085
|
// TODO: Move to extrude config later
|
|
4087
4086
|
offset: -0.1,
|
|
4088
|
-
altitude:
|
|
4087
|
+
altitude: import_lodash17.default.get(options, "altitude", 0)
|
|
4089
4088
|
};
|
|
4090
4089
|
const color = unitProperty.defaultColor;
|
|
4091
4090
|
if (color === "transparent") return;
|
|
@@ -4128,14 +4127,14 @@ var EXCEPT_AMENITY_LOCATION_CATEGORIES = [
|
|
|
4128
4127
|
"unspecified"
|
|
4129
4128
|
];
|
|
4130
4129
|
var getLocationByAmenity = (feature2) => {
|
|
4131
|
-
const unit =
|
|
4132
|
-
const unitCategory =
|
|
4130
|
+
const unit = import_lodash17.default.get(feature2, "properties.units[0]", null);
|
|
4131
|
+
const unitCategory = import_lodash17.default.get(unit, "properties.category");
|
|
4133
4132
|
if (!unit) return feature2.id;
|
|
4134
4133
|
return EXCEPT_AMENITY_LOCATION_CATEGORIES.includes(unitCategory) ? feature2 : unit;
|
|
4135
4134
|
};
|
|
4136
4135
|
var getLocationByOccupant = (feature2) => {
|
|
4137
|
-
const kiosk =
|
|
4138
|
-
const unit =
|
|
4136
|
+
const kiosk = import_lodash17.default.get(feature2, "properties.kiosk", null);
|
|
4137
|
+
const unit = import_lodash17.default.get(feature2, "properties.anchor.properties.unit", null);
|
|
4139
4138
|
return kiosk || unit;
|
|
4140
4139
|
};
|
|
4141
4140
|
var getLocationIdByFeature = (feature2) => {
|
|
@@ -4163,10 +4162,10 @@ var getFeatureByLocationId = (id, features = []) => {
|
|
|
4163
4162
|
});
|
|
4164
4163
|
};
|
|
4165
4164
|
var isClickableFeature = (feature2) => {
|
|
4166
|
-
const isClickable =
|
|
4165
|
+
const isClickable = import_lodash17.default.get(feature2, "properties.is_clickable");
|
|
4167
4166
|
switch (feature2?.feature_type) {
|
|
4168
4167
|
case "amenity":
|
|
4169
|
-
return
|
|
4168
|
+
return import_lodash17.default.isNull(isClickable) ? true : isClickable;
|
|
4170
4169
|
case "occupant":
|
|
4171
4170
|
return true;
|
|
4172
4171
|
default:
|
|
@@ -4184,15 +4183,15 @@ var getLocationByFeature = (feature2) => {
|
|
|
4184
4183
|
}
|
|
4185
4184
|
};
|
|
4186
4185
|
var getRelatedLocationsByOccupant = (feature2) => {
|
|
4187
|
-
const kiosks =
|
|
4188
|
-
const units =
|
|
4186
|
+
const kiosks = import_lodash17.default.get(feature2, "properties.kiosks", []);
|
|
4187
|
+
const units = import_lodash17.default.get(feature2, "properties.units", []);
|
|
4189
4188
|
return [...kiosks, ...units];
|
|
4190
4189
|
};
|
|
4191
4190
|
var getRelatedLocationsByAmenity = (feature2) => {
|
|
4192
|
-
const units =
|
|
4191
|
+
const units = import_lodash17.default.get(feature2, "properties.units", []);
|
|
4193
4192
|
if (units.length === 0) return [feature2];
|
|
4194
4193
|
return units.filter((unit) => {
|
|
4195
|
-
const unitCategory =
|
|
4194
|
+
const unitCategory = import_lodash17.default.get(unit, "properties.category");
|
|
4196
4195
|
return !EXCEPT_AMENITY_LOCATION_CATEGORIES.includes(unitCategory);
|
|
4197
4196
|
});
|
|
4198
4197
|
};
|
|
@@ -4218,8 +4217,8 @@ var getRelatedLocationsByFeature = (feature2) => {
|
|
|
4218
4217
|
};
|
|
4219
4218
|
var getOrdinalByLocationId = (locationId, feature2) => {
|
|
4220
4219
|
if (!feature2) return null;
|
|
4221
|
-
const mainUnit =
|
|
4222
|
-
const mainKiosk =
|
|
4220
|
+
const mainUnit = import_lodash17.default.get(feature2, "properties.unit");
|
|
4221
|
+
const mainKiosk = import_lodash17.default.get(feature2, "properties.kiosk");
|
|
4223
4222
|
const relatedLocations = getRelatedLocationsByFeature(feature2);
|
|
4224
4223
|
const allLocations = [mainUnit, mainKiosk, ...relatedLocations].filter(
|
|
4225
4224
|
Boolean
|
|
@@ -4227,7 +4226,7 @@ var getOrdinalByLocationId = (locationId, feature2) => {
|
|
|
4227
4226
|
const targetLocation = allLocations.find(
|
|
4228
4227
|
(location) => location.id === locationId
|
|
4229
4228
|
);
|
|
4230
|
-
return targetLocation ?
|
|
4229
|
+
return targetLocation ? import_lodash17.default.get(targetLocation, "properties.level.properties.ordinal") || import_lodash17.default.get(targetLocation, "properties.ordinal") : null;
|
|
4231
4230
|
};
|
|
4232
4231
|
|
|
4233
4232
|
// src/IndoorMap/utils/math.ts
|
|
@@ -4312,7 +4311,7 @@ var CameraManager = class {
|
|
|
4312
4311
|
};
|
|
4313
4312
|
|
|
4314
4313
|
// src/IndoorMap/renderer/RendererManager.ts
|
|
4315
|
-
var
|
|
4314
|
+
var import_lodash20 = require("lodash");
|
|
4316
4315
|
var import_center12 = require("@turf/center");
|
|
4317
4316
|
var THREE4 = __toESM(require("three"));
|
|
4318
4317
|
|
|
@@ -4333,7 +4332,7 @@ var maptalks3 = __toESM(require("maptalks-gl"));
|
|
|
4333
4332
|
var import_maptalks6 = require("maptalks.three");
|
|
4334
4333
|
var import_three5 = require("three");
|
|
4335
4334
|
var import_d3plus_shape = require("d3plus-shape");
|
|
4336
|
-
var
|
|
4335
|
+
var import_lodash18 = require("lodash");
|
|
4337
4336
|
var OPTIONS3 = {
|
|
4338
4337
|
// Allowing click through and prevent interaction
|
|
4339
4338
|
interactive: false,
|
|
@@ -4351,9 +4350,9 @@ var defaultFlatLabelOptions = {
|
|
|
4351
4350
|
textBaseline: "middle",
|
|
4352
4351
|
fillStyle: "#000"
|
|
4353
4352
|
};
|
|
4354
|
-
var defaultRectAngleToCalc = (0,
|
|
4353
|
+
var defaultRectAngleToCalc = (0, import_lodash18.range)(-90, 92, 2);
|
|
4355
4354
|
var getMaterial = (text, flatLabelOptions) => {
|
|
4356
|
-
const options = (0,
|
|
4355
|
+
const options = (0, import_lodash18.merge)({}, defaultFlatLabelOptions, flatLabelOptions);
|
|
4357
4356
|
const {
|
|
4358
4357
|
fontSize: initialFontSize,
|
|
4359
4358
|
fontFamily,
|
|
@@ -4406,12 +4405,12 @@ var getMaterial = (text, flatLabelOptions) => {
|
|
|
4406
4405
|
const maxWidth = SIZE - 2 * margin;
|
|
4407
4406
|
texts = wrapText(ctx, text, maxWidth);
|
|
4408
4407
|
}
|
|
4409
|
-
let textWidth = (0,
|
|
4408
|
+
let textWidth = (0, import_lodash18.max)(texts.map((text2) => ctx.measureText(text2).width));
|
|
4410
4409
|
let scale3 = 1;
|
|
4411
4410
|
while (scale3 > 0 && textWidth + 2 * margin > SIZE) {
|
|
4412
4411
|
scale3 -= scaleStep;
|
|
4413
4412
|
ctx.font = `${fontWeight} ${scale3 * fontSize}px "${fontFamily}", Arial`;
|
|
4414
|
-
textWidth = (0,
|
|
4413
|
+
textWidth = (0, import_lodash18.max)(texts.map((text2) => ctx.measureText(text2).width));
|
|
4415
4414
|
}
|
|
4416
4415
|
const center8 = { x: 0.5 * SIZE, y: 0.5 * SIZE };
|
|
4417
4416
|
if (scale3 > scaleMin) {
|
|
@@ -4479,7 +4478,7 @@ var GroundLabel = class extends import_maptalks6.BaseObject {
|
|
|
4479
4478
|
strokeStyle,
|
|
4480
4479
|
lineWidth
|
|
4481
4480
|
});
|
|
4482
|
-
const rectAngles = (0,
|
|
4481
|
+
const rectAngles = (0, import_lodash18.isArray)(angle) ? angle : [angle];
|
|
4483
4482
|
material.needsUpdate = true;
|
|
4484
4483
|
const rect = (0, import_d3plus_shape.largestRect)(bound, {
|
|
4485
4484
|
cache: true,
|
|
@@ -4552,32 +4551,32 @@ var GroundLabel = class extends import_maptalks6.BaseObject {
|
|
|
4552
4551
|
return { x: this.#offsetX, y: this.#offsetY };
|
|
4553
4552
|
}
|
|
4554
4553
|
set offsetX(value) {
|
|
4555
|
-
if ((0,
|
|
4554
|
+
if ((0, import_lodash18.isNumber)(value)) {
|
|
4556
4555
|
this.#offsetX = value;
|
|
4557
4556
|
this.#updatePosition();
|
|
4558
4557
|
}
|
|
4559
4558
|
}
|
|
4560
4559
|
set offsetY(value) {
|
|
4561
|
-
if ((0,
|
|
4560
|
+
if ((0, import_lodash18.isNumber)(value)) {
|
|
4562
4561
|
this.#offsetY = value;
|
|
4563
4562
|
this.#updatePosition();
|
|
4564
4563
|
}
|
|
4565
4564
|
}
|
|
4566
4565
|
set angle(newAngle) {
|
|
4567
|
-
if ((0,
|
|
4566
|
+
if ((0, import_lodash18.isNumber)(newAngle)) {
|
|
4568
4567
|
this.#angle = newAngle;
|
|
4569
4568
|
this.getObject3d().rotation.z = Math.PI / 180 * this.#angle;
|
|
4570
4569
|
}
|
|
4571
4570
|
}
|
|
4572
4571
|
setOffset(offsetX, offsetY) {
|
|
4573
|
-
if ((0,
|
|
4572
|
+
if ((0, import_lodash18.isNumber)(offsetX) && (0, import_lodash18.isNumber)(offsetY)) {
|
|
4574
4573
|
this.#offsetX = offsetX;
|
|
4575
4574
|
this.#offsetY = offsetY;
|
|
4576
4575
|
this.#updatePosition();
|
|
4577
4576
|
}
|
|
4578
4577
|
}
|
|
4579
4578
|
addOffset(deltaX, deltaY) {
|
|
4580
|
-
if ((0,
|
|
4579
|
+
if ((0, import_lodash18.isNumber)(deltaX) && (0, import_lodash18.isNumber)(deltaY)) {
|
|
4581
4580
|
this.#offsetX += deltaX;
|
|
4582
4581
|
this.#offsetY += deltaY;
|
|
4583
4582
|
this.#updatePosition();
|
|
@@ -5159,7 +5158,7 @@ var THREE3 = __toESM(require("three"));
|
|
|
5159
5158
|
var import_maptalks8 = require("maptalks");
|
|
5160
5159
|
var THREE2 = __toESM(require("three"));
|
|
5161
5160
|
var import_maptalks9 = require("maptalks.three");
|
|
5162
|
-
var
|
|
5161
|
+
var import_lodash19 = require("lodash");
|
|
5163
5162
|
|
|
5164
5163
|
// src/IndoorMap/renderer/utils/interpolateStops.ts
|
|
5165
5164
|
var interpolateStops = ({ stops }, zoom) => {
|
|
@@ -5254,7 +5253,7 @@ var TextSpriteMarker = class extends import_maptalks9.BaseObject {
|
|
|
5254
5253
|
const paragraphs = String(text).split("\n");
|
|
5255
5254
|
const wrappedLines = [];
|
|
5256
5255
|
paragraphs.forEach((paragraph) => {
|
|
5257
|
-
if ((0,
|
|
5256
|
+
if ((0, import_lodash19.isNil)(maxWidth) || isNaN(maxWidth)) {
|
|
5258
5257
|
wrappedLines.push(paragraph);
|
|
5259
5258
|
return;
|
|
5260
5259
|
}
|
|
@@ -5315,7 +5314,7 @@ var TextSpriteMarker = class extends import_maptalks9.BaseObject {
|
|
|
5315
5314
|
const altitude = (options.altitude || 0) + this.#altitudeOffset;
|
|
5316
5315
|
const z = layer.altitudeToVector3(altitude, altitude).x;
|
|
5317
5316
|
const position = layer.coordinateToVector3(this._coordinate, z);
|
|
5318
|
-
(0,
|
|
5317
|
+
(0, import_lodash19.set)(this.properties, "default.position", position);
|
|
5319
5318
|
this.getObject3d().position.copy(position);
|
|
5320
5319
|
}
|
|
5321
5320
|
_animation() {
|
|
@@ -5598,7 +5597,7 @@ var RendererManager = class extends EventTarget {
|
|
|
5598
5597
|
if (this.#isClicked) return;
|
|
5599
5598
|
this.#isClicked = true;
|
|
5600
5599
|
const onClickElement = this.#onClickElement;
|
|
5601
|
-
if (!(0,
|
|
5600
|
+
if (!(0, import_lodash20.isFunction)(onClickElement)) return;
|
|
5602
5601
|
this.#onClickElement(e);
|
|
5603
5602
|
this.#isClicked = false;
|
|
5604
5603
|
};
|
|
@@ -5651,7 +5650,7 @@ var RendererManager = class extends EventTarget {
|
|
|
5651
5650
|
});
|
|
5652
5651
|
units.filter((u) => u.properties.category === "room").forEach((unit) => {
|
|
5653
5652
|
const openingRelationships = relationships.filter((r) => r.properties.origin?.id === unit.id || r.properties.destination?.id === unit.id);
|
|
5654
|
-
const roomOpenings = (0,
|
|
5653
|
+
const roomOpenings = (0, import_lodash20.compact)(openingRelationships.map((rel) => {
|
|
5655
5654
|
const openingId = rel?.properties.intermediary[0].id;
|
|
5656
5655
|
return openings.find((o) => o.id === openingId);
|
|
5657
5656
|
}));
|
|
@@ -5733,7 +5732,7 @@ var RendererManager = class extends EventTarget {
|
|
|
5733
5732
|
this.markerRenderer.showMarkers(markers, ordinal - baseOrdinal);
|
|
5734
5733
|
}
|
|
5735
5734
|
} else {
|
|
5736
|
-
const baseOrdinal = Array.isArray(targetOrdinal) ? (0,
|
|
5735
|
+
const baseOrdinal = Array.isArray(targetOrdinal) ? (0, import_lodash20.min)(targetOrdinal) : targetOrdinal;
|
|
5737
5736
|
for (const [ordinal, elements] of this.elementsByOrdinal) {
|
|
5738
5737
|
const inOrdinal = Array.isArray(targetOrdinal) ? targetOrdinal.includes(ordinal) : ordinal === targetOrdinal;
|
|
5739
5738
|
if (inOrdinal) {
|
|
@@ -5760,7 +5759,7 @@ var RendererManager = class extends EventTarget {
|
|
|
5760
5759
|
const elements = elemIds.map((id) => this.elementsMap.get(id)).flat();
|
|
5761
5760
|
elements.forEach((element) => {
|
|
5762
5761
|
const controller = this.elementRenderer.createHighlightController(element);
|
|
5763
|
-
if (controller && (0,
|
|
5762
|
+
if (controller && (0, import_lodash20.isFunction)(controller.start)) {
|
|
5764
5763
|
controller.start();
|
|
5765
5764
|
this.highlightControllers.push(controller);
|
|
5766
5765
|
}
|
|
@@ -5768,7 +5767,7 @@ var RendererManager = class extends EventTarget {
|
|
|
5768
5767
|
};
|
|
5769
5768
|
clearHighlightElements = () => {
|
|
5770
5769
|
this.highlightControllers.forEach((controller) => {
|
|
5771
|
-
if ((0,
|
|
5770
|
+
if ((0, import_lodash20.isFunction)(controller?.clear)) controller.clear();
|
|
5772
5771
|
});
|
|
5773
5772
|
};
|
|
5774
5773
|
/**
|
|
@@ -5883,7 +5882,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
5883
5882
|
};
|
|
5884
5883
|
constructor(elementId, options) {
|
|
5885
5884
|
super();
|
|
5886
|
-
const combinedOptions =
|
|
5885
|
+
const combinedOptions = import_lodash21.default.merge({}, defaultOptions, options);
|
|
5887
5886
|
this.options = combinedOptions;
|
|
5888
5887
|
const {
|
|
5889
5888
|
onMapReady,
|
|
@@ -5930,7 +5929,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
5930
5929
|
this.dataClient = options.dataClient;
|
|
5931
5930
|
}
|
|
5932
5931
|
setOptions(options) {
|
|
5933
|
-
const combinedOptions =
|
|
5932
|
+
const combinedOptions = import_lodash21.default.merge({}, defaultOptions, options);
|
|
5934
5933
|
this.options = combinedOptions;
|
|
5935
5934
|
const maptalksOptions = parseMaptalksOptions(combinedOptions);
|
|
5936
5935
|
this.map.setOptions(maptalksOptions);
|
|
@@ -5956,7 +5955,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
5956
5955
|
handleMapClick = ({ coordinate }) => {
|
|
5957
5956
|
const { x, y } = coordinate;
|
|
5958
5957
|
console.log(
|
|
5959
|
-
`[Coordinates]: x: ${
|
|
5958
|
+
`[Coordinates]: x: ${import_lodash21.default.round(x, 8)} y: ${import_lodash21.default.round(
|
|
5960
5959
|
y,
|
|
5961
5960
|
8
|
|
5962
5961
|
)}, [Bearing]: ${this.map.getBearing()}, [Pitch]: ${this.map.getPitch()}`
|
|
@@ -6042,7 +6041,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
6042
6041
|
if (this.#isClicked) return;
|
|
6043
6042
|
this.#isClicked = true;
|
|
6044
6043
|
const onClickElement = this.#onClickElement;
|
|
6045
|
-
if (!
|
|
6044
|
+
if (!import_lodash21.default.isFunction(onClickElement)) return;
|
|
6046
6045
|
this.#onClickElement(e);
|
|
6047
6046
|
this.#isClicked = false;
|
|
6048
6047
|
};
|
|
@@ -6062,16 +6061,16 @@ var IndoorMap = class extends EventTarget {
|
|
|
6062
6061
|
for (const feature2 of this.#features) {
|
|
6063
6062
|
try {
|
|
6064
6063
|
const { feature_type: featureType, properties, id } = feature2;
|
|
6065
|
-
const layerName =
|
|
6064
|
+
const layerName = import_lodash21.default.get(
|
|
6066
6065
|
LAYER_FEATURE_TYPE_OBJ,
|
|
6067
6066
|
featureType,
|
|
6068
6067
|
featureType
|
|
6069
6068
|
);
|
|
6070
6069
|
const layer = this.map.getLayer(layerName);
|
|
6071
6070
|
let geometry;
|
|
6072
|
-
const category =
|
|
6073
|
-
const extrudeConfig =
|
|
6074
|
-
const textMarkerType =
|
|
6071
|
+
const category = import_lodash21.default.get(feature2, "properties.category");
|
|
6072
|
+
const extrudeConfig = import_lodash21.default.get(this.#mapConfig, "extrude");
|
|
6073
|
+
const textMarkerType = import_lodash21.default.get(
|
|
6075
6074
|
this.#mapConfig,
|
|
6076
6075
|
"text_marker_type",
|
|
6077
6076
|
"ui-marker"
|
|
@@ -6238,15 +6237,15 @@ var IndoorMap = class extends EventTarget {
|
|
|
6238
6237
|
}
|
|
6239
6238
|
}
|
|
6240
6239
|
updateUserLocationSymbolByLocale(locale) {
|
|
6241
|
-
const userLocationGeometry =
|
|
6240
|
+
const userLocationGeometry = import_lodash21.default.get(
|
|
6242
6241
|
this.#elements,
|
|
6243
6242
|
`${USER_LOCATION_ELEMENT_ID}.geometry`
|
|
6244
6243
|
);
|
|
6245
6244
|
if (!userLocationGeometry) return;
|
|
6246
6245
|
const currentSymbol = userLocationGeometry.getSymbol();
|
|
6247
6246
|
const localeSymbolToUpdate = currentSymbol.map((symbol) => {
|
|
6248
|
-
const localeSymbol =
|
|
6249
|
-
if (!
|
|
6247
|
+
const localeSymbol = import_lodash21.default.get(symbol, `${LOCALE_SYMBOL_KEY}.${locale}`) || import_lodash21.default.get(symbol, `${LOCALE_SYMBOL_KEY}.default`);
|
|
6248
|
+
if (!import_lodash21.default.isPlainObject(localeSymbol)) return symbol;
|
|
6250
6249
|
return {
|
|
6251
6250
|
...symbol,
|
|
6252
6251
|
...localeSymbol
|
|
@@ -6320,14 +6319,14 @@ var IndoorMap = class extends EventTarget {
|
|
|
6320
6319
|
* END of User Location
|
|
6321
6320
|
****************************/
|
|
6322
6321
|
showGeometryByElementId = (elementId) => {
|
|
6323
|
-
const geometry =
|
|
6322
|
+
const geometry = import_lodash21.default.get(
|
|
6324
6323
|
this.#elements,
|
|
6325
6324
|
`${elementId}.geometry`
|
|
6326
6325
|
);
|
|
6327
6326
|
if (geometry) geometry.show();
|
|
6328
6327
|
};
|
|
6329
6328
|
hideGeometryByElementId = (elementId) => {
|
|
6330
|
-
const geometry =
|
|
6329
|
+
const geometry = import_lodash21.default.get(this.#elements, `${elementId}.geometry`);
|
|
6331
6330
|
if (geometry) geometry.hide();
|
|
6332
6331
|
};
|
|
6333
6332
|
setSpriteMarkersOpacity = (opacity = 1) => {
|
|
@@ -6374,13 +6373,13 @@ var IndoorMap = class extends EventTarget {
|
|
|
6374
6373
|
const line = lineStrings[i];
|
|
6375
6374
|
const coords = line.geometry.coordinates;
|
|
6376
6375
|
const prevLine = lineStrings[i - 1];
|
|
6377
|
-
const firstCoord =
|
|
6376
|
+
const firstCoord = import_lodash21.default.first(coords);
|
|
6378
6377
|
const isFirstLine = i === 0;
|
|
6379
6378
|
if (isFirstLine) {
|
|
6380
6379
|
accLine.push(...coords);
|
|
6381
6380
|
continue;
|
|
6382
6381
|
}
|
|
6383
|
-
const prevLastCoord =
|
|
6382
|
+
const prevLastCoord = import_lodash21.default.last(prevLine.geometry.coordinates);
|
|
6384
6383
|
const isNearby = (0, import_distance6.default)(point(firstCoord), point(prevLastCoord)) < distance5;
|
|
6385
6384
|
if (!isNearby) {
|
|
6386
6385
|
const remainingLines = lineStrings.slice(i);
|
|
@@ -6401,8 +6400,8 @@ var IndoorMap = class extends EventTarget {
|
|
|
6401
6400
|
create3DStepPath
|
|
6402
6401
|
} = this.#styler;
|
|
6403
6402
|
const routeMarkerLayer = this.map.getLayer(HIGHLIGHT_LAYER_NAME);
|
|
6404
|
-
const linesByOrdinal = (0,
|
|
6405
|
-
const joinedLines = (0,
|
|
6403
|
+
const linesByOrdinal = (0, import_lodash21.default)(stepGeometries).filter(({ geometry }) => geometry.type === "LineString").groupBy("properties.ordinal").value();
|
|
6404
|
+
const joinedLines = (0, import_lodash21.default)(linesByOrdinal).reduce((acc, lines, key) => {
|
|
6406
6405
|
const joined = this.combineNearbyLineStrings(lines, {
|
|
6407
6406
|
properties: { ordinal: +key }
|
|
6408
6407
|
});
|
|
@@ -6430,14 +6429,14 @@ var IndoorMap = class extends EventTarget {
|
|
|
6430
6429
|
stepElement = createOriginMarker(stepGeometry).addTo(routeMarkerLayer);
|
|
6431
6430
|
break;
|
|
6432
6431
|
case "destination-marker":
|
|
6433
|
-
const extrudeConfig =
|
|
6432
|
+
const extrudeConfig = import_lodash21.default.get(this.#mapConfig, "extrude");
|
|
6434
6433
|
if (destinationFeature.feature_type === "occupant") {
|
|
6435
|
-
const stepId =
|
|
6434
|
+
const stepId = import_lodash21.default.get(stepGeometry, "id");
|
|
6436
6435
|
const normalizedDestinationFeature = {
|
|
6437
6436
|
...destinationFeature,
|
|
6438
6437
|
id: stepId
|
|
6439
6438
|
};
|
|
6440
|
-
const logoUrl =
|
|
6439
|
+
const logoUrl = import_lodash21.default.get(
|
|
6441
6440
|
normalizedDestinationFeature,
|
|
6442
6441
|
"properties.logo.url"
|
|
6443
6442
|
);
|
|
@@ -6482,15 +6481,15 @@ var IndoorMap = class extends EventTarget {
|
|
|
6482
6481
|
const routeMarkerLayer = this.map.getLayer(
|
|
6483
6482
|
HIGHLIGHT_LAYER_NAME
|
|
6484
6483
|
);
|
|
6485
|
-
const originMarkerGeometry =
|
|
6484
|
+
const originMarkerGeometry = import_lodash21.default.get(
|
|
6486
6485
|
this.#elements,
|
|
6487
6486
|
`${ORIGIN_MARKER_ID}.geometry`
|
|
6488
6487
|
);
|
|
6489
|
-
const destinationMarkerGeometry =
|
|
6488
|
+
const destinationMarkerGeometry = import_lodash21.default.get(
|
|
6490
6489
|
this.#elements,
|
|
6491
6490
|
`${DESTINATION_MARKER_ID}.geometry`
|
|
6492
6491
|
);
|
|
6493
|
-
const geometriesToRemove =
|
|
6492
|
+
const geometriesToRemove = import_lodash21.default.compact([
|
|
6494
6493
|
originMarkerGeometry,
|
|
6495
6494
|
destinationMarkerGeometry
|
|
6496
6495
|
]);
|
|
@@ -6501,7 +6500,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
6501
6500
|
(obj) => !(obj instanceof NavigationPath)
|
|
6502
6501
|
);
|
|
6503
6502
|
const objects = this.#navigationGeometries || {};
|
|
6504
|
-
|
|
6503
|
+
import_lodash21.default.forEach(objects, (obj) => {
|
|
6505
6504
|
if (!obj) return;
|
|
6506
6505
|
this.#navigationGeometries[obj.properties.id] = null;
|
|
6507
6506
|
obj.remove();
|
|
@@ -6538,7 +6537,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
6538
6537
|
}
|
|
6539
6538
|
if (this.threeLayer) {
|
|
6540
6539
|
const currentView = this.camera.getView();
|
|
6541
|
-
const objectOpacity =
|
|
6540
|
+
const objectOpacity = import_lodash21.default.clamp(38 - 2 * currentView.zoom, 0, 1);
|
|
6542
6541
|
this.#objects.forEach((object) => {
|
|
6543
6542
|
object.getObject3d().traverse((child) => {
|
|
6544
6543
|
if (child.isMesh) child.material.opacity = objectOpacity;
|
|
@@ -6548,7 +6547,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
6548
6547
|
});
|
|
6549
6548
|
if (this.#billboardObjects) {
|
|
6550
6549
|
this.#billboardObjects.forEach((object) => {
|
|
6551
|
-
const objectScale =
|
|
6550
|
+
const objectScale = import_lodash21.default.clamp(
|
|
6552
6551
|
20 - 1 * currentView.zoom,
|
|
6553
6552
|
1,
|
|
6554
6553
|
1.05
|
|
@@ -6557,7 +6556,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
6557
6556
|
});
|
|
6558
6557
|
}
|
|
6559
6558
|
if (this.#isLayersFadingOnZoom) {
|
|
6560
|
-
const layerOpacity =
|
|
6559
|
+
const layerOpacity = import_lodash21.default.clamp(1 - objectOpacity, 0, 1);
|
|
6561
6560
|
LAYERS.forEach((layerKey) => {
|
|
6562
6561
|
const layer = this.map.getLayer(layerKey);
|
|
6563
6562
|
if (layer) layer.setOpacity(layerOpacity);
|