venue-js 1.2.0-next.7 → 1.2.0-next.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +172 -15
- package/dist/index.d.ts +172 -15
- package/dist/index.js +284 -362
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +274 -357
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -49,6 +49,7 @@ __export(index_exports, {
|
|
|
49
49
|
MARKER_LAYER_NAME: () => MARKER_LAYER_NAME,
|
|
50
50
|
NONIMDF_FEATURE_TYPES: () => NONIMDF_FEATURE_TYPES,
|
|
51
51
|
ORIGIN_MARKER_ID: () => ORIGIN_MARKER_ID,
|
|
52
|
+
OccupantHelpers: () => occupant_helper_exports,
|
|
52
53
|
POI_MARKER_LAYER_NAME: () => POI_MARKER_LAYER_NAME,
|
|
53
54
|
QueryObserver: () => import_query_core2.QueryObserver,
|
|
54
55
|
USER_LOCATION_ELEMENT_ID: () => USER_LOCATION_ELEMENT_ID,
|
|
@@ -76,6 +77,16 @@ __export(index_exports, {
|
|
|
76
77
|
getRelatedLocationsByOccupant: () => getRelatedLocationsByOccupant,
|
|
77
78
|
getSuitablyValueBetweenBearings: () => getSuitablyValueBetweenBearings,
|
|
78
79
|
isClickableFeature: () => isClickableFeature,
|
|
80
|
+
isValidCoordinate: () => isValidCoordinate,
|
|
81
|
+
isValidLineString: () => isValidLineString,
|
|
82
|
+
isValidLineStringCoordinates: () => isValidLineStringCoordinates,
|
|
83
|
+
isValidMultiPolygon: () => isValidMultiPolygon,
|
|
84
|
+
isValidMultiPolygonCoordinates: () => isValidMultiPolygonCoordinates,
|
|
85
|
+
isValidPoint: () => isValidPoint,
|
|
86
|
+
isValidPolygon: () => isValidPolygon,
|
|
87
|
+
isValidPolygonCoordinates: () => isValidPolygonCoordinates,
|
|
88
|
+
matchFilter: () => matchFilter,
|
|
89
|
+
matchFilters: () => matchFilters,
|
|
79
90
|
safeFetchFeature: () => safeFetchFeature,
|
|
80
91
|
styledFeatureGenerator: () => styledFeatureGenerator
|
|
81
92
|
});
|
|
@@ -274,6 +285,115 @@ var safeFetchFeature = async (featureType, params) => {
|
|
|
274
285
|
}
|
|
275
286
|
};
|
|
276
287
|
|
|
288
|
+
// src/data/utils/geometry-validator.ts
|
|
289
|
+
var isValidCoordinate = (point2) => {
|
|
290
|
+
return point2.length === 2 && point2.every((coord) => typeof coord === "number");
|
|
291
|
+
};
|
|
292
|
+
function isValidLinearRingCoordinates(ring) {
|
|
293
|
+
if (ring.length < 4) {
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
return ring.every(isValidCoordinate) && ring[0][0] === ring[ring.length - 1][0] && ring[0][1] === ring[ring.length - 1][1];
|
|
297
|
+
}
|
|
298
|
+
var isValidPolygonCoordinates = (polygon) => {
|
|
299
|
+
if (Array.isArray(polygon[0]) && (polygon[0].length === 0 || typeof polygon[0][0] === "number")) {
|
|
300
|
+
return isValidLinearRingCoordinates(polygon);
|
|
301
|
+
}
|
|
302
|
+
if (Array.isArray(polygon) && polygon.length > 0 && Array.isArray(polygon[0])) {
|
|
303
|
+
if (!isValidLinearRingCoordinates(polygon[0])) {
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
for (let i = 1; i < polygon.length; i++) {
|
|
307
|
+
if (!isValidLinearRingCoordinates(polygon[i])) {
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return true;
|
|
312
|
+
}
|
|
313
|
+
return false;
|
|
314
|
+
};
|
|
315
|
+
var isValidMultiPolygonCoordinates = (multipolygon) => {
|
|
316
|
+
return multipolygon.every(isValidPolygonCoordinates);
|
|
317
|
+
};
|
|
318
|
+
var isValidLineStringCoordinates = (lineString2) => {
|
|
319
|
+
if (!Array.isArray(lineString2) || lineString2.length < 2) {
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
const firstPoint = lineString2[0];
|
|
323
|
+
const lastPoint = lineString2[lineString2.length - 1];
|
|
324
|
+
if (firstPoint[0] === lastPoint[0] && firstPoint[1] === lastPoint[1]) {
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
return lineString2.every(isValidCoordinate);
|
|
328
|
+
};
|
|
329
|
+
var isValidMultiPolygon = (geometry) => {
|
|
330
|
+
const { type, coordinates } = geometry;
|
|
331
|
+
return type === "MultiPolygon" && isValidMultiPolygonCoordinates(coordinates);
|
|
332
|
+
};
|
|
333
|
+
var isValidPolygon = (geometry) => {
|
|
334
|
+
const { type, coordinates } = geometry;
|
|
335
|
+
return type === "Polygon" && isValidPolygonCoordinates(coordinates);
|
|
336
|
+
};
|
|
337
|
+
var isValidLineString = (geometry) => {
|
|
338
|
+
const { type, coordinates } = geometry;
|
|
339
|
+
return type === "LineString" && isValidLineStringCoordinates(coordinates);
|
|
340
|
+
};
|
|
341
|
+
var isValidPoint = (geometry) => {
|
|
342
|
+
const { type, coordinates } = geometry;
|
|
343
|
+
return type === "Point" && isValidCoordinate(coordinates);
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
// src/data/utils/match-filters.ts
|
|
347
|
+
function isInFilter(filter) {
|
|
348
|
+
return typeof filter === "object" && filter !== null && "$in" in filter && Array.isArray(filter.$in);
|
|
349
|
+
}
|
|
350
|
+
var someIntersect = (a, b) => a.some((v) => b.includes(v));
|
|
351
|
+
function matchFilter(value, filter) {
|
|
352
|
+
if (Array.isArray(value)) {
|
|
353
|
+
if (isInFilter(filter)) return someIntersect(value, filter.$in);
|
|
354
|
+
return value.includes(filter);
|
|
355
|
+
} else {
|
|
356
|
+
if (isInFilter(filter)) return filter.$in.includes(value);
|
|
357
|
+
return value === filter;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
function matchFilters(item, filters) {
|
|
361
|
+
return Object.entries(filters).every(([key, filter]) => {
|
|
362
|
+
return matchFilter(item.properties[key], filter);
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// src/data/utils/occupant-helper.ts
|
|
367
|
+
var occupant_helper_exports = {};
|
|
368
|
+
__export(occupant_helper_exports, {
|
|
369
|
+
getOccupantCorrelatedLocations: () => getOccupantCorrelatedLocations,
|
|
370
|
+
getOccupantMainLocation: () => getOccupantMainLocation,
|
|
371
|
+
getOccupantMarkerLocations: () => getOccupantMarkerLocations
|
|
372
|
+
});
|
|
373
|
+
var import_compact = __toESM(require("lodash/compact"));
|
|
374
|
+
var getOccupantMainLocation = (occupant) => {
|
|
375
|
+
return occupant.properties.kiosk || occupant.properties.unit;
|
|
376
|
+
};
|
|
377
|
+
var getOccupantCorrelatedLocations = (occupant) => {
|
|
378
|
+
const allCorrelatedLocations = [
|
|
379
|
+
...occupant.properties.units,
|
|
380
|
+
...occupant.properties.kiosks
|
|
381
|
+
];
|
|
382
|
+
return (0, import_compact.default)(allCorrelatedLocations);
|
|
383
|
+
};
|
|
384
|
+
var getOccupantMarkerLocations = (occupant, options) => {
|
|
385
|
+
const placementType = options?.type ? options.type : occupant.properties.show_name_on_all_units ? "ALL_LOCATIONS" : "ONCE_PER_LEVEL";
|
|
386
|
+
const mainLocation = getOccupantMainLocation(occupant);
|
|
387
|
+
const mainLocationLevel = mainLocation?.properties?.level_id;
|
|
388
|
+
const allCorrelatedLocations = getOccupantCorrelatedLocations(occupant);
|
|
389
|
+
if (placementType === "ALL_LOCATIONS") {
|
|
390
|
+
return (0, import_compact.default)([mainLocation, ...allCorrelatedLocations]);
|
|
391
|
+
}
|
|
392
|
+
const otherLevelLocations = allCorrelatedLocations.filter((f) => f.properties.level_id !== mainLocationLevel);
|
|
393
|
+
const onePerLevelLocations = [...new Map(otherLevelLocations.map((loc) => [loc.properties.level_id, loc])).values()];
|
|
394
|
+
return (0, import_compact.default)([mainLocation, ...onePerLevelLocations]);
|
|
395
|
+
};
|
|
396
|
+
|
|
277
397
|
// src/data/getDataClient.ts
|
|
278
398
|
var import_query_core = require("@tanstack/query-core");
|
|
279
399
|
|
|
@@ -429,8 +549,8 @@ var createPopulator = ({
|
|
|
429
549
|
venue,
|
|
430
550
|
promotions,
|
|
431
551
|
privileges,
|
|
432
|
-
kiosk,
|
|
433
|
-
unit,
|
|
552
|
+
kiosk: kiosk ? await populateKiosk(kiosk) : null,
|
|
553
|
+
unit: unit ? await populateUnit(unit) : null,
|
|
434
554
|
kiosks: await Promise.all(kiosks.map(populateKiosk)),
|
|
435
555
|
units: await Promise.all(units.map(populateUnit))
|
|
436
556
|
}
|
|
@@ -522,26 +642,6 @@ var createPopulator = ({
|
|
|
522
642
|
};
|
|
523
643
|
};
|
|
524
644
|
|
|
525
|
-
// src/data/utils/match-filters.ts
|
|
526
|
-
function isInFilter(filter) {
|
|
527
|
-
return typeof filter === "object" && filter !== null && "$in" in filter && Array.isArray(filter.$in);
|
|
528
|
-
}
|
|
529
|
-
var someIntersect = (a, b) => a.some((v) => b.includes(v));
|
|
530
|
-
function matchFilter(value, filter) {
|
|
531
|
-
if (Array.isArray(value)) {
|
|
532
|
-
if (isInFilter(filter)) return someIntersect(value, filter.$in);
|
|
533
|
-
return value.includes(filter);
|
|
534
|
-
} else {
|
|
535
|
-
if (isInFilter(filter)) return filter.$in.includes(value);
|
|
536
|
-
return value === filter;
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
function matchFilters(item, filters) {
|
|
540
|
-
return Object.entries(filters).every(([key, filter]) => {
|
|
541
|
-
return matchFilter(item.properties[key], filter);
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
|
|
545
645
|
// src/data/getDataClient.ts
|
|
546
646
|
var getDataClient = (options) => {
|
|
547
647
|
const observers = /* @__PURE__ */ new Map();
|
|
@@ -752,8 +852,8 @@ function isNumber(num) {
|
|
|
752
852
|
// src/IndoorMap/IndoorMap.ts
|
|
753
853
|
var import_distance = __toESM(require("@turf/distance"));
|
|
754
854
|
var import_center4 = __toESM(require("@turf/center"));
|
|
755
|
-
var
|
|
756
|
-
var
|
|
855
|
+
var import_three7 = require("three");
|
|
856
|
+
var import_maptalks10 = require("maptalks.three");
|
|
757
857
|
|
|
758
858
|
// src/IndoorMap/constants.ts
|
|
759
859
|
var defaultLayerOption = { enableAltitude: true };
|
|
@@ -1749,18 +1849,6 @@ var loadModel3d = (model3d, coordinate, threeLayer) => {
|
|
|
1749
1849
|
);
|
|
1750
1850
|
});
|
|
1751
1851
|
};
|
|
1752
|
-
var create3DModels = async (models, defaultCoordinate, properties, threeLayer) => {
|
|
1753
|
-
let modelObjs = [];
|
|
1754
|
-
for (let j = 0; j < models.length; j++) {
|
|
1755
|
-
const model = models[j];
|
|
1756
|
-
const positionCoord = import_lodash4.default.get(model, "properties.position");
|
|
1757
|
-
const coord = positionCoord || defaultCoordinate;
|
|
1758
|
-
const object = await loadModel3d(model, coord, threeLayer);
|
|
1759
|
-
object.properties = properties;
|
|
1760
|
-
modelObjs.push(object);
|
|
1761
|
-
}
|
|
1762
|
-
return modelObjs;
|
|
1763
|
-
};
|
|
1764
1852
|
var createExtrudePolygon = (geometry, threeLayer, material, height, properties = {}, options) => {
|
|
1765
1853
|
const { offset = 0, altitude = 0 } = options;
|
|
1766
1854
|
const offsetGeometry = (0, import_buffer.default)(geometry, offset, { units: "meters" });
|
|
@@ -2668,44 +2756,6 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
2668
2756
|
markerProperties
|
|
2669
2757
|
);
|
|
2670
2758
|
},
|
|
2671
|
-
createVenue3DModel: async (venue, threeLayer) => {
|
|
2672
|
-
const { id, feature_type, properties } = venue;
|
|
2673
|
-
const { category, model3d } = properties;
|
|
2674
|
-
const modelProperty = {
|
|
2675
|
-
id,
|
|
2676
|
-
feature_type,
|
|
2677
|
-
category
|
|
2678
|
-
};
|
|
2679
|
-
const center2 = (0, import_center2.default)(venue);
|
|
2680
|
-
const centerCoord = import_lodash4.default.get(center2, "geometry.coordinates");
|
|
2681
|
-
const modelPosition = import_lodash4.default.get(model3d, "properties.position", centerCoord);
|
|
2682
|
-
const models = await create3DModels(
|
|
2683
|
-
model3d,
|
|
2684
|
-
modelPosition,
|
|
2685
|
-
modelProperty,
|
|
2686
|
-
threeLayer
|
|
2687
|
-
);
|
|
2688
|
-
return models;
|
|
2689
|
-
},
|
|
2690
|
-
create3DFixture: async (fixture, threeLayer) => {
|
|
2691
|
-
const { id, feature_type, properties } = fixture;
|
|
2692
|
-
const { category, ordinal, model3d } = properties;
|
|
2693
|
-
const modelProperty = {
|
|
2694
|
-
id,
|
|
2695
|
-
feature_type,
|
|
2696
|
-
category,
|
|
2697
|
-
ordinal
|
|
2698
|
-
};
|
|
2699
|
-
const center2 = (0, import_center2.default)(fixture);
|
|
2700
|
-
const coordinate = import_lodash4.default.get(center2, "geometry.coordinates");
|
|
2701
|
-
const models = await create3DModels(
|
|
2702
|
-
model3d,
|
|
2703
|
-
coordinate,
|
|
2704
|
-
modelProperty,
|
|
2705
|
-
threeLayer
|
|
2706
|
-
);
|
|
2707
|
-
return models;
|
|
2708
|
-
},
|
|
2709
2759
|
createExtrudedUnit: (unit, threeLayer, options) => {
|
|
2710
2760
|
const extrudeHeight = import_lodash4.default.get(options, "height");
|
|
2711
2761
|
if (!extrudeHeight) return;
|
|
@@ -2745,24 +2795,6 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
2745
2795
|
options3d
|
|
2746
2796
|
);
|
|
2747
2797
|
return object;
|
|
2748
|
-
},
|
|
2749
|
-
createAmbientLight: (config) => {
|
|
2750
|
-
const { color: colorString = "0xffffff", intensity = 1 } = config;
|
|
2751
|
-
const color = parseInt(colorString, 16);
|
|
2752
|
-
const ambientLight = new import_three5.AmbientLight(color, intensity);
|
|
2753
|
-
return ambientLight;
|
|
2754
|
-
},
|
|
2755
|
-
createDirectionalLight: (config) => {
|
|
2756
|
-
const {
|
|
2757
|
-
color: colorString = "0xffffff",
|
|
2758
|
-
intensity = 1,
|
|
2759
|
-
position: positionString = [0, 0, 0]
|
|
2760
|
-
} = config;
|
|
2761
|
-
const color = parseInt(colorString, 16);
|
|
2762
|
-
const [x, y, z] = positionString;
|
|
2763
|
-
const light = new import_three5.DirectionalLight(color, intensity);
|
|
2764
|
-
light.position.set(x, y, z).normalize();
|
|
2765
|
-
return light;
|
|
2766
2798
|
}
|
|
2767
2799
|
};
|
|
2768
2800
|
};
|
|
@@ -3121,6 +3153,7 @@ var CameraManager = class {
|
|
|
3121
3153
|
};
|
|
3122
3154
|
|
|
3123
3155
|
// src/IndoorMap/renderer/RendererManager.ts
|
|
3156
|
+
var import_isFunction = __toESM(require("lodash/isFunction"));
|
|
3124
3157
|
var import_min = __toESM(require("lodash/min"));
|
|
3125
3158
|
var import_center3 = require("@turf/center");
|
|
3126
3159
|
var THREE3 = __toESM(require("three"));
|
|
@@ -3128,6 +3161,7 @@ var THREE3 = __toESM(require("three"));
|
|
|
3128
3161
|
// src/IndoorMap/renderer/3d/Element3DRenderer.ts
|
|
3129
3162
|
var maptalks4 = __toESM(require("maptalks-gl"));
|
|
3130
3163
|
var THREE = __toESM(require("three"));
|
|
3164
|
+
var import_maptalks7 = require("maptalks.three");
|
|
3131
3165
|
var import_buffer2 = __toESM(require("@turf/buffer"));
|
|
3132
3166
|
|
|
3133
3167
|
// src/IndoorMap/renderer/3d/element3DRendererOptions.ts
|
|
@@ -3140,6 +3174,7 @@ var element3DRendererOptions = {
|
|
|
3140
3174
|
unenclosedarea: { color: "#cccccc", height: 0.2 },
|
|
3141
3175
|
nonpublic: { color: "#999999", height: 0.3 },
|
|
3142
3176
|
escalator: { height: 0.2 },
|
|
3177
|
+
parking: { height: 0.1 },
|
|
3143
3178
|
room: { color: "#ffffff", height: 2, bottomHeight: 0.12 }
|
|
3144
3179
|
}
|
|
3145
3180
|
},
|
|
@@ -3177,6 +3212,7 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3177
3212
|
map;
|
|
3178
3213
|
gltfLayer;
|
|
3179
3214
|
threeLayer;
|
|
3215
|
+
scene;
|
|
3180
3216
|
// private dracoLoader: DRACOLoader
|
|
3181
3217
|
lineMaterial;
|
|
3182
3218
|
materialByColorMap;
|
|
@@ -3308,6 +3344,9 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3308
3344
|
treeMarker.addTo(this.gltfLayer);
|
|
3309
3345
|
return treeMarker;
|
|
3310
3346
|
}
|
|
3347
|
+
async createBuilding(coordinate, ordinal) {
|
|
3348
|
+
return Promise.resolve(null);
|
|
3349
|
+
}
|
|
3311
3350
|
createElement(f) {
|
|
3312
3351
|
switch (f.feature_type) {
|
|
3313
3352
|
default:
|
|
@@ -3329,6 +3368,34 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3329
3368
|
}
|
|
3330
3369
|
});
|
|
3331
3370
|
}
|
|
3371
|
+
createHighlightController(element) {
|
|
3372
|
+
if (!(element instanceof import_maptalks7.BaseObject)) {
|
|
3373
|
+
return null;
|
|
3374
|
+
}
|
|
3375
|
+
switch (element.type) {
|
|
3376
|
+
case "ExtrudePolygon": {
|
|
3377
|
+
const mesh = element.getObject3d();
|
|
3378
|
+
const originalMaterial = mesh.material;
|
|
3379
|
+
const highlightMaterial = this.getOrCreateMaterialByColor("#ff0000");
|
|
3380
|
+
return {
|
|
3381
|
+
start: () => {
|
|
3382
|
+
mesh.material = highlightMaterial;
|
|
3383
|
+
},
|
|
3384
|
+
clear: () => {
|
|
3385
|
+
mesh.material = originalMaterial;
|
|
3386
|
+
}
|
|
3387
|
+
};
|
|
3388
|
+
}
|
|
3389
|
+
default: {
|
|
3390
|
+
return {
|
|
3391
|
+
start() {
|
|
3392
|
+
},
|
|
3393
|
+
clear() {
|
|
3394
|
+
}
|
|
3395
|
+
};
|
|
3396
|
+
}
|
|
3397
|
+
}
|
|
3398
|
+
}
|
|
3332
3399
|
render() {
|
|
3333
3400
|
this.threeLayer._needsUpdate = !this.threeLayer._needsUpdate;
|
|
3334
3401
|
if (this.threeLayer._needsUpdate) {
|
|
@@ -3436,7 +3503,10 @@ var Element2DRenderer = class extends EventTarget {
|
|
|
3436
3503
|
async createEscalator(f, coordinates) {
|
|
3437
3504
|
return Promise.resolve(null);
|
|
3438
3505
|
}
|
|
3439
|
-
async createTree(
|
|
3506
|
+
async createTree(coordinates) {
|
|
3507
|
+
return Promise.resolve(null);
|
|
3508
|
+
}
|
|
3509
|
+
async createBuilding(coordinate, ordinal) {
|
|
3440
3510
|
return Promise.resolve(null);
|
|
3441
3511
|
}
|
|
3442
3512
|
createElement = (imdfFeature) => {
|
|
@@ -3456,6 +3526,15 @@ var Element2DRenderer = class extends EventTarget {
|
|
|
3456
3526
|
element.hide();
|
|
3457
3527
|
});
|
|
3458
3528
|
}
|
|
3529
|
+
createHighlightController(element) {
|
|
3530
|
+
if (!(element instanceof maptalks5.Geometry)) return null;
|
|
3531
|
+
return {
|
|
3532
|
+
start() {
|
|
3533
|
+
},
|
|
3534
|
+
clear() {
|
|
3535
|
+
}
|
|
3536
|
+
};
|
|
3537
|
+
}
|
|
3459
3538
|
};
|
|
3460
3539
|
|
|
3461
3540
|
// src/IndoorMap/renderer/2d/Marker2DRenderer.ts
|
|
@@ -3466,6 +3545,7 @@ var Marker2DRenderer = class extends EventTarget {
|
|
|
3466
3545
|
markerLayer;
|
|
3467
3546
|
constructor(map) {
|
|
3468
3547
|
super();
|
|
3548
|
+
this.map = map;
|
|
3469
3549
|
}
|
|
3470
3550
|
createMarker = (coordinates, ordinal, content) => {
|
|
3471
3551
|
const marker = new maptalks6.ui.UIMarker(coordinates, {
|
|
@@ -3487,79 +3567,12 @@ var Marker2DRenderer = class extends EventTarget {
|
|
|
3487
3567
|
};
|
|
3488
3568
|
|
|
3489
3569
|
// src/IndoorMap/renderer/3d/Marker3DRenderer.ts
|
|
3490
|
-
var maptalks7 = __toESM(require("maptalks"));
|
|
3491
|
-
|
|
3492
|
-
// src/IndoorMap/renderer/utils/svg2material.ts
|
|
3493
|
-
var import_three7 = require("three");
|
|
3494
|
-
var svgToDataURL = (svgString, scaleFactor = 1) => {
|
|
3495
|
-
const svgBlob = new Blob([svgString], { type: "image/svg+xml" });
|
|
3496
|
-
const url = URL.createObjectURL(svgBlob);
|
|
3497
|
-
const img = new Image();
|
|
3498
|
-
return new Promise((resolve, reject) => {
|
|
3499
|
-
img.onload = function() {
|
|
3500
|
-
const newWidth = img.width * scaleFactor;
|
|
3501
|
-
const newHeight = img.height * scaleFactor;
|
|
3502
|
-
const canvas = document.createElement("canvas");
|
|
3503
|
-
canvas.width = newWidth;
|
|
3504
|
-
canvas.height = newHeight;
|
|
3505
|
-
const ctx = canvas.getContext("2d");
|
|
3506
|
-
ctx.drawImage(img, 0, 0, newWidth, newHeight);
|
|
3507
|
-
const pngDataUrl = canvas.toDataURL("image/png");
|
|
3508
|
-
resolve(pngDataUrl);
|
|
3509
|
-
};
|
|
3510
|
-
img.onerror = function(error) {
|
|
3511
|
-
reject(error);
|
|
3512
|
-
};
|
|
3513
|
-
img.src = url;
|
|
3514
|
-
});
|
|
3515
|
-
};
|
|
3516
|
-
var createSVGPathFromMarkerSymbol2 = (style) => {
|
|
3517
|
-
const {
|
|
3518
|
-
markerWidth = 24,
|
|
3519
|
-
markerDx = 0,
|
|
3520
|
-
markerDy = 0,
|
|
3521
|
-
// markerFill,
|
|
3522
|
-
markerPath,
|
|
3523
|
-
fill = "#000000"
|
|
3524
|
-
} = style;
|
|
3525
|
-
const scale2 = markerWidth / 24;
|
|
3526
|
-
const strokeWidth = 2;
|
|
3527
|
-
const halfStrokeWidth = 0.5 * strokeWidth;
|
|
3528
|
-
if (Array.isArray(markerPath)) {
|
|
3529
|
-
return markerPath.map(
|
|
3530
|
-
({ path, fill: fill2 }) => `<path d="${path}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${fill2}" stroke="#ffffff" stroke-width="${strokeWidth}" />`
|
|
3531
|
-
);
|
|
3532
|
-
}
|
|
3533
|
-
return `<path d="${markerPath}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${fill}" />`;
|
|
3534
|
-
};
|
|
3535
|
-
var createSpriteMaterialByLabelSymbol2 = (labelSymbol) => {
|
|
3536
|
-
const material = new import_three7.SpriteMaterial();
|
|
3537
|
-
try {
|
|
3538
|
-
const [base, icon] = labelSymbol ?? [{}, {}];
|
|
3539
|
-
const { markerWidth: baseWidth = 24 } = base;
|
|
3540
|
-
const { markerWidth: iconWidth = 24 } = icon;
|
|
3541
|
-
const viewBoxDimension = Math.max(baseWidth, iconWidth);
|
|
3542
|
-
const baseSVG = createSVGPathFromMarkerSymbol2(base);
|
|
3543
|
-
const iconSVG = icon ? createSVGPathFromMarkerSymbol2(icon) : "";
|
|
3544
|
-
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${viewBoxDimension}" height="${viewBoxDimension}">${baseSVG}${iconSVG}</svg>`;
|
|
3545
|
-
const textureLoader = new import_three7.TextureLoader();
|
|
3546
|
-
const scaleFactor = 200 / 24;
|
|
3547
|
-
svgToDataURL(svg, scaleFactor).then((png) => {
|
|
3548
|
-
const texture = textureLoader.load(png, () => {
|
|
3549
|
-
material.map = texture;
|
|
3550
|
-
material.needsUpdate = true;
|
|
3551
|
-
});
|
|
3552
|
-
});
|
|
3553
|
-
} catch (error) {
|
|
3554
|
-
console.warn(`Error createSpriteMaterialByLabelSymbol: `, labelSymbol);
|
|
3555
|
-
}
|
|
3556
|
-
return material;
|
|
3557
|
-
};
|
|
3570
|
+
var maptalks7 = __toESM(require("maptalks-gl"));
|
|
3558
3571
|
|
|
3559
3572
|
// src/IndoorMap/renderer/3d/objects/TextSpriteMarker.ts
|
|
3560
|
-
var
|
|
3573
|
+
var import_maptalks8 = require("maptalks");
|
|
3561
3574
|
var THREE2 = __toESM(require("three"));
|
|
3562
|
-
var
|
|
3575
|
+
var import_maptalks9 = require("maptalks.three");
|
|
3563
3576
|
var import_lodash6 = require("lodash");
|
|
3564
3577
|
|
|
3565
3578
|
// src/IndoorMap/renderer/utils/interpolateStops.ts
|
|
@@ -3585,11 +3598,11 @@ var OPTIONS4 = {
|
|
|
3585
3598
|
fontFamily: "sans-serif",
|
|
3586
3599
|
fontSize: 28,
|
|
3587
3600
|
fontWeight: 400,
|
|
3588
|
-
background: "
|
|
3601
|
+
background: "transparent",
|
|
3589
3602
|
lineHeight: 32,
|
|
3590
3603
|
padding: 8,
|
|
3591
3604
|
strokeColor: "#000000",
|
|
3592
|
-
strokeWidth:
|
|
3605
|
+
strokeWidth: 3,
|
|
3593
3606
|
strokeStyle: "round",
|
|
3594
3607
|
// Sprite options
|
|
3595
3608
|
/* Overall scale multiplier */
|
|
@@ -3597,12 +3610,12 @@ var OPTIONS4 = {
|
|
|
3597
3610
|
altitude: 0,
|
|
3598
3611
|
opacity: 1
|
|
3599
3612
|
};
|
|
3600
|
-
var TextSpriteMarker = class extends
|
|
3613
|
+
var TextSpriteMarker = class extends import_maptalks9.BaseObject {
|
|
3601
3614
|
#altitudeOffset = 0;
|
|
3602
3615
|
constructor(coordinate, options, layer, properties = {}) {
|
|
3603
|
-
options =
|
|
3616
|
+
options = import_maptalks8.Util.extend({}, OPTIONS4, options, { layer });
|
|
3604
3617
|
super();
|
|
3605
|
-
this._coordinate = new
|
|
3618
|
+
this._coordinate = new import_maptalks8.Coordinate(coordinate);
|
|
3606
3619
|
this._initOptions(options);
|
|
3607
3620
|
this._createGroup();
|
|
3608
3621
|
this.properties = { ...properties };
|
|
@@ -3801,40 +3814,41 @@ var Marker3DRenderer = class extends EventTarget {
|
|
|
3801
3814
|
});
|
|
3802
3815
|
}
|
|
3803
3816
|
/** Marker */
|
|
3804
|
-
getOrCreateIconMaterial(key) {
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3817
|
+
// getOrCreateIconMaterial(key) {
|
|
3818
|
+
// if (!this.materialByKey) this.materialByKey = new Map()
|
|
3819
|
+
// const existingMaterial = this.materialByKey.get(key)
|
|
3820
|
+
// if (existingMaterial) return existingMaterial
|
|
3821
|
+
// // Create new
|
|
3822
|
+
// const baseSymbol: maptalks.Path = {
|
|
3823
|
+
// markerType: "path",
|
|
3824
|
+
// markerPath: [
|
|
3825
|
+
// {
|
|
3826
|
+
// path: "M20.775 1.2H1.225V20.35H8.215L11.3 22.8L14.385 20.35H20.775V1.2Z",
|
|
3827
|
+
// fill: "#ff0000",
|
|
3828
|
+
// },
|
|
3829
|
+
// ],
|
|
3830
|
+
// markerPathWidth: 24,
|
|
3831
|
+
// markerPathHeight: 24
|
|
3832
|
+
// }
|
|
3833
|
+
// const markerSymbol: maptalks.PathMarkerSymbol = {
|
|
3834
|
+
// markerType: "path",
|
|
3835
|
+
// markerPath: [],
|
|
3836
|
+
// // TODO: Get Path by featureType.category
|
|
3837
|
+
// // markerPath: [{ fill: "#FFFFFF", path: "M 19 3 H 5 c -1.1 0 -2 0.9 -2 2 v 14 c 0 1.1 0.9 2 2 2 h 14 c 1.1 0 2 -0.9 2 -2 V 5 c 0 -1.1 -0.9 -2 -2 -2 Z m -2 6 h -1.7 l -5 9 H 7 c -0.83 0 -1.5 -0.67 -1.5 -1.5 S 6.17 15 7 15 h 1.7 l 5 -9 H 17 c 0.83 0 1.5 0.67 1.5 1.5 S 17.83 9 17 9 Z" }],
|
|
3838
|
+
// markerPathWidth: 24,
|
|
3839
|
+
// markerPathHeight: 24,
|
|
3840
|
+
// markerWidth: 24,
|
|
3841
|
+
// markerHeight: 24,
|
|
3842
|
+
// markerDy: 1.5,
|
|
3843
|
+
// markerDx: 1.5,
|
|
3844
|
+
// }
|
|
3845
|
+
// const created = createSpriteMaterialByLabelSymbol([
|
|
3846
|
+
// baseSymbol,
|
|
3847
|
+
// markerSymbol,
|
|
3848
|
+
// ])
|
|
3849
|
+
// this.materialByKey.set(key, created)
|
|
3850
|
+
// return created
|
|
3851
|
+
// }
|
|
3838
3852
|
};
|
|
3839
3853
|
|
|
3840
3854
|
// src/IndoorMap/renderer/utils/angleBetweenLineString.ts
|
|
@@ -3864,6 +3878,9 @@ var RendererManager = class extends EventTarget {
|
|
|
3864
3878
|
options;
|
|
3865
3879
|
// Client for fetching data
|
|
3866
3880
|
#dataClient;
|
|
3881
|
+
#isClicked = false;
|
|
3882
|
+
#onClickElement = (e) => {
|
|
3883
|
+
};
|
|
3867
3884
|
/** Elements: Responsible for converting feature info elements and add to map */
|
|
3868
3885
|
elementRenderer;
|
|
3869
3886
|
markerRenderer;
|
|
@@ -3872,6 +3889,7 @@ var RendererManager = class extends EventTarget {
|
|
|
3872
3889
|
currentOrdinals;
|
|
3873
3890
|
markersMap;
|
|
3874
3891
|
markersByOrdinal;
|
|
3892
|
+
highlightControllers = [];
|
|
3875
3893
|
constructor(map, dataClient, options) {
|
|
3876
3894
|
super();
|
|
3877
3895
|
this.map = map;
|
|
@@ -3890,7 +3908,7 @@ var RendererManager = class extends EventTarget {
|
|
|
3890
3908
|
scene.add(ambientLight);
|
|
3891
3909
|
const dirColor = 16777215;
|
|
3892
3910
|
const dllight = new THREE3.DirectionalLight(dirColor, 0.8);
|
|
3893
|
-
dllight.position.set(0, -10,
|
|
3911
|
+
dllight.position.set(0, -10, 20).normalize();
|
|
3894
3912
|
scene.add(dllight);
|
|
3895
3913
|
const hemi = new THREE3.HemisphereLight(16777215, 4473924, 0.4);
|
|
3896
3914
|
scene.add(hemi);
|
|
@@ -3907,19 +3925,27 @@ var RendererManager = class extends EventTarget {
|
|
|
3907
3925
|
this.#createElements();
|
|
3908
3926
|
}
|
|
3909
3927
|
}
|
|
3928
|
+
set onClickElement(func) {
|
|
3929
|
+
this.#onClickElement = func;
|
|
3930
|
+
}
|
|
3931
|
+
handleClickElement = (e) => {
|
|
3932
|
+
console.log(`handleClickElement`, this.#isClicked);
|
|
3933
|
+
if (this.#isClicked) return;
|
|
3934
|
+
this.#isClicked = true;
|
|
3935
|
+
const onClickElement = this.#onClickElement;
|
|
3936
|
+
if (!(0, import_isFunction.default)(onClickElement)) return;
|
|
3937
|
+
this.#onClickElement(e);
|
|
3938
|
+
this.#isClicked = false;
|
|
3939
|
+
};
|
|
3910
3940
|
getElementsByOrdinal = (ordinal) => {
|
|
3911
3941
|
const exist = this.elementsByOrdinal.get(ordinal);
|
|
3912
3942
|
if (!exist) this.elementsByOrdinal.set(ordinal, []);
|
|
3913
3943
|
return this.elementsByOrdinal.get(ordinal);
|
|
3914
3944
|
};
|
|
3915
|
-
getMarkersByOrdinal = (ordinal) => {
|
|
3916
|
-
const exist = this.markersByOrdinal.get(ordinal);
|
|
3917
|
-
if (!exist) this.markersByOrdinal.set(ordinal, []);
|
|
3918
|
-
return this.markersByOrdinal.get(ordinal);
|
|
3919
|
-
};
|
|
3920
3945
|
addElementsToManager = (id, elements, ordinal) => {
|
|
3921
3946
|
this.elementsMap.set(id, elements);
|
|
3922
3947
|
elements.forEach((el) => {
|
|
3948
|
+
el.on("click", (e) => this.handleClickElement(id));
|
|
3923
3949
|
this.getElementsByOrdinal(ordinal).push(el);
|
|
3924
3950
|
});
|
|
3925
3951
|
const inOrdinal = Array.isArray(this.currentOrdinals) ? this.currentOrdinals.includes(ordinal) : ordinal === this.currentOrdinals;
|
|
@@ -3929,18 +3955,6 @@ var RendererManager = class extends EventTarget {
|
|
|
3929
3955
|
this.elementRenderer.hideElements(elements, ordinal);
|
|
3930
3956
|
}
|
|
3931
3957
|
};
|
|
3932
|
-
addMarkersToManager = (id, markers, ordinal) => {
|
|
3933
|
-
this.markersMap.set(id, markers);
|
|
3934
|
-
markers.forEach((el) => {
|
|
3935
|
-
this.getMarkersByOrdinal(ordinal).push(el);
|
|
3936
|
-
});
|
|
3937
|
-
const inOrdinal = Array.isArray(this.currentOrdinals) ? this.currentOrdinals.includes(ordinal) : ordinal === this.currentOrdinals;
|
|
3938
|
-
if (inOrdinal) {
|
|
3939
|
-
this.markerRenderer.showMarkers(markers, ordinal);
|
|
3940
|
-
} else {
|
|
3941
|
-
this.markerRenderer.hideMarkers(markers, ordinal);
|
|
3942
|
-
}
|
|
3943
|
-
};
|
|
3944
3958
|
async #createElements() {
|
|
3945
3959
|
await delay(this.options.delayBeforeCreateElements ?? 0);
|
|
3946
3960
|
const levels = await this.#dataClient.filterByType("level", {
|
|
@@ -4042,14 +4056,48 @@ var RendererManager = class extends EventTarget {
|
|
|
4042
4056
|
}
|
|
4043
4057
|
}
|
|
4044
4058
|
}
|
|
4059
|
+
highlightElements = (elemIds, options) => {
|
|
4060
|
+
const { reset = true } = options ?? {};
|
|
4061
|
+
if (reset) {
|
|
4062
|
+
this.clearHighlightElements();
|
|
4063
|
+
}
|
|
4064
|
+
const elements = elemIds.map((id) => this.elementsMap.get(id)).flat();
|
|
4065
|
+
elements.forEach((element) => {
|
|
4066
|
+
const controller = this.elementRenderer.createHighlightController(element);
|
|
4067
|
+
controller.start();
|
|
4068
|
+
this.highlightControllers.push(controller);
|
|
4069
|
+
});
|
|
4070
|
+
};
|
|
4071
|
+
clearHighlightElements = () => {
|
|
4072
|
+
this.highlightControllers.forEach((controller) => {
|
|
4073
|
+
if ((0, import_isFunction.default)(controller?.clear)) controller.clear();
|
|
4074
|
+
});
|
|
4075
|
+
};
|
|
4045
4076
|
/**
|
|
4046
4077
|
* ========================================================================
|
|
4047
4078
|
* Markers
|
|
4048
4079
|
* ======================================================================== */
|
|
4080
|
+
_getMarkersByOrdinal = (ordinal) => {
|
|
4081
|
+
const exist = this.markersByOrdinal.get(ordinal);
|
|
4082
|
+
if (!exist) this.markersByOrdinal.set(ordinal, []);
|
|
4083
|
+
return this.markersByOrdinal.get(ordinal);
|
|
4084
|
+
};
|
|
4085
|
+
_addMarkersToManager = (id, markers, ordinal) => {
|
|
4086
|
+
this.markersMap.set(id, markers);
|
|
4087
|
+
markers.forEach((el) => {
|
|
4088
|
+
this._getMarkersByOrdinal(ordinal).push(el);
|
|
4089
|
+
});
|
|
4090
|
+
const inOrdinal = Array.isArray(this.currentOrdinals) ? this.currentOrdinals.includes(ordinal) : ordinal === this.currentOrdinals;
|
|
4091
|
+
if (inOrdinal) {
|
|
4092
|
+
this.markerRenderer.showMarkers(markers, ordinal);
|
|
4093
|
+
} else {
|
|
4094
|
+
this.markerRenderer.hideMarkers(markers, ordinal);
|
|
4095
|
+
}
|
|
4096
|
+
};
|
|
4049
4097
|
createMarker(coordinate, ordinal, text, options) {
|
|
4050
4098
|
const marker = this.markerRenderer.createMarker(coordinate, ordinal, text, options);
|
|
4051
4099
|
const markerId = `${this.markersMap.size + 1}`;
|
|
4052
|
-
this.
|
|
4100
|
+
this._addMarkersToManager(markerId, [marker], ordinal);
|
|
4053
4101
|
}
|
|
4054
4102
|
clearMarkers() {
|
|
4055
4103
|
for (const [markerId, marker] of this.markersMap) {
|
|
@@ -4147,7 +4195,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4147
4195
|
layers: []
|
|
4148
4196
|
});
|
|
4149
4197
|
const groupLayer = new import_maptalks_gl.GroupGLLayer("group", [], {}).addTo(this.map);
|
|
4150
|
-
const threeLayer = new
|
|
4198
|
+
const threeLayer = new import_maptalks10.ThreeLayer("three", {
|
|
4151
4199
|
forceRenderOnMoving: true,
|
|
4152
4200
|
forceRenderOnRotating: true
|
|
4153
4201
|
});
|
|
@@ -4249,7 +4297,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4249
4297
|
this.map.setDevicePixelRatio(value);
|
|
4250
4298
|
}
|
|
4251
4299
|
set onClickElement(func) {
|
|
4252
|
-
this
|
|
4300
|
+
this.rendererManager.onClickElement = func;
|
|
4253
4301
|
}
|
|
4254
4302
|
set locale(value) {
|
|
4255
4303
|
this.#locale = value || defaultOptions.locale;
|
|
@@ -4265,7 +4313,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4265
4313
|
const scene = this.threeLayer.getScene();
|
|
4266
4314
|
if (scene) {
|
|
4267
4315
|
scene.children = scene.children.filter(
|
|
4268
|
-
(children) => children instanceof
|
|
4316
|
+
(children) => children instanceof import_three7.PerspectiveCamera
|
|
4269
4317
|
);
|
|
4270
4318
|
}
|
|
4271
4319
|
}
|
|
@@ -4290,20 +4338,14 @@ var IndoorMap = class extends EventTarget {
|
|
|
4290
4338
|
create3DFootprint,
|
|
4291
4339
|
create3DGroundLabel,
|
|
4292
4340
|
create3DBillboard,
|
|
4293
|
-
createVenue3DModel,
|
|
4294
4341
|
createExtrudedUnit,
|
|
4295
|
-
create3DFixture,
|
|
4296
4342
|
create3DAmenityMarker,
|
|
4297
4343
|
create3DOccupantAmenityMarker,
|
|
4298
4344
|
create3DOpeningMarker,
|
|
4299
|
-
createOccupantGroundLabel
|
|
4300
|
-
// Light
|
|
4301
|
-
createAmbientLight,
|
|
4302
|
-
createDirectionalLight
|
|
4345
|
+
createOccupantGroundLabel
|
|
4303
4346
|
} = this.#styler;
|
|
4304
4347
|
let elements = {};
|
|
4305
4348
|
let object3ds = [];
|
|
4306
|
-
const scene = this.threeLayer.getScene();
|
|
4307
4349
|
for (const feature2 of this.#features) {
|
|
4308
4350
|
try {
|
|
4309
4351
|
const { feature_type: featureType, properties, id } = feature2;
|
|
@@ -4326,16 +4368,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4326
4368
|
feature2
|
|
4327
4369
|
);
|
|
4328
4370
|
switch (featureType) {
|
|
4329
|
-
case "venue": {
|
|
4330
|
-
geometry = createVenue(feature2).addTo(layer);
|
|
4331
|
-
const models = await createVenue3DModel(feature2, this.threeLayer);
|
|
4332
|
-
models.forEach((model) => {
|
|
4333
|
-
model.on("click", this.handleClickElement);
|
|
4334
|
-
object3ds.push(model);
|
|
4335
|
-
this.#venueObjects.push(model);
|
|
4336
|
-
});
|
|
4337
|
-
break;
|
|
4338
|
-
}
|
|
4339
4371
|
case "amenity": {
|
|
4340
4372
|
if (feature2.properties.is_featured) {
|
|
4341
4373
|
const billboardObj = create3DBillboard(feature2, this.threeLayer);
|
|
@@ -4379,127 +4411,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4379
4411
|
geometry = createSection(feature2)?.addTo(layer);
|
|
4380
4412
|
break;
|
|
4381
4413
|
}
|
|
4382
|
-
case "occupant": {
|
|
4383
|
-
switch (category) {
|
|
4384
|
-
// Create only marker if it is amenity occupant
|
|
4385
|
-
case "currencyexchange":
|
|
4386
|
-
case "donationcenter":
|
|
4387
|
-
case "postoffice":
|
|
4388
|
-
const markerFeature = {
|
|
4389
|
-
...feature2,
|
|
4390
|
-
geometry: feature2.properties?.anchor?.geometry
|
|
4391
|
-
};
|
|
4392
|
-
const marker3d = create3DOccupantAmenityMarker(
|
|
4393
|
-
markerFeature,
|
|
4394
|
-
this.threeLayer,
|
|
4395
|
-
extrudeConfig
|
|
4396
|
-
)?.on("click", this.handleClickElement);
|
|
4397
|
-
object3ds.push(marker3d);
|
|
4398
|
-
break;
|
|
4399
|
-
default: {
|
|
4400
|
-
const { kiosk, anchor } = feature2.properties;
|
|
4401
|
-
const { unit } = anchor.properties;
|
|
4402
|
-
let mainLocation = kiosk || unit || null;
|
|
4403
|
-
const relatedLocations = [
|
|
4404
|
-
...feature2.properties.units,
|
|
4405
|
-
...feature2.properties.kiosks
|
|
4406
|
-
].filter((f) => f.properties.ordinal !== properties.ordinal);
|
|
4407
|
-
const occupantLocations = [mainLocation, ...relatedLocations];
|
|
4408
|
-
const renderType = feature2.properties.render_type;
|
|
4409
|
-
occupantLocations.forEach((location, index) => {
|
|
4410
|
-
const isMainLocation = index === 0;
|
|
4411
|
-
if (renderType === "Label") {
|
|
4412
|
-
const occupantGroundLabel = createOccupantGroundLabel(
|
|
4413
|
-
feature2,
|
|
4414
|
-
location,
|
|
4415
|
-
{ textMarkerType, extrudeConfig },
|
|
4416
|
-
this.threeLayer
|
|
4417
|
-
);
|
|
4418
|
-
if (occupantGroundLabel instanceof GroundLabel) {
|
|
4419
|
-
occupantGroundLabel.on("click", this.handleClickElement);
|
|
4420
|
-
occupantGroundLabel.addTo(this.threeLayer);
|
|
4421
|
-
object3ds.push(occupantGroundLabel);
|
|
4422
|
-
this.#groundObjects.push(occupantGroundLabel);
|
|
4423
|
-
}
|
|
4424
|
-
} else {
|
|
4425
|
-
const occupantMarker = createOccupant(feature2, location, {
|
|
4426
|
-
textMarkerType,
|
|
4427
|
-
extrudeConfig
|
|
4428
|
-
});
|
|
4429
|
-
if (occupantMarker instanceof import_maptalks_gl.ui.UIMarker) {
|
|
4430
|
-
occupantMarker.addTo(this.map);
|
|
4431
|
-
} else {
|
|
4432
|
-
occupantMarker?.on("click", this.handleClickElement);
|
|
4433
|
-
occupantMarker?.addTo(layer);
|
|
4434
|
-
}
|
|
4435
|
-
if (isMainLocation) {
|
|
4436
|
-
geometry = occupantMarker;
|
|
4437
|
-
} else {
|
|
4438
|
-
elements[`${feature2.id}_${index}`] = {
|
|
4439
|
-
geometry: occupantMarker,
|
|
4440
|
-
properties: location.properties,
|
|
4441
|
-
featureType: "occupant",
|
|
4442
|
-
feature: feature2
|
|
4443
|
-
};
|
|
4444
|
-
}
|
|
4445
|
-
}
|
|
4446
|
-
});
|
|
4447
|
-
}
|
|
4448
|
-
}
|
|
4449
|
-
break;
|
|
4450
|
-
}
|
|
4451
|
-
case "fixture": {
|
|
4452
|
-
const models = await create3DFixture(feature2, this.threeLayer);
|
|
4453
|
-
models.forEach((model) => {
|
|
4454
|
-
model.on("click", this.handleClickElement);
|
|
4455
|
-
object3ds.push(model);
|
|
4456
|
-
this.#glbObjects.push(model);
|
|
4457
|
-
});
|
|
4458
|
-
if (!featureExtrudeConfig) {
|
|
4459
|
-
geometry = createFixture(feature2)?.addTo(layer);
|
|
4460
|
-
} else {
|
|
4461
|
-
const locatedLevel = feature2?.properties?.level;
|
|
4462
|
-
const levelExtrudeConfig = getExtrudeConfigByFeature(
|
|
4463
|
-
extrudeConfig,
|
|
4464
|
-
locatedLevel
|
|
4465
|
-
);
|
|
4466
|
-
const levelHeight = import_lodash7.default.get(levelExtrudeConfig, "height", 0);
|
|
4467
|
-
const option = { ...featureExtrudeConfig, altitude: levelHeight };
|
|
4468
|
-
const extrudedFixture = createExtrudedUnit(
|
|
4469
|
-
feature2,
|
|
4470
|
-
this.threeLayer,
|
|
4471
|
-
option
|
|
4472
|
-
);
|
|
4473
|
-
object3ds.push(extrudedFixture);
|
|
4474
|
-
}
|
|
4475
|
-
break;
|
|
4476
|
-
}
|
|
4477
|
-
case "footprint": {
|
|
4478
|
-
const objects = await create3DFootprint(
|
|
4479
|
-
feature2,
|
|
4480
|
-
this.threeLayer,
|
|
4481
|
-
featureExtrudeConfig
|
|
4482
|
-
);
|
|
4483
|
-
objects.forEach((object) => {
|
|
4484
|
-
object.on("click", () => {
|
|
4485
|
-
const {
|
|
4486
|
-
geometry: { coordinates }
|
|
4487
|
-
} = (0, import_center4.default)(feature2);
|
|
4488
|
-
this.camera.animateTo({ center: coordinates, pitch: 45 });
|
|
4489
|
-
});
|
|
4490
|
-
object3ds.push(object);
|
|
4491
|
-
this.#objects.push(object);
|
|
4492
|
-
});
|
|
4493
|
-
if (feature2.properties.logo) {
|
|
4494
|
-
const footprintMarker = create3DBillboard(
|
|
4495
|
-
feature2,
|
|
4496
|
-
this.threeLayer
|
|
4497
|
-
);
|
|
4498
|
-
object3ds.push(footprintMarker);
|
|
4499
|
-
this.#billboardObjects.push(footprintMarker);
|
|
4500
|
-
}
|
|
4501
|
-
break;
|
|
4502
|
-
}
|
|
4503
4414
|
default:
|
|
4504
4415
|
break;
|
|
4505
4416
|
}
|
|
@@ -5168,6 +5079,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
5168
5079
|
MARKER_LAYER_NAME,
|
|
5169
5080
|
NONIMDF_FEATURE_TYPES,
|
|
5170
5081
|
ORIGIN_MARKER_ID,
|
|
5082
|
+
OccupantHelpers,
|
|
5171
5083
|
POI_MARKER_LAYER_NAME,
|
|
5172
5084
|
QueryObserver,
|
|
5173
5085
|
USER_LOCATION_ELEMENT_ID,
|
|
@@ -5195,6 +5107,16 @@ var IndoorMap = class extends EventTarget {
|
|
|
5195
5107
|
getRelatedLocationsByOccupant,
|
|
5196
5108
|
getSuitablyValueBetweenBearings,
|
|
5197
5109
|
isClickableFeature,
|
|
5110
|
+
isValidCoordinate,
|
|
5111
|
+
isValidLineString,
|
|
5112
|
+
isValidLineStringCoordinates,
|
|
5113
|
+
isValidMultiPolygon,
|
|
5114
|
+
isValidMultiPolygonCoordinates,
|
|
5115
|
+
isValidPoint,
|
|
5116
|
+
isValidPolygon,
|
|
5117
|
+
isValidPolygonCoordinates,
|
|
5118
|
+
matchFilter,
|
|
5119
|
+
matchFilters,
|
|
5198
5120
|
safeFetchFeature,
|
|
5199
5121
|
styledFeatureGenerator
|
|
5200
5122
|
});
|