venue-js 1.2.0-next.9 → 1.3.0-next.1

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.js CHANGED
@@ -30,12 +30,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  var index_exports = {};
31
31
  __export(index_exports, {
32
32
  ALL_FEATURE_TYPES: () => ALL_FEATURE_TYPES,
33
- ALWAYS_VISIBLE_FEATURE_TYPES: () => ALWAYS_VISIBLE_FEATURE_TYPES,
34
33
  BASE_LAYER_NAME: () => BASE_LAYER_NAME,
35
34
  DEFAULT_BASE_URL: () => DEFAULT_BASE_URL,
36
- DEFAULT_HIGHLIGHT_OPTIONS: () => DEFAULT_HIGHLIGHT_OPTIONS,
37
35
  DEFAULT_LOCALE: () => DEFAULT_LOCALE,
38
- DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS: () => DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS,
39
36
  DESTINATION_MARKER_ID: () => DESTINATION_MARKER_ID,
40
37
  GEOJSON_FEATURE_TYPES: () => GEOJSON_FEATURE_TYPES,
41
38
  HIGHLIGHT_LAYER_NAME: () => HIGHLIGHT_LAYER_NAME,
@@ -52,6 +49,7 @@ __export(index_exports, {
52
49
  OccupantHelpers: () => occupant_helper_exports,
53
50
  POI_MARKER_LAYER_NAME: () => POI_MARKER_LAYER_NAME,
54
51
  QueryObserver: () => import_query_core2.QueryObserver,
52
+ TextSpriteMarker: () => TextSpriteMarker,
55
53
  USER_LOCATION_ELEMENT_ID: () => USER_LOCATION_ELEMENT_ID,
56
54
  USER_LOCATION_LAYER_NAME: () => USER_LOCATION_LAYER_NAME,
57
55
  VENUE_EVENTS: () => VENUE_EVENTS,
@@ -169,7 +167,8 @@ var defaultFeatureQueryOptionsMap = {
169
167
  // refresh every 5 min
170
168
  },
171
169
  element: {},
172
- page: {}
170
+ page: {},
171
+ model3d: {}
173
172
  };
174
173
 
175
174
  // src/data/api/delivery-project.ts
@@ -185,6 +184,14 @@ async function fetchDeliveryApi(projectId, apiKey, featureType, baseUrl = DEFAUL
185
184
  const items = await res.json();
186
185
  return items;
187
186
  }
187
+ case "model3d": {
188
+ const res = await fetch(
189
+ `${baseUrl}/delivery/projects/${projectId}/${featureType}.geojson?api-key=${apiKey}`
190
+ );
191
+ if (res.status !== 200) return [];
192
+ const items = await res.json();
193
+ return items.features;
194
+ }
188
195
  case "sponsored-content": {
189
196
  const res = await fetch(
190
197
  `${baseUrl}/delivery/projects/${projectId}/sponsored-content.json?api-key=${apiKey}`
@@ -295,16 +302,16 @@ function isValidLinearRingCoordinates(ring) {
295
302
  }
296
303
  return ring.every(isValidCoordinate) && ring[0][0] === ring[ring.length - 1][0] && ring[0][1] === ring[ring.length - 1][1];
297
304
  }
298
- var isValidPolygonCoordinates = (polygon) => {
299
- if (Array.isArray(polygon[0]) && (polygon[0].length === 0 || typeof polygon[0][0] === "number")) {
300
- return isValidLinearRingCoordinates(polygon);
305
+ var isValidPolygonCoordinates = (polygon2) => {
306
+ if (Array.isArray(polygon2[0]) && (polygon2[0].length === 0 || typeof polygon2[0][0] === "number")) {
307
+ return isValidLinearRingCoordinates(polygon2);
301
308
  }
302
- if (Array.isArray(polygon) && polygon.length > 0 && Array.isArray(polygon[0])) {
303
- if (!isValidLinearRingCoordinates(polygon[0])) {
309
+ if (Array.isArray(polygon2) && polygon2.length > 0 && Array.isArray(polygon2[0])) {
310
+ if (!isValidLinearRingCoordinates(polygon2[0])) {
304
311
  return false;
305
312
  }
306
- for (let i = 1; i < polygon.length; i++) {
307
- if (!isValidLinearRingCoordinates(polygon[i])) {
313
+ for (let i = 1; i < polygon2.length; i++) {
314
+ if (!isValidLinearRingCoordinates(polygon2[i])) {
308
315
  return false;
309
316
  }
310
317
  }
@@ -347,7 +354,7 @@ var isValidPoint = (geometry) => {
347
354
  function isInFilter(filter) {
348
355
  return typeof filter === "object" && filter !== null && "$in" in filter && Array.isArray(filter.$in);
349
356
  }
350
- var someIntersect = (a, b) => a.some((v) => b.includes(v));
357
+ var someIntersect = (a, b) => a.some((v2) => b.includes(v2));
351
358
  function matchFilter(value, filter) {
352
359
  if (Array.isArray(value)) {
353
360
  if (isInFilter(filter)) return someIntersect(value, filter.$in);
@@ -370,7 +377,7 @@ __export(occupant_helper_exports, {
370
377
  getOccupantMainLocation: () => getOccupantMainLocation,
371
378
  getOccupantMarkerLocations: () => getOccupantMarkerLocations
372
379
  });
373
- var import_compact = __toESM(require("lodash/compact"));
380
+ var import_lodash_es = require("lodash-es");
374
381
  var getOccupantMainLocation = (occupant) => {
375
382
  return occupant.properties.kiosk || occupant.properties.unit;
376
383
  };
@@ -379,7 +386,7 @@ var getOccupantCorrelatedLocations = (occupant) => {
379
386
  ...occupant.properties.units,
380
387
  ...occupant.properties.kiosks
381
388
  ];
382
- return (0, import_compact.default)(allCorrelatedLocations);
389
+ return (0, import_lodash_es.compact)(allCorrelatedLocations);
383
390
  };
384
391
  var getOccupantMarkerLocations = (occupant, options) => {
385
392
  const placementType = options?.type ? options.type : occupant.properties.show_name_on_all_units ? "ALL_LOCATIONS" : "ONCE_PER_LEVEL";
@@ -387,11 +394,11 @@ var getOccupantMarkerLocations = (occupant, options) => {
387
394
  const mainLocationLevel = mainLocation?.properties?.level_id;
388
395
  const allCorrelatedLocations = getOccupantCorrelatedLocations(occupant);
389
396
  if (placementType === "ALL_LOCATIONS") {
390
- return (0, import_compact.default)([mainLocation, ...allCorrelatedLocations]);
397
+ return (0, import_lodash_es.compact)([mainLocation, ...allCorrelatedLocations]);
391
398
  }
392
399
  const otherLevelLocations = allCorrelatedLocations.filter((f) => f.properties.level_id !== mainLocationLevel);
393
400
  const onePerLevelLocations = [...new Map(otherLevelLocations.map((loc) => [loc.properties.level_id, loc])).values()];
394
- return (0, import_compact.default)([mainLocation, ...onePerLevelLocations]);
401
+ return (0, import_lodash_es.compact)([mainLocation, ...onePerLevelLocations]);
395
402
  };
396
403
 
397
404
  // src/data/getDataClient.ts
@@ -771,8 +778,8 @@ var getDataClient = (options) => {
771
778
  // src/IndoorMap/IndoorMap.ts
772
779
  var import_maptalks_gl = require("maptalks-gl");
773
780
  var import_transcoders = require("@maptalks/transcoders.draco");
774
- var import_tween2 = __toESM(require("@tweenjs/tween.js"));
775
- var import_lodash7 = __toESM(require("lodash"));
781
+ var import_tween = __toESM(require("@tweenjs/tween.js"));
782
+ var import_lodash6 = __toESM(require("lodash"));
776
783
 
777
784
  // ../../node_modules/@turf/helpers/dist/esm/index.js
778
785
  var earthRadius = 63710088e-1;
@@ -824,6 +831,28 @@ function point(coordinates, properties, options = {}) {
824
831
  };
825
832
  return feature(geom, properties, options);
826
833
  }
834
+ function polygon(coordinates, properties, options = {}) {
835
+ for (const ring of coordinates) {
836
+ if (ring.length < 4) {
837
+ throw new Error(
838
+ "Each LinearRing of a Polygon must have 4 or more Positions."
839
+ );
840
+ }
841
+ if (ring[ring.length - 1].length !== ring[0].length) {
842
+ throw new Error("First and last Position are not equivalent.");
843
+ }
844
+ for (let j = 0; j < ring[ring.length - 1].length; j++) {
845
+ if (ring[ring.length - 1][j] !== ring[0][j]) {
846
+ throw new Error("First and last Position are not equivalent.");
847
+ }
848
+ }
849
+ }
850
+ const geom = {
851
+ type: "Polygon",
852
+ coordinates
853
+ };
854
+ return feature(geom, properties, options);
855
+ }
827
856
  function lineString(coordinates, properties, options = {}) {
828
857
  if (coordinates.length < 2) {
829
858
  throw new Error("coordinates must be an array of two or more positions");
@@ -845,6 +874,13 @@ function featureCollection(features, options = {}) {
845
874
  fc.features = features;
846
875
  return fc;
847
876
  }
877
+ function multiPoint(coordinates, properties, options = {}) {
878
+ const geom = {
879
+ type: "MultiPoint",
880
+ coordinates
881
+ };
882
+ return feature(geom, properties, options);
883
+ }
848
884
  function isNumber(num) {
849
885
  return !isNaN(num) && num !== null && !Array.isArray(num);
850
886
  }
@@ -852,7 +888,7 @@ function isNumber(num) {
852
888
  // src/IndoorMap/IndoorMap.ts
853
889
  var import_distance = __toESM(require("@turf/distance"));
854
890
  var import_center4 = __toESM(require("@turf/center"));
855
- var import_three7 = require("three");
891
+ var import_three6 = require("three");
856
892
  var import_maptalks10 = require("maptalks.three");
857
893
 
858
894
  // src/IndoorMap/constants.ts
@@ -871,7 +907,6 @@ var GEOLOCATION = "geolocation";
871
907
  var ORIGIN_MARKER = "origin-marker";
872
908
  var DESTINATION_MARKER = "destination-marker";
873
909
  var DECORATION = "decoration";
874
- var ALWAYS_VISIBLE_FEATURE_TYPES = [VENUE, FOOTPRINT];
875
910
  var BASE_LAYER_NAME = "base";
876
911
  var POI_MARKER_LAYER_NAME = "poi";
877
912
  var MARKER_LAYER_NAME = "marker";
@@ -883,13 +918,6 @@ var USER_LOCATION_ELEMENT_ID = "user_location";
883
918
  var LAST_USER_LOCATION_ELEMENT_ID_PREFIX = "last_user_location-";
884
919
  var LOCALE_SYMBOL_KEY = "locale_symbol";
885
920
  var DEFAULT_LOCALE = "en";
886
- var DEFAULT_HIGHLIGHT_OPTIONS = {
887
- symbolSet: null
888
- };
889
- var DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS = {
890
- symbolSet: null,
891
- defaultMarker: false
892
- };
893
921
  var LAYERS = [
894
922
  BASE_LAYER_NAME,
895
923
  POI_MARKER_LAYER_NAME,
@@ -939,11 +967,10 @@ var VENUE_EVENTS = {
939
967
 
940
968
  // src/IndoorMap/utils/createElements.js
941
969
  var import_lodash4 = __toESM(require("lodash"));
942
- var import_maptalks5 = require("maptalks");
970
+ var import_maptalks4 = require("maptalks");
943
971
  var import_center2 = __toESM(require("@turf/center"));
944
972
  var import_buffer = __toESM(require("@turf/buffer"));
945
- var import_three5 = require("three");
946
- var import_GLTFLoader = require("three/examples/jsm/loaders/GLTFLoader.js");
973
+ var import_three4 = require("three");
947
974
 
948
975
  // src/IndoorMap/object3d/Billboard.js
949
976
  var maptalks = __toESM(require("maptalks"));
@@ -975,7 +1002,7 @@ var Billboard = class extends import_maptalks.BaseObject {
975
1002
  this._initOptions(options);
976
1003
  const {
977
1004
  altitude = OPTIONS.altitude,
978
- scale: scale2 = OPTIONS.scale,
1005
+ scale: scale3 = OPTIONS.scale,
979
1006
  alphaTest = OPTIONS.alphaTest,
980
1007
  legColor = OPTIONS.legColor,
981
1008
  showLeg = OPTIONS.showLeg
@@ -1009,8 +1036,8 @@ var Billboard = class extends import_maptalks.BaseObject {
1009
1036
  const sprite = new import_three.Sprite(material);
1010
1037
  sprite.material.sizeAttenuation = false;
1011
1038
  sprite.scale.set(
1012
- scale2 * naturalWidth / divider,
1013
- scale2 * naturalHeight / divider,
1039
+ scale3 * naturalWidth / divider,
1040
+ scale3 * naturalHeight / divider,
1014
1041
  1
1015
1042
  );
1016
1043
  this.getObject3d().add(sprite);
@@ -1019,7 +1046,7 @@ var Billboard = class extends import_maptalks.BaseObject {
1019
1046
  const position = layer.coordinateToVector3(coordinate, z);
1020
1047
  import_lodash.default.set(this.properties, "default.position", position);
1021
1048
  import_lodash.default.set(this.properties, "default.altitude", altitude);
1022
- import_lodash.default.set(this.properties, "default.scale", scale2);
1049
+ import_lodash.default.set(this.properties, "default.scale", scale3);
1023
1050
  this.getObject3d().position.copy(position);
1024
1051
  }
1025
1052
  setLineHeight(altitude) {
@@ -1032,419 +1059,129 @@ var Billboard = class extends import_maptalks.BaseObject {
1032
1059
  }
1033
1060
  };
1034
1061
 
1035
- // src/IndoorMap/object3d/GroundLabel.ts
1036
- var maptalks2 = __toESM(require("maptalks"));
1062
+ // src/IndoorMap/object3d/SpriteMarker.ts
1037
1063
  var import_maptalks2 = require("maptalks.three");
1038
1064
  var import_three2 = require("three");
1039
- var import_d3plus_shape = require("d3plus-shape");
1040
- var import_lodash_es = require("lodash-es");
1041
- var OPTIONS2 = {
1042
- // Allowing click through and prevent interaction
1043
- interactive: false,
1044
- altitude: 0
1045
- };
1046
- var defaultFlatLabelOptions = {
1047
- fontSize: 14,
1048
- fontFamily: "Manrope",
1049
- fontWeight: 600,
1050
- margin: 0,
1051
- scaleMin: 0.5,
1052
- lineHeight: 1.05,
1053
- scaleStep: 0.05,
1054
- textAlign: "center",
1055
- textBaseline: "middle",
1056
- fillStyle: "#000"
1065
+ var import_lodash2 = __toESM(require("lodash"));
1066
+ var DEFAULT_SCALE = 0.05;
1067
+ var DEFAULT_ALTITUDE = 0;
1068
+ var DEFAULT_ALPHATEST = 0.3;
1069
+ var DEFAULT_OPTIONS = {
1070
+ scale: DEFAULT_SCALE,
1071
+ altitude: DEFAULT_ALTITUDE,
1072
+ alphaTest: DEFAULT_ALPHATEST,
1073
+ highlight: {
1074
+ options: {
1075
+ scale: DEFAULT_SCALE * 1.25
1076
+ },
1077
+ material: null
1078
+ }
1057
1079
  };
1058
- var defaultRectAngleToCalc = (0, import_lodash_es.range)(-90, 92, 2);
1059
- var getMaterial = (text, flatLabelOptions) => {
1060
- const options = (0, import_lodash_es.merge)({}, defaultFlatLabelOptions, flatLabelOptions);
1061
- const {
1062
- fontSize: initialFontSize,
1063
- fontFamily,
1064
- fontWeight,
1065
- margin,
1066
- scaleMin,
1067
- scaleStep,
1068
- fillStyle,
1069
- lineHeight,
1070
- textAlign,
1071
- strokeStyle,
1072
- lineWidth,
1073
- textBaseline
1074
- } = options;
1075
- const pixelMultiplier = 4;
1076
- const SIZE = 100 * pixelMultiplier;
1077
- const fontSize = initialFontSize * (pixelMultiplier * 1.25);
1078
- const canvas = document.createElement("canvas");
1079
- canvas.width = canvas.height = SIZE;
1080
- const ctx = canvas.getContext("2d");
1081
- ctx.font = `${fontWeight} ${fontSize}px "${fontFamily}", Arial`;
1082
- ctx.textAlign = textAlign;
1083
- ctx.textBaseline = textBaseline;
1084
- ctx.fillStyle = fillStyle;
1085
- ctx.strokeStyle = strokeStyle;
1086
- ctx.lineWidth = lineWidth;
1087
- const wrapText = (ctx2, text2, maxWidth) => {
1088
- const words = text2.trim().split(/\s+/);
1089
- if (words.length <= 1) return [text2];
1090
- const lines = [];
1091
- const MAX_LINES = 3;
1092
- let currentLine = words[0];
1093
- for (let i = 1; i < words.length; i++) {
1094
- const lineToMeasure = currentLine + " " + words[i];
1095
- if (ctx2.measureText(lineToMeasure).width > maxWidth) {
1096
- lines.push(currentLine);
1097
- currentLine = words[i];
1098
- } else {
1099
- currentLine = lineToMeasure;
1100
- }
1080
+ var SpriteMarker = class extends import_maptalks2.BaseObject {
1081
+ #default = null;
1082
+ #highlight = null;
1083
+ constructor(coordinate, options, material, layer, properties) {
1084
+ super();
1085
+ this._initOptions(options);
1086
+ this._createGroup();
1087
+ const {
1088
+ altitude = DEFAULT_OPTIONS.altitude,
1089
+ scale: scale3 = DEFAULT_OPTIONS.scale,
1090
+ highlight = DEFAULT_OPTIONS.highlight,
1091
+ alphaTest = DEFAULT_OPTIONS.alphaTest
1092
+ } = options;
1093
+ this.properties = { ...properties };
1094
+ const modifiedAltitude = altitude + 2;
1095
+ this.#default = { options: { scale: scale3, altitude: modifiedAltitude }, material };
1096
+ this.#highlight = import_lodash2.default.merge({}, DEFAULT_OPTIONS.highlight, highlight);
1097
+ if (material && material instanceof import_three2.SpriteMaterial)
1098
+ material.alphaTest = alphaTest;
1099
+ const sprite = new import_three2.Sprite(material);
1100
+ sprite.scale.set(scale3, scale3, scale3);
1101
+ const obj3d = this.getObject3d();
1102
+ obj3d.add(sprite);
1103
+ const z = layer.altitudeToVector3(modifiedAltitude, modifiedAltitude).x;
1104
+ const position = layer.coordinateToVector3(coordinate, z);
1105
+ import_lodash2.default.set(this.properties, "default.position", position);
1106
+ this.getObject3d().position.copy(position);
1107
+ }
1108
+ // Different objects need to implement their own methods
1109
+ setSymbol(material) {
1110
+ if (material && material instanceof import_three2.SpriteMaterial) {
1111
+ const sprite = this.getObject3d().children[0];
1112
+ if (!sprite) return this;
1113
+ sprite.material = material;
1114
+ sprite.material.needsUpdate = true;
1101
1115
  }
1102
- lines.push(currentLine);
1103
- return lines.slice(0, MAX_LINES);
1104
- };
1105
- const hasManualBreaks = text.includes("\n");
1106
- let texts;
1107
- if (hasManualBreaks) {
1108
- texts = text.split(/\n/g);
1109
- } else {
1110
- const maxWidth = SIZE - 2 * margin;
1111
- texts = wrapText(ctx, text, maxWidth);
1116
+ return this;
1112
1117
  }
1113
- let textWidth = (0, import_lodash_es.max)(texts.map((text2) => ctx.measureText(text2).width));
1114
- let scale2 = 1;
1115
- while (scale2 > 0 && textWidth + 2 * margin > SIZE) {
1116
- scale2 -= scaleStep;
1117
- ctx.font = `${fontWeight} ${scale2 * fontSize}px "${fontFamily}", Arial`;
1118
- textWidth = (0, import_lodash_es.max)(texts.map((text2) => ctx.measureText(text2).width));
1118
+ setScale(scaleX, scaleY = scaleX, scaleZ = scaleX) {
1119
+ const sprite = this.getObject3d().children[0];
1120
+ if (!sprite) return this;
1121
+ sprite.scale.set(scaleX, scaleY, scaleZ);
1122
+ return this;
1119
1123
  }
1120
- const center2 = { x: 0.5 * SIZE, y: 0.5 * SIZE };
1121
- if (scale2 > scaleMin) {
1122
- const totalHeight = texts.length * (fontSize * scale2 * lineHeight);
1123
- const startY = center2.y - totalHeight / 2 + fontSize * scale2 * lineHeight * 0.5;
1124
- texts.forEach((text2, index) => {
1125
- const yOffset = startY + index * (fontSize * scale2 * lineHeight);
1126
- if (strokeStyle && lineWidth) {
1127
- ctx.strokeText(text2, center2.x, yOffset);
1128
- }
1129
- ctx.fillText(text2, center2.x, yOffset);
1130
- });
1124
+ // Different objects need to implement their own methods
1125
+ getSymbol() {
1126
+ return this.getObject3d()?.children[0]?.material;
1127
+ }
1128
+ highlight() {
1129
+ const { material, options } = this.#highlight;
1130
+ if (material) this.setSymbol(material);
1131
+ if (options.scale) this.setScale(options.scale);
1132
+ if (options.altitude) this.setAltitude(options.altitude);
1133
+ return this;
1134
+ }
1135
+ removeHighlight() {
1136
+ const { material, options } = this.#default;
1137
+ if (material) this.setSymbol(material);
1138
+ if (options.scale) this.setScale(options.scale);
1139
+ if (options.altitude) this.setAltitude(options.altitude);
1140
+ return this;
1131
1141
  }
1132
- const texture = new import_three2.Texture(canvas);
1133
- texture.needsUpdate = true;
1134
- const material = new import_three2.MeshPhongMaterial({
1135
- map: texture,
1136
- transparent: true,
1137
- // @ref: https://threejs.org/docs/#api/en/materials/Material.alphaTest
1138
- alphaTest: 0.3
1139
- });
1140
- return material;
1141
1142
  };
1142
- var GroundLabel = class extends import_maptalks2.BaseObject {
1143
- #angle = 0;
1144
- #bearing = 0;
1145
- #text = "";
1146
- #offsetX = 0;
1147
- #offsetY = 0;
1148
- #originalPosition = null;
1149
- #layer = null;
1150
- constructor(bound, options, layer) {
1143
+
1144
+ // src/IndoorMap/object3d/NavigationPath.ts
1145
+ var maptalks2 = __toESM(require("maptalks"));
1146
+ var import_maptalks3 = require("maptalks.three");
1147
+ var import_three3 = require("three");
1148
+ var OPTIONS2 = {
1149
+ altitude: 0
1150
+ };
1151
+ var DEFAULT_LINE_OPTION = {
1152
+ color: "#000",
1153
+ opacity: 1
1154
+ };
1155
+ var DEFAULT_LINE_EFFECT_OPTION = {
1156
+ color: "#000",
1157
+ opacity: 1
1158
+ };
1159
+ var ENABLE_ANIMATED_PATH = true;
1160
+ var NavigationPath = class extends import_maptalks3.BaseObject {
1161
+ constructor(feature2, layer, properties, options, lineOptions = DEFAULT_LINE_OPTION, outlineOption = DEFAULT_LINE_EFFECT_OPTION) {
1151
1162
  options = maptalks2.Util.extend({}, OPTIONS2, options, {
1152
- layer,
1153
- coordinate: bound
1163
+ layer
1154
1164
  });
1155
- const {
1156
- altitude,
1157
- text,
1158
- fontSize,
1159
- fillStyle,
1160
- textAlign,
1161
- fontFamily,
1162
- textBaseline,
1163
- strokeStyle,
1164
- lineWidth,
1165
- angle = defaultRectAngleToCalc,
1166
- maxFontScale,
1167
- offsetX = 0,
1168
- offsetY = 0,
1169
- ...properties
1170
- } = options;
1171
1165
  super();
1172
1166
  this._initOptions(options);
1173
- this.properties = properties;
1174
- this.#offsetX = offsetX;
1175
- this.#offsetY = offsetY;
1176
- this.#layer = layer;
1177
- const material = getMaterial(text, {
1178
- fillStyle,
1179
- fontSize,
1180
- textAlign,
1181
- textBaseline,
1182
- fontFamily,
1183
- strokeStyle,
1184
- lineWidth
1185
- });
1186
- const rectAngles = (0, import_lodash_es.isArray)(angle) ? angle : [angle];
1187
- material.needsUpdate = true;
1188
- const rect = (0, import_d3plus_shape.largestRect)(bound, {
1189
- cache: true,
1190
- /**
1191
- * Black magic here:
1192
- * For some reason if we allow angle -90 or 90, some polygon will use that angle even if it's wrong angle to use.
1193
- * So we remove -90 and 90 from choices, and use -85 & 85 instead.
1194
- */
1195
- angle: rectAngles
1196
- });
1197
- const { cx, cy, width, angle: calculatedAngle } = rect;
1198
- this.#text = text;
1199
- this.#angle = calculatedAngle;
1200
- const geometry = new import_three2.PlaneGeometry(1, 1);
1201
- this._createMesh(geometry, material);
1202
- const z = layer.altitudeToVector3(altitude, altitude).x;
1203
- const basePosition = layer.coordinateToVector3({ x: cx, y: cy }, z);
1204
- this.#originalPosition = basePosition.clone();
1205
- const finalPosition = this.#calculateFinalPosition(basePosition);
1206
- const scale2 = width / 6456122659e-13;
1207
- const finalScale = maxFontScale && scale2 > maxFontScale ? maxFontScale : scale2;
1208
- this.getObject3d().scale.set(finalScale, finalScale, finalScale);
1209
- this.getObject3d().position.copy(finalPosition);
1210
- this.getObject3d().rotation.z = Math.PI / 180 * this.#angle;
1211
- }
1212
- #calculateFinalPosition(basePosition) {
1213
- if (this.#offsetX === 0 && this.#offsetY === 0) {
1214
- return basePosition;
1215
- }
1216
- const offsetCoordinate = {
1217
- x: this.#offsetX,
1218
- y: this.#offsetY
1219
- };
1220
- const z = this.#layer.altitudeToVector3(0, 0).x;
1221
- const offsetVector = this.#layer.coordinateToVector3(offsetCoordinate, z);
1222
- const zeroVector = this.#layer.coordinateToVector3({ x: 0, y: 0 }, z);
1223
- const worldOffsetX = offsetVector.x - zeroVector.x;
1224
- const worldOffsetY = offsetVector.y - zeroVector.y;
1225
- return {
1226
- x: basePosition.x + worldOffsetX,
1227
- y: basePosition.y + worldOffsetY,
1228
- z: basePosition.z
1229
- };
1230
- }
1231
- #updatePosition() {
1232
- if (this.#originalPosition && this.#layer) {
1233
- const finalPosition = this.#calculateFinalPosition(this.#originalPosition);
1234
- this.getObject3d().position.copy(finalPosition);
1235
- }
1236
- }
1237
- set bearing(value) {
1238
- this.#bearing = value;
1239
- const degree = this.#angle + this.#bearing;
1240
- const angle = degree > 90 || degree < -90 ? this.#angle + 180 : this.#angle;
1241
- this.getObject3d().rotation.z = Math.PI / 180 * angle;
1242
- }
1243
- get angle() {
1244
- return this.#angle;
1245
- }
1246
- get currentAngle() {
1247
- return this.#angle;
1248
- }
1249
- get text() {
1250
- return this.#text;
1251
- }
1252
- get offsetX() {
1253
- return this.#offsetX;
1254
- }
1255
- get offsetY() {
1256
- return this.#offsetY;
1257
- }
1258
- get offset() {
1259
- return { x: this.#offsetX, y: this.#offsetY };
1260
- }
1261
- set offsetX(value) {
1262
- if ((0, import_lodash_es.isNumber)(value)) {
1263
- this.#offsetX = value;
1264
- this.#updatePosition();
1265
- }
1266
- }
1267
- set offsetY(value) {
1268
- if ((0, import_lodash_es.isNumber)(value)) {
1269
- this.#offsetY = value;
1270
- this.#updatePosition();
1271
- }
1272
- }
1273
- set angle(newAngle) {
1274
- if ((0, import_lodash_es.isNumber)(newAngle)) {
1275
- this.#angle = newAngle;
1276
- this.getObject3d().rotation.z = Math.PI / 180 * this.#angle;
1277
- }
1278
- }
1279
- setOffset(offsetX, offsetY) {
1280
- if ((0, import_lodash_es.isNumber)(offsetX) && (0, import_lodash_es.isNumber)(offsetY)) {
1281
- this.#offsetX = offsetX;
1282
- this.#offsetY = offsetY;
1283
- this.#updatePosition();
1284
- }
1285
- }
1286
- addOffset(deltaX, deltaY) {
1287
- if ((0, import_lodash_es.isNumber)(deltaX) && (0, import_lodash_es.isNumber)(deltaY)) {
1288
- this.#offsetX += deltaX;
1289
- this.#offsetY += deltaY;
1290
- this.#updatePosition();
1291
- }
1292
- }
1293
- resetOffset() {
1294
- this.#offsetX = 0;
1295
- this.#offsetY = 0;
1296
- this.#updatePosition();
1297
- }
1298
- moveToPosition(targetX, targetY) {
1299
- if (this.#originalPosition && this.#layer) {
1300
- const currentCenter = this.#layer.vector3ToCoordinate(
1301
- this.#originalPosition
1302
- );
1303
- this.#offsetX = targetX - currentCenter.x;
1304
- this.#offsetY = targetY - currentCenter.y;
1305
- this.#updatePosition();
1306
- }
1307
- }
1308
- updateText(newText, options = {}) {
1309
- this.#text = newText;
1310
- const materialOptions = {
1311
- fillStyle: options.fillStyle || this.properties.fillStyle,
1312
- fontSize: options.fontSize || this.properties.fontSize,
1313
- textAlign: options.textAlign || this.properties.textAlign,
1314
- textBaseline: options.textBaseline || this.properties.textBaseline,
1315
- fontFamily: options.fontFamily || this.properties.fontFamily,
1316
- strokeStyle: options.strokeStyle || this.properties.strokeStyle,
1317
- lineWidth: options.lineWidth || this.properties.lineWidth
1318
- };
1319
- const newMaterial = getMaterial(newText, materialOptions);
1320
- this.getObject3d().material = newMaterial;
1321
- newMaterial.needsUpdate = true;
1322
- }
1323
- };
1324
-
1325
- // src/IndoorMap/object3d/SpriteMarker.ts
1326
- var import_maptalks3 = require("maptalks.three");
1327
- var import_three3 = require("three");
1328
- var import_lodash2 = __toESM(require("lodash"));
1329
- var DEFAULT_SCALE = 0.05;
1330
- var DEFAULT_ALTITUDE = 0;
1331
- var DEFAULT_ALPHATEST = 0.3;
1332
- var DEFAULT_OPTIONS = {
1333
- scale: DEFAULT_SCALE,
1334
- altitude: DEFAULT_ALTITUDE,
1335
- alphaTest: DEFAULT_ALPHATEST,
1336
- highlight: {
1337
- options: {
1338
- scale: DEFAULT_SCALE * 1.25
1339
- },
1340
- material: null
1341
- }
1342
- };
1343
- var SpriteMarker = class extends import_maptalks3.BaseObject {
1344
- #default = null;
1345
- #highlight = null;
1346
- constructor(coordinate, options, material, layer, properties) {
1347
- super();
1348
- this._initOptions(options);
1349
- this._createGroup();
1350
- const {
1351
- altitude = DEFAULT_OPTIONS.altitude,
1352
- scale: scale2 = DEFAULT_OPTIONS.scale,
1353
- highlight = DEFAULT_OPTIONS.highlight,
1354
- alphaTest = DEFAULT_OPTIONS.alphaTest
1355
- } = options;
1356
- this.properties = { ...properties };
1357
- const modifiedAltitude = altitude + 2;
1358
- this.#default = { options: { scale: scale2, altitude: modifiedAltitude }, material };
1359
- this.#highlight = import_lodash2.default.merge({}, DEFAULT_OPTIONS.highlight, highlight);
1360
- if (material && material instanceof import_three3.SpriteMaterial)
1361
- material.alphaTest = alphaTest;
1362
- const sprite = new import_three3.Sprite(material);
1363
- sprite.scale.set(scale2, scale2, scale2);
1364
- const obj3d = this.getObject3d();
1365
- obj3d.add(sprite);
1366
- const z = layer.altitudeToVector3(modifiedAltitude, modifiedAltitude).x;
1367
- const position = layer.coordinateToVector3(coordinate, z);
1368
- import_lodash2.default.set(this.properties, "default.position", position);
1369
- this.getObject3d().position.copy(position);
1370
- }
1371
- // Different objects need to implement their own methods
1372
- setSymbol(material) {
1373
- if (material && material instanceof import_three3.SpriteMaterial) {
1374
- const sprite = this.getObject3d().children[0];
1375
- if (!sprite) return this;
1376
- sprite.material = material;
1377
- sprite.material.needsUpdate = true;
1378
- }
1379
- return this;
1380
- }
1381
- setScale(scaleX, scaleY = scaleX, scaleZ = scaleX) {
1382
- const sprite = this.getObject3d().children[0];
1383
- if (!sprite) return this;
1384
- sprite.scale.set(scaleX, scaleY, scaleZ);
1385
- return this;
1386
- }
1387
- // Different objects need to implement their own methods
1388
- getSymbol() {
1389
- return this.getObject3d()?.children[0]?.material;
1390
- }
1391
- highlight() {
1392
- const { material, options } = this.#highlight;
1393
- if (material) this.setSymbol(material);
1394
- if (options.scale) this.setScale(options.scale);
1395
- if (options.altitude) this.setAltitude(options.altitude);
1396
- return this;
1397
- }
1398
- removeHighlight() {
1399
- const { material, options } = this.#default;
1400
- if (material) this.setSymbol(material);
1401
- if (options.scale) this.setScale(options.scale);
1402
- if (options.altitude) this.setAltitude(options.altitude);
1403
- return this;
1404
- }
1405
- };
1406
-
1407
- // src/IndoorMap/object3d/NavigationPath.ts
1408
- var maptalks3 = __toESM(require("maptalks"));
1409
- var import_maptalks4 = require("maptalks.three");
1410
- var import_three4 = require("three");
1411
- var OPTIONS3 = {
1412
- altitude: 0
1413
- };
1414
- var DEFAULT_LINE_OPTION = {
1415
- color: "#000",
1416
- opacity: 1
1417
- };
1418
- var DEFAULT_LINE_EFFECT_OPTION = {
1419
- color: "#000",
1420
- opacity: 1
1421
- };
1422
- var ENABLE_ANIMATED_PATH = true;
1423
- var NavigationPath = class extends import_maptalks4.BaseObject {
1424
- constructor(feature2, layer, properties, options, lineOptions = DEFAULT_LINE_OPTION, outlineOption = DEFAULT_LINE_EFFECT_OPTION) {
1425
- options = maptalks3.Util.extend({}, OPTIONS3, options, {
1426
- layer
1427
- });
1428
- super();
1429
- this._initOptions(options);
1430
- const { altitude = OPTIONS3.altitude } = options;
1431
- this.properties = { ...properties };
1432
- this._createGroup();
1433
- const { color: lineColor, opacity: lineOpacity } = lineOptions || DEFAULT_LINE_OPTION;
1434
- const staticMaterial = new import_three4.MeshBasicMaterial({
1435
- transparent: true,
1436
- color: lineColor || "#fff",
1437
- opacity: lineOpacity || 1,
1438
- depthWrite: false
1167
+ const { altitude = OPTIONS2.altitude } = options;
1168
+ this.properties = { ...properties };
1169
+ this._createGroup();
1170
+ const { color: lineColor, opacity: lineOpacity } = lineOptions || DEFAULT_LINE_OPTION;
1171
+ const staticMaterial = new import_three3.MeshBasicMaterial({
1172
+ transparent: true,
1173
+ color: lineColor || "#fff",
1174
+ opacity: lineOpacity || 1,
1175
+ depthWrite: false
1439
1176
  });
1440
1177
  const uniforms = {
1441
1178
  time: { value: 0 },
1442
- color: { value: new import_three4.Color(lineColor || "#fff") },
1179
+ color: { value: new import_three3.Color(lineColor || "#fff") },
1443
1180
  opacity: { value: lineOpacity || 1 }
1444
1181
  };
1445
1182
  this._uniforms = uniforms;
1446
1183
  this._t = 0;
1447
- const animatedMaterial = new import_three4.ShaderMaterial({
1184
+ const animatedMaterial = new import_three3.ShaderMaterial({
1448
1185
  uniforms,
1449
1186
  transparent: true,
1450
1187
  depthWrite: false,
@@ -1467,7 +1204,7 @@ var NavigationPath = class extends import_maptalks4.BaseObject {
1467
1204
  }
1468
1205
  `
1469
1206
  });
1470
- const pathGeometry = maptalks3.GeoJSON.toGeometry(feature2);
1207
+ const pathGeometry = maptalks2.GeoJSON.toGeometry(feature2);
1471
1208
  const line = layer.toPath(
1472
1209
  pathGeometry,
1473
1210
  {
@@ -1478,7 +1215,7 @@ var NavigationPath = class extends import_maptalks4.BaseObject {
1478
1215
  ENABLE_ANIMATED_PATH ? animatedMaterial : staticMaterial
1479
1216
  );
1480
1217
  const { color: outlineColor, opacity: outlineOpacity } = outlineOption || {};
1481
- const outlineMaterial = new import_three4.MeshBasicMaterial({
1218
+ const outlineMaterial = new import_three3.MeshBasicMaterial({
1482
1219
  transparent: true,
1483
1220
  color: outlineColor || "#fff",
1484
1221
  opacity: outlineOpacity || 1
@@ -1525,8 +1262,8 @@ var createPolygonFromLineString = (geometry) => {
1525
1262
  const right = (0, import_line_offset.default)(line, -0.3, { units: "meters" });
1526
1263
  const leftCoords = left.geometry.coordinates;
1527
1264
  const rightCoords = right.geometry.coordinates.reverse();
1528
- const polygon = [...leftCoords, ...rightCoords, leftCoords[0]];
1529
- return [polygon];
1265
+ const polygon2 = [...leftCoords, ...rightCoords, leftCoords[0]];
1266
+ return [polygon2];
1530
1267
  };
1531
1268
 
1532
1269
  // src/IndoorMap/utils/svg.ts
@@ -1560,14 +1297,14 @@ var createSVGPathFromMarkerSymbol = (style) => {
1560
1297
  markerFill,
1561
1298
  markerPath
1562
1299
  } = style;
1563
- const scale2 = markerWidth / 24;
1564
- return `<path d="${markerPath}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${markerFill}"/>`;
1300
+ const scale3 = markerWidth / 24;
1301
+ return `<path d="${markerPath}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale3})" fill="${markerFill}"/>`;
1565
1302
  };
1566
1303
 
1567
1304
  // src/IndoorMap/utils/createElements.js
1568
1305
  var GeometryType = {
1569
- Polygon: import_maptalks5.Polygon,
1570
- MultiPolygon: import_maptalks5.MultiPolygon
1306
+ Polygon: import_maptalks4.Polygon,
1307
+ MultiPolygon: import_maptalks4.MultiPolygon
1571
1308
  };
1572
1309
  var ORDINAL_HEIGHT = 0;
1573
1310
  var VENUE_Z_INDEX = 0;
@@ -1702,8 +1439,8 @@ var createObstructionalFixture = (feature2, style = {}, options = {}) => {
1702
1439
  if (allowOverride) import_lodash4.default.merge(symbolStyle, properties.style);
1703
1440
  if (inheritFillColorToLine) symbolStyle.lineColor = symbolStyle.polygonFill;
1704
1441
  if (geometry.type === "LineString") {
1705
- const polygon = createPolygonFromLineString(geometry);
1706
- return new GeometryType["Polygon"](polygon, {
1442
+ const polygon2 = createPolygonFromLineString(geometry);
1443
+ return new GeometryType["Polygon"](polygon2, {
1707
1444
  properties: {
1708
1445
  altitude: getAltitude(properties)
1709
1446
  },
@@ -1771,7 +1508,7 @@ var createPrincipalOpening = (feature2, style, options = {}) => {
1771
1508
  const symbolStyle = { ...style };
1772
1509
  if (allowOverride) import_lodash4.default.merge(symbolStyle, properties.style);
1773
1510
  try {
1774
- return new import_maptalks5.LineString(geometry.coordinates, {
1511
+ return new import_maptalks4.LineString(geometry.coordinates, {
1775
1512
  properties: {
1776
1513
  altitude: getAltitude(properties)
1777
1514
  },
@@ -1788,7 +1525,7 @@ var createEmergencyExitOpening = (feature2, style, options = {}) => {
1788
1525
  const symbolStyle = { ...style };
1789
1526
  if (allowOverride) import_lodash4.default.merge(symbolStyle, properties.style);
1790
1527
  try {
1791
- return new import_maptalks5.LineString(geometry.coordinates, {
1528
+ return new import_maptalks4.LineString(geometry.coordinates, {
1792
1529
  properties: {
1793
1530
  altitude: getAltitude(properties)
1794
1531
  },
@@ -1805,7 +1542,7 @@ var createPedestrianOpening = (feature2, style, options = {}) => {
1805
1542
  const symbolStyle = { ...style };
1806
1543
  if (allowOverride) import_lodash4.default.merge(symbolStyle, properties.style);
1807
1544
  try {
1808
- return new import_maptalks5.LineString(geometry.coordinates, {
1545
+ return new import_maptalks4.LineString(geometry.coordinates, {
1809
1546
  properties: {
1810
1547
  id,
1811
1548
  feature_type: "opening",
@@ -1819,36 +1556,6 @@ var createPedestrianOpening = (feature2, style, options = {}) => {
1819
1556
  console.log(`error creating pedestrian opening:`, feature2);
1820
1557
  }
1821
1558
  };
1822
- var loadModel3d = (model3d, coordinate, threeLayer) => {
1823
- return new Promise((resolve, reject) => {
1824
- const loader = new import_GLTFLoader.GLTFLoader();
1825
- const { url, properties: modelProperties } = model3d;
1826
- loader.load(
1827
- url,
1828
- (gltf) => {
1829
- const object3d = gltf.scene;
1830
- object3d.rotation.x = import_lodash4.default.get(modelProperties, "rotation.x");
1831
- object3d.rotation.y = import_lodash4.default.get(modelProperties, "rotation.y");
1832
- object3d.scale.set(...import_lodash4.default.get(modelProperties, "scale") || []);
1833
- const object = threeLayer.toModel(object3d, {
1834
- coordinate
1835
- });
1836
- object.getObject3d().traverse((child) => {
1837
- if (child.isMesh === true) {
1838
- child.material.transparent = true;
1839
- child.material.metalness = 0.1;
1840
- }
1841
- });
1842
- resolve(object);
1843
- },
1844
- (xhr) => {
1845
- },
1846
- (error) => {
1847
- reject(error);
1848
- }
1849
- );
1850
- });
1851
- };
1852
1559
  var createExtrudePolygon = (geometry, threeLayer, material, height, properties = {}, options) => {
1853
1560
  const { offset = 0, altitude = 0 } = options;
1854
1561
  const offsetGeometry = (0, import_buffer.default)(geometry, offset, { units: "meters" });
@@ -1893,7 +1600,7 @@ var getFeatureMarkerConfig = (feature2, mapConfig = {}) => {
1893
1600
  };
1894
1601
  };
1895
1602
  var createSpriteMaterialByLabelSymbol = (labelSymbol = []) => {
1896
- const material = new import_three5.SpriteMaterial();
1603
+ const material = new import_three4.SpriteMaterial();
1897
1604
  try {
1898
1605
  const [base, icon] = labelSymbol;
1899
1606
  const { markerWidth: baseWidth = 24 } = base;
@@ -1902,7 +1609,7 @@ var createSpriteMaterialByLabelSymbol = (labelSymbol = []) => {
1902
1609
  const baseSVG = createSVGPathFromMarkerSymbol(base);
1903
1610
  const iconSVG = createSVGPathFromMarkerSymbol(icon);
1904
1611
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${viewBoxDimension}" height="${viewBoxDimension}">${baseSVG}${iconSVG}</svg>`;
1905
- const textureLoader = new import_three5.TextureLoader();
1612
+ const textureLoader = new import_three4.TextureLoader();
1906
1613
  const scaleFactor = 200 / 24;
1907
1614
  svgToPng(svg, scaleFactor).then((png) => {
1908
1615
  const texture = textureLoader.load(png, () => {
@@ -2059,7 +1766,7 @@ var styledFeatureGenerator = (mapTheme) => {
2059
1766
  switch (renderType) {
2060
1767
  case "Logo":
2061
1768
  import_lodash4.default.set(priorityMarkerSymbol, "markerFile", logoUrl);
2062
- return new import_maptalks5.Marker(coordinates, {
1769
+ return new import_maptalks4.Marker(coordinates, {
2063
1770
  properties: {
2064
1771
  altitude: getAltitude(properties) + markerHeight,
2065
1772
  ...baseProperties
@@ -2067,7 +1774,7 @@ var styledFeatureGenerator = (mapTheme) => {
2067
1774
  symbol: priorityLabelSymbol
2068
1775
  });
2069
1776
  case "Logo + Name":
2070
- return new import_maptalks5.Marker(coordinates, {
1777
+ return new import_maptalks4.Marker(coordinates, {
2071
1778
  properties: {
2072
1779
  name: occupantName.en,
2073
1780
  altitude: getAltitude(properties) + markerHeight,
@@ -2087,7 +1794,7 @@ var styledFeatureGenerator = (mapTheme) => {
2087
1794
  }
2088
1795
  });
2089
1796
  case "None":
2090
- return new import_maptalks5.ui.UIMarker(coordinates, {
1797
+ return new import_maptalks4.ui.UIMarker(coordinates, {
2091
1798
  properties: { ...baseProperties },
2092
1799
  content: createStyledUIMarkerElement({
2093
1800
  style: { display: "none" },
@@ -2098,7 +1805,7 @@ var styledFeatureGenerator = (mapTheme) => {
2098
1805
  case "Name":
2099
1806
  default:
2100
1807
  if (textMarkerType === "marker") {
2101
- return new import_maptalks5.Marker(coordinates, {
1808
+ return new import_maptalks4.Marker(coordinates, {
2102
1809
  properties: {
2103
1810
  name: occupantName.en,
2104
1811
  altitude: getAltitude(properties) + markerHeight,
@@ -2128,7 +1835,7 @@ var styledFeatureGenerator = (mapTheme) => {
2128
1835
  `occupant-${import_lodash4.default.toLower(renderType)}-${renderPriority}`
2129
1836
  );
2130
1837
  const style = { ...uiMarkerSymbol, ...uiMarkerPrioritySymbol };
2131
- return new import_maptalks5.ui.UIMarker(coordinates, {
1838
+ return new import_maptalks4.ui.UIMarker(coordinates, {
2132
1839
  properties: { ...baseProperties },
2133
1840
  content: createStyledUIMarkerElement({
2134
1841
  style,
@@ -2205,7 +1912,7 @@ var styledFeatureGenerator = (mapTheme) => {
2205
1912
  const { geometry, properties } = feature2;
2206
1913
  const coordinates = getCenterFromGeometry(geometry);
2207
1914
  const markerSymbol = getElementSymbol("pin-marker");
2208
- return new import_maptalks5.Marker(coordinates, {
1915
+ return new import_maptalks4.Marker(coordinates, {
2209
1916
  properties: {
2210
1917
  altitude: getAltitude(properties)
2211
1918
  },
@@ -2220,7 +1927,7 @@ var styledFeatureGenerator = (mapTheme) => {
2220
1927
  const coordinates = getCenterFromGeometry(geometry);
2221
1928
  const markerSymbol = getElementSymbol("origin-marker");
2222
1929
  try {
2223
- return new import_maptalks5.Marker(coordinates, {
1930
+ return new import_maptalks4.Marker(coordinates, {
2224
1931
  properties: {
2225
1932
  altitude: getAltitude(properties)
2226
1933
  },
@@ -2242,7 +1949,7 @@ var styledFeatureGenerator = (mapTheme) => {
2242
1949
  const coordinates = getCenterFromGeometry(geometry);
2243
1950
  const symbol = getElementSymbol("pin-marker");
2244
1951
  try {
2245
- return new import_maptalks5.Marker(coordinates, {
1952
+ return new import_maptalks4.Marker(coordinates, {
2246
1953
  properties: {
2247
1954
  altitude: getAltitude(properties) + markerHeight
2248
1955
  },
@@ -2267,7 +1974,7 @@ var styledFeatureGenerator = (mapTheme) => {
2267
1974
  "highlighted-logo-marker"
2268
1975
  );
2269
1976
  try {
2270
- return new import_maptalks5.Marker(coordinates, {
1977
+ return new import_maptalks4.Marker(coordinates, {
2271
1978
  properties: {
2272
1979
  altitude: getAltitude(properties) + markerHeight
2273
1980
  },
@@ -2283,7 +1990,7 @@ var styledFeatureGenerator = (mapTheme) => {
2283
1990
  const { geometry, properties } = feature2;
2284
1991
  const coordinates = getCenterFromGeometry(geometry);
2285
1992
  const symbolStyle = getElementSymbol("user-location") || {};
2286
- const marker = new import_maptalks5.Marker(coordinates, {
1993
+ const marker = new import_maptalks4.Marker(coordinates, {
2287
1994
  properties: {
2288
1995
  altitude: getAltitude(properties),
2289
1996
  ordinal: properties.ordinal !== null ? properties.ordinal : null
@@ -2312,7 +2019,7 @@ var styledFeatureGenerator = (mapTheme) => {
2312
2019
  const coordinates = getCenterFromGeometry(geometry);
2313
2020
  const symbolStyle = getElementSymbol("last-user-location") || {};
2314
2021
  const options = getElementOptions("last-user-location") || {};
2315
- const marker = new import_maptalks5.Marker(coordinates, {
2022
+ const marker = new import_maptalks4.Marker(coordinates, {
2316
2023
  properties: {
2317
2024
  ...options,
2318
2025
  altitude: getAltitude(properties),
@@ -2344,14 +2051,14 @@ var styledFeatureGenerator = (mapTheme) => {
2344
2051
  const coordinates = import_lodash4.default.get(geometry, "coordinates");
2345
2052
  const logoUrl = import_lodash4.default.get(properties, "logo.url");
2346
2053
  if (markerSymbol) {
2347
- return new import_maptalks5.Marker(coordinates, {
2054
+ return new import_maptalks4.Marker(coordinates, {
2348
2055
  properties: markerProperties,
2349
2056
  symbol: markerSymbol
2350
2057
  });
2351
2058
  }
2352
2059
  if (!logoUrl) {
2353
2060
  const symbol = getElementSymbol("pin-marker");
2354
- return new import_maptalks5.Marker(coordinates, {
2061
+ return new import_maptalks4.Marker(coordinates, {
2355
2062
  properties: markerProperties,
2356
2063
  symbol
2357
2064
  });
@@ -2359,7 +2066,7 @@ var styledFeatureGenerator = (mapTheme) => {
2359
2066
  const labelSymbol = getLabelSymbol("highlight-occupant-logo");
2360
2067
  const priorityMarkerSymbol = import_lodash4.default.last(labelSymbol) || {};
2361
2068
  import_lodash4.default.set(priorityMarkerSymbol, "markerFile", logoUrl);
2362
- return new import_maptalks5.Marker(coordinates, {
2069
+ return new import_maptalks4.Marker(coordinates, {
2363
2070
  properties: markerProperties,
2364
2071
  symbol: labelSymbol
2365
2072
  });
@@ -2376,7 +2083,7 @@ var styledFeatureGenerator = (mapTheme) => {
2376
2083
  const kioskHeight = import_lodash4.default.get(kioskConfig, "height", 0);
2377
2084
  const markerHeight = unitHeight + kioskHeight;
2378
2085
  const symbol = getElementSymbol("highlight-amenity-marker");
2379
- return new import_maptalks5.Marker(coordinates, {
2086
+ return new import_maptalks4.Marker(coordinates, {
2380
2087
  properties: {
2381
2088
  ...feature2,
2382
2089
  altitude: markerHeight
@@ -2453,24 +2160,24 @@ var styledFeatureGenerator = (mapTheme) => {
2453
2160
  switch (geometry.type) {
2454
2161
  case "Point":
2455
2162
  return [
2456
- geometry?.getCoordinates ? geometry?.getCoordinates() : new import_maptalks5.Coordinate(geometry.coordinates)
2163
+ geometry?.getCoordinates ? geometry?.getCoordinates() : new import_maptalks4.Coordinate(geometry.coordinates)
2457
2164
  ];
2458
2165
  case "Polygon":
2459
2166
  return [
2460
- geometry?.getCenter ? geometry?.getCenter() : new import_maptalks5.Polygon(geometry.coordinates).getCenter()
2167
+ geometry?.getCenter ? geometry?.getCenter() : new import_maptalks4.Polygon(geometry.coordinates).getCenter()
2461
2168
  ];
2462
2169
  case "MultiPolygon":
2463
2170
  return [
2464
- geometry?.getCenter ? geometry?.getCenter() : new import_maptalks5.MultiPolygon(geometry.coordinates).getCenter()
2171
+ geometry?.getCenter ? geometry?.getCenter() : new import_maptalks4.MultiPolygon(geometry.coordinates).getCenter()
2465
2172
  ];
2466
2173
  case "LineString":
2467
2174
  default:
2468
- return geometry?.getCoordinates ? geometry?.getCoordinates() : new import_maptalks5.LineString(geometry.coordinates).getCoordinates();
2175
+ return geometry?.getCoordinates ? geometry?.getCoordinates() : new import_maptalks4.LineString(geometry.coordinates).getCoordinates();
2469
2176
  }
2470
2177
  }).flatten().value();
2471
2178
  const stepPathLineSymbol = getElementSymbol("navigation-path");
2472
2179
  const startPathSymbolMarker = getElementSymbol("navigation-path-start");
2473
- const line = new import_maptalks5.LineString(mergedCoordinates, {
2180
+ const line = new import_maptalks4.LineString(mergedCoordinates, {
2474
2181
  smoothness: 0.5,
2475
2182
  symbol: [...stepPathLineSymbol, startPathSymbolMarker]
2476
2183
  });
@@ -2511,115 +2218,23 @@ var styledFeatureGenerator = (mapTheme) => {
2511
2218
  };
2512
2219
  switch (type) {
2513
2220
  case "Polygon":
2514
- return new import_maptalks5.Polygon(coordinates, formattedProperties);
2221
+ return new import_maptalks4.Polygon(coordinates, formattedProperties);
2515
2222
  case "MultiPolygon":
2516
- return new import_maptalks5.MultiPolygon(coordinates, formattedProperties);
2223
+ return new import_maptalks4.MultiPolygon(coordinates, formattedProperties);
2517
2224
  case "LineString":
2518
- return new import_maptalks5.LineString(coordinates, formattedProperties);
2225
+ return new import_maptalks4.LineString(coordinates, formattedProperties);
2519
2226
  case "MultiLineString":
2520
- return new import_maptalks5.MultiLineString(coordinates, formattedProperties);
2227
+ return new import_maptalks4.MultiLineString(coordinates, formattedProperties);
2521
2228
  default:
2522
2229
  return null;
2523
2230
  }
2524
2231
  },
2525
- /** Three JS */
2526
- create3DFootprint: async (feature2, threeLayer, options) => {
2527
- const objects = [];
2528
- const extrudeHeight = import_lodash4.default.get(options, "height");
2529
- if (!extrudeHeight) return objects;
2530
- const { properties } = feature2;
2531
- const footprintProperties = getFeatureProperties(feature2);
2532
- const hasModel3ds = Array.isArray(properties.model3d) && properties.model3d.length > 0;
2533
- if (hasModel3ds) {
2534
- const models = properties.model3d;
2535
- const center2 = (0, import_center2.default)(feature2);
2536
- const coordinate = import_lodash4.default.get(center2, "geometry.coordinates");
2537
- for (const model of models) {
2538
- const object = await loadModel3d(model, coordinate, threeLayer);
2539
- object.properties = footprintProperties;
2540
- objects.push(object);
2541
- }
2542
- } else {
2543
- const color = footprintProperties.defaultColor;
2544
- if (color === "transparent") return;
2545
- const material = new import_three5.MeshLambertMaterial({
2546
- color,
2547
- transparent: true
2548
- });
2549
- const object = createExtrudePolygon(
2550
- feature2.geometry,
2551
- threeLayer,
2552
- material,
2553
- extrudeHeight,
2554
- footprintProperties,
2555
- {}
2556
- );
2557
- objects.push(object);
2558
- }
2559
- return objects;
2560
- },
2561
- create3DGroundLabel: (label, threeLayer) => {
2562
- const text = label.properties.name;
2563
- const bound = label.geometry.coordinates[0];
2564
- if (import_lodash4.default.isNil(bound)) throw new Error("Invalid coordinates");
2565
- const groundLabelSymbol = getElementSymbol("ground-label");
2566
- const featureSymbol = import_lodash4.default.get(label, "properties", {});
2567
- const groundLabelOptions = import_lodash4.default.merge(
2568
- {},
2569
- { text },
2570
- groundLabelSymbol,
2571
- featureSymbol
2572
- );
2573
- return new GroundLabel(bound, groundLabelOptions, threeLayer);
2574
- },
2575
- createOccupantGroundLabel: (feature2, location, mapConfig, threeLayer) => {
2576
- const text = feature2.properties.name.en;
2577
- const bound = location.geometry.coordinates[0];
2578
- if (import_lodash4.default.isNil(bound)) throw new Error("Invalid coordinates");
2579
- const groundLabelSymbol = getElementSymbol("occupant-flat-label");
2580
- const groundLabelOptions = getElementOptions("occupant-flat-label");
2581
- const baseAltitude = getAltitude(location.properties);
2582
- const extrudeHeight = import_lodash4.default.get(
2583
- mapConfig,
2584
- "extrudeConfig.unit.room.height",
2585
- 0
2586
- );
2587
- const totalAltitude = baseAltitude + extrudeHeight + 0.05;
2588
- const customAngle = import_lodash4.default.get(feature2, "properties.style.angle");
2589
- const offsetX = import_lodash4.default.get(feature2, "properties.style.offsetX", 0);
2590
- const offsetY = import_lodash4.default.get(feature2, "properties.style.offsetY", 0);
2591
- const featureSymbol = {
2592
- name: text,
2593
- ordinal: location.properties.ordinal,
2594
- venue_id: feature2.properties.venue_id
2595
- };
2596
- const mergedGroundLabelOptions = import_lodash4.default.merge(
2597
- {},
2598
- { text },
2599
- groundLabelSymbol,
2600
- groundLabelOptions,
2601
- featureSymbol,
2602
- {
2603
- altitude: totalAltitude,
2604
- offsetX,
2605
- offsetY,
2606
- // set custom angle
2607
- ...!import_lodash4.default.isNil(customAngle) ? { angle: customAngle } : {}
2608
- }
2609
- );
2610
- const groundLabel = new GroundLabel(
2611
- bound,
2612
- mergedGroundLabelOptions,
2613
- threeLayer
2614
- );
2615
- return groundLabel;
2616
- },
2617
2232
  create3DBillboard: (billboard, threeLayer) => {
2618
2233
  const { id, feature_type, properties } = billboard;
2619
2234
  const {
2620
2235
  logo,
2621
2236
  altitude,
2622
- scale: scale2,
2237
+ scale: scale3,
2623
2238
  alphaTest,
2624
2239
  legColor,
2625
2240
  showLeg,
@@ -2633,7 +2248,7 @@ var styledFeatureGenerator = (mapTheme) => {
2633
2248
  };
2634
2249
  const options = {
2635
2250
  altitude,
2636
- scale: scale2,
2251
+ scale: scale3,
2637
2252
  alphaTest,
2638
2253
  legColor,
2639
2254
  showLeg,
@@ -2767,15 +2382,15 @@ var styledFeatureGenerator = (mapTheme) => {
2767
2382
  };
2768
2383
  const color = unitProperty.defaultColor;
2769
2384
  if (color === "transparent") return;
2770
- const material = new import_three5.MeshLambertMaterial({
2385
+ const material = new import_three4.MeshLambertMaterial({
2771
2386
  color,
2772
2387
  transparent: true
2773
2388
  });
2774
2389
  if (unit.geometry.type === "LineString") {
2775
- const polygon = createPolygonFromLineString(unit.geometry);
2390
+ const polygon2 = createPolygonFromLineString(unit.geometry);
2776
2391
  const geometry = {
2777
2392
  type: "Polygon",
2778
- coordinates: polygon
2393
+ coordinates: polygon2
2779
2394
  };
2780
2395
  return createExtrudePolygon(
2781
2396
  geometry,
@@ -2877,9 +2492,9 @@ var getRelatedLocationsByAmenity = (feature2) => {
2877
2492
  var getRelatedLocationIdsByFeature = (feature2) => {
2878
2493
  switch (feature2?.feature_type) {
2879
2494
  case "amenity":
2880
- return getRelatedLocationsByAmenity(feature2).map((v) => v?.id);
2495
+ return getRelatedLocationsByAmenity(feature2).map((v2) => v2?.id);
2881
2496
  case "occupant":
2882
- return getRelatedLocationsByOccupant(feature2).map((v) => v?.id);
2497
+ return getRelatedLocationsByOccupant(feature2).map((v2) => v2?.id);
2883
2498
  default:
2884
2499
  return [];
2885
2500
  }
@@ -2924,47 +2539,8 @@ var getSuitablyValueBetweenBearings = (newBearing, currentBearing) => {
2924
2539
  return newBearing;
2925
2540
  };
2926
2541
 
2927
- // src/IndoorMap/utils/createHighlightElement.ts
2928
- var import_three6 = require("three");
2929
- var import_lodash5 = __toESM(require("lodash"));
2930
- var import_tween = __toESM(require("@tweenjs/tween.js"));
2931
- var DEFAULT_ALTITUDE_FACTOR = 0.5;
2932
- var createHighlighBillboardController = (obj, { altitudeFactor = DEFAULT_ALTITUDE_FACTOR } = {}) => {
2933
- const controller = { start: () => {
2934
- }, clear: () => {
2935
- } };
2936
- if (!(obj instanceof Billboard)) return controller;
2937
- const altitude = obj.properties.default.altitude;
2938
- const newAltitude = import_lodash5.default.clamp(altitude * altitudeFactor, 0, altitude);
2939
- const tween = new import_tween.default.Tween({ altitude }).to({ altitude: newAltitude }, 800).easing(import_tween.default.Easing.Quartic.Out).onUpdate((newUpdate) => {
2940
- obj.setLineHeight(newUpdate.altitude);
2941
- });
2942
- controller.start = () => {
2943
- tween.start();
2944
- };
2945
- controller.clear = () => {
2946
- tween.stop().to({ altitude }, 1600).startFromCurrentValues();
2947
- };
2948
- return controller;
2949
- };
2950
- var createHighlighExtrudeObjectController = (obj, { color }) => {
2951
- const controller = { start: () => {
2952
- }, clear: () => {
2953
- } };
2954
- if (obj?.type !== "ExtrudePolygon" || import_lodash5.default.isNil(obj?.object3d?.material?.color) || import_lodash5.default.isNil(color))
2955
- return controller;
2956
- controller.start = () => {
2957
- obj.object3d.material.color = new import_three6.Color(color);
2958
- };
2959
- controller.clear = () => {
2960
- const objectDefaultColor = import_lodash5.default.get(obj, "properties.defaultColor");
2961
- obj.object3d.material.color = new import_three6.Color(objectDefaultColor);
2962
- };
2963
- return controller;
2964
- };
2965
-
2966
2542
  // src/IndoorMap/camera/CameraManager.ts
2967
- var import_maptalks6 = require("maptalks");
2543
+ var import_maptalks5 = require("maptalks");
2968
2544
 
2969
2545
  // ../../node_modules/@turf/meta/dist/esm/index.js
2970
2546
  function coordEach(geojson, callback, excludeWrapCoord) {
@@ -3107,75 +2683,378 @@ var CameraManager = class {
3107
2683
  if (this.map && Object.keys(value).length !== 0) {
3108
2684
  this.map.setView(value);
3109
2685
  }
3110
- };
3111
- animateTo = (view, options = {}, step) => {
3112
- this.map.animateTo(view, options, step);
3113
- };
3114
- setMaxExtent(extent) {
3115
- return this.map.setMaxExtent(extent);
2686
+ };
2687
+ animateTo = (view, options = {}, step) => {
2688
+ this.map.animateTo(view, options, step);
2689
+ };
2690
+ setMaxExtent(extent) {
2691
+ return this.map.setMaxExtent(extent);
2692
+ }
2693
+ getFeatureExtent = (feature2, scaleFactor = 1) => {
2694
+ const [minX, minY, maxX, maxY] = index_default(
2695
+ (0, import_transform_scale.default)((0, import_bbox_polygon.default)(index_default(feature2)), scaleFactor)
2696
+ );
2697
+ return new import_maptalks5.Extent(minX, minY, maxX, maxY);
2698
+ };
2699
+ getExtentZoom = (extent, options = {
2700
+ isFraction: false,
2701
+ padding: {
2702
+ paddingLeft: 0,
2703
+ paddingRight: 0,
2704
+ paddingTop: 0,
2705
+ paddingBottom: 0
2706
+ }
2707
+ }) => {
2708
+ const { isFraction = false, padding } = options;
2709
+ return this.map.getFitZoom(extent, isFraction, padding);
2710
+ };
2711
+ set maxZoom(value) {
2712
+ this.map.setMaxZoom(value);
2713
+ const spatialReference = {
2714
+ projection: "EPSG:3857",
2715
+ resolutions: (function() {
2716
+ const resolutions = [];
2717
+ const d = 2 * 6378137 * Math.PI;
2718
+ for (let i = 0; i < value; i++) {
2719
+ resolutions[i] = d / (256 * Math.pow(2, i));
2720
+ }
2721
+ return resolutions;
2722
+ })()
2723
+ };
2724
+ this.map.setSpatialReference(spatialReference);
2725
+ }
2726
+ set minZoom(value) {
2727
+ this.map.setMinZoom(value);
2728
+ }
2729
+ };
2730
+
2731
+ // src/IndoorMap/renderer/RendererManager.ts
2732
+ var import_lodash_es3 = require("lodash-es");
2733
+ var import_center3 = require("@turf/center");
2734
+ var THREE3 = __toESM(require("three"));
2735
+
2736
+ // src/IndoorMap/renderer/3d/Element3DRenderer.ts
2737
+ var maptalks4 = __toESM(require("maptalks-gl"));
2738
+ var THREE = __toESM(require("three"));
2739
+ var import_maptalks7 = require("maptalks.three");
2740
+ var import_buffer2 = __toESM(require("@turf/buffer"));
2741
+ var import_clean_coords = require("@turf/clean-coords");
2742
+ var import_polygon_to_line = require("@turf/polygon-to-line");
2743
+ var import_nearest_point_on_line = require("@turf/nearest-point-on-line");
2744
+ var import_length = require("@turf/length");
2745
+ var import_along = require("@turf/along");
2746
+ var import_point_to_line_distance = require("@turf/point-to-line-distance");
2747
+
2748
+ // src/IndoorMap/renderer/3d/objects/GroundLabel.ts
2749
+ var maptalks3 = __toESM(require("maptalks-gl"));
2750
+ var import_maptalks6 = require("maptalks.three");
2751
+ var import_three5 = require("three");
2752
+ var import_d3plus_shape = require("d3plus-shape");
2753
+ var import_lodash_es2 = require("lodash-es");
2754
+ var OPTIONS3 = {
2755
+ // Allowing click through and prevent interaction
2756
+ interactive: false,
2757
+ altitude: 0
2758
+ };
2759
+ var defaultFlatLabelOptions = {
2760
+ fontSize: 14,
2761
+ fontFamily: "Manrope",
2762
+ fontWeight: 600,
2763
+ margin: 0,
2764
+ scaleMin: 0.5,
2765
+ lineHeight: 1.05,
2766
+ scaleStep: 0.05,
2767
+ textAlign: "center",
2768
+ textBaseline: "middle",
2769
+ fillStyle: "#000"
2770
+ };
2771
+ var defaultRectAngleToCalc = (0, import_lodash_es2.range)(-90, 92, 2);
2772
+ var getMaterial = (text, flatLabelOptions) => {
2773
+ const options = (0, import_lodash_es2.merge)({}, defaultFlatLabelOptions, flatLabelOptions);
2774
+ const {
2775
+ fontSize: initialFontSize,
2776
+ fontFamily,
2777
+ fontWeight,
2778
+ margin,
2779
+ scaleMin,
2780
+ scaleStep,
2781
+ fillStyle,
2782
+ lineHeight,
2783
+ textAlign,
2784
+ strokeStyle,
2785
+ lineWidth,
2786
+ textBaseline
2787
+ } = options;
2788
+ const pixelMultiplier = 4;
2789
+ const SIZE = 100 * pixelMultiplier;
2790
+ const fontSize = initialFontSize * (pixelMultiplier * 1.25);
2791
+ const canvas = document.createElement("canvas");
2792
+ canvas.width = canvas.height = SIZE;
2793
+ const ctx = canvas.getContext("2d");
2794
+ ctx.font = `${fontWeight} ${fontSize}px "${fontFamily}", Arial`;
2795
+ ctx.textAlign = textAlign;
2796
+ ctx.textBaseline = textBaseline;
2797
+ ctx.fillStyle = fillStyle;
2798
+ ctx.strokeStyle = strokeStyle;
2799
+ ctx.lineWidth = lineWidth;
2800
+ const wrapText = (ctx2, text2, maxWidth) => {
2801
+ const words = text2.trim().split(/\s+/);
2802
+ if (words.length <= 1) return [text2];
2803
+ const lines = [];
2804
+ const MAX_LINES = 3;
2805
+ let currentLine = words[0];
2806
+ for (let i = 1; i < words.length; i++) {
2807
+ const lineToMeasure = currentLine + " " + words[i];
2808
+ if (ctx2.measureText(lineToMeasure).width > maxWidth) {
2809
+ lines.push(currentLine);
2810
+ currentLine = words[i];
2811
+ } else {
2812
+ currentLine = lineToMeasure;
2813
+ }
2814
+ }
2815
+ lines.push(currentLine);
2816
+ return lines.slice(0, MAX_LINES);
2817
+ };
2818
+ const hasManualBreaks = text.includes("\n");
2819
+ let texts;
2820
+ if (hasManualBreaks) {
2821
+ texts = text.split(/\n/g);
2822
+ } else {
2823
+ const maxWidth = SIZE - 2 * margin;
2824
+ texts = wrapText(ctx, text, maxWidth);
2825
+ }
2826
+ let textWidth = (0, import_lodash_es2.max)(texts.map((text2) => ctx.measureText(text2).width));
2827
+ let scale3 = 1;
2828
+ while (scale3 > 0 && textWidth + 2 * margin > SIZE) {
2829
+ scale3 -= scaleStep;
2830
+ ctx.font = `${fontWeight} ${scale3 * fontSize}px "${fontFamily}", Arial`;
2831
+ textWidth = (0, import_lodash_es2.max)(texts.map((text2) => ctx.measureText(text2).width));
2832
+ }
2833
+ const center2 = { x: 0.5 * SIZE, y: 0.5 * SIZE };
2834
+ if (scale3 > scaleMin) {
2835
+ const totalHeight = texts.length * (fontSize * scale3 * lineHeight);
2836
+ const startY = center2.y - totalHeight / 2 + fontSize * scale3 * lineHeight * 0.5;
2837
+ texts.forEach((text2, index) => {
2838
+ const yOffset = startY + index * (fontSize * scale3 * lineHeight);
2839
+ if (strokeStyle && lineWidth) {
2840
+ ctx.strokeText(text2, center2.x, yOffset);
2841
+ }
2842
+ ctx.fillText(text2, center2.x, yOffset);
2843
+ });
2844
+ }
2845
+ const texture = new import_three5.Texture(canvas);
2846
+ texture.needsUpdate = true;
2847
+ const material = new import_three5.MeshPhongMaterial({
2848
+ map: texture,
2849
+ transparent: true,
2850
+ // @ref: https://threejs.org/docs/#api/en/materials/Material.alphaTest
2851
+ alphaTest: 0.3
2852
+ });
2853
+ return material;
2854
+ };
2855
+ var GroundLabel = class extends import_maptalks6.BaseObject {
2856
+ #angle = 0;
2857
+ #bearing = 0;
2858
+ #text = "";
2859
+ #offsetX = 0;
2860
+ #offsetY = 0;
2861
+ #originalPosition = null;
2862
+ #layer = null;
2863
+ constructor(bound, text, options, layer) {
2864
+ options = maptalks3.Util.extend({}, OPTIONS3, options, {
2865
+ layer,
2866
+ coordinate: bound
2867
+ });
2868
+ const {
2869
+ altitude = 0,
2870
+ bottomHeight = 0,
2871
+ fontSize,
2872
+ fillStyle,
2873
+ textAlign,
2874
+ fontFamily,
2875
+ textBaseline,
2876
+ strokeStyle,
2877
+ lineWidth,
2878
+ angle = defaultRectAngleToCalc,
2879
+ maxFontScale,
2880
+ offsetX = 0,
2881
+ offsetY = 0,
2882
+ ...properties
2883
+ } = options;
2884
+ super();
2885
+ this._initOptions(options);
2886
+ this.properties = properties;
2887
+ this.#offsetX = offsetX;
2888
+ this.#offsetY = offsetY;
2889
+ this.#layer = layer;
2890
+ const material = getMaterial(text, {
2891
+ fillStyle,
2892
+ fontSize,
2893
+ textAlign,
2894
+ textBaseline,
2895
+ fontFamily,
2896
+ strokeStyle,
2897
+ lineWidth
2898
+ });
2899
+ const rectAngles = (0, import_lodash_es2.isArray)(angle) ? angle : [angle];
2900
+ material.needsUpdate = true;
2901
+ const rect = (0, import_d3plus_shape.largestRect)(bound, {
2902
+ cache: true,
2903
+ /**
2904
+ * Black magic here:
2905
+ * For some reason if we allow angle -90 or 90, some polygon will use that angle even if it's wrong angle to use.
2906
+ * So we remove -90 and 90 from choices, and use -85 & 85 instead.
2907
+ */
2908
+ angle: rectAngles
2909
+ });
2910
+ const { cx, cy, width, angle: calculatedAngle } = rect;
2911
+ this.#text = text;
2912
+ this.#angle = calculatedAngle;
2913
+ const geometry = new import_three5.PlaneGeometry(1, 1);
2914
+ this._createMesh(geometry, material);
2915
+ const z = layer.altitudeToVector3(altitude + bottomHeight, altitude + bottomHeight).x;
2916
+ const basePosition = layer.coordinateToVector3([cx, cy], z);
2917
+ this.#originalPosition = basePosition.clone();
2918
+ const finalPosition = this.#calculateFinalPosition(basePosition);
2919
+ const scale3 = width / 6456122659e-13;
2920
+ const finalScale = maxFontScale && scale3 > maxFontScale ? maxFontScale : scale3;
2921
+ this.getObject3d().scale.set(finalScale, finalScale, finalScale);
2922
+ this.getObject3d().position.copy(finalPosition);
2923
+ this.getObject3d().rotation.z = Math.PI / 180 * this.#angle;
2924
+ }
2925
+ #calculateFinalPosition(basePosition) {
2926
+ if (this.#offsetX === 0 && this.#offsetY === 0) {
2927
+ return basePosition;
2928
+ }
2929
+ const offsetCoordinate = [this.#offsetX, this.#offsetY];
2930
+ const z = this.#layer.altitudeToVector3(0, 0).x;
2931
+ const offsetVector = this.#layer.coordinateToVector3(offsetCoordinate, z);
2932
+ const zeroVector = this.#layer.coordinateToVector3([0, 0], z);
2933
+ const worldOffsetX = offsetVector.x - zeroVector.x;
2934
+ const worldOffsetY = offsetVector.y - zeroVector.y;
2935
+ return {
2936
+ x: basePosition.x + worldOffsetX,
2937
+ y: basePosition.y + worldOffsetY,
2938
+ z: basePosition.z
2939
+ };
2940
+ }
2941
+ #updatePosition() {
2942
+ if (this.#originalPosition && this.#layer) {
2943
+ const finalPosition = this.#calculateFinalPosition(this.#originalPosition);
2944
+ this.getObject3d().position.copy(finalPosition);
2945
+ }
2946
+ }
2947
+ set bearing(value) {
2948
+ this.#bearing = value;
2949
+ const degree = this.#angle + this.#bearing;
2950
+ const angle = degree > 90 || degree < -90 ? this.#angle + 180 : this.#angle;
2951
+ this.getObject3d().rotation.z = Math.PI / 180 * angle;
2952
+ }
2953
+ get angle() {
2954
+ return this.#angle;
2955
+ }
2956
+ get currentAngle() {
2957
+ return this.#angle;
2958
+ }
2959
+ get text() {
2960
+ return this.#text;
2961
+ }
2962
+ get offsetX() {
2963
+ return this.#offsetX;
2964
+ }
2965
+ get offsetY() {
2966
+ return this.#offsetY;
2967
+ }
2968
+ get offset() {
2969
+ return { x: this.#offsetX, y: this.#offsetY };
2970
+ }
2971
+ set offsetX(value) {
2972
+ if ((0, import_lodash_es2.isNumber)(value)) {
2973
+ this.#offsetX = value;
2974
+ this.#updatePosition();
2975
+ }
2976
+ }
2977
+ set offsetY(value) {
2978
+ if ((0, import_lodash_es2.isNumber)(value)) {
2979
+ this.#offsetY = value;
2980
+ this.#updatePosition();
2981
+ }
2982
+ }
2983
+ set angle(newAngle) {
2984
+ if ((0, import_lodash_es2.isNumber)(newAngle)) {
2985
+ this.#angle = newAngle;
2986
+ this.getObject3d().rotation.z = Math.PI / 180 * this.#angle;
2987
+ }
2988
+ }
2989
+ setOffset(offsetX, offsetY) {
2990
+ if ((0, import_lodash_es2.isNumber)(offsetX) && (0, import_lodash_es2.isNumber)(offsetY)) {
2991
+ this.#offsetX = offsetX;
2992
+ this.#offsetY = offsetY;
2993
+ this.#updatePosition();
2994
+ }
2995
+ }
2996
+ addOffset(deltaX, deltaY) {
2997
+ if ((0, import_lodash_es2.isNumber)(deltaX) && (0, import_lodash_es2.isNumber)(deltaY)) {
2998
+ this.#offsetX += deltaX;
2999
+ this.#offsetY += deltaY;
3000
+ this.#updatePosition();
3001
+ }
3116
3002
  }
3117
- getFeatureExtent = (feature2, scaleFactor = 1) => {
3118
- const [minX, minY, maxX, maxY] = index_default(
3119
- (0, import_transform_scale.default)((0, import_bbox_polygon.default)(index_default(feature2)), scaleFactor)
3120
- );
3121
- return new import_maptalks6.Extent(minX, minY, maxX, maxY);
3122
- };
3123
- getExtentZoom = (extent, options = {
3124
- isFraction: false,
3125
- padding: {
3126
- paddingLeft: 0,
3127
- paddingRight: 0,
3128
- paddingTop: 0,
3129
- paddingBottom: 0
3003
+ resetOffset() {
3004
+ this.#offsetX = 0;
3005
+ this.#offsetY = 0;
3006
+ this.#updatePosition();
3007
+ }
3008
+ moveToPosition(targetX, targetY) {
3009
+ if (this.#originalPosition && this.#layer) {
3010
+ const currentCenter = this.#layer.vector3ToCoordinate(
3011
+ this.#originalPosition
3012
+ );
3013
+ this.#offsetX = targetX - currentCenter.x;
3014
+ this.#offsetY = targetY - currentCenter.y;
3015
+ this.#updatePosition();
3130
3016
  }
3131
- }) => {
3132
- const { isFraction = false, padding } = options;
3133
- return this.map.getFitZoom(extent, isFraction, padding);
3134
- };
3135
- set maxZoom(value) {
3136
- this.map.setMaxZoom(value);
3137
- const spatialReference = {
3138
- projection: "EPSG:3857",
3139
- resolutions: (function() {
3140
- const resolutions = [];
3141
- const d = 2 * 6378137 * Math.PI;
3142
- for (let i = 0; i < value; i++) {
3143
- resolutions[i] = d / (256 * Math.pow(2, i));
3144
- }
3145
- return resolutions;
3146
- })()
3017
+ }
3018
+ updateText(newText, options = {}) {
3019
+ this.#text = newText;
3020
+ const materialOptions = {
3021
+ fillStyle: options.fillStyle || this.properties.fillStyle,
3022
+ fontSize: options.fontSize || this.properties.fontSize,
3023
+ textAlign: options.textAlign || this.properties.textAlign,
3024
+ textBaseline: options.textBaseline || this.properties.textBaseline,
3025
+ fontFamily: options.fontFamily || this.properties.fontFamily,
3026
+ strokeStyle: options.strokeStyle || this.properties.strokeStyle,
3027
+ lineWidth: options.lineWidth || this.properties.lineWidth
3147
3028
  };
3148
- this.map.setSpatialReference(spatialReference);
3029
+ const newMaterial = getMaterial(newText, materialOptions);
3030
+ this.getObject3d().material = newMaterial;
3031
+ newMaterial.needsUpdate = true;
3149
3032
  }
3150
- set minZoom(value) {
3151
- this.map.setMinZoom(value);
3033
+ _animation() {
3034
+ const map = this.getMap();
3035
+ if (!map) return;
3036
+ const bearing = map.getBearing();
3037
+ this.bearing = bearing;
3038
+ }
3039
+ // Add bottomHeight to altitude as final altitude position
3040
+ setAltitude(altitude) {
3041
+ const bottomHeight = this.options.bottomHeight ?? 0;
3042
+ return super.setAltitude(altitude + bottomHeight);
3152
3043
  }
3153
3044
  };
3154
3045
 
3155
- // src/IndoorMap/renderer/RendererManager.ts
3156
- var import_isFunction = __toESM(require("lodash/isFunction"));
3157
- var import_min = __toESM(require("lodash/min"));
3158
- var import_center3 = require("@turf/center");
3159
- var THREE3 = __toESM(require("three"));
3160
-
3161
- // src/IndoorMap/renderer/3d/Element3DRenderer.ts
3162
- var maptalks4 = __toESM(require("maptalks-gl"));
3163
- var THREE = __toESM(require("three"));
3164
- var import_maptalks7 = require("maptalks.three");
3165
- var import_buffer2 = __toESM(require("@turf/buffer"));
3166
-
3167
3046
  // src/IndoorMap/renderer/3d/element3DRendererOptions.ts
3168
3047
  var element3DRendererOptions = {
3169
3048
  unit: {
3170
- default: { color: "#ffffff", height: 4 },
3049
+ default: { color: "#ffffff", height: 0.2 },
3171
3050
  byCategory: {
3172
3051
  walkway: { color: "#cccccc", height: 0.1 },
3173
3052
  terrace: { color: "#cccccc", height: 0.1 },
3174
3053
  unenclosedarea: { color: "#cccccc", height: 0.2 },
3175
3054
  nonpublic: { color: "#999999", height: 0.3 },
3176
3055
  escalator: { height: 0.2 },
3177
- parking: { height: 0.1 },
3178
- room: { color: "#ffffff", height: 2, bottomHeight: 0.12 }
3056
+ parking: { color: "#999999", height: 0.1 },
3057
+ room: { color: "#ffffff", height: 0.5, bottomHeight: 0.12 }
3179
3058
  }
3180
3059
  },
3181
3060
  kiosk: {
@@ -3185,35 +3064,37 @@ var element3DRendererOptions = {
3185
3064
  default: { color: "#ffffff", height: 0.5 },
3186
3065
  byCategory: {
3187
3066
  water: { color: "#ACD7EC", height: 0.1 },
3188
- vegetation: { color: "#91C499", height: 0.5 }
3067
+ vegetation: { color: "#91C499", height: 0.5 },
3068
+ wall: { color: "#787878", topColor: "#ffffff", height: 4.2, width: 1 }
3189
3069
  }
3190
3070
  }
3191
3071
  };
3192
3072
 
3193
- // src/IndoorMap/renderer/3d/Element3DRenderer.ts
3073
+ // src/IndoorMap/renderer/3d/utils/get3DRendererOption.ts
3194
3074
  var DEFAULT_POLYGON_OPTION = {
3195
3075
  color: "#FFFFFF",
3196
3076
  offset: 0,
3197
3077
  altitude: 0
3198
3078
  };
3199
- var HEIGHT_METER = 4;
3200
- var MULTIORDINAL_HEIGHT_METER = 9;
3201
- var getGeometryOption = (feature2, options) => {
3079
+ var get3DRendererOption = (featureType, category, options) => {
3202
3080
  try {
3203
- const option = options[feature2.feature_type] ?? element3DRendererOptions[feature2.feature_type];
3204
- const category = feature2.properties.category;
3081
+ const option = options[featureType] ?? element3DRendererOptions[featureType];
3205
3082
  return (category && option.byCategory?.[category]) ?? option?.default ?? DEFAULT_POLYGON_OPTION;
3206
3083
  } catch (err) {
3207
- console.log(err.message, { options, feature: feature2 });
3084
+ console.log(err.message, { options, featureType, category });
3208
3085
  }
3209
3086
  };
3087
+
3088
+ // src/IndoorMap/renderer/3d/Element3DRenderer.ts
3089
+ var import_line_split = __toESM(require("@turf/line-split"));
3090
+ var HEIGHT_METER = 4;
3091
+ var MULTIORDINAL_HEIGHT_METER = 9;
3210
3092
  var Element3DRenderer = class extends EventTarget {
3211
3093
  options;
3212
3094
  map;
3213
3095
  gltfLayer;
3214
3096
  threeLayer;
3215
3097
  scene;
3216
- // private dracoLoader: DRACOLoader
3217
3098
  lineMaterial;
3218
3099
  materialByColorMap;
3219
3100
  // Renderer is Ready
@@ -3252,7 +3133,7 @@ var Element3DRenderer = class extends EventTarget {
3252
3133
  bottomHeight: bottomHeightOptions,
3253
3134
  color: colorOptions,
3254
3135
  ...options
3255
- } = getGeometryOption(feature2, this.options);
3136
+ } = get3DRendererOption(feature2.feature_type, feature2.properties.category, this.options);
3256
3137
  const _this = this;
3257
3138
  const createPolygon = (geometry, feature3) => {
3258
3139
  try {
@@ -3292,6 +3173,20 @@ var Element3DRenderer = class extends EventTarget {
3292
3173
  return [];
3293
3174
  }
3294
3175
  };
3176
+ const createLineString = (geometry, feature3) => {
3177
+ try {
3178
+ const color = feature3.properties.style.polygonFill ?? colorOptions ?? "#000000";
3179
+ const material = this.getOrCreateMaterialByColor(color);
3180
+ const extrudedLine = this.threeLayer.toExtrudeLine(
3181
+ new maptalks4.LineString(geometry.coordinates),
3182
+ { height: heightOptions, ...options },
3183
+ material
3184
+ );
3185
+ return [extrudedLine];
3186
+ } catch (err) {
3187
+ return [];
3188
+ }
3189
+ };
3295
3190
  try {
3296
3191
  switch (feature2.geometry.type) {
3297
3192
  case "MultiPolygon": {
@@ -3311,11 +3206,80 @@ var Element3DRenderer = class extends EventTarget {
3311
3206
  this.threeLayer.addMesh(meshes);
3312
3207
  return meshes;
3313
3208
  }
3209
+ case "LineString": {
3210
+ const { coordinates } = feature2.geometry;
3211
+ if (!coordinates) return [];
3212
+ const meshes = createLineString(feature2.geometry, feature2);
3213
+ this.threeLayer.addMesh(meshes);
3214
+ return meshes;
3215
+ }
3314
3216
  }
3315
3217
  } catch (err) {
3316
3218
  console.log(`error createGeometry`, err, { feature: feature2, options });
3317
3219
  }
3318
3220
  };
3221
+ createRoomWall(unit, openings = []) {
3222
+ const polygons = unit.geometry.type === "Polygon" ? [unit.geometry.coordinates] : unit.geometry.coordinates;
3223
+ return polygons.map((plg) => {
3224
+ return plg.map((ring) => {
3225
+ const roomWall = (0, import_clean_coords.cleanCoords)((0, import_polygon_to_line.polygonToLine)(polygon([ring])));
3226
+ if (openings.length === 0) {
3227
+ const color = "#ababab";
3228
+ const material = this.getOrCreateMaterialByColor(color);
3229
+ const extrudedWall = this.threeLayer.toExtrudeLine(
3230
+ new maptalks4.LineString(roomWall.geometry.coordinates),
3231
+ { height: 4, width: 1 },
3232
+ material
3233
+ );
3234
+ return extrudedWall;
3235
+ }
3236
+ let openingPoints = [];
3237
+ openings.forEach((opening) => {
3238
+ const doorCoords = opening?.geometry?.coordinates;
3239
+ const p0 = point(doorCoords[0]);
3240
+ const p1 = point(doorCoords[doorCoords.length - 1]);
3241
+ const s0 = (0, import_nearest_point_on_line.nearestPointOnLine)(roomWall, p0, { units: "meters" });
3242
+ const s1 = (0, import_nearest_point_on_line.nearestPointOnLine)(roomWall, p1, { units: "meters" });
3243
+ const d0 = s0.properties.dist;
3244
+ const d1 = s1.properties.dist;
3245
+ if (d0 > 1 || d1 > 1) {
3246
+ } else {
3247
+ openingPoints = openingPoints.concat([s0.geometry.coordinates, s1.geometry.coordinates]);
3248
+ }
3249
+ });
3250
+ try {
3251
+ const split = (0, import_line_split.default)(roomWall, multiPoint(openingPoints));
3252
+ const wallsOnly = split.features.filter((seg) => {
3253
+ const mid = (0, import_along.along)(seg, (0, import_length.length)(seg, { units: "meters" }) / 2, { units: "meters" });
3254
+ for (const opening of openings) {
3255
+ const dist = (0, import_point_to_line_distance.pointToLineDistance)(mid, opening, { units: "meters" });
3256
+ if (dist < 0.05) return false;
3257
+ }
3258
+ return true;
3259
+ });
3260
+ const wallMeshes = wallsOnly.map((feature2, i) => {
3261
+ const color = "#ababab";
3262
+ const material = this.getOrCreateMaterialByColor(color);
3263
+ const extrudedLine = this.threeLayer.toExtrudeLine(
3264
+ new maptalks4.LineString(feature2.geometry.coordinates),
3265
+ { height: 3, width: 0.4, id: unit.id },
3266
+ material
3267
+ );
3268
+ extrudedLine.getObject3d().userData = {
3269
+ unitId: unit.id,
3270
+ coords: feature2.geometry.coordinates
3271
+ };
3272
+ return extrudedLine;
3273
+ }).flat();
3274
+ this.threeLayer.addMesh(wallMeshes);
3275
+ return wallMeshes;
3276
+ } catch (e) {
3277
+ console.log(e.message, { unit, roomWall });
3278
+ return [];
3279
+ }
3280
+ }).flat();
3281
+ }).flat();
3282
+ }
3319
3283
  async createEscalator(f, coordinate, options) {
3320
3284
  const model = {
3321
3285
  url: "https://cdn.venue.in.th/static/glb/escalator.glb",
@@ -3335,14 +3299,24 @@ var Element3DRenderer = class extends EventTarget {
3335
3299
  escalatorMarker.addTo(this.gltfLayer);
3336
3300
  return escalatorMarker;
3337
3301
  }
3338
- async createTree(coordinate, ordinal) {
3339
- const treeMarker = new maptalks4.GLTFMarker(coordinate, {
3302
+ // Note: Move to another renderer and keep this file on Geometry only?
3303
+ createGroundLabel(f, unit) {
3304
+ const text = f.properties.name;
3305
+ const bound = f.geometry.coordinates[0];
3306
+ const { height: unitHeight } = get3DRendererOption("unit", unit.properties.category, this.options);
3307
+ const options = { bottomHeight: unitHeight + 5e-3 };
3308
+ const groundLabel = new GroundLabel(bound, text, options, this.threeLayer);
3309
+ this.threeLayer.addMesh(groundLabel);
3310
+ return groundLabel;
3311
+ }
3312
+ async createModel3d(f) {
3313
+ const marker = new maptalks4.GLTFMarker(f.properties.center, {
3340
3314
  symbol: {
3341
- url: "https://dashboard.situm.com/uploads/3dmodels/demoaccount/new_escalator.glb"
3315
+ url: f.properties.model
3342
3316
  }
3343
3317
  });
3344
- treeMarker.addTo(this.gltfLayer);
3345
- return treeMarker;
3318
+ marker.addTo(this.gltfLayer);
3319
+ return marker;
3346
3320
  }
3347
3321
  async createBuilding(coordinate, ordinal) {
3348
3322
  return Promise.resolve(null);
@@ -3373,7 +3347,8 @@ var Element3DRenderer = class extends EventTarget {
3373
3347
  return null;
3374
3348
  }
3375
3349
  switch (element.type) {
3376
- case "ExtrudePolygon": {
3350
+ case "ExtrudePolygon":
3351
+ case "ExtrudeLine": {
3377
3352
  const mesh = element.getObject3d();
3378
3353
  const originalMaterial = mesh.material;
3379
3354
  const highlightMaterial = this.getOrCreateMaterialByColor("#ff0000");
@@ -3454,7 +3429,7 @@ var getGeometryProperties = (feature2) => ({
3454
3429
  category: feature2.properties.category,
3455
3430
  name: feature2.properties.name?.en
3456
3431
  });
3457
- var getGeometryOption2 = (feature2, options) => {
3432
+ var getGeometryOption = (feature2, options) => {
3458
3433
  try {
3459
3434
  const option = options[feature2.feature_type] ?? element2DRendererOptions[feature2.feature_type];
3460
3435
  const category = feature2.properties.category;
@@ -3481,7 +3456,7 @@ var Element2DRenderer = class extends EventTarget {
3481
3456
  }
3482
3457
  createGeometry = (imdfFeature) => {
3483
3458
  const feature2 = getGeometryProperties(imdfFeature);
3484
- const { symbol, ...options } = getGeometryOption2(imdfFeature, this.options);
3459
+ const { symbol, ...options } = getGeometryOption(imdfFeature, this.options);
3485
3460
  const altitude = feature2.properties.ordinal * 10;
3486
3461
  const geometry = maptalks5.Geometry.fromJSON({
3487
3462
  feature: feature2,
@@ -3500,11 +3475,16 @@ var Element2DRenderer = class extends EventTarget {
3500
3475
  return geometry;
3501
3476
  }
3502
3477
  };
3478
+ createRoomWall(unit, openings) {
3479
+ return null;
3480
+ }
3503
3481
  async createEscalator(f, coordinates) {
3504
3482
  return Promise.resolve(null);
3505
3483
  }
3506
- async createTree(coordinates) {
3507
- return Promise.resolve(null);
3484
+ createGroundLabel(f, unit) {
3485
+ const text = f.properties.name;
3486
+ const bound = f.geometry.coordinates[0];
3487
+ return null;
3508
3488
  }
3509
3489
  async createBuilding(coordinate, ordinal) {
3510
3490
  return Promise.resolve(null);
@@ -3573,7 +3553,7 @@ var maptalks7 = __toESM(require("maptalks-gl"));
3573
3553
  var import_maptalks8 = require("maptalks");
3574
3554
  var THREE2 = __toESM(require("three"));
3575
3555
  var import_maptalks9 = require("maptalks.three");
3576
- var import_lodash6 = require("lodash");
3556
+ var import_lodash5 = require("lodash");
3577
3557
 
3578
3558
  // src/IndoorMap/renderer/utils/interpolateStops.ts
3579
3559
  var interpolateStops = ({ stops }, zoom) => {
@@ -3668,7 +3648,7 @@ var TextSpriteMarker = class extends import_maptalks9.BaseObject {
3668
3648
  const paragraphs = String(text).split("\n");
3669
3649
  const wrappedLines = [];
3670
3650
  paragraphs.forEach((paragraph) => {
3671
- if ((0, import_lodash6.isNil)(maxWidth) || isNaN(maxWidth)) {
3651
+ if ((0, import_lodash5.isNil)(maxWidth) || isNaN(maxWidth)) {
3672
3652
  wrappedLines.push(paragraph);
3673
3653
  return;
3674
3654
  }
@@ -3729,7 +3709,7 @@ var TextSpriteMarker = class extends import_maptalks9.BaseObject {
3729
3709
  const altitude = (options.altitude || 0) + this.#altitudeOffset;
3730
3710
  const z = layer.altitudeToVector3(altitude, altitude).x;
3731
3711
  const position = layer.coordinateToVector3(this._coordinate, z);
3732
- (0, import_lodash6.set)(this.properties, "default.position", position);
3712
+ (0, import_lodash5.set)(this.properties, "default.position", position);
3733
3713
  this.getObject3d().position.copy(position);
3734
3714
  }
3735
3715
  _animation() {
@@ -3869,6 +3849,479 @@ var angleBetweenLineStrings = (line1, line2) => {
3869
3849
  return Math.atan2(dy, dx);
3870
3850
  };
3871
3851
 
3852
+ // ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/util.js
3853
+ var epsilon = 11102230246251565e-32;
3854
+ var splitter = 134217729;
3855
+ var resulterrbound = (3 + 8 * epsilon) * epsilon;
3856
+ function sum(elen, e, flen, f, h) {
3857
+ let Q, Qnew, hh, bvirt;
3858
+ let enow = e[0];
3859
+ let fnow = f[0];
3860
+ let eindex = 0;
3861
+ let findex = 0;
3862
+ if (fnow > enow === fnow > -enow) {
3863
+ Q = enow;
3864
+ enow = e[++eindex];
3865
+ } else {
3866
+ Q = fnow;
3867
+ fnow = f[++findex];
3868
+ }
3869
+ let hindex = 0;
3870
+ if (eindex < elen && findex < flen) {
3871
+ if (fnow > enow === fnow > -enow) {
3872
+ Qnew = enow + Q;
3873
+ hh = Q - (Qnew - enow);
3874
+ enow = e[++eindex];
3875
+ } else {
3876
+ Qnew = fnow + Q;
3877
+ hh = Q - (Qnew - fnow);
3878
+ fnow = f[++findex];
3879
+ }
3880
+ Q = Qnew;
3881
+ if (hh !== 0) {
3882
+ h[hindex++] = hh;
3883
+ }
3884
+ while (eindex < elen && findex < flen) {
3885
+ if (fnow > enow === fnow > -enow) {
3886
+ Qnew = Q + enow;
3887
+ bvirt = Qnew - Q;
3888
+ hh = Q - (Qnew - bvirt) + (enow - bvirt);
3889
+ enow = e[++eindex];
3890
+ } else {
3891
+ Qnew = Q + fnow;
3892
+ bvirt = Qnew - Q;
3893
+ hh = Q - (Qnew - bvirt) + (fnow - bvirt);
3894
+ fnow = f[++findex];
3895
+ }
3896
+ Q = Qnew;
3897
+ if (hh !== 0) {
3898
+ h[hindex++] = hh;
3899
+ }
3900
+ }
3901
+ }
3902
+ while (eindex < elen) {
3903
+ Qnew = Q + enow;
3904
+ bvirt = Qnew - Q;
3905
+ hh = Q - (Qnew - bvirt) + (enow - bvirt);
3906
+ enow = e[++eindex];
3907
+ Q = Qnew;
3908
+ if (hh !== 0) {
3909
+ h[hindex++] = hh;
3910
+ }
3911
+ }
3912
+ while (findex < flen) {
3913
+ Qnew = Q + fnow;
3914
+ bvirt = Qnew - Q;
3915
+ hh = Q - (Qnew - bvirt) + (fnow - bvirt);
3916
+ fnow = f[++findex];
3917
+ Q = Qnew;
3918
+ if (hh !== 0) {
3919
+ h[hindex++] = hh;
3920
+ }
3921
+ }
3922
+ if (Q !== 0 || hindex === 0) {
3923
+ h[hindex++] = Q;
3924
+ }
3925
+ return hindex;
3926
+ }
3927
+ function estimate(elen, e) {
3928
+ let Q = e[0];
3929
+ for (let i = 1; i < elen; i++) Q += e[i];
3930
+ return Q;
3931
+ }
3932
+ function vec(n) {
3933
+ return new Float64Array(n);
3934
+ }
3935
+
3936
+ // ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/orient2d.js
3937
+ var ccwerrboundA = (3 + 16 * epsilon) * epsilon;
3938
+ var ccwerrboundB = (2 + 12 * epsilon) * epsilon;
3939
+ var ccwerrboundC = (9 + 64 * epsilon) * epsilon * epsilon;
3940
+ var B = vec(4);
3941
+ var C1 = vec(8);
3942
+ var C2 = vec(12);
3943
+ var D = vec(16);
3944
+ var u = vec(4);
3945
+ function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {
3946
+ let acxtail, acytail, bcxtail, bcytail;
3947
+ let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u32;
3948
+ const acx = ax - cx;
3949
+ const bcx = bx - cx;
3950
+ const acy = ay - cy;
3951
+ const bcy = by - cy;
3952
+ s1 = acx * bcy;
3953
+ c = splitter * acx;
3954
+ ahi = c - (c - acx);
3955
+ alo = acx - ahi;
3956
+ c = splitter * bcy;
3957
+ bhi = c - (c - bcy);
3958
+ blo = bcy - bhi;
3959
+ s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
3960
+ t1 = acy * bcx;
3961
+ c = splitter * acy;
3962
+ ahi = c - (c - acy);
3963
+ alo = acy - ahi;
3964
+ c = splitter * bcx;
3965
+ bhi = c - (c - bcx);
3966
+ blo = bcx - bhi;
3967
+ t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
3968
+ _i = s0 - t0;
3969
+ bvirt = s0 - _i;
3970
+ B[0] = s0 - (_i + bvirt) + (bvirt - t0);
3971
+ _j = s1 + _i;
3972
+ bvirt = _j - s1;
3973
+ _0 = s1 - (_j - bvirt) + (_i - bvirt);
3974
+ _i = _0 - t1;
3975
+ bvirt = _0 - _i;
3976
+ B[1] = _0 - (_i + bvirt) + (bvirt - t1);
3977
+ u32 = _j + _i;
3978
+ bvirt = u32 - _j;
3979
+ B[2] = _j - (u32 - bvirt) + (_i - bvirt);
3980
+ B[3] = u32;
3981
+ let det = estimate(4, B);
3982
+ let errbound = ccwerrboundB * detsum;
3983
+ if (det >= errbound || -det >= errbound) {
3984
+ return det;
3985
+ }
3986
+ bvirt = ax - acx;
3987
+ acxtail = ax - (acx + bvirt) + (bvirt - cx);
3988
+ bvirt = bx - bcx;
3989
+ bcxtail = bx - (bcx + bvirt) + (bvirt - cx);
3990
+ bvirt = ay - acy;
3991
+ acytail = ay - (acy + bvirt) + (bvirt - cy);
3992
+ bvirt = by - bcy;
3993
+ bcytail = by - (bcy + bvirt) + (bvirt - cy);
3994
+ if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) {
3995
+ return det;
3996
+ }
3997
+ errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det);
3998
+ det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail);
3999
+ if (det >= errbound || -det >= errbound) return det;
4000
+ s1 = acxtail * bcy;
4001
+ c = splitter * acxtail;
4002
+ ahi = c - (c - acxtail);
4003
+ alo = acxtail - ahi;
4004
+ c = splitter * bcy;
4005
+ bhi = c - (c - bcy);
4006
+ blo = bcy - bhi;
4007
+ s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
4008
+ t1 = acytail * bcx;
4009
+ c = splitter * acytail;
4010
+ ahi = c - (c - acytail);
4011
+ alo = acytail - ahi;
4012
+ c = splitter * bcx;
4013
+ bhi = c - (c - bcx);
4014
+ blo = bcx - bhi;
4015
+ t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
4016
+ _i = s0 - t0;
4017
+ bvirt = s0 - _i;
4018
+ u[0] = s0 - (_i + bvirt) + (bvirt - t0);
4019
+ _j = s1 + _i;
4020
+ bvirt = _j - s1;
4021
+ _0 = s1 - (_j - bvirt) + (_i - bvirt);
4022
+ _i = _0 - t1;
4023
+ bvirt = _0 - _i;
4024
+ u[1] = _0 - (_i + bvirt) + (bvirt - t1);
4025
+ u32 = _j + _i;
4026
+ bvirt = u32 - _j;
4027
+ u[2] = _j - (u32 - bvirt) + (_i - bvirt);
4028
+ u[3] = u32;
4029
+ const C1len = sum(4, B, 4, u, C1);
4030
+ s1 = acx * bcytail;
4031
+ c = splitter * acx;
4032
+ ahi = c - (c - acx);
4033
+ alo = acx - ahi;
4034
+ c = splitter * bcytail;
4035
+ bhi = c - (c - bcytail);
4036
+ blo = bcytail - bhi;
4037
+ s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
4038
+ t1 = acy * bcxtail;
4039
+ c = splitter * acy;
4040
+ ahi = c - (c - acy);
4041
+ alo = acy - ahi;
4042
+ c = splitter * bcxtail;
4043
+ bhi = c - (c - bcxtail);
4044
+ blo = bcxtail - bhi;
4045
+ t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
4046
+ _i = s0 - t0;
4047
+ bvirt = s0 - _i;
4048
+ u[0] = s0 - (_i + bvirt) + (bvirt - t0);
4049
+ _j = s1 + _i;
4050
+ bvirt = _j - s1;
4051
+ _0 = s1 - (_j - bvirt) + (_i - bvirt);
4052
+ _i = _0 - t1;
4053
+ bvirt = _0 - _i;
4054
+ u[1] = _0 - (_i + bvirt) + (bvirt - t1);
4055
+ u32 = _j + _i;
4056
+ bvirt = u32 - _j;
4057
+ u[2] = _j - (u32 - bvirt) + (_i - bvirt);
4058
+ u[3] = u32;
4059
+ const C2len = sum(C1len, C1, 4, u, C2);
4060
+ s1 = acxtail * bcytail;
4061
+ c = splitter * acxtail;
4062
+ ahi = c - (c - acxtail);
4063
+ alo = acxtail - ahi;
4064
+ c = splitter * bcytail;
4065
+ bhi = c - (c - bcytail);
4066
+ blo = bcytail - bhi;
4067
+ s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
4068
+ t1 = acytail * bcxtail;
4069
+ c = splitter * acytail;
4070
+ ahi = c - (c - acytail);
4071
+ alo = acytail - ahi;
4072
+ c = splitter * bcxtail;
4073
+ bhi = c - (c - bcxtail);
4074
+ blo = bcxtail - bhi;
4075
+ t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
4076
+ _i = s0 - t0;
4077
+ bvirt = s0 - _i;
4078
+ u[0] = s0 - (_i + bvirt) + (bvirt - t0);
4079
+ _j = s1 + _i;
4080
+ bvirt = _j - s1;
4081
+ _0 = s1 - (_j - bvirt) + (_i - bvirt);
4082
+ _i = _0 - t1;
4083
+ bvirt = _0 - _i;
4084
+ u[1] = _0 - (_i + bvirt) + (bvirt - t1);
4085
+ u32 = _j + _i;
4086
+ bvirt = u32 - _j;
4087
+ u[2] = _j - (u32 - bvirt) + (_i - bvirt);
4088
+ u[3] = u32;
4089
+ const Dlen = sum(C2len, C2, 4, u, D);
4090
+ return D[Dlen - 1];
4091
+ }
4092
+ function orient2d(ax, ay, bx, by, cx, cy) {
4093
+ const detleft = (ay - cy) * (bx - cx);
4094
+ const detright = (ax - cx) * (by - cy);
4095
+ const det = detleft - detright;
4096
+ const detsum = Math.abs(detleft + detright);
4097
+ if (Math.abs(det) >= ccwerrboundA * detsum) return det;
4098
+ return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum);
4099
+ }
4100
+
4101
+ // ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/orient3d.js
4102
+ var o3derrboundA = (7 + 56 * epsilon) * epsilon;
4103
+ var o3derrboundB = (3 + 28 * epsilon) * epsilon;
4104
+ var o3derrboundC = (26 + 288 * epsilon) * epsilon * epsilon;
4105
+ var bc = vec(4);
4106
+ var ca = vec(4);
4107
+ var ab = vec(4);
4108
+ var at_b = vec(4);
4109
+ var at_c = vec(4);
4110
+ var bt_c = vec(4);
4111
+ var bt_a = vec(4);
4112
+ var ct_a = vec(4);
4113
+ var ct_b = vec(4);
4114
+ var bct = vec(8);
4115
+ var cat = vec(8);
4116
+ var abt = vec(8);
4117
+ var u2 = vec(4);
4118
+ var _8 = vec(8);
4119
+ var _8b = vec(8);
4120
+ var _16 = vec(8);
4121
+ var _12 = vec(12);
4122
+ var fin = vec(192);
4123
+ var fin2 = vec(192);
4124
+
4125
+ // ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/incircle.js
4126
+ var iccerrboundA = (10 + 96 * epsilon) * epsilon;
4127
+ var iccerrboundB = (4 + 48 * epsilon) * epsilon;
4128
+ var iccerrboundC = (44 + 576 * epsilon) * epsilon * epsilon;
4129
+ var bc2 = vec(4);
4130
+ var ca2 = vec(4);
4131
+ var ab2 = vec(4);
4132
+ var aa = vec(4);
4133
+ var bb = vec(4);
4134
+ var cc = vec(4);
4135
+ var u3 = vec(4);
4136
+ var v = vec(4);
4137
+ var axtbc = vec(8);
4138
+ var aytbc = vec(8);
4139
+ var bxtca = vec(8);
4140
+ var bytca = vec(8);
4141
+ var cxtab = vec(8);
4142
+ var cytab = vec(8);
4143
+ var abt2 = vec(8);
4144
+ var bct2 = vec(8);
4145
+ var cat2 = vec(8);
4146
+ var abtt = vec(4);
4147
+ var bctt = vec(4);
4148
+ var catt = vec(4);
4149
+ var _82 = vec(8);
4150
+ var _162 = vec(16);
4151
+ var _16b = vec(16);
4152
+ var _16c = vec(16);
4153
+ var _32 = vec(32);
4154
+ var _32b = vec(32);
4155
+ var _48 = vec(48);
4156
+ var _64 = vec(64);
4157
+ var fin3 = vec(1152);
4158
+ var fin22 = vec(1152);
4159
+
4160
+ // ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/insphere.js
4161
+ var isperrboundA = (16 + 224 * epsilon) * epsilon;
4162
+ var isperrboundB = (5 + 72 * epsilon) * epsilon;
4163
+ var isperrboundC = (71 + 1408 * epsilon) * epsilon * epsilon;
4164
+ var ab3 = vec(4);
4165
+ var bc3 = vec(4);
4166
+ var cd = vec(4);
4167
+ var de = vec(4);
4168
+ var ea = vec(4);
4169
+ var ac = vec(4);
4170
+ var bd = vec(4);
4171
+ var ce = vec(4);
4172
+ var da = vec(4);
4173
+ var eb = vec(4);
4174
+ var abc = vec(24);
4175
+ var bcd = vec(24);
4176
+ var cde = vec(24);
4177
+ var dea = vec(24);
4178
+ var eab = vec(24);
4179
+ var abd = vec(24);
4180
+ var bce = vec(24);
4181
+ var cda = vec(24);
4182
+ var deb = vec(24);
4183
+ var eac = vec(24);
4184
+ var adet = vec(1152);
4185
+ var bdet = vec(1152);
4186
+ var cdet = vec(1152);
4187
+ var ddet = vec(1152);
4188
+ var edet = vec(1152);
4189
+ var abdet = vec(2304);
4190
+ var cddet = vec(2304);
4191
+ var cdedet = vec(3456);
4192
+ var deter = vec(5760);
4193
+ var _83 = vec(8);
4194
+ var _8b2 = vec(8);
4195
+ var _8c = vec(8);
4196
+ var _163 = vec(16);
4197
+ var _24 = vec(24);
4198
+ var _482 = vec(48);
4199
+ var _48b = vec(48);
4200
+ var _96 = vec(96);
4201
+ var _192 = vec(192);
4202
+ var _384x = vec(384);
4203
+ var _384y = vec(384);
4204
+ var _384z = vec(384);
4205
+ var _768 = vec(768);
4206
+ var xdet = vec(96);
4207
+ var ydet = vec(96);
4208
+ var zdet = vec(96);
4209
+ var fin4 = vec(1152);
4210
+
4211
+ // ../../node_modules/point-in-polygon-hao/dist/esm/index.js
4212
+ function pointInPolygon(p, polygon2) {
4213
+ var i;
4214
+ var ii;
4215
+ var k = 0;
4216
+ var f;
4217
+ var u1;
4218
+ var v1;
4219
+ var u22;
4220
+ var v2;
4221
+ var currentP;
4222
+ var nextP;
4223
+ var x = p[0];
4224
+ var y = p[1];
4225
+ var numContours = polygon2.length;
4226
+ for (i = 0; i < numContours; i++) {
4227
+ ii = 0;
4228
+ var contour = polygon2[i];
4229
+ var contourLen = contour.length - 1;
4230
+ currentP = contour[0];
4231
+ if (currentP[0] !== contour[contourLen][0] && currentP[1] !== contour[contourLen][1]) {
4232
+ throw new Error("First and last coordinates in a ring must be the same");
4233
+ }
4234
+ u1 = currentP[0] - x;
4235
+ v1 = currentP[1] - y;
4236
+ for (ii; ii < contourLen; ii++) {
4237
+ nextP = contour[ii + 1];
4238
+ u22 = nextP[0] - x;
4239
+ v2 = nextP[1] - y;
4240
+ if (v1 === 0 && v2 === 0) {
4241
+ if (u22 <= 0 && u1 >= 0 || u1 <= 0 && u22 >= 0) {
4242
+ return 0;
4243
+ }
4244
+ } else if (v2 >= 0 && v1 <= 0 || v2 <= 0 && v1 >= 0) {
4245
+ f = orient2d(u1, u22, v1, v2, 0, 0);
4246
+ if (f === 0) {
4247
+ return 0;
4248
+ }
4249
+ if (f > 0 && v2 > 0 && v1 <= 0 || f < 0 && v2 <= 0 && v1 > 0) {
4250
+ k++;
4251
+ }
4252
+ }
4253
+ currentP = nextP;
4254
+ v1 = v2;
4255
+ u1 = u22;
4256
+ }
4257
+ }
4258
+ if (k % 2 === 0) {
4259
+ return false;
4260
+ }
4261
+ return true;
4262
+ }
4263
+
4264
+ // ../../node_modules/@turf/invariant/dist/esm/index.js
4265
+ function getCoord(coord) {
4266
+ if (!coord) {
4267
+ throw new Error("coord is required");
4268
+ }
4269
+ if (!Array.isArray(coord)) {
4270
+ if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
4271
+ return [...coord.geometry.coordinates];
4272
+ }
4273
+ if (coord.type === "Point") {
4274
+ return [...coord.coordinates];
4275
+ }
4276
+ }
4277
+ if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
4278
+ return [...coord];
4279
+ }
4280
+ throw new Error("coord must be GeoJSON Point or an Array of numbers");
4281
+ }
4282
+ function getGeom(geojson) {
4283
+ if (geojson.type === "Feature") {
4284
+ return geojson.geometry;
4285
+ }
4286
+ return geojson;
4287
+ }
4288
+
4289
+ // ../../node_modules/@turf/boolean-point-in-polygon/dist/esm/index.js
4290
+ function booleanPointInPolygon(point2, polygon2, options = {}) {
4291
+ if (!point2) {
4292
+ throw new Error("point is required");
4293
+ }
4294
+ if (!polygon2) {
4295
+ throw new Error("polygon is required");
4296
+ }
4297
+ const pt = getCoord(point2);
4298
+ const geom = getGeom(polygon2);
4299
+ const type = geom.type;
4300
+ const bbox2 = polygon2.bbox;
4301
+ let polys = geom.coordinates;
4302
+ if (bbox2 && inBBox(pt, bbox2) === false) {
4303
+ return false;
4304
+ }
4305
+ if (type === "Polygon") {
4306
+ polys = [polys];
4307
+ }
4308
+ let result = false;
4309
+ for (var i = 0; i < polys.length; ++i) {
4310
+ const polyResult = pointInPolygon(pt, polys[i]);
4311
+ if (polyResult === 0) return options.ignoreBoundary ? false : true;
4312
+ else if (polyResult) result = true;
4313
+ }
4314
+ return result;
4315
+ }
4316
+ function inBBox(pt, bbox2) {
4317
+ return bbox2[0] <= pt[0] && bbox2[1] <= pt[1] && bbox2[2] >= pt[0] && bbox2[3] >= pt[1];
4318
+ }
4319
+
4320
+ // src/IndoorMap/renderer/utils/findUnitOnPoint.ts
4321
+ var findUnitOnPoint = (units, point2) => {
4322
+ return units.find((unit) => booleanPointInPolygon(point2, polygon(unit.geometry.coordinates)));
4323
+ };
4324
+
3872
4325
  // src/IndoorMap/renderer/RendererManager.ts
3873
4326
  function delay(ms) {
3874
4327
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -3904,6 +4357,38 @@ var RendererManager = class extends EventTarget {
3904
4357
  const groupLayer = this.map.getLayer("group");
3905
4358
  const threeLayer = groupLayer.getLayer("three");
3906
4359
  threeLayer.prepareToDraw = function(gl, scene, camera) {
4360
+ function findBadMeshes(scene2) {
4361
+ const bad = [];
4362
+ scene2.traverse((obj) => {
4363
+ if (!obj?.isMesh) return;
4364
+ const geom = obj.geometry;
4365
+ const pos = geom?.attributes?.position?.array;
4366
+ if (!pos || pos.length === 0) return;
4367
+ for (let i = 0; i < pos.length; i++) {
4368
+ const v2 = pos[i];
4369
+ if (!Number.isFinite(v2)) {
4370
+ bad.push({ mesh: obj, index: i, value: v2 });
4371
+ break;
4372
+ }
4373
+ }
4374
+ });
4375
+ if (bad.length) {
4376
+ console.group(`\u274C Found ${bad.length} meshes with invalid positions`);
4377
+ for (const b of bad) {
4378
+ console.log({
4379
+ name: b.mesh.name,
4380
+ userData: b.mesh.userData,
4381
+ uuid: b.mesh.uuid,
4382
+ badIndex: b.index,
4383
+ badValue: b.value
4384
+ });
4385
+ }
4386
+ console.groupEnd();
4387
+ } else {
4388
+ console.log("\u2705 No invalid meshes found");
4389
+ }
4390
+ return bad;
4391
+ }
3907
4392
  const ambientLight = new THREE3.AmbientLight(16777215, 0.3);
3908
4393
  scene.add(ambientLight);
3909
4394
  const dirColor = 16777215;
@@ -3918,6 +4403,9 @@ var RendererManager = class extends EventTarget {
3918
4403
  options.onRendererReady();
3919
4404
  }
3920
4405
  _this.#createElements();
4406
+ setTimeout(() => {
4407
+ findBadMeshes(scene);
4408
+ }, 3e3);
3921
4409
  };
3922
4410
  } else {
3923
4411
  this.elementRenderer = new Element2DRenderer(map, options.elements);
@@ -3929,11 +4417,10 @@ var RendererManager = class extends EventTarget {
3929
4417
  this.#onClickElement = func;
3930
4418
  }
3931
4419
  handleClickElement = (e) => {
3932
- console.log(`handleClickElement`, this.#isClicked);
3933
4420
  if (this.#isClicked) return;
3934
4421
  this.#isClicked = true;
3935
4422
  const onClickElement = this.#onClickElement;
3936
- if (!(0, import_isFunction.default)(onClickElement)) return;
4423
+ if (!(0, import_lodash_es3.isFunction)(onClickElement)) return;
3937
4424
  this.#onClickElement(e);
3938
4425
  this.#isClicked = false;
3939
4426
  };
@@ -3960,6 +4447,9 @@ var RendererManager = class extends EventTarget {
3960
4447
  const levels = await this.#dataClient.filterByType("level", {
3961
4448
  populate: true
3962
4449
  });
4450
+ const openings = await this.#dataClient.filterByType("opening", {
4451
+ populate: true
4452
+ });
3963
4453
  const relationships = await this.#dataClient.filterByType("relationship");
3964
4454
  const fixtures = await this.#dataClient.filterByType("fixture", { populate: true });
3965
4455
  fixtures.forEach((fixture) => {
@@ -3973,7 +4463,7 @@ var RendererManager = class extends EventTarget {
3973
4463
  populate: true
3974
4464
  });
3975
4465
  units.filter(
3976
- (u) => !["opentobelow", "escalator"].includes(u.properties.category)
4466
+ (u4) => !["opentobelow", "escalator", "room"].includes(u4.properties.category)
3977
4467
  ).forEach((unit) => {
3978
4468
  const element = this.elementRenderer.createGeometry(unit);
3979
4469
  if (element) {
@@ -3981,6 +4471,22 @@ var RendererManager = class extends EventTarget {
3981
4471
  this.addElementsToManager(unit.id, _elements, unit.properties.level.properties.ordinal);
3982
4472
  }
3983
4473
  });
4474
+ units.filter((u4) => u4.properties.category === "room").forEach((unit) => {
4475
+ const openingRelationships = relationships.filter((r) => r.properties.origin?.id === unit.id || r.properties.destination?.id === unit.id);
4476
+ const roomOpenings = (0, import_lodash_es3.compact)(openingRelationships.map((rel) => {
4477
+ const openingId = rel?.properties.intermediary[0].id;
4478
+ return openings.find((o) => o.id === openingId);
4479
+ }));
4480
+ const innerElements = this.elementRenderer.createGeometry(unit);
4481
+ const wallElements = this.elementRenderer.createRoomWall(unit, roomOpenings);
4482
+ if (innerElements || wallElements) {
4483
+ const _innerElements = Array.isArray(innerElements) ? innerElements : [innerElements];
4484
+ const _wallElements = Array.isArray(wallElements) ? wallElements : [wallElements];
4485
+ const _elements = [..._innerElements, ..._wallElements];
4486
+ const ordinal = unit.properties.level.properties.ordinal;
4487
+ this.addElementsToManager(unit.id, _elements, ordinal);
4488
+ }
4489
+ });
3984
4490
  const kiosks = await this.#dataClient.filterByType("kiosk", {
3985
4491
  populate: true
3986
4492
  });
@@ -3991,7 +4497,7 @@ var RendererManager = class extends EventTarget {
3991
4497
  this.addElementsToManager(kiosk.id, _elements, kiosk.properties.level.properties.ordinal);
3992
4498
  }
3993
4499
  });
3994
- const escalators = units.filter((u) => u.properties.category === "escalator");
4500
+ const escalators = units.filter((u4) => u4.properties.category === "escalator");
3995
4501
  for (const escalator of escalators) {
3996
4502
  try {
3997
4503
  const escalatorRelationships = relationships.filter((r) => (r.properties?.intermediary || []).some((inter) => inter.id === escalator.id));
@@ -4023,6 +4529,22 @@ var RendererManager = class extends EventTarget {
4023
4529
  console.warn(`cannot create escalator`, err.message);
4024
4530
  }
4025
4531
  }
4532
+ const groundLabels = await this.#dataClient.filterByType("label");
4533
+ for (const label of groundLabels) {
4534
+ const center2 = (0, import_center3.center)(polygon(label.geometry.coordinates)).geometry.coordinates;
4535
+ const unit = findUnitOnPoint(units, center2);
4536
+ const element = this.elementRenderer.createGroundLabel(label, unit);
4537
+ if (element) {
4538
+ const _elements = Array.isArray(element) ? element : [element];
4539
+ this.addElementsToManager(label.id, _elements, label.properties.ordinal);
4540
+ }
4541
+ }
4542
+ if (this.options.type === "3D") {
4543
+ const model3ds = await this.#dataClient.filterByType("model3d");
4544
+ for (const model3d of model3ds) {
4545
+ this.elementRenderer.createModel3d(model3d);
4546
+ }
4547
+ }
4026
4548
  this.changeLevelByOrdinal(this.currentOrdinals);
4027
4549
  this.dispatchEvent(new CustomEvent("renderermanager:elements_created"));
4028
4550
  }
@@ -4037,7 +4559,7 @@ var RendererManager = class extends EventTarget {
4037
4559
  this.markerRenderer.showMarkers(markers, ordinal - baseOrdinal);
4038
4560
  }
4039
4561
  } else {
4040
- const baseOrdinal = Array.isArray(targetOrdinal) ? (0, import_min.default)(targetOrdinal) : targetOrdinal;
4562
+ const baseOrdinal = Array.isArray(targetOrdinal) ? (0, import_lodash_es3.min)(targetOrdinal) : targetOrdinal;
4041
4563
  for (const [ordinal, elements] of this.elementsByOrdinal) {
4042
4564
  const inOrdinal = Array.isArray(targetOrdinal) ? targetOrdinal.includes(ordinal) : ordinal === targetOrdinal;
4043
4565
  if (inOrdinal) {
@@ -4064,13 +4586,15 @@ var RendererManager = class extends EventTarget {
4064
4586
  const elements = elemIds.map((id) => this.elementsMap.get(id)).flat();
4065
4587
  elements.forEach((element) => {
4066
4588
  const controller = this.elementRenderer.createHighlightController(element);
4067
- controller.start();
4068
- this.highlightControllers.push(controller);
4589
+ if (controller && (0, import_lodash_es3.isFunction)(controller.start)) {
4590
+ controller.start();
4591
+ this.highlightControllers.push(controller);
4592
+ }
4069
4593
  });
4070
4594
  };
4071
4595
  clearHighlightElements = () => {
4072
4596
  this.highlightControllers.forEach((controller) => {
4073
- if ((0, import_isFunction.default)(controller?.clear)) controller.clear();
4597
+ if ((0, import_lodash_es3.isFunction)(controller?.clear)) controller.clear();
4074
4598
  });
4075
4599
  };
4076
4600
  /**
@@ -4112,8 +4636,23 @@ var INITIAL_ZOOM = 18.5;
4112
4636
  var CLICK_TOLERANCE = 20;
4113
4637
  var defaultOptions = {
4114
4638
  pixelRatio: 1,
4639
+ interactions: true,
4115
4640
  locale: DEFAULT_LOCALE
4116
4641
  };
4642
+ var parseMaptalksOptions = (options) => {
4643
+ return {
4644
+ centerCross: options.centerCross ?? false,
4645
+ ...options.interactions === false ? {
4646
+ draggable: false,
4647
+ dragPan: false,
4648
+ dragRotate: false,
4649
+ dragPitch: false,
4650
+ scrollWheelZoom: false,
4651
+ touchZoom: false,
4652
+ doubleClickZoom: false
4653
+ } : {}
4654
+ };
4655
+ };
4117
4656
  var IndoorMap = class extends EventTarget {
4118
4657
  options;
4119
4658
  //TODO: refac functions; let them do only 1 thing in a function
@@ -4132,7 +4671,6 @@ var IndoorMap = class extends EventTarget {
4132
4671
  #billboardObjects = [];
4133
4672
  #spriteMarkerObjects = [];
4134
4673
  #mapDecorations = [];
4135
- #groundLabels = [];
4136
4674
  #groundObjects = [];
4137
4675
  #navigationGeometries = {};
4138
4676
  #venueObjects = [];
@@ -4167,14 +4705,15 @@ var IndoorMap = class extends EventTarget {
4167
4705
  };
4168
4706
  constructor(elementId, options) {
4169
4707
  super();
4170
- const combinedOptions = import_lodash7.default.merge({}, defaultOptions, options);
4171
- this.options = options;
4708
+ const combinedOptions = import_lodash6.default.merge({}, defaultOptions, options);
4709
+ this.options = combinedOptions;
4172
4710
  const {
4173
4711
  onMapReady,
4174
4712
  onMapLoading,
4175
4713
  pixelRatio,
4176
4714
  locale
4177
4715
  } = combinedOptions;
4716
+ const maptalksOptions = parseMaptalksOptions(combinedOptions);
4178
4717
  this.map = new import_maptalks_gl.Map(elementId, {
4179
4718
  attribution: false,
4180
4719
  // Temporart set, not really default view
@@ -4182,7 +4721,7 @@ var IndoorMap = class extends EventTarget {
4182
4721
  center: INITIAL_CENTER,
4183
4722
  zoom: INITIAL_ZOOM,
4184
4723
  clickTimeThreshold: 600,
4185
- centerCross: options.centerCross ?? false,
4724
+ ...maptalksOptions,
4186
4725
  baseLayer: new import_maptalks_gl.TileLayer("base", {
4187
4726
  urlTemplate: "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",
4188
4727
  subdomains: ["a", "b", "c", "d"],
@@ -4212,6 +4751,12 @@ var IndoorMap = class extends EventTarget {
4212
4751
  this.map.on("click", this.handleMapClick);
4213
4752
  this.dataClient = options.dataClient;
4214
4753
  }
4754
+ setOptions(options) {
4755
+ const combinedOptions = import_lodash6.default.merge({}, defaultOptions, options);
4756
+ this.options = combinedOptions;
4757
+ const maptalksOptions = parseMaptalksOptions(combinedOptions);
4758
+ this.map.setOptions(maptalksOptions);
4759
+ }
4215
4760
  set dataClient(value) {
4216
4761
  this.#dataClient = value;
4217
4762
  if (!this.options.camera?.defaultView?.center) {
@@ -4232,7 +4777,7 @@ var IndoorMap = class extends EventTarget {
4232
4777
  handleMapClick = ({ coordinate }) => {
4233
4778
  const { x, y } = coordinate;
4234
4779
  console.log(
4235
- `[Coordinates]: x: ${import_lodash7.default.round(x, 8)} y: ${import_lodash7.default.round(
4780
+ `[Coordinates]: x: ${import_lodash6.default.round(x, 8)} y: ${import_lodash6.default.round(
4236
4781
  y,
4237
4782
  8
4238
4783
  )}, [Bearing]: ${this.map.getBearing()}, [Pitch]: ${this.map.getPitch()}`
@@ -4290,9 +4835,6 @@ var IndoorMap = class extends EventTarget {
4290
4835
  set mapDecorations(value) {
4291
4836
  this.#mapDecorations = value;
4292
4837
  }
4293
- set groundLabels(value) {
4294
- this.#groundLabels = value;
4295
- }
4296
4838
  set pixelRatio(value) {
4297
4839
  this.map.setDevicePixelRatio(value);
4298
4840
  }
@@ -4313,7 +4855,7 @@ var IndoorMap = class extends EventTarget {
4313
4855
  const scene = this.threeLayer.getScene();
4314
4856
  if (scene) {
4315
4857
  scene.children = scene.children.filter(
4316
- (children) => children instanceof import_three7.PerspectiveCamera
4858
+ (children) => children instanceof import_three6.PerspectiveCamera
4317
4859
  );
4318
4860
  }
4319
4861
  }
@@ -4321,44 +4863,36 @@ var IndoorMap = class extends EventTarget {
4321
4863
  if (this.#isClicked) return;
4322
4864
  this.#isClicked = true;
4323
4865
  const onClickElement = this.#onClickElement;
4324
- if (!import_lodash7.default.isFunction(onClickElement)) return;
4866
+ if (!import_lodash6.default.isFunction(onClickElement)) return;
4325
4867
  this.#onClickElement(e);
4326
4868
  this.#isClicked = false;
4327
4869
  };
4328
4870
  async #legacy_createElements() {
4329
4871
  const {
4330
4872
  // 2D
4331
- createVenue,
4332
4873
  createOpening,
4333
4874
  createSection,
4334
- createFixture,
4335
- createOccupant,
4336
4875
  createDecoration,
4337
4876
  // 3D
4338
- create3DFootprint,
4339
- create3DGroundLabel,
4340
4877
  create3DBillboard,
4341
- createExtrudedUnit,
4342
4878
  create3DAmenityMarker,
4343
- create3DOccupantAmenityMarker,
4344
- create3DOpeningMarker,
4345
- createOccupantGroundLabel
4879
+ create3DOpeningMarker
4346
4880
  } = this.#styler;
4347
4881
  let elements = {};
4348
4882
  let object3ds = [];
4349
4883
  for (const feature2 of this.#features) {
4350
4884
  try {
4351
4885
  const { feature_type: featureType, properties, id } = feature2;
4352
- const layerName = import_lodash7.default.get(
4886
+ const layerName = import_lodash6.default.get(
4353
4887
  LAYER_FEATURE_TYPE_OBJ,
4354
4888
  featureType,
4355
4889
  featureType
4356
4890
  );
4357
4891
  const layer = this.map.getLayer(layerName);
4358
4892
  let geometry;
4359
- const category = import_lodash7.default.get(feature2, "properties.category");
4360
- const extrudeConfig = import_lodash7.default.get(this.#mapConfig, "extrude");
4361
- const textMarkerType = import_lodash7.default.get(
4893
+ const category = import_lodash6.default.get(feature2, "properties.category");
4894
+ const extrudeConfig = import_lodash6.default.get(this.#mapConfig, "extrude");
4895
+ const textMarkerType = import_lodash6.default.get(
4362
4896
  this.#mapConfig,
4363
4897
  "text_marker_type",
4364
4898
  "ui-marker"
@@ -4420,16 +4954,6 @@ var IndoorMap = class extends EventTarget {
4420
4954
  console.warn(`Cannot create ${feature2.id}: ${err.message}`);
4421
4955
  }
4422
4956
  }
4423
- this.#groundLabels.forEach((label) => {
4424
- const text = label.properties.name;
4425
- try {
4426
- const groundLabel = create3DGroundLabel(label, this.threeLayer);
4427
- object3ds.push(groundLabel);
4428
- this.#groundObjects.push(groundLabel);
4429
- } catch (error) {
4430
- console.log("error creating ground label for ", text);
4431
- }
4432
- });
4433
4957
  this.#mapDecorations.forEach((decoration) => {
4434
4958
  const { id, geometry, properties } = decoration;
4435
4959
  const geometryType = decoration?.geometry?.type;
@@ -4511,186 +5035,6 @@ var IndoorMap = class extends EventTarget {
4511
5035
  clearAnimations() {
4512
5036
  this.#animationsToRun = [];
4513
5037
  }
4514
- /**
4515
- * Hilighting Elements
4516
- * ========================================= */
4517
- // TODO: To consider if we should use setter `set hilightElementIds` instead?
4518
- setHighlightElementIds(targetElementIds, options = {}) {
4519
- const highlight3DOptions = import_lodash7.default.merge(
4520
- {},
4521
- DEFAULT_HIGHLIGHT_OPTIONS,
4522
- import_lodash7.default.get(options, "highlight3DOptions", {})
4523
- );
4524
- const highlight2DOptions = import_lodash7.default.merge(
4525
- {},
4526
- DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS,
4527
- import_lodash7.default.get(options, "highlight2DOptions", {})
4528
- );
4529
- this.setHighlightedObject(targetElementIds, highlight3DOptions);
4530
- return this.setHighlight2DElementIds(targetElementIds, highlight2DOptions);
4531
- }
4532
- setHighlight2DElementIds(targetElementIds, options = {}) {
4533
- const { defaultMarker, symbolSet } = import_lodash7.default.merge(
4534
- {},
4535
- DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS,
4536
- options
4537
- );
4538
- const {
4539
- createMarker,
4540
- createHighlightOccupantMarker,
4541
- getElementSymbol,
4542
- getHilighPolygonalSymbol,
4543
- getHighlightMarkerSymbol
4544
- } = this.#styler;
4545
- const extrudeConfig = import_lodash7.default.get(this.#mapConfig, "extrude");
4546
- const elementToHilights = targetElementIds.map(
4547
- (elemId) => this.#elements[elemId] || this.#elements[`${LAST_USER_LOCATION_ELEMENT_ID_PREFIX}${elemId}`]
4548
- ).filter((elem) => elem);
4549
- elementToHilights.forEach((elem) => {
4550
- const { feature: feature2, geometry } = elem;
4551
- if (!geometry || !feature2) return;
4552
- const hilightLayer = this.map.getLayer(HIGHLIGHT_LAYER_NAME);
4553
- if (!hilightLayer) return;
4554
- const defaultSymbol = getHilighPolygonalSymbol(geometry.type);
4555
- const definedSymbol = symbolSet ? getElementSymbol(symbolSet) : null;
4556
- const symbol = import_lodash7.default.isEmpty(definedSymbol) ? defaultSymbol : definedSymbol;
4557
- switch (geometry.type) {
4558
- case "MultiPolygon":
4559
- case "Polygon": {
4560
- geometry?.updateSymbol(symbol);
4561
- break;
4562
- }
4563
- default:
4564
- break;
4565
- }
4566
- switch (feature2.feature_type) {
4567
- case "amenity":
4568
- const highlightedAmenityMarker = definedSymbol || getHighlightMarkerSymbol();
4569
- geometry?.updateSymbol(highlightedAmenityMarker);
4570
- break;
4571
- case "occupant": {
4572
- switch (feature2.properties.category) {
4573
- case "currencyexchange":
4574
- case "donationcenter":
4575
- case "postoffice":
4576
- const highlightedAmenityMarker2 = definedSymbol || getHighlightMarkerSymbol();
4577
- geometry?.updateSymbol(highlightedAmenityMarker2);
4578
- break;
4579
- default:
4580
- if (feature2.properties.render_type === "Logo") {
4581
- this.hideGeometryByElementId(feature2.id);
4582
- }
4583
- createHighlightOccupantMarker(feature2, {
4584
- extrudeConfig,
4585
- symbol: definedSymbol
4586
- }).on("click", this.handleClickElement).addTo(hilightLayer);
4587
- break;
4588
- }
4589
- break;
4590
- }
4591
- case "opening":
4592
- break;
4593
- default:
4594
- if (defaultMarker) createMarker(feature2).addTo(hilightLayer);
4595
- break;
4596
- }
4597
- });
4598
- this.#highlightElementIds = targetElementIds;
4599
- if (elementToHilights.length === 0) return;
4600
- return featureCollection(
4601
- elementToHilights.map(({ feature: feature2 }) => {
4602
- const { geometry } = feature2;
4603
- if (feature2.feature_type === "occupant")
4604
- return feature(feature2?.properties?.anchor?.geometry);
4605
- return feature(geometry);
4606
- })
4607
- );
4608
- }
4609
- clearHighlightElements() {
4610
- this.#clearAllElementOnLayerByName(HIGHLIGHT_LAYER_NAME);
4611
- (0, import_lodash7.default)(this.#highlightElementIds).map((elemId) => this.#elements[elemId]?.geometry).compact().forEach((geometry) => {
4612
- if (geometry instanceof import_maptalks_gl.ui.UIMarker) return;
4613
- if (geometry instanceof import_maptalks_gl.Marker) {
4614
- this.showGeometryByElementId(geometry.properties.id);
4615
- return;
4616
- }
4617
- try {
4618
- const defaultSymbol = geometry.options.defaultSymbol;
4619
- geometry.updateSymbol(defaultSymbol);
4620
- } catch (err) {
4621
- console.log(
4622
- `error cannot return to defaultSymbol, check if "defaultSymbol" exists in element creation function`
4623
- );
4624
- }
4625
- });
4626
- this.#highlightElementIds = [];
4627
- }
4628
- setHighlightedObject(targetObjectIds, options = {}) {
4629
- const { symbolSet } = import_lodash7.default.merge({}, DEFAULT_HIGHLIGHT_OPTIONS, options);
4630
- const {
4631
- getElementSymbol,
4632
- getHilighPolygonalSymbol,
4633
- createHighlight2DAmenityMarkerFrom3DMarker
4634
- } = this.#styler;
4635
- const objects = this.threeLayer?.getBaseObjects();
4636
- const objectsToHighlight = objects.filter(
4637
- ({ properties }) => targetObjectIds.includes(properties?.id)
4638
- );
4639
- const defaultSymbol = getHilighPolygonalSymbol("Polygon");
4640
- const targetSymbol = symbolSet ? getElementSymbol(symbolSet) : null;
4641
- const { polygonFill: color } = import_lodash7.default.isEmpty(targetSymbol) ? defaultSymbol : targetSymbol;
4642
- const amenityHighlightMode = import_lodash7.default.get(
4643
- this.#mapConfig,
4644
- "amenity_highlight_mode",
4645
- ""
4646
- );
4647
- objectsToHighlight.forEach((obj) => {
4648
- if (obj.type === "ExtrudePolygon") {
4649
- const newController = createHighlighExtrudeObjectController(obj, {
4650
- color
4651
- });
4652
- newController.start();
4653
- this.#highlightObjectControllers.push(newController);
4654
- }
4655
- if (obj instanceof SpriteMarker) {
4656
- if (amenityHighlightMode === "2DMarker") {
4657
- const hilight2DLayer = this.map.getLayer(HIGHLIGHT_LAYER_NAME);
4658
- const extrudeConfig = import_lodash7.default.get(this.#mapConfig, "extrude");
4659
- obj.hide();
4660
- const { properties: featureProperties } = obj;
4661
- createHighlight2DAmenityMarkerFrom3DMarker(
4662
- featureProperties,
4663
- extrudeConfig
4664
- ).on("click", this.handleClickElement).addTo(hilight2DLayer);
4665
- } else {
4666
- obj.highlight();
4667
- }
4668
- }
4669
- if (obj instanceof Billboard) {
4670
- const newController = createHighlighBillboardController(obj);
4671
- newController.start();
4672
- this.#highlightObjectControllers.push(newController);
4673
- }
4674
- });
4675
- this.#highlightObjectIds = targetObjectIds;
4676
- }
4677
- clearHighlightObject() {
4678
- this.#highlightObjectControllers.forEach((controller) => {
4679
- if (import_lodash7.default.isFunction(controller?.clear)) controller.clear();
4680
- });
4681
- this.#highlightObjectIds.forEach((objIds) => {
4682
- const objects = this.threeLayer?.getBaseObjects();
4683
- const objectToResetHighlight = objects.find(
4684
- ({ properties }) => objIds.includes(properties?.id)
4685
- );
4686
- if (objectToResetHighlight instanceof SpriteMarker) {
4687
- objectToResetHighlight.show();
4688
- objectToResetHighlight.removeHighlight();
4689
- }
4690
- });
4691
- this.#highlightObjectControllers = [];
4692
- this.#highlightObjectIds = [];
4693
- }
4694
5038
  /**
4695
5039
  * User Location
4696
5040
  ****************************/
@@ -4715,15 +5059,15 @@ var IndoorMap = class extends EventTarget {
4715
5059
  }
4716
5060
  }
4717
5061
  updateUserLocationSymbolByLocale(locale) {
4718
- const userLocationGeometry = import_lodash7.default.get(
5062
+ const userLocationGeometry = import_lodash6.default.get(
4719
5063
  this.#elements,
4720
5064
  `${USER_LOCATION_ELEMENT_ID}.geometry`
4721
5065
  );
4722
5066
  if (!userLocationGeometry) return;
4723
5067
  const currentSymbol = userLocationGeometry.getSymbol();
4724
5068
  const localeSymbolToUpdate = currentSymbol.map((symbol) => {
4725
- const localeSymbol = import_lodash7.default.get(symbol, `${LOCALE_SYMBOL_KEY}.${locale}`) || import_lodash7.default.get(symbol, `${LOCALE_SYMBOL_KEY}.default`);
4726
- if (!import_lodash7.default.isPlainObject(localeSymbol)) return symbol;
5069
+ const localeSymbol = import_lodash6.default.get(symbol, `${LOCALE_SYMBOL_KEY}.${locale}`) || import_lodash6.default.get(symbol, `${LOCALE_SYMBOL_KEY}.default`);
5070
+ if (!import_lodash6.default.isPlainObject(localeSymbol)) return symbol;
4727
5071
  return {
4728
5072
  ...symbol,
4729
5073
  ...localeSymbol
@@ -4797,14 +5141,14 @@ var IndoorMap = class extends EventTarget {
4797
5141
  * END of User Location
4798
5142
  ****************************/
4799
5143
  showGeometryByElementId = (elementId) => {
4800
- const geometry = import_lodash7.default.get(
5144
+ const geometry = import_lodash6.default.get(
4801
5145
  this.#elements,
4802
5146
  `${elementId}.geometry`
4803
5147
  );
4804
5148
  if (geometry) geometry.show();
4805
5149
  };
4806
5150
  hideGeometryByElementId = (elementId) => {
4807
- const geometry = import_lodash7.default.get(this.#elements, `${elementId}.geometry`);
5151
+ const geometry = import_lodash6.default.get(this.#elements, `${elementId}.geometry`);
4808
5152
  if (geometry) geometry.hide();
4809
5153
  };
4810
5154
  setSpriteMarkersOpacity = (opacity = 1) => {
@@ -4851,13 +5195,13 @@ var IndoorMap = class extends EventTarget {
4851
5195
  const line = lineStrings[i];
4852
5196
  const coords = line.geometry.coordinates;
4853
5197
  const prevLine = lineStrings[i - 1];
4854
- const firstCoord = import_lodash7.default.first(coords);
5198
+ const firstCoord = import_lodash6.default.first(coords);
4855
5199
  const isFirstLine = i === 0;
4856
5200
  if (isFirstLine) {
4857
5201
  accLine.push(...coords);
4858
5202
  continue;
4859
5203
  }
4860
- const prevLastCoord = import_lodash7.default.last(prevLine.geometry.coordinates);
5204
+ const prevLastCoord = import_lodash6.default.last(prevLine.geometry.coordinates);
4861
5205
  const isNearby = (0, import_distance.default)(point(firstCoord), point(prevLastCoord)) < distance;
4862
5206
  if (!isNearby) {
4863
5207
  const remainingLines = lineStrings.slice(i);
@@ -4878,8 +5222,8 @@ var IndoorMap = class extends EventTarget {
4878
5222
  create3DStepPath
4879
5223
  } = this.#styler;
4880
5224
  const routeMarkerLayer = this.map.getLayer(HIGHLIGHT_LAYER_NAME);
4881
- const linesByOrdinal = (0, import_lodash7.default)(stepGeometries).filter(({ geometry }) => geometry.type === "LineString").groupBy("properties.ordinal").value();
4882
- const joinedLines = (0, import_lodash7.default)(linesByOrdinal).reduce((acc, lines, key) => {
5225
+ const linesByOrdinal = (0, import_lodash6.default)(stepGeometries).filter(({ geometry }) => geometry.type === "LineString").groupBy("properties.ordinal").value();
5226
+ const joinedLines = (0, import_lodash6.default)(linesByOrdinal).reduce((acc, lines, key) => {
4883
5227
  const joined = this.combineNearbyLineStrings(lines, {
4884
5228
  properties: { ordinal: +key }
4885
5229
  });
@@ -4907,14 +5251,14 @@ var IndoorMap = class extends EventTarget {
4907
5251
  stepElement = createOriginMarker(stepGeometry).addTo(routeMarkerLayer);
4908
5252
  break;
4909
5253
  case "destination-marker":
4910
- const extrudeConfig = import_lodash7.default.get(this.#mapConfig, "extrude");
5254
+ const extrudeConfig = import_lodash6.default.get(this.#mapConfig, "extrude");
4911
5255
  if (destinationFeature.feature_type === "occupant") {
4912
- const stepId = import_lodash7.default.get(stepGeometry, "id");
5256
+ const stepId = import_lodash6.default.get(stepGeometry, "id");
4913
5257
  const normalizedDestinationFeature = {
4914
5258
  ...destinationFeature,
4915
5259
  id: stepId
4916
5260
  };
4917
- const logoUrl = import_lodash7.default.get(
5261
+ const logoUrl = import_lodash6.default.get(
4918
5262
  normalizedDestinationFeature,
4919
5263
  "properties.logo.url"
4920
5264
  );
@@ -4959,15 +5303,15 @@ var IndoorMap = class extends EventTarget {
4959
5303
  const routeMarkerLayer = this.map.getLayer(
4960
5304
  HIGHLIGHT_LAYER_NAME
4961
5305
  );
4962
- const originMarkerGeometry = import_lodash7.default.get(
5306
+ const originMarkerGeometry = import_lodash6.default.get(
4963
5307
  this.#elements,
4964
5308
  `${ORIGIN_MARKER_ID}.geometry`
4965
5309
  );
4966
- const destinationMarkerGeometry = import_lodash7.default.get(
5310
+ const destinationMarkerGeometry = import_lodash6.default.get(
4967
5311
  this.#elements,
4968
5312
  `${DESTINATION_MARKER_ID}.geometry`
4969
5313
  );
4970
- const geometriesToRemove = import_lodash7.default.compact([
5314
+ const geometriesToRemove = import_lodash6.default.compact([
4971
5315
  originMarkerGeometry,
4972
5316
  destinationMarkerGeometry
4973
5317
  ]);
@@ -4978,7 +5322,7 @@ var IndoorMap = class extends EventTarget {
4978
5322
  (obj) => !(obj instanceof NavigationPath)
4979
5323
  );
4980
5324
  const objects = this.#navigationGeometries || {};
4981
- import_lodash7.default.forEach(objects, (obj) => {
5325
+ import_lodash6.default.forEach(objects, (obj) => {
4982
5326
  if (!obj) return;
4983
5327
  this.#navigationGeometries[obj.properties.id] = null;
4984
5328
  obj.remove();
@@ -5015,7 +5359,7 @@ var IndoorMap = class extends EventTarget {
5015
5359
  }
5016
5360
  if (this.threeLayer) {
5017
5361
  const currentView = this.camera.getView();
5018
- const objectOpacity = import_lodash7.default.clamp(38 - 2 * currentView.zoom, 0, 1);
5362
+ const objectOpacity = import_lodash6.default.clamp(38 - 2 * currentView.zoom, 0, 1);
5019
5363
  this.#objects.forEach((object) => {
5020
5364
  object.getObject3d().traverse((child) => {
5021
5365
  if (child.isMesh) child.material.opacity = objectOpacity;
@@ -5025,7 +5369,7 @@ var IndoorMap = class extends EventTarget {
5025
5369
  });
5026
5370
  if (this.#billboardObjects) {
5027
5371
  this.#billboardObjects.forEach((object) => {
5028
- const objectScale = import_lodash7.default.clamp(
5372
+ const objectScale = import_lodash6.default.clamp(
5029
5373
  20 - 1 * currentView.zoom,
5030
5374
  1,
5031
5375
  1.05
@@ -5034,7 +5378,7 @@ var IndoorMap = class extends EventTarget {
5034
5378
  });
5035
5379
  }
5036
5380
  if (this.#isLayersFadingOnZoom) {
5037
- const layerOpacity = import_lodash7.default.clamp(1 - objectOpacity, 0, 1);
5381
+ const layerOpacity = import_lodash6.default.clamp(1 - objectOpacity, 0, 1);
5038
5382
  LAYERS.forEach((layerKey) => {
5039
5383
  const layer = this.map.getLayer(layerKey);
5040
5384
  if (layer) layer.setOpacity(layerOpacity);
@@ -5048,24 +5392,18 @@ var IndoorMap = class extends EventTarget {
5048
5392
  child.visible = this.showVenueObject && objectOpacity > 0.4;
5049
5393
  });
5050
5394
  });
5051
- this.#groundObjects.forEach((gLabel) => {
5052
- gLabel.bearing = currBearing;
5053
- });
5054
5395
  }
5055
5396
  this.#animationsToRun.forEach(({ callback }) => callback(this));
5056
- import_tween2.default.update();
5397
+ import_tween.default.update();
5057
5398
  requestAnimationFrame(this.render.bind(this));
5058
5399
  }
5059
5400
  };
5060
5401
  // Annotate the CommonJS export names for ESM import in node:
5061
5402
  0 && (module.exports = {
5062
5403
  ALL_FEATURE_TYPES,
5063
- ALWAYS_VISIBLE_FEATURE_TYPES,
5064
5404
  BASE_LAYER_NAME,
5065
5405
  DEFAULT_BASE_URL,
5066
- DEFAULT_HIGHLIGHT_OPTIONS,
5067
5406
  DEFAULT_LOCALE,
5068
- DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS,
5069
5407
  DESTINATION_MARKER_ID,
5070
5408
  GEOJSON_FEATURE_TYPES,
5071
5409
  HIGHLIGHT_LAYER_NAME,
@@ -5082,6 +5420,7 @@ var IndoorMap = class extends EventTarget {
5082
5420
  OccupantHelpers,
5083
5421
  POI_MARKER_LAYER_NAME,
5084
5422
  QueryObserver,
5423
+ TextSpriteMarker,
5085
5424
  USER_LOCATION_ELEMENT_ID,
5086
5425
  USER_LOCATION_LAYER_NAME,
5087
5426
  VENUE_EVENTS,