venue-js 1.4.0-next.16 → 1.4.0-next.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -27,6 +27,71 @@ var IMDF_FEATURE_TYPES = [
27
27
  "unit",
28
28
  "venue"
29
29
  ];
30
+ var IMDF_UNIT_CATEGORIES = [
31
+ "auditorium",
32
+ "brick",
33
+ "classroom",
34
+ "column",
35
+ "concrete",
36
+ "conferenceroom",
37
+ "drywall",
38
+ "elevator",
39
+ "escalator",
40
+ "fieldofplay",
41
+ "firstaid",
42
+ "fitnessroom",
43
+ "foodservice",
44
+ "footbridge",
45
+ "glass",
46
+ "huddleroom",
47
+ "kitchen",
48
+ "laboratory",
49
+ "library",
50
+ "lobby",
51
+ "lounge",
52
+ "mailroom",
53
+ "mothersroom",
54
+ "movietheater",
55
+ "movingwalkway",
56
+ "nonpublic",
57
+ "office",
58
+ "opentobelow",
59
+ "parking",
60
+ "phoneroom",
61
+ "platform",
62
+ "privatelounge",
63
+ "ramp",
64
+ "recreation",
65
+ "restroom",
66
+ "restroom.family",
67
+ "restroom.female",
68
+ "restroom.female.wheelchair",
69
+ "restroom.male",
70
+ "restroom.male.wheelchair",
71
+ "restroom.transgender",
72
+ "restroom.transgender.wheelchair",
73
+ "restroom.unisex",
74
+ "restroom.unisex.wheelchair",
75
+ "restroom.wheelchair",
76
+ "road",
77
+ "room",
78
+ "serverroom",
79
+ "shower",
80
+ "smokingarea",
81
+ "stairs",
82
+ "steps",
83
+ "storage",
84
+ "structure",
85
+ "terrace",
86
+ "theater",
87
+ "unenclosedarea",
88
+ "unspecified",
89
+ "vegetation",
90
+ "waitingroom",
91
+ "walkway",
92
+ "walkway.island",
93
+ "wood"
94
+ ];
30
95
  var NONIMDF_FEATURE_TYPES = [
31
96
  "taxonomy",
32
97
  "event",
@@ -268,7 +333,7 @@ var isValidPoint = (geometry) => {
268
333
  function isInFilter(filter) {
269
334
  return typeof filter === "object" && filter !== null && "$in" in filter && Array.isArray(filter.$in);
270
335
  }
271
- var someIntersect = (a, b) => a.some((v2) => b.includes(v2));
336
+ var someIntersect = (a, b) => a.some((v) => b.includes(v));
272
337
  function matchFilter(value, filter) {
273
338
  if (Array.isArray(value)) {
274
339
  if (isInFilter(filter)) return someIntersect(value, filter.$in);
@@ -326,7 +391,27 @@ import {
326
391
  } from "@tanstack/query-core";
327
392
 
328
393
  // src/data/populator/index.ts
329
- import { booleanWithin } from "@turf/boolean-within";
394
+ import { center as center2 } from "@turf/center";
395
+ import { booleanPointInPolygon as booleanPointInPolygon2 } from "@turf/boolean-point-in-polygon";
396
+
397
+ // src/data/utils/findContaining.ts
398
+ import { center } from "@turf/center";
399
+ import { booleanPointInPolygon } from "@turf/boolean-point-in-polygon";
400
+ var findContainingUnit = (poi, units) => {
401
+ const unit = units.find(
402
+ (unit2) => {
403
+ try {
404
+ return unit2.properties.level_id === poi.properties.level_id && booleanPointInPolygon(center(poi), unit2);
405
+ } catch (e) {
406
+ console.log(`Cannot find containing unit of (${poi.id}):`, e.message);
407
+ return false;
408
+ }
409
+ }
410
+ );
411
+ return unit;
412
+ };
413
+
414
+ // src/data/populator/index.ts
330
415
  var createPopulator = ({
331
416
  internalFindById,
332
417
  internalFilterByType
@@ -336,7 +421,6 @@ var createPopulator = ({
336
421
  const populateDetail = (detail) => Promise.resolve(detail);
337
422
  const populateFootprint = (footprint) => Promise.resolve(footprint);
338
423
  const populateGeofence = (geofence) => Promise.resolve(geofence);
339
- const populateRelationship = (relationship) => Promise.resolve(relationship);
340
424
  const populatePrivilege = (privilege) => Promise.resolve(privilege);
341
425
  const populateEvent = (event) => Promise.resolve(event);
342
426
  const populatePromotion = async (promotion) => {
@@ -360,7 +444,7 @@ var createPopulator = ({
360
444
  const ordinalKiosks = kiosks.filter(
361
445
  (kiosk2) => kiosk2.properties.level_id === defaultLevel.id
362
446
  );
363
- const kiosk = ordinalKiosks.find((kiosk2) => booleanWithin(amenity, kiosk2));
447
+ const kiosk = ordinalKiosks.find((kiosk2) => booleanPointInPolygon2(amenity, kiosk2));
364
448
  return {
365
449
  ...amenity,
366
450
  properties: {
@@ -379,7 +463,7 @@ var createPopulator = ({
379
463
  const venue = await internalFindById(unit.properties.venue_id);
380
464
  const level = await internalFindById(unit.properties.level_id);
381
465
  const sections = await internalFilterByType("section");
382
- const section = sections.find((section2) => booleanWithin(anchor, section2));
466
+ const section = sections.find((section2) => booleanPointInPolygon2(anchor, section2));
383
467
  return {
384
468
  ...anchor,
385
469
  properties: {
@@ -412,20 +496,11 @@ var createPopulator = ({
412
496
  const venue = await internalFindById(kiosk.properties.venue_id);
413
497
  const anchor = await internalFindById(kiosk.properties.anchor_id);
414
498
  const units = await internalFilterByType("unit");
415
- const unit = units.find(
416
- (unit2) => {
417
- try {
418
- return unit2.properties.category === "walkway" && unit2.properties.level_id === kiosk.properties.level_id && booleanWithin(kiosk, unit2);
419
- } catch (e) {
420
- console.log(`Cannot find kiosk(${kiosk.id})'s units:`, e.message);
421
- return false;
422
- }
423
- }
424
- );
499
+ const unit = findContainingUnit(kiosk, units.filter((unit2) => unit2.properties.category === "walkway"));
425
500
  let section = null;
426
501
  if (anchor) {
427
502
  const sections = await internalFilterByType("section");
428
- section = sections.find((section2) => booleanWithin(anchor, section2));
503
+ section = sections.find((section2) => booleanPointInPolygon2(anchor, section2));
429
504
  }
430
505
  return {
431
506
  ...kiosk,
@@ -507,6 +582,23 @@ var createPopulator = ({
507
582
  }
508
583
  };
509
584
  };
585
+ const populateRelationship = async (relationship) => {
586
+ const originId = relationship.properties.origin?.id;
587
+ const destinationId = relationship.properties.destination?.id;
588
+ const origin = originId ? await internalFindById(originId) : null;
589
+ const destination = destinationId ? await internalFindById(destinationId) : null;
590
+ const intermediary_ids = (relationship.properties.intermediary || []).map(({ id }) => id);
591
+ const intermediary = await Promise.all(intermediary_ids.map(internalFindById));
592
+ return {
593
+ ...relationship,
594
+ properties: {
595
+ ...relationship.properties,
596
+ origin,
597
+ destination,
598
+ intermediary
599
+ }
600
+ };
601
+ };
510
602
  const populateSection = async (section) => {
511
603
  const venue = await internalFindById(section.properties.venue_id);
512
604
  const level = await internalFindById(section.properties.level_id);
@@ -525,7 +617,7 @@ var createPopulator = ({
525
617
  const level = await internalFindById(unit.properties.level_id);
526
618
  const sections = await internalFilterByType("section");
527
619
  try {
528
- const section = unit.geometry.type !== "MultiPolygon" ? sections.find((section2) => booleanWithin(unit, section2)) : null;
620
+ const section = unit.geometry.type !== "MultiPolygon" ? sections.find((section2) => booleanPointInPolygon2(center2(unit), section2)) : null;
529
621
  return {
530
622
  ...unit,
531
623
  properties: {
@@ -2106,7 +2198,7 @@ import "@maptalks/transcoders.draco";
2106
2198
  import TWEEN from "@tweenjs/tween.js";
2107
2199
  import _5 from "lodash";
2108
2200
 
2109
- // ../../node_modules/@turf/helpers/dist/esm/index.js
2201
+ // node_modules/@turf/helpers/dist/esm/index.js
2110
2202
  var earthRadius = 63710088e-1;
2111
2203
  var factors = {
2112
2204
  centimeters: earthRadius * 100,
@@ -2347,7 +2439,7 @@ var Billboard = class extends BaseObject {
2347
2439
  this._initOptions(options);
2348
2440
  const {
2349
2441
  altitude = OPTIONS.altitude,
2350
- scale: scale3 = OPTIONS.scale,
2442
+ scale: scale2 = OPTIONS.scale,
2351
2443
  alphaTest = OPTIONS.alphaTest,
2352
2444
  legColor = OPTIONS.legColor,
2353
2445
  showLeg = OPTIONS.showLeg
@@ -2381,8 +2473,8 @@ var Billboard = class extends BaseObject {
2381
2473
  const sprite = new Sprite(material);
2382
2474
  sprite.material.sizeAttenuation = false;
2383
2475
  sprite.scale.set(
2384
- scale3 * naturalWidth / divider,
2385
- scale3 * naturalHeight / divider,
2476
+ scale2 * naturalWidth / divider,
2477
+ scale2 * naturalHeight / divider,
2386
2478
  1
2387
2479
  );
2388
2480
  this.getObject3d().add(sprite);
@@ -2391,7 +2483,7 @@ var Billboard = class extends BaseObject {
2391
2483
  const position = layer.coordinateToVector3(coordinate, z);
2392
2484
  _.set(this.properties, "default.position", position);
2393
2485
  _.set(this.properties, "default.altitude", altitude);
2394
- _.set(this.properties, "default.scale", scale3);
2486
+ _.set(this.properties, "default.scale", scale2);
2395
2487
  this.getObject3d().position.copy(position);
2396
2488
  }
2397
2489
  setLineHeight(altitude) {
@@ -2431,18 +2523,18 @@ var SpriteMarker = class extends BaseObject2 {
2431
2523
  this._createGroup();
2432
2524
  const {
2433
2525
  altitude = DEFAULT_OPTIONS.altitude,
2434
- scale: scale3 = DEFAULT_OPTIONS.scale,
2526
+ scale: scale2 = DEFAULT_OPTIONS.scale,
2435
2527
  highlight = DEFAULT_OPTIONS.highlight,
2436
2528
  alphaTest = DEFAULT_OPTIONS.alphaTest
2437
2529
  } = options;
2438
2530
  this.properties = { ...properties };
2439
2531
  const modifiedAltitude = altitude + 2;
2440
- this.#default = { options: { scale: scale3, altitude: modifiedAltitude }, material };
2532
+ this.#default = { options: { scale: scale2, altitude: modifiedAltitude }, material };
2441
2533
  this.#highlight = _2.merge({}, DEFAULT_OPTIONS.highlight, highlight);
2442
2534
  if (material && material instanceof SpriteMaterial2)
2443
2535
  material.alphaTest = alphaTest;
2444
2536
  const sprite = new Sprite2(material);
2445
- sprite.scale.set(scale3, scale3, scale3);
2537
+ sprite.scale.set(scale2, scale2, scale2);
2446
2538
  const obj3d = this.getObject3d();
2447
2539
  obj3d.add(sprite);
2448
2540
  const z = layer.altitudeToVector3(modifiedAltitude, modifiedAltitude).x;
@@ -2588,14 +2680,14 @@ var NavigationPath = class extends BaseObject3 {
2588
2680
  };
2589
2681
 
2590
2682
  // src/IndoorMap/utils/geometry.ts
2591
- import center from "@turf/center";
2683
+ import center3 from "@turf/center";
2592
2684
  import _3 from "lodash";
2593
2685
  import turfLineOffset from "@turf/line-offset";
2594
2686
  var getCenterFromGeometry = (geometry) => {
2595
2687
  try {
2596
2688
  const { type = null, coordinates = null } = geometry;
2597
2689
  if (!type || !coordinates) return null;
2598
- const centerPoint = center(geometry);
2690
+ const centerPoint = center3(geometry);
2599
2691
  return _3.get(centerPoint, "geometry.coordinates");
2600
2692
  } catch (error) {
2601
2693
  return null;
@@ -2642,8 +2734,8 @@ var createSVGPathFromMarkerSymbol = (style) => {
2642
2734
  markerFill,
2643
2735
  markerPath
2644
2736
  } = style;
2645
- const scale3 = markerWidth / 24;
2646
- return `<path d="${markerPath}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale3})" fill="${markerFill}"/>`;
2737
+ const scale2 = markerWidth / 24;
2738
+ return `<path d="${markerPath}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${markerFill}"/>`;
2647
2739
  };
2648
2740
 
2649
2741
  // src/IndoorMap/utils/createElements.js
@@ -3579,7 +3671,7 @@ var styledFeatureGenerator = (mapTheme) => {
3579
3671
  const {
3580
3672
  logo,
3581
3673
  altitude,
3582
- scale: scale3,
3674
+ scale: scale2,
3583
3675
  alphaTest,
3584
3676
  legColor,
3585
3677
  showLeg,
@@ -3593,7 +3685,7 @@ var styledFeatureGenerator = (mapTheme) => {
3593
3685
  };
3594
3686
  const options = {
3595
3687
  altitude,
3596
- scale: scale3,
3688
+ scale: scale2,
3597
3689
  alphaTest,
3598
3690
  legColor,
3599
3691
  showLeg,
@@ -3837,9 +3929,9 @@ var getRelatedLocationsByAmenity = (feature2) => {
3837
3929
  var getRelatedLocationIdsByFeature = (feature2) => {
3838
3930
  switch (feature2?.feature_type) {
3839
3931
  case "amenity":
3840
- return getRelatedLocationsByAmenity(feature2).map((v2) => v2?.id);
3932
+ return getRelatedLocationsByAmenity(feature2).map((v) => v?.id);
3841
3933
  case "occupant":
3842
- return getRelatedLocationsByOccupant(feature2).map((v2) => v2?.id);
3934
+ return getRelatedLocationsByOccupant(feature2).map((v) => v?.id);
3843
3935
  default:
3844
3936
  return [];
3845
3937
  }
@@ -4173,22 +4265,22 @@ var getMaterial = (text, flatLabelOptions) => {
4173
4265
  texts = wrapText(ctx, text, maxWidth);
4174
4266
  }
4175
4267
  let textWidth = max(texts.map((text2) => ctx.measureText(text2).width));
4176
- let scale3 = 1;
4177
- while (scale3 > 0 && textWidth + 2 * margin > SIZE) {
4178
- scale3 -= scaleStep;
4179
- ctx.font = `${fontWeight} ${scale3 * fontSize}px "${fontFamily}", Arial`;
4268
+ let scale2 = 1;
4269
+ while (scale2 > 0 && textWidth + 2 * margin > SIZE) {
4270
+ scale2 -= scaleStep;
4271
+ ctx.font = `${fontWeight} ${scale2 * fontSize}px "${fontFamily}", Arial`;
4180
4272
  textWidth = max(texts.map((text2) => ctx.measureText(text2).width));
4181
4273
  }
4182
- const center2 = { x: 0.5 * SIZE, y: 0.5 * SIZE };
4183
- if (scale3 > scaleMin) {
4184
- const totalHeight = texts.length * (fontSize * scale3 * lineHeight);
4185
- const startY = center2.y - totalHeight / 2 + fontSize * scale3 * lineHeight * 0.5;
4274
+ const center4 = { x: 0.5 * SIZE, y: 0.5 * SIZE };
4275
+ if (scale2 > scaleMin) {
4276
+ const totalHeight = texts.length * (fontSize * scale2 * lineHeight);
4277
+ const startY = center4.y - totalHeight / 2 + fontSize * scale2 * lineHeight * 0.5;
4186
4278
  texts.forEach((text2, index) => {
4187
- const yOffset = startY + index * (fontSize * scale3 * lineHeight);
4279
+ const yOffset = startY + index * (fontSize * scale2 * lineHeight);
4188
4280
  if (strokeStyle && lineWidth) {
4189
- ctx.strokeText(text2, center2.x, yOffset);
4281
+ ctx.strokeText(text2, center4.x, yOffset);
4190
4282
  }
4191
- ctx.fillText(text2, center2.x, yOffset);
4283
+ ctx.fillText(text2, center4.x, yOffset);
4192
4284
  });
4193
4285
  }
4194
4286
  const texture = new Texture(canvas);
@@ -4265,8 +4357,8 @@ var GroundLabel = class extends BaseObject4 {
4265
4357
  const basePosition = layer.coordinateToVector3([cx, cy], z);
4266
4358
  this.#originalPosition = basePosition.clone();
4267
4359
  const finalPosition = this.#calculateFinalPosition(basePosition);
4268
- const scale3 = width / 6456122659e-13;
4269
- const finalScale = maxFontScale && scale3 > maxFontScale ? maxFontScale : scale3;
4360
+ const scale2 = width / 6456122659e-13;
4361
+ const finalScale = maxFontScale && scale2 > maxFontScale ? maxFontScale : scale2;
4270
4362
  this.getObject3d().scale.set(finalScale, finalScale, finalScale);
4271
4363
  this.getObject3d().position.copy(finalPosition);
4272
4364
  this.getObject3d().rotation.z = Math.PI / 180 * this.#angle;
@@ -5239,478 +5331,11 @@ var angleBetweenLineStrings = (line1, line2) => {
5239
5331
  return Math.atan2(dy, dx);
5240
5332
  };
5241
5333
 
5242
- // ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/util.js
5243
- var epsilon = 11102230246251565e-32;
5244
- var splitter = 134217729;
5245
- var resulterrbound = (3 + 8 * epsilon) * epsilon;
5246
- function sum(elen, e, flen, f, h) {
5247
- let Q, Qnew, hh, bvirt;
5248
- let enow = e[0];
5249
- let fnow = f[0];
5250
- let eindex = 0;
5251
- let findex = 0;
5252
- if (fnow > enow === fnow > -enow) {
5253
- Q = enow;
5254
- enow = e[++eindex];
5255
- } else {
5256
- Q = fnow;
5257
- fnow = f[++findex];
5258
- }
5259
- let hindex = 0;
5260
- if (eindex < elen && findex < flen) {
5261
- if (fnow > enow === fnow > -enow) {
5262
- Qnew = enow + Q;
5263
- hh = Q - (Qnew - enow);
5264
- enow = e[++eindex];
5265
- } else {
5266
- Qnew = fnow + Q;
5267
- hh = Q - (Qnew - fnow);
5268
- fnow = f[++findex];
5269
- }
5270
- Q = Qnew;
5271
- if (hh !== 0) {
5272
- h[hindex++] = hh;
5273
- }
5274
- while (eindex < elen && findex < flen) {
5275
- if (fnow > enow === fnow > -enow) {
5276
- Qnew = Q + enow;
5277
- bvirt = Qnew - Q;
5278
- hh = Q - (Qnew - bvirt) + (enow - bvirt);
5279
- enow = e[++eindex];
5280
- } else {
5281
- Qnew = Q + fnow;
5282
- bvirt = Qnew - Q;
5283
- hh = Q - (Qnew - bvirt) + (fnow - bvirt);
5284
- fnow = f[++findex];
5285
- }
5286
- Q = Qnew;
5287
- if (hh !== 0) {
5288
- h[hindex++] = hh;
5289
- }
5290
- }
5291
- }
5292
- while (eindex < elen) {
5293
- Qnew = Q + enow;
5294
- bvirt = Qnew - Q;
5295
- hh = Q - (Qnew - bvirt) + (enow - bvirt);
5296
- enow = e[++eindex];
5297
- Q = Qnew;
5298
- if (hh !== 0) {
5299
- h[hindex++] = hh;
5300
- }
5301
- }
5302
- while (findex < flen) {
5303
- Qnew = Q + fnow;
5304
- bvirt = Qnew - Q;
5305
- hh = Q - (Qnew - bvirt) + (fnow - bvirt);
5306
- fnow = f[++findex];
5307
- Q = Qnew;
5308
- if (hh !== 0) {
5309
- h[hindex++] = hh;
5310
- }
5311
- }
5312
- if (Q !== 0 || hindex === 0) {
5313
- h[hindex++] = Q;
5314
- }
5315
- return hindex;
5316
- }
5317
- function estimate(elen, e) {
5318
- let Q = e[0];
5319
- for (let i = 1; i < elen; i++) Q += e[i];
5320
- return Q;
5321
- }
5322
- function vec(n) {
5323
- return new Float64Array(n);
5324
- }
5325
-
5326
- // ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/orient2d.js
5327
- var ccwerrboundA = (3 + 16 * epsilon) * epsilon;
5328
- var ccwerrboundB = (2 + 12 * epsilon) * epsilon;
5329
- var ccwerrboundC = (9 + 64 * epsilon) * epsilon * epsilon;
5330
- var B = vec(4);
5331
- var C1 = vec(8);
5332
- var C2 = vec(12);
5333
- var D = vec(16);
5334
- var u = vec(4);
5335
- function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {
5336
- let acxtail, acytail, bcxtail, bcytail;
5337
- let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u32;
5338
- const acx = ax - cx;
5339
- const bcx = bx - cx;
5340
- const acy = ay - cy;
5341
- const bcy = by - cy;
5342
- s1 = acx * bcy;
5343
- c = splitter * acx;
5344
- ahi = c - (c - acx);
5345
- alo = acx - ahi;
5346
- c = splitter * bcy;
5347
- bhi = c - (c - bcy);
5348
- blo = bcy - bhi;
5349
- s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
5350
- t1 = acy * bcx;
5351
- c = splitter * acy;
5352
- ahi = c - (c - acy);
5353
- alo = acy - ahi;
5354
- c = splitter * bcx;
5355
- bhi = c - (c - bcx);
5356
- blo = bcx - bhi;
5357
- t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
5358
- _i = s0 - t0;
5359
- bvirt = s0 - _i;
5360
- B[0] = s0 - (_i + bvirt) + (bvirt - t0);
5361
- _j = s1 + _i;
5362
- bvirt = _j - s1;
5363
- _0 = s1 - (_j - bvirt) + (_i - bvirt);
5364
- _i = _0 - t1;
5365
- bvirt = _0 - _i;
5366
- B[1] = _0 - (_i + bvirt) + (bvirt - t1);
5367
- u32 = _j + _i;
5368
- bvirt = u32 - _j;
5369
- B[2] = _j - (u32 - bvirt) + (_i - bvirt);
5370
- B[3] = u32;
5371
- let det = estimate(4, B);
5372
- let errbound = ccwerrboundB * detsum;
5373
- if (det >= errbound || -det >= errbound) {
5374
- return det;
5375
- }
5376
- bvirt = ax - acx;
5377
- acxtail = ax - (acx + bvirt) + (bvirt - cx);
5378
- bvirt = bx - bcx;
5379
- bcxtail = bx - (bcx + bvirt) + (bvirt - cx);
5380
- bvirt = ay - acy;
5381
- acytail = ay - (acy + bvirt) + (bvirt - cy);
5382
- bvirt = by - bcy;
5383
- bcytail = by - (bcy + bvirt) + (bvirt - cy);
5384
- if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) {
5385
- return det;
5386
- }
5387
- errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det);
5388
- det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail);
5389
- if (det >= errbound || -det >= errbound) return det;
5390
- s1 = acxtail * bcy;
5391
- c = splitter * acxtail;
5392
- ahi = c - (c - acxtail);
5393
- alo = acxtail - ahi;
5394
- c = splitter * bcy;
5395
- bhi = c - (c - bcy);
5396
- blo = bcy - bhi;
5397
- s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
5398
- t1 = acytail * bcx;
5399
- c = splitter * acytail;
5400
- ahi = c - (c - acytail);
5401
- alo = acytail - ahi;
5402
- c = splitter * bcx;
5403
- bhi = c - (c - bcx);
5404
- blo = bcx - bhi;
5405
- t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
5406
- _i = s0 - t0;
5407
- bvirt = s0 - _i;
5408
- u[0] = s0 - (_i + bvirt) + (bvirt - t0);
5409
- _j = s1 + _i;
5410
- bvirt = _j - s1;
5411
- _0 = s1 - (_j - bvirt) + (_i - bvirt);
5412
- _i = _0 - t1;
5413
- bvirt = _0 - _i;
5414
- u[1] = _0 - (_i + bvirt) + (bvirt - t1);
5415
- u32 = _j + _i;
5416
- bvirt = u32 - _j;
5417
- u[2] = _j - (u32 - bvirt) + (_i - bvirt);
5418
- u[3] = u32;
5419
- const C1len = sum(4, B, 4, u, C1);
5420
- s1 = acx * bcytail;
5421
- c = splitter * acx;
5422
- ahi = c - (c - acx);
5423
- alo = acx - ahi;
5424
- c = splitter * bcytail;
5425
- bhi = c - (c - bcytail);
5426
- blo = bcytail - bhi;
5427
- s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
5428
- t1 = acy * bcxtail;
5429
- c = splitter * acy;
5430
- ahi = c - (c - acy);
5431
- alo = acy - ahi;
5432
- c = splitter * bcxtail;
5433
- bhi = c - (c - bcxtail);
5434
- blo = bcxtail - bhi;
5435
- t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
5436
- _i = s0 - t0;
5437
- bvirt = s0 - _i;
5438
- u[0] = s0 - (_i + bvirt) + (bvirt - t0);
5439
- _j = s1 + _i;
5440
- bvirt = _j - s1;
5441
- _0 = s1 - (_j - bvirt) + (_i - bvirt);
5442
- _i = _0 - t1;
5443
- bvirt = _0 - _i;
5444
- u[1] = _0 - (_i + bvirt) + (bvirt - t1);
5445
- u32 = _j + _i;
5446
- bvirt = u32 - _j;
5447
- u[2] = _j - (u32 - bvirt) + (_i - bvirt);
5448
- u[3] = u32;
5449
- const C2len = sum(C1len, C1, 4, u, C2);
5450
- s1 = acxtail * bcytail;
5451
- c = splitter * acxtail;
5452
- ahi = c - (c - acxtail);
5453
- alo = acxtail - ahi;
5454
- c = splitter * bcytail;
5455
- bhi = c - (c - bcytail);
5456
- blo = bcytail - bhi;
5457
- s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
5458
- t1 = acytail * bcxtail;
5459
- c = splitter * acytail;
5460
- ahi = c - (c - acytail);
5461
- alo = acytail - ahi;
5462
- c = splitter * bcxtail;
5463
- bhi = c - (c - bcxtail);
5464
- blo = bcxtail - bhi;
5465
- t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
5466
- _i = s0 - t0;
5467
- bvirt = s0 - _i;
5468
- u[0] = s0 - (_i + bvirt) + (bvirt - t0);
5469
- _j = s1 + _i;
5470
- bvirt = _j - s1;
5471
- _0 = s1 - (_j - bvirt) + (_i - bvirt);
5472
- _i = _0 - t1;
5473
- bvirt = _0 - _i;
5474
- u[1] = _0 - (_i + bvirt) + (bvirt - t1);
5475
- u32 = _j + _i;
5476
- bvirt = u32 - _j;
5477
- u[2] = _j - (u32 - bvirt) + (_i - bvirt);
5478
- u[3] = u32;
5479
- const Dlen = sum(C2len, C2, 4, u, D);
5480
- return D[Dlen - 1];
5481
- }
5482
- function orient2d(ax, ay, bx, by, cx, cy) {
5483
- const detleft = (ay - cy) * (bx - cx);
5484
- const detright = (ax - cx) * (by - cy);
5485
- const det = detleft - detright;
5486
- const detsum = Math.abs(detleft + detright);
5487
- if (Math.abs(det) >= ccwerrboundA * detsum) return det;
5488
- return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum);
5489
- }
5490
-
5491
- // ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/orient3d.js
5492
- var o3derrboundA = (7 + 56 * epsilon) * epsilon;
5493
- var o3derrboundB = (3 + 28 * epsilon) * epsilon;
5494
- var o3derrboundC = (26 + 288 * epsilon) * epsilon * epsilon;
5495
- var bc = vec(4);
5496
- var ca = vec(4);
5497
- var ab = vec(4);
5498
- var at_b = vec(4);
5499
- var at_c = vec(4);
5500
- var bt_c = vec(4);
5501
- var bt_a = vec(4);
5502
- var ct_a = vec(4);
5503
- var ct_b = vec(4);
5504
- var bct = vec(8);
5505
- var cat = vec(8);
5506
- var abt = vec(8);
5507
- var u2 = vec(4);
5508
- var _8 = vec(8);
5509
- var _8b = vec(8);
5510
- var _16 = vec(8);
5511
- var _12 = vec(12);
5512
- var fin = vec(192);
5513
- var fin2 = vec(192);
5514
-
5515
- // ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/incircle.js
5516
- var iccerrboundA = (10 + 96 * epsilon) * epsilon;
5517
- var iccerrboundB = (4 + 48 * epsilon) * epsilon;
5518
- var iccerrboundC = (44 + 576 * epsilon) * epsilon * epsilon;
5519
- var bc2 = vec(4);
5520
- var ca2 = vec(4);
5521
- var ab2 = vec(4);
5522
- var aa = vec(4);
5523
- var bb = vec(4);
5524
- var cc = vec(4);
5525
- var u3 = vec(4);
5526
- var v = vec(4);
5527
- var axtbc = vec(8);
5528
- var aytbc = vec(8);
5529
- var bxtca = vec(8);
5530
- var bytca = vec(8);
5531
- var cxtab = vec(8);
5532
- var cytab = vec(8);
5533
- var abt2 = vec(8);
5534
- var bct2 = vec(8);
5535
- var cat2 = vec(8);
5536
- var abtt = vec(4);
5537
- var bctt = vec(4);
5538
- var catt = vec(4);
5539
- var _82 = vec(8);
5540
- var _162 = vec(16);
5541
- var _16b = vec(16);
5542
- var _16c = vec(16);
5543
- var _32 = vec(32);
5544
- var _32b = vec(32);
5545
- var _48 = vec(48);
5546
- var _64 = vec(64);
5547
- var fin3 = vec(1152);
5548
- var fin22 = vec(1152);
5549
-
5550
- // ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/insphere.js
5551
- var isperrboundA = (16 + 224 * epsilon) * epsilon;
5552
- var isperrboundB = (5 + 72 * epsilon) * epsilon;
5553
- var isperrboundC = (71 + 1408 * epsilon) * epsilon * epsilon;
5554
- var ab3 = vec(4);
5555
- var bc3 = vec(4);
5556
- var cd = vec(4);
5557
- var de = vec(4);
5558
- var ea = vec(4);
5559
- var ac = vec(4);
5560
- var bd = vec(4);
5561
- var ce = vec(4);
5562
- var da = vec(4);
5563
- var eb = vec(4);
5564
- var abc = vec(24);
5565
- var bcd = vec(24);
5566
- var cde = vec(24);
5567
- var dea = vec(24);
5568
- var eab = vec(24);
5569
- var abd = vec(24);
5570
- var bce = vec(24);
5571
- var cda = vec(24);
5572
- var deb = vec(24);
5573
- var eac = vec(24);
5574
- var adet = vec(1152);
5575
- var bdet = vec(1152);
5576
- var cdet = vec(1152);
5577
- var ddet = vec(1152);
5578
- var edet = vec(1152);
5579
- var abdet = vec(2304);
5580
- var cddet = vec(2304);
5581
- var cdedet = vec(3456);
5582
- var deter = vec(5760);
5583
- var _83 = vec(8);
5584
- var _8b2 = vec(8);
5585
- var _8c = vec(8);
5586
- var _163 = vec(16);
5587
- var _24 = vec(24);
5588
- var _482 = vec(48);
5589
- var _48b = vec(48);
5590
- var _96 = vec(96);
5591
- var _192 = vec(192);
5592
- var _384x = vec(384);
5593
- var _384y = vec(384);
5594
- var _384z = vec(384);
5595
- var _768 = vec(768);
5596
- var xdet = vec(96);
5597
- var ydet = vec(96);
5598
- var zdet = vec(96);
5599
- var fin4 = vec(1152);
5600
-
5601
- // ../../node_modules/point-in-polygon-hao/dist/esm/index.js
5602
- function pointInPolygon(p, polygon2) {
5603
- var i;
5604
- var ii;
5605
- var k = 0;
5606
- var f;
5607
- var u1;
5608
- var v1;
5609
- var u22;
5610
- var v2;
5611
- var currentP;
5612
- var nextP;
5613
- var x = p[0];
5614
- var y = p[1];
5615
- var numContours = polygon2.length;
5616
- for (i = 0; i < numContours; i++) {
5617
- ii = 0;
5618
- var contour = polygon2[i];
5619
- var contourLen = contour.length - 1;
5620
- currentP = contour[0];
5621
- if (currentP[0] !== contour[contourLen][0] && currentP[1] !== contour[contourLen][1]) {
5622
- throw new Error("First and last coordinates in a ring must be the same");
5623
- }
5624
- u1 = currentP[0] - x;
5625
- v1 = currentP[1] - y;
5626
- for (ii; ii < contourLen; ii++) {
5627
- nextP = contour[ii + 1];
5628
- u22 = nextP[0] - x;
5629
- v2 = nextP[1] - y;
5630
- if (v1 === 0 && v2 === 0) {
5631
- if (u22 <= 0 && u1 >= 0 || u1 <= 0 && u22 >= 0) {
5632
- return 0;
5633
- }
5634
- } else if (v2 >= 0 && v1 <= 0 || v2 <= 0 && v1 >= 0) {
5635
- f = orient2d(u1, u22, v1, v2, 0, 0);
5636
- if (f === 0) {
5637
- return 0;
5638
- }
5639
- if (f > 0 && v2 > 0 && v1 <= 0 || f < 0 && v2 <= 0 && v1 > 0) {
5640
- k++;
5641
- }
5642
- }
5643
- currentP = nextP;
5644
- v1 = v2;
5645
- u1 = u22;
5646
- }
5647
- }
5648
- if (k % 2 === 0) {
5649
- return false;
5650
- }
5651
- return true;
5652
- }
5653
-
5654
- // ../../node_modules/@turf/invariant/dist/esm/index.js
5655
- function getCoord(coord) {
5656
- if (!coord) {
5657
- throw new Error("coord is required");
5658
- }
5659
- if (!Array.isArray(coord)) {
5660
- if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
5661
- return [...coord.geometry.coordinates];
5662
- }
5663
- if (coord.type === "Point") {
5664
- return [...coord.coordinates];
5665
- }
5666
- }
5667
- if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
5668
- return [...coord];
5669
- }
5670
- throw new Error("coord must be GeoJSON Point or an Array of numbers");
5671
- }
5672
- function getGeom(geojson) {
5673
- if (geojson.type === "Feature") {
5674
- return geojson.geometry;
5675
- }
5676
- return geojson;
5677
- }
5678
-
5679
- // ../../node_modules/@turf/boolean-point-in-polygon/dist/esm/index.js
5680
- function booleanPointInPolygon(point2, polygon2, options = {}) {
5681
- if (!point2) {
5682
- throw new Error("point is required");
5683
- }
5684
- if (!polygon2) {
5685
- throw new Error("polygon is required");
5686
- }
5687
- const pt = getCoord(point2);
5688
- const geom = getGeom(polygon2);
5689
- const type = geom.type;
5690
- const bbox2 = polygon2.bbox;
5691
- let polys = geom.coordinates;
5692
- if (bbox2 && inBBox(pt, bbox2) === false) {
5693
- return false;
5694
- }
5695
- if (type === "Polygon") {
5696
- polys = [polys];
5697
- }
5698
- let result = false;
5699
- for (var i = 0; i < polys.length; ++i) {
5700
- const polyResult = pointInPolygon(pt, polys[i]);
5701
- if (polyResult === 0) return options.ignoreBoundary ? false : true;
5702
- else if (polyResult) result = true;
5703
- }
5704
- return result;
5705
- }
5706
- function inBBox(pt, bbox2) {
5707
- return bbox2[0] <= pt[0] && bbox2[1] <= pt[1] && bbox2[2] >= pt[0] && bbox2[3] >= pt[1];
5708
- }
5709
-
5710
5334
  // src/IndoorMap/renderer/utils/findUnitOnPoint.ts
5335
+ import { booleanPointInPolygon as booleanPointInPolygon3 } from "@turf/boolean-point-in-polygon";
5711
5336
  var findUnitOnPoint = (units, point2) => {
5712
5337
  try {
5713
- return units.find((unit) => booleanPointInPolygon(point2, polygon(unit.geometry.coordinates)));
5338
+ return units.find((unit) => booleanPointInPolygon3(point2, polygon(unit.geometry.coordinates)));
5714
5339
  } catch (err) {
5715
5340
  return null;
5716
5341
  }
@@ -5759,9 +5384,9 @@ var RendererManager = class extends EventTarget {
5759
5384
  const pos = geom?.attributes?.position?.array;
5760
5385
  if (!pos || pos.length === 0) return;
5761
5386
  for (let i = 0; i < pos.length; i++) {
5762
- const v2 = pos[i];
5763
- if (!Number.isFinite(v2)) {
5764
- bad.push({ mesh: obj, index: i, value: v2 });
5387
+ const v = pos[i];
5388
+ if (!Number.isFinite(v)) {
5389
+ bad.push({ mesh: obj, index: i, value: v });
5765
5390
  break;
5766
5391
  }
5767
5392
  }
@@ -5857,7 +5482,7 @@ var RendererManager = class extends EventTarget {
5857
5482
  populate: true
5858
5483
  });
5859
5484
  units.filter(
5860
- (u4) => !["opentobelow", "escalator", "room"].includes(u4.properties.category)
5485
+ (u) => !["opentobelow", "escalator", "room"].includes(u.properties.category)
5861
5486
  ).forEach((unit) => {
5862
5487
  const element = this.elementRenderer.createGeometry(unit);
5863
5488
  if (element) {
@@ -5865,7 +5490,7 @@ var RendererManager = class extends EventTarget {
5865
5490
  this.addElementsToManager(unit.id, _elements, unit.properties.level.properties.ordinal);
5866
5491
  }
5867
5492
  });
5868
- units.filter((u4) => u4.properties.category === "room").forEach((unit) => {
5493
+ units.filter((u) => u.properties.category === "room").forEach((unit) => {
5869
5494
  const openingRelationships = relationships.filter((r) => r.properties.origin?.id === unit.id || r.properties.destination?.id === unit.id);
5870
5495
  const roomOpenings = compact2(openingRelationships.map((rel) => {
5871
5496
  const openingId = rel?.properties.intermediary[0].id;
@@ -5891,7 +5516,7 @@ var RendererManager = class extends EventTarget {
5891
5516
  this.addElementsToManager(kiosk.id, _elements, kiosk.properties.level.properties.ordinal);
5892
5517
  }
5893
5518
  });
5894
- const escalators = units.filter((u4) => u4.properties.category === "escalator");
5519
+ const escalators = units.filter((u) => u.properties.category === "escalator");
5895
5520
  for (const escalator of escalators) {
5896
5521
  try {
5897
5522
  const escalatorRelationships = relationships.filter((r) => (r.properties?.intermediary || []).some((inter) => inter.id === escalator.id));
@@ -5925,8 +5550,8 @@ var RendererManager = class extends EventTarget {
5925
5550
  }
5926
5551
  const groundLabels = await this.#dataClient.filterByType("label");
5927
5552
  for (const label of groundLabels) {
5928
- const center2 = turfCenter2(polygon(label.geometry.coordinates)).geometry.coordinates;
5929
- const unit = findUnitOnPoint(units, center2);
5553
+ const center4 = turfCenter2(polygon(label.geometry.coordinates)).geometry.coordinates;
5554
+ const unit = findUnitOnPoint(units, center4);
5930
5555
  if (unit) {
5931
5556
  const element = this.elementRenderer.createGroundLabel(label, unit);
5932
5557
  if (element) {
@@ -6161,8 +5786,8 @@ var IndoorMap = class extends EventTarget {
6161
5786
  this.#venues = venues;
6162
5787
  const venueCenters = turfCenter3(featureCollection(venues));
6163
5788
  const [x, y] = venueCenters.geometry.coordinates;
6164
- const center2 = new Coordinate4(x, y);
6165
- this.camera.setView({ center: center2, pitch: 60, zoom: 19 });
5789
+ const center4 = new Coordinate4(x, y);
5790
+ this.camera.setView({ center: center4, pitch: 60, zoom: 19 });
6166
5791
  });
6167
5792
  }
6168
5793
  }
@@ -6805,6 +6430,7 @@ export {
6805
6430
  GEOJSON_FEATURE_TYPES,
6806
6431
  HIGHLIGHT_LAYER_NAME,
6807
6432
  IMDF_FEATURE_TYPES,
6433
+ IMDF_UNIT_CATEGORIES,
6808
6434
  IndoorMap,
6809
6435
  LAST_USER_LOCATION_ELEMENT_ID_PREFIX,
6810
6436
  LAYERS,