venue-js 1.2.0-next.13 → 1.2.0-next.14

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
@@ -294,16 +294,16 @@ function isValidLinearRingCoordinates(ring) {
294
294
  }
295
295
  return ring.every(isValidCoordinate) && ring[0][0] === ring[ring.length - 1][0] && ring[0][1] === ring[ring.length - 1][1];
296
296
  }
297
- var isValidPolygonCoordinates = (polygon) => {
298
- if (Array.isArray(polygon[0]) && (polygon[0].length === 0 || typeof polygon[0][0] === "number")) {
299
- return isValidLinearRingCoordinates(polygon);
297
+ var isValidPolygonCoordinates = (polygon2) => {
298
+ if (Array.isArray(polygon2[0]) && (polygon2[0].length === 0 || typeof polygon2[0][0] === "number")) {
299
+ return isValidLinearRingCoordinates(polygon2);
300
300
  }
301
- if (Array.isArray(polygon) && polygon.length > 0 && Array.isArray(polygon[0])) {
302
- if (!isValidLinearRingCoordinates(polygon[0])) {
301
+ if (Array.isArray(polygon2) && polygon2.length > 0 && Array.isArray(polygon2[0])) {
302
+ if (!isValidLinearRingCoordinates(polygon2[0])) {
303
303
  return false;
304
304
  }
305
- for (let i = 1; i < polygon.length; i++) {
306
- if (!isValidLinearRingCoordinates(polygon[i])) {
305
+ for (let i = 1; i < polygon2.length; i++) {
306
+ if (!isValidLinearRingCoordinates(polygon2[i])) {
307
307
  return false;
308
308
  }
309
309
  }
@@ -346,7 +346,7 @@ var isValidPoint = (geometry) => {
346
346
  function isInFilter(filter) {
347
347
  return typeof filter === "object" && filter !== null && "$in" in filter && Array.isArray(filter.$in);
348
348
  }
349
- var someIntersect = (a, b) => a.some((v) => b.includes(v));
349
+ var someIntersect = (a, b) => a.some((v2) => b.includes(v2));
350
350
  function matchFilter(value, filter) {
351
351
  if (Array.isArray(value)) {
352
352
  if (isInFilter(filter)) return someIntersect(value, filter.$in);
@@ -823,6 +823,28 @@ function point(coordinates, properties, options = {}) {
823
823
  };
824
824
  return feature(geom, properties, options);
825
825
  }
826
+ function polygon(coordinates, properties, options = {}) {
827
+ for (const ring of coordinates) {
828
+ if (ring.length < 4) {
829
+ throw new Error(
830
+ "Each LinearRing of a Polygon must have 4 or more Positions."
831
+ );
832
+ }
833
+ if (ring[ring.length - 1].length !== ring[0].length) {
834
+ throw new Error("First and last Position are not equivalent.");
835
+ }
836
+ for (let j = 0; j < ring[ring.length - 1].length; j++) {
837
+ if (ring[ring.length - 1][j] !== ring[0][j]) {
838
+ throw new Error("First and last Position are not equivalent.");
839
+ }
840
+ }
841
+ }
842
+ const geom = {
843
+ type: "Polygon",
844
+ coordinates
845
+ };
846
+ return feature(geom, properties, options);
847
+ }
826
848
  function lineString(coordinates, properties, options = {}) {
827
849
  if (coordinates.length < 2) {
828
850
  throw new Error("coordinates must be an array of two or more positions");
@@ -930,10 +952,10 @@ var VENUE_EVENTS = {
930
952
 
931
953
  // src/IndoorMap/utils/createElements.js
932
954
  var import_lodash4 = __toESM(require("lodash"));
933
- var import_maptalks5 = require("maptalks");
955
+ var import_maptalks4 = require("maptalks");
934
956
  var import_center2 = __toESM(require("@turf/center"));
935
957
  var import_buffer = __toESM(require("@turf/buffer"));
936
- var import_three5 = require("three");
958
+ var import_three4 = require("three");
937
959
  var import_GLTFLoader = require("three/examples/jsm/loaders/GLTFLoader.js");
938
960
 
939
961
  // src/IndoorMap/object3d/Billboard.js
@@ -966,7 +988,7 @@ var Billboard = class extends import_maptalks.BaseObject {
966
988
  this._initOptions(options);
967
989
  const {
968
990
  altitude = OPTIONS.altitude,
969
- scale: scale2 = OPTIONS.scale,
991
+ scale: scale3 = OPTIONS.scale,
970
992
  alphaTest = OPTIONS.alphaTest,
971
993
  legColor = OPTIONS.legColor,
972
994
  showLeg = OPTIONS.showLeg
@@ -1000,8 +1022,8 @@ var Billboard = class extends import_maptalks.BaseObject {
1000
1022
  const sprite = new import_three.Sprite(material);
1001
1023
  sprite.material.sizeAttenuation = false;
1002
1024
  sprite.scale.set(
1003
- scale2 * naturalWidth / divider,
1004
- scale2 * naturalHeight / divider,
1025
+ scale3 * naturalWidth / divider,
1026
+ scale3 * naturalHeight / divider,
1005
1027
  1
1006
1028
  );
1007
1029
  this.getObject3d().add(sprite);
@@ -1010,7 +1032,7 @@ var Billboard = class extends import_maptalks.BaseObject {
1010
1032
  const position = layer.coordinateToVector3(coordinate, z);
1011
1033
  import_lodash.default.set(this.properties, "default.position", position);
1012
1034
  import_lodash.default.set(this.properties, "default.altitude", altitude);
1013
- import_lodash.default.set(this.properties, "default.scale", scale2);
1035
+ import_lodash.default.set(this.properties, "default.scale", scale3);
1014
1036
  this.getObject3d().position.copy(position);
1015
1037
  }
1016
1038
  setLineHeight(altitude) {
@@ -1023,383 +1045,93 @@ var Billboard = class extends import_maptalks.BaseObject {
1023
1045
  }
1024
1046
  };
1025
1047
 
1026
- // src/IndoorMap/object3d/GroundLabel.ts
1027
- var maptalks2 = __toESM(require("maptalks"));
1048
+ // src/IndoorMap/object3d/SpriteMarker.ts
1028
1049
  var import_maptalks2 = require("maptalks.three");
1029
1050
  var import_three2 = require("three");
1030
- var import_d3plus_shape = require("d3plus-shape");
1031
- var import_lodash_es = require("lodash-es");
1032
- var OPTIONS2 = {
1033
- // Allowing click through and prevent interaction
1034
- interactive: false,
1035
- altitude: 0
1036
- };
1037
- var defaultFlatLabelOptions = {
1038
- fontSize: 14,
1039
- fontFamily: "Manrope",
1040
- fontWeight: 600,
1041
- margin: 0,
1042
- scaleMin: 0.5,
1043
- lineHeight: 1.05,
1044
- scaleStep: 0.05,
1045
- textAlign: "center",
1046
- textBaseline: "middle",
1047
- fillStyle: "#000"
1048
- };
1049
- var defaultRectAngleToCalc = (0, import_lodash_es.range)(-90, 92, 2);
1050
- var getMaterial = (text, flatLabelOptions) => {
1051
- const options = (0, import_lodash_es.merge)({}, defaultFlatLabelOptions, flatLabelOptions);
1052
- const {
1053
- fontSize: initialFontSize,
1054
- fontFamily,
1055
- fontWeight,
1056
- margin,
1057
- scaleMin,
1058
- scaleStep,
1059
- fillStyle,
1060
- lineHeight,
1061
- textAlign,
1062
- strokeStyle,
1063
- lineWidth,
1064
- textBaseline
1065
- } = options;
1066
- const pixelMultiplier = 4;
1067
- const SIZE = 100 * pixelMultiplier;
1068
- const fontSize = initialFontSize * (pixelMultiplier * 1.25);
1069
- const canvas = document.createElement("canvas");
1070
- canvas.width = canvas.height = SIZE;
1071
- const ctx = canvas.getContext("2d");
1072
- ctx.font = `${fontWeight} ${fontSize}px "${fontFamily}", Arial`;
1073
- ctx.textAlign = textAlign;
1074
- ctx.textBaseline = textBaseline;
1075
- ctx.fillStyle = fillStyle;
1076
- ctx.strokeStyle = strokeStyle;
1077
- ctx.lineWidth = lineWidth;
1078
- const wrapText = (ctx2, text2, maxWidth) => {
1079
- const words = text2.trim().split(/\s+/);
1080
- if (words.length <= 1) return [text2];
1081
- const lines = [];
1082
- const MAX_LINES = 3;
1083
- let currentLine = words[0];
1084
- for (let i = 1; i < words.length; i++) {
1085
- const lineToMeasure = currentLine + " " + words[i];
1086
- if (ctx2.measureText(lineToMeasure).width > maxWidth) {
1087
- lines.push(currentLine);
1088
- currentLine = words[i];
1089
- } else {
1090
- currentLine = lineToMeasure;
1091
- }
1092
- }
1093
- lines.push(currentLine);
1094
- return lines.slice(0, MAX_LINES);
1095
- };
1096
- const hasManualBreaks = text.includes("\n");
1097
- let texts;
1098
- if (hasManualBreaks) {
1099
- texts = text.split(/\n/g);
1100
- } else {
1101
- const maxWidth = SIZE - 2 * margin;
1102
- texts = wrapText(ctx, text, maxWidth);
1103
- }
1104
- let textWidth = (0, import_lodash_es.max)(texts.map((text2) => ctx.measureText(text2).width));
1105
- let scale2 = 1;
1106
- while (scale2 > 0 && textWidth + 2 * margin > SIZE) {
1107
- scale2 -= scaleStep;
1108
- ctx.font = `${fontWeight} ${scale2 * fontSize}px "${fontFamily}", Arial`;
1109
- textWidth = (0, import_lodash_es.max)(texts.map((text2) => ctx.measureText(text2).width));
1110
- }
1111
- const center2 = { x: 0.5 * SIZE, y: 0.5 * SIZE };
1112
- if (scale2 > scaleMin) {
1113
- const totalHeight = texts.length * (fontSize * scale2 * lineHeight);
1114
- const startY = center2.y - totalHeight / 2 + fontSize * scale2 * lineHeight * 0.5;
1115
- texts.forEach((text2, index) => {
1116
- const yOffset = startY + index * (fontSize * scale2 * lineHeight);
1117
- if (strokeStyle && lineWidth) {
1118
- ctx.strokeText(text2, center2.x, yOffset);
1119
- }
1120
- ctx.fillText(text2, center2.x, yOffset);
1121
- });
1051
+ var import_lodash2 = __toESM(require("lodash"));
1052
+ var DEFAULT_SCALE = 0.05;
1053
+ var DEFAULT_ALTITUDE = 0;
1054
+ var DEFAULT_ALPHATEST = 0.3;
1055
+ var DEFAULT_OPTIONS = {
1056
+ scale: DEFAULT_SCALE,
1057
+ altitude: DEFAULT_ALTITUDE,
1058
+ alphaTest: DEFAULT_ALPHATEST,
1059
+ highlight: {
1060
+ options: {
1061
+ scale: DEFAULT_SCALE * 1.25
1062
+ },
1063
+ material: null
1122
1064
  }
1123
- const texture = new import_three2.Texture(canvas);
1124
- texture.needsUpdate = true;
1125
- const material = new import_three2.MeshPhongMaterial({
1126
- map: texture,
1127
- transparent: true,
1128
- // @ref: https://threejs.org/docs/#api/en/materials/Material.alphaTest
1129
- alphaTest: 0.3
1130
- });
1131
- return material;
1132
1065
  };
1133
- var GroundLabel = class extends import_maptalks2.BaseObject {
1134
- #angle = 0;
1135
- #bearing = 0;
1136
- #text = "";
1137
- #offsetX = 0;
1138
- #offsetY = 0;
1139
- #originalPosition = null;
1140
- #layer = null;
1141
- constructor(bound, options, layer) {
1142
- options = maptalks2.Util.extend({}, OPTIONS2, options, {
1143
- layer,
1144
- coordinate: bound
1145
- });
1146
- const {
1147
- altitude,
1148
- text,
1149
- fontSize,
1150
- fillStyle,
1151
- textAlign,
1152
- fontFamily,
1153
- textBaseline,
1154
- strokeStyle,
1155
- lineWidth,
1156
- angle = defaultRectAngleToCalc,
1157
- maxFontScale,
1158
- offsetX = 0,
1159
- offsetY = 0,
1160
- ...properties
1161
- } = options;
1066
+ var SpriteMarker = class extends import_maptalks2.BaseObject {
1067
+ #default = null;
1068
+ #highlight = null;
1069
+ constructor(coordinate, options, material, layer, properties) {
1162
1070
  super();
1163
1071
  this._initOptions(options);
1164
- this.properties = properties;
1165
- this.#offsetX = offsetX;
1166
- this.#offsetY = offsetY;
1167
- this.#layer = layer;
1168
- const material = getMaterial(text, {
1169
- fillStyle,
1170
- fontSize,
1171
- textAlign,
1172
- textBaseline,
1173
- fontFamily,
1174
- strokeStyle,
1175
- lineWidth
1176
- });
1177
- const rectAngles = (0, import_lodash_es.isArray)(angle) ? angle : [angle];
1178
- material.needsUpdate = true;
1179
- const rect = (0, import_d3plus_shape.largestRect)(bound, {
1180
- cache: true,
1181
- /**
1182
- * Black magic here:
1183
- * For some reason if we allow angle -90 or 90, some polygon will use that angle even if it's wrong angle to use.
1184
- * So we remove -90 and 90 from choices, and use -85 & 85 instead.
1185
- */
1186
- angle: rectAngles
1187
- });
1188
- const { cx, cy, width, angle: calculatedAngle } = rect;
1189
- this.#text = text;
1190
- this.#angle = calculatedAngle;
1191
- const geometry = new import_three2.PlaneGeometry(1, 1);
1192
- this._createMesh(geometry, material);
1193
- const z = layer.altitudeToVector3(altitude, altitude).x;
1194
- const basePosition = layer.coordinateToVector3({ x: cx, y: cy }, z);
1195
- this.#originalPosition = basePosition.clone();
1196
- const finalPosition = this.#calculateFinalPosition(basePosition);
1197
- const scale2 = width / 6456122659e-13;
1198
- const finalScale = maxFontScale && scale2 > maxFontScale ? maxFontScale : scale2;
1199
- this.getObject3d().scale.set(finalScale, finalScale, finalScale);
1200
- this.getObject3d().position.copy(finalPosition);
1201
- this.getObject3d().rotation.z = Math.PI / 180 * this.#angle;
1202
- }
1203
- #calculateFinalPosition(basePosition) {
1204
- if (this.#offsetX === 0 && this.#offsetY === 0) {
1205
- return basePosition;
1206
- }
1207
- const offsetCoordinate = {
1208
- x: this.#offsetX,
1209
- y: this.#offsetY
1210
- };
1211
- const z = this.#layer.altitudeToVector3(0, 0).x;
1212
- const offsetVector = this.#layer.coordinateToVector3(offsetCoordinate, z);
1213
- const zeroVector = this.#layer.coordinateToVector3({ x: 0, y: 0 }, z);
1214
- const worldOffsetX = offsetVector.x - zeroVector.x;
1215
- const worldOffsetY = offsetVector.y - zeroVector.y;
1216
- return {
1217
- x: basePosition.x + worldOffsetX,
1218
- y: basePosition.y + worldOffsetY,
1219
- z: basePosition.z
1220
- };
1072
+ this._createGroup();
1073
+ const {
1074
+ altitude = DEFAULT_OPTIONS.altitude,
1075
+ scale: scale3 = DEFAULT_OPTIONS.scale,
1076
+ highlight = DEFAULT_OPTIONS.highlight,
1077
+ alphaTest = DEFAULT_OPTIONS.alphaTest
1078
+ } = options;
1079
+ this.properties = { ...properties };
1080
+ const modifiedAltitude = altitude + 2;
1081
+ this.#default = { options: { scale: scale3, altitude: modifiedAltitude }, material };
1082
+ this.#highlight = import_lodash2.default.merge({}, DEFAULT_OPTIONS.highlight, highlight);
1083
+ if (material && material instanceof import_three2.SpriteMaterial)
1084
+ material.alphaTest = alphaTest;
1085
+ const sprite = new import_three2.Sprite(material);
1086
+ sprite.scale.set(scale3, scale3, scale3);
1087
+ const obj3d = this.getObject3d();
1088
+ obj3d.add(sprite);
1089
+ const z = layer.altitudeToVector3(modifiedAltitude, modifiedAltitude).x;
1090
+ const position = layer.coordinateToVector3(coordinate, z);
1091
+ import_lodash2.default.set(this.properties, "default.position", position);
1092
+ this.getObject3d().position.copy(position);
1221
1093
  }
1222
- #updatePosition() {
1223
- if (this.#originalPosition && this.#layer) {
1224
- const finalPosition = this.#calculateFinalPosition(this.#originalPosition);
1225
- this.getObject3d().position.copy(finalPosition);
1094
+ // Different objects need to implement their own methods
1095
+ setSymbol(material) {
1096
+ if (material && material instanceof import_three2.SpriteMaterial) {
1097
+ const sprite = this.getObject3d().children[0];
1098
+ if (!sprite) return this;
1099
+ sprite.material = material;
1100
+ sprite.material.needsUpdate = true;
1226
1101
  }
1102
+ return this;
1227
1103
  }
1228
- set bearing(value) {
1229
- this.#bearing = value;
1230
- const degree = this.#angle + this.#bearing;
1231
- const angle = degree > 90 || degree < -90 ? this.#angle + 180 : this.#angle;
1232
- this.getObject3d().rotation.z = Math.PI / 180 * angle;
1104
+ setScale(scaleX, scaleY = scaleX, scaleZ = scaleX) {
1105
+ const sprite = this.getObject3d().children[0];
1106
+ if (!sprite) return this;
1107
+ sprite.scale.set(scaleX, scaleY, scaleZ);
1108
+ return this;
1233
1109
  }
1234
- get angle() {
1235
- return this.#angle;
1110
+ // Different objects need to implement their own methods
1111
+ getSymbol() {
1112
+ return this.getObject3d()?.children[0]?.material;
1236
1113
  }
1237
- get currentAngle() {
1238
- return this.#angle;
1114
+ highlight() {
1115
+ const { material, options } = this.#highlight;
1116
+ if (material) this.setSymbol(material);
1117
+ if (options.scale) this.setScale(options.scale);
1118
+ if (options.altitude) this.setAltitude(options.altitude);
1119
+ return this;
1239
1120
  }
1240
- get text() {
1241
- return this.#text;
1242
- }
1243
- get offsetX() {
1244
- return this.#offsetX;
1245
- }
1246
- get offsetY() {
1247
- return this.#offsetY;
1248
- }
1249
- get offset() {
1250
- return { x: this.#offsetX, y: this.#offsetY };
1251
- }
1252
- set offsetX(value) {
1253
- if ((0, import_lodash_es.isNumber)(value)) {
1254
- this.#offsetX = value;
1255
- this.#updatePosition();
1256
- }
1257
- }
1258
- set offsetY(value) {
1259
- if ((0, import_lodash_es.isNumber)(value)) {
1260
- this.#offsetY = value;
1261
- this.#updatePosition();
1262
- }
1263
- }
1264
- set angle(newAngle) {
1265
- if ((0, import_lodash_es.isNumber)(newAngle)) {
1266
- this.#angle = newAngle;
1267
- this.getObject3d().rotation.z = Math.PI / 180 * this.#angle;
1268
- }
1269
- }
1270
- setOffset(offsetX, offsetY) {
1271
- if ((0, import_lodash_es.isNumber)(offsetX) && (0, import_lodash_es.isNumber)(offsetY)) {
1272
- this.#offsetX = offsetX;
1273
- this.#offsetY = offsetY;
1274
- this.#updatePosition();
1275
- }
1276
- }
1277
- addOffset(deltaX, deltaY) {
1278
- if ((0, import_lodash_es.isNumber)(deltaX) && (0, import_lodash_es.isNumber)(deltaY)) {
1279
- this.#offsetX += deltaX;
1280
- this.#offsetY += deltaY;
1281
- this.#updatePosition();
1282
- }
1283
- }
1284
- resetOffset() {
1285
- this.#offsetX = 0;
1286
- this.#offsetY = 0;
1287
- this.#updatePosition();
1288
- }
1289
- moveToPosition(targetX, targetY) {
1290
- if (this.#originalPosition && this.#layer) {
1291
- const currentCenter = this.#layer.vector3ToCoordinate(
1292
- this.#originalPosition
1293
- );
1294
- this.#offsetX = targetX - currentCenter.x;
1295
- this.#offsetY = targetY - currentCenter.y;
1296
- this.#updatePosition();
1297
- }
1298
- }
1299
- updateText(newText, options = {}) {
1300
- this.#text = newText;
1301
- const materialOptions = {
1302
- fillStyle: options.fillStyle || this.properties.fillStyle,
1303
- fontSize: options.fontSize || this.properties.fontSize,
1304
- textAlign: options.textAlign || this.properties.textAlign,
1305
- textBaseline: options.textBaseline || this.properties.textBaseline,
1306
- fontFamily: options.fontFamily || this.properties.fontFamily,
1307
- strokeStyle: options.strokeStyle || this.properties.strokeStyle,
1308
- lineWidth: options.lineWidth || this.properties.lineWidth
1309
- };
1310
- const newMaterial = getMaterial(newText, materialOptions);
1311
- this.getObject3d().material = newMaterial;
1312
- newMaterial.needsUpdate = true;
1121
+ removeHighlight() {
1122
+ const { material, options } = this.#default;
1123
+ if (material) this.setSymbol(material);
1124
+ if (options.scale) this.setScale(options.scale);
1125
+ if (options.altitude) this.setAltitude(options.altitude);
1126
+ return this;
1313
1127
  }
1314
1128
  };
1315
1129
 
1316
- // src/IndoorMap/object3d/SpriteMarker.ts
1130
+ // src/IndoorMap/object3d/NavigationPath.ts
1131
+ var maptalks2 = __toESM(require("maptalks"));
1317
1132
  var import_maptalks3 = require("maptalks.three");
1318
1133
  var import_three3 = require("three");
1319
- var import_lodash2 = __toESM(require("lodash"));
1320
- var DEFAULT_SCALE = 0.05;
1321
- var DEFAULT_ALTITUDE = 0;
1322
- var DEFAULT_ALPHATEST = 0.3;
1323
- var DEFAULT_OPTIONS = {
1324
- scale: DEFAULT_SCALE,
1325
- altitude: DEFAULT_ALTITUDE,
1326
- alphaTest: DEFAULT_ALPHATEST,
1327
- highlight: {
1328
- options: {
1329
- scale: DEFAULT_SCALE * 1.25
1330
- },
1331
- material: null
1332
- }
1333
- };
1334
- var SpriteMarker = class extends import_maptalks3.BaseObject {
1335
- #default = null;
1336
- #highlight = null;
1337
- constructor(coordinate, options, material, layer, properties) {
1338
- super();
1339
- this._initOptions(options);
1340
- this._createGroup();
1341
- const {
1342
- altitude = DEFAULT_OPTIONS.altitude,
1343
- scale: scale2 = DEFAULT_OPTIONS.scale,
1344
- highlight = DEFAULT_OPTIONS.highlight,
1345
- alphaTest = DEFAULT_OPTIONS.alphaTest
1346
- } = options;
1347
- this.properties = { ...properties };
1348
- const modifiedAltitude = altitude + 2;
1349
- this.#default = { options: { scale: scale2, altitude: modifiedAltitude }, material };
1350
- this.#highlight = import_lodash2.default.merge({}, DEFAULT_OPTIONS.highlight, highlight);
1351
- if (material && material instanceof import_three3.SpriteMaterial)
1352
- material.alphaTest = alphaTest;
1353
- const sprite = new import_three3.Sprite(material);
1354
- sprite.scale.set(scale2, scale2, scale2);
1355
- const obj3d = this.getObject3d();
1356
- obj3d.add(sprite);
1357
- const z = layer.altitudeToVector3(modifiedAltitude, modifiedAltitude).x;
1358
- const position = layer.coordinateToVector3(coordinate, z);
1359
- import_lodash2.default.set(this.properties, "default.position", position);
1360
- this.getObject3d().position.copy(position);
1361
- }
1362
- // Different objects need to implement their own methods
1363
- setSymbol(material) {
1364
- if (material && material instanceof import_three3.SpriteMaterial) {
1365
- const sprite = this.getObject3d().children[0];
1366
- if (!sprite) return this;
1367
- sprite.material = material;
1368
- sprite.material.needsUpdate = true;
1369
- }
1370
- return this;
1371
- }
1372
- setScale(scaleX, scaleY = scaleX, scaleZ = scaleX) {
1373
- const sprite = this.getObject3d().children[0];
1374
- if (!sprite) return this;
1375
- sprite.scale.set(scaleX, scaleY, scaleZ);
1376
- return this;
1377
- }
1378
- // Different objects need to implement their own methods
1379
- getSymbol() {
1380
- return this.getObject3d()?.children[0]?.material;
1381
- }
1382
- highlight() {
1383
- const { material, options } = this.#highlight;
1384
- if (material) this.setSymbol(material);
1385
- if (options.scale) this.setScale(options.scale);
1386
- if (options.altitude) this.setAltitude(options.altitude);
1387
- return this;
1388
- }
1389
- removeHighlight() {
1390
- const { material, options } = this.#default;
1391
- if (material) this.setSymbol(material);
1392
- if (options.scale) this.setScale(options.scale);
1393
- if (options.altitude) this.setAltitude(options.altitude);
1394
- return this;
1395
- }
1396
- };
1397
-
1398
- // src/IndoorMap/object3d/NavigationPath.ts
1399
- var maptalks3 = __toESM(require("maptalks"));
1400
- var import_maptalks4 = require("maptalks.three");
1401
- var import_three4 = require("three");
1402
- var OPTIONS3 = {
1134
+ var OPTIONS2 = {
1403
1135
  altitude: 0
1404
1136
  };
1405
1137
  var DEFAULT_LINE_OPTION = {
@@ -1411,18 +1143,18 @@ var DEFAULT_LINE_EFFECT_OPTION = {
1411
1143
  opacity: 1
1412
1144
  };
1413
1145
  var ENABLE_ANIMATED_PATH = true;
1414
- var NavigationPath = class extends import_maptalks4.BaseObject {
1146
+ var NavigationPath = class extends import_maptalks3.BaseObject {
1415
1147
  constructor(feature2, layer, properties, options, lineOptions = DEFAULT_LINE_OPTION, outlineOption = DEFAULT_LINE_EFFECT_OPTION) {
1416
- options = maptalks3.Util.extend({}, OPTIONS3, options, {
1148
+ options = maptalks2.Util.extend({}, OPTIONS2, options, {
1417
1149
  layer
1418
1150
  });
1419
1151
  super();
1420
1152
  this._initOptions(options);
1421
- const { altitude = OPTIONS3.altitude } = options;
1153
+ const { altitude = OPTIONS2.altitude } = options;
1422
1154
  this.properties = { ...properties };
1423
1155
  this._createGroup();
1424
1156
  const { color: lineColor, opacity: lineOpacity } = lineOptions || DEFAULT_LINE_OPTION;
1425
- const staticMaterial = new import_three4.MeshBasicMaterial({
1157
+ const staticMaterial = new import_three3.MeshBasicMaterial({
1426
1158
  transparent: true,
1427
1159
  color: lineColor || "#fff",
1428
1160
  opacity: lineOpacity || 1,
@@ -1430,12 +1162,12 @@ var NavigationPath = class extends import_maptalks4.BaseObject {
1430
1162
  });
1431
1163
  const uniforms = {
1432
1164
  time: { value: 0 },
1433
- color: { value: new import_three4.Color(lineColor || "#fff") },
1165
+ color: { value: new import_three3.Color(lineColor || "#fff") },
1434
1166
  opacity: { value: lineOpacity || 1 }
1435
1167
  };
1436
1168
  this._uniforms = uniforms;
1437
1169
  this._t = 0;
1438
- const animatedMaterial = new import_three4.ShaderMaterial({
1170
+ const animatedMaterial = new import_three3.ShaderMaterial({
1439
1171
  uniforms,
1440
1172
  transparent: true,
1441
1173
  depthWrite: false,
@@ -1458,7 +1190,7 @@ var NavigationPath = class extends import_maptalks4.BaseObject {
1458
1190
  }
1459
1191
  `
1460
1192
  });
1461
- const pathGeometry = maptalks3.GeoJSON.toGeometry(feature2);
1193
+ const pathGeometry = maptalks2.GeoJSON.toGeometry(feature2);
1462
1194
  const line = layer.toPath(
1463
1195
  pathGeometry,
1464
1196
  {
@@ -1469,7 +1201,7 @@ var NavigationPath = class extends import_maptalks4.BaseObject {
1469
1201
  ENABLE_ANIMATED_PATH ? animatedMaterial : staticMaterial
1470
1202
  );
1471
1203
  const { color: outlineColor, opacity: outlineOpacity } = outlineOption || {};
1472
- const outlineMaterial = new import_three4.MeshBasicMaterial({
1204
+ const outlineMaterial = new import_three3.MeshBasicMaterial({
1473
1205
  transparent: true,
1474
1206
  color: outlineColor || "#fff",
1475
1207
  opacity: outlineOpacity || 1
@@ -1516,8 +1248,8 @@ var createPolygonFromLineString = (geometry) => {
1516
1248
  const right = (0, import_line_offset.default)(line, -0.3, { units: "meters" });
1517
1249
  const leftCoords = left.geometry.coordinates;
1518
1250
  const rightCoords = right.geometry.coordinates.reverse();
1519
- const polygon = [...leftCoords, ...rightCoords, leftCoords[0]];
1520
- return [polygon];
1251
+ const polygon2 = [...leftCoords, ...rightCoords, leftCoords[0]];
1252
+ return [polygon2];
1521
1253
  };
1522
1254
 
1523
1255
  // src/IndoorMap/utils/svg.ts
@@ -1551,14 +1283,14 @@ var createSVGPathFromMarkerSymbol = (style) => {
1551
1283
  markerFill,
1552
1284
  markerPath
1553
1285
  } = style;
1554
- const scale2 = markerWidth / 24;
1555
- return `<path d="${markerPath}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${markerFill}"/>`;
1286
+ const scale3 = markerWidth / 24;
1287
+ return `<path d="${markerPath}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale3})" fill="${markerFill}"/>`;
1556
1288
  };
1557
1289
 
1558
1290
  // src/IndoorMap/utils/createElements.js
1559
1291
  var GeometryType = {
1560
- Polygon: import_maptalks5.Polygon,
1561
- MultiPolygon: import_maptalks5.MultiPolygon
1292
+ Polygon: import_maptalks4.Polygon,
1293
+ MultiPolygon: import_maptalks4.MultiPolygon
1562
1294
  };
1563
1295
  var ORDINAL_HEIGHT = 0;
1564
1296
  var VENUE_Z_INDEX = 0;
@@ -1693,8 +1425,8 @@ var createObstructionalFixture = (feature2, style = {}, options = {}) => {
1693
1425
  if (allowOverride) import_lodash4.default.merge(symbolStyle, properties.style);
1694
1426
  if (inheritFillColorToLine) symbolStyle.lineColor = symbolStyle.polygonFill;
1695
1427
  if (geometry.type === "LineString") {
1696
- const polygon = createPolygonFromLineString(geometry);
1697
- return new GeometryType["Polygon"](polygon, {
1428
+ const polygon2 = createPolygonFromLineString(geometry);
1429
+ return new GeometryType["Polygon"](polygon2, {
1698
1430
  properties: {
1699
1431
  altitude: getAltitude(properties)
1700
1432
  },
@@ -1762,7 +1494,7 @@ var createPrincipalOpening = (feature2, style, options = {}) => {
1762
1494
  const symbolStyle = { ...style };
1763
1495
  if (allowOverride) import_lodash4.default.merge(symbolStyle, properties.style);
1764
1496
  try {
1765
- return new import_maptalks5.LineString(geometry.coordinates, {
1497
+ return new import_maptalks4.LineString(geometry.coordinates, {
1766
1498
  properties: {
1767
1499
  altitude: getAltitude(properties)
1768
1500
  },
@@ -1779,7 +1511,7 @@ var createEmergencyExitOpening = (feature2, style, options = {}) => {
1779
1511
  const symbolStyle = { ...style };
1780
1512
  if (allowOverride) import_lodash4.default.merge(symbolStyle, properties.style);
1781
1513
  try {
1782
- return new import_maptalks5.LineString(geometry.coordinates, {
1514
+ return new import_maptalks4.LineString(geometry.coordinates, {
1783
1515
  properties: {
1784
1516
  altitude: getAltitude(properties)
1785
1517
  },
@@ -1796,7 +1528,7 @@ var createPedestrianOpening = (feature2, style, options = {}) => {
1796
1528
  const symbolStyle = { ...style };
1797
1529
  if (allowOverride) import_lodash4.default.merge(symbolStyle, properties.style);
1798
1530
  try {
1799
- return new import_maptalks5.LineString(geometry.coordinates, {
1531
+ return new import_maptalks4.LineString(geometry.coordinates, {
1800
1532
  properties: {
1801
1533
  id,
1802
1534
  feature_type: "opening",
@@ -1884,7 +1616,7 @@ var getFeatureMarkerConfig = (feature2, mapConfig = {}) => {
1884
1616
  };
1885
1617
  };
1886
1618
  var createSpriteMaterialByLabelSymbol = (labelSymbol = []) => {
1887
- const material = new import_three5.SpriteMaterial();
1619
+ const material = new import_three4.SpriteMaterial();
1888
1620
  try {
1889
1621
  const [base, icon] = labelSymbol;
1890
1622
  const { markerWidth: baseWidth = 24 } = base;
@@ -1893,7 +1625,7 @@ var createSpriteMaterialByLabelSymbol = (labelSymbol = []) => {
1893
1625
  const baseSVG = createSVGPathFromMarkerSymbol(base);
1894
1626
  const iconSVG = createSVGPathFromMarkerSymbol(icon);
1895
1627
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${viewBoxDimension}" height="${viewBoxDimension}">${baseSVG}${iconSVG}</svg>`;
1896
- const textureLoader = new import_three5.TextureLoader();
1628
+ const textureLoader = new import_three4.TextureLoader();
1897
1629
  const scaleFactor = 200 / 24;
1898
1630
  svgToPng(svg, scaleFactor).then((png) => {
1899
1631
  const texture = textureLoader.load(png, () => {
@@ -2050,7 +1782,7 @@ var styledFeatureGenerator = (mapTheme) => {
2050
1782
  switch (renderType) {
2051
1783
  case "Logo":
2052
1784
  import_lodash4.default.set(priorityMarkerSymbol, "markerFile", logoUrl);
2053
- return new import_maptalks5.Marker(coordinates, {
1785
+ return new import_maptalks4.Marker(coordinates, {
2054
1786
  properties: {
2055
1787
  altitude: getAltitude(properties) + markerHeight,
2056
1788
  ...baseProperties
@@ -2058,7 +1790,7 @@ var styledFeatureGenerator = (mapTheme) => {
2058
1790
  symbol: priorityLabelSymbol
2059
1791
  });
2060
1792
  case "Logo + Name":
2061
- return new import_maptalks5.Marker(coordinates, {
1793
+ return new import_maptalks4.Marker(coordinates, {
2062
1794
  properties: {
2063
1795
  name: occupantName.en,
2064
1796
  altitude: getAltitude(properties) + markerHeight,
@@ -2078,7 +1810,7 @@ var styledFeatureGenerator = (mapTheme) => {
2078
1810
  }
2079
1811
  });
2080
1812
  case "None":
2081
- return new import_maptalks5.ui.UIMarker(coordinates, {
1813
+ return new import_maptalks4.ui.UIMarker(coordinates, {
2082
1814
  properties: { ...baseProperties },
2083
1815
  content: createStyledUIMarkerElement({
2084
1816
  style: { display: "none" },
@@ -2089,7 +1821,7 @@ var styledFeatureGenerator = (mapTheme) => {
2089
1821
  case "Name":
2090
1822
  default:
2091
1823
  if (textMarkerType === "marker") {
2092
- return new import_maptalks5.Marker(coordinates, {
1824
+ return new import_maptalks4.Marker(coordinates, {
2093
1825
  properties: {
2094
1826
  name: occupantName.en,
2095
1827
  altitude: getAltitude(properties) + markerHeight,
@@ -2119,7 +1851,7 @@ var styledFeatureGenerator = (mapTheme) => {
2119
1851
  `occupant-${import_lodash4.default.toLower(renderType)}-${renderPriority}`
2120
1852
  );
2121
1853
  const style = { ...uiMarkerSymbol, ...uiMarkerPrioritySymbol };
2122
- return new import_maptalks5.ui.UIMarker(coordinates, {
1854
+ return new import_maptalks4.ui.UIMarker(coordinates, {
2123
1855
  properties: { ...baseProperties },
2124
1856
  content: createStyledUIMarkerElement({
2125
1857
  style,
@@ -2196,7 +1928,7 @@ var styledFeatureGenerator = (mapTheme) => {
2196
1928
  const { geometry, properties } = feature2;
2197
1929
  const coordinates = getCenterFromGeometry(geometry);
2198
1930
  const markerSymbol = getElementSymbol("pin-marker");
2199
- return new import_maptalks5.Marker(coordinates, {
1931
+ return new import_maptalks4.Marker(coordinates, {
2200
1932
  properties: {
2201
1933
  altitude: getAltitude(properties)
2202
1934
  },
@@ -2211,7 +1943,7 @@ var styledFeatureGenerator = (mapTheme) => {
2211
1943
  const coordinates = getCenterFromGeometry(geometry);
2212
1944
  const markerSymbol = getElementSymbol("origin-marker");
2213
1945
  try {
2214
- return new import_maptalks5.Marker(coordinates, {
1946
+ return new import_maptalks4.Marker(coordinates, {
2215
1947
  properties: {
2216
1948
  altitude: getAltitude(properties)
2217
1949
  },
@@ -2233,7 +1965,7 @@ var styledFeatureGenerator = (mapTheme) => {
2233
1965
  const coordinates = getCenterFromGeometry(geometry);
2234
1966
  const symbol = getElementSymbol("pin-marker");
2235
1967
  try {
2236
- return new import_maptalks5.Marker(coordinates, {
1968
+ return new import_maptalks4.Marker(coordinates, {
2237
1969
  properties: {
2238
1970
  altitude: getAltitude(properties) + markerHeight
2239
1971
  },
@@ -2258,7 +1990,7 @@ var styledFeatureGenerator = (mapTheme) => {
2258
1990
  "highlighted-logo-marker"
2259
1991
  );
2260
1992
  try {
2261
- return new import_maptalks5.Marker(coordinates, {
1993
+ return new import_maptalks4.Marker(coordinates, {
2262
1994
  properties: {
2263
1995
  altitude: getAltitude(properties) + markerHeight
2264
1996
  },
@@ -2274,7 +2006,7 @@ var styledFeatureGenerator = (mapTheme) => {
2274
2006
  const { geometry, properties } = feature2;
2275
2007
  const coordinates = getCenterFromGeometry(geometry);
2276
2008
  const symbolStyle = getElementSymbol("user-location") || {};
2277
- const marker = new import_maptalks5.Marker(coordinates, {
2009
+ const marker = new import_maptalks4.Marker(coordinates, {
2278
2010
  properties: {
2279
2011
  altitude: getAltitude(properties),
2280
2012
  ordinal: properties.ordinal !== null ? properties.ordinal : null
@@ -2303,7 +2035,7 @@ var styledFeatureGenerator = (mapTheme) => {
2303
2035
  const coordinates = getCenterFromGeometry(geometry);
2304
2036
  const symbolStyle = getElementSymbol("last-user-location") || {};
2305
2037
  const options = getElementOptions("last-user-location") || {};
2306
- const marker = new import_maptalks5.Marker(coordinates, {
2038
+ const marker = new import_maptalks4.Marker(coordinates, {
2307
2039
  properties: {
2308
2040
  ...options,
2309
2041
  altitude: getAltitude(properties),
@@ -2335,14 +2067,14 @@ var styledFeatureGenerator = (mapTheme) => {
2335
2067
  const coordinates = import_lodash4.default.get(geometry, "coordinates");
2336
2068
  const logoUrl = import_lodash4.default.get(properties, "logo.url");
2337
2069
  if (markerSymbol) {
2338
- return new import_maptalks5.Marker(coordinates, {
2070
+ return new import_maptalks4.Marker(coordinates, {
2339
2071
  properties: markerProperties,
2340
2072
  symbol: markerSymbol
2341
2073
  });
2342
2074
  }
2343
2075
  if (!logoUrl) {
2344
2076
  const symbol = getElementSymbol("pin-marker");
2345
- return new import_maptalks5.Marker(coordinates, {
2077
+ return new import_maptalks4.Marker(coordinates, {
2346
2078
  properties: markerProperties,
2347
2079
  symbol
2348
2080
  });
@@ -2350,7 +2082,7 @@ var styledFeatureGenerator = (mapTheme) => {
2350
2082
  const labelSymbol = getLabelSymbol("highlight-occupant-logo");
2351
2083
  const priorityMarkerSymbol = import_lodash4.default.last(labelSymbol) || {};
2352
2084
  import_lodash4.default.set(priorityMarkerSymbol, "markerFile", logoUrl);
2353
- return new import_maptalks5.Marker(coordinates, {
2085
+ return new import_maptalks4.Marker(coordinates, {
2354
2086
  properties: markerProperties,
2355
2087
  symbol: labelSymbol
2356
2088
  });
@@ -2367,7 +2099,7 @@ var styledFeatureGenerator = (mapTheme) => {
2367
2099
  const kioskHeight = import_lodash4.default.get(kioskConfig, "height", 0);
2368
2100
  const markerHeight = unitHeight + kioskHeight;
2369
2101
  const symbol = getElementSymbol("highlight-amenity-marker");
2370
- return new import_maptalks5.Marker(coordinates, {
2102
+ return new import_maptalks4.Marker(coordinates, {
2371
2103
  properties: {
2372
2104
  ...feature2,
2373
2105
  altitude: markerHeight
@@ -2444,24 +2176,24 @@ var styledFeatureGenerator = (mapTheme) => {
2444
2176
  switch (geometry.type) {
2445
2177
  case "Point":
2446
2178
  return [
2447
- geometry?.getCoordinates ? geometry?.getCoordinates() : new import_maptalks5.Coordinate(geometry.coordinates)
2179
+ geometry?.getCoordinates ? geometry?.getCoordinates() : new import_maptalks4.Coordinate(geometry.coordinates)
2448
2180
  ];
2449
2181
  case "Polygon":
2450
2182
  return [
2451
- geometry?.getCenter ? geometry?.getCenter() : new import_maptalks5.Polygon(geometry.coordinates).getCenter()
2183
+ geometry?.getCenter ? geometry?.getCenter() : new import_maptalks4.Polygon(geometry.coordinates).getCenter()
2452
2184
  ];
2453
2185
  case "MultiPolygon":
2454
2186
  return [
2455
- geometry?.getCenter ? geometry?.getCenter() : new import_maptalks5.MultiPolygon(geometry.coordinates).getCenter()
2187
+ geometry?.getCenter ? geometry?.getCenter() : new import_maptalks4.MultiPolygon(geometry.coordinates).getCenter()
2456
2188
  ];
2457
2189
  case "LineString":
2458
2190
  default:
2459
- return geometry?.getCoordinates ? geometry?.getCoordinates() : new import_maptalks5.LineString(geometry.coordinates).getCoordinates();
2191
+ return geometry?.getCoordinates ? geometry?.getCoordinates() : new import_maptalks4.LineString(geometry.coordinates).getCoordinates();
2460
2192
  }
2461
2193
  }).flatten().value();
2462
2194
  const stepPathLineSymbol = getElementSymbol("navigation-path");
2463
2195
  const startPathSymbolMarker = getElementSymbol("navigation-path-start");
2464
- const line = new import_maptalks5.LineString(mergedCoordinates, {
2196
+ const line = new import_maptalks4.LineString(mergedCoordinates, {
2465
2197
  smoothness: 0.5,
2466
2198
  symbol: [...stepPathLineSymbol, startPathSymbolMarker]
2467
2199
  });
@@ -2502,13 +2234,13 @@ var styledFeatureGenerator = (mapTheme) => {
2502
2234
  };
2503
2235
  switch (type) {
2504
2236
  case "Polygon":
2505
- return new import_maptalks5.Polygon(coordinates, formattedProperties);
2237
+ return new import_maptalks4.Polygon(coordinates, formattedProperties);
2506
2238
  case "MultiPolygon":
2507
- return new import_maptalks5.MultiPolygon(coordinates, formattedProperties);
2239
+ return new import_maptalks4.MultiPolygon(coordinates, formattedProperties);
2508
2240
  case "LineString":
2509
- return new import_maptalks5.LineString(coordinates, formattedProperties);
2241
+ return new import_maptalks4.LineString(coordinates, formattedProperties);
2510
2242
  case "MultiLineString":
2511
- return new import_maptalks5.MultiLineString(coordinates, formattedProperties);
2243
+ return new import_maptalks4.MultiLineString(coordinates, formattedProperties);
2512
2244
  default:
2513
2245
  return null;
2514
2246
  }
@@ -2533,7 +2265,7 @@ var styledFeatureGenerator = (mapTheme) => {
2533
2265
  } else {
2534
2266
  const color = footprintProperties.defaultColor;
2535
2267
  if (color === "transparent") return;
2536
- const material = new import_three5.MeshLambertMaterial({
2268
+ const material = new import_three4.MeshLambertMaterial({
2537
2269
  color,
2538
2270
  transparent: true
2539
2271
  });
@@ -2549,68 +2281,12 @@ var styledFeatureGenerator = (mapTheme) => {
2549
2281
  }
2550
2282
  return objects;
2551
2283
  },
2552
- create3DGroundLabel: (label, threeLayer) => {
2553
- const text = label.properties.name;
2554
- const bound = label.geometry.coordinates[0];
2555
- if (import_lodash4.default.isNil(bound)) throw new Error("Invalid coordinates");
2556
- const groundLabelSymbol = getElementSymbol("ground-label");
2557
- const featureSymbol = import_lodash4.default.get(label, "properties", {});
2558
- const groundLabelOptions = import_lodash4.default.merge(
2559
- {},
2560
- { text },
2561
- groundLabelSymbol,
2562
- featureSymbol
2563
- );
2564
- return new GroundLabel(bound, groundLabelOptions, threeLayer);
2565
- },
2566
- createOccupantGroundLabel: (feature2, location, mapConfig, threeLayer) => {
2567
- const text = feature2.properties.name.en;
2568
- const bound = location.geometry.coordinates[0];
2569
- if (import_lodash4.default.isNil(bound)) throw new Error("Invalid coordinates");
2570
- const groundLabelSymbol = getElementSymbol("occupant-flat-label");
2571
- const groundLabelOptions = getElementOptions("occupant-flat-label");
2572
- const baseAltitude = getAltitude(location.properties);
2573
- const extrudeHeight = import_lodash4.default.get(
2574
- mapConfig,
2575
- "extrudeConfig.unit.room.height",
2576
- 0
2577
- );
2578
- const totalAltitude = baseAltitude + extrudeHeight + 0.05;
2579
- const customAngle = import_lodash4.default.get(feature2, "properties.style.angle");
2580
- const offsetX = import_lodash4.default.get(feature2, "properties.style.offsetX", 0);
2581
- const offsetY = import_lodash4.default.get(feature2, "properties.style.offsetY", 0);
2582
- const featureSymbol = {
2583
- name: text,
2584
- ordinal: location.properties.ordinal,
2585
- venue_id: feature2.properties.venue_id
2586
- };
2587
- const mergedGroundLabelOptions = import_lodash4.default.merge(
2588
- {},
2589
- { text },
2590
- groundLabelSymbol,
2591
- groundLabelOptions,
2592
- featureSymbol,
2593
- {
2594
- altitude: totalAltitude,
2595
- offsetX,
2596
- offsetY,
2597
- // set custom angle
2598
- ...!import_lodash4.default.isNil(customAngle) ? { angle: customAngle } : {}
2599
- }
2600
- );
2601
- const groundLabel = new GroundLabel(
2602
- bound,
2603
- mergedGroundLabelOptions,
2604
- threeLayer
2605
- );
2606
- return groundLabel;
2607
- },
2608
2284
  create3DBillboard: (billboard, threeLayer) => {
2609
2285
  const { id, feature_type, properties } = billboard;
2610
2286
  const {
2611
2287
  logo,
2612
2288
  altitude,
2613
- scale: scale2,
2289
+ scale: scale3,
2614
2290
  alphaTest,
2615
2291
  legColor,
2616
2292
  showLeg,
@@ -2624,7 +2300,7 @@ var styledFeatureGenerator = (mapTheme) => {
2624
2300
  };
2625
2301
  const options = {
2626
2302
  altitude,
2627
- scale: scale2,
2303
+ scale: scale3,
2628
2304
  alphaTest,
2629
2305
  legColor,
2630
2306
  showLeg,
@@ -2758,15 +2434,15 @@ var styledFeatureGenerator = (mapTheme) => {
2758
2434
  };
2759
2435
  const color = unitProperty.defaultColor;
2760
2436
  if (color === "transparent") return;
2761
- const material = new import_three5.MeshLambertMaterial({
2437
+ const material = new import_three4.MeshLambertMaterial({
2762
2438
  color,
2763
2439
  transparent: true
2764
2440
  });
2765
2441
  if (unit.geometry.type === "LineString") {
2766
- const polygon = createPolygonFromLineString(unit.geometry);
2442
+ const polygon2 = createPolygonFromLineString(unit.geometry);
2767
2443
  const geometry = {
2768
2444
  type: "Polygon",
2769
- coordinates: polygon
2445
+ coordinates: polygon2
2770
2446
  };
2771
2447
  return createExtrudePolygon(
2772
2448
  geometry,
@@ -2868,9 +2544,9 @@ var getRelatedLocationsByAmenity = (feature2) => {
2868
2544
  var getRelatedLocationIdsByFeature = (feature2) => {
2869
2545
  switch (feature2?.feature_type) {
2870
2546
  case "amenity":
2871
- return getRelatedLocationsByAmenity(feature2).map((v) => v?.id);
2547
+ return getRelatedLocationsByAmenity(feature2).map((v2) => v2?.id);
2872
2548
  case "occupant":
2873
- return getRelatedLocationsByOccupant(feature2).map((v) => v?.id);
2549
+ return getRelatedLocationsByOccupant(feature2).map((v2) => v2?.id);
2874
2550
  default:
2875
2551
  return [];
2876
2552
  }
@@ -2916,7 +2592,7 @@ var getSuitablyValueBetweenBearings = (newBearing, currentBearing) => {
2916
2592
  };
2917
2593
 
2918
2594
  // src/IndoorMap/camera/CameraManager.ts
2919
- var import_maptalks6 = require("maptalks");
2595
+ var import_maptalks5 = require("maptalks");
2920
2596
 
2921
2597
  // ../../node_modules/@turf/meta/dist/esm/index.js
2922
2598
  function coordEach(geojson, callback, excludeWrapCoord) {
@@ -3014,108 +2690,406 @@ function coordEach(geojson, callback, excludeWrapCoord) {
3014
2690
  }
3015
2691
  }
3016
2692
  }
3017
- }
3018
-
3019
- // ../../node_modules/@turf/bbox/dist/esm/index.js
3020
- function bbox(geojson, options = {}) {
3021
- if (geojson.bbox != null && true !== options.recompute) {
3022
- return geojson.bbox;
2693
+ }
2694
+
2695
+ // ../../node_modules/@turf/bbox/dist/esm/index.js
2696
+ function bbox(geojson, options = {}) {
2697
+ if (geojson.bbox != null && true !== options.recompute) {
2698
+ return geojson.bbox;
2699
+ }
2700
+ const result = [Infinity, Infinity, -Infinity, -Infinity];
2701
+ coordEach(geojson, (coord) => {
2702
+ if (result[0] > coord[0]) {
2703
+ result[0] = coord[0];
2704
+ }
2705
+ if (result[1] > coord[1]) {
2706
+ result[1] = coord[1];
2707
+ }
2708
+ if (result[2] < coord[0]) {
2709
+ result[2] = coord[0];
2710
+ }
2711
+ if (result[3] < coord[1]) {
2712
+ result[3] = coord[1];
2713
+ }
2714
+ });
2715
+ return result;
2716
+ }
2717
+ var index_default = bbox;
2718
+
2719
+ // src/IndoorMap/camera/CameraManager.ts
2720
+ var import_transform_scale = __toESM(require("@turf/transform-scale"));
2721
+ var import_bbox_polygon = __toESM(require("@turf/bbox-polygon"));
2722
+ var CameraManager = class {
2723
+ map;
2724
+ constructor(map, options) {
2725
+ this.map = map;
2726
+ if (options?.defaultView) {
2727
+ this.setView(options?.defaultView);
2728
+ }
2729
+ }
2730
+ /** Public methods */
2731
+ getView = () => {
2732
+ return this.map.getView();
2733
+ };
2734
+ setView = (value) => {
2735
+ if (this.map && Object.keys(value).length !== 0) {
2736
+ this.map.setView(value);
2737
+ }
2738
+ };
2739
+ animateTo = (view, options = {}, step) => {
2740
+ this.map.animateTo(view, options, step);
2741
+ };
2742
+ setMaxExtent(extent) {
2743
+ return this.map.setMaxExtent(extent);
2744
+ }
2745
+ getFeatureExtent = (feature2, scaleFactor = 1) => {
2746
+ const [minX, minY, maxX, maxY] = index_default(
2747
+ (0, import_transform_scale.default)((0, import_bbox_polygon.default)(index_default(feature2)), scaleFactor)
2748
+ );
2749
+ return new import_maptalks5.Extent(minX, minY, maxX, maxY);
2750
+ };
2751
+ getExtentZoom = (extent, options = {
2752
+ isFraction: false,
2753
+ padding: {
2754
+ paddingLeft: 0,
2755
+ paddingRight: 0,
2756
+ paddingTop: 0,
2757
+ paddingBottom: 0
2758
+ }
2759
+ }) => {
2760
+ const { isFraction = false, padding } = options;
2761
+ return this.map.getFitZoom(extent, isFraction, padding);
2762
+ };
2763
+ set maxZoom(value) {
2764
+ this.map.setMaxZoom(value);
2765
+ const spatialReference = {
2766
+ projection: "EPSG:3857",
2767
+ resolutions: (function() {
2768
+ const resolutions = [];
2769
+ const d = 2 * 6378137 * Math.PI;
2770
+ for (let i = 0; i < value; i++) {
2771
+ resolutions[i] = d / (256 * Math.pow(2, i));
2772
+ }
2773
+ return resolutions;
2774
+ })()
2775
+ };
2776
+ this.map.setSpatialReference(spatialReference);
2777
+ }
2778
+ set minZoom(value) {
2779
+ this.map.setMinZoom(value);
2780
+ }
2781
+ };
2782
+
2783
+ // src/IndoorMap/renderer/RendererManager.ts
2784
+ var import_isFunction = __toESM(require("lodash/isFunction"));
2785
+ var import_min = __toESM(require("lodash/min"));
2786
+ var import_center3 = require("@turf/center");
2787
+ var THREE3 = __toESM(require("three"));
2788
+
2789
+ // src/IndoorMap/renderer/3d/Element3DRenderer.ts
2790
+ var maptalks4 = __toESM(require("maptalks-gl"));
2791
+ var THREE = __toESM(require("three"));
2792
+ var import_maptalks7 = require("maptalks.three");
2793
+ var import_buffer2 = __toESM(require("@turf/buffer"));
2794
+
2795
+ // src/IndoorMap/renderer/3d/objects/GroundLabel.ts
2796
+ var maptalks3 = __toESM(require("maptalks-gl"));
2797
+ var import_maptalks6 = require("maptalks.three");
2798
+ var import_three5 = require("three");
2799
+ var import_d3plus_shape = require("d3plus-shape");
2800
+ var import_lodash_es = require("lodash-es");
2801
+ var OPTIONS3 = {
2802
+ // Allowing click through and prevent interaction
2803
+ interactive: false,
2804
+ altitude: 0
2805
+ };
2806
+ var defaultFlatLabelOptions = {
2807
+ fontSize: 14,
2808
+ fontFamily: "Manrope",
2809
+ fontWeight: 600,
2810
+ margin: 0,
2811
+ scaleMin: 0.5,
2812
+ lineHeight: 1.05,
2813
+ scaleStep: 0.05,
2814
+ textAlign: "center",
2815
+ textBaseline: "middle",
2816
+ fillStyle: "#000"
2817
+ };
2818
+ var defaultRectAngleToCalc = (0, import_lodash_es.range)(-90, 92, 2);
2819
+ var getMaterial = (text, flatLabelOptions) => {
2820
+ const options = (0, import_lodash_es.merge)({}, defaultFlatLabelOptions, flatLabelOptions);
2821
+ const {
2822
+ fontSize: initialFontSize,
2823
+ fontFamily,
2824
+ fontWeight,
2825
+ margin,
2826
+ scaleMin,
2827
+ scaleStep,
2828
+ fillStyle,
2829
+ lineHeight,
2830
+ textAlign,
2831
+ strokeStyle,
2832
+ lineWidth,
2833
+ textBaseline
2834
+ } = options;
2835
+ const pixelMultiplier = 4;
2836
+ const SIZE = 100 * pixelMultiplier;
2837
+ const fontSize = initialFontSize * (pixelMultiplier * 1.25);
2838
+ const canvas = document.createElement("canvas");
2839
+ canvas.width = canvas.height = SIZE;
2840
+ const ctx = canvas.getContext("2d");
2841
+ ctx.font = `${fontWeight} ${fontSize}px "${fontFamily}", Arial`;
2842
+ ctx.textAlign = textAlign;
2843
+ ctx.textBaseline = textBaseline;
2844
+ ctx.fillStyle = fillStyle;
2845
+ ctx.strokeStyle = strokeStyle;
2846
+ ctx.lineWidth = lineWidth;
2847
+ const wrapText = (ctx2, text2, maxWidth) => {
2848
+ const words = text2.trim().split(/\s+/);
2849
+ if (words.length <= 1) return [text2];
2850
+ const lines = [];
2851
+ const MAX_LINES = 3;
2852
+ let currentLine = words[0];
2853
+ for (let i = 1; i < words.length; i++) {
2854
+ const lineToMeasure = currentLine + " " + words[i];
2855
+ if (ctx2.measureText(lineToMeasure).width > maxWidth) {
2856
+ lines.push(currentLine);
2857
+ currentLine = words[i];
2858
+ } else {
2859
+ currentLine = lineToMeasure;
2860
+ }
2861
+ }
2862
+ lines.push(currentLine);
2863
+ return lines.slice(0, MAX_LINES);
2864
+ };
2865
+ const hasManualBreaks = text.includes("\n");
2866
+ let texts;
2867
+ if (hasManualBreaks) {
2868
+ texts = text.split(/\n/g);
2869
+ } else {
2870
+ const maxWidth = SIZE - 2 * margin;
2871
+ texts = wrapText(ctx, text, maxWidth);
2872
+ }
2873
+ let textWidth = (0, import_lodash_es.max)(texts.map((text2) => ctx.measureText(text2).width));
2874
+ let scale3 = 1;
2875
+ while (scale3 > 0 && textWidth + 2 * margin > SIZE) {
2876
+ scale3 -= scaleStep;
2877
+ ctx.font = `${fontWeight} ${scale3 * fontSize}px "${fontFamily}", Arial`;
2878
+ textWidth = (0, import_lodash_es.max)(texts.map((text2) => ctx.measureText(text2).width));
2879
+ }
2880
+ const center2 = { x: 0.5 * SIZE, y: 0.5 * SIZE };
2881
+ if (scale3 > scaleMin) {
2882
+ const totalHeight = texts.length * (fontSize * scale3 * lineHeight);
2883
+ const startY = center2.y - totalHeight / 2 + fontSize * scale3 * lineHeight * 0.5;
2884
+ texts.forEach((text2, index) => {
2885
+ const yOffset = startY + index * (fontSize * scale3 * lineHeight);
2886
+ if (strokeStyle && lineWidth) {
2887
+ ctx.strokeText(text2, center2.x, yOffset);
2888
+ }
2889
+ ctx.fillText(text2, center2.x, yOffset);
2890
+ });
2891
+ }
2892
+ const texture = new import_three5.Texture(canvas);
2893
+ texture.needsUpdate = true;
2894
+ const material = new import_three5.MeshPhongMaterial({
2895
+ map: texture,
2896
+ transparent: true,
2897
+ // @ref: https://threejs.org/docs/#api/en/materials/Material.alphaTest
2898
+ alphaTest: 0.3
2899
+ });
2900
+ return material;
2901
+ };
2902
+ var GroundLabel = class extends import_maptalks6.BaseObject {
2903
+ #angle = 0;
2904
+ #bearing = 0;
2905
+ #text = "";
2906
+ #offsetX = 0;
2907
+ #offsetY = 0;
2908
+ #originalPosition = null;
2909
+ #layer = null;
2910
+ constructor(bound, text, options, layer) {
2911
+ options = maptalks3.Util.extend({}, OPTIONS3, options, {
2912
+ layer,
2913
+ coordinate: bound
2914
+ });
2915
+ const {
2916
+ altitude = 0,
2917
+ bottomHeight = 0,
2918
+ fontSize,
2919
+ fillStyle,
2920
+ textAlign,
2921
+ fontFamily,
2922
+ textBaseline,
2923
+ strokeStyle,
2924
+ lineWidth,
2925
+ angle = defaultRectAngleToCalc,
2926
+ maxFontScale,
2927
+ offsetX = 0,
2928
+ offsetY = 0,
2929
+ ...properties
2930
+ } = options;
2931
+ super();
2932
+ this._initOptions(options);
2933
+ this.properties = properties;
2934
+ this.#offsetX = offsetX;
2935
+ this.#offsetY = offsetY;
2936
+ this.#layer = layer;
2937
+ const material = getMaterial(text, {
2938
+ fillStyle,
2939
+ fontSize,
2940
+ textAlign,
2941
+ textBaseline,
2942
+ fontFamily,
2943
+ strokeStyle,
2944
+ lineWidth
2945
+ });
2946
+ const rectAngles = (0, import_lodash_es.isArray)(angle) ? angle : [angle];
2947
+ material.needsUpdate = true;
2948
+ const rect = (0, import_d3plus_shape.largestRect)(bound, {
2949
+ cache: true,
2950
+ /**
2951
+ * Black magic here:
2952
+ * For some reason if we allow angle -90 or 90, some polygon will use that angle even if it's wrong angle to use.
2953
+ * So we remove -90 and 90 from choices, and use -85 & 85 instead.
2954
+ */
2955
+ angle: rectAngles
2956
+ });
2957
+ const { cx, cy, width, angle: calculatedAngle } = rect;
2958
+ this.#text = text;
2959
+ this.#angle = calculatedAngle;
2960
+ const geometry = new import_three5.PlaneGeometry(1, 1);
2961
+ this._createMesh(geometry, material);
2962
+ const z = layer.altitudeToVector3(altitude + bottomHeight, altitude + bottomHeight).x;
2963
+ const basePosition = layer.coordinateToVector3([cx, cy], z);
2964
+ this.#originalPosition = basePosition.clone();
2965
+ const finalPosition = this.#calculateFinalPosition(basePosition);
2966
+ const scale3 = width / 6456122659e-13;
2967
+ const finalScale = maxFontScale && scale3 > maxFontScale ? maxFontScale : scale3;
2968
+ this.getObject3d().scale.set(finalScale, finalScale, finalScale);
2969
+ this.getObject3d().position.copy(finalPosition);
2970
+ this.getObject3d().rotation.z = Math.PI / 180 * this.#angle;
2971
+ }
2972
+ #calculateFinalPosition(basePosition) {
2973
+ if (this.#offsetX === 0 && this.#offsetY === 0) {
2974
+ return basePosition;
2975
+ }
2976
+ const offsetCoordinate = [this.#offsetX, this.#offsetY];
2977
+ const z = this.#layer.altitudeToVector3(0, 0).x;
2978
+ const offsetVector = this.#layer.coordinateToVector3(offsetCoordinate, z);
2979
+ const zeroVector = this.#layer.coordinateToVector3([0, 0], z);
2980
+ const worldOffsetX = offsetVector.x - zeroVector.x;
2981
+ const worldOffsetY = offsetVector.y - zeroVector.y;
2982
+ return {
2983
+ x: basePosition.x + worldOffsetX,
2984
+ y: basePosition.y + worldOffsetY,
2985
+ z: basePosition.z
2986
+ };
2987
+ }
2988
+ #updatePosition() {
2989
+ if (this.#originalPosition && this.#layer) {
2990
+ const finalPosition = this.#calculateFinalPosition(this.#originalPosition);
2991
+ this.getObject3d().position.copy(finalPosition);
2992
+ }
2993
+ }
2994
+ set bearing(value) {
2995
+ this.#bearing = value;
2996
+ const degree = this.#angle + this.#bearing;
2997
+ const angle = degree > 90 || degree < -90 ? this.#angle + 180 : this.#angle;
2998
+ this.getObject3d().rotation.z = Math.PI / 180 * angle;
3023
2999
  }
3024
- const result = [Infinity, Infinity, -Infinity, -Infinity];
3025
- coordEach(geojson, (coord) => {
3026
- if (result[0] > coord[0]) {
3027
- result[0] = coord[0];
3028
- }
3029
- if (result[1] > coord[1]) {
3030
- result[1] = coord[1];
3000
+ get angle() {
3001
+ return this.#angle;
3002
+ }
3003
+ get currentAngle() {
3004
+ return this.#angle;
3005
+ }
3006
+ get text() {
3007
+ return this.#text;
3008
+ }
3009
+ get offsetX() {
3010
+ return this.#offsetX;
3011
+ }
3012
+ get offsetY() {
3013
+ return this.#offsetY;
3014
+ }
3015
+ get offset() {
3016
+ return { x: this.#offsetX, y: this.#offsetY };
3017
+ }
3018
+ set offsetX(value) {
3019
+ if ((0, import_lodash_es.isNumber)(value)) {
3020
+ this.#offsetX = value;
3021
+ this.#updatePosition();
3031
3022
  }
3032
- if (result[2] < coord[0]) {
3033
- result[2] = coord[0];
3023
+ }
3024
+ set offsetY(value) {
3025
+ if ((0, import_lodash_es.isNumber)(value)) {
3026
+ this.#offsetY = value;
3027
+ this.#updatePosition();
3034
3028
  }
3035
- if (result[3] < coord[1]) {
3036
- result[3] = coord[1];
3029
+ }
3030
+ set angle(newAngle) {
3031
+ if ((0, import_lodash_es.isNumber)(newAngle)) {
3032
+ this.#angle = newAngle;
3033
+ this.getObject3d().rotation.z = Math.PI / 180 * this.#angle;
3037
3034
  }
3038
- });
3039
- return result;
3040
- }
3041
- var index_default = bbox;
3042
-
3043
- // src/IndoorMap/camera/CameraManager.ts
3044
- var import_transform_scale = __toESM(require("@turf/transform-scale"));
3045
- var import_bbox_polygon = __toESM(require("@turf/bbox-polygon"));
3046
- var CameraManager = class {
3047
- map;
3048
- constructor(map, options) {
3049
- this.map = map;
3050
- if (options?.defaultView) {
3051
- this.setView(options?.defaultView);
3035
+ }
3036
+ setOffset(offsetX, offsetY) {
3037
+ if ((0, import_lodash_es.isNumber)(offsetX) && (0, import_lodash_es.isNumber)(offsetY)) {
3038
+ this.#offsetX = offsetX;
3039
+ this.#offsetY = offsetY;
3040
+ this.#updatePosition();
3052
3041
  }
3053
3042
  }
3054
- /** Public methods */
3055
- getView = () => {
3056
- return this.map.getView();
3057
- };
3058
- setView = (value) => {
3059
- if (this.map && Object.keys(value).length !== 0) {
3060
- this.map.setView(value);
3043
+ addOffset(deltaX, deltaY) {
3044
+ if ((0, import_lodash_es.isNumber)(deltaX) && (0, import_lodash_es.isNumber)(deltaY)) {
3045
+ this.#offsetX += deltaX;
3046
+ this.#offsetY += deltaY;
3047
+ this.#updatePosition();
3061
3048
  }
3062
- };
3063
- animateTo = (view, options = {}, step) => {
3064
- this.map.animateTo(view, options, step);
3065
- };
3066
- setMaxExtent(extent) {
3067
- return this.map.setMaxExtent(extent);
3068
3049
  }
3069
- getFeatureExtent = (feature2, scaleFactor = 1) => {
3070
- const [minX, minY, maxX, maxY] = index_default(
3071
- (0, import_transform_scale.default)((0, import_bbox_polygon.default)(index_default(feature2)), scaleFactor)
3072
- );
3073
- return new import_maptalks6.Extent(minX, minY, maxX, maxY);
3074
- };
3075
- getExtentZoom = (extent, options = {
3076
- isFraction: false,
3077
- padding: {
3078
- paddingLeft: 0,
3079
- paddingRight: 0,
3080
- paddingTop: 0,
3081
- paddingBottom: 0
3050
+ resetOffset() {
3051
+ this.#offsetX = 0;
3052
+ this.#offsetY = 0;
3053
+ this.#updatePosition();
3054
+ }
3055
+ moveToPosition(targetX, targetY) {
3056
+ if (this.#originalPosition && this.#layer) {
3057
+ const currentCenter = this.#layer.vector3ToCoordinate(
3058
+ this.#originalPosition
3059
+ );
3060
+ this.#offsetX = targetX - currentCenter.x;
3061
+ this.#offsetY = targetY - currentCenter.y;
3062
+ this.#updatePosition();
3082
3063
  }
3083
- }) => {
3084
- const { isFraction = false, padding } = options;
3085
- return this.map.getFitZoom(extent, isFraction, padding);
3086
- };
3087
- set maxZoom(value) {
3088
- this.map.setMaxZoom(value);
3089
- const spatialReference = {
3090
- projection: "EPSG:3857",
3091
- resolutions: (function() {
3092
- const resolutions = [];
3093
- const d = 2 * 6378137 * Math.PI;
3094
- for (let i = 0; i < value; i++) {
3095
- resolutions[i] = d / (256 * Math.pow(2, i));
3096
- }
3097
- return resolutions;
3098
- })()
3064
+ }
3065
+ updateText(newText, options = {}) {
3066
+ this.#text = newText;
3067
+ const materialOptions = {
3068
+ fillStyle: options.fillStyle || this.properties.fillStyle,
3069
+ fontSize: options.fontSize || this.properties.fontSize,
3070
+ textAlign: options.textAlign || this.properties.textAlign,
3071
+ textBaseline: options.textBaseline || this.properties.textBaseline,
3072
+ fontFamily: options.fontFamily || this.properties.fontFamily,
3073
+ strokeStyle: options.strokeStyle || this.properties.strokeStyle,
3074
+ lineWidth: options.lineWidth || this.properties.lineWidth
3099
3075
  };
3100
- this.map.setSpatialReference(spatialReference);
3076
+ const newMaterial = getMaterial(newText, materialOptions);
3077
+ this.getObject3d().material = newMaterial;
3078
+ newMaterial.needsUpdate = true;
3101
3079
  }
3102
- set minZoom(value) {
3103
- this.map.setMinZoom(value);
3080
+ _animation() {
3081
+ const map = this.getMap();
3082
+ if (!map) return;
3083
+ const bearing = map.getBearing();
3084
+ this.bearing = bearing;
3085
+ }
3086
+ // Add bottomHeight to altitude as final altitude position
3087
+ setAltitude(altitude) {
3088
+ const bottomHeight = this.options.bottomHeight ?? 0;
3089
+ return super.setAltitude(altitude + bottomHeight);
3104
3090
  }
3105
3091
  };
3106
3092
 
3107
- // src/IndoorMap/renderer/RendererManager.ts
3108
- var import_isFunction = __toESM(require("lodash/isFunction"));
3109
- var import_min = __toESM(require("lodash/min"));
3110
- var import_center3 = require("@turf/center");
3111
- var THREE3 = __toESM(require("three"));
3112
-
3113
- // src/IndoorMap/renderer/3d/Element3DRenderer.ts
3114
- var maptalks4 = __toESM(require("maptalks-gl"));
3115
- var THREE = __toESM(require("three"));
3116
- var import_maptalks7 = require("maptalks.three");
3117
- var import_buffer2 = __toESM(require("@turf/buffer"));
3118
-
3119
3093
  // src/IndoorMap/renderer/3d/element3DRendererOptions.ts
3120
3094
  var element3DRendererOptions = {
3121
3095
  unit: {
@@ -3143,30 +3117,30 @@ var element3DRendererOptions = {
3143
3117
  }
3144
3118
  };
3145
3119
 
3146
- // src/IndoorMap/renderer/3d/Element3DRenderer.ts
3120
+ // src/IndoorMap/renderer/3d/utils/get3DRendererOption.ts
3147
3121
  var DEFAULT_POLYGON_OPTION = {
3148
3122
  color: "#FFFFFF",
3149
3123
  offset: 0,
3150
3124
  altitude: 0
3151
3125
  };
3152
- var HEIGHT_METER = 4;
3153
- var MULTIORDINAL_HEIGHT_METER = 9;
3154
- var getGeometryOption = (feature2, options) => {
3126
+ var get3DRendererOption = (featureType, category, options) => {
3155
3127
  try {
3156
- const option = options[feature2.feature_type] ?? element3DRendererOptions[feature2.feature_type];
3157
- const category = feature2.properties.category;
3128
+ const option = options[featureType] ?? element3DRendererOptions[featureType];
3158
3129
  return (category && option.byCategory?.[category]) ?? option?.default ?? DEFAULT_POLYGON_OPTION;
3159
3130
  } catch (err) {
3160
- console.log(err.message, { options, feature: feature2 });
3131
+ console.log(err.message, { options, featureType, category });
3161
3132
  }
3162
3133
  };
3134
+
3135
+ // src/IndoorMap/renderer/3d/Element3DRenderer.ts
3136
+ var HEIGHT_METER = 4;
3137
+ var MULTIORDINAL_HEIGHT_METER = 9;
3163
3138
  var Element3DRenderer = class extends EventTarget {
3164
3139
  options;
3165
3140
  map;
3166
3141
  gltfLayer;
3167
3142
  threeLayer;
3168
3143
  scene;
3169
- // private dracoLoader: DRACOLoader
3170
3144
  lineMaterial;
3171
3145
  materialByColorMap;
3172
3146
  // Renderer is Ready
@@ -3205,7 +3179,7 @@ var Element3DRenderer = class extends EventTarget {
3205
3179
  bottomHeight: bottomHeightOptions,
3206
3180
  color: colorOptions,
3207
3181
  ...options
3208
- } = getGeometryOption(feature2, this.options);
3182
+ } = get3DRendererOption(feature2.feature_type, feature2.properties.category, this.options);
3209
3183
  const _this = this;
3210
3184
  const createPolygon = (geometry, feature3) => {
3211
3185
  try {
@@ -3309,6 +3283,16 @@ var Element3DRenderer = class extends EventTarget {
3309
3283
  escalatorMarker.addTo(this.gltfLayer);
3310
3284
  return escalatorMarker;
3311
3285
  }
3286
+ // Note: Move to another renderer and keep this file on Geometry only?
3287
+ createGroundLabel(f, unit) {
3288
+ const text = f.properties.name;
3289
+ const bound = f.geometry.coordinates[0];
3290
+ const { height: unitHeight } = get3DRendererOption("unit", unit.properties.category, this.options);
3291
+ const options = { bottomHeight: unitHeight + 5e-3 };
3292
+ const groundLabel = new GroundLabel(bound, text, options, this.threeLayer);
3293
+ this.threeLayer.addMesh(groundLabel);
3294
+ return groundLabel;
3295
+ }
3312
3296
  async createTree(coordinate, ordinal) {
3313
3297
  const treeMarker = new maptalks4.GLTFMarker(coordinate, {
3314
3298
  symbol: {
@@ -3429,7 +3413,7 @@ var getGeometryProperties = (feature2) => ({
3429
3413
  category: feature2.properties.category,
3430
3414
  name: feature2.properties.name?.en
3431
3415
  });
3432
- var getGeometryOption2 = (feature2, options) => {
3416
+ var getGeometryOption = (feature2, options) => {
3433
3417
  try {
3434
3418
  const option = options[feature2.feature_type] ?? element2DRendererOptions[feature2.feature_type];
3435
3419
  const category = feature2.properties.category;
@@ -3456,7 +3440,7 @@ var Element2DRenderer = class extends EventTarget {
3456
3440
  }
3457
3441
  createGeometry = (imdfFeature) => {
3458
3442
  const feature2 = getGeometryProperties(imdfFeature);
3459
- const { symbol, ...options } = getGeometryOption2(imdfFeature, this.options);
3443
+ const { symbol, ...options } = getGeometryOption(imdfFeature, this.options);
3460
3444
  const altitude = feature2.properties.ordinal * 10;
3461
3445
  const geometry = maptalks5.Geometry.fromJSON({
3462
3446
  feature: feature2,
@@ -3478,6 +3462,11 @@ var Element2DRenderer = class extends EventTarget {
3478
3462
  async createEscalator(f, coordinates) {
3479
3463
  return Promise.resolve(null);
3480
3464
  }
3465
+ createGroundLabel(f, unit) {
3466
+ const text = f.properties.name;
3467
+ const bound = f.geometry.coordinates[0];
3468
+ return null;
3469
+ }
3481
3470
  async createTree(coordinates) {
3482
3471
  return Promise.resolve(null);
3483
3472
  }
@@ -3844,6 +3833,479 @@ var angleBetweenLineStrings = (line1, line2) => {
3844
3833
  return Math.atan2(dy, dx);
3845
3834
  };
3846
3835
 
3836
+ // ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/util.js
3837
+ var epsilon = 11102230246251565e-32;
3838
+ var splitter = 134217729;
3839
+ var resulterrbound = (3 + 8 * epsilon) * epsilon;
3840
+ function sum(elen, e, flen, f, h) {
3841
+ let Q, Qnew, hh, bvirt;
3842
+ let enow = e[0];
3843
+ let fnow = f[0];
3844
+ let eindex = 0;
3845
+ let findex = 0;
3846
+ if (fnow > enow === fnow > -enow) {
3847
+ Q = enow;
3848
+ enow = e[++eindex];
3849
+ } else {
3850
+ Q = fnow;
3851
+ fnow = f[++findex];
3852
+ }
3853
+ let hindex = 0;
3854
+ if (eindex < elen && findex < flen) {
3855
+ if (fnow > enow === fnow > -enow) {
3856
+ Qnew = enow + Q;
3857
+ hh = Q - (Qnew - enow);
3858
+ enow = e[++eindex];
3859
+ } else {
3860
+ Qnew = fnow + Q;
3861
+ hh = Q - (Qnew - fnow);
3862
+ fnow = f[++findex];
3863
+ }
3864
+ Q = Qnew;
3865
+ if (hh !== 0) {
3866
+ h[hindex++] = hh;
3867
+ }
3868
+ while (eindex < elen && findex < flen) {
3869
+ if (fnow > enow === fnow > -enow) {
3870
+ Qnew = Q + enow;
3871
+ bvirt = Qnew - Q;
3872
+ hh = Q - (Qnew - bvirt) + (enow - bvirt);
3873
+ enow = e[++eindex];
3874
+ } else {
3875
+ Qnew = Q + fnow;
3876
+ bvirt = Qnew - Q;
3877
+ hh = Q - (Qnew - bvirt) + (fnow - bvirt);
3878
+ fnow = f[++findex];
3879
+ }
3880
+ Q = Qnew;
3881
+ if (hh !== 0) {
3882
+ h[hindex++] = hh;
3883
+ }
3884
+ }
3885
+ }
3886
+ while (eindex < elen) {
3887
+ Qnew = Q + enow;
3888
+ bvirt = Qnew - Q;
3889
+ hh = Q - (Qnew - bvirt) + (enow - bvirt);
3890
+ enow = e[++eindex];
3891
+ Q = Qnew;
3892
+ if (hh !== 0) {
3893
+ h[hindex++] = hh;
3894
+ }
3895
+ }
3896
+ while (findex < flen) {
3897
+ Qnew = Q + fnow;
3898
+ bvirt = Qnew - Q;
3899
+ hh = Q - (Qnew - bvirt) + (fnow - bvirt);
3900
+ fnow = f[++findex];
3901
+ Q = Qnew;
3902
+ if (hh !== 0) {
3903
+ h[hindex++] = hh;
3904
+ }
3905
+ }
3906
+ if (Q !== 0 || hindex === 0) {
3907
+ h[hindex++] = Q;
3908
+ }
3909
+ return hindex;
3910
+ }
3911
+ function estimate(elen, e) {
3912
+ let Q = e[0];
3913
+ for (let i = 1; i < elen; i++) Q += e[i];
3914
+ return Q;
3915
+ }
3916
+ function vec(n) {
3917
+ return new Float64Array(n);
3918
+ }
3919
+
3920
+ // ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/orient2d.js
3921
+ var ccwerrboundA = (3 + 16 * epsilon) * epsilon;
3922
+ var ccwerrboundB = (2 + 12 * epsilon) * epsilon;
3923
+ var ccwerrboundC = (9 + 64 * epsilon) * epsilon * epsilon;
3924
+ var B = vec(4);
3925
+ var C1 = vec(8);
3926
+ var C2 = vec(12);
3927
+ var D = vec(16);
3928
+ var u = vec(4);
3929
+ function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {
3930
+ let acxtail, acytail, bcxtail, bcytail;
3931
+ let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u32;
3932
+ const acx = ax - cx;
3933
+ const bcx = bx - cx;
3934
+ const acy = ay - cy;
3935
+ const bcy = by - cy;
3936
+ s1 = acx * bcy;
3937
+ c = splitter * acx;
3938
+ ahi = c - (c - acx);
3939
+ alo = acx - ahi;
3940
+ c = splitter * bcy;
3941
+ bhi = c - (c - bcy);
3942
+ blo = bcy - bhi;
3943
+ s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
3944
+ t1 = acy * bcx;
3945
+ c = splitter * acy;
3946
+ ahi = c - (c - acy);
3947
+ alo = acy - ahi;
3948
+ c = splitter * bcx;
3949
+ bhi = c - (c - bcx);
3950
+ blo = bcx - bhi;
3951
+ t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
3952
+ _i = s0 - t0;
3953
+ bvirt = s0 - _i;
3954
+ B[0] = s0 - (_i + bvirt) + (bvirt - t0);
3955
+ _j = s1 + _i;
3956
+ bvirt = _j - s1;
3957
+ _0 = s1 - (_j - bvirt) + (_i - bvirt);
3958
+ _i = _0 - t1;
3959
+ bvirt = _0 - _i;
3960
+ B[1] = _0 - (_i + bvirt) + (bvirt - t1);
3961
+ u32 = _j + _i;
3962
+ bvirt = u32 - _j;
3963
+ B[2] = _j - (u32 - bvirt) + (_i - bvirt);
3964
+ B[3] = u32;
3965
+ let det = estimate(4, B);
3966
+ let errbound = ccwerrboundB * detsum;
3967
+ if (det >= errbound || -det >= errbound) {
3968
+ return det;
3969
+ }
3970
+ bvirt = ax - acx;
3971
+ acxtail = ax - (acx + bvirt) + (bvirt - cx);
3972
+ bvirt = bx - bcx;
3973
+ bcxtail = bx - (bcx + bvirt) + (bvirt - cx);
3974
+ bvirt = ay - acy;
3975
+ acytail = ay - (acy + bvirt) + (bvirt - cy);
3976
+ bvirt = by - bcy;
3977
+ bcytail = by - (bcy + bvirt) + (bvirt - cy);
3978
+ if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) {
3979
+ return det;
3980
+ }
3981
+ errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det);
3982
+ det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail);
3983
+ if (det >= errbound || -det >= errbound) return det;
3984
+ s1 = acxtail * bcy;
3985
+ c = splitter * acxtail;
3986
+ ahi = c - (c - acxtail);
3987
+ alo = acxtail - ahi;
3988
+ c = splitter * bcy;
3989
+ bhi = c - (c - bcy);
3990
+ blo = bcy - bhi;
3991
+ s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
3992
+ t1 = acytail * bcx;
3993
+ c = splitter * acytail;
3994
+ ahi = c - (c - acytail);
3995
+ alo = acytail - ahi;
3996
+ c = splitter * bcx;
3997
+ bhi = c - (c - bcx);
3998
+ blo = bcx - bhi;
3999
+ t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
4000
+ _i = s0 - t0;
4001
+ bvirt = s0 - _i;
4002
+ u[0] = s0 - (_i + bvirt) + (bvirt - t0);
4003
+ _j = s1 + _i;
4004
+ bvirt = _j - s1;
4005
+ _0 = s1 - (_j - bvirt) + (_i - bvirt);
4006
+ _i = _0 - t1;
4007
+ bvirt = _0 - _i;
4008
+ u[1] = _0 - (_i + bvirt) + (bvirt - t1);
4009
+ u32 = _j + _i;
4010
+ bvirt = u32 - _j;
4011
+ u[2] = _j - (u32 - bvirt) + (_i - bvirt);
4012
+ u[3] = u32;
4013
+ const C1len = sum(4, B, 4, u, C1);
4014
+ s1 = acx * bcytail;
4015
+ c = splitter * acx;
4016
+ ahi = c - (c - acx);
4017
+ alo = acx - ahi;
4018
+ c = splitter * bcytail;
4019
+ bhi = c - (c - bcytail);
4020
+ blo = bcytail - bhi;
4021
+ s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
4022
+ t1 = acy * bcxtail;
4023
+ c = splitter * acy;
4024
+ ahi = c - (c - acy);
4025
+ alo = acy - ahi;
4026
+ c = splitter * bcxtail;
4027
+ bhi = c - (c - bcxtail);
4028
+ blo = bcxtail - bhi;
4029
+ t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
4030
+ _i = s0 - t0;
4031
+ bvirt = s0 - _i;
4032
+ u[0] = s0 - (_i + bvirt) + (bvirt - t0);
4033
+ _j = s1 + _i;
4034
+ bvirt = _j - s1;
4035
+ _0 = s1 - (_j - bvirt) + (_i - bvirt);
4036
+ _i = _0 - t1;
4037
+ bvirt = _0 - _i;
4038
+ u[1] = _0 - (_i + bvirt) + (bvirt - t1);
4039
+ u32 = _j + _i;
4040
+ bvirt = u32 - _j;
4041
+ u[2] = _j - (u32 - bvirt) + (_i - bvirt);
4042
+ u[3] = u32;
4043
+ const C2len = sum(C1len, C1, 4, u, C2);
4044
+ s1 = acxtail * bcytail;
4045
+ c = splitter * acxtail;
4046
+ ahi = c - (c - acxtail);
4047
+ alo = acxtail - ahi;
4048
+ c = splitter * bcytail;
4049
+ bhi = c - (c - bcytail);
4050
+ blo = bcytail - bhi;
4051
+ s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
4052
+ t1 = acytail * bcxtail;
4053
+ c = splitter * acytail;
4054
+ ahi = c - (c - acytail);
4055
+ alo = acytail - ahi;
4056
+ c = splitter * bcxtail;
4057
+ bhi = c - (c - bcxtail);
4058
+ blo = bcxtail - bhi;
4059
+ t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
4060
+ _i = s0 - t0;
4061
+ bvirt = s0 - _i;
4062
+ u[0] = s0 - (_i + bvirt) + (bvirt - t0);
4063
+ _j = s1 + _i;
4064
+ bvirt = _j - s1;
4065
+ _0 = s1 - (_j - bvirt) + (_i - bvirt);
4066
+ _i = _0 - t1;
4067
+ bvirt = _0 - _i;
4068
+ u[1] = _0 - (_i + bvirt) + (bvirt - t1);
4069
+ u32 = _j + _i;
4070
+ bvirt = u32 - _j;
4071
+ u[2] = _j - (u32 - bvirt) + (_i - bvirt);
4072
+ u[3] = u32;
4073
+ const Dlen = sum(C2len, C2, 4, u, D);
4074
+ return D[Dlen - 1];
4075
+ }
4076
+ function orient2d(ax, ay, bx, by, cx, cy) {
4077
+ const detleft = (ay - cy) * (bx - cx);
4078
+ const detright = (ax - cx) * (by - cy);
4079
+ const det = detleft - detright;
4080
+ const detsum = Math.abs(detleft + detright);
4081
+ if (Math.abs(det) >= ccwerrboundA * detsum) return det;
4082
+ return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum);
4083
+ }
4084
+
4085
+ // ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/orient3d.js
4086
+ var o3derrboundA = (7 + 56 * epsilon) * epsilon;
4087
+ var o3derrboundB = (3 + 28 * epsilon) * epsilon;
4088
+ var o3derrboundC = (26 + 288 * epsilon) * epsilon * epsilon;
4089
+ var bc = vec(4);
4090
+ var ca = vec(4);
4091
+ var ab = vec(4);
4092
+ var at_b = vec(4);
4093
+ var at_c = vec(4);
4094
+ var bt_c = vec(4);
4095
+ var bt_a = vec(4);
4096
+ var ct_a = vec(4);
4097
+ var ct_b = vec(4);
4098
+ var bct = vec(8);
4099
+ var cat = vec(8);
4100
+ var abt = vec(8);
4101
+ var u2 = vec(4);
4102
+ var _8 = vec(8);
4103
+ var _8b = vec(8);
4104
+ var _16 = vec(8);
4105
+ var _12 = vec(12);
4106
+ var fin = vec(192);
4107
+ var fin2 = vec(192);
4108
+
4109
+ // ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/incircle.js
4110
+ var iccerrboundA = (10 + 96 * epsilon) * epsilon;
4111
+ var iccerrboundB = (4 + 48 * epsilon) * epsilon;
4112
+ var iccerrboundC = (44 + 576 * epsilon) * epsilon * epsilon;
4113
+ var bc2 = vec(4);
4114
+ var ca2 = vec(4);
4115
+ var ab2 = vec(4);
4116
+ var aa = vec(4);
4117
+ var bb = vec(4);
4118
+ var cc = vec(4);
4119
+ var u3 = vec(4);
4120
+ var v = vec(4);
4121
+ var axtbc = vec(8);
4122
+ var aytbc = vec(8);
4123
+ var bxtca = vec(8);
4124
+ var bytca = vec(8);
4125
+ var cxtab = vec(8);
4126
+ var cytab = vec(8);
4127
+ var abt2 = vec(8);
4128
+ var bct2 = vec(8);
4129
+ var cat2 = vec(8);
4130
+ var abtt = vec(4);
4131
+ var bctt = vec(4);
4132
+ var catt = vec(4);
4133
+ var _82 = vec(8);
4134
+ var _162 = vec(16);
4135
+ var _16b = vec(16);
4136
+ var _16c = vec(16);
4137
+ var _32 = vec(32);
4138
+ var _32b = vec(32);
4139
+ var _48 = vec(48);
4140
+ var _64 = vec(64);
4141
+ var fin3 = vec(1152);
4142
+ var fin22 = vec(1152);
4143
+
4144
+ // ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/insphere.js
4145
+ var isperrboundA = (16 + 224 * epsilon) * epsilon;
4146
+ var isperrboundB = (5 + 72 * epsilon) * epsilon;
4147
+ var isperrboundC = (71 + 1408 * epsilon) * epsilon * epsilon;
4148
+ var ab3 = vec(4);
4149
+ var bc3 = vec(4);
4150
+ var cd = vec(4);
4151
+ var de = vec(4);
4152
+ var ea = vec(4);
4153
+ var ac = vec(4);
4154
+ var bd = vec(4);
4155
+ var ce = vec(4);
4156
+ var da = vec(4);
4157
+ var eb = vec(4);
4158
+ var abc = vec(24);
4159
+ var bcd = vec(24);
4160
+ var cde = vec(24);
4161
+ var dea = vec(24);
4162
+ var eab = vec(24);
4163
+ var abd = vec(24);
4164
+ var bce = vec(24);
4165
+ var cda = vec(24);
4166
+ var deb = vec(24);
4167
+ var eac = vec(24);
4168
+ var adet = vec(1152);
4169
+ var bdet = vec(1152);
4170
+ var cdet = vec(1152);
4171
+ var ddet = vec(1152);
4172
+ var edet = vec(1152);
4173
+ var abdet = vec(2304);
4174
+ var cddet = vec(2304);
4175
+ var cdedet = vec(3456);
4176
+ var deter = vec(5760);
4177
+ var _83 = vec(8);
4178
+ var _8b2 = vec(8);
4179
+ var _8c = vec(8);
4180
+ var _163 = vec(16);
4181
+ var _24 = vec(24);
4182
+ var _482 = vec(48);
4183
+ var _48b = vec(48);
4184
+ var _96 = vec(96);
4185
+ var _192 = vec(192);
4186
+ var _384x = vec(384);
4187
+ var _384y = vec(384);
4188
+ var _384z = vec(384);
4189
+ var _768 = vec(768);
4190
+ var xdet = vec(96);
4191
+ var ydet = vec(96);
4192
+ var zdet = vec(96);
4193
+ var fin4 = vec(1152);
4194
+
4195
+ // ../../node_modules/point-in-polygon-hao/dist/esm/index.js
4196
+ function pointInPolygon(p, polygon2) {
4197
+ var i;
4198
+ var ii;
4199
+ var k = 0;
4200
+ var f;
4201
+ var u1;
4202
+ var v1;
4203
+ var u22;
4204
+ var v2;
4205
+ var currentP;
4206
+ var nextP;
4207
+ var x = p[0];
4208
+ var y = p[1];
4209
+ var numContours = polygon2.length;
4210
+ for (i = 0; i < numContours; i++) {
4211
+ ii = 0;
4212
+ var contour = polygon2[i];
4213
+ var contourLen = contour.length - 1;
4214
+ currentP = contour[0];
4215
+ if (currentP[0] !== contour[contourLen][0] && currentP[1] !== contour[contourLen][1]) {
4216
+ throw new Error("First and last coordinates in a ring must be the same");
4217
+ }
4218
+ u1 = currentP[0] - x;
4219
+ v1 = currentP[1] - y;
4220
+ for (ii; ii < contourLen; ii++) {
4221
+ nextP = contour[ii + 1];
4222
+ u22 = nextP[0] - x;
4223
+ v2 = nextP[1] - y;
4224
+ if (v1 === 0 && v2 === 0) {
4225
+ if (u22 <= 0 && u1 >= 0 || u1 <= 0 && u22 >= 0) {
4226
+ return 0;
4227
+ }
4228
+ } else if (v2 >= 0 && v1 <= 0 || v2 <= 0 && v1 >= 0) {
4229
+ f = orient2d(u1, u22, v1, v2, 0, 0);
4230
+ if (f === 0) {
4231
+ return 0;
4232
+ }
4233
+ if (f > 0 && v2 > 0 && v1 <= 0 || f < 0 && v2 <= 0 && v1 > 0) {
4234
+ k++;
4235
+ }
4236
+ }
4237
+ currentP = nextP;
4238
+ v1 = v2;
4239
+ u1 = u22;
4240
+ }
4241
+ }
4242
+ if (k % 2 === 0) {
4243
+ return false;
4244
+ }
4245
+ return true;
4246
+ }
4247
+
4248
+ // ../../node_modules/@turf/invariant/dist/esm/index.js
4249
+ function getCoord(coord) {
4250
+ if (!coord) {
4251
+ throw new Error("coord is required");
4252
+ }
4253
+ if (!Array.isArray(coord)) {
4254
+ if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
4255
+ return [...coord.geometry.coordinates];
4256
+ }
4257
+ if (coord.type === "Point") {
4258
+ return [...coord.coordinates];
4259
+ }
4260
+ }
4261
+ if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
4262
+ return [...coord];
4263
+ }
4264
+ throw new Error("coord must be GeoJSON Point or an Array of numbers");
4265
+ }
4266
+ function getGeom(geojson) {
4267
+ if (geojson.type === "Feature") {
4268
+ return geojson.geometry;
4269
+ }
4270
+ return geojson;
4271
+ }
4272
+
4273
+ // ../../node_modules/@turf/boolean-point-in-polygon/dist/esm/index.js
4274
+ function booleanPointInPolygon(point2, polygon2, options = {}) {
4275
+ if (!point2) {
4276
+ throw new Error("point is required");
4277
+ }
4278
+ if (!polygon2) {
4279
+ throw new Error("polygon is required");
4280
+ }
4281
+ const pt = getCoord(point2);
4282
+ const geom = getGeom(polygon2);
4283
+ const type = geom.type;
4284
+ const bbox2 = polygon2.bbox;
4285
+ let polys = geom.coordinates;
4286
+ if (bbox2 && inBBox(pt, bbox2) === false) {
4287
+ return false;
4288
+ }
4289
+ if (type === "Polygon") {
4290
+ polys = [polys];
4291
+ }
4292
+ let result = false;
4293
+ for (var i = 0; i < polys.length; ++i) {
4294
+ const polyResult = pointInPolygon(pt, polys[i]);
4295
+ if (polyResult === 0) return options.ignoreBoundary ? false : true;
4296
+ else if (polyResult) result = true;
4297
+ }
4298
+ return result;
4299
+ }
4300
+ function inBBox(pt, bbox2) {
4301
+ return bbox2[0] <= pt[0] && bbox2[1] <= pt[1] && bbox2[2] >= pt[0] && bbox2[3] >= pt[1];
4302
+ }
4303
+
4304
+ // src/IndoorMap/renderer/utils/findUnitOnPoint.ts
4305
+ var findUnitOnPoint = (units, point2) => {
4306
+ return units.find((unit) => booleanPointInPolygon(point2, polygon(unit.geometry.coordinates)));
4307
+ };
4308
+
3847
4309
  // src/IndoorMap/renderer/RendererManager.ts
3848
4310
  function delay(ms) {
3849
4311
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -3947,7 +4409,7 @@ var RendererManager = class extends EventTarget {
3947
4409
  populate: true
3948
4410
  });
3949
4411
  units.filter(
3950
- (u) => !["opentobelow", "escalator"].includes(u.properties.category)
4412
+ (u4) => !["opentobelow", "escalator"].includes(u4.properties.category)
3951
4413
  ).forEach((unit) => {
3952
4414
  const element = this.elementRenderer.createGeometry(unit);
3953
4415
  if (element) {
@@ -3965,7 +4427,7 @@ var RendererManager = class extends EventTarget {
3965
4427
  this.addElementsToManager(kiosk.id, _elements, kiosk.properties.level.properties.ordinal);
3966
4428
  }
3967
4429
  });
3968
- const escalators = units.filter((u) => u.properties.category === "escalator");
4430
+ const escalators = units.filter((u4) => u4.properties.category === "escalator");
3969
4431
  for (const escalator of escalators) {
3970
4432
  try {
3971
4433
  const escalatorRelationships = relationships.filter((r) => (r.properties?.intermediary || []).some((inter) => inter.id === escalator.id));
@@ -3997,6 +4459,17 @@ var RendererManager = class extends EventTarget {
3997
4459
  console.warn(`cannot create escalator`, err.message);
3998
4460
  }
3999
4461
  }
4462
+ const groundLabels = await this.#dataClient.filterByType("label");
4463
+ for (const label of groundLabels) {
4464
+ const center2 = (0, import_center3.center)(polygon(label.geometry.coordinates)).geometry.coordinates;
4465
+ const unit = findUnitOnPoint(units, center2);
4466
+ const element = this.elementRenderer.createGroundLabel(label, unit);
4467
+ console.log({ element });
4468
+ if (element) {
4469
+ const _elements = Array.isArray(element) ? element : [element];
4470
+ this.addElementsToManager(label.id, _elements, label.properties.ordinal);
4471
+ }
4472
+ }
4000
4473
  this.changeLevelByOrdinal(this.currentOrdinals);
4001
4474
  this.dispatchEvent(new CustomEvent("renderermanager:elements_created"));
4002
4475
  }
@@ -4123,7 +4596,6 @@ var IndoorMap = class extends EventTarget {
4123
4596
  #billboardObjects = [];
4124
4597
  #spriteMarkerObjects = [];
4125
4598
  #mapDecorations = [];
4126
- #groundLabels = [];
4127
4599
  #groundObjects = [];
4128
4600
  #navigationGeometries = {};
4129
4601
  #venueObjects = [];
@@ -4288,9 +4760,6 @@ var IndoorMap = class extends EventTarget {
4288
4760
  set mapDecorations(value) {
4289
4761
  this.#mapDecorations = value;
4290
4762
  }
4291
- set groundLabels(value) {
4292
- this.#groundLabels = value;
4293
- }
4294
4763
  set pixelRatio(value) {
4295
4764
  this.map.setDevicePixelRatio(value);
4296
4765
  }
@@ -4334,13 +4803,11 @@ var IndoorMap = class extends EventTarget {
4334
4803
  createDecoration,
4335
4804
  // 3D
4336
4805
  create3DFootprint,
4337
- create3DGroundLabel,
4338
4806
  create3DBillboard,
4339
4807
  createExtrudedUnit,
4340
4808
  create3DAmenityMarker,
4341
4809
  create3DOccupantAmenityMarker,
4342
- create3DOpeningMarker,
4343
- createOccupantGroundLabel
4810
+ create3DOpeningMarker
4344
4811
  } = this.#styler;
4345
4812
  let elements = {};
4346
4813
  let object3ds = [];
@@ -4418,16 +4885,6 @@ var IndoorMap = class extends EventTarget {
4418
4885
  console.warn(`Cannot create ${feature2.id}: ${err.message}`);
4419
4886
  }
4420
4887
  }
4421
- this.#groundLabels.forEach((label) => {
4422
- const text = label.properties.name;
4423
- try {
4424
- const groundLabel = create3DGroundLabel(label, this.threeLayer);
4425
- object3ds.push(groundLabel);
4426
- this.#groundObjects.push(groundLabel);
4427
- } catch (error) {
4428
- console.log("error creating ground label for ", text);
4429
- }
4430
- });
4431
4888
  this.#mapDecorations.forEach((decoration) => {
4432
4889
  const { id, geometry, properties } = decoration;
4433
4890
  const geometryType = decoration?.geometry?.type;
@@ -4866,9 +5323,6 @@ var IndoorMap = class extends EventTarget {
4866
5323
  child.visible = this.showVenueObject && objectOpacity > 0.4;
4867
5324
  });
4868
5325
  });
4869
- this.#groundObjects.forEach((gLabel) => {
4870
- gLabel.bearing = currBearing;
4871
- });
4872
5326
  }
4873
5327
  this.#animationsToRun.forEach(({ callback }) => callback(this));
4874
5328
  import_tween.default.update();