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.mjs CHANGED
@@ -1,3 +1,9 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
1
7
  // src/data/index.ts
2
8
  import { QueryObserver as QueryObserver2 } from "@tanstack/query-core";
3
9
 
@@ -191,6 +197,115 @@ var safeFetchFeature = async (featureType, params) => {
191
197
  }
192
198
  };
193
199
 
200
+ // src/data/utils/geometry-validator.ts
201
+ var isValidCoordinate = (point2) => {
202
+ return point2.length === 2 && point2.every((coord) => typeof coord === "number");
203
+ };
204
+ function isValidLinearRingCoordinates(ring) {
205
+ if (ring.length < 4) {
206
+ return false;
207
+ }
208
+ return ring.every(isValidCoordinate) && ring[0][0] === ring[ring.length - 1][0] && ring[0][1] === ring[ring.length - 1][1];
209
+ }
210
+ var isValidPolygonCoordinates = (polygon) => {
211
+ if (Array.isArray(polygon[0]) && (polygon[0].length === 0 || typeof polygon[0][0] === "number")) {
212
+ return isValidLinearRingCoordinates(polygon);
213
+ }
214
+ if (Array.isArray(polygon) && polygon.length > 0 && Array.isArray(polygon[0])) {
215
+ if (!isValidLinearRingCoordinates(polygon[0])) {
216
+ return false;
217
+ }
218
+ for (let i = 1; i < polygon.length; i++) {
219
+ if (!isValidLinearRingCoordinates(polygon[i])) {
220
+ return false;
221
+ }
222
+ }
223
+ return true;
224
+ }
225
+ return false;
226
+ };
227
+ var isValidMultiPolygonCoordinates = (multipolygon) => {
228
+ return multipolygon.every(isValidPolygonCoordinates);
229
+ };
230
+ var isValidLineStringCoordinates = (lineString2) => {
231
+ if (!Array.isArray(lineString2) || lineString2.length < 2) {
232
+ return false;
233
+ }
234
+ const firstPoint = lineString2[0];
235
+ const lastPoint = lineString2[lineString2.length - 1];
236
+ if (firstPoint[0] === lastPoint[0] && firstPoint[1] === lastPoint[1]) {
237
+ return false;
238
+ }
239
+ return lineString2.every(isValidCoordinate);
240
+ };
241
+ var isValidMultiPolygon = (geometry) => {
242
+ const { type, coordinates } = geometry;
243
+ return type === "MultiPolygon" && isValidMultiPolygonCoordinates(coordinates);
244
+ };
245
+ var isValidPolygon = (geometry) => {
246
+ const { type, coordinates } = geometry;
247
+ return type === "Polygon" && isValidPolygonCoordinates(coordinates);
248
+ };
249
+ var isValidLineString = (geometry) => {
250
+ const { type, coordinates } = geometry;
251
+ return type === "LineString" && isValidLineStringCoordinates(coordinates);
252
+ };
253
+ var isValidPoint = (geometry) => {
254
+ const { type, coordinates } = geometry;
255
+ return type === "Point" && isValidCoordinate(coordinates);
256
+ };
257
+
258
+ // src/data/utils/match-filters.ts
259
+ function isInFilter(filter) {
260
+ return typeof filter === "object" && filter !== null && "$in" in filter && Array.isArray(filter.$in);
261
+ }
262
+ var someIntersect = (a, b) => a.some((v) => b.includes(v));
263
+ function matchFilter(value, filter) {
264
+ if (Array.isArray(value)) {
265
+ if (isInFilter(filter)) return someIntersect(value, filter.$in);
266
+ return value.includes(filter);
267
+ } else {
268
+ if (isInFilter(filter)) return filter.$in.includes(value);
269
+ return value === filter;
270
+ }
271
+ }
272
+ function matchFilters(item, filters) {
273
+ return Object.entries(filters).every(([key, filter]) => {
274
+ return matchFilter(item.properties[key], filter);
275
+ });
276
+ }
277
+
278
+ // src/data/utils/occupant-helper.ts
279
+ var occupant_helper_exports = {};
280
+ __export(occupant_helper_exports, {
281
+ getOccupantCorrelatedLocations: () => getOccupantCorrelatedLocations,
282
+ getOccupantMainLocation: () => getOccupantMainLocation,
283
+ getOccupantMarkerLocations: () => getOccupantMarkerLocations
284
+ });
285
+ import _compact from "lodash/compact";
286
+ var getOccupantMainLocation = (occupant) => {
287
+ return occupant.properties.kiosk || occupant.properties.unit;
288
+ };
289
+ var getOccupantCorrelatedLocations = (occupant) => {
290
+ const allCorrelatedLocations = [
291
+ ...occupant.properties.units,
292
+ ...occupant.properties.kiosks
293
+ ];
294
+ return _compact(allCorrelatedLocations);
295
+ };
296
+ var getOccupantMarkerLocations = (occupant, options) => {
297
+ const placementType = options?.type ? options.type : occupant.properties.show_name_on_all_units ? "ALL_LOCATIONS" : "ONCE_PER_LEVEL";
298
+ const mainLocation = getOccupantMainLocation(occupant);
299
+ const mainLocationLevel = mainLocation?.properties?.level_id;
300
+ const allCorrelatedLocations = getOccupantCorrelatedLocations(occupant);
301
+ if (placementType === "ALL_LOCATIONS") {
302
+ return _compact([mainLocation, ...allCorrelatedLocations]);
303
+ }
304
+ const otherLevelLocations = allCorrelatedLocations.filter((f) => f.properties.level_id !== mainLocationLevel);
305
+ const onePerLevelLocations = [...new Map(otherLevelLocations.map((loc) => [loc.properties.level_id, loc])).values()];
306
+ return _compact([mainLocation, ...onePerLevelLocations]);
307
+ };
308
+
194
309
  // src/data/getDataClient.ts
195
310
  import {
196
311
  QueryClient,
@@ -349,8 +464,8 @@ var createPopulator = ({
349
464
  venue,
350
465
  promotions,
351
466
  privileges,
352
- kiosk,
353
- unit,
467
+ kiosk: kiosk ? await populateKiosk(kiosk) : null,
468
+ unit: unit ? await populateUnit(unit) : null,
354
469
  kiosks: await Promise.all(kiosks.map(populateKiosk)),
355
470
  units: await Promise.all(units.map(populateUnit))
356
471
  }
@@ -442,26 +557,6 @@ var createPopulator = ({
442
557
  };
443
558
  };
444
559
 
445
- // src/data/utils/match-filters.ts
446
- function isInFilter(filter) {
447
- return typeof filter === "object" && filter !== null && "$in" in filter && Array.isArray(filter.$in);
448
- }
449
- var someIntersect = (a, b) => a.some((v) => b.includes(v));
450
- function matchFilter(value, filter) {
451
- if (Array.isArray(value)) {
452
- if (isInFilter(filter)) return someIntersect(value, filter.$in);
453
- return value.includes(filter);
454
- } else {
455
- if (isInFilter(filter)) return filter.$in.includes(value);
456
- return value === filter;
457
- }
458
- }
459
- function matchFilters(item, filters) {
460
- return Object.entries(filters).every(([key, filter]) => {
461
- return matchFilter(item.properties[key], filter);
462
- });
463
- }
464
-
465
560
  // src/data/getDataClient.ts
466
561
  var getDataClient = (options) => {
467
562
  const observers = /* @__PURE__ */ new Map();
@@ -682,7 +777,7 @@ function isNumber(num) {
682
777
  import turfDistance from "@turf/distance";
683
778
  import turfCenter3 from "@turf/center";
684
779
  import { PerspectiveCamera } from "three";
685
- import { ThreeLayer as ThreeLayer3 } from "maptalks.three";
780
+ import { ThreeLayer as ThreeLayer4 } from "maptalks.three";
686
781
 
687
782
  // src/IndoorMap/constants.ts
688
783
  var defaultLayerOption = { enableAltitude: true };
@@ -1704,18 +1799,6 @@ var loadModel3d = (model3d, coordinate, threeLayer) => {
1704
1799
  );
1705
1800
  });
1706
1801
  };
1707
- var create3DModels = async (models, defaultCoordinate, properties, threeLayer) => {
1708
- let modelObjs = [];
1709
- for (let j = 0; j < models.length; j++) {
1710
- const model = models[j];
1711
- const positionCoord = _4.get(model, "properties.position");
1712
- const coord = positionCoord || defaultCoordinate;
1713
- const object = await loadModel3d(model, coord, threeLayer);
1714
- object.properties = properties;
1715
- modelObjs.push(object);
1716
- }
1717
- return modelObjs;
1718
- };
1719
1802
  var createExtrudePolygon = (geometry, threeLayer, material, height, properties = {}, options) => {
1720
1803
  const { offset = 0, altitude = 0 } = options;
1721
1804
  const offsetGeometry = turfBuffer(geometry, offset, { units: "meters" });
@@ -2623,44 +2706,6 @@ var styledFeatureGenerator = (mapTheme) => {
2623
2706
  markerProperties
2624
2707
  );
2625
2708
  },
2626
- createVenue3DModel: async (venue, threeLayer) => {
2627
- const { id, feature_type, properties } = venue;
2628
- const { category, model3d } = properties;
2629
- const modelProperty = {
2630
- id,
2631
- feature_type,
2632
- category
2633
- };
2634
- const center2 = turfCenter(venue);
2635
- const centerCoord = _4.get(center2, "geometry.coordinates");
2636
- const modelPosition = _4.get(model3d, "properties.position", centerCoord);
2637
- const models = await create3DModels(
2638
- model3d,
2639
- modelPosition,
2640
- modelProperty,
2641
- threeLayer
2642
- );
2643
- return models;
2644
- },
2645
- create3DFixture: async (fixture, threeLayer) => {
2646
- const { id, feature_type, properties } = fixture;
2647
- const { category, ordinal, model3d } = properties;
2648
- const modelProperty = {
2649
- id,
2650
- feature_type,
2651
- category,
2652
- ordinal
2653
- };
2654
- const center2 = turfCenter(fixture);
2655
- const coordinate = _4.get(center2, "geometry.coordinates");
2656
- const models = await create3DModels(
2657
- model3d,
2658
- coordinate,
2659
- modelProperty,
2660
- threeLayer
2661
- );
2662
- return models;
2663
- },
2664
2709
  createExtrudedUnit: (unit, threeLayer, options) => {
2665
2710
  const extrudeHeight = _4.get(options, "height");
2666
2711
  if (!extrudeHeight) return;
@@ -2700,24 +2745,6 @@ var styledFeatureGenerator = (mapTheme) => {
2700
2745
  options3d
2701
2746
  );
2702
2747
  return object;
2703
- },
2704
- createAmbientLight: (config) => {
2705
- const { color: colorString = "0xffffff", intensity = 1 } = config;
2706
- const color = parseInt(colorString, 16);
2707
- const ambientLight = new AmbientLight(color, intensity);
2708
- return ambientLight;
2709
- },
2710
- createDirectionalLight: (config) => {
2711
- const {
2712
- color: colorString = "0xffffff",
2713
- intensity = 1,
2714
- position: positionString = [0, 0, 0]
2715
- } = config;
2716
- const color = parseInt(colorString, 16);
2717
- const [x, y, z] = positionString;
2718
- const light = new DirectionalLight(color, intensity);
2719
- light.position.set(x, y, z).normalize();
2720
- return light;
2721
2748
  }
2722
2749
  };
2723
2750
  };
@@ -3076,6 +3103,7 @@ var CameraManager = class {
3076
3103
  };
3077
3104
 
3078
3105
  // src/IndoorMap/renderer/RendererManager.ts
3106
+ import _isFunction from "lodash/isFunction";
3079
3107
  import _min from "lodash/min";
3080
3108
  import { center as turfCenter2 } from "@turf/center";
3081
3109
  import * as THREE3 from "three";
@@ -3083,6 +3111,7 @@ import * as THREE3 from "three";
3083
3111
  // src/IndoorMap/renderer/3d/Element3DRenderer.ts
3084
3112
  import * as maptalks4 from "maptalks-gl";
3085
3113
  import * as THREE from "three";
3114
+ import { BaseObject as BaseObject5 } from "maptalks.three";
3086
3115
  import turfBuffer2 from "@turf/buffer";
3087
3116
 
3088
3117
  // src/IndoorMap/renderer/3d/element3DRendererOptions.ts
@@ -3095,6 +3124,7 @@ var element3DRendererOptions = {
3095
3124
  unenclosedarea: { color: "#cccccc", height: 0.2 },
3096
3125
  nonpublic: { color: "#999999", height: 0.3 },
3097
3126
  escalator: { height: 0.2 },
3127
+ parking: { height: 0.1 },
3098
3128
  room: { color: "#ffffff", height: 2, bottomHeight: 0.12 }
3099
3129
  }
3100
3130
  },
@@ -3132,6 +3162,7 @@ var Element3DRenderer = class extends EventTarget {
3132
3162
  map;
3133
3163
  gltfLayer;
3134
3164
  threeLayer;
3165
+ scene;
3135
3166
  // private dracoLoader: DRACOLoader
3136
3167
  lineMaterial;
3137
3168
  materialByColorMap;
@@ -3263,6 +3294,9 @@ var Element3DRenderer = class extends EventTarget {
3263
3294
  treeMarker.addTo(this.gltfLayer);
3264
3295
  return treeMarker;
3265
3296
  }
3297
+ async createBuilding(coordinate, ordinal) {
3298
+ return Promise.resolve(null);
3299
+ }
3266
3300
  createElement(f) {
3267
3301
  switch (f.feature_type) {
3268
3302
  default:
@@ -3284,6 +3318,34 @@ var Element3DRenderer = class extends EventTarget {
3284
3318
  }
3285
3319
  });
3286
3320
  }
3321
+ createHighlightController(element) {
3322
+ if (!(element instanceof BaseObject5)) {
3323
+ return null;
3324
+ }
3325
+ switch (element.type) {
3326
+ case "ExtrudePolygon": {
3327
+ const mesh = element.getObject3d();
3328
+ const originalMaterial = mesh.material;
3329
+ const highlightMaterial = this.getOrCreateMaterialByColor("#ff0000");
3330
+ return {
3331
+ start: () => {
3332
+ mesh.material = highlightMaterial;
3333
+ },
3334
+ clear: () => {
3335
+ mesh.material = originalMaterial;
3336
+ }
3337
+ };
3338
+ }
3339
+ default: {
3340
+ return {
3341
+ start() {
3342
+ },
3343
+ clear() {
3344
+ }
3345
+ };
3346
+ }
3347
+ }
3348
+ }
3287
3349
  render() {
3288
3350
  this.threeLayer._needsUpdate = !this.threeLayer._needsUpdate;
3289
3351
  if (this.threeLayer._needsUpdate) {
@@ -3391,7 +3453,10 @@ var Element2DRenderer = class extends EventTarget {
3391
3453
  async createEscalator(f, coordinates) {
3392
3454
  return Promise.resolve(null);
3393
3455
  }
3394
- async createTree(f, coordinates) {
3456
+ async createTree(coordinates) {
3457
+ return Promise.resolve(null);
3458
+ }
3459
+ async createBuilding(coordinate, ordinal) {
3395
3460
  return Promise.resolve(null);
3396
3461
  }
3397
3462
  createElement = (imdfFeature) => {
@@ -3411,6 +3476,15 @@ var Element2DRenderer = class extends EventTarget {
3411
3476
  element.hide();
3412
3477
  });
3413
3478
  }
3479
+ createHighlightController(element) {
3480
+ if (!(element instanceof maptalks5.Geometry)) return null;
3481
+ return {
3482
+ start() {
3483
+ },
3484
+ clear() {
3485
+ }
3486
+ };
3487
+ }
3414
3488
  };
3415
3489
 
3416
3490
  // src/IndoorMap/renderer/2d/Marker2DRenderer.ts
@@ -3421,6 +3495,7 @@ var Marker2DRenderer = class extends EventTarget {
3421
3495
  markerLayer;
3422
3496
  constructor(map) {
3423
3497
  super();
3498
+ this.map = map;
3424
3499
  }
3425
3500
  createMarker = (coordinates, ordinal, content) => {
3426
3501
  const marker = new maptalks6.ui.UIMarker(coordinates, {
@@ -3442,79 +3517,12 @@ var Marker2DRenderer = class extends EventTarget {
3442
3517
  };
3443
3518
 
3444
3519
  // src/IndoorMap/renderer/3d/Marker3DRenderer.ts
3445
- import * as maptalks7 from "maptalks";
3446
-
3447
- // src/IndoorMap/renderer/utils/svg2material.ts
3448
- import { SpriteMaterial as SpriteMaterial4, TextureLoader as TextureLoader3 } from "three";
3449
- var svgToDataURL = (svgString, scaleFactor = 1) => {
3450
- const svgBlob = new Blob([svgString], { type: "image/svg+xml" });
3451
- const url = URL.createObjectURL(svgBlob);
3452
- const img = new Image();
3453
- return new Promise((resolve, reject) => {
3454
- img.onload = function() {
3455
- const newWidth = img.width * scaleFactor;
3456
- const newHeight = img.height * scaleFactor;
3457
- const canvas = document.createElement("canvas");
3458
- canvas.width = newWidth;
3459
- canvas.height = newHeight;
3460
- const ctx = canvas.getContext("2d");
3461
- ctx.drawImage(img, 0, 0, newWidth, newHeight);
3462
- const pngDataUrl = canvas.toDataURL("image/png");
3463
- resolve(pngDataUrl);
3464
- };
3465
- img.onerror = function(error) {
3466
- reject(error);
3467
- };
3468
- img.src = url;
3469
- });
3470
- };
3471
- var createSVGPathFromMarkerSymbol2 = (style) => {
3472
- const {
3473
- markerWidth = 24,
3474
- markerDx = 0,
3475
- markerDy = 0,
3476
- // markerFill,
3477
- markerPath,
3478
- fill = "#000000"
3479
- } = style;
3480
- const scale2 = markerWidth / 24;
3481
- const strokeWidth = 2;
3482
- const halfStrokeWidth = 0.5 * strokeWidth;
3483
- if (Array.isArray(markerPath)) {
3484
- return markerPath.map(
3485
- ({ path, fill: fill2 }) => `<path d="${path}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${fill2}" stroke="#ffffff" stroke-width="${strokeWidth}" />`
3486
- );
3487
- }
3488
- return `<path d="${markerPath}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${fill}" />`;
3489
- };
3490
- var createSpriteMaterialByLabelSymbol2 = (labelSymbol) => {
3491
- const material = new SpriteMaterial4();
3492
- try {
3493
- const [base, icon] = labelSymbol ?? [{}, {}];
3494
- const { markerWidth: baseWidth = 24 } = base;
3495
- const { markerWidth: iconWidth = 24 } = icon;
3496
- const viewBoxDimension = Math.max(baseWidth, iconWidth);
3497
- const baseSVG = createSVGPathFromMarkerSymbol2(base);
3498
- const iconSVG = icon ? createSVGPathFromMarkerSymbol2(icon) : "";
3499
- const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${viewBoxDimension}" height="${viewBoxDimension}">${baseSVG}${iconSVG}</svg>`;
3500
- const textureLoader = new TextureLoader3();
3501
- const scaleFactor = 200 / 24;
3502
- svgToDataURL(svg, scaleFactor).then((png) => {
3503
- const texture = textureLoader.load(png, () => {
3504
- material.map = texture;
3505
- material.needsUpdate = true;
3506
- });
3507
- });
3508
- } catch (error) {
3509
- console.warn(`Error createSpriteMaterialByLabelSymbol: `, labelSymbol);
3510
- }
3511
- return material;
3512
- };
3520
+ import * as maptalks7 from "maptalks-gl";
3513
3521
 
3514
3522
  // src/IndoorMap/renderer/3d/objects/TextSpriteMarker.ts
3515
3523
  import { Coordinate as Coordinate2, Util as Util4 } from "maptalks";
3516
3524
  import * as THREE2 from "three";
3517
- import { BaseObject as BaseObject5 } from "maptalks.three";
3525
+ import { BaseObject as BaseObject6 } from "maptalks.three";
3518
3526
  import { isNil, set } from "lodash";
3519
3527
 
3520
3528
  // src/IndoorMap/renderer/utils/interpolateStops.ts
@@ -3540,11 +3548,11 @@ var OPTIONS4 = {
3540
3548
  fontFamily: "sans-serif",
3541
3549
  fontSize: 28,
3542
3550
  fontWeight: 400,
3543
- background: "rgba(0, 0, 0, 0.2)",
3551
+ background: "transparent",
3544
3552
  lineHeight: 32,
3545
3553
  padding: 8,
3546
3554
  strokeColor: "#000000",
3547
- strokeWidth: 6,
3555
+ strokeWidth: 3,
3548
3556
  strokeStyle: "round",
3549
3557
  // Sprite options
3550
3558
  /* Overall scale multiplier */
@@ -3552,7 +3560,7 @@ var OPTIONS4 = {
3552
3560
  altitude: 0,
3553
3561
  opacity: 1
3554
3562
  };
3555
- var TextSpriteMarker = class extends BaseObject5 {
3563
+ var TextSpriteMarker = class extends BaseObject6 {
3556
3564
  #altitudeOffset = 0;
3557
3565
  constructor(coordinate, options, layer, properties = {}) {
3558
3566
  options = Util4.extend({}, OPTIONS4, options, { layer });
@@ -3756,40 +3764,41 @@ var Marker3DRenderer = class extends EventTarget {
3756
3764
  });
3757
3765
  }
3758
3766
  /** Marker */
3759
- getOrCreateIconMaterial(key) {
3760
- if (!this.materialByKey) this.materialByKey = /* @__PURE__ */ new Map();
3761
- const existingMaterial = this.materialByKey.get(key);
3762
- if (existingMaterial) return existingMaterial;
3763
- const baseSymbol = {
3764
- markerType: "path",
3765
- markerPath: [
3766
- {
3767
- path: "M20.775 1.2H1.225V20.35H8.215L11.3 22.8L14.385 20.35H20.775V1.2Z",
3768
- fill: "#ff0000"
3769
- }
3770
- ],
3771
- markerPathWidth: 24,
3772
- markerPathHeight: 24
3773
- };
3774
- const markerSymbol = {
3775
- markerType: "path",
3776
- markerPath: [],
3777
- // TODO: Get Path by featureType.category
3778
- // 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" }],
3779
- markerPathWidth: 24,
3780
- markerPathHeight: 24,
3781
- markerWidth: 24,
3782
- markerHeight: 24,
3783
- markerDy: 1.5,
3784
- markerDx: 1.5
3785
- };
3786
- const created = createSpriteMaterialByLabelSymbol2([
3787
- baseSymbol,
3788
- markerSymbol
3789
- ]);
3790
- this.materialByKey.set(key, created);
3791
- return created;
3792
- }
3767
+ // getOrCreateIconMaterial(key) {
3768
+ // if (!this.materialByKey) this.materialByKey = new Map()
3769
+ // const existingMaterial = this.materialByKey.get(key)
3770
+ // if (existingMaterial) return existingMaterial
3771
+ // // Create new
3772
+ // const baseSymbol: maptalks.Path = {
3773
+ // markerType: "path",
3774
+ // markerPath: [
3775
+ // {
3776
+ // path: "M20.775 1.2H1.225V20.35H8.215L11.3 22.8L14.385 20.35H20.775V1.2Z",
3777
+ // fill: "#ff0000",
3778
+ // },
3779
+ // ],
3780
+ // markerPathWidth: 24,
3781
+ // markerPathHeight: 24
3782
+ // }
3783
+ // const markerSymbol: maptalks.PathMarkerSymbol = {
3784
+ // markerType: "path",
3785
+ // markerPath: [],
3786
+ // // TODO: Get Path by featureType.category
3787
+ // // 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" }],
3788
+ // markerPathWidth: 24,
3789
+ // markerPathHeight: 24,
3790
+ // markerWidth: 24,
3791
+ // markerHeight: 24,
3792
+ // markerDy: 1.5,
3793
+ // markerDx: 1.5,
3794
+ // }
3795
+ // const created = createSpriteMaterialByLabelSymbol([
3796
+ // baseSymbol,
3797
+ // markerSymbol,
3798
+ // ])
3799
+ // this.materialByKey.set(key, created)
3800
+ // return created
3801
+ // }
3793
3802
  };
3794
3803
 
3795
3804
  // src/IndoorMap/renderer/utils/angleBetweenLineString.ts
@@ -3819,6 +3828,9 @@ var RendererManager = class extends EventTarget {
3819
3828
  options;
3820
3829
  // Client for fetching data
3821
3830
  #dataClient;
3831
+ #isClicked = false;
3832
+ #onClickElement = (e) => {
3833
+ };
3822
3834
  /** Elements: Responsible for converting feature info elements and add to map */
3823
3835
  elementRenderer;
3824
3836
  markerRenderer;
@@ -3827,6 +3839,7 @@ var RendererManager = class extends EventTarget {
3827
3839
  currentOrdinals;
3828
3840
  markersMap;
3829
3841
  markersByOrdinal;
3842
+ highlightControllers = [];
3830
3843
  constructor(map, dataClient, options) {
3831
3844
  super();
3832
3845
  this.map = map;
@@ -3845,7 +3858,7 @@ var RendererManager = class extends EventTarget {
3845
3858
  scene.add(ambientLight);
3846
3859
  const dirColor = 16777215;
3847
3860
  const dllight = new THREE3.DirectionalLight(dirColor, 0.8);
3848
- dllight.position.set(0, -10, 10).normalize();
3861
+ dllight.position.set(0, -10, 20).normalize();
3849
3862
  scene.add(dllight);
3850
3863
  const hemi = new THREE3.HemisphereLight(16777215, 4473924, 0.4);
3851
3864
  scene.add(hemi);
@@ -3862,19 +3875,27 @@ var RendererManager = class extends EventTarget {
3862
3875
  this.#createElements();
3863
3876
  }
3864
3877
  }
3878
+ set onClickElement(func) {
3879
+ this.#onClickElement = func;
3880
+ }
3881
+ handleClickElement = (e) => {
3882
+ console.log(`handleClickElement`, this.#isClicked);
3883
+ if (this.#isClicked) return;
3884
+ this.#isClicked = true;
3885
+ const onClickElement = this.#onClickElement;
3886
+ if (!_isFunction(onClickElement)) return;
3887
+ this.#onClickElement(e);
3888
+ this.#isClicked = false;
3889
+ };
3865
3890
  getElementsByOrdinal = (ordinal) => {
3866
3891
  const exist = this.elementsByOrdinal.get(ordinal);
3867
3892
  if (!exist) this.elementsByOrdinal.set(ordinal, []);
3868
3893
  return this.elementsByOrdinal.get(ordinal);
3869
3894
  };
3870
- getMarkersByOrdinal = (ordinal) => {
3871
- const exist = this.markersByOrdinal.get(ordinal);
3872
- if (!exist) this.markersByOrdinal.set(ordinal, []);
3873
- return this.markersByOrdinal.get(ordinal);
3874
- };
3875
3895
  addElementsToManager = (id, elements, ordinal) => {
3876
3896
  this.elementsMap.set(id, elements);
3877
3897
  elements.forEach((el) => {
3898
+ el.on("click", (e) => this.handleClickElement(id));
3878
3899
  this.getElementsByOrdinal(ordinal).push(el);
3879
3900
  });
3880
3901
  const inOrdinal = Array.isArray(this.currentOrdinals) ? this.currentOrdinals.includes(ordinal) : ordinal === this.currentOrdinals;
@@ -3884,18 +3905,6 @@ var RendererManager = class extends EventTarget {
3884
3905
  this.elementRenderer.hideElements(elements, ordinal);
3885
3906
  }
3886
3907
  };
3887
- addMarkersToManager = (id, markers, ordinal) => {
3888
- this.markersMap.set(id, markers);
3889
- markers.forEach((el) => {
3890
- this.getMarkersByOrdinal(ordinal).push(el);
3891
- });
3892
- const inOrdinal = Array.isArray(this.currentOrdinals) ? this.currentOrdinals.includes(ordinal) : ordinal === this.currentOrdinals;
3893
- if (inOrdinal) {
3894
- this.markerRenderer.showMarkers(markers, ordinal);
3895
- } else {
3896
- this.markerRenderer.hideMarkers(markers, ordinal);
3897
- }
3898
- };
3899
3908
  async #createElements() {
3900
3909
  await delay(this.options.delayBeforeCreateElements ?? 0);
3901
3910
  const levels = await this.#dataClient.filterByType("level", {
@@ -3997,14 +4006,48 @@ var RendererManager = class extends EventTarget {
3997
4006
  }
3998
4007
  }
3999
4008
  }
4009
+ highlightElements = (elemIds, options) => {
4010
+ const { reset = true } = options ?? {};
4011
+ if (reset) {
4012
+ this.clearHighlightElements();
4013
+ }
4014
+ const elements = elemIds.map((id) => this.elementsMap.get(id)).flat();
4015
+ elements.forEach((element) => {
4016
+ const controller = this.elementRenderer.createHighlightController(element);
4017
+ controller.start();
4018
+ this.highlightControllers.push(controller);
4019
+ });
4020
+ };
4021
+ clearHighlightElements = () => {
4022
+ this.highlightControllers.forEach((controller) => {
4023
+ if (_isFunction(controller?.clear)) controller.clear();
4024
+ });
4025
+ };
4000
4026
  /**
4001
4027
  * ========================================================================
4002
4028
  * Markers
4003
4029
  * ======================================================================== */
4030
+ _getMarkersByOrdinal = (ordinal) => {
4031
+ const exist = this.markersByOrdinal.get(ordinal);
4032
+ if (!exist) this.markersByOrdinal.set(ordinal, []);
4033
+ return this.markersByOrdinal.get(ordinal);
4034
+ };
4035
+ _addMarkersToManager = (id, markers, ordinal) => {
4036
+ this.markersMap.set(id, markers);
4037
+ markers.forEach((el) => {
4038
+ this._getMarkersByOrdinal(ordinal).push(el);
4039
+ });
4040
+ const inOrdinal = Array.isArray(this.currentOrdinals) ? this.currentOrdinals.includes(ordinal) : ordinal === this.currentOrdinals;
4041
+ if (inOrdinal) {
4042
+ this.markerRenderer.showMarkers(markers, ordinal);
4043
+ } else {
4044
+ this.markerRenderer.hideMarkers(markers, ordinal);
4045
+ }
4046
+ };
4004
4047
  createMarker(coordinate, ordinal, text, options) {
4005
4048
  const marker = this.markerRenderer.createMarker(coordinate, ordinal, text, options);
4006
4049
  const markerId = `${this.markersMap.size + 1}`;
4007
- this.addMarkersToManager(markerId, [marker], ordinal);
4050
+ this._addMarkersToManager(markerId, [marker], ordinal);
4008
4051
  }
4009
4052
  clearMarkers() {
4010
4053
  for (const [markerId, marker] of this.markersMap) {
@@ -4102,7 +4145,7 @@ var IndoorMap = class extends EventTarget {
4102
4145
  layers: []
4103
4146
  });
4104
4147
  const groupLayer = new GroupGLLayer("group", [], {}).addTo(this.map);
4105
- const threeLayer = new ThreeLayer3("three", {
4148
+ const threeLayer = new ThreeLayer4("three", {
4106
4149
  forceRenderOnMoving: true,
4107
4150
  forceRenderOnRotating: true
4108
4151
  });
@@ -4204,7 +4247,7 @@ var IndoorMap = class extends EventTarget {
4204
4247
  this.map.setDevicePixelRatio(value);
4205
4248
  }
4206
4249
  set onClickElement(func) {
4207
- this.#onClickElement = func;
4250
+ this.rendererManager.onClickElement = func;
4208
4251
  }
4209
4252
  set locale(value) {
4210
4253
  this.#locale = value || defaultOptions.locale;
@@ -4245,20 +4288,14 @@ var IndoorMap = class extends EventTarget {
4245
4288
  create3DFootprint,
4246
4289
  create3DGroundLabel,
4247
4290
  create3DBillboard,
4248
- createVenue3DModel,
4249
4291
  createExtrudedUnit,
4250
- create3DFixture,
4251
4292
  create3DAmenityMarker,
4252
4293
  create3DOccupantAmenityMarker,
4253
4294
  create3DOpeningMarker,
4254
- createOccupantGroundLabel,
4255
- // Light
4256
- createAmbientLight,
4257
- createDirectionalLight
4295
+ createOccupantGroundLabel
4258
4296
  } = this.#styler;
4259
4297
  let elements = {};
4260
4298
  let object3ds = [];
4261
- const scene = this.threeLayer.getScene();
4262
4299
  for (const feature2 of this.#features) {
4263
4300
  try {
4264
4301
  const { feature_type: featureType, properties, id } = feature2;
@@ -4281,16 +4318,6 @@ var IndoorMap = class extends EventTarget {
4281
4318
  feature2
4282
4319
  );
4283
4320
  switch (featureType) {
4284
- case "venue": {
4285
- geometry = createVenue(feature2).addTo(layer);
4286
- const models = await createVenue3DModel(feature2, this.threeLayer);
4287
- models.forEach((model) => {
4288
- model.on("click", this.handleClickElement);
4289
- object3ds.push(model);
4290
- this.#venueObjects.push(model);
4291
- });
4292
- break;
4293
- }
4294
4321
  case "amenity": {
4295
4322
  if (feature2.properties.is_featured) {
4296
4323
  const billboardObj = create3DBillboard(feature2, this.threeLayer);
@@ -4334,127 +4361,6 @@ var IndoorMap = class extends EventTarget {
4334
4361
  geometry = createSection(feature2)?.addTo(layer);
4335
4362
  break;
4336
4363
  }
4337
- case "occupant": {
4338
- switch (category) {
4339
- // Create only marker if it is amenity occupant
4340
- case "currencyexchange":
4341
- case "donationcenter":
4342
- case "postoffice":
4343
- const markerFeature = {
4344
- ...feature2,
4345
- geometry: feature2.properties?.anchor?.geometry
4346
- };
4347
- const marker3d = create3DOccupantAmenityMarker(
4348
- markerFeature,
4349
- this.threeLayer,
4350
- extrudeConfig
4351
- )?.on("click", this.handleClickElement);
4352
- object3ds.push(marker3d);
4353
- break;
4354
- default: {
4355
- const { kiosk, anchor } = feature2.properties;
4356
- const { unit } = anchor.properties;
4357
- let mainLocation = kiosk || unit || null;
4358
- const relatedLocations = [
4359
- ...feature2.properties.units,
4360
- ...feature2.properties.kiosks
4361
- ].filter((f) => f.properties.ordinal !== properties.ordinal);
4362
- const occupantLocations = [mainLocation, ...relatedLocations];
4363
- const renderType = feature2.properties.render_type;
4364
- occupantLocations.forEach((location, index) => {
4365
- const isMainLocation = index === 0;
4366
- if (renderType === "Label") {
4367
- const occupantGroundLabel = createOccupantGroundLabel(
4368
- feature2,
4369
- location,
4370
- { textMarkerType, extrudeConfig },
4371
- this.threeLayer
4372
- );
4373
- if (occupantGroundLabel instanceof GroundLabel) {
4374
- occupantGroundLabel.on("click", this.handleClickElement);
4375
- occupantGroundLabel.addTo(this.threeLayer);
4376
- object3ds.push(occupantGroundLabel);
4377
- this.#groundObjects.push(occupantGroundLabel);
4378
- }
4379
- } else {
4380
- const occupantMarker = createOccupant(feature2, location, {
4381
- textMarkerType,
4382
- extrudeConfig
4383
- });
4384
- if (occupantMarker instanceof ui3.UIMarker) {
4385
- occupantMarker.addTo(this.map);
4386
- } else {
4387
- occupantMarker?.on("click", this.handleClickElement);
4388
- occupantMarker?.addTo(layer);
4389
- }
4390
- if (isMainLocation) {
4391
- geometry = occupantMarker;
4392
- } else {
4393
- elements[`${feature2.id}_${index}`] = {
4394
- geometry: occupantMarker,
4395
- properties: location.properties,
4396
- featureType: "occupant",
4397
- feature: feature2
4398
- };
4399
- }
4400
- }
4401
- });
4402
- }
4403
- }
4404
- break;
4405
- }
4406
- case "fixture": {
4407
- const models = await create3DFixture(feature2, this.threeLayer);
4408
- models.forEach((model) => {
4409
- model.on("click", this.handleClickElement);
4410
- object3ds.push(model);
4411
- this.#glbObjects.push(model);
4412
- });
4413
- if (!featureExtrudeConfig) {
4414
- geometry = createFixture(feature2)?.addTo(layer);
4415
- } else {
4416
- const locatedLevel = feature2?.properties?.level;
4417
- const levelExtrudeConfig = getExtrudeConfigByFeature(
4418
- extrudeConfig,
4419
- locatedLevel
4420
- );
4421
- const levelHeight = _6.get(levelExtrudeConfig, "height", 0);
4422
- const option = { ...featureExtrudeConfig, altitude: levelHeight };
4423
- const extrudedFixture = createExtrudedUnit(
4424
- feature2,
4425
- this.threeLayer,
4426
- option
4427
- );
4428
- object3ds.push(extrudedFixture);
4429
- }
4430
- break;
4431
- }
4432
- case "footprint": {
4433
- const objects = await create3DFootprint(
4434
- feature2,
4435
- this.threeLayer,
4436
- featureExtrudeConfig
4437
- );
4438
- objects.forEach((object) => {
4439
- object.on("click", () => {
4440
- const {
4441
- geometry: { coordinates }
4442
- } = turfCenter3(feature2);
4443
- this.camera.animateTo({ center: coordinates, pitch: 45 });
4444
- });
4445
- object3ds.push(object);
4446
- this.#objects.push(object);
4447
- });
4448
- if (feature2.properties.logo) {
4449
- const footprintMarker = create3DBillboard(
4450
- feature2,
4451
- this.threeLayer
4452
- );
4453
- object3ds.push(footprintMarker);
4454
- this.#billboardObjects.push(footprintMarker);
4455
- }
4456
- break;
4457
- }
4458
4364
  default:
4459
4365
  break;
4460
4366
  }
@@ -5122,6 +5028,7 @@ export {
5122
5028
  MARKER_LAYER_NAME,
5123
5029
  NONIMDF_FEATURE_TYPES,
5124
5030
  ORIGIN_MARKER_ID,
5031
+ occupant_helper_exports as OccupantHelpers,
5125
5032
  POI_MARKER_LAYER_NAME,
5126
5033
  QueryObserver2 as QueryObserver,
5127
5034
  USER_LOCATION_ELEMENT_ID,
@@ -5149,6 +5056,16 @@ export {
5149
5056
  getRelatedLocationsByOccupant,
5150
5057
  getSuitablyValueBetweenBearings,
5151
5058
  isClickableFeature,
5059
+ isValidCoordinate,
5060
+ isValidLineString,
5061
+ isValidLineStringCoordinates,
5062
+ isValidMultiPolygon,
5063
+ isValidMultiPolygonCoordinates,
5064
+ isValidPoint,
5065
+ isValidPolygon,
5066
+ isValidPolygonCoordinates,
5067
+ matchFilter,
5068
+ matchFilters,
5152
5069
  safeFetchFeature,
5153
5070
  styledFeatureGenerator
5154
5071
  };