three-geo-play 1.0.1 → 1.1.0

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.

Potentially problematic release.


This version of three-geo-play might be problematic. Click here for more details.

package/dist/index.js CHANGED
@@ -1,9 +1,14 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
6
  var __getProtoOf = Object.getPrototypeOf;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __typeError = (msg) => {
9
+ throw TypeError(msg);
10
+ };
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
12
  var __commonJS = (cb, mod2) => function __require() {
8
13
  return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
9
14
  };
@@ -28,6 +33,20 @@ var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__
28
33
  mod2
29
34
  ));
30
35
  var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
36
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
37
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
38
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
39
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
40
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
41
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
42
+ var __privateWrapper = (obj, member, setter, getter) => ({
43
+ set _(value) {
44
+ __privateSet(obj, member, value, setter);
45
+ },
46
+ get _() {
47
+ return __privateGet(obj, member, getter);
48
+ }
49
+ });
31
50
 
32
51
  // ../../node_modules/@protobufjs/aspromise/index.js
33
52
  var require_aspromise = __commonJS({
@@ -5447,709 +5466,1081 @@ module.exports = __toCommonJS(index_exports);
5447
5466
 
5448
5467
  // src/style/BuildingLayer.js
5449
5468
  var THREE = __toESM(require("three"));
5469
+ var _material, _YOrder, _height, _allowDetails, _isVisible, _BuildingLayer_instances, validateAndWrapMaterial_fn;
5450
5470
  var BuildingLayer = class {
5451
- #material;
5452
- #YOrder;
5453
- #height;
5454
- #allowDetails;
5455
- #isVisible = true;
5456
- #minHeight = 0;
5457
- #maxHeight = Infinity;
5458
- #fixToMinHeight = false;
5459
- constructor(material = null, YOrder = 0.03, minHeight = 0, maxHeight = Infinity, fixToMinHeight = false) {
5460
- this.#YOrder = YOrder;
5461
- this.#height = 1e-3;
5462
- this.#allowDetails = false;
5463
- this.#minHeight = minHeight;
5464
- this.#maxHeight = maxHeight;
5465
- this.#fixToMinHeight = fixToMinHeight;
5466
- this.#material = this.#validateAndWrapMaterial(material);
5471
+ /**
5472
+ * @param {THREE.Material|null} [material=null] - Material for building faces. Falls back to a default yellow material if invalid.
5473
+ * @param {number} [YOrder=0.03] - Y-axis render order offset.
5474
+ */
5475
+ constructor(material = null, YOrder = 0.03) {
5476
+ __privateAdd(this, _BuildingLayer_instances);
5477
+ /** @type {THREE.Material} */
5478
+ __privateAdd(this, _material);
5479
+ /** @type {number} */
5480
+ __privateAdd(this, _YOrder);
5481
+ /** @type {number} */
5482
+ __privateAdd(this, _height);
5483
+ /** @type {boolean} */
5484
+ __privateAdd(this, _allowDetails);
5485
+ /** @type {boolean} */
5486
+ __privateAdd(this, _isVisible, true);
5487
+ __privateSet(this, _YOrder, YOrder);
5488
+ __privateSet(this, _height, 1e-3);
5489
+ __privateSet(this, _allowDetails, false);
5490
+ __privateSet(this, _material, __privateMethod(this, _BuildingLayer_instances, validateAndWrapMaterial_fn).call(this, material));
5467
5491
  }
5492
+ /**
5493
+ * Whether this layer is rendered.
5494
+ * @type {boolean}
5495
+ */
5468
5496
  get isVisible() {
5469
- return this.#isVisible;
5497
+ return __privateGet(this, _isVisible);
5470
5498
  }
5471
5499
  set isVisible(value) {
5472
- this.#isVisible = !!value;
5500
+ __privateSet(this, _isVisible, !!value);
5473
5501
  }
5502
+ /**
5503
+ * The Three.js material applied to building geometry.
5504
+ * Must be a valid {@link THREE.Material}; otherwise a default material is used.
5505
+ * @type {THREE.Material}
5506
+ */
5474
5507
  get material() {
5475
- return this.#material;
5508
+ return __privateGet(this, _material);
5476
5509
  }
5477
5510
  set material(value) {
5478
- this.#material = this.#validateAndWrapMaterial(value);
5511
+ __privateSet(this, _material, __privateMethod(this, _BuildingLayer_instances, validateAndWrapMaterial_fn).call(this, value));
5479
5512
  }
5513
+ /**
5514
+ * Y-axis render order offset. Higher values render on top of lower ones.
5515
+ * @type {number}
5516
+ */
5480
5517
  get YOrder() {
5481
- return this.#YOrder;
5518
+ return __privateGet(this, _YOrder);
5482
5519
  }
5483
5520
  set YOrder(value) {
5484
- this.#YOrder = value;
5521
+ __privateSet(this, _YOrder, value);
5485
5522
  }
5523
+ /**
5524
+ * Base extrusion height multiplier for buildings without OSM height data.
5525
+ * @type {number}
5526
+ */
5486
5527
  get height() {
5487
- return this.#height;
5528
+ return __privateGet(this, _height);
5488
5529
  }
5489
5530
  set height(value) {
5490
- this.#height = value;
5531
+ __privateSet(this, _height, value);
5491
5532
  }
5533
+ /**
5534
+ * If true, enables finer building detail (e.g. roof shapes) when available in tile data.
5535
+ * @type {boolean}
5536
+ */
5492
5537
  get allowDetails() {
5493
- return this.#allowDetails;
5538
+ return __privateGet(this, _allowDetails);
5494
5539
  }
5495
5540
  set allowDetails(value) {
5496
- this.#allowDetails = !!value;
5541
+ __privateSet(this, _allowDetails, !!value);
5497
5542
  }
5543
+ /**
5544
+ * Returns this instance regardless of name (BuildingLayer has a single type).
5545
+ * @param {string} _name - Unused.
5546
+ * @returns {BuildingLayer} This instance.
5547
+ */
5498
5548
  getTypeByName(_name) {
5499
5549
  return this;
5500
5550
  }
5551
+ /**
5552
+ * Sets the material and returns this instance for chaining.
5553
+ * @param {THREE.Material} material
5554
+ * @returns {BuildingLayer}
5555
+ */
5501
5556
  setMaterial(material) {
5502
5557
  this.material = material;
5503
5558
  return this;
5504
5559
  }
5560
+ /**
5561
+ * Sets the Y render order and returns this instance for chaining.
5562
+ * @param {number} y
5563
+ * @returns {BuildingLayer}
5564
+ */
5505
5565
  setYOrder(y) {
5506
5566
  this.YOrder = y;
5507
5567
  return this;
5508
5568
  }
5569
+ /**
5570
+ * Sets the base extrusion height and returns this instance for chaining.
5571
+ * @param {number} h
5572
+ * @returns {BuildingLayer}
5573
+ */
5509
5574
  setHeight(h) {
5510
5575
  this.height = h;
5511
5576
  return this;
5512
5577
  }
5578
+ /**
5579
+ * Enables or disables detail rendering and returns this instance for chaining.
5580
+ * @param {boolean} val
5581
+ * @returns {BuildingLayer}
5582
+ */
5513
5583
  setAllowDetails(val) {
5514
5584
  this.allowDetails = val;
5515
5585
  return this;
5516
5586
  }
5517
- #validateAndWrapMaterial(material) {
5518
- if (!material || !(material instanceof THREE.Material)) {
5519
- if (material) {
5520
- console.warn("ThreeGeoPlay: Invalid material, using default. It must be a valid THREE.Material");
5521
- }
5522
- return new THREE.MeshBasicMaterial({
5523
- color: 16774307,
5524
- transparent: true,
5525
- opacity: 0.5,
5526
- side: THREE.FrontSide,
5527
- depthWrite: false
5528
- });
5529
- }
5530
- return material;
5587
+ };
5588
+ _material = new WeakMap();
5589
+ _YOrder = new WeakMap();
5590
+ _height = new WeakMap();
5591
+ _allowDetails = new WeakMap();
5592
+ _isVisible = new WeakMap();
5593
+ _BuildingLayer_instances = new WeakSet();
5594
+ /**
5595
+ * @param {THREE.Material|null} material
5596
+ * @returns {THREE.Material}
5597
+ * @private
5598
+ */
5599
+ validateAndWrapMaterial_fn = function(material) {
5600
+ if (!material || !(material instanceof THREE.Material)) {
5601
+ if (material) {
5602
+ console.warn("ThreeGeoPlay: Invalid material, using default. It must be a valid THREE.Material");
5603
+ }
5604
+ return new THREE.MeshBasicMaterial({
5605
+ color: 16774307,
5606
+ transparent: true,
5607
+ opacity: 0.5,
5608
+ side: THREE.FrontSide,
5609
+ depthWrite: false
5610
+ });
5531
5611
  }
5612
+ return material;
5532
5613
  };
5533
5614
 
5534
5615
  // src/style/WaterLayer.js
5535
5616
  var THREE2 = __toESM(require("three"));
5617
+ var _isVisible2, _material2, _YOrder2;
5536
5618
  var WaterType = class {
5537
- #isVisible = false;
5538
- #material;
5539
- #YOrder;
5619
+ /**
5620
+ * @param {THREE.Material} material - Three.js material for this water type.
5621
+ * @param {number} YOrder - Y-axis render order offset.
5622
+ */
5540
5623
  constructor(material, YOrder) {
5541
- this.#material = material;
5542
- this.#YOrder = YOrder;
5624
+ /** @type {boolean} */
5625
+ __privateAdd(this, _isVisible2, false);
5626
+ /** @type {THREE.Material} */
5627
+ __privateAdd(this, _material2);
5628
+ /** @type {number} */
5629
+ __privateAdd(this, _YOrder2);
5630
+ __privateSet(this, _material2, material);
5631
+ __privateSet(this, _YOrder2, YOrder);
5543
5632
  }
5633
+ /**
5634
+ * Whether this water type is rendered.
5635
+ * @type {boolean}
5636
+ */
5544
5637
  get isVisible() {
5545
- return this.#isVisible;
5638
+ return __privateGet(this, _isVisible2);
5546
5639
  }
5547
5640
  set isVisible(v) {
5548
- this.#isVisible = !!v;
5641
+ __privateSet(this, _isVisible2, !!v);
5549
5642
  }
5643
+ /**
5644
+ * Sets visibility (alias for the `isVisible` setter).
5645
+ * @param {boolean} v
5646
+ */
5550
5647
  setVisible(v) {
5551
- this.#isVisible = !!v;
5648
+ __privateSet(this, _isVisible2, !!v);
5552
5649
  }
5650
+ /**
5651
+ * The Three.js material used to render this water type.
5652
+ * Must be a {@link THREE.Material} instance.
5653
+ * @type {THREE.Material}
5654
+ */
5553
5655
  get material() {
5554
- return this.#material;
5656
+ return __privateGet(this, _material2);
5555
5657
  }
5556
5658
  set material(m) {
5557
5659
  if (m && !(m instanceof THREE2.Material)) {
5558
5660
  console.warn("ThreeGeoPlay: material must be a THREE.Material instance");
5559
5661
  return;
5560
5662
  }
5561
- this.#material = m;
5663
+ __privateSet(this, _material2, m);
5562
5664
  }
5665
+ /**
5666
+ * Y-axis render order offset for depth sorting.
5667
+ * @type {number}
5668
+ */
5563
5669
  get YOrder() {
5564
- return this.#YOrder;
5670
+ return __privateGet(this, _YOrder2);
5565
5671
  }
5566
5672
  set YOrder(v) {
5567
- this.#YOrder = v;
5673
+ __privateSet(this, _YOrder2, v);
5568
5674
  }
5569
5675
  };
5676
+ _isVisible2 = new WeakMap();
5677
+ _material2 = new WeakMap();
5678
+ _YOrder2 = new WeakMap();
5679
+ var _isVisible3, _swimming_pool, _river, _lake, _ocean, _pond, _waterMap, _WaterLayer_instances, allTypes_fn;
5570
5680
  var WaterLayer = class {
5571
- #isVisible = true;
5572
- #swimming_pool;
5573
- #river;
5574
- #lake;
5575
- #ocean;
5576
- #pond;
5577
- #waterMap;
5578
5681
  constructor() {
5579
- const mat = (color, transparent = false, opacity = 0.9, extra = {}) => new THREE2.MeshBasicMaterial({
5580
- color,
5581
- transparent,
5582
- opacity,
5583
- side: THREE2.BackSide,
5584
- ...extra
5585
- });
5586
- this.#swimming_pool = new WaterType(
5587
- mat(16777215, true, 0.5, { depthWrite: false }),
5588
- 1e-4
5589
- );
5590
- this.#river = new WaterType(
5591
- mat(16737792),
5592
- 12e-5
5593
- );
5594
- this.#lake = new WaterType(
5595
- mat(10279158),
5596
- 14e-5
5597
- );
5598
- this.#ocean = new WaterType(
5599
- mat(10279158),
5600
- 1e-4
5601
- );
5602
- this.#pond = new WaterType(
5603
- mat(3925925),
5604
- 1e-4
5605
- );
5606
- this.#waterMap = /* @__PURE__ */ new Map([
5607
- ["swimming_pool", this.#swimming_pool],
5608
- ["river", this.#river],
5609
- ["lake", this.#lake],
5610
- ["ocean", this.#ocean],
5611
- ["pond", this.#pond]
5612
- ]);
5682
+ __privateAdd(this, _WaterLayer_instances);
5683
+ /** @type {boolean} */
5684
+ __privateAdd(this, _isVisible3, true);
5685
+ /** @type {WaterType} */
5686
+ __privateAdd(this, _swimming_pool);
5687
+ /** @type {WaterType} */
5688
+ __privateAdd(this, _river);
5689
+ /** @type {WaterType} */
5690
+ __privateAdd(this, _lake);
5691
+ /** @type {WaterType} */
5692
+ __privateAdd(this, _ocean);
5693
+ /** @type {WaterType} */
5694
+ __privateAdd(this, _pond);
5695
+ /** @type {Map<string, WaterType>} */
5696
+ __privateAdd(this, _waterMap);
5697
+ const mat = (color, transparent = false, opacity = 0.9, extra = {}) => new THREE2.MeshBasicMaterial({ color, transparent, opacity, side: THREE2.BackSide, ...extra });
5698
+ __privateSet(this, _swimming_pool, new WaterType(mat(16777215, true, 0.5, { depthWrite: false }), 1e-4));
5699
+ __privateSet(this, _river, new WaterType(mat(16737792), 12e-5));
5700
+ __privateSet(this, _lake, new WaterType(mat(10279158), 14e-5));
5701
+ __privateSet(this, _ocean, new WaterType(mat(10279158), 1e-4));
5702
+ __privateSet(this, _pond, new WaterType(mat(3925925), 1e-4));
5703
+ __privateSet(this, _waterMap, /* @__PURE__ */ new Map([
5704
+ ["swimming_pool", __privateGet(this, _swimming_pool)],
5705
+ ["river", __privateGet(this, _river)],
5706
+ ["lake", __privateGet(this, _lake)],
5707
+ ["ocean", __privateGet(this, _ocean)],
5708
+ ["pond", __privateGet(this, _pond)]
5709
+ ]));
5613
5710
  }
5711
+ /**
5712
+ * Master visibility toggle. Setting this also propagates to all individual water types.
5713
+ * @type {boolean}
5714
+ */
5614
5715
  get isVisible() {
5615
- return this.#isVisible;
5716
+ return __privateGet(this, _isVisible3);
5616
5717
  }
5617
5718
  set isVisible(v) {
5618
- this.#isVisible = !!v;
5619
- this.#allTypes().forEach((t) => t.setVisible(v));
5719
+ __privateSet(this, _isVisible3, !!v);
5720
+ __privateMethod(this, _WaterLayer_instances, allTypes_fn).call(this).forEach((t) => t.setVisible(v));
5620
5721
  }
5722
+ /** @type {WaterType} */
5621
5723
  get swimming_pool() {
5622
- return this.#swimming_pool;
5724
+ return __privateGet(this, _swimming_pool);
5623
5725
  }
5726
+ /** @type {WaterType} */
5624
5727
  get river() {
5625
- return this.#river;
5728
+ return __privateGet(this, _river);
5626
5729
  }
5730
+ /** @type {WaterType} */
5627
5731
  get lake() {
5628
- return this.#lake;
5732
+ return __privateGet(this, _lake);
5629
5733
  }
5734
+ /** @type {WaterType} */
5630
5735
  get ocean() {
5631
- return this.#ocean;
5736
+ return __privateGet(this, _ocean);
5632
5737
  }
5738
+ /** @type {WaterType} */
5633
5739
  get pond() {
5634
- return this.#pond;
5740
+ return __privateGet(this, _pond);
5635
5741
  }
5742
+ /**
5743
+ * Returns a water type by its OSM class name.
5744
+ * @param {'swimming_pool'|'river'|'lake'|'ocean'|'pond'} name - The water class name.
5745
+ * @returns {WaterType|null} The matching type, or `null` if not found.
5746
+ */
5636
5747
  getTypeByName(name) {
5637
- return this.#waterMap.get(name) ?? null;
5748
+ return __privateGet(this, _waterMap).get(name) ?? null;
5638
5749
  }
5750
+ /**
5751
+ * Replaces the material on every water type with a clone of the provided material.
5752
+ * @param {THREE.Material} material - A valid Three.js material.
5753
+ */
5639
5754
  setAllMaterials(material) {
5640
5755
  if (!(material instanceof THREE2.Material)) {
5641
5756
  console.warn("ThreeGeoPlay: Invalid material, must be a THREE.Material");
5642
5757
  return;
5643
5758
  }
5644
- this.#allTypes().forEach((t) => {
5759
+ __privateMethod(this, _WaterLayer_instances, allTypes_fn).call(this).forEach((t) => {
5645
5760
  t.material = material.clone();
5646
5761
  });
5647
5762
  }
5763
+ /**
5764
+ * Sets visibility on all individual water types.
5765
+ * @param {boolean} isVisible
5766
+ */
5648
5767
  setVisibleAll(isVisible) {
5649
- this.#allTypes().forEach((t) => t.setVisible(isVisible));
5650
- }
5651
- #allTypes() {
5652
- return [
5653
- this.#swimming_pool,
5654
- this.#river,
5655
- this.#lake,
5656
- this.#ocean,
5657
- this.#pond
5658
- ];
5768
+ __privateMethod(this, _WaterLayer_instances, allTypes_fn).call(this).forEach((t) => t.setVisible(isVisible));
5659
5769
  }
5660
5770
  };
5771
+ _isVisible3 = new WeakMap();
5772
+ _swimming_pool = new WeakMap();
5773
+ _river = new WeakMap();
5774
+ _lake = new WeakMap();
5775
+ _ocean = new WeakMap();
5776
+ _pond = new WeakMap();
5777
+ _waterMap = new WeakMap();
5778
+ _WaterLayer_instances = new WeakSet();
5779
+ /**
5780
+ * @returns {WaterType[]}
5781
+ * @private
5782
+ */
5783
+ allTypes_fn = function() {
5784
+ return [__privateGet(this, _swimming_pool), __privateGet(this, _river), __privateGet(this, _lake), __privateGet(this, _ocean), __privateGet(this, _pond)];
5785
+ };
5661
5786
 
5662
5787
  // src/style/LanduseLayer.js
5663
5788
  var THREE3 = __toESM(require("three"));
5789
+ var _isVisible4, _material3, _YOrder3;
5664
5790
  var LandUseType = class {
5665
- #isVisible = false;
5666
- #material;
5667
- #YOrder;
5791
+ /**
5792
+ * @param {THREE.Material} material - Three.js material for this land use type.
5793
+ * @param {number} YOrder - Y-axis render order offset.
5794
+ */
5668
5795
  constructor(material, YOrder) {
5669
- this.#material = material;
5670
- this.#YOrder = YOrder;
5796
+ /** @type {boolean} */
5797
+ __privateAdd(this, _isVisible4, false);
5798
+ /** @type {THREE.Material} */
5799
+ __privateAdd(this, _material3);
5800
+ /** @type {number} */
5801
+ __privateAdd(this, _YOrder3);
5802
+ __privateSet(this, _material3, material);
5803
+ __privateSet(this, _YOrder3, YOrder);
5671
5804
  }
5805
+ /**
5806
+ * Whether this land use type is rendered.
5807
+ * @type {boolean}
5808
+ */
5672
5809
  get isVisible() {
5673
- return this.#isVisible;
5810
+ return __privateGet(this, _isVisible4);
5674
5811
  }
5675
5812
  set isVisible(v) {
5676
- this.#isVisible = !!v;
5813
+ __privateSet(this, _isVisible4, !!v);
5677
5814
  }
5815
+ /**
5816
+ * Sets visibility (alias for the `isVisible` setter).
5817
+ * @param {boolean} v
5818
+ */
5678
5819
  setVisible(v) {
5679
- this.#isVisible = !!v;
5820
+ __privateSet(this, _isVisible4, !!v);
5680
5821
  }
5822
+ /**
5823
+ * The Three.js material used to render this land use type.
5824
+ * Must be a {@link THREE.Material} instance.
5825
+ * @type {THREE.Material}
5826
+ */
5681
5827
  get material() {
5682
- return this.#material;
5828
+ return __privateGet(this, _material3);
5683
5829
  }
5684
5830
  set material(m) {
5685
5831
  if (m && !(m instanceof THREE3.Material)) {
5686
5832
  console.warn("ThreeGeoPlay: material must be a THREE.Material instance");
5687
5833
  return;
5688
5834
  }
5689
- this.#material = m;
5835
+ __privateSet(this, _material3, m);
5690
5836
  }
5837
+ /**
5838
+ * Y-axis render order offset for depth sorting.
5839
+ * @type {number}
5840
+ */
5691
5841
  get YOrder() {
5692
- return this.#YOrder;
5842
+ return __privateGet(this, _YOrder3);
5693
5843
  }
5694
5844
  set YOrder(v) {
5695
- this.#YOrder = v;
5845
+ __privateSet(this, _YOrder3, v);
5696
5846
  }
5697
5847
  };
5848
+ _isVisible4 = new WeakMap();
5849
+ _material3 = new WeakMap();
5850
+ _YOrder3 = new WeakMap();
5851
+ var _isVisible5, _farmland, _suburb, _residential, _industrial, _pitch, _university, _retail, _playground, _commercial, _military, _school, _college, _bus_station, _kindergarten, _theme_park, _hospital, _railway, _parking, _recreation_ground, _cemetery, _library, _track, _stadium, _quarter, _zoo, _attraction, _religious, _quarry, _nature_reserve, _protected_area, _landUseMap, _LandUseLayer_instances, allTypes_fn2;
5698
5852
  var LandUseLayer = class {
5699
- #isVisible = true;
5700
- #farmland;
5701
- #suburb;
5702
- #residential;
5703
- #industrial;
5704
- #pitch;
5705
- #university;
5706
- #retail;
5707
- #playground;
5708
- #commercial;
5709
- #military;
5710
- #school;
5711
- #college;
5712
- #bus_station;
5713
- #kindergarten;
5714
- #theme_park;
5715
- #hospital;
5716
- #railway;
5717
- #parking;
5718
- #recreation_ground;
5719
- #cemetery;
5720
- #library;
5721
- #track;
5722
- #stadium;
5723
- #quarter;
5724
- #zoo;
5725
- #attraction;
5726
- #religious;
5727
- #quarry;
5728
- #nature_reserve;
5729
- #protected_area;
5730
- #landUseMap;
5731
5853
  constructor() {
5854
+ __privateAdd(this, _LandUseLayer_instances);
5855
+ /** @type {boolean} */
5856
+ __privateAdd(this, _isVisible5, true);
5857
+ /** @type {LandUseType} */
5858
+ __privateAdd(this, _farmland);
5859
+ /** @type {LandUseType} */
5860
+ __privateAdd(this, _suburb);
5861
+ /** @type {LandUseType} */
5862
+ __privateAdd(this, _residential);
5863
+ /** @type {LandUseType} */
5864
+ __privateAdd(this, _industrial);
5865
+ /** @type {LandUseType} */
5866
+ __privateAdd(this, _pitch);
5867
+ /** @type {LandUseType} */
5868
+ __privateAdd(this, _university);
5869
+ /** @type {LandUseType} */
5870
+ __privateAdd(this, _retail);
5871
+ /** @type {LandUseType} */
5872
+ __privateAdd(this, _playground);
5873
+ /** @type {LandUseType} */
5874
+ __privateAdd(this, _commercial);
5875
+ /** @type {LandUseType} */
5876
+ __privateAdd(this, _military);
5877
+ /** @type {LandUseType} */
5878
+ __privateAdd(this, _school);
5879
+ /** @type {LandUseType} */
5880
+ __privateAdd(this, _college);
5881
+ /** @type {LandUseType} */
5882
+ __privateAdd(this, _bus_station);
5883
+ /** @type {LandUseType} */
5884
+ __privateAdd(this, _kindergarten);
5885
+ /** @type {LandUseType} */
5886
+ __privateAdd(this, _theme_park);
5887
+ /** @type {LandUseType} */
5888
+ __privateAdd(this, _hospital);
5889
+ /** @type {LandUseType} */
5890
+ __privateAdd(this, _railway);
5891
+ /** @type {LandUseType} */
5892
+ __privateAdd(this, _parking);
5893
+ /** @type {LandUseType} */
5894
+ __privateAdd(this, _recreation_ground);
5895
+ /** @type {LandUseType} */
5896
+ __privateAdd(this, _cemetery);
5897
+ /** @type {LandUseType} */
5898
+ __privateAdd(this, _library);
5899
+ /** @type {LandUseType} */
5900
+ __privateAdd(this, _track);
5901
+ /** @type {LandUseType} */
5902
+ __privateAdd(this, _stadium);
5903
+ /** @type {LandUseType} */
5904
+ __privateAdd(this, _quarter);
5905
+ /** @type {LandUseType} */
5906
+ __privateAdd(this, _zoo);
5907
+ /** @type {LandUseType} */
5908
+ __privateAdd(this, _attraction);
5909
+ /** @type {LandUseType} */
5910
+ __privateAdd(this, _religious);
5911
+ /** @type {LandUseType} */
5912
+ __privateAdd(this, _quarry);
5913
+ /** @type {LandUseType} */
5914
+ __privateAdd(this, _nature_reserve);
5915
+ /** @type {LandUseType} */
5916
+ __privateAdd(this, _protected_area);
5917
+ /** @type {Map<string, LandUseType>} */
5918
+ __privateAdd(this, _landUseMap);
5732
5919
  const mat = (color) => new THREE3.MeshBasicMaterial({
5733
5920
  color,
5734
5921
  transparent: false,
5735
5922
  side: THREE3.BackSide
5736
5923
  });
5737
- this.#farmland = new LandUseType(mat(16764057), 29e-5);
5738
- this.#suburb = new LandUseType(mat(16764057), 3e-4);
5739
- this.#residential = new LandUseType(mat(7007092), 31e-5);
5740
- this.#industrial = new LandUseType(mat(8421504), 32e-5);
5741
- this.#pitch = new LandUseType(mat(65280), 33e-5);
5742
- this.#university = new LandUseType(mat(255), 34e-5);
5743
- this.#retail = new LandUseType(mat(16737095), 35e-5);
5744
- this.#playground = new LandUseType(mat(16766720), 36e-5);
5745
- this.#commercial = new LandUseType(mat(16729344), 37e-5);
5746
- this.#military = new LandUseType(mat(6908265), 38e-5);
5747
- this.#school = new LandUseType(mat(11393254), 39e-5);
5748
- this.#college = new LandUseType(mat(6970061), 4e-4);
5749
- this.#bus_station = new LandUseType(mat(32896), 41e-5);
5750
- this.#kindergarten = new LandUseType(mat(16761035), 42e-5);
5751
- this.#theme_park = new LandUseType(mat(16738740), 43e-5);
5752
- this.#hospital = new LandUseType(mat(16711680), 44e-5);
5753
- this.#railway = new LandUseType(mat(11119017), 45e-5);
5754
- this.#parking = new LandUseType(mat(4620980), 46e-5);
5755
- this.#recreation_ground = new LandUseType(mat(10025880), 48e-5);
5756
- this.#cemetery = new LandUseType(mat(5597999), 49e-5);
5757
- this.#library = new LandUseType(mat(9055202), 5e-4);
5758
- this.#track = new LandUseType(mat(9127187), 51e-5);
5759
- this.#stadium = new LandUseType(mat(16747520), 52e-5);
5760
- this.#quarter = new LandUseType(mat(11674146), 53e-5);
5761
- this.#zoo = new LandUseType(mat(2263842), 54e-5);
5762
- this.#attraction = new LandUseType(mat(16753920), 55e-5);
5763
- this.#religious = new LandUseType(mat(4915330), 56e-5);
5764
- this.#quarry = new LandUseType(mat(1553925), 57e-5);
5765
- this.#nature_reserve = new LandUseType(mat(25600), 58e-5);
5766
- this.#protected_area = new LandUseType(mat(3329330), 59e-5);
5767
- this.#landUseMap = /* @__PURE__ */ new Map([
5768
- ["farmland", this.#farmland],
5769
- ["suburb", this.#suburb],
5770
- ["residential", this.#residential],
5771
- ["industrial", this.#industrial],
5772
- ["pitch", this.#pitch],
5773
- ["university", this.#university],
5774
- ["retail", this.#retail],
5775
- ["playground", this.#playground],
5776
- ["commercial", this.#commercial],
5777
- ["military", this.#military],
5778
- ["school", this.#school],
5779
- ["college", this.#college],
5780
- ["bus_station", this.#bus_station],
5781
- ["kindergarten", this.#kindergarten],
5782
- ["theme_park", this.#theme_park],
5783
- ["hospital", this.#hospital],
5784
- ["railway", this.#railway],
5785
- ["parking", this.#parking],
5786
- ["recreation_ground", this.#recreation_ground],
5787
- ["cemetery", this.#cemetery],
5788
- ["library", this.#library],
5789
- ["track", this.#track],
5790
- ["stadium", this.#stadium],
5791
- ["quarter", this.#quarter],
5792
- ["zoo", this.#zoo],
5793
- ["attraction", this.#attraction],
5794
- ["religious", this.#religious],
5795
- ["quarry", this.#quarry],
5796
- ["nature_reserve", this.#nature_reserve],
5797
- ["protected_area", this.#protected_area]
5798
- ]);
5924
+ __privateSet(this, _farmland, new LandUseType(mat(16764057), 29e-5));
5925
+ __privateSet(this, _suburb, new LandUseType(mat(16764057), 3e-4));
5926
+ __privateSet(this, _residential, new LandUseType(mat(7007092), 31e-5));
5927
+ __privateSet(this, _industrial, new LandUseType(mat(8421504), 32e-5));
5928
+ __privateSet(this, _pitch, new LandUseType(mat(65280), 33e-5));
5929
+ __privateSet(this, _university, new LandUseType(mat(255), 34e-5));
5930
+ __privateSet(this, _retail, new LandUseType(mat(16737095), 35e-5));
5931
+ __privateSet(this, _playground, new LandUseType(mat(16766720), 36e-5));
5932
+ __privateSet(this, _commercial, new LandUseType(mat(16729344), 37e-5));
5933
+ __privateSet(this, _military, new LandUseType(mat(6908265), 38e-5));
5934
+ __privateSet(this, _school, new LandUseType(mat(11393254), 39e-5));
5935
+ __privateSet(this, _college, new LandUseType(mat(6970061), 4e-4));
5936
+ __privateSet(this, _bus_station, new LandUseType(mat(32896), 41e-5));
5937
+ __privateSet(this, _kindergarten, new LandUseType(mat(16761035), 42e-5));
5938
+ __privateSet(this, _theme_park, new LandUseType(mat(16738740), 43e-5));
5939
+ __privateSet(this, _hospital, new LandUseType(mat(16711680), 44e-5));
5940
+ __privateSet(this, _railway, new LandUseType(mat(11119017), 45e-5));
5941
+ __privateSet(this, _parking, new LandUseType(mat(4620980), 46e-5));
5942
+ __privateSet(this, _recreation_ground, new LandUseType(mat(10025880), 48e-5));
5943
+ __privateSet(this, _cemetery, new LandUseType(mat(5597999), 49e-5));
5944
+ __privateSet(this, _library, new LandUseType(mat(9055202), 5e-4));
5945
+ __privateSet(this, _track, new LandUseType(mat(9127187), 51e-5));
5946
+ __privateSet(this, _stadium, new LandUseType(mat(16747520), 52e-5));
5947
+ __privateSet(this, _quarter, new LandUseType(mat(11674146), 53e-5));
5948
+ __privateSet(this, _zoo, new LandUseType(mat(2263842), 54e-5));
5949
+ __privateSet(this, _attraction, new LandUseType(mat(16753920), 55e-5));
5950
+ __privateSet(this, _religious, new LandUseType(mat(4915330), 56e-5));
5951
+ __privateSet(this, _quarry, new LandUseType(mat(1553925), 57e-5));
5952
+ __privateSet(this, _nature_reserve, new LandUseType(mat(25600), 58e-5));
5953
+ __privateSet(this, _protected_area, new LandUseType(mat(3329330), 59e-5));
5954
+ __privateSet(this, _landUseMap, /* @__PURE__ */ new Map([
5955
+ ["farmland", __privateGet(this, _farmland)],
5956
+ ["suburb", __privateGet(this, _suburb)],
5957
+ ["residential", __privateGet(this, _residential)],
5958
+ ["industrial", __privateGet(this, _industrial)],
5959
+ ["pitch", __privateGet(this, _pitch)],
5960
+ ["university", __privateGet(this, _university)],
5961
+ ["retail", __privateGet(this, _retail)],
5962
+ ["playground", __privateGet(this, _playground)],
5963
+ ["commercial", __privateGet(this, _commercial)],
5964
+ ["military", __privateGet(this, _military)],
5965
+ ["school", __privateGet(this, _school)],
5966
+ ["college", __privateGet(this, _college)],
5967
+ ["bus_station", __privateGet(this, _bus_station)],
5968
+ ["kindergarten", __privateGet(this, _kindergarten)],
5969
+ ["theme_park", __privateGet(this, _theme_park)],
5970
+ ["hospital", __privateGet(this, _hospital)],
5971
+ ["railway", __privateGet(this, _railway)],
5972
+ ["parking", __privateGet(this, _parking)],
5973
+ ["recreation_ground", __privateGet(this, _recreation_ground)],
5974
+ ["cemetery", __privateGet(this, _cemetery)],
5975
+ ["library", __privateGet(this, _library)],
5976
+ ["track", __privateGet(this, _track)],
5977
+ ["stadium", __privateGet(this, _stadium)],
5978
+ ["quarter", __privateGet(this, _quarter)],
5979
+ ["zoo", __privateGet(this, _zoo)],
5980
+ ["attraction", __privateGet(this, _attraction)],
5981
+ ["religious", __privateGet(this, _religious)],
5982
+ ["quarry", __privateGet(this, _quarry)],
5983
+ ["nature_reserve", __privateGet(this, _nature_reserve)],
5984
+ ["protected_area", __privateGet(this, _protected_area)]
5985
+ ]));
5799
5986
  }
5987
+ /**
5988
+ * Master visibility toggle. Setting this also propagates to all individual types.
5989
+ * @type {boolean}
5990
+ */
5800
5991
  get isVisible() {
5801
- return this.#isVisible;
5992
+ return __privateGet(this, _isVisible5);
5802
5993
  }
5803
5994
  set isVisible(v) {
5804
- this.#isVisible = !!v;
5805
- this.#allTypes().forEach((t) => t.setVisible(v));
5995
+ __privateSet(this, _isVisible5, !!v);
5996
+ __privateMethod(this, _LandUseLayer_instances, allTypes_fn2).call(this).forEach((t) => t.setVisible(v));
5806
5997
  }
5998
+ /** @type {LandUseType} */
5807
5999
  get farmland() {
5808
- return this.#farmland;
6000
+ return __privateGet(this, _farmland);
5809
6001
  }
6002
+ /** @type {LandUseType} */
5810
6003
  get suburb() {
5811
- return this.#suburb;
6004
+ return __privateGet(this, _suburb);
5812
6005
  }
6006
+ /** @type {LandUseType} */
5813
6007
  get residential() {
5814
- return this.#residential;
6008
+ return __privateGet(this, _residential);
5815
6009
  }
6010
+ /** @type {LandUseType} */
5816
6011
  get industrial() {
5817
- return this.#industrial;
6012
+ return __privateGet(this, _industrial);
5818
6013
  }
6014
+ /** @type {LandUseType} */
5819
6015
  get pitch() {
5820
- return this.#pitch;
6016
+ return __privateGet(this, _pitch);
5821
6017
  }
6018
+ /** @type {LandUseType} */
5822
6019
  get university() {
5823
- return this.#university;
6020
+ return __privateGet(this, _university);
5824
6021
  }
6022
+ /** @type {LandUseType} */
5825
6023
  get retail() {
5826
- return this.#retail;
6024
+ return __privateGet(this, _retail);
5827
6025
  }
6026
+ /** @type {LandUseType} */
5828
6027
  get playground() {
5829
- return this.#playground;
6028
+ return __privateGet(this, _playground);
5830
6029
  }
6030
+ /** @type {LandUseType} */
5831
6031
  get commercial() {
5832
- return this.#commercial;
6032
+ return __privateGet(this, _commercial);
5833
6033
  }
6034
+ /** @type {LandUseType} */
5834
6035
  get military() {
5835
- return this.#military;
6036
+ return __privateGet(this, _military);
5836
6037
  }
6038
+ /** @type {LandUseType} */
5837
6039
  get school() {
5838
- return this.#school;
6040
+ return __privateGet(this, _school);
5839
6041
  }
6042
+ /** @type {LandUseType} */
5840
6043
  get college() {
5841
- return this.#college;
6044
+ return __privateGet(this, _college);
5842
6045
  }
6046
+ /** @type {LandUseType} */
5843
6047
  get bus_station() {
5844
- return this.#bus_station;
6048
+ return __privateGet(this, _bus_station);
5845
6049
  }
6050
+ /** @type {LandUseType} */
5846
6051
  get kindergarten() {
5847
- return this.#kindergarten;
6052
+ return __privateGet(this, _kindergarten);
5848
6053
  }
6054
+ /** @type {LandUseType} */
5849
6055
  get theme_park() {
5850
- return this.#theme_park;
6056
+ return __privateGet(this, _theme_park);
5851
6057
  }
6058
+ /** @type {LandUseType} */
5852
6059
  get hospital() {
5853
- return this.#hospital;
6060
+ return __privateGet(this, _hospital);
5854
6061
  }
6062
+ /** @type {LandUseType} */
5855
6063
  get railway() {
5856
- return this.#railway;
6064
+ return __privateGet(this, _railway);
5857
6065
  }
6066
+ /** @type {LandUseType} */
5858
6067
  get parking() {
5859
- return this.#parking;
6068
+ return __privateGet(this, _parking);
5860
6069
  }
6070
+ /** @type {LandUseType} */
5861
6071
  get recreation_ground() {
5862
- return this.#recreation_ground;
6072
+ return __privateGet(this, _recreation_ground);
5863
6073
  }
6074
+ /** @type {LandUseType} */
5864
6075
  get cemetery() {
5865
- return this.#cemetery;
6076
+ return __privateGet(this, _cemetery);
5866
6077
  }
6078
+ /** @type {LandUseType} */
5867
6079
  get library() {
5868
- return this.#library;
6080
+ return __privateGet(this, _library);
5869
6081
  }
6082
+ /** @type {LandUseType} */
5870
6083
  get track() {
5871
- return this.#track;
6084
+ return __privateGet(this, _track);
5872
6085
  }
6086
+ /** @type {LandUseType} */
5873
6087
  get stadium() {
5874
- return this.#stadium;
6088
+ return __privateGet(this, _stadium);
5875
6089
  }
6090
+ /** @type {LandUseType} */
5876
6091
  get quarter() {
5877
- return this.#quarter;
6092
+ return __privateGet(this, _quarter);
5878
6093
  }
6094
+ /** @type {LandUseType} */
5879
6095
  get zoo() {
5880
- return this.#zoo;
6096
+ return __privateGet(this, _zoo);
5881
6097
  }
6098
+ /** @type {LandUseType} */
5882
6099
  get attraction() {
5883
- return this.#attraction;
6100
+ return __privateGet(this, _attraction);
5884
6101
  }
6102
+ /** @type {LandUseType} */
5885
6103
  get religious() {
5886
- return this.#religious;
6104
+ return __privateGet(this, _religious);
5887
6105
  }
6106
+ /** @type {LandUseType} */
5888
6107
  get quarry() {
5889
- return this.#quarry;
6108
+ return __privateGet(this, _quarry);
5890
6109
  }
6110
+ /** @type {LandUseType} */
5891
6111
  get nature_reserve() {
5892
- return this.#nature_reserve;
6112
+ return __privateGet(this, _nature_reserve);
5893
6113
  }
6114
+ /** @type {LandUseType} */
5894
6115
  get protected_area() {
5895
- return this.#protected_area;
6116
+ return __privateGet(this, _protected_area);
5896
6117
  }
6118
+ /**
6119
+ * Returns a land use type by its OSM class name.
6120
+ * @param {LandUseClassName} name - The OSM land use class name.
6121
+ * @returns {LandUseType|null} The matching type, or `null` if not found.
6122
+ */
5897
6123
  getTypeByName(name) {
5898
- return this.#landUseMap.get(name) ?? null;
6124
+ return __privateGet(this, _landUseMap).get(name) ?? null;
5899
6125
  }
6126
+ /**
6127
+ * Replaces the material on every land use type with a clone of the provided material.
6128
+ * @param {THREE.Material} material - A valid Three.js material.
6129
+ */
5900
6130
  setAllMaterials(material) {
5901
6131
  if (!(material instanceof THREE3.Material)) {
5902
6132
  console.warn("ThreeGeoPlay: Invalid material");
5903
6133
  return;
5904
6134
  }
5905
- this.#allTypes().forEach((t) => t.material = material.clone());
6135
+ __privateMethod(this, _LandUseLayer_instances, allTypes_fn2).call(this).forEach((t) => t.material = material.clone());
5906
6136
  }
6137
+ /**
6138
+ * Sets visibility on all individual land use types.
6139
+ * @param {boolean} v
6140
+ */
5907
6141
  setVisibleAll(v) {
5908
- this.#allTypes().forEach((t) => t.setVisible(v));
5909
- }
5910
- #allTypes() {
5911
- return Array.from(this.#landUseMap.values());
5912
- }
5913
- static admittedClasses = /* @__PURE__ */ new Set([
5914
- "farmland",
5915
- "suburb",
5916
- "residential",
5917
- "industrial",
5918
- "pitch",
5919
- "university",
5920
- "retail",
5921
- "playground",
5922
- "commercial",
5923
- "military",
5924
- "school",
5925
- "college",
5926
- "bus_station",
5927
- "kindergarten",
5928
- "theme_park",
5929
- "hospital",
5930
- "railway",
5931
- "parking",
5932
- "recreation_ground",
5933
- "cemetery",
5934
- "library",
5935
- "track",
5936
- "stadium",
5937
- "quarter",
5938
- "zoo",
5939
- "attraction",
5940
- "religious",
5941
- "quarry",
5942
- "nature_reserve",
5943
- "protected_area"
5944
- ]);
6142
+ __privateMethod(this, _LandUseLayer_instances, allTypes_fn2).call(this).forEach((t) => t.setVisible(v));
6143
+ }
6144
+ };
6145
+ _isVisible5 = new WeakMap();
6146
+ _farmland = new WeakMap();
6147
+ _suburb = new WeakMap();
6148
+ _residential = new WeakMap();
6149
+ _industrial = new WeakMap();
6150
+ _pitch = new WeakMap();
6151
+ _university = new WeakMap();
6152
+ _retail = new WeakMap();
6153
+ _playground = new WeakMap();
6154
+ _commercial = new WeakMap();
6155
+ _military = new WeakMap();
6156
+ _school = new WeakMap();
6157
+ _college = new WeakMap();
6158
+ _bus_station = new WeakMap();
6159
+ _kindergarten = new WeakMap();
6160
+ _theme_park = new WeakMap();
6161
+ _hospital = new WeakMap();
6162
+ _railway = new WeakMap();
6163
+ _parking = new WeakMap();
6164
+ _recreation_ground = new WeakMap();
6165
+ _cemetery = new WeakMap();
6166
+ _library = new WeakMap();
6167
+ _track = new WeakMap();
6168
+ _stadium = new WeakMap();
6169
+ _quarter = new WeakMap();
6170
+ _zoo = new WeakMap();
6171
+ _attraction = new WeakMap();
6172
+ _religious = new WeakMap();
6173
+ _quarry = new WeakMap();
6174
+ _nature_reserve = new WeakMap();
6175
+ _protected_area = new WeakMap();
6176
+ _landUseMap = new WeakMap();
6177
+ _LandUseLayer_instances = new WeakSet();
6178
+ /**
6179
+ * @returns {LandUseType[]}
6180
+ * @private
6181
+ */
6182
+ allTypes_fn2 = function() {
6183
+ return Array.from(__privateGet(this, _landUseMap).values());
5945
6184
  };
6185
+ /**
6186
+ * Set of all valid OSM land use class names accepted by this layer.
6187
+ * @type {Set<LandUseClassName>}
6188
+ */
6189
+ __publicField(LandUseLayer, "admittedClasses", /* @__PURE__ */ new Set([
6190
+ "farmland",
6191
+ "suburb",
6192
+ "residential",
6193
+ "industrial",
6194
+ "pitch",
6195
+ "university",
6196
+ "retail",
6197
+ "playground",
6198
+ "commercial",
6199
+ "military",
6200
+ "school",
6201
+ "college",
6202
+ "bus_station",
6203
+ "kindergarten",
6204
+ "theme_park",
6205
+ "hospital",
6206
+ "railway",
6207
+ "parking",
6208
+ "recreation_ground",
6209
+ "cemetery",
6210
+ "library",
6211
+ "track",
6212
+ "stadium",
6213
+ "quarter",
6214
+ "zoo",
6215
+ "attraction",
6216
+ "religious",
6217
+ "quarry",
6218
+ "nature_reserve",
6219
+ "protected_area"
6220
+ ]));
5946
6221
 
5947
6222
  // src/style/LandcoverLayer.js
5948
6223
  var THREE4 = __toESM(require("three"));
6224
+ var _isVisible6, _material4, _YOrder4;
5949
6225
  var LandCoverType = class {
5950
- #isVisible = true;
5951
- #material;
5952
- #YOrder;
6226
+ /**
6227
+ * @param {THREE.Material} material - Three.js material for this cover type.
6228
+ * @param {number} YOrder - Y-axis render order offset.
6229
+ */
5953
6230
  constructor(material, YOrder) {
5954
- this.#material = material;
5955
- this.#YOrder = YOrder;
6231
+ /** @type {boolean} */
6232
+ __privateAdd(this, _isVisible6, true);
6233
+ /** @type {THREE.Material} */
6234
+ __privateAdd(this, _material4);
6235
+ /** @type {number} */
6236
+ __privateAdd(this, _YOrder4);
6237
+ __privateSet(this, _material4, material);
6238
+ __privateSet(this, _YOrder4, YOrder);
5956
6239
  }
6240
+ /**
6241
+ * Whether this land cover type is rendered.
6242
+ * @type {boolean}
6243
+ */
5957
6244
  get isVisible() {
5958
- return this.#isVisible;
6245
+ return __privateGet(this, _isVisible6);
5959
6246
  }
5960
6247
  set isVisible(v) {
5961
- this.#isVisible = !!v;
6248
+ __privateSet(this, _isVisible6, !!v);
5962
6249
  }
6250
+ /**
6251
+ * Sets visibility (alias for the `isVisible` setter).
6252
+ * @param {boolean} v
6253
+ */
5963
6254
  setVisible(v) {
5964
- this.#isVisible = !!v;
6255
+ __privateSet(this, _isVisible6, !!v);
5965
6256
  }
6257
+ /**
6258
+ * The Three.js material used to render this land cover type.
6259
+ * Must be a {@link THREE.Material} instance.
6260
+ * @type {THREE.Material}
6261
+ */
5966
6262
  get material() {
5967
- return this.#material;
6263
+ return __privateGet(this, _material4);
5968
6264
  }
5969
6265
  set material(m) {
5970
6266
  if (m && !(m instanceof THREE4.Material)) {
5971
6267
  console.warn("ThreeGeoPlay: material must be a THREE.Material instance");
5972
6268
  return;
5973
6269
  }
5974
- this.#material = m;
6270
+ __privateSet(this, _material4, m);
5975
6271
  }
6272
+ /**
6273
+ * Y-axis render order offset for depth sorting.
6274
+ * @type {number}
6275
+ */
5976
6276
  get YOrder() {
5977
- return this.#YOrder;
6277
+ return __privateGet(this, _YOrder4);
5978
6278
  }
5979
6279
  set YOrder(v) {
5980
- this.#YOrder = v;
6280
+ __privateSet(this, _YOrder4, v);
5981
6281
  }
5982
6282
  };
6283
+ _isVisible6 = new WeakMap();
6284
+ _material4 = new WeakMap();
6285
+ _YOrder4 = new WeakMap();
6286
+ var _isVisible7, _sand, _park, _grass, _wood, _wetland, _rock, _farmland2, _landCoverMap, _LandCoverLayer_instances, allTypes_fn3;
5983
6287
  var LandCoverLayer = class {
5984
- #isVisible = true;
5985
- #sand;
5986
- #park;
5987
- #grass;
5988
- #wood;
5989
- #wetland;
5990
- #rock;
5991
- #farmland;
5992
- #landCoverMap;
5993
6288
  constructor() {
6289
+ __privateAdd(this, _LandCoverLayer_instances);
6290
+ /** @type {boolean} */
6291
+ __privateAdd(this, _isVisible7, true);
6292
+ /** @type {LandCoverType} */
6293
+ __privateAdd(this, _sand);
6294
+ /** @type {LandCoverType} */
6295
+ __privateAdd(this, _park);
6296
+ /** @type {LandCoverType} */
6297
+ __privateAdd(this, _grass);
6298
+ /** @type {LandCoverType} */
6299
+ __privateAdd(this, _wood);
6300
+ /** @type {LandCoverType} */
6301
+ __privateAdd(this, _wetland);
6302
+ /** @type {LandCoverType} */
6303
+ __privateAdd(this, _rock);
6304
+ /** @type {LandCoverType} */
6305
+ __privateAdd(this, _farmland2);
6306
+ /** @type {Map<string, LandCoverType>} */
6307
+ __privateAdd(this, _landCoverMap);
5994
6308
  const mat = (color) => new THREE4.MeshBasicMaterial({
5995
6309
  color,
5996
6310
  transparent: false,
5997
6311
  opacity: 0.9,
5998
6312
  side: THREE4.BackSide
5999
6313
  });
6000
- this.#sand = new LandCoverType(mat(16115033), 21e-5);
6001
- this.#park = new LandCoverType(mat(1088512), 22e-5);
6002
- this.#grass = new LandCoverType(mat(1553925), 23e-5);
6003
- this.#wood = new LandCoverType(mat(1553925), 24e-5);
6004
- this.#wetland = new LandCoverType(mat(1553925), 25e-5);
6005
- this.#rock = new LandCoverType(mat(1553925), 26e-5);
6006
- this.#farmland = new LandCoverType(mat(16764057), 27e-5);
6007
- this.#landCoverMap = /* @__PURE__ */ new Map([
6008
- ["sand", this.#sand],
6009
- ["park", this.#park],
6010
- ["grass", this.#grass],
6011
- ["wood", this.#wood],
6012
- ["wetland", this.#wetland],
6013
- ["rock", this.#rock],
6014
- ["farmland", this.#farmland]
6015
- ]);
6314
+ __privateSet(this, _sand, new LandCoverType(mat(16115033), 21e-5));
6315
+ __privateSet(this, _park, new LandCoverType(mat(1088512), 22e-5));
6316
+ __privateSet(this, _grass, new LandCoverType(mat(1553925), 23e-5));
6317
+ __privateSet(this, _wood, new LandCoverType(mat(1553925), 24e-5));
6318
+ __privateSet(this, _wetland, new LandCoverType(mat(1553925), 25e-5));
6319
+ __privateSet(this, _rock, new LandCoverType(mat(1553925), 26e-5));
6320
+ __privateSet(this, _farmland2, new LandCoverType(mat(16764057), 27e-5));
6321
+ __privateSet(this, _landCoverMap, /* @__PURE__ */ new Map([
6322
+ ["sand", __privateGet(this, _sand)],
6323
+ ["park", __privateGet(this, _park)],
6324
+ ["grass", __privateGet(this, _grass)],
6325
+ ["wood", __privateGet(this, _wood)],
6326
+ ["wetland", __privateGet(this, _wetland)],
6327
+ ["rock", __privateGet(this, _rock)],
6328
+ ["farmland", __privateGet(this, _farmland2)]
6329
+ ]));
6016
6330
  }
6331
+ /**
6332
+ * Master visibility toggle for the entire land cover layer.
6333
+ * Setting this also propagates to all individual cover types.
6334
+ * @type {boolean}
6335
+ */
6017
6336
  get isVisible() {
6018
- return this.#isVisible;
6337
+ return __privateGet(this, _isVisible7);
6019
6338
  }
6020
6339
  set isVisible(v) {
6021
- this.#isVisible = !!v;
6022
- this.#allTypes().forEach((t) => t.setVisible(v));
6340
+ __privateSet(this, _isVisible7, !!v);
6341
+ __privateMethod(this, _LandCoverLayer_instances, allTypes_fn3).call(this).forEach((t) => t.setVisible(v));
6023
6342
  }
6343
+ /** @type {LandCoverType} */
6024
6344
  get sand() {
6025
- return this.#sand;
6345
+ return __privateGet(this, _sand);
6026
6346
  }
6347
+ /** @type {LandCoverType} */
6027
6348
  get park() {
6028
- return this.#park;
6349
+ return __privateGet(this, _park);
6029
6350
  }
6351
+ /** @type {LandCoverType} */
6030
6352
  get grass() {
6031
- return this.#grass;
6353
+ return __privateGet(this, _grass);
6032
6354
  }
6355
+ /** @type {LandCoverType} */
6033
6356
  get wood() {
6034
- return this.#wood;
6357
+ return __privateGet(this, _wood);
6035
6358
  }
6359
+ /** @type {LandCoverType} */
6036
6360
  get wetland() {
6037
- return this.#wetland;
6361
+ return __privateGet(this, _wetland);
6038
6362
  }
6363
+ /** @type {LandCoverType} */
6039
6364
  get rock() {
6040
- return this.#rock;
6365
+ return __privateGet(this, _rock);
6041
6366
  }
6367
+ /** @type {LandCoverType} */
6042
6368
  get farmland() {
6043
- return this.#farmland;
6369
+ return __privateGet(this, _farmland2);
6044
6370
  }
6371
+ /**
6372
+ * Returns a land cover type by its OSM class name.
6373
+ * @param {'sand'|'park'|'grass'|'wood'|'wetland'|'rock'|'farmland'} name - The land cover class name.
6374
+ * @returns {LandCoverType|null} The matching type, or `null` if not found.
6375
+ */
6045
6376
  getTypeByName(name) {
6046
- return this.#landCoverMap.get(name) ?? null;
6377
+ return __privateGet(this, _landCoverMap).get(name) ?? null;
6047
6378
  }
6379
+ /**
6380
+ * Replaces the material on every land cover type with a clone of the provided material.
6381
+ * @param {THREE.Material} material - A valid Three.js material to apply to all types.
6382
+ */
6048
6383
  setAllMaterials(material) {
6049
6384
  if (!(material instanceof THREE4.Material)) {
6050
6385
  console.warn("ThreeGeoPlay: Invalid material, must be a THREE.Material");
6051
6386
  return;
6052
6387
  }
6053
- this.#allTypes().forEach((t) => {
6388
+ __privateMethod(this, _LandCoverLayer_instances, allTypes_fn3).call(this).forEach((t) => {
6054
6389
  t.material = material.clone();
6055
6390
  });
6056
6391
  }
6392
+ /**
6393
+ * Sets visibility on all individual land cover types.
6394
+ * @param {boolean} isVisible
6395
+ */
6057
6396
  setVisibleAll(isVisible) {
6058
- this.#allTypes().forEach((t) => t.setVisible(isVisible));
6059
- }
6060
- #allTypes() {
6061
- return [
6062
- this.#sand,
6063
- this.#park,
6064
- this.#grass,
6065
- this.#wood,
6066
- this.#wetland,
6067
- this.#rock,
6068
- this.#farmland
6069
- ];
6397
+ __privateMethod(this, _LandCoverLayer_instances, allTypes_fn3).call(this).forEach((t) => t.setVisible(isVisible));
6070
6398
  }
6071
6399
  };
6400
+ _isVisible7 = new WeakMap();
6401
+ _sand = new WeakMap();
6402
+ _park = new WeakMap();
6403
+ _grass = new WeakMap();
6404
+ _wood = new WeakMap();
6405
+ _wetland = new WeakMap();
6406
+ _rock = new WeakMap();
6407
+ _farmland2 = new WeakMap();
6408
+ _landCoverMap = new WeakMap();
6409
+ _LandCoverLayer_instances = new WeakSet();
6410
+ /**
6411
+ * @returns {LandCoverType[]}
6412
+ * @private
6413
+ */
6414
+ allTypes_fn3 = function() {
6415
+ return [
6416
+ __privateGet(this, _sand),
6417
+ __privateGet(this, _park),
6418
+ __privateGet(this, _grass),
6419
+ __privateGet(this, _wood),
6420
+ __privateGet(this, _wetland),
6421
+ __privateGet(this, _rock),
6422
+ __privateGet(this, _farmland2)
6423
+ ];
6424
+ };
6072
6425
 
6073
6426
  // src/style/TransportationLayer.js
6074
6427
  var THREE5 = __toESM(require("three"));
6075
6428
  function makeRoadMaterial(color) {
6076
- return new THREE5.MeshBasicMaterial({
6077
- color,
6078
- side: THREE5.BackSide,
6079
- wireframe: false
6080
- });
6429
+ return new THREE5.MeshBasicMaterial({ color, side: THREE5.BackSide, wireframe: false });
6081
6430
  }
6082
6431
  function makeOutlineMaterial(color) {
6083
- return new THREE5.MeshBasicMaterial({
6084
- color,
6085
- side: THREE5.BackSide
6086
- });
6432
+ return new THREE5.MeshBasicMaterial({ color, side: THREE5.BackSide });
6087
6433
  }
6434
+ var _isVisible8, _outlineWidth, _material5, _outlineMaterial, _YOrder5, _lineWidth;
6088
6435
  var RoadType = class {
6089
- #isVisible = false;
6090
- #outlineWidth = null;
6091
- #material = null;
6092
- #outlineMaterial = null;
6093
- #YOrder = 0;
6094
- #lineWidth = 0;
6436
+ /**
6437
+ * @param {THREE.Material} material - Fill material.
6438
+ * @param {THREE.Material} outlineMaterial - Outline material.
6439
+ * @param {number} YOrder - Y-axis render order offset.
6440
+ * @param {number} lineWidth - Half-width of the rendered road in world units.
6441
+ * @param {boolean} isVisible - Initial visibility.
6442
+ */
6095
6443
  constructor(material, outlineMaterial, YOrder, lineWidth, isVisible) {
6096
- this.#material = material;
6097
- this.#outlineMaterial = outlineMaterial;
6098
- this.#YOrder = YOrder;
6099
- this.#lineWidth = lineWidth;
6444
+ /** @type {boolean} */
6445
+ __privateAdd(this, _isVisible8, false);
6446
+ /** @type {number|null} */
6447
+ __privateAdd(this, _outlineWidth, null);
6448
+ /** @type {THREE.Material} */
6449
+ __privateAdd(this, _material5, null);
6450
+ /** @type {THREE.Material} */
6451
+ __privateAdd(this, _outlineMaterial, null);
6452
+ /** @type {number} */
6453
+ __privateAdd(this, _YOrder5, 0);
6454
+ /** @type {number} */
6455
+ __privateAdd(this, _lineWidth, 0);
6456
+ __privateSet(this, _material5, material);
6457
+ __privateSet(this, _outlineMaterial, outlineMaterial);
6458
+ __privateSet(this, _YOrder5, YOrder);
6459
+ __privateSet(this, _lineWidth, lineWidth);
6100
6460
  this.isVisible = isVisible;
6101
6461
  }
6462
+ /**
6463
+ * Whether this road type is rendered.
6464
+ * @type {boolean}
6465
+ */
6102
6466
  get isVisible() {
6103
- return this.#isVisible;
6467
+ return __privateGet(this, _isVisible8);
6104
6468
  }
6105
6469
  set isVisible(v) {
6106
- this.#isVisible = !!v;
6470
+ __privateSet(this, _isVisible8, !!v);
6107
6471
  }
6472
+ /**
6473
+ * Sets visibility (alias for the `isVisible` setter).
6474
+ * @param {boolean} v
6475
+ */
6108
6476
  setVisible(v) {
6109
- this.#isVisible = !!v;
6477
+ __privateSet(this, _isVisible8, !!v);
6110
6478
  }
6479
+ /**
6480
+ * The Three.js fill material for this road type.
6481
+ * Must be a {@link THREE.Material} instance.
6482
+ * @type {THREE.Material}
6483
+ */
6111
6484
  get material() {
6112
- return this.#material;
6485
+ return __privateGet(this, _material5);
6113
6486
  }
6114
6487
  set material(m) {
6115
6488
  if (m && !(m instanceof THREE5.Material)) {
6116
6489
  console.warn("ThreeGeoPlay: material must be a THREE.Material instance");
6117
6490
  return;
6118
6491
  }
6119
- this.#material = m;
6492
+ __privateSet(this, _material5, m);
6120
6493
  }
6494
+ /**
6495
+ * The Three.js outline material for this road type.
6496
+ * Must be a {@link THREE.Material} instance.
6497
+ * @type {THREE.Material}
6498
+ */
6121
6499
  get outlineMaterial() {
6122
- return this.#outlineMaterial;
6500
+ return __privateGet(this, _outlineMaterial);
6123
6501
  }
6124
6502
  set outlineMaterial(m) {
6125
6503
  if (m && !(m instanceof THREE5.Material)) {
6126
6504
  console.warn("ThreeGeoPlay: outlineMaterial must be a THREE.Material instance");
6127
6505
  return;
6128
6506
  }
6129
- this.#outlineMaterial = m;
6507
+ __privateSet(this, _outlineMaterial, m);
6130
6508
  }
6509
+ /**
6510
+ * Y-axis render order offset for depth sorting.
6511
+ * @type {number}
6512
+ */
6131
6513
  get YOrder() {
6132
- return this.#YOrder;
6514
+ return __privateGet(this, _YOrder5);
6133
6515
  }
6134
6516
  set YOrder(v) {
6135
6517
  if (typeof v !== "number" || isNaN(v)) {
6136
6518
  console.warn(`ThreeGeoPlay: YOrder must be a number (received: ${v})`);
6137
6519
  return;
6138
6520
  }
6139
- this.#YOrder = v;
6521
+ __privateSet(this, _YOrder5, v);
6140
6522
  }
6523
+ /**
6524
+ * Half-width of the rendered road geometry in world units. Must be ≥ 0.
6525
+ * @type {number}
6526
+ */
6141
6527
  get lineWidth() {
6142
- return this.#lineWidth;
6528
+ return __privateGet(this, _lineWidth);
6143
6529
  }
6144
6530
  set lineWidth(v) {
6145
6531
  if (typeof v !== "number" || isNaN(v) || v < 0) {
6146
6532
  console.warn(`ThreeGeoPlay: lineWidth must be a non-negative number (received: ${v})`);
6147
6533
  return;
6148
6534
  }
6149
- this.#lineWidth = v;
6535
+ __privateSet(this, _lineWidth, v);
6150
6536
  }
6537
+ /**
6538
+ * Per-type outline width override in world units.
6539
+ * Set to `null` to fall back to {@link GeneralConfig.outlineWidth}.
6540
+ * @type {number|null}
6541
+ */
6151
6542
  get outlineWidth() {
6152
- return this.#outlineWidth;
6543
+ return __privateGet(this, _outlineWidth);
6153
6544
  }
6154
6545
  set outlineWidth(num) {
6155
6546
  if (num !== null && (typeof num !== "number" || isNaN(num))) {
@@ -6158,20 +6549,38 @@ var RoadType = class {
6158
6549
  }
6159
6550
  if (num !== null && num < 0) {
6160
6551
  console.warn(`ThreeGeoPlay: outlineWidth cannot be negative (received: ${num}), defaulting to 0`);
6161
- this.#outlineWidth = 0;
6552
+ __privateSet(this, _outlineWidth, 0);
6162
6553
  return;
6163
6554
  }
6164
- this.#outlineWidth = num;
6555
+ __privateSet(this, _outlineWidth, num);
6165
6556
  }
6557
+ /**
6558
+ * Clears the per-type outline width override, falling back to {@link GeneralConfig.outlineWidth}.
6559
+ */
6166
6560
  resetOutlineWidth() {
6167
- this.#outlineWidth = null;
6561
+ __privateSet(this, _outlineWidth, null);
6168
6562
  }
6169
6563
  };
6564
+ _isVisible8 = new WeakMap();
6565
+ _outlineWidth = new WeakMap();
6566
+ _material5 = new WeakMap();
6567
+ _outlineMaterial = new WeakMap();
6568
+ _YOrder5 = new WeakMap();
6569
+ _lineWidth = new WeakMap();
6570
+ var _jointSegments, _outlineWidth2;
6170
6571
  var GeneralConfig = class {
6171
- #jointSegments = 8;
6172
- #outlineWidth = 0.075;
6572
+ constructor() {
6573
+ /** @type {number} */
6574
+ __privateAdd(this, _jointSegments, 8);
6575
+ /** @type {number} */
6576
+ __privateAdd(this, _outlineWidth2, 0.075);
6577
+ }
6578
+ /**
6579
+ * Number of segments used to round road joints. Minimum is 6.
6580
+ * @type {number}
6581
+ */
6173
6582
  get jointSegments() {
6174
- return this.#jointSegments;
6583
+ return __privateGet(this, _jointSegments);
6175
6584
  }
6176
6585
  set jointSegments(num) {
6177
6586
  if (typeof num !== "number" || isNaN(num)) {
@@ -6180,13 +6589,18 @@ var GeneralConfig = class {
6180
6589
  }
6181
6590
  if (num < 6) {
6182
6591
  console.warn(`ThreeGeoPlay: jointSegments cannot be less than 6 (received: ${num}), defaulting to 6`);
6183
- this.#jointSegments = 6;
6592
+ __privateSet(this, _jointSegments, 6);
6184
6593
  return;
6185
6594
  }
6186
- this.#jointSegments = num;
6595
+ __privateSet(this, _jointSegments, num);
6187
6596
  }
6597
+ /**
6598
+ * Default outline width in world units applied to all road types that have not set their own.
6599
+ * Must be ≥ 0.
6600
+ * @type {number}
6601
+ */
6188
6602
  get outlineWidth() {
6189
- return this.#outlineWidth;
6603
+ return __privateGet(this, _outlineWidth2);
6190
6604
  }
6191
6605
  set outlineWidth(num) {
6192
6606
  if (typeof num !== "number" || isNaN(num)) {
@@ -6195,208 +6609,321 @@ var GeneralConfig = class {
6195
6609
  }
6196
6610
  if (num < 0) {
6197
6611
  console.warn(`ThreeGeoPlay: outlineWidth cannot be negative (received: ${num}), defaulting to 0`);
6198
- this.#outlineWidth = 0;
6612
+ __privateSet(this, _outlineWidth2, 0);
6199
6613
  return;
6200
6614
  }
6201
- this.#outlineWidth = num;
6615
+ __privateSet(this, _outlineWidth2, num);
6202
6616
  }
6203
6617
  };
6618
+ _jointSegments = new WeakMap();
6619
+ _outlineWidth2 = new WeakMap();
6620
+ var _isVisible9, _generalConfig, _primary, _secondary, _tertiary, _minor, _service, _pedestrian, _path, _minor_construction, _rail, _transit, _track2, _trunk, _pier, _primary_construction, _ferry, _secondary_construction, _path_construction, _motorway, _trunk_construction, _service_construction, _TransportationLayer_instances, allRoadTypes_fn, roadTypeMap_fn;
6204
6621
  var TransportationLayer = class {
6205
- #isVisible = true;
6206
- #generalConfig = new GeneralConfig();
6207
- #primary;
6208
- #secondary;
6209
- #tertiary;
6210
- #minor;
6211
- #service;
6212
- #pedestrian;
6213
- #path;
6214
- #minor_construction;
6215
- #rail;
6216
- #transit;
6217
- #track;
6218
- #trunk;
6219
- #pier;
6220
- #primary_construction;
6221
- #ferry;
6222
- #secondary_construction;
6223
- #path_construction;
6224
- #motorway;
6225
- #trunk_construction;
6226
- #service_construction;
6227
6622
  constructor() {
6623
+ __privateAdd(this, _TransportationLayer_instances);
6624
+ /** @type {boolean} */
6625
+ __privateAdd(this, _isVisible9, true);
6626
+ /** @type {GeneralConfig} */
6627
+ __privateAdd(this, _generalConfig, new GeneralConfig());
6628
+ /** @type {RoadType} */
6629
+ __privateAdd(this, _primary);
6630
+ /** @type {RoadType} */
6631
+ __privateAdd(this, _secondary);
6632
+ /** @type {RoadType} */
6633
+ __privateAdd(this, _tertiary);
6634
+ /** @type {RoadType} */
6635
+ __privateAdd(this, _minor);
6636
+ /** @type {RoadType} */
6637
+ __privateAdd(this, _service);
6638
+ /** @type {RoadType} */
6639
+ __privateAdd(this, _pedestrian);
6640
+ /** @type {RoadType} */
6641
+ __privateAdd(this, _path);
6642
+ /** @type {RoadType} */
6643
+ __privateAdd(this, _minor_construction);
6644
+ /** @type {RoadType} */
6645
+ __privateAdd(this, _rail);
6646
+ /** @type {RoadType} */
6647
+ __privateAdd(this, _transit);
6648
+ /** @type {RoadType} */
6649
+ __privateAdd(this, _track2);
6650
+ /** @type {RoadType} */
6651
+ __privateAdd(this, _trunk);
6652
+ /** @type {RoadType} */
6653
+ __privateAdd(this, _pier);
6654
+ /** @type {RoadType} */
6655
+ __privateAdd(this, _primary_construction);
6656
+ /** @type {RoadType} */
6657
+ __privateAdd(this, _ferry);
6658
+ /** @type {RoadType} */
6659
+ __privateAdd(this, _secondary_construction);
6660
+ /** @type {RoadType} */
6661
+ __privateAdd(this, _path_construction);
6662
+ /** @type {RoadType} */
6663
+ __privateAdd(this, _motorway);
6664
+ /** @type {RoadType} */
6665
+ __privateAdd(this, _trunk_construction);
6666
+ /** @type {RoadType} */
6667
+ __privateAdd(this, _service_construction);
6228
6668
  const delta = 0.25;
6229
6669
  const roadMat = makeRoadMaterial(16711680);
6230
6670
  const outlineMat = makeOutlineMaterial(16776960);
6231
- this.#motorway = new RoadType(roadMat, outlineMat, 25e-4, 0.55 * delta, true);
6232
- this.#trunk = new RoadType(roadMat, outlineMat, 24e-4, 0.5 * delta, false);
6233
- this.#trunk_construction = new RoadType(roadMat, outlineMat, 23e-4, 0.48 * delta, false);
6234
- this.#primary = new RoadType(roadMat, outlineMat, 22e-4, 0.45 * delta, true);
6235
- this.#primary_construction = new RoadType(roadMat, outlineMat, 21e-4, 0.43 * delta, false);
6236
- this.#secondary = new RoadType(roadMat, outlineMat, 2e-3, 0.38 * delta, true);
6237
- this.#secondary_construction = new RoadType(roadMat, outlineMat, 19e-4, 0.36 * delta, false);
6238
- this.#tertiary = new RoadType(roadMat, outlineMat, 18e-4, 0.3 * delta, true);
6239
- this.#minor = new RoadType(roadMat, outlineMat, 17e-4, 0.22 * delta, true);
6240
- this.#minor_construction = new RoadType(roadMat, outlineMat, 16e-4, 0.2 * delta, false);
6241
- this.#service = new RoadType(roadMat, outlineMat, 15e-4, 0.16 * delta, true);
6242
- this.#service_construction = new RoadType(roadMat, outlineMat, 14e-4, 0.15 * delta, false);
6243
- this.#rail = new RoadType(roadMat, outlineMat, 13e-4, 0.18 * delta, false);
6244
- this.#transit = new RoadType(roadMat, outlineMat, 13e-4, 0.2 * delta, false);
6245
- this.#pedestrian = new RoadType(roadMat, outlineMat, 12e-4, 0.12 * delta, false);
6246
- this.#path = new RoadType(roadMat, outlineMat, 11e-4, 0.08 * delta, true);
6247
- this.#path_construction = new RoadType(roadMat, outlineMat, 11e-4, 0.08 * delta, false);
6248
- this.#track = new RoadType(roadMat, outlineMat, 1e-3, 0.1 * delta, false);
6249
- this.#pier = new RoadType(roadMat, outlineMat, 9e-4, 0.2, false);
6250
- this.#ferry = new RoadType(roadMat, outlineMat, 8e-4, 0.25, false);
6671
+ __privateSet(this, _motorway, new RoadType(roadMat, outlineMat, 25e-4, 0.55 * delta, true));
6672
+ __privateSet(this, _trunk, new RoadType(roadMat, outlineMat, 24e-4, 0.5 * delta, false));
6673
+ __privateSet(this, _trunk_construction, new RoadType(roadMat, outlineMat, 23e-4, 0.48 * delta, false));
6674
+ __privateSet(this, _primary, new RoadType(roadMat, outlineMat, 22e-4, 0.45 * delta, true));
6675
+ __privateSet(this, _primary_construction, new RoadType(roadMat, outlineMat, 21e-4, 0.43 * delta, false));
6676
+ __privateSet(this, _secondary, new RoadType(roadMat, outlineMat, 2e-3, 0.38 * delta, true));
6677
+ __privateSet(this, _secondary_construction, new RoadType(roadMat, outlineMat, 19e-4, 0.36 * delta, false));
6678
+ __privateSet(this, _tertiary, new RoadType(roadMat, outlineMat, 18e-4, 0.3 * delta, true));
6679
+ __privateSet(this, _minor, new RoadType(roadMat, outlineMat, 17e-4, 0.22 * delta, true));
6680
+ __privateSet(this, _minor_construction, new RoadType(roadMat, outlineMat, 16e-4, 0.2 * delta, false));
6681
+ __privateSet(this, _service, new RoadType(roadMat, outlineMat, 15e-4, 0.16 * delta, true));
6682
+ __privateSet(this, _service_construction, new RoadType(roadMat, outlineMat, 14e-4, 0.15 * delta, false));
6683
+ __privateSet(this, _rail, new RoadType(roadMat, outlineMat, 13e-4, 0.18 * delta, false));
6684
+ __privateSet(this, _transit, new RoadType(roadMat, outlineMat, 13e-4, 0.2 * delta, false));
6685
+ __privateSet(this, _pedestrian, new RoadType(roadMat, outlineMat, 12e-4, 0.12 * delta, false));
6686
+ __privateSet(this, _path, new RoadType(roadMat, outlineMat, 11e-4, 0.08 * delta, true));
6687
+ __privateSet(this, _path_construction, new RoadType(roadMat, outlineMat, 11e-4, 0.08 * delta, false));
6688
+ __privateSet(this, _track2, new RoadType(roadMat, outlineMat, 1e-3, 0.1 * delta, false));
6689
+ __privateSet(this, _pier, new RoadType(roadMat, outlineMat, 9e-4, 0.2, false));
6690
+ __privateSet(this, _ferry, new RoadType(roadMat, outlineMat, 8e-4, 0.25, false));
6251
6691
  }
6692
+ /**
6693
+ * Master visibility toggle for the entire transportation layer.
6694
+ * @type {boolean}
6695
+ */
6252
6696
  get isVisible() {
6253
- return this.#isVisible;
6697
+ return __privateGet(this, _isVisible9);
6254
6698
  }
6699
+ /**
6700
+ * Shared configuration defaults (joint segments, global outline width).
6701
+ * @type {GeneralConfig}
6702
+ */
6255
6703
  get generalConfig() {
6256
- return this.#generalConfig;
6704
+ return __privateGet(this, _generalConfig);
6257
6705
  }
6706
+ /** @type {RoadType} */
6258
6707
  get motorway() {
6259
- return this.#motorway;
6708
+ return __privateGet(this, _motorway);
6260
6709
  }
6710
+ /** @type {RoadType} */
6261
6711
  get trunk() {
6262
- return this.#trunk;
6712
+ return __privateGet(this, _trunk);
6263
6713
  }
6714
+ /** @type {RoadType} */
6264
6715
  get trunk_construction() {
6265
- return this.#trunk_construction;
6716
+ return __privateGet(this, _trunk_construction);
6266
6717
  }
6718
+ /** @type {RoadType} */
6267
6719
  get primary() {
6268
- return this.#primary;
6720
+ return __privateGet(this, _primary);
6269
6721
  }
6722
+ /** @type {RoadType} */
6270
6723
  get primary_construction() {
6271
- return this.#primary_construction;
6724
+ return __privateGet(this, _primary_construction);
6272
6725
  }
6726
+ /** @type {RoadType} */
6273
6727
  get secondary() {
6274
- return this.#secondary;
6728
+ return __privateGet(this, _secondary);
6275
6729
  }
6730
+ /** @type {RoadType} */
6276
6731
  get secondary_construction() {
6277
- return this.#secondary_construction;
6732
+ return __privateGet(this, _secondary_construction);
6278
6733
  }
6734
+ /** @type {RoadType} */
6279
6735
  get tertiary() {
6280
- return this.#tertiary;
6736
+ return __privateGet(this, _tertiary);
6281
6737
  }
6738
+ /** @type {RoadType} */
6282
6739
  get minor() {
6283
- return this.#minor;
6740
+ return __privateGet(this, _minor);
6284
6741
  }
6742
+ /** @type {RoadType} */
6285
6743
  get minor_construction() {
6286
- return this.#minor_construction;
6744
+ return __privateGet(this, _minor_construction);
6287
6745
  }
6746
+ /** @type {RoadType} */
6288
6747
  get service() {
6289
- return this.#service;
6748
+ return __privateGet(this, _service);
6290
6749
  }
6750
+ /** @type {RoadType} */
6291
6751
  get service_construction() {
6292
- return this.#service_construction;
6752
+ return __privateGet(this, _service_construction);
6293
6753
  }
6754
+ /** @type {RoadType} */
6294
6755
  get rail() {
6295
- return this.#rail;
6756
+ return __privateGet(this, _rail);
6296
6757
  }
6758
+ /** @type {RoadType} */
6297
6759
  get transit() {
6298
- return this.#transit;
6760
+ return __privateGet(this, _transit);
6299
6761
  }
6762
+ /** @type {RoadType} */
6300
6763
  get pedestrian() {
6301
- return this.#pedestrian;
6764
+ return __privateGet(this, _pedestrian);
6302
6765
  }
6766
+ /** @type {RoadType} */
6303
6767
  get path() {
6304
- return this.#path;
6768
+ return __privateGet(this, _path);
6305
6769
  }
6770
+ /** @type {RoadType} */
6306
6771
  get path_construction() {
6307
- return this.#path_construction;
6772
+ return __privateGet(this, _path_construction);
6308
6773
  }
6774
+ /** @type {RoadType} */
6309
6775
  get track() {
6310
- return this.#track;
6776
+ return __privateGet(this, _track2);
6311
6777
  }
6778
+ /** @type {RoadType} */
6312
6779
  get pier() {
6313
- return this.#pier;
6780
+ return __privateGet(this, _pier);
6314
6781
  }
6782
+ /** @type {RoadType} */
6315
6783
  get ferry() {
6316
- return this.#ferry;
6784
+ return __privateGet(this, _ferry);
6317
6785
  }
6786
+ /**
6787
+ * Resolves the effective outline width for a road type:
6788
+ * returns the type's own `outlineWidth` if set, otherwise falls back to
6789
+ * {@link GeneralConfig.outlineWidth}.
6790
+ * @param {RoadType} roadType
6791
+ * @returns {number}
6792
+ */
6318
6793
  resolveOutlineWidth(roadType) {
6319
- return roadType.outlineWidth ?? this.#generalConfig.outlineWidth;
6794
+ return roadType.outlineWidth ?? __privateGet(this, _generalConfig).outlineWidth;
6320
6795
  }
6796
+ /**
6797
+ * Sets `outlineWidth` on every road type and on `generalConfig`.
6798
+ * @param {number} width
6799
+ */
6321
6800
  setOutlineWidthAll(width) {
6322
- for (const roadType of this.#allRoadTypes()) {
6801
+ for (const roadType of __privateMethod(this, _TransportationLayer_instances, allRoadTypes_fn).call(this)) {
6323
6802
  roadType.outlineWidth = width;
6324
6803
  }
6325
- this.#generalConfig.outlineWidth = width;
6804
+ __privateGet(this, _generalConfig).outlineWidth = width;
6326
6805
  }
6806
+ /**
6807
+ * Resets the per-type outline width on all road types (falls back to `generalConfig`).
6808
+ */
6327
6809
  resetOutlineWidthAll() {
6328
- for (const roadType of this.#allRoadTypes()) {
6810
+ for (const roadType of __privateMethod(this, _TransportationLayer_instances, allRoadTypes_fn).call(this)) {
6329
6811
  roadType.resetOutlineWidth();
6330
6812
  }
6331
6813
  }
6814
+ /**
6815
+ * Sets master layer visibility and propagates to all road types.
6816
+ * @param {boolean} isVisible
6817
+ */
6332
6818
  setVisible(isVisible) {
6333
- this.#isVisible = !!isVisible;
6334
- for (const roadType of this.#allRoadTypes()) {
6819
+ __privateSet(this, _isVisible9, !!isVisible);
6820
+ for (const roadType of __privateMethod(this, _TransportationLayer_instances, allRoadTypes_fn).call(this)) {
6335
6821
  roadType.setVisible(isVisible);
6336
6822
  }
6337
6823
  }
6824
+ /**
6825
+ * Replaces the material on every road type with a clone of the provided materials.
6826
+ * @param {THREE.Material} material - Fill material.
6827
+ * @param {THREE.Material} [outlineMaterial] - Optional outline material.
6828
+ */
6338
6829
  setAllMaterials(material, outlineMaterial) {
6339
6830
  if (material && !(material instanceof THREE5.Material)) {
6340
6831
  console.warn("ThreeGeoPlay: Invalid material");
6341
6832
  return;
6342
6833
  }
6343
- for (const roadType of this.#allRoadTypes()) {
6834
+ for (const roadType of __privateMethod(this, _TransportationLayer_instances, allRoadTypes_fn).call(this)) {
6344
6835
  if (material) roadType.material = material.clone();
6345
6836
  if (outlineMaterial) roadType.outlineMaterial = outlineMaterial.clone();
6346
6837
  }
6347
6838
  }
6839
+ /**
6840
+ * Returns a road type by its OSM class name.
6841
+ * @param {TransportClassName} name - The OSM transport class name.
6842
+ * @returns {RoadType|null} The matching type, or `null` if not found.
6843
+ */
6348
6844
  getTypeByName(name) {
6349
- return this.#roadTypeMap().get(name) ?? null;
6350
- }
6351
- #allRoadTypes() {
6352
- return [
6353
- this.#motorway,
6354
- this.#trunk,
6355
- this.#trunk_construction,
6356
- this.#primary,
6357
- this.#primary_construction,
6358
- this.#secondary,
6359
- this.#secondary_construction,
6360
- this.#tertiary,
6361
- this.#minor,
6362
- this.#minor_construction,
6363
- this.#service,
6364
- this.#service_construction,
6365
- this.#rail,
6366
- this.#transit,
6367
- this.#pedestrian,
6368
- this.#path,
6369
- this.#path_construction,
6370
- this.#track,
6371
- this.#pier,
6372
- this.#ferry
6373
- ];
6374
- }
6375
- #roadTypeMap() {
6376
- return /* @__PURE__ */ new Map([
6377
- ["motorway", this.#motorway],
6378
- ["trunk", this.#trunk],
6379
- ["trunk_construction", this.#trunk_construction],
6380
- ["primary", this.#primary],
6381
- ["primary_construction", this.#primary_construction],
6382
- ["secondary", this.#secondary],
6383
- ["secondary_construction", this.#secondary_construction],
6384
- ["tertiary", this.#tertiary],
6385
- ["minor", this.#minor],
6386
- ["minor_construction", this.#minor_construction],
6387
- ["service", this.#service],
6388
- ["service_construction", this.#service_construction],
6389
- ["rail", this.#rail],
6390
- ["transit", this.#transit],
6391
- ["pedestrian", this.#pedestrian],
6392
- ["path", this.#path],
6393
- ["path_construction", this.#path_construction],
6394
- ["track", this.#track],
6395
- ["pier", this.#pier],
6396
- ["ferry", this.#ferry]
6397
- ]);
6845
+ return __privateMethod(this, _TransportationLayer_instances, roadTypeMap_fn).call(this).get(name) ?? null;
6398
6846
  }
6399
6847
  };
6848
+ _isVisible9 = new WeakMap();
6849
+ _generalConfig = new WeakMap();
6850
+ _primary = new WeakMap();
6851
+ _secondary = new WeakMap();
6852
+ _tertiary = new WeakMap();
6853
+ _minor = new WeakMap();
6854
+ _service = new WeakMap();
6855
+ _pedestrian = new WeakMap();
6856
+ _path = new WeakMap();
6857
+ _minor_construction = new WeakMap();
6858
+ _rail = new WeakMap();
6859
+ _transit = new WeakMap();
6860
+ _track2 = new WeakMap();
6861
+ _trunk = new WeakMap();
6862
+ _pier = new WeakMap();
6863
+ _primary_construction = new WeakMap();
6864
+ _ferry = new WeakMap();
6865
+ _secondary_construction = new WeakMap();
6866
+ _path_construction = new WeakMap();
6867
+ _motorway = new WeakMap();
6868
+ _trunk_construction = new WeakMap();
6869
+ _service_construction = new WeakMap();
6870
+ _TransportationLayer_instances = new WeakSet();
6871
+ /**
6872
+ * @returns {RoadType[]}
6873
+ * @private
6874
+ */
6875
+ allRoadTypes_fn = function() {
6876
+ return [
6877
+ __privateGet(this, _motorway),
6878
+ __privateGet(this, _trunk),
6879
+ __privateGet(this, _trunk_construction),
6880
+ __privateGet(this, _primary),
6881
+ __privateGet(this, _primary_construction),
6882
+ __privateGet(this, _secondary),
6883
+ __privateGet(this, _secondary_construction),
6884
+ __privateGet(this, _tertiary),
6885
+ __privateGet(this, _minor),
6886
+ __privateGet(this, _minor_construction),
6887
+ __privateGet(this, _service),
6888
+ __privateGet(this, _service_construction),
6889
+ __privateGet(this, _rail),
6890
+ __privateGet(this, _transit),
6891
+ __privateGet(this, _pedestrian),
6892
+ __privateGet(this, _path),
6893
+ __privateGet(this, _path_construction),
6894
+ __privateGet(this, _track2),
6895
+ __privateGet(this, _pier),
6896
+ __privateGet(this, _ferry)
6897
+ ];
6898
+ };
6899
+ /**
6900
+ * @returns {Map<string, RoadType>}
6901
+ * @private
6902
+ */
6903
+ roadTypeMap_fn = function() {
6904
+ return /* @__PURE__ */ new Map([
6905
+ ["motorway", __privateGet(this, _motorway)],
6906
+ ["trunk", __privateGet(this, _trunk)],
6907
+ ["trunk_construction", __privateGet(this, _trunk_construction)],
6908
+ ["primary", __privateGet(this, _primary)],
6909
+ ["primary_construction", __privateGet(this, _primary_construction)],
6910
+ ["secondary", __privateGet(this, _secondary)],
6911
+ ["secondary_construction", __privateGet(this, _secondary_construction)],
6912
+ ["tertiary", __privateGet(this, _tertiary)],
6913
+ ["minor", __privateGet(this, _minor)],
6914
+ ["minor_construction", __privateGet(this, _minor_construction)],
6915
+ ["service", __privateGet(this, _service)],
6916
+ ["service_construction", __privateGet(this, _service_construction)],
6917
+ ["rail", __privateGet(this, _rail)],
6918
+ ["transit", __privateGet(this, _transit)],
6919
+ ["pedestrian", __privateGet(this, _pedestrian)],
6920
+ ["path", __privateGet(this, _path)],
6921
+ ["path_construction", __privateGet(this, _path_construction)],
6922
+ ["track", __privateGet(this, _track2)],
6923
+ ["pier", __privateGet(this, _pier)],
6924
+ ["ferry", __privateGet(this, _ferry)]
6925
+ ]);
6926
+ };
6400
6927
 
6401
6928
  // src/style/WaterWayLayer.js
6402
6929
  var THREE6 = __toESM(require("three"));
@@ -6412,307 +6939,489 @@ function makeWaterwayMaterial(color, transparent = true, opacity = 0.9) {
6412
6939
  });
6413
6940
  }
6414
6941
  function makeOutlineMaterial2(color) {
6415
- return new THREE6.MeshBasicMaterial({
6416
- color,
6417
- side: THREE6.BackSide
6418
- });
6942
+ return new THREE6.MeshBasicMaterial({ color, side: THREE6.BackSide });
6419
6943
  }
6944
+ var _isVisible10, _material6, _outlineMaterial2, _YOrder6, _outlineWidth3, _lineWidth2;
6420
6945
  var WaterwayType = class {
6421
- #isVisible = true;
6422
- #material;
6423
- #outlineMaterial;
6424
- #YOrder;
6425
- #outlineWidth = 0.1;
6426
- #lineWidth = 1;
6946
+ /**
6947
+ * @param {THREE.Material} material - Fill material.
6948
+ * @param {THREE.Material} outlineMaterial - Outline material.
6949
+ * @param {number} YOrder - Y-axis render order offset.
6950
+ * @param {number} [lineWidth=0] - Half-width of the rendered line in world units.
6951
+ */
6427
6952
  constructor(material, outlineMaterial, YOrder, lineWidth = 0) {
6428
- this.#material = material;
6429
- this.#outlineMaterial = outlineMaterial;
6430
- this.#YOrder = YOrder;
6431
- this.#lineWidth = lineWidth;
6953
+ /** @type {boolean} */
6954
+ __privateAdd(this, _isVisible10, true);
6955
+ /** @type {THREE.Material} */
6956
+ __privateAdd(this, _material6);
6957
+ /** @type {THREE.Material} */
6958
+ __privateAdd(this, _outlineMaterial2);
6959
+ /** @type {number} */
6960
+ __privateAdd(this, _YOrder6);
6961
+ /** @type {number} */
6962
+ __privateAdd(this, _outlineWidth3, 0.1);
6963
+ /** @type {number} */
6964
+ __privateAdd(this, _lineWidth2, 1);
6965
+ __privateSet(this, _material6, material);
6966
+ __privateSet(this, _outlineMaterial2, outlineMaterial);
6967
+ __privateSet(this, _YOrder6, YOrder);
6968
+ __privateSet(this, _lineWidth2, lineWidth);
6432
6969
  }
6970
+ /**
6971
+ * Whether this waterway type is rendered.
6972
+ * @type {boolean}
6973
+ */
6433
6974
  get isVisible() {
6434
- return this.#isVisible;
6975
+ return __privateGet(this, _isVisible10);
6435
6976
  }
6436
6977
  set isVisible(v) {
6437
- this.#isVisible = !!v;
6978
+ __privateSet(this, _isVisible10, !!v);
6438
6979
  }
6980
+ /**
6981
+ * Sets visibility (alias for the `isVisible` setter).
6982
+ * @param {boolean} v
6983
+ */
6439
6984
  setVisible(v) {
6440
- this.#isVisible = !!v;
6985
+ __privateSet(this, _isVisible10, !!v);
6441
6986
  }
6987
+ /**
6988
+ * The Three.js fill material for this waterway type.
6989
+ * Must be a {@link THREE.Material} instance.
6990
+ * @type {THREE.Material}
6991
+ */
6442
6992
  get material() {
6443
- return this.#material;
6993
+ return __privateGet(this, _material6);
6444
6994
  }
6445
6995
  set material(m) {
6446
6996
  if (m && !(m instanceof THREE6.Material)) {
6447
6997
  console.warn("GeoPlay: material must be a THREE.Material instance");
6448
6998
  return;
6449
6999
  }
6450
- this.#material = m;
7000
+ __privateSet(this, _material6, m);
6451
7001
  }
7002
+ /**
7003
+ * The Three.js outline material for this waterway type.
7004
+ * Must be a {@link THREE.Material} instance.
7005
+ * @type {THREE.Material}
7006
+ */
6452
7007
  get outlineMaterial() {
6453
- return this.#outlineMaterial;
7008
+ return __privateGet(this, _outlineMaterial2);
6454
7009
  }
6455
7010
  set outlineMaterial(m) {
6456
7011
  if (m && !(m instanceof THREE6.Material)) {
6457
7012
  console.warn("GeoPlay: outlineMaterial must be a THREE.Material instance");
6458
7013
  return;
6459
7014
  }
6460
- this.#outlineMaterial = m;
7015
+ __privateSet(this, _outlineMaterial2, m);
6461
7016
  }
7017
+ /**
7018
+ * Y-axis render order offset for depth sorting.
7019
+ * @type {number}
7020
+ */
6462
7021
  get YOrder() {
6463
- return this.#YOrder;
7022
+ return __privateGet(this, _YOrder6);
6464
7023
  }
6465
7024
  set YOrder(v) {
6466
- this.#YOrder = v;
7025
+ __privateSet(this, _YOrder6, v);
6467
7026
  }
7027
+ /**
7028
+ * Half-width of the rendered line in world units. Must be ≥ 0.
7029
+ * @type {number}
7030
+ */
6468
7031
  get lineWidth() {
6469
- return this.#lineWidth;
7032
+ return __privateGet(this, _lineWidth2);
6470
7033
  }
6471
7034
  set lineWidth(v) {
6472
7035
  if (typeof v !== "number" || isNaN(v) || v < 0) {
6473
7036
  console.warn(`GeoPlay: lineWidth must be a non-negative number (received: ${v})`);
6474
7037
  return;
6475
7038
  }
6476
- this.#lineWidth = v;
7039
+ __privateSet(this, _lineWidth2, v);
6477
7040
  }
7041
+ /**
7042
+ * Width of the outline in world units. Set to `null` to inherit from the layer default.
7043
+ * @type {number|null}
7044
+ */
6478
7045
  get outlineWidth() {
6479
- return this.#outlineWidth;
7046
+ return __privateGet(this, _outlineWidth3);
6480
7047
  }
6481
7048
  set outlineWidth(v) {
6482
7049
  if (v !== null && (typeof v !== "number" || isNaN(v) || v < 0)) {
6483
7050
  console.warn(`GeoPlay: outlineWidth must be a non-negative number or null (received: ${v})`);
6484
7051
  return;
6485
7052
  }
6486
- this.#outlineWidth = v;
7053
+ __privateSet(this, _outlineWidth3, v);
6487
7054
  }
7055
+ /**
7056
+ * Resets `outlineWidth` to `null` so the layer-level default is used instead.
7057
+ */
6488
7058
  resetOutlineWidth() {
6489
- this.#outlineWidth = null;
7059
+ __privateSet(this, _outlineWidth3, null);
6490
7060
  }
6491
7061
  };
7062
+ _isVisible10 = new WeakMap();
7063
+ _material6 = new WeakMap();
7064
+ _outlineMaterial2 = new WeakMap();
7065
+ _YOrder6 = new WeakMap();
7066
+ _outlineWidth3 = new WeakMap();
7067
+ _lineWidth2 = new WeakMap();
7068
+ var _isVisible11, _river2, _stream, _tidal_channel, _flowline, _canal, _drain, _ditch, _pressurised, _waterwayMap, _WaterwayLayer_instances, allWaterways_fn;
6492
7069
  var WaterwayLayer = class {
6493
- #isVisible = true;
6494
- #river;
6495
- #stream;
6496
- #tidal_channel;
6497
- #flowline;
6498
- #canal;
6499
- #drain;
6500
- #ditch;
6501
- #pressurised;
6502
- #waterwayMap;
6503
7070
  constructor() {
7071
+ __privateAdd(this, _WaterwayLayer_instances);
7072
+ /** @type {boolean} */
7073
+ __privateAdd(this, _isVisible11, true);
7074
+ /** @type {WaterwayType} */
7075
+ __privateAdd(this, _river2);
7076
+ /** @type {WaterwayType} */
7077
+ __privateAdd(this, _stream);
7078
+ /** @type {WaterwayType} */
7079
+ __privateAdd(this, _tidal_channel);
7080
+ /** @type {WaterwayType} */
7081
+ __privateAdd(this, _flowline);
7082
+ /** @type {WaterwayType} */
7083
+ __privateAdd(this, _canal);
7084
+ /** @type {WaterwayType} */
7085
+ __privateAdd(this, _drain);
7086
+ /** @type {WaterwayType} */
7087
+ __privateAdd(this, _ditch);
7088
+ /** @type {WaterwayType} */
7089
+ __privateAdd(this, _pressurised);
7090
+ /** @type {Map<string, WaterwayType>} */
7091
+ __privateAdd(this, _waterwayMap);
6504
7092
  const delta = 0.2;
6505
7093
  const waterMat = makeWaterwayMaterial(2062260);
6506
7094
  const outlineMat = makeOutlineMaterial2(872314);
6507
- this.#river = new WaterwayType(waterMat, outlineMat, 1e-4, 0.5 * delta);
6508
- this.#stream = new WaterwayType(waterMat, outlineMat, 12e-5, 0.3 * delta);
6509
- this.#tidal_channel = new WaterwayType(waterMat, outlineMat, 11e-5, 0.4 * delta);
6510
- this.#flowline = new WaterwayType(waterMat, outlineMat, 9e-5, 0.2 * delta);
6511
- this.#canal = new WaterwayType(waterMat, outlineMat, 1e-4, 0.4 * delta);
6512
- this.#drain = new WaterwayType(waterMat, outlineMat, 8e-5, 0.2 * delta);
6513
- this.#ditch = new WaterwayType(waterMat, outlineMat, 7e-5, 0.15 * delta);
6514
- this.#pressurised = new WaterwayType(waterMat, outlineMat, 5e-5, 0.1 * delta);
6515
- this.#waterwayMap = /* @__PURE__ */ new Map([
6516
- ["river", this.#river],
6517
- ["stream", this.#stream],
6518
- ["tidal_channel", this.#tidal_channel],
6519
- ["flowline", this.#flowline],
6520
- ["canal", this.#canal],
6521
- ["drain", this.#drain],
6522
- ["ditch", this.#ditch],
6523
- ["pressurised", this.#pressurised]
6524
- ]);
7095
+ __privateSet(this, _river2, new WaterwayType(waterMat, outlineMat, 1e-4, 0.5 * delta));
7096
+ __privateSet(this, _stream, new WaterwayType(waterMat, outlineMat, 12e-5, 0.3 * delta));
7097
+ __privateSet(this, _tidal_channel, new WaterwayType(waterMat, outlineMat, 11e-5, 0.4 * delta));
7098
+ __privateSet(this, _flowline, new WaterwayType(waterMat, outlineMat, 9e-5, 0.2 * delta));
7099
+ __privateSet(this, _canal, new WaterwayType(waterMat, outlineMat, 1e-4, 0.4 * delta));
7100
+ __privateSet(this, _drain, new WaterwayType(waterMat, outlineMat, 8e-5, 0.2 * delta));
7101
+ __privateSet(this, _ditch, new WaterwayType(waterMat, outlineMat, 7e-5, 0.15 * delta));
7102
+ __privateSet(this, _pressurised, new WaterwayType(waterMat, outlineMat, 5e-5, 0.1 * delta));
7103
+ __privateSet(this, _waterwayMap, /* @__PURE__ */ new Map([
7104
+ ["river", __privateGet(this, _river2)],
7105
+ ["stream", __privateGet(this, _stream)],
7106
+ ["tidal_channel", __privateGet(this, _tidal_channel)],
7107
+ ["flowline", __privateGet(this, _flowline)],
7108
+ ["canal", __privateGet(this, _canal)],
7109
+ ["drain", __privateGet(this, _drain)],
7110
+ ["ditch", __privateGet(this, _ditch)],
7111
+ ["pressurised", __privateGet(this, _pressurised)]
7112
+ ]));
6525
7113
  }
7114
+ /**
7115
+ * Master visibility toggle. Setting this also propagates to all individual waterway types.
7116
+ * @type {boolean}
7117
+ */
6526
7118
  get isVisible() {
6527
- return this.#isVisible;
7119
+ return __privateGet(this, _isVisible11);
6528
7120
  }
6529
7121
  set isVisible(v) {
6530
- this.#isVisible = !!v;
6531
- this.#allWaterways().forEach((w) => w.setVisible(v));
7122
+ __privateSet(this, _isVisible11, !!v);
7123
+ __privateMethod(this, _WaterwayLayer_instances, allWaterways_fn).call(this).forEach((w) => w.setVisible(v));
6532
7124
  }
7125
+ /** @type {WaterwayType} */
6533
7126
  get river() {
6534
- return this.#river;
7127
+ return __privateGet(this, _river2);
6535
7128
  }
7129
+ /** @type {WaterwayType} */
6536
7130
  get stream() {
6537
- return this.#stream;
7131
+ return __privateGet(this, _stream);
6538
7132
  }
7133
+ /** @type {WaterwayType} */
6539
7134
  get tidal_channel() {
6540
- return this.#tidal_channel;
7135
+ return __privateGet(this, _tidal_channel);
6541
7136
  }
7137
+ /** @type {WaterwayType} */
6542
7138
  get flowline() {
6543
- return this.#flowline;
7139
+ return __privateGet(this, _flowline);
6544
7140
  }
7141
+ /** @type {WaterwayType} */
6545
7142
  get canal() {
6546
- return this.#canal;
7143
+ return __privateGet(this, _canal);
6547
7144
  }
7145
+ /** @type {WaterwayType} */
6548
7146
  get drain() {
6549
- return this.#drain;
7147
+ return __privateGet(this, _drain);
6550
7148
  }
7149
+ /** @type {WaterwayType} */
6551
7150
  get ditch() {
6552
- return this.#ditch;
7151
+ return __privateGet(this, _ditch);
6553
7152
  }
7153
+ /** @type {WaterwayType} */
6554
7154
  get pressurised() {
6555
- return this.#pressurised;
7155
+ return __privateGet(this, _pressurised);
6556
7156
  }
7157
+ /**
7158
+ * Returns a waterway type by its OSM class name.
7159
+ * @param {'river'|'stream'|'tidal_channel'|'flowline'|'canal'|'drain'|'ditch'|'pressurised'} name
7160
+ * @returns {WaterwayType|null} The matching type, or `null` if not found.
7161
+ */
6557
7162
  getTypeByName(name) {
6558
- return this.#waterwayMap.get(name) ?? null;
7163
+ return __privateGet(this, _waterwayMap).get(name) ?? null;
6559
7164
  }
7165
+ /**
7166
+ * Replaces fill and outline materials on every waterway type with clones of the provided materials.
7167
+ * @param {THREE.Material} material - A valid Three.js fill material.
7168
+ * @param {THREE.Material} [outlineMaterial] - Optional outline material.
7169
+ */
6560
7170
  setAllMaterials(material, outlineMaterial) {
6561
7171
  if (!(material instanceof THREE6.Material)) {
6562
7172
  console.warn("GeoPlay: Invalid material, must be THREE.Material");
6563
7173
  return;
6564
7174
  }
6565
- this.#allWaterways().forEach((w) => {
7175
+ __privateMethod(this, _WaterwayLayer_instances, allWaterways_fn).call(this).forEach((w) => {
6566
7176
  w.material = material.clone();
6567
7177
  if (outlineMaterial) w.outlineMaterial = outlineMaterial.clone();
6568
7178
  });
6569
7179
  }
7180
+ /**
7181
+ * Sets `outlineWidth` on all waterway types.
7182
+ * @param {number} width
7183
+ */
6570
7184
  setOutlineWidthAll(width) {
6571
- this.#allWaterways().forEach((w) => w.outlineWidth = width);
7185
+ __privateMethod(this, _WaterwayLayer_instances, allWaterways_fn).call(this).forEach((w) => w.outlineWidth = width);
6572
7186
  }
7187
+ /**
7188
+ * Resets `outlineWidth` to `null` on all waterway types (falls back to layer default).
7189
+ */
6573
7190
  resetOutlineWidthAll() {
6574
- this.#allWaterways().forEach((w) => w.resetOutlineWidth());
7191
+ __privateMethod(this, _WaterwayLayer_instances, allWaterways_fn).call(this).forEach((w) => w.resetOutlineWidth());
6575
7192
  }
7193
+ /**
7194
+ * Sets `lineWidth` on all waterway types.
7195
+ * @param {number} width
7196
+ */
6576
7197
  setLineWidthAll(width) {
6577
- this.#allWaterways().forEach((w) => w.lineWidth = width);
7198
+ __privateMethod(this, _WaterwayLayer_instances, allWaterways_fn).call(this).forEach((w) => w.lineWidth = width);
6578
7199
  }
7200
+ /**
7201
+ * Sets visibility on all individual waterway types.
7202
+ * @param {boolean} isVisible
7203
+ */
6579
7204
  setVisibleAll(isVisible) {
6580
- this.#allWaterways().forEach((w) => w.setVisible(isVisible));
6581
- }
6582
- #allWaterways() {
6583
- return [
6584
- this.#river,
6585
- this.#stream,
6586
- this.#tidal_channel,
6587
- this.#flowline,
6588
- this.#canal,
6589
- this.#drain,
6590
- this.#ditch,
6591
- this.#pressurised
6592
- ];
7205
+ __privateMethod(this, _WaterwayLayer_instances, allWaterways_fn).call(this).forEach((w) => w.setVisible(isVisible));
6593
7206
  }
6594
7207
  };
7208
+ _isVisible11 = new WeakMap();
7209
+ _river2 = new WeakMap();
7210
+ _stream = new WeakMap();
7211
+ _tidal_channel = new WeakMap();
7212
+ _flowline = new WeakMap();
7213
+ _canal = new WeakMap();
7214
+ _drain = new WeakMap();
7215
+ _ditch = new WeakMap();
7216
+ _pressurised = new WeakMap();
7217
+ _waterwayMap = new WeakMap();
7218
+ _WaterwayLayer_instances = new WeakSet();
7219
+ /**
7220
+ * @returns {WaterwayType[]}
7221
+ * @private
7222
+ */
7223
+ allWaterways_fn = function() {
7224
+ return [
7225
+ __privateGet(this, _river2),
7226
+ __privateGet(this, _stream),
7227
+ __privateGet(this, _tidal_channel),
7228
+ __privateGet(this, _flowline),
7229
+ __privateGet(this, _canal),
7230
+ __privateGet(this, _drain),
7231
+ __privateGet(this, _ditch),
7232
+ __privateGet(this, _pressurised)
7233
+ ];
7234
+ };
6595
7235
 
6596
7236
  // src/style/BackgroundLayer.js
6597
7237
  var THREE7 = __toESM(require("three"));
7238
+ var _isVisible12, _material7, _YOrder7;
6598
7239
  var BackgroundLayer = class {
6599
- /** @type {boolean} */
6600
- #isVisible = false;
6601
- /** @type {THREE.Material} */
6602
- #material;
6603
- /** @type {number} */
6604
- #YOrder = -0.05;
6605
7240
  constructor() {
6606
- this.#material = new THREE7.MeshBasicMaterial({
7241
+ /** @type {boolean} */
7242
+ __privateAdd(this, _isVisible12, false);
7243
+ /** @type {THREE.Material} */
7244
+ __privateAdd(this, _material7);
7245
+ /** @type {number} */
7246
+ __privateAdd(this, _YOrder7, -0.05);
7247
+ __privateSet(this, _material7, new THREE7.MeshBasicMaterial({
6607
7248
  color: 15921129,
6608
7249
  transparent: false,
6609
7250
  side: THREE7.FrontSide
6610
- });
7251
+ }));
6611
7252
  }
7253
+ /**
7254
+ * Whether this layer is visible.
7255
+ * @type {boolean}
7256
+ */
6612
7257
  get isVisible() {
6613
- return this.#isVisible;
7258
+ return __privateGet(this, _isVisible12);
6614
7259
  }
6615
7260
  set isVisible(v) {
6616
- this.#isVisible = !!v;
7261
+ __privateSet(this, _isVisible12, !!v);
6617
7262
  }
7263
+ /**
7264
+ * The Three.js material used to render the background.
7265
+ * @type {THREE.Material}
7266
+ */
6618
7267
  get material() {
6619
- return this.#material;
7268
+ return __privateGet(this, _material7);
6620
7269
  }
6621
7270
  set material(v) {
6622
- this.#material = v;
7271
+ __privateSet(this, _material7, v);
6623
7272
  }
7273
+ /**
7274
+ * Y-axis render order offset. Lower values render beneath other layers.
7275
+ * @type {number}
7276
+ */
6624
7277
  get YOrder() {
6625
- return this.#YOrder;
7278
+ return __privateGet(this, _YOrder7);
6626
7279
  }
6627
7280
  set YOrder(v) {
6628
- this.#YOrder = v;
7281
+ __privateSet(this, _YOrder7, v);
6629
7282
  }
7283
+ /**
7284
+ * Returns this instance regardless of name (background has a single type).
7285
+ * @param {string} _name - Unused.
7286
+ * @returns {BackgroundLayer} This instance.
7287
+ */
6630
7288
  getTypeByName(_name) {
6631
7289
  return this;
6632
7290
  }
6633
7291
  };
7292
+ _isVisible12 = new WeakMap();
7293
+ _material7 = new WeakMap();
7294
+ _YOrder7 = new WeakMap();
6634
7295
 
6635
7296
  // src/style/MapStyle.js
7297
+ var _buildingLayer, _waterLayer, _waterwayLayer, _landUseLayer, _landCoverLayer, _transportationLayer, _backgroundLayer;
6636
7298
  var MapStyle = class {
6637
- #buildingLayer;
6638
- #waterLayer;
6639
- #waterwayLayer;
6640
- #landUseLayer;
6641
- #landCoverLayer;
6642
- #transportationLayer;
6643
- #backgroundLayer;
6644
7299
  constructor() {
6645
- this.#buildingLayer = new BuildingLayer();
6646
- this.#waterLayer = new WaterLayer();
6647
- this.#waterwayLayer = new WaterwayLayer();
6648
- this.#landUseLayer = new LandUseLayer();
6649
- this.#landCoverLayer = new LandCoverLayer();
6650
- this.#transportationLayer = new TransportationLayer();
6651
- this.#backgroundLayer = new BackgroundLayer();
7300
+ /** @type {BuildingLayer} */
7301
+ __privateAdd(this, _buildingLayer);
7302
+ /** @type {WaterLayer} */
7303
+ __privateAdd(this, _waterLayer);
7304
+ /** @type {WaterwayLayer} */
7305
+ __privateAdd(this, _waterwayLayer);
7306
+ /** @type {LandUseLayer} */
7307
+ __privateAdd(this, _landUseLayer);
7308
+ /** @type {LandCoverLayer} */
7309
+ __privateAdd(this, _landCoverLayer);
7310
+ /** @type {TransportationLayer} */
7311
+ __privateAdd(this, _transportationLayer);
7312
+ /** @type {BackgroundLayer} */
7313
+ __privateAdd(this, _backgroundLayer);
7314
+ __privateSet(this, _buildingLayer, new BuildingLayer());
7315
+ __privateSet(this, _waterLayer, new WaterLayer());
7316
+ __privateSet(this, _waterwayLayer, new WaterwayLayer());
7317
+ __privateSet(this, _landUseLayer, new LandUseLayer());
7318
+ __privateSet(this, _landCoverLayer, new LandCoverLayer());
7319
+ __privateSet(this, _transportationLayer, new TransportationLayer());
7320
+ __privateSet(this, _backgroundLayer, new BackgroundLayer());
6652
7321
  }
7322
+ /**
7323
+ * Retrieves a style layer by its internal name.
7324
+ * @param {'background'|'waterway'|'water'|'landcover'|'landuse'|'building'|'transportation'} layerName
7325
+ * @returns {BackgroundLayer|WaterwayLayer|WaterLayer|LandCoverLayer|LandUseLayer|BuildingLayer|TransportationLayer|null}
7326
+ */
6653
7327
  getStyleLayerByName(layerName) {
6654
7328
  switch (layerName) {
6655
7329
  case "background":
6656
- return this.#backgroundLayer;
7330
+ return __privateGet(this, _backgroundLayer);
6657
7331
  case "waterway":
6658
- return this.#waterwayLayer;
7332
+ return __privateGet(this, _waterwayLayer);
6659
7333
  case "water":
6660
- return this.#waterLayer;
7334
+ return __privateGet(this, _waterLayer);
6661
7335
  case "landcover":
6662
- return this.#landCoverLayer;
7336
+ return __privateGet(this, _landCoverLayer);
6663
7337
  case "landuse":
6664
- return this.#landUseLayer;
7338
+ return __privateGet(this, _landUseLayer);
6665
7339
  case "building":
6666
- return this.#buildingLayer;
7340
+ return __privateGet(this, _buildingLayer);
6667
7341
  case "transportation":
6668
- return this.#transportationLayer;
7342
+ return __privateGet(this, _transportationLayer);
6669
7343
  default:
6670
7344
  return null;
6671
7345
  }
6672
7346
  }
7347
+ /**
7348
+ * The building extrusion layer.
7349
+ * @type {BuildingLayer}
7350
+ */
6673
7351
  get buildingLayer() {
6674
- return this.#buildingLayer;
7352
+ return __privateGet(this, _buildingLayer);
6675
7353
  }
6676
7354
  set buildingLayer(layer) {
6677
- this.#buildingLayer = layer;
7355
+ __privateSet(this, _buildingLayer, layer);
6678
7356
  }
7357
+ /**
7358
+ * The water body layer (lakes, oceans, rivers as polygons).
7359
+ * @type {WaterLayer}
7360
+ */
6679
7361
  get waterLayer() {
6680
- return this.#waterLayer;
7362
+ return __privateGet(this, _waterLayer);
6681
7363
  }
6682
7364
  set waterLayer(layer) {
6683
- this.#waterLayer = layer;
7365
+ __privateSet(this, _waterLayer, layer);
6684
7366
  }
7367
+ /**
7368
+ * The waterway layer (rivers, canals, ditches as lines).
7369
+ * @type {WaterwayLayer}
7370
+ */
6685
7371
  get waterwayLayer() {
6686
- return this.#waterwayLayer;
7372
+ return __privateGet(this, _waterwayLayer);
6687
7373
  }
6688
7374
  set waterwayLayer(layer) {
6689
- this.#waterwayLayer = layer;
7375
+ __privateSet(this, _waterwayLayer, layer);
6690
7376
  }
7377
+ /**
7378
+ * The land use layer (residential, industrial, parks, etc.).
7379
+ * @type {LandUseLayer}
7380
+ */
6691
7381
  get landUseLayer() {
6692
- return this.#landUseLayer;
7382
+ return __privateGet(this, _landUseLayer);
6693
7383
  }
6694
7384
  set landUseLayer(layer) {
6695
- this.#landUseLayer = layer;
7385
+ __privateSet(this, _landUseLayer, layer);
6696
7386
  }
7387
+ /**
7388
+ * The land cover layer (grass, wood, sand, etc.).
7389
+ * @type {LandCoverLayer}
7390
+ */
6697
7391
  get landCoverLayer() {
6698
- return this.#landCoverLayer;
7392
+ return __privateGet(this, _landCoverLayer);
6699
7393
  }
6700
7394
  set landCoverLayer(layer) {
6701
- this.#landCoverLayer = layer;
7395
+ __privateSet(this, _landCoverLayer, layer);
6702
7396
  }
7397
+ /**
7398
+ * The transportation layer (roads, rails, paths, etc.).
7399
+ * @type {TransportationLayer}
7400
+ */
6703
7401
  get transportationLayer() {
6704
- return this.#transportationLayer;
7402
+ return __privateGet(this, _transportationLayer);
6705
7403
  }
6706
7404
  set transportationLayer(layer) {
6707
- this.#transportationLayer = layer;
7405
+ __privateSet(this, _transportationLayer, layer);
6708
7406
  }
7407
+ /**
7408
+ * The background (base fill) layer rendered beneath all other layers.
7409
+ * @type {BackgroundLayer}
7410
+ */
6709
7411
  get backgroundLayer() {
6710
- return this.#backgroundLayer;
7412
+ return __privateGet(this, _backgroundLayer);
6711
7413
  }
6712
7414
  set backgroundLayer(layer) {
6713
- this.#backgroundLayer = layer;
7415
+ __privateSet(this, _backgroundLayer, layer);
6714
7416
  }
6715
7417
  };
7418
+ _buildingLayer = new WeakMap();
7419
+ _waterLayer = new WeakMap();
7420
+ _waterwayLayer = new WeakMap();
7421
+ _landUseLayer = new WeakMap();
7422
+ _landCoverLayer = new WeakMap();
7423
+ _transportationLayer = new WeakMap();
7424
+ _backgroundLayer = new WeakMap();
6716
7425
 
6717
7426
  // src/config/MapConfig.js
6718
7427
  var REBUILD_REQUIRED_FIELDS = Object.freeze({
@@ -6723,126 +7432,270 @@ var REBUILD_REQUIRED_FIELDS = Object.freeze({
6723
7432
  originLatLon: true
6724
7433
  });
6725
7434
  var TileLayout = Object.freeze({
7435
+ /** Tiles are loaded in a circular pattern around the origin. */
6726
7436
  CIRCULAR: "circular",
7437
+ /** Tiles are loaded in a square grid around the origin. */
6727
7438
  GRID: "grid"
6728
7439
  });
6729
7440
  var ViewMode = Object.freeze({
7441
+ /**
7442
+ * The map origin automatically follows the target set via
7443
+ * {@link ThreeGeoPlay#setFollowTarget} (defaults to the camera).
7444
+ */
6730
7445
  FOLLOW_TARGET: "follow_target",
7446
+ /**
7447
+ * The map origin is controlled manually via
7448
+ * {@link ThreeGeoPlay#moveMapOriginToLatLon} or
7449
+ * {@link ThreeGeoPlay#moveMapOriginToPosition}.
7450
+ */
6731
7451
  MANUAL: "manual"
6732
7452
  });
7453
+ var _pbfTileProviderZXYurl, _zoomLevel, _renderDistance, _tileWorldSize, _tileLayout, _originLatLon, _worldOriginOffset, _viewMode, _mapStyle, _followUpdateIntervalInMs, _showTileBorders, _dirtyFields;
6733
7454
  var MapConfig = class {
6734
- #pbfTileProviderZXYurl = "https://tile.openstreetmap.org/{z}/{x}/{y}.pbf";
6735
- #zoomLevel = 18;
6736
- #renderDistance = 4;
6737
- #tileWorldSize = 1;
6738
- #tileLayout = TileLayout.CIRCULAR;
6739
- #originLatLon = { lat: 41.899689, lon: 12.43779 };
6740
- #worldOriginOffset = { x: 0, z: 0 };
6741
- #viewMode = ViewMode.FOLLOW_TARGET;
6742
- #mapStyle = new MapStyle();
6743
- #followUpdateIntervalInMs = 0;
6744
- #showTileBorders = false;
6745
- #dirtyFields = /* @__PURE__ */ new Set();
7455
+ constructor() {
7456
+ /**
7457
+ * ZXY URL template for the PBF vector tile provider.
7458
+ * Use `{z}`, `{x}`, `{y}` as placeholders.
7459
+ * @type {string}
7460
+ */
7461
+ __privateAdd(this, _pbfTileProviderZXYurl, "https://tile.openstreetmap.org/{z}/{x}/{y}.pbf");
7462
+ /**
7463
+ * OSM zoom level (typically 14–18). Higher values load more detail.
7464
+ * @type {number}
7465
+ */
7466
+ __privateAdd(this, _zoomLevel, 18);
7467
+ /**
7468
+ * Number of tiles to load in each direction from the origin tile.
7469
+ * @type {number}
7470
+ */
7471
+ __privateAdd(this, _renderDistance, 4);
7472
+ /**
7473
+ * World-space size of one tile in Three.js units.
7474
+ * @type {number}
7475
+ */
7476
+ __privateAdd(this, _tileWorldSize, 1);
7477
+ /**
7478
+ * @type {TileLayout}
7479
+ */
7480
+ __privateAdd(this, _tileLayout, TileLayout.CIRCULAR);
7481
+ /**
7482
+ * Geographic coordinates of the map origin.
7483
+ * @type {LatLon}
7484
+ */
7485
+ __privateAdd(this, _originLatLon, { lat: 41.899689, lon: 12.43779 });
7486
+ /**
7487
+ * Additional X/Z offset applied to the world origin in Three.js units.
7488
+ * @type {WorldOffset}
7489
+ */
7490
+ __privateAdd(this, _worldOriginOffset, { x: 0, z: 0 });
7491
+ /**
7492
+ * @type {ViewMode}
7493
+ */
7494
+ __privateAdd(this, _viewMode, ViewMode.FOLLOW_TARGET);
7495
+ /**
7496
+ * @type {MapStyle}
7497
+ */
7498
+ __privateAdd(this, _mapStyle, new MapStyle());
7499
+ /**
7500
+ * Minimum interval in milliseconds between follow-target updates.
7501
+ * `0` means update every frame.
7502
+ * @type {number}
7503
+ */
7504
+ __privateAdd(this, _followUpdateIntervalInMs, 0);
7505
+ /**
7506
+ * When true, draws a visible border around each loaded tile (useful for debugging).
7507
+ * @type {boolean}
7508
+ */
7509
+ __privateAdd(this, _showTileBorders, false);
7510
+ /** @type {Set<string>} */
7511
+ __privateAdd(this, _dirtyFields, /* @__PURE__ */ new Set());
7512
+ }
7513
+ // ─── Dirty-state helpers ──────────────────────────────────────────────────
7514
+ /**
7515
+ * True if any property has been modified since the last {@link flushDirtyState} call.
7516
+ * @type {boolean}
7517
+ * @readonly
7518
+ */
6746
7519
  get _isDirty() {
6747
- return this.#dirtyFields.size > 0;
7520
+ return __privateGet(this, _dirtyFields).size > 0;
6748
7521
  }
7522
+ /**
7523
+ * The set of field names that have been modified since the last flush.
7524
+ * @type {Set<string>}
7525
+ * @readonly
7526
+ */
6749
7527
  get _dirtyFields() {
6750
- return this.#dirtyFields;
7528
+ return __privateGet(this, _dirtyFields);
6751
7529
  }
7530
+ /**
7531
+ * True if any dirty field requires a full tile rebuild (new fetch + geometry generation).
7532
+ * @type {boolean}
7533
+ * @readonly
7534
+ */
6752
7535
  get requiresRebuild() {
6753
- return [...this.#dirtyFields].some((f) => REBUILD_REQUIRED_FIELDS[f] === true);
7536
+ return [...__privateGet(this, _dirtyFields)].some((f) => REBUILD_REQUIRED_FIELDS[f] === true);
6754
7537
  }
7538
+ /**
7539
+ * Scale factor relative to zoom level 18.
7540
+ * Useful for sizing world-space objects consistently across zoom levels.
7541
+ * @type {number}
7542
+ * @readonly
7543
+ */
6755
7544
  get zoomScaleFactor() {
6756
- return 1 / Math.pow(2, 18 - this.#zoomLevel);
7545
+ return 1 / Math.pow(2, 18 - __privateGet(this, _zoomLevel));
6757
7546
  }
7547
+ /**
7548
+ * Clears the dirty-field set. Called automatically by {@link ThreeGeoPlay#onFrameUpdate}
7549
+ * after processing changes.
7550
+ */
6758
7551
  flushDirtyState() {
6759
- this.#dirtyFields.clear();
7552
+ __privateGet(this, _dirtyFields).clear();
6760
7553
  }
7554
+ // ─── Properties ──────────────────────────────────────────────────────────
7555
+ /**
7556
+ * ZXY URL template for the PBF tile provider.
7557
+ * Changing this triggers a full tile rebuild.
7558
+ * @type {string}
7559
+ */
6761
7560
  get pbfTileProviderZXYurl() {
6762
- return this.#pbfTileProviderZXYurl;
7561
+ return __privateGet(this, _pbfTileProviderZXYurl);
6763
7562
  }
6764
7563
  set pbfTileProviderZXYurl(value) {
6765
- this.#pbfTileProviderZXYurl = value;
6766
- this.#dirtyFields.add("pbfTileProviderZXYurl");
7564
+ __privateSet(this, _pbfTileProviderZXYurl, value);
7565
+ __privateGet(this, _dirtyFields).add("pbfTileProviderZXYurl");
6767
7566
  }
7567
+ /**
7568
+ * OSM zoom level. Changing this triggers a full tile rebuild.
7569
+ * @type {number}
7570
+ */
6768
7571
  get zoomLevel() {
6769
- return this.#zoomLevel;
7572
+ return __privateGet(this, _zoomLevel);
6770
7573
  }
6771
7574
  set zoomLevel(value) {
6772
- this.#zoomLevel = value;
6773
- this.#dirtyFields.add("zoomLevel");
7575
+ __privateSet(this, _zoomLevel, value);
7576
+ __privateGet(this, _dirtyFields).add("zoomLevel");
6774
7577
  }
7578
+ /**
7579
+ * Number of tiles to load around the origin. Changing this re-applies the tile center.
7580
+ * @type {number}
7581
+ */
6775
7582
  get renderDistance() {
6776
- return this.#renderDistance;
7583
+ return __privateGet(this, _renderDistance);
6777
7584
  }
6778
7585
  set renderDistance(value) {
6779
- this.#renderDistance = Math.round(value);
6780
- this.#dirtyFields.add("renderDistance");
7586
+ __privateSet(this, _renderDistance, Math.round(value));
7587
+ __privateGet(this, _dirtyFields).add("renderDistance");
6781
7588
  }
7589
+ /**
7590
+ * World-space size of one tile in Three.js units. Must be a positive number.
7591
+ * Changing this rescales existing tiles without a full rebuild.
7592
+ * @type {number}
7593
+ */
6782
7594
  get tileWorldSize() {
6783
- return this.#tileWorldSize;
7595
+ return __privateGet(this, _tileWorldSize);
6784
7596
  }
6785
7597
  set tileWorldSize(value) {
6786
7598
  if (typeof value !== "number" || isNaN(value) || value <= 0) {
6787
7599
  throw new Error(`ThreeGeoPlay : Invalid tileWorldSize: ${value}. Must be a positive number`);
6788
7600
  }
6789
- this.#tileWorldSize = value;
6790
- this.#dirtyFields.add("tileWorldSize");
7601
+ __privateSet(this, _tileWorldSize, value);
7602
+ __privateGet(this, _dirtyFields).add("tileWorldSize");
6791
7603
  }
7604
+ /**
7605
+ * Tile loading pattern. Use {@link TileLayout} enum values.
7606
+ * Changing this triggers a full tile rebuild.
7607
+ * @type {TileLayout}
7608
+ */
6792
7609
  get tileLayout() {
6793
- return this.#tileLayout;
7610
+ return __privateGet(this, _tileLayout);
6794
7611
  }
6795
7612
  set tileLayout(value) {
6796
7613
  if (!Object.values(TileLayout).includes(value)) {
6797
7614
  throw new Error(`ThreeGeoPlay : Invalid tile layout: ${value}. Use TileLayout.CIRCULAR or TileLayout.GRID`);
6798
7615
  }
6799
- this.#tileLayout = value;
6800
- this.#dirtyFields.add("tileLayout");
7616
+ __privateSet(this, _tileLayout, value);
7617
+ __privateGet(this, _dirtyFields).add("tileLayout");
6801
7618
  }
7619
+ /**
7620
+ * Geographic coordinates of the map origin.
7621
+ * Changing this triggers a full tile rebuild.
7622
+ * @type {LatLon}
7623
+ */
6802
7624
  get originLatLon() {
6803
- return this.#originLatLon;
7625
+ return __privateGet(this, _originLatLon);
6804
7626
  }
6805
7627
  set originLatLon(value) {
6806
- this.#originLatLon = value;
6807
- this.#dirtyFields.add("originLatLon");
7628
+ __privateSet(this, _originLatLon, value);
7629
+ __privateGet(this, _dirtyFields).add("originLatLon");
6808
7630
  }
7631
+ /**
7632
+ * Additional X/Z offset applied to the world origin.
7633
+ * Changing this triggers a full tile rebuild.
7634
+ * @type {WorldOffset}
7635
+ */
6809
7636
  get worldOriginOffset() {
6810
- return this.#worldOriginOffset;
7637
+ return __privateGet(this, _worldOriginOffset);
6811
7638
  }
6812
7639
  set worldOriginOffset(value) {
6813
7640
  if (!value || typeof value.x !== "number" || isNaN(value.x) || typeof value.z !== "number" || isNaN(value.z)) {
6814
7641
  throw new Error("Invalid worldOriginOffset: x and z must be valid numbers");
6815
7642
  }
6816
- this.#worldOriginOffset = { x: value.x, z: value.z };
6817
- this.#dirtyFields.add("worldOriginOffset");
7643
+ __privateSet(this, _worldOriginOffset, { x: value.x, z: value.z });
7644
+ __privateGet(this, _dirtyFields).add("worldOriginOffset");
6818
7645
  }
7646
+ /**
7647
+ * Camera/map tracking mode. Use {@link ViewMode} enum values.
7648
+ * @type {ViewMode}
7649
+ */
6819
7650
  get viewMode() {
6820
- return this.#viewMode;
7651
+ return __privateGet(this, _viewMode);
6821
7652
  }
6822
7653
  set viewMode(value) {
6823
7654
  if (!Object.values(ViewMode).includes(value)) {
6824
7655
  throw new Error(`ThreeGeoPlay : Invalid view mode: ${value}. Use ViewMode.FOLLOW_TARGET or ViewMode.MANUAL`);
6825
7656
  }
6826
- this.#viewMode = value;
6827
- this.#dirtyFields.add("viewMode");
7657
+ __privateSet(this, _viewMode, value);
7658
+ __privateGet(this, _dirtyFields).add("viewMode");
6828
7659
  }
7660
+ /**
7661
+ * The active {@link MapStyle} instance.
7662
+ * Changing this triggers a material update on all tiles.
7663
+ * @type {MapStyle}
7664
+ */
6829
7665
  get mapStyle() {
6830
- return this.#mapStyle;
7666
+ return __privateGet(this, _mapStyle);
6831
7667
  }
6832
7668
  set mapStyle(value) {
6833
- this.#mapStyle = value;
6834
- this.#dirtyFields.add("mapStyle");
7669
+ __privateSet(this, _mapStyle, value);
7670
+ __privateGet(this, _dirtyFields).add("mapStyle");
6835
7671
  }
7672
+ /**
7673
+ * Minimum interval in milliseconds between follow-target tile updates.
7674
+ * `0` means the map updates every frame.
7675
+ * @type {number}
7676
+ * @readonly
7677
+ */
6836
7678
  get FollowUpdateInterval() {
6837
- return this.#followUpdateIntervalInMs;
7679
+ return __privateGet(this, _followUpdateIntervalInMs);
6838
7680
  }
7681
+ /**
7682
+ * When true, a visible border is drawn around each loaded tile.
7683
+ * Useful for debugging tile boundaries.
7684
+ * @type {boolean}
7685
+ */
6839
7686
  get showTileBorders() {
6840
- return this.#showTileBorders;
7687
+ return __privateGet(this, _showTileBorders);
6841
7688
  }
6842
7689
  set showTileBorders(value) {
6843
- this.#showTileBorders = value;
6844
- this.#dirtyFields.add("showTileBorders");
7690
+ __privateSet(this, _showTileBorders, value);
7691
+ __privateGet(this, _dirtyFields).add("showTileBorders");
6845
7692
  }
7693
+ /**
7694
+ * Sets the minimum interval between follow-target updates.
7695
+ * Pass `0` to update every frame (default).
7696
+ * @param {number} intervalMs - Interval in milliseconds. Must be ≥ 0.
7697
+ * @throws {Error} If `intervalMs` is not a non-negative number.
7698
+ */
6846
7699
  setFollowUpdateInterval(intervalMs) {
6847
7700
  if (typeof intervalMs !== "number" || isNaN(intervalMs)) {
6848
7701
  throw new Error(`ThreeGeoPlay : Invalid interval: ${intervalMs}. Must be a number`);
@@ -6850,10 +7703,22 @@ var MapConfig = class {
6850
7703
  if (intervalMs < 0) {
6851
7704
  throw new Error(`ThreeGeoPlay : Invalid interval: ${intervalMs}. Must be 0 or positive`);
6852
7705
  }
6853
- this.#followUpdateIntervalInMs = intervalMs;
6854
- this.#dirtyFields.add("followUpdateIntervalInMs");
7706
+ __privateSet(this, _followUpdateIntervalInMs, intervalMs);
7707
+ __privateGet(this, _dirtyFields).add("followUpdateIntervalInMs");
6855
7708
  }
6856
7709
  };
7710
+ _pbfTileProviderZXYurl = new WeakMap();
7711
+ _zoomLevel = new WeakMap();
7712
+ _renderDistance = new WeakMap();
7713
+ _tileWorldSize = new WeakMap();
7714
+ _tileLayout = new WeakMap();
7715
+ _originLatLon = new WeakMap();
7716
+ _worldOriginOffset = new WeakMap();
7717
+ _viewMode = new WeakMap();
7718
+ _mapStyle = new WeakMap();
7719
+ _followUpdateIntervalInMs = new WeakMap();
7720
+ _showTileBorders = new WeakMap();
7721
+ _dirtyFields = new WeakMap();
6857
7722
 
6858
7723
  // src/geo_utils/projection.js
6859
7724
  function geoToTileXY(dLon, dLat, zoom) {
@@ -6878,7 +7743,7 @@ function geoToTileXYFloat(dLon, dLat, zoom) {
6878
7743
  // src/utils/fetchTileData.js
6879
7744
  async function fetchTileData(url, tilePosition = null, signal = null) {
6880
7745
  const PERMANENT_ERRORS = /* @__PURE__ */ new Set([401, 403, 404, 410]);
6881
- if (signal == null ? void 0 : signal.aborted) throw new DOMException("Aborted", "AbortError");
7746
+ if (signal?.aborted) throw new DOMException("Aborted", "AbortError");
6882
7747
  const res = await fetch(url, { signal });
6883
7748
  if (PERMANENT_ERRORS.has(res.status)) return null;
6884
7749
  if (!res.ok) throw new Error(`HTTP error ${res.status}`);
@@ -7067,128 +7932,126 @@ function simplifyLine(line, epsilon) {
7067
7932
 
7068
7933
  // src/utils/TileFeatureCollector.js
7069
7934
  var FeatureGroup = class {
7070
- identifier;
7071
- style;
7072
- layerName = "";
7073
- featureClass = "";
7074
7935
  constructor(identifier, style) {
7936
+ __publicField(this, "identifier");
7937
+ __publicField(this, "style");
7938
+ __publicField(this, "layerName", "");
7939
+ __publicField(this, "featureClass", "");
7075
7940
  this.identifier = identifier;
7076
7941
  this.style = style;
7077
7942
  }
7078
7943
  };
7079
7944
  var LineGroup = class extends FeatureGroup {
7080
- lines = [];
7945
+ constructor() {
7946
+ super(...arguments);
7947
+ __publicField(this, "lines", []);
7948
+ }
7081
7949
  };
7082
7950
  var PolygonGroup = class extends FeatureGroup {
7083
- features = [];
7951
+ constructor() {
7952
+ super(...arguments);
7953
+ __publicField(this, "features", []);
7954
+ }
7084
7955
  };
7085
7956
  var GeomType = Object.freeze({ UNKNOWN: 0, POINT: 1, LINESTRING: 2, POLYGON: 3 });
7086
- var TileFeatureCollector = class _TileFeatureCollector {
7087
- static unknownSet = /* @__PURE__ */ new Set();
7088
- #mapconfig = null;
7089
- #positionXY = null;
7957
+ var _mapconfig, _positionXY, _TileFeatureCollector_instances, collectLine_fn, segmentLine_fn, collectPolygon_fn, normalizeRing_fn, resolveStyle_fn, getOrCreate_fn;
7958
+ var _TileFeatureCollector = class _TileFeatureCollector {
7090
7959
  constructor(positionXY, mapconfig) {
7091
- this.#positionXY = positionXY;
7092
- this.#mapconfig = mapconfig;
7960
+ __privateAdd(this, _TileFeatureCollector_instances);
7961
+ __privateAdd(this, _mapconfig, null);
7962
+ __privateAdd(this, _positionXY, null);
7963
+ __privateSet(this, _positionXY, positionXY);
7964
+ __privateSet(this, _mapconfig, mapconfig);
7093
7965
  }
7094
7966
  collect(protoTile) {
7095
7967
  const lineGroups = [];
7096
7968
  const polygonGroups = [];
7097
7969
  for (const layer of protoTile.layers) {
7098
- const scale = 1 / layer.extent * this.#mapconfig.tileWorldSize;
7970
+ const scale = 1 / layer.extent * __privateGet(this, _mapconfig).tileWorldSize;
7099
7971
  for (const feature of layer.features) {
7100
7972
  switch (feature.type) {
7101
7973
  case GeomType.LINESTRING:
7102
- this.#collectLine(layer, feature, scale, lineGroups);
7974
+ __privateMethod(this, _TileFeatureCollector_instances, collectLine_fn).call(this, layer, feature, scale, lineGroups);
7103
7975
  break;
7104
7976
  case GeomType.POLYGON:
7105
- this.#collectPolygon(layer, feature, scale, polygonGroups);
7977
+ __privateMethod(this, _TileFeatureCollector_instances, collectPolygon_fn).call(this, layer, feature, scale, polygonGroups);
7106
7978
  break;
7107
7979
  }
7108
7980
  }
7109
7981
  }
7110
7982
  return { lineGroups, polygonGroups };
7111
7983
  }
7112
- #collectLine(layer, feature, scale, lineGroups) {
7113
- const featureClass = feature.properties.get("class");
7114
- const style = this.#resolveStyle(layer.name, featureClass);
7115
- if (!(style == null ? void 0 : style.isVisible)) return;
7116
- const [tileX, tileY] = this.#positionXY;
7117
- const group = this.#getOrCreate(
7118
- LineGroup,
7119
- `${layer.name}::${featureClass}`,
7120
- style,
7121
- layer.name,
7122
- featureClass,
7123
- lineGroups
7124
- );
7125
- for (const rawLine of parseGeometry(feature.geometry))
7126
- group.lines.push(this.#segmentLine(rawLine, scale, tileX, tileY));
7127
- }
7128
- #segmentLine(rawLine, scale, tileX, tileY) {
7129
- const simplified = simplifyLine(rawLine, 2);
7130
- const out = new Float32Array(simplified.length);
7131
- for (let i = 0; i < simplified.length; i += 2) {
7132
- out[i] = simplified[i] * scale + tileX;
7133
- out[i + 1] = simplified[i + 1] * scale + tileY;
7134
- }
7135
- return out;
7136
- }
7137
- #collectPolygon(layer, feature, scale, polygonGroups) {
7138
- const featureClass = feature.properties.get("class") ?? layer.name;
7139
- const style = this.#resolveStyle(layer.name, featureClass);
7140
- if (!(style == null ? void 0 : style.isVisible)) return;
7141
- const [tileX, tileY] = this.#positionXY;
7142
- const group = this.#getOrCreate(
7143
- PolygonGroup,
7144
- `${layer.name}::${featureClass}`,
7145
- style,
7146
- layer.name,
7147
- featureClass,
7148
- polygonGroups
7149
- );
7150
- const rings = parseGeometry(feature.geometry).map((ring) => this.#normalizeRing(ring, scale, tileX, tileY));
7151
- group.features.push({ rings, properties: feature.properties });
7984
+ };
7985
+ _mapconfig = new WeakMap();
7986
+ _positionXY = new WeakMap();
7987
+ _TileFeatureCollector_instances = new WeakSet();
7988
+ collectLine_fn = function(layer, feature, scale, lineGroups) {
7989
+ const featureClass = feature.properties.get("class");
7990
+ const style = __privateMethod(this, _TileFeatureCollector_instances, resolveStyle_fn).call(this, layer.name, featureClass);
7991
+ if (!style?.isVisible) return;
7992
+ const [tileX, tileY] = __privateGet(this, _positionXY);
7993
+ const group = __privateMethod(this, _TileFeatureCollector_instances, getOrCreate_fn).call(this, LineGroup, `${layer.name}::${featureClass}`, style, layer.name, featureClass, lineGroups);
7994
+ for (const rawLine of parseGeometry(feature.geometry))
7995
+ group.lines.push(__privateMethod(this, _TileFeatureCollector_instances, segmentLine_fn).call(this, rawLine, scale, tileX, tileY));
7996
+ };
7997
+ segmentLine_fn = function(rawLine, scale, tileX, tileY) {
7998
+ const simplified = simplifyLine(rawLine, 2);
7999
+ const out = new Float32Array(simplified.length);
8000
+ for (let i = 0; i < simplified.length; i += 2) {
8001
+ out[i] = simplified[i] * scale + tileX;
8002
+ out[i + 1] = simplified[i + 1] * scale + tileY;
7152
8003
  }
7153
- #normalizeRing(rawRing, scale, tileX, tileY) {
7154
- const out = new Float32Array(rawRing.length);
7155
- for (let i = 0; i < rawRing.length; i += 2) {
7156
- out[i] = rawRing[i] * scale + tileX;
7157
- out[i + 1] = rawRing[i + 1] * scale + tileY;
7158
- }
7159
- return out;
8004
+ return out;
8005
+ };
8006
+ collectPolygon_fn = function(layer, feature, scale, polygonGroups) {
8007
+ const featureClass = feature.properties.get("class") ?? layer.name;
8008
+ const style = __privateMethod(this, _TileFeatureCollector_instances, resolveStyle_fn).call(this, layer.name, featureClass);
8009
+ if (!style?.isVisible) return;
8010
+ const [tileX, tileY] = __privateGet(this, _positionXY);
8011
+ const group = __privateMethod(this, _TileFeatureCollector_instances, getOrCreate_fn).call(this, PolygonGroup, `${layer.name}::${featureClass}`, style, layer.name, featureClass, polygonGroups);
8012
+ const rings = parseGeometry(feature.geometry).map((ring) => __privateMethod(this, _TileFeatureCollector_instances, normalizeRing_fn).call(this, ring, scale, tileX, tileY));
8013
+ group.features.push({ rings, properties: feature.properties });
8014
+ };
8015
+ normalizeRing_fn = function(rawRing, scale, tileX, tileY) {
8016
+ const out = new Float32Array(rawRing.length);
8017
+ for (let i = 0; i < rawRing.length; i += 2) {
8018
+ out[i] = rawRing[i] * scale + tileX;
8019
+ out[i + 1] = rawRing[i + 1] * scale + tileY;
7160
8020
  }
7161
- #resolveStyle(layerName, featureClass) {
7162
- if (layerName === "landuse") {
7163
- if (featureClass === "grass" || featureClass === "park") {
7164
- layerName = "landcover";
7165
- }
7166
- }
7167
- if (featureClass === "grass" && layerName === "landuse") {
8021
+ return out;
8022
+ };
8023
+ resolveStyle_fn = function(layerName, featureClass) {
8024
+ if (layerName === "landuse") {
8025
+ if (featureClass === "grass" || featureClass === "park") {
7168
8026
  layerName = "landcover";
7169
8027
  }
7170
- const styleLayer = this.#mapconfig.mapStyle.getStyleLayerByName(layerName);
7171
- if (!styleLayer) {
7172
- _TileFeatureCollector.unknownSet.add(`[no layer] ${featureClass}/${layerName}`);
7173
- return null;
7174
- }
7175
- const style = styleLayer.getTypeByName ? styleLayer.getTypeByName(featureClass) : styleLayer;
7176
- if (!style) {
7177
- _TileFeatureCollector.unknownSet.add(`[no type] ${featureClass}/${layerName}`);
7178
- }
7179
- return style ?? null;
7180
8028
  }
7181
- #getOrCreate(GroupClass, key, style, layerName, featureClass, list) {
7182
- let group = list.find((g) => g.identifier === key);
7183
- if (!group) {
7184
- group = new GroupClass(key, style);
7185
- group.layerName = layerName;
7186
- group.featureClass = featureClass;
7187
- list.push(group);
7188
- }
7189
- return group;
8029
+ if (featureClass === "grass" && layerName === "landuse") {
8030
+ layerName = "landcover";
8031
+ }
8032
+ const styleLayer = __privateGet(this, _mapconfig).mapStyle.getStyleLayerByName(layerName);
8033
+ if (!styleLayer) {
8034
+ _TileFeatureCollector.unknownSet.add(`[no layer] ${featureClass}/${layerName}`);
8035
+ return null;
8036
+ }
8037
+ const style = styleLayer.getTypeByName ? styleLayer.getTypeByName(featureClass) : styleLayer;
8038
+ if (!style) {
8039
+ _TileFeatureCollector.unknownSet.add(`[no type] ${featureClass}/${layerName}`);
7190
8040
  }
8041
+ return style ?? null;
7191
8042
  };
8043
+ getOrCreate_fn = function(GroupClass, key, style, layerName, featureClass, list) {
8044
+ let group = list.find((g) => g.identifier === key);
8045
+ if (!group) {
8046
+ group = new GroupClass(key, style);
8047
+ group.layerName = layerName;
8048
+ group.featureClass = featureClass;
8049
+ list.push(group);
8050
+ }
8051
+ return group;
8052
+ };
8053
+ __publicField(_TileFeatureCollector, "unknownSet", /* @__PURE__ */ new Set());
8054
+ var TileFeatureCollector = _TileFeatureCollector;
7192
8055
 
7193
8056
  // src/geom_utils/earcut.js
7194
8057
  function earcut(data, holeIndices, dim) {
@@ -7709,372 +8572,351 @@ var TILE_BORDER_MATERIAL = new THREE9.LineBasicMaterial({
7709
8572
  transparent: true,
7710
8573
  opacity: 0.8
7711
8574
  });
8575
+ var _positionXY2, _scene, _mapconfig2, _tileData, _borderLines, _Tile_instances, buildBorderLines_fn, buildLineMeshes_fn, getOrCreate_fn2, metaFor_fn, buildPolygonMeshes_fn, buildFlatGroups_fn, buildExtrudedGroups_fn, earcutInto_fn, buildExtrudedVerts_fn, earcutFlat_fn, makeTileClippingPlanes_fn, addMesh_fn;
7712
8576
  var Tile = class {
7713
- tileMeshes = [];
7714
- #positionXY = null;
7715
- #scene = null;
7716
- #mapconfig = null;
7717
- #tileData = null;
7718
- #borderLines = null;
7719
8577
  constructor(positionXY, tileData, scene, mapconfig) {
7720
- this.#positionXY = positionXY;
7721
- this.#scene = scene;
7722
- this.#mapconfig = mapconfig;
7723
- this.#tileData = tileData;
8578
+ __privateAdd(this, _Tile_instances);
8579
+ __publicField(this, "tileMeshes", []);
8580
+ __privateAdd(this, _positionXY2, null);
8581
+ __privateAdd(this, _scene, null);
8582
+ __privateAdd(this, _mapconfig2, null);
8583
+ __privateAdd(this, _tileData, null);
8584
+ __privateAdd(this, _borderLines, null);
8585
+ __privateSet(this, _positionXY2, positionXY);
8586
+ __privateSet(this, _scene, scene);
8587
+ __privateSet(this, _mapconfig2, mapconfig);
8588
+ __privateSet(this, _tileData, tileData);
7724
8589
  }
7725
8590
  async render() {
7726
8591
  let protoTile;
7727
8592
  try {
7728
- protoTile = deserializeMVT(this.#tileData);
8593
+ protoTile = deserializeMVT(__privateGet(this, _tileData));
7729
8594
  } catch (err) {
7730
8595
  console.error("ThreeGeoPlay: deserialization error:", err);
7731
8596
  return;
7732
8597
  }
7733
- const collector = new TileFeatureCollector(this.#positionXY, this.#mapconfig);
8598
+ const collector = new TileFeatureCollector(__privateGet(this, _positionXY2), __privateGet(this, _mapconfig2));
7734
8599
  const result = collector.collect(protoTile);
7735
8600
  if (!result) return;
7736
- this.#buildLineMeshes(result.lineGroups);
7737
- this.#buildPolygonMeshes(result.polygonGroups);
7738
- this.#buildBorderLines();
8601
+ __privateMethod(this, _Tile_instances, buildLineMeshes_fn).call(this, result.lineGroups);
8602
+ __privateMethod(this, _Tile_instances, buildPolygonMeshes_fn).call(this, result.polygonGroups);
8603
+ __privateMethod(this, _Tile_instances, buildBorderLines_fn).call(this);
7739
8604
  }
7740
8605
  updateBorderVisibility() {
7741
- if (this.#mapconfig.showTileBorders) {
7742
- if (!this.#borderLines) this.#buildBorderLines();
7743
- } else if (this.#borderLines) {
7744
- this.#scene.remove(this.#borderLines);
7745
- this.#borderLines.geometry.dispose();
7746
- this.#borderLines = null;
8606
+ if (__privateGet(this, _mapconfig2).showTileBorders) {
8607
+ if (!__privateGet(this, _borderLines)) __privateMethod(this, _Tile_instances, buildBorderLines_fn).call(this);
8608
+ } else if (__privateGet(this, _borderLines)) {
8609
+ __privateGet(this, _scene).remove(__privateGet(this, _borderLines));
8610
+ __privateGet(this, _borderLines).geometry.dispose();
8611
+ __privateSet(this, _borderLines, null);
7747
8612
  }
7748
8613
  }
7749
8614
  scaleMeshes(ratio) {
7750
- var _a;
7751
8615
  for (const mesh of this.tileMeshes) mesh.scale.multiplyScalar(ratio);
7752
- (_a = this.#borderLines) == null ? void 0 : _a.scale.multiplyScalar(ratio);
8616
+ __privateGet(this, _borderLines)?.scale.multiplyScalar(ratio);
7753
8617
  }
7754
8618
  refreshMaterials() {
7755
- var _a;
7756
8619
  for (const mesh of this.tileMeshes) {
7757
8620
  const { featureClass, isOutline, layerName } = mesh.userData;
7758
8621
  if (!featureClass) continue;
7759
- const style = (_a = this.#mapconfig.mapStyle.getStyleLayerByName(layerName)) == null ? void 0 : _a.getTypeByName(featureClass);
8622
+ const style = __privateGet(this, _mapconfig2).mapStyle.getStyleLayerByName(layerName)?.getTypeByName(featureClass);
7760
8623
  if (!style) continue;
7761
8624
  mesh.material = isOutline ? style.outlineMaterial : style.material;
7762
8625
  }
7763
8626
  }
7764
8627
  destroy() {
7765
- var _a;
7766
8628
  for (const mesh of this.tileMeshes) {
7767
- this.#scene.remove(mesh);
7768
- (_a = mesh.geometry) == null ? void 0 : _a.dispose();
8629
+ __privateGet(this, _scene).remove(mesh);
8630
+ mesh.geometry?.dispose();
7769
8631
  }
7770
- if (this.#borderLines) {
7771
- this.#scene.remove(this.#borderLines);
7772
- this.#borderLines.geometry.dispose();
7773
- this.#borderLines = null;
8632
+ if (__privateGet(this, _borderLines)) {
8633
+ __privateGet(this, _scene).remove(__privateGet(this, _borderLines));
8634
+ __privateGet(this, _borderLines).geometry.dispose();
8635
+ __privateSet(this, _borderLines, null);
7774
8636
  }
7775
8637
  this.tileMeshes = [];
7776
8638
  }
7777
- #buildBorderLines() {
7778
- const [wx, wz] = this.#positionXY;
7779
- const size = this.#mapconfig.tileWorldSize;
7780
- const y = 0.01;
7781
- const corners = new Float32Array([
7782
- wx,
7783
- y,
7784
- wz,
7785
- wx + size,
7786
- y,
7787
- wz,
7788
- wx + size,
7789
- y,
7790
- wz + size,
7791
- wx,
7792
- y,
7793
- wz + size,
7794
- wx,
7795
- y,
7796
- wz
7797
- ]);
7798
- const geo = new THREE9.BufferGeometry();
7799
- geo.setAttribute("position", new THREE9.BufferAttribute(corners, 3));
7800
- this.#borderLines = new THREE9.Line(geo, TILE_BORDER_MATERIAL);
7801
- this.#borderLines.visible = this.#mapconfig.showTileBorders;
7802
- this.#scene.add(this.#borderLines);
7803
- }
7804
- #buildLineMeshes(lineGroups) {
7805
- if (lineGroups.length === 0) return;
7806
- const tileSize = this.#mapconfig.tileWorldSize;
7807
- const zoomScale = this.#mapconfig.zoomScaleFactor;
7808
- const transportationLayer = this.#mapconfig.mapStyle.getStyleLayerByName("transportation");
7809
- const jointSegs = transportationLayer.generalConfig.jointSegments;
7810
- const outlineVerts = /* @__PURE__ */ new Map();
7811
- const fillVerts = /* @__PURE__ */ new Map();
7812
- for (const group of lineGroups) {
7813
- const { style, layerName, lines } = group;
7814
- if (!style.isVisible) continue;
7815
- const lineWidth = style.lineWidth * tileSize * zoomScale;
7816
- const roadY = style.YOrder;
7817
- const outlineWidth = layerName === "transportation" ? transportationLayer.resolveOutlineWidth(style) : style.outlineWidth ?? 0;
7818
- if (outlineWidth > 0) {
7819
- const borderWidth = lineWidth + outlineWidth * tileSize * zoomScale;
7820
- const fillArr = this.#getOrCreate(fillVerts, style.material);
7821
- const outlineArr = this.#getOrCreate(outlineVerts, style.outlineMaterial);
7822
- for (const line of lines)
7823
- transformLineToAccumulators(line, lineWidth, borderWidth, jointSegs, fillArr, outlineArr, roadY, roadY - 0.01);
7824
- } else {
7825
- const fillArr = this.#getOrCreate(fillVerts, style.material);
7826
- for (const line of lines) {
7827
- for (const poly of transformLineInPolygon(line, lineWidth, jointSegs)) {
7828
- const n = poly.length / 2;
7829
- const x0 = poly[0], z0 = poly[1];
7830
- for (let i = 1; i < n - 1; i++) {
7831
- fillArr.push(
7832
- x0,
7833
- roadY,
7834
- z0,
7835
- poly[i * 2],
7836
- roadY,
7837
- poly[i * 2 + 1],
7838
- poly[i * 2 + 2],
7839
- roadY,
7840
- poly[i * 2 + 3]
7841
- );
7842
- }
8639
+ };
8640
+ _positionXY2 = new WeakMap();
8641
+ _scene = new WeakMap();
8642
+ _mapconfig2 = new WeakMap();
8643
+ _tileData = new WeakMap();
8644
+ _borderLines = new WeakMap();
8645
+ _Tile_instances = new WeakSet();
8646
+ buildBorderLines_fn = function() {
8647
+ const [wx, wz] = __privateGet(this, _positionXY2);
8648
+ const size = __privateGet(this, _mapconfig2).tileWorldSize;
8649
+ const y = 0.01;
8650
+ const corners = new Float32Array([
8651
+ wx,
8652
+ y,
8653
+ wz,
8654
+ wx + size,
8655
+ y,
8656
+ wz,
8657
+ wx + size,
8658
+ y,
8659
+ wz + size,
8660
+ wx,
8661
+ y,
8662
+ wz + size,
8663
+ wx,
8664
+ y,
8665
+ wz
8666
+ ]);
8667
+ const geo = new THREE9.BufferGeometry();
8668
+ geo.setAttribute("position", new THREE9.BufferAttribute(corners, 3));
8669
+ __privateSet(this, _borderLines, new THREE9.Line(geo, TILE_BORDER_MATERIAL));
8670
+ __privateGet(this, _borderLines).visible = __privateGet(this, _mapconfig2).showTileBorders;
8671
+ __privateGet(this, _scene).add(__privateGet(this, _borderLines));
8672
+ };
8673
+ buildLineMeshes_fn = function(lineGroups) {
8674
+ if (lineGroups.length === 0) return;
8675
+ const tileSize = __privateGet(this, _mapconfig2).tileWorldSize;
8676
+ const zoomScale = __privateGet(this, _mapconfig2).zoomScaleFactor;
8677
+ const transportationLayer = __privateGet(this, _mapconfig2).mapStyle.getStyleLayerByName("transportation");
8678
+ const jointSegs = transportationLayer.generalConfig.jointSegments;
8679
+ const outlineVerts = /* @__PURE__ */ new Map();
8680
+ const fillVerts = /* @__PURE__ */ new Map();
8681
+ for (const group of lineGroups) {
8682
+ const { style, layerName, lines } = group;
8683
+ if (!style.isVisible) continue;
8684
+ const lineWidth = style.lineWidth * tileSize * zoomScale;
8685
+ const roadY = style.YOrder;
8686
+ const outlineWidth = layerName === "transportation" ? transportationLayer.resolveOutlineWidth(style) : style.outlineWidth ?? 0;
8687
+ if (outlineWidth > 0) {
8688
+ const borderWidth = lineWidth + outlineWidth * tileSize * zoomScale;
8689
+ const fillArr = __privateMethod(this, _Tile_instances, getOrCreate_fn2).call(this, fillVerts, style.material);
8690
+ const outlineArr = __privateMethod(this, _Tile_instances, getOrCreate_fn2).call(this, outlineVerts, style.outlineMaterial);
8691
+ for (const line of lines)
8692
+ transformLineToAccumulators(line, lineWidth, borderWidth, jointSegs, fillArr, outlineArr, roadY, roadY - 0.01);
8693
+ } else {
8694
+ const fillArr = __privateMethod(this, _Tile_instances, getOrCreate_fn2).call(this, fillVerts, style.material);
8695
+ for (const line of lines) {
8696
+ for (const poly of transformLineInPolygon(line, lineWidth, jointSegs)) {
8697
+ const n = poly.length / 2;
8698
+ const x0 = poly[0], z0 = poly[1];
8699
+ for (let i = 1; i < n - 1; i++) {
8700
+ fillArr.push(
8701
+ x0,
8702
+ roadY,
8703
+ z0,
8704
+ poly[i * 2],
8705
+ roadY,
8706
+ poly[i * 2 + 1],
8707
+ poly[i * 2 + 2],
8708
+ roadY,
8709
+ poly[i * 2 + 3]
8710
+ );
7843
8711
  }
7844
8712
  }
7845
8713
  }
7846
8714
  }
7847
- for (const [mat, verts] of outlineVerts)
7848
- this.#addMesh(
7849
- vertsToGeometry(verts),
7850
- mat,
7851
- this.#metaFor(mat, lineGroups, true, "featureClass"),
7852
- this.#metaFor(mat, lineGroups, true, "layerName"),
7853
- true
7854
- );
7855
- for (const [mat, verts] of fillVerts)
7856
- this.#addMesh(
7857
- vertsToGeometry(verts),
7858
- mat,
7859
- this.#metaFor(mat, lineGroups, false, "featureClass"),
7860
- this.#metaFor(mat, lineGroups, false, "layerName"),
7861
- false
7862
- );
7863
8715
  }
7864
- #getOrCreate(map, material) {
7865
- if (!map.has(material)) map.set(material, []);
7866
- return map.get(material);
7867
- }
7868
- #metaFor(mat, groups, isOutline, field) {
7869
- for (const g of groups)
7870
- if ((isOutline ? g.style.outlineMaterial : g.style.material) === mat)
7871
- return g[field];
7872
- return "";
7873
- }
7874
- #buildPolygonMeshes(polygonGroups) {
7875
- if (polygonGroups.length === 0) return;
7876
- const [tileX, tileY] = this.#positionXY;
7877
- const tileSize = this.#mapconfig.tileWorldSize;
7878
- const clippingPlanes = this.#makeTileClippingPlanes(tileX, tileY, tileSize);
7879
- const flatGroups = [];
7880
- const extrudedGroups = [];
7881
- for (const group of polygonGroups) {
7882
- if (group.layerName == "transportation") {
7883
- continue;
7884
- }
7885
- if (!group.style.isVisible) continue;
7886
- if (!group.style.material) {
7887
- console.warn(`ThreeGeoPlay: material undefined for ${group.featureClass}/${group.layerName}`);
7888
- continue;
7889
- }
7890
- const isBuilding = group.style.material.transparent && group.style.height != null;
7891
- (isBuilding ? extrudedGroups : flatGroups).push(group);
7892
- }
7893
- this.#buildFlatGroups(flatGroups);
7894
- this.#buildExtrudedGroups(extrudedGroups, clippingPlanes);
7895
- }
7896
- #buildFlatGroups(flatGroups) {
7897
- if (flatGroups.length === 0) return;
7898
- const accumByMat = /* @__PURE__ */ new Map();
7899
- for (const { style, layerName, featureClass, features } of flatGroups) {
7900
- if (!style.isVisible) continue;
7901
- if (!accumByMat.has(style.material))
7902
- accumByMat.set(style.material, { verts: [], featureClass, layerName });
7903
- const { verts } = accumByMat.get(style.material);
7904
- const y = style.YOrder ?? 0;
7905
- for (const { rings } of features) {
7906
- if (rings.length === 0 || rings[0].length < 6) continue;
7907
- this.#earcutInto(rings, verts, y);
7908
- }
7909
- }
7910
- for (const [mat, { verts, featureClass, layerName }] of accumByMat) {
7911
- if (verts.length === 0) continue;
7912
- this.#addMesh(vertsToGeometry(verts), mat, featureClass, layerName, false);
7913
- }
7914
- }
7915
- #buildExtrudedGroups(extrudedGroups, clippingPlanes) {
7916
- if (extrudedGroups.length === 0) return;
7917
- const tileSize = this.#mapconfig.tileWorldSize;
7918
- const accumByMat = /* @__PURE__ */ new Map();
7919
- for (const { style, layerName, featureClass, features } of extrudedGroups) {
7920
- if (!style.isVisible) continue;
7921
- if (!accumByMat.has(style.material)) {
7922
- const clonedMat = style.material.clone();
7923
- clonedMat.clippingPlanes = clippingPlanes;
7924
- accumByMat.set(style.material, { verts: [], clonedMat, featureClass, layerName });
7925
- }
7926
- const { verts } = accumByMat.get(style.material);
7927
- const extrusionScale = (style.height ?? 0.05) * tileSize;
7928
- const baseYOrder = style.YOrder ?? 0;
7929
- for (const { rings, properties } of features) {
7930
- if (rings.length === 0 || rings[0].length < 6) continue;
7931
- const renderHeight = properties.get("render_height") ?? 10;
7932
- const renderMinHeight = properties.get("render_min_height") ?? 0;
7933
- const yTop = baseYOrder + Math.max(0, renderHeight) * extrusionScale;
7934
- const yBase = baseYOrder + Math.max(0, renderMinHeight) * extrusionScale;
7935
- this.#buildExtrudedVerts(rings, yBase, yTop, verts);
7936
- }
7937
- }
7938
- for (const [, { verts, clonedMat, featureClass, layerName }] of accumByMat) {
7939
- if (verts.length === 0) {
7940
- clonedMat.dispose();
7941
- continue;
7942
- }
7943
- this.#addMesh(vertsToGeometry(verts), clonedMat, featureClass, layerName, false);
7944
- }
7945
- }
7946
- #earcutInto(rings, verts, y) {
7947
- let flat, holeIndices;
7948
- if (rings.length === 1) {
7949
- flat = rings[0];
7950
- holeIndices = null;
7951
- } else {
7952
- holeIndices = [];
7953
- let totalLen = rings[0].length;
7954
- for (let i = 1; i < rings.length; i++) {
7955
- holeIndices.push(totalLen / 2);
7956
- totalLen += rings[i].length;
7957
- }
7958
- flat = new Float32Array(totalLen);
7959
- let off = 0;
7960
- for (const ring of rings) {
7961
- flat.set(ring, off);
7962
- off += ring.length;
7963
- }
7964
- }
7965
- const indices = earcut(flat, holeIndices, 2);
7966
- for (const idx of indices) verts.push(flat[idx * 2], y, flat[idx * 2 + 1]);
7967
- }
7968
- #buildExtrudedVerts(rings, yBase, yTop, verts) {
7969
- const { flat, indices } = this.#earcutFlat(rings);
7970
- for (let i = 0; i < indices.length; i += 3) {
7971
- const a = indices[i] * 2, b = indices[i + 1] * 2, c = indices[i + 2] * 2;
7972
- verts.push(flat[c], yTop, flat[c + 1]);
7973
- verts.push(flat[b], yTop, flat[b + 1]);
7974
- verts.push(flat[a], yTop, flat[a + 1]);
8716
+ for (const [mat, verts] of outlineVerts)
8717
+ __privateMethod(this, _Tile_instances, addMesh_fn).call(this, vertsToGeometry(verts), mat, __privateMethod(this, _Tile_instances, metaFor_fn).call(this, mat, lineGroups, true, "featureClass"), __privateMethod(this, _Tile_instances, metaFor_fn).call(this, mat, lineGroups, true, "layerName"), true);
8718
+ for (const [mat, verts] of fillVerts)
8719
+ __privateMethod(this, _Tile_instances, addMesh_fn).call(this, vertsToGeometry(verts), mat, __privateMethod(this, _Tile_instances, metaFor_fn).call(this, mat, lineGroups, false, "featureClass"), __privateMethod(this, _Tile_instances, metaFor_fn).call(this, mat, lineGroups, false, "layerName"), false);
8720
+ };
8721
+ getOrCreate_fn2 = function(map, material) {
8722
+ if (!map.has(material)) map.set(material, []);
8723
+ return map.get(material);
8724
+ };
8725
+ metaFor_fn = function(mat, groups, isOutline, field) {
8726
+ for (const g of groups)
8727
+ if ((isOutline ? g.style.outlineMaterial : g.style.material) === mat)
8728
+ return g[field];
8729
+ return "";
8730
+ };
8731
+ buildPolygonMeshes_fn = function(polygonGroups) {
8732
+ if (polygonGroups.length === 0) return;
8733
+ const [tileX, tileY] = __privateGet(this, _positionXY2);
8734
+ const tileSize = __privateGet(this, _mapconfig2).tileWorldSize;
8735
+ const clippingPlanes = __privateMethod(this, _Tile_instances, makeTileClippingPlanes_fn).call(this, tileX, tileY, tileSize);
8736
+ const flatGroups = [];
8737
+ const extrudedGroups = [];
8738
+ for (const group of polygonGroups) {
8739
+ if (group.layerName == "transportation") {
8740
+ continue;
7975
8741
  }
7976
- for (const ring of rings) {
7977
- const n = ring.length / 2;
7978
- for (let i = 0; i < n; i++) {
7979
- const j = (i + 1) % n;
7980
- const x0 = ring[i * 2], z0 = ring[i * 2 + 1];
7981
- const x1 = ring[j * 2], z1 = ring[j * 2 + 1];
7982
- verts.push(x0, yTop, z0, x1, yBase, z1, x0, yBase, z0);
7983
- verts.push(x0, yTop, z0, x1, yTop, z1, x1, yBase, z1);
7984
- }
8742
+ if (!group.style.isVisible) continue;
8743
+ if (!group.style.material) {
8744
+ console.warn(`ThreeGeoPlay: material undefined for ${group.featureClass}/${group.layerName}`);
8745
+ continue;
8746
+ }
8747
+ const isBuilding = group.style.material.transparent && group.style.height != null;
8748
+ (isBuilding ? extrudedGroups : flatGroups).push(group);
8749
+ }
8750
+ __privateMethod(this, _Tile_instances, buildFlatGroups_fn).call(this, flatGroups);
8751
+ __privateMethod(this, _Tile_instances, buildExtrudedGroups_fn).call(this, extrudedGroups, clippingPlanes);
8752
+ };
8753
+ buildFlatGroups_fn = function(flatGroups) {
8754
+ if (flatGroups.length === 0) return;
8755
+ const accumByMat = /* @__PURE__ */ new Map();
8756
+ for (const { style, layerName, featureClass, features } of flatGroups) {
8757
+ if (!style.isVisible) continue;
8758
+ if (!accumByMat.has(style.material))
8759
+ accumByMat.set(style.material, { verts: [], featureClass, layerName });
8760
+ const { verts } = accumByMat.get(style.material);
8761
+ const y = style.YOrder ?? 0;
8762
+ for (const { rings } of features) {
8763
+ if (rings.length === 0 || rings[0].length < 6) continue;
8764
+ __privateMethod(this, _Tile_instances, earcutInto_fn).call(this, rings, verts, y);
8765
+ }
8766
+ }
8767
+ for (const [mat, { verts, featureClass, layerName }] of accumByMat) {
8768
+ if (verts.length === 0) continue;
8769
+ __privateMethod(this, _Tile_instances, addMesh_fn).call(this, vertsToGeometry(verts), mat, featureClass, layerName, false);
8770
+ }
8771
+ };
8772
+ buildExtrudedGroups_fn = function(extrudedGroups, clippingPlanes) {
8773
+ if (extrudedGroups.length === 0) return;
8774
+ const tileSize = __privateGet(this, _mapconfig2).tileWorldSize;
8775
+ const accumByMat = /* @__PURE__ */ new Map();
8776
+ for (const { style, layerName, featureClass, features } of extrudedGroups) {
8777
+ if (!style.isVisible) continue;
8778
+ if (!accumByMat.has(style.material)) {
8779
+ const clonedMat = style.material.clone();
8780
+ clonedMat.clippingPlanes = clippingPlanes;
8781
+ accumByMat.set(style.material, { verts: [], clonedMat, featureClass, layerName });
8782
+ }
8783
+ const { verts } = accumByMat.get(style.material);
8784
+ const extrusionScale = (style.height ?? 0.05) * tileSize;
8785
+ const baseYOrder = style.YOrder ?? 0;
8786
+ for (const { rings, properties } of features) {
8787
+ if (rings.length === 0 || rings[0].length < 6) continue;
8788
+ const renderHeight = properties.get("render_height") ?? 10;
8789
+ const renderMinHeight = properties.get("render_min_height") ?? 0;
8790
+ const yTop = baseYOrder + Math.max(0, renderHeight) * extrusionScale;
8791
+ const yBase = baseYOrder + Math.max(0, renderMinHeight) * extrusionScale;
8792
+ __privateMethod(this, _Tile_instances, buildExtrudedVerts_fn).call(this, rings, yBase, yTop, verts);
8793
+ }
8794
+ }
8795
+ for (const [, { verts, clonedMat, featureClass, layerName }] of accumByMat) {
8796
+ if (verts.length === 0) {
8797
+ clonedMat.dispose();
8798
+ continue;
7985
8799
  }
8800
+ __privateMethod(this, _Tile_instances, addMesh_fn).call(this, vertsToGeometry(verts), clonedMat, featureClass, layerName, false);
7986
8801
  }
7987
- #earcutFlat(rings) {
7988
- if (rings.length === 1)
7989
- return { flat: rings[0], indices: earcut(rings[0], null, 2) };
7990
- const holeIndices = [];
8802
+ };
8803
+ earcutInto_fn = function(rings, verts, y) {
8804
+ let flat, holeIndices;
8805
+ if (rings.length === 1) {
8806
+ flat = rings[0];
8807
+ holeIndices = null;
8808
+ } else {
8809
+ holeIndices = [];
7991
8810
  let totalLen = rings[0].length;
7992
8811
  for (let i = 1; i < rings.length; i++) {
7993
8812
  holeIndices.push(totalLen / 2);
7994
8813
  totalLen += rings[i].length;
7995
8814
  }
7996
- const flat = new Float32Array(totalLen);
8815
+ flat = new Float32Array(totalLen);
7997
8816
  let off = 0;
7998
8817
  for (const ring of rings) {
7999
8818
  flat.set(ring, off);
8000
8819
  off += ring.length;
8001
8820
  }
8002
- return { flat, indices: earcut(flat, holeIndices, 2) };
8003
8821
  }
8004
- #makeTileClippingPlanes(tileX, tileY, size) {
8005
- const corners = [
8006
- new THREE9.Vector3(tileX, 0, tileY + size),
8007
- new THREE9.Vector3(tileX + size, 0, tileY + size),
8008
- new THREE9.Vector3(tileX + size, 0, tileY),
8009
- new THREE9.Vector3(tileX, 0, tileY)
8010
- ];
8011
- const up = new THREE9.Vector3(0, 1, 0);
8012
- return corners.map((a, i) => {
8013
- const b = corners[(i + 1) % 4];
8014
- const edge = new THREE9.Vector3().subVectors(b, a);
8015
- const normal = new THREE9.Vector3().crossVectors(edge, up).normalize().negate();
8016
- return new THREE9.Plane().setFromNormalAndCoplanarPoint(normal, a);
8017
- });
8018
- }
8019
- #addMesh(geometry, material, featureClass, layerName, isOutline) {
8020
- const mesh = new THREE9.Mesh(geometry, material);
8021
- mesh.userData.featureClass = featureClass;
8022
- mesh.userData.layerName = layerName;
8023
- mesh.userData.isOutline = isOutline;
8024
- this.tileMeshes.push(mesh);
8025
- this.#scene.add(mesh);
8822
+ const indices = earcut(flat, holeIndices, 2);
8823
+ for (const idx of indices) verts.push(flat[idx * 2], y, flat[idx * 2 + 1]);
8824
+ };
8825
+ buildExtrudedVerts_fn = function(rings, yBase, yTop, verts) {
8826
+ const { flat, indices } = __privateMethod(this, _Tile_instances, earcutFlat_fn).call(this, rings);
8827
+ for (let i = 0; i < indices.length; i += 3) {
8828
+ const a = indices[i] * 2, b = indices[i + 1] * 2, c = indices[i + 2] * 2;
8829
+ verts.push(flat[c], yTop, flat[c + 1]);
8830
+ verts.push(flat[b], yTop, flat[b + 1]);
8831
+ verts.push(flat[a], yTop, flat[a + 1]);
8832
+ }
8833
+ for (const ring of rings) {
8834
+ const n = ring.length / 2;
8835
+ for (let i = 0; i < n; i++) {
8836
+ const j = (i + 1) % n;
8837
+ const x0 = ring[i * 2], z0 = ring[i * 2 + 1];
8838
+ const x1 = ring[j * 2], z1 = ring[j * 2 + 1];
8839
+ verts.push(x0, yTop, z0, x1, yBase, z1, x0, yBase, z0);
8840
+ verts.push(x0, yTop, z0, x1, yTop, z1, x1, yBase, z1);
8841
+ }
8026
8842
  }
8027
8843
  };
8844
+ earcutFlat_fn = function(rings) {
8845
+ if (rings.length === 1)
8846
+ return { flat: rings[0], indices: earcut(rings[0], null, 2) };
8847
+ const holeIndices = [];
8848
+ let totalLen = rings[0].length;
8849
+ for (let i = 1; i < rings.length; i++) {
8850
+ holeIndices.push(totalLen / 2);
8851
+ totalLen += rings[i].length;
8852
+ }
8853
+ const flat = new Float32Array(totalLen);
8854
+ let off = 0;
8855
+ for (const ring of rings) {
8856
+ flat.set(ring, off);
8857
+ off += ring.length;
8858
+ }
8859
+ return { flat, indices: earcut(flat, holeIndices, 2) };
8860
+ };
8861
+ makeTileClippingPlanes_fn = function(tileX, tileY, size) {
8862
+ const corners = [
8863
+ new THREE9.Vector3(tileX, 0, tileY + size),
8864
+ new THREE9.Vector3(tileX + size, 0, tileY + size),
8865
+ new THREE9.Vector3(tileX + size, 0, tileY),
8866
+ new THREE9.Vector3(tileX, 0, tileY)
8867
+ ];
8868
+ const up = new THREE9.Vector3(0, 1, 0);
8869
+ return corners.map((a, i) => {
8870
+ const b = corners[(i + 1) % 4];
8871
+ const edge = new THREE9.Vector3().subVectors(b, a);
8872
+ const normal = new THREE9.Vector3().crossVectors(edge, up).normalize().negate();
8873
+ return new THREE9.Plane().setFromNormalAndCoplanarPoint(normal, a);
8874
+ });
8875
+ };
8876
+ addMesh_fn = function(geometry, material, featureClass, layerName, isOutline) {
8877
+ const mesh = new THREE9.Mesh(geometry, material);
8878
+ mesh.userData.featureClass = featureClass;
8879
+ mesh.userData.layerName = layerName;
8880
+ mesh.userData.isOutline = isOutline;
8881
+ this.tileMeshes.push(mesh);
8882
+ __privateGet(this, _scene).add(mesh);
8883
+ };
8028
8884
 
8029
8885
  // src/map/TileManager.js
8030
8886
  var THREE10 = __toESM(require("three"));
8887
+ var _mapConfig, _originLatLon2, _zoomLevel2, _tileProviderUrl, _originTileX, _originTileY, _scene2, _subTileOffsetX, _subTileOffsetY, _lastCenterTileX, _lastCenterTileY, _lastTileWorldSize, _doneTiles, _pendingTiles, _fetchQueue, _activeFetches, _maxConcurrentFetches, _groundMesh, _TileManager_instances, initGroundMesh_fn, updateGroundMesh_fn, applyCenter_fn, drainQueue_fn, fetchTile_fn;
8031
8888
  var TileManager = class {
8032
- #mapConfig = null;
8033
- #originLatLon = null;
8034
- #zoomLevel = null;
8035
- #tileProviderUrl = null;
8036
- #originTileX = null;
8037
- #originTileY = null;
8038
- #scene = null;
8039
- #subTileOffsetX = 0;
8040
- #subTileOffsetY = 0;
8041
- #lastCenterTileX = null;
8042
- #lastCenterTileY = null;
8043
- #lastTileWorldSize = null;
8044
- #doneTiles = /* @__PURE__ */ new Map();
8045
- #pendingTiles = /* @__PURE__ */ new Map();
8046
- #fetchQueue = [];
8047
- #activeFetches = 0;
8048
- #maxConcurrentFetches = 100;
8049
- #groundMesh = null;
8050
8889
  constructor(mapConfig, scene) {
8051
- this.#mapConfig = mapConfig;
8052
- this.#originLatLon = mapConfig.originLatLon;
8053
- this.#zoomLevel = mapConfig.zoomLevel;
8054
- this.#tileProviderUrl = mapConfig.pbfTileProviderZXYurl;
8055
- this.#scene = scene;
8056
- this.#lastTileWorldSize = mapConfig.tileWorldSize;
8057
- this.#initGroundMesh();
8058
- }
8059
- #initGroundMesh() {
8060
- const style = this.#mapConfig.mapStyle.getStyleLayerByName("background");
8061
- const material = style == null ? void 0 : style.material;
8062
- const geo = new THREE10.PlaneGeometry(1, 1);
8063
- this.#groundMesh = new THREE10.Mesh(geo, material);
8064
- this.#groundMesh.rotation.x = -Math.PI / 2;
8065
- this.#groundMesh.position.y = (style == null ? void 0 : style.YOrder) ?? 0;
8066
- this.#scene.add(this.#groundMesh);
8067
- }
8068
- #updateGroundMesh(centerWorldX, centerWorldZ) {
8069
- if (!this.#groundMesh) return;
8070
- const size = (this.#mapConfig.renderDistance * 2 + 1) * this.#mapConfig.tileWorldSize;
8071
- this.#groundMesh.scale.set(size, size, 1);
8072
- this.#groundMesh.position.x = centerWorldX;
8073
- this.#groundMesh.position.z = centerWorldZ;
8890
+ __privateAdd(this, _TileManager_instances);
8891
+ __privateAdd(this, _mapConfig, null);
8892
+ __privateAdd(this, _originLatLon2, null);
8893
+ __privateAdd(this, _zoomLevel2, null);
8894
+ __privateAdd(this, _tileProviderUrl, null);
8895
+ __privateAdd(this, _originTileX, null);
8896
+ __privateAdd(this, _originTileY, null);
8897
+ __privateAdd(this, _scene2, null);
8898
+ __privateAdd(this, _subTileOffsetX, 0);
8899
+ __privateAdd(this, _subTileOffsetY, 0);
8900
+ __privateAdd(this, _lastCenterTileX, null);
8901
+ __privateAdd(this, _lastCenterTileY, null);
8902
+ __privateAdd(this, _lastTileWorldSize, null);
8903
+ __privateAdd(this, _doneTiles, /* @__PURE__ */ new Map());
8904
+ __privateAdd(this, _pendingTiles, /* @__PURE__ */ new Map());
8905
+ __privateAdd(this, _fetchQueue, []);
8906
+ __privateAdd(this, _activeFetches, 0);
8907
+ __privateAdd(this, _maxConcurrentFetches, 100);
8908
+ __privateAdd(this, _groundMesh, null);
8909
+ __privateSet(this, _mapConfig, mapConfig);
8910
+ __privateSet(this, _originLatLon2, mapConfig.originLatLon);
8911
+ __privateSet(this, _zoomLevel2, mapConfig.zoomLevel);
8912
+ __privateSet(this, _tileProviderUrl, mapConfig.pbfTileProviderZXYurl);
8913
+ __privateSet(this, _scene2, scene);
8914
+ __privateSet(this, _lastTileWorldSize, mapConfig.tileWorldSize);
8915
+ __privateMethod(this, _TileManager_instances, initGroundMesh_fn).call(this);
8074
8916
  }
8075
8917
  async init() {
8076
- const { lon, lat } = this.#originLatLon;
8077
- const zoom = this.#zoomLevel;
8918
+ const { lon, lat } = __privateGet(this, _originLatLon2);
8919
+ const zoom = __privateGet(this, _zoomLevel2);
8078
8920
  if (lon < -180 || lon > 180) console.warn("ThreeGeoPlay: lon out of range [-180, 180]:", lon);
8079
8921
  if (lat < -85.051129 || lat > 85.051129) console.warn("ThreeGeoPlay: lat out of range[-85.05, 85.05]:", lat);
8080
8922
  const [ox, oy] = geoToTileXY(lon, lat, zoom);
@@ -8085,278 +8927,272 @@ var TileManager = class {
8085
8927
  const maxTile = 2 ** zoom;
8086
8928
  if (ox < 0 || oy < 0) console.warn("ThreeGeoPlay: negative tile origin");
8087
8929
  if (ox >= maxTile || oy >= maxTile) console.warn("ThreeGeoPlay: tile origin out of OSM grid");
8088
- this.#originTileX = ox;
8089
- this.#originTileY = oy;
8930
+ __privateSet(this, _originTileX, ox);
8931
+ __privateSet(this, _originTileY, oy);
8090
8932
  const [fox, foy] = geoToTileXYFloat(lon, lat, zoom);
8091
- this.#subTileOffsetX = fox - ox;
8092
- this.#subTileOffsetY = foy - oy;
8093
- this.#applyCenter(ox, oy);
8933
+ __privateSet(this, _subTileOffsetX, fox - ox);
8934
+ __privateSet(this, _subTileOffsetY, foy - oy);
8935
+ __privateMethod(this, _TileManager_instances, applyCenter_fn).call(this, ox, oy);
8094
8936
  }
8095
8937
  updateCenter(lat, lon) {
8096
- const [cx, cy] = geoToTileXY(lon, lat, this.#zoomLevel);
8097
- this.#applyCenter(cx, cy);
8938
+ const [cx, cy] = geoToTileXY(lon, lat, __privateGet(this, _zoomLevel2));
8939
+ __privateMethod(this, _TileManager_instances, applyCenter_fn).call(this, cx, cy);
8098
8940
  }
8099
8941
  updateCenterFromPosition(x, z) {
8100
- const { originLatLon, tileWorldSize, zoomLevel, worldOriginOffset: offset } = this.#mapConfig;
8942
+ const { originLatLon, tileWorldSize, zoomLevel, worldOriginOffset: offset } = __privateGet(this, _mapConfig);
8101
8943
  const [ox, oy] = geoToTileXY(originLatLon.lon, originLatLon.lat, zoomLevel);
8102
8944
  const cx = Math.floor(ox + (x - offset.x) / tileWorldSize);
8103
8945
  const cy = Math.floor(oy + (z - offset.z) / tileWorldSize);
8104
- if (cx === this.#lastCenterTileX && cy === this.#lastCenterTileY) return;
8105
- this.#lastCenterTileX = cx;
8106
- this.#lastCenterTileY = cy;
8107
- this.#applyCenter(cx, cy);
8946
+ if (cx === __privateGet(this, _lastCenterTileX) && cy === __privateGet(this, _lastCenterTileY)) return;
8947
+ __privateSet(this, _lastCenterTileX, cx);
8948
+ __privateSet(this, _lastCenterTileY, cy);
8949
+ __privateMethod(this, _TileManager_instances, applyCenter_fn).call(this, cx, cy);
8108
8950
  }
8109
8951
  updateBorders() {
8110
- var _a;
8111
- for (const [, entry] of this.#doneTiles) {
8112
- (_a = entry.tile) == null ? void 0 : _a.updateBorderVisibility();
8952
+ for (const [, entry] of __privateGet(this, _doneTiles)) {
8953
+ entry.tile?.updateBorderVisibility();
8113
8954
  }
8114
8955
  }
8115
8956
  rescaleTiles(newSize) {
8116
- var _a;
8117
- if (!this.#lastTileWorldSize || this.#lastTileWorldSize === newSize) return;
8118
- const ratio = newSize / this.#lastTileWorldSize;
8119
- for (const [, entry] of this.#doneTiles) {
8120
- (_a = entry.tile) == null ? void 0 : _a.scaleMeshes(ratio);
8121
- }
8122
- this.#lastTileWorldSize = newSize;
8123
- if (this.#lastCenterTileX !== null) {
8124
- const offset = this.#mapConfig.worldOriginOffset;
8125
- const dx = this.#lastCenterTileX - this.#originTileX;
8126
- const dy = this.#lastCenterTileY - this.#originTileY;
8127
- const cx = (dx - this.#subTileOffsetX) * newSize + offset.x;
8128
- const cz = (dy - this.#subTileOffsetY) * newSize + offset.z;
8129
- this.#updateGroundMesh(cx, cz);
8957
+ if (!__privateGet(this, _lastTileWorldSize) || __privateGet(this, _lastTileWorldSize) === newSize) return;
8958
+ const ratio = newSize / __privateGet(this, _lastTileWorldSize);
8959
+ for (const [, entry] of __privateGet(this, _doneTiles)) {
8960
+ entry.tile?.scaleMeshes(ratio);
8961
+ }
8962
+ __privateSet(this, _lastTileWorldSize, newSize);
8963
+ if (__privateGet(this, _lastCenterTileX) !== null) {
8964
+ const offset = __privateGet(this, _mapConfig).worldOriginOffset;
8965
+ const dx = __privateGet(this, _lastCenterTileX) - __privateGet(this, _originTileX);
8966
+ const dy = __privateGet(this, _lastCenterTileY) - __privateGet(this, _originTileY);
8967
+ const cx = (dx - __privateGet(this, _subTileOffsetX)) * newSize + offset.x;
8968
+ const cz = (dy - __privateGet(this, _subTileOffsetY)) * newSize + offset.z;
8969
+ __privateMethod(this, _TileManager_instances, updateGroundMesh_fn).call(this, cx, cz);
8130
8970
  }
8131
8971
  }
8132
8972
  applyCenter() {
8133
- if (this.#lastCenterTileX === null || this.#originTileX === null) {
8973
+ if (__privateGet(this, _lastCenterTileX) === null || __privateGet(this, _originTileX) === null) {
8134
8974
  return;
8135
8975
  }
8136
- this.#applyCenter(this.#lastCenterTileX, this.#lastCenterTileY);
8976
+ __privateMethod(this, _TileManager_instances, applyCenter_fn).call(this, __privateGet(this, _lastCenterTileX), __privateGet(this, _lastCenterTileY));
8137
8977
  }
8138
8978
  updateMaterials() {
8139
- var _a;
8140
- for (const [, entry] of this.#doneTiles) {
8141
- (_a = entry.tile) == null ? void 0 : _a.refreshMaterials();
8142
- }
8143
- const style = this.#mapConfig.mapStyle.getStyleLayerByName("background");
8144
- if ((style == null ? void 0 : style.material) && this.#groundMesh) {
8145
- this.#groundMesh.material = style.material;
8146
- }
8147
- }
8148
- #applyCenter(centerTileX, centerTileY) {
8149
- const renderDistance = this.#mapConfig.renderDistance;
8150
- const tileWorldSize = this.#mapConfig.tileWorldSize;
8151
- const offset = this.#mapConfig.worldOriginOffset;
8152
- const isCircular = this.#mapConfig.tileLayout === TileLayout.CIRCULAR;
8153
- const r2 = renderDistance * renderDistance;
8154
- const needed = /* @__PURE__ */ new Map();
8155
- for (let tx = centerTileX - renderDistance; tx <= centerTileX + renderDistance; tx++) {
8156
- for (let ty = centerTileY - renderDistance; ty <= centerTileY + renderDistance; ty++) {
8157
- const cdx = tx - centerTileX;
8158
- const cdy = ty - centerTileY;
8159
- if (isCircular) {
8160
- const cx = centerTileX + 0.5;
8161
- const cy = centerTileY + 0.5;
8162
- const nearestX = Math.max(tx, Math.min(cx, tx + 1));
8163
- const nearestZ = Math.max(ty, Math.min(cy, ty + 1));
8164
- const dx2 = nearestX - cx;
8165
- const dz = nearestZ - cy;
8166
- if (dx2 * dx2 + dz * dz > r2) continue;
8167
- }
8168
- const dx = tx - this.#originTileX;
8169
- const dy = ty - this.#originTileY;
8170
- const key = `${dx}_${dy}`;
8171
- const worldX = (dx - this.#subTileOffsetX) * tileWorldSize + offset.x;
8172
- const worldZ = (dy - this.#subTileOffsetY) * tileWorldSize + offset.z;
8173
- needed.set(key, { tx, ty, worldX, worldZ, dist: cdx * cdx + cdy * cdy });
8174
- }
8175
- }
8176
- const centerWorldX = (centerTileX - this.#originTileX - this.#subTileOffsetX + 0.5) * tileWorldSize + offset.x;
8177
- const centerWorldZ = (centerTileY - this.#originTileY - this.#subTileOffsetY + 0.5) * tileWorldSize + offset.z;
8178
- this.#updateGroundMesh(centerWorldX, centerWorldZ);
8179
- for (const [key, controller] of this.#pendingTiles) {
8180
- if (!needed.has(key)) {
8181
- controller.abort();
8182
- this.#pendingTiles.delete(key);
8183
- }
8184
- }
8185
- for (const [key, entry] of this.#doneTiles) {
8186
- if (!needed.has(key)) {
8187
- entry.dispose();
8188
- this.#doneTiles.delete(key);
8189
- }
8190
- }
8191
- this.#fetchQueue = [];
8192
- for (const [key, data] of needed) {
8193
- if (!this.#doneTiles.has(key) && !this.#pendingTiles.has(key)) {
8194
- this.#fetchQueue.push({ key, ...data });
8195
- }
8196
- }
8197
- this.#fetchQueue.sort((a, b) => a.dist - b.dist);
8198
- this.#drainQueue();
8199
- }
8200
- #drainQueue() {
8201
- while (this.#activeFetches < this.#maxConcurrentFetches && this.#fetchQueue.length > 0) {
8202
- const item = this.#fetchQueue.shift();
8203
- if (this.#doneTiles.has(item.key) || this.#pendingTiles.has(item.key)) continue;
8204
- this.#activeFetches++;
8205
- this.#fetchTile(item);
8206
- }
8207
- }
8208
- async #fetchTile({ key, tx, ty, worldX, worldZ }) {
8209
- const controller = new AbortController();
8210
- this.#pendingTiles.set(key, controller);
8211
- const url = this.#tileProviderUrl.replace("{z}", this.#zoomLevel).replace("{x}", tx).replace("{y}", ty);
8212
- let result;
8979
+ for (const [, entry] of __privateGet(this, _doneTiles)) {
8980
+ entry.tile?.refreshMaterials();
8981
+ }
8982
+ const style = __privateGet(this, _mapConfig).mapStyle.getStyleLayerByName("background");
8983
+ if (style?.material && __privateGet(this, _groundMesh)) {
8984
+ __privateGet(this, _groundMesh).material = style.material;
8985
+ }
8986
+ }
8987
+ destroy() {
8988
+ for (const [, c] of __privateGet(this, _pendingTiles)) c.abort();
8989
+ for (const [, t] of __privateGet(this, _doneTiles)) t.dispose();
8990
+ __privateGet(this, _pendingTiles).clear();
8991
+ __privateGet(this, _doneTiles).clear();
8992
+ __privateSet(this, _fetchQueue, []);
8993
+ __privateSet(this, _activeFetches, 0);
8994
+ if (__privateGet(this, _groundMesh)) {
8995
+ __privateGet(this, _scene2).remove(__privateGet(this, _groundMesh));
8996
+ __privateGet(this, _groundMesh).geometry.dispose();
8997
+ __privateSet(this, _groundMesh, null);
8998
+ }
8999
+ }
9000
+ };
9001
+ _mapConfig = new WeakMap();
9002
+ _originLatLon2 = new WeakMap();
9003
+ _zoomLevel2 = new WeakMap();
9004
+ _tileProviderUrl = new WeakMap();
9005
+ _originTileX = new WeakMap();
9006
+ _originTileY = new WeakMap();
9007
+ _scene2 = new WeakMap();
9008
+ _subTileOffsetX = new WeakMap();
9009
+ _subTileOffsetY = new WeakMap();
9010
+ _lastCenterTileX = new WeakMap();
9011
+ _lastCenterTileY = new WeakMap();
9012
+ _lastTileWorldSize = new WeakMap();
9013
+ _doneTiles = new WeakMap();
9014
+ _pendingTiles = new WeakMap();
9015
+ _fetchQueue = new WeakMap();
9016
+ _activeFetches = new WeakMap();
9017
+ _maxConcurrentFetches = new WeakMap();
9018
+ _groundMesh = new WeakMap();
9019
+ _TileManager_instances = new WeakSet();
9020
+ initGroundMesh_fn = function() {
9021
+ const style = __privateGet(this, _mapConfig).mapStyle.getStyleLayerByName("background");
9022
+ const material = style?.material;
9023
+ const geo = new THREE10.PlaneGeometry(1, 1);
9024
+ __privateSet(this, _groundMesh, new THREE10.Mesh(geo, material));
9025
+ __privateGet(this, _groundMesh).rotation.x = -Math.PI / 2;
9026
+ __privateGet(this, _groundMesh).position.y = style?.YOrder ?? 0;
9027
+ __privateGet(this, _scene2).add(__privateGet(this, _groundMesh));
9028
+ };
9029
+ updateGroundMesh_fn = function(centerWorldX, centerWorldZ) {
9030
+ if (!__privateGet(this, _groundMesh)) return;
9031
+ const size = (__privateGet(this, _mapConfig).renderDistance * 2 + 1) * __privateGet(this, _mapConfig).tileWorldSize;
9032
+ __privateGet(this, _groundMesh).scale.set(size, size, 1);
9033
+ __privateGet(this, _groundMesh).position.x = centerWorldX;
9034
+ __privateGet(this, _groundMesh).position.z = centerWorldZ;
9035
+ };
9036
+ applyCenter_fn = function(centerTileX, centerTileY) {
9037
+ const renderDistance = __privateGet(this, _mapConfig).renderDistance;
9038
+ const tileWorldSize = __privateGet(this, _mapConfig).tileWorldSize;
9039
+ const offset = __privateGet(this, _mapConfig).worldOriginOffset;
9040
+ const isCircular = __privateGet(this, _mapConfig).tileLayout === TileLayout.CIRCULAR;
9041
+ const r2 = renderDistance * renderDistance;
9042
+ const needed = /* @__PURE__ */ new Map();
9043
+ for (let tx = centerTileX - renderDistance; tx <= centerTileX + renderDistance; tx++) {
9044
+ for (let ty = centerTileY - renderDistance; ty <= centerTileY + renderDistance; ty++) {
9045
+ const cdx = tx - centerTileX;
9046
+ const cdy = ty - centerTileY;
9047
+ if (isCircular) {
9048
+ const cx = centerTileX + 0.5;
9049
+ const cy = centerTileY + 0.5;
9050
+ const nearestX = Math.max(tx, Math.min(cx, tx + 1));
9051
+ const nearestZ = Math.max(ty, Math.min(cy, ty + 1));
9052
+ const dx2 = nearestX - cx;
9053
+ const dz = nearestZ - cy;
9054
+ if (dx2 * dx2 + dz * dz > r2) continue;
9055
+ }
9056
+ const dx = tx - __privateGet(this, _originTileX);
9057
+ const dy = ty - __privateGet(this, _originTileY);
9058
+ const key = `${dx}_${dy}`;
9059
+ const worldX = (dx - __privateGet(this, _subTileOffsetX)) * tileWorldSize + offset.x;
9060
+ const worldZ = (dy - __privateGet(this, _subTileOffsetY)) * tileWorldSize + offset.z;
9061
+ needed.set(key, { tx, ty, worldX, worldZ, dist: cdx * cdx + cdy * cdy });
9062
+ }
9063
+ }
9064
+ const centerWorldX = (centerTileX - __privateGet(this, _originTileX) - __privateGet(this, _subTileOffsetX) + 0.5) * tileWorldSize + offset.x;
9065
+ const centerWorldZ = (centerTileY - __privateGet(this, _originTileY) - __privateGet(this, _subTileOffsetY) + 0.5) * tileWorldSize + offset.z;
9066
+ __privateMethod(this, _TileManager_instances, updateGroundMesh_fn).call(this, centerWorldX, centerWorldZ);
9067
+ for (const [key, controller] of __privateGet(this, _pendingTiles)) {
9068
+ if (!needed.has(key)) {
9069
+ controller.abort();
9070
+ __privateGet(this, _pendingTiles).delete(key);
9071
+ }
9072
+ }
9073
+ for (const [key, entry] of __privateGet(this, _doneTiles)) {
9074
+ if (!needed.has(key)) {
9075
+ entry.dispose();
9076
+ __privateGet(this, _doneTiles).delete(key);
9077
+ }
9078
+ }
9079
+ __privateSet(this, _fetchQueue, []);
9080
+ for (const [key, data] of needed) {
9081
+ if (!__privateGet(this, _doneTiles).has(key) && !__privateGet(this, _pendingTiles).has(key)) {
9082
+ __privateGet(this, _fetchQueue).push({ key, ...data });
9083
+ }
9084
+ }
9085
+ __privateGet(this, _fetchQueue).sort((a, b) => a.dist - b.dist);
9086
+ __privateMethod(this, _TileManager_instances, drainQueue_fn).call(this);
9087
+ };
9088
+ drainQueue_fn = function() {
9089
+ while (__privateGet(this, _activeFetches) < __privateGet(this, _maxConcurrentFetches) && __privateGet(this, _fetchQueue).length > 0) {
9090
+ const item = __privateGet(this, _fetchQueue).shift();
9091
+ if (__privateGet(this, _doneTiles).has(item.key) || __privateGet(this, _pendingTiles).has(item.key)) continue;
9092
+ __privateWrapper(this, _activeFetches)._++;
9093
+ __privateMethod(this, _TileManager_instances, fetchTile_fn).call(this, item);
9094
+ }
9095
+ };
9096
+ fetchTile_fn = async function({ key, tx, ty, worldX, worldZ }) {
9097
+ const controller = new AbortController();
9098
+ __privateGet(this, _pendingTiles).set(key, controller);
9099
+ const url = __privateGet(this, _tileProviderUrl).replace("{z}", __privateGet(this, _zoomLevel2)).replace("{x}", tx).replace("{y}", ty);
9100
+ let result;
9101
+ try {
8213
9102
  try {
8214
- try {
8215
- result = await fetchTileData(url, key, controller.signal);
8216
- } catch (err) {
8217
- if (err.name === "AbortError") {
8218
- return;
8219
- }
8220
- console.error(`ThreeGeoPlay: Fetch ${tx}/${ty} failed, retrying in 3 or 5 seconds...`, err);
8221
- const n = Math.floor(Math.random() * 4) + 3;
8222
- await new Promise((resolve) => setTimeout(resolve, n * 1e3));
8223
- if (!this.#pendingTiles.has(key) || controller.signal.aborted) {
8224
- return;
8225
- }
8226
- this.#fetchQueue.unshift({ key, tx, ty, worldX, worldZ, dist: 0 });
9103
+ result = await fetchTileData(url, key, controller.signal);
9104
+ } catch (err) {
9105
+ if (err.name === "AbortError") {
8227
9106
  return;
8228
9107
  }
8229
- if (!result || this.#doneTiles.has(key) || !this.#pendingTiles.has(key)) {
9108
+ console.error(`ThreeGeoPlay: Fetch ${tx}/${ty} failed, retrying in 3 or 5 seconds...`, err);
9109
+ const n = Math.floor(Math.random() * 4) + 3;
9110
+ await new Promise((resolve) => setTimeout(resolve, n * 1e3));
9111
+ if (!__privateGet(this, _pendingTiles).has(key) || controller.signal.aborted) {
8230
9112
  return;
8231
9113
  }
8232
- try {
8233
- const tile = new Tile(
8234
- [worldX, worldZ],
8235
- result.payload,
8236
- this.#scene,
8237
- this.#mapConfig
8238
- );
8239
- await tile.render(controller.signal);
8240
- this.#doneTiles.set(key, {
8241
- tile,
8242
- dispose: () => tile.destroy()
8243
- });
8244
- } catch (err) {
8245
- if (err.name === "AbortError") {
8246
- return;
8247
- }
8248
- console.error(`ThreeGeoPlay: Tile ${tx}/${ty} render failed (no retry)`, err);
8249
- }
8250
- } finally {
8251
- this.#pendingTiles.delete(key);
8252
- this.#activeFetches--;
8253
- this.#drainQueue();
9114
+ __privateGet(this, _fetchQueue).unshift({ key, tx, ty, worldX, worldZ, dist: 0 });
9115
+ return;
8254
9116
  }
8255
- }
8256
- destroy() {
8257
- for (const [, c] of this.#pendingTiles) c.abort();
8258
- for (const [, t] of this.#doneTiles) t.dispose();
8259
- this.#pendingTiles.clear();
8260
- this.#doneTiles.clear();
8261
- this.#fetchQueue = [];
8262
- this.#activeFetches = 0;
8263
- if (this.#groundMesh) {
8264
- this.#scene.remove(this.#groundMesh);
8265
- this.#groundMesh.geometry.dispose();
8266
- this.#groundMesh = null;
9117
+ if (!result || __privateGet(this, _doneTiles).has(key) || !__privateGet(this, _pendingTiles).has(key)) {
9118
+ return;
9119
+ }
9120
+ try {
9121
+ const tile = new Tile(
9122
+ [worldX, worldZ],
9123
+ result.payload,
9124
+ __privateGet(this, _scene2),
9125
+ __privateGet(this, _mapConfig)
9126
+ );
9127
+ await tile.render(controller.signal);
9128
+ __privateGet(this, _doneTiles).set(key, {
9129
+ tile,
9130
+ dispose: () => tile.destroy()
9131
+ });
9132
+ } catch (err) {
9133
+ if (err.name === "AbortError") {
9134
+ return;
9135
+ }
9136
+ console.error(`ThreeGeoPlay: Tile ${tx}/${ty} render failed (no retry)`, err);
8267
9137
  }
9138
+ } finally {
9139
+ __privateGet(this, _pendingTiles).delete(key);
9140
+ __privateWrapper(this, _activeFetches)._--;
9141
+ __privateMethod(this, _TileManager_instances, drainQueue_fn).call(this);
8268
9142
  }
8269
9143
  };
8270
9144
 
8271
9145
  // src/ThreeGeoPlay.js
9146
+ var _isStarted, _lastTime, _mapConfig2, _mapStyle2, _scene3, _camera, _renderer, _followTarget, _ThreeGeoPlay_instances, validateConstructorParams_fn, validateConfig_fn, validateStyle_fn;
8272
9147
  var ThreeGeoPlay = class {
8273
- /** @type {boolean} Whether the map has been started */
8274
- #isStarted = false;
8275
- #lastTime = Date.now();
8276
- /** @type {MapConfig} Map configuration instance */
8277
- #mapConfig = null;
8278
- /** @type {MapStyle} Map style instance */
8279
- #mapStyle = null;
8280
- /** @type {THREE.Scene} Three.js scene */
8281
- #scene = null;
8282
- /** @type {THREE.Camera} Three.js camera */
8283
- #camera = null;
8284
- /** @type {THREE.WebGLRenderer} Three.js renderer */
8285
- #renderer = null;
8286
- /** @type {THREE.Object3D|null} Target object to follow when viewMode is FOLLOW_TARGET (camera by default) */
8287
- #followTarget = null;
8288
9148
  /**
8289
- * @param {THREE.Scene} threeScene - Three.js scene
8290
- * @param {THREE.Camera} threeCamera - Three.js camera
8291
- * @param {THREE.WebGLRenderer} threeRenderer - Three.js renderer
9149
+ * @param {THREE.Scene} threeScene - Three.js scene.
9150
+ * @param {THREE.Camera} threeCamera - Three.js camera (also the default follow target).
9151
+ * @param {THREE.WebGLRenderer} threeRenderer - Three.js renderer.
9152
+ * @throws {Error} If any parameter is missing.
8292
9153
  */
8293
9154
  constructor(threeScene, threeCamera, threeRenderer) {
8294
- this.#validateConstructorParams(threeScene, threeCamera, threeRenderer);
8295
- this.#scene = threeScene;
8296
- this.#camera = threeCamera;
8297
- this.#followTarget = threeCamera;
8298
- this.#renderer = threeRenderer;
9155
+ __privateAdd(this, _ThreeGeoPlay_instances);
9156
+ /** @type {boolean} */
9157
+ __privateAdd(this, _isStarted, false);
9158
+ /** @type {number} */
9159
+ __privateAdd(this, _lastTime, Date.now());
9160
+ /** @type {MapConfig} */
9161
+ __privateAdd(this, _mapConfig2, null);
9162
+ /** @type {MapStyle} */
9163
+ __privateAdd(this, _mapStyle2, null);
9164
+ /** @type {THREE.Scene} */
9165
+ __privateAdd(this, _scene3, null);
9166
+ /** @type {THREE.Camera} */
9167
+ __privateAdd(this, _camera, null);
9168
+ /** @type {THREE.WebGLRenderer} */
9169
+ __privateAdd(this, _renderer, null);
9170
+ /**
9171
+ * The Three.js Object3D whose position the map tracks in {@link ViewMode.FOLLOW_TARGET} mode.
9172
+ * Defaults to the camera passed to the constructor.
9173
+ * @type {THREE.Object3D}
9174
+ */
9175
+ __privateAdd(this, _followTarget, null);
9176
+ __privateMethod(this, _ThreeGeoPlay_instances, validateConstructorParams_fn).call(this, threeScene, threeCamera, threeRenderer);
9177
+ __privateSet(this, _scene3, threeScene);
9178
+ __privateSet(this, _camera, threeCamera);
9179
+ __privateSet(this, _followTarget, threeCamera);
9180
+ __privateSet(this, _renderer, threeRenderer);
8299
9181
  threeRenderer.localClippingEnabled = true;
8300
- this.#mapConfig = new MapConfig();
8301
- this.#mapStyle = new MapStyle();
8302
- }
8303
- /**
8304
- * Validates constructor parameters
8305
- * @private
8306
- * @param {THREE.Scene} scene - Three.js scene
8307
- * @param {THREE.Camera} camera - Three.js camera
8308
- * @param {THREE.WebGLRenderer} renderer - Three.js renderer
8309
- * @throws {Error} If any parameter is missing
8310
- */
8311
- #validateConstructorParams(scene, camera, renderer) {
8312
- if (!scene) {
8313
- throw new Error("ThreeGeoPlay: threeScene is required");
8314
- }
8315
- if (!camera) {
8316
- throw new Error("ThreeGeoPlay: threeCamera is required");
8317
- }
8318
- if (!renderer) {
8319
- throw new Error("ThreeGeoPlay: threeRenderer is required");
8320
- }
8321
- }
8322
- /**
8323
- * Validates MapConfig instance
8324
- * @private
8325
- * @param {MapConfig} config - Configuration to validate
8326
- * @returns {boolean} True if valid
8327
- */
8328
- #validateConfig(config) {
8329
- if (!config) {
8330
- return false;
8331
- }
8332
- if (!(config instanceof MapConfig)) {
8333
- console.warn("ThreeGeoPlay: MapConfig must be an instance of MapConfig");
8334
- return false;
8335
- }
8336
- return true;
9182
+ __privateSet(this, _mapConfig2, new MapConfig());
9183
+ __privateSet(this, _mapStyle2, new MapStyle());
8337
9184
  }
9185
+ // ─── Public API ──────────────────────────────────────────────────────────
8338
9186
  /**
8339
- * Validates MapStyle instance
8340
- * @private
8341
- * @param {MapStyle} style - Style to validate
8342
- * @returns {boolean} True if valid
8343
- */
8344
- #validateStyle(style) {
8345
- if (!style) {
8346
- return false;
8347
- }
8348
- if (!(style instanceof MapStyle)) {
8349
- console.warn("ThreeGeoPlay: MapStyle must be an instance of MapStyle");
8350
- return false;
8351
- }
8352
- return true;
8353
- }
8354
- /**
8355
- * Set the target object for the map to follow
8356
- * When viewMode is FOLLOW_TARGET, the map origin will automatically update
8357
- * to match this target's position (X-Z plane only, Y-axis ignored)
8358
- * @param {THREE.Object3D} target - Three.js object to follow (e.g., camera, player mesh)
8359
- * @throws {Error} If target is not a valid Three.js Object3D
9187
+ * Sets the object the map will follow in {@link ViewMode.FOLLOW_TARGET} mode.
9188
+ * If the current `viewMode` is not `FOLLOW_TARGET` it is switched automatically.
9189
+ *
9190
+ * @param {THREE.Object3D} target - Any Three.js Object3D (mesh, group, camera, …).
9191
+ * @throws {Error} If `target` is not a valid Three.js Object3D with a position.
9192
+ *
9193
+ * @example
9194
+ * const playerMesh = new THREE.Mesh(geometry, material);
9195
+ * geoPlay.setFollowTarget(playerMesh);
8360
9196
  */
8361
9197
  setFollowTarget(target) {
8362
9198
  if (!target) {
@@ -8368,114 +9204,89 @@ var ThreeGeoPlay = class {
8368
9204
  if (!target.position || typeof target.position.x !== "number" || typeof target.position.z !== "number") {
8369
9205
  throw new Error("ThreeGeoPlay: Follow target must have a valid position property with x and z coordinates");
8370
9206
  }
8371
- this.#followTarget = target;
8372
- if (this.#mapConfig.viewMode !== ViewMode.FOLLOW_TARGET) {
9207
+ __privateSet(this, _followTarget, target);
9208
+ if (__privateGet(this, _mapConfig2).viewMode !== ViewMode.FOLLOW_TARGET) {
8373
9209
  console.warn("ThreeGeoPlay: ViewMode was not set to FOLLOW_TARGET. Automatically switching to FOLLOW_TARGET mode.");
8374
- this.#mapConfig.viewMode = ViewMode.FOLLOW_TARGET;
9210
+ __privateGet(this, _mapConfig2).viewMode = ViewMode.FOLLOW_TARGET;
8375
9211
  }
8376
9212
  }
8377
9213
  /**
8378
- * Manually move map origin to specified geographic coordinates
8379
- * Works in MANUAL and STATIC modes. In FOLLOW_TARGET mode, this is ignored.
8380
- * @param {number} lat - Latitude (-90 to 90)
8381
- * @param {number} lon - Longitude (-180 to 180)
8382
- * @throws {Error} If coordinates are invalid
8383
- * @returns {void}
9214
+ * Moves the map origin to the given geographic coordinates.
9215
+ * Only effective in {@link ViewMode.MANUAL} or `STATIC` mode ignored (with a warning)
9216
+ * in {@link ViewMode.FOLLOW_TARGET}.
9217
+ *
9218
+ * @param {number} lat - Latitude in degrees (−90 … 90).
9219
+ * @param {number} lon - Longitude in degrees (−180 … 180).
9220
+ * @throws {Error} If either coordinate is out of range or not a number.
9221
+ *
9222
+ * @example
9223
+ * geoPlay.getMapConfig().viewMode = ViewMode.MANUAL;
9224
+ * geoPlay.moveMapOriginToLatLon(48.8566, 2.3522); // Paris
8384
9225
  */
8385
9226
  moveMapOriginToLatLon(lat, lon) {
8386
- if (this.#mapConfig.viewMode === ViewMode.FOLLOW_TARGET) {
9227
+ if (__privateGet(this, _mapConfig2).viewMode === ViewMode.FOLLOW_TARGET) {
8387
9228
  console.warn("ThreeGeoPlay: ViewMode was set to FOLLOW_TARGET. Automatically switching to MANUAL mode.");
8388
9229
  return;
8389
9230
  }
8390
- if (typeof lat !== "number" || isNaN(lat)) {
8391
- throw new Error(`Invalid latitude: ${lat}. Must be a number`);
8392
- }
8393
- if (lat < -90 || lat > 90) {
8394
- throw new Error(`Invalid latitude: ${lat}. Must be between -90 and 90`);
8395
- }
8396
- if (typeof lon !== "number" || isNaN(lon)) {
8397
- throw new Error(`Invalid longitude: ${lon}. Must be a number`);
8398
- }
8399
- if (lon < -180 || lon > 180) {
8400
- throw new Error(`Invalid longitude: ${lon}. Must be between -180 and 180`);
8401
- }
8402
- this.#mapConfig.originLatLon = { lat, lon };
9231
+ if (typeof lat !== "number" || isNaN(lat)) throw new Error(`Invalid latitude: ${lat}. Must be a number`);
9232
+ if (lat < -90 || lat > 90) throw new Error(`Invalid latitude: ${lat}. Must be between -90 and 90`);
9233
+ if (typeof lon !== "number" || isNaN(lon)) throw new Error(`Invalid longitude: ${lon}. Must be a number`);
9234
+ if (lon < -180 || lon > 180) throw new Error(`Invalid longitude: ${lon}. Must be between -180 and 180`);
9235
+ __privateGet(this, _mapConfig2).originLatLon = { lat, lon };
8403
9236
  }
8404
9237
  /**
8405
- * Manually move map origin to specified 3D world position
8406
- * Converts X-Z coordinates to geographic coordinates automatically.
8407
- * Works in MANUAL and STATIC modes. In FOLLOW_TARGET mode, this is ignored.
8408
- * @param {number} x - X coordinate in 3D world space
8409
- * @param {number} z - Z coordinate in 3D world space
8410
- * @throws {Error} If coordinates are invalid
8411
- * @returns {void}
9238
+ * Moves the map origin to match the given Three.js world-space X/Z position.
9239
+ * If the current mode is {@link ViewMode.FOLLOW_TARGET} it is automatically
9240
+ * switched to {@link ViewMode.MANUAL}.
9241
+ *
9242
+ * @param {number} x - X coordinate in Three.js world space.
9243
+ * @param {number} z - Z coordinate in Three.js world space.
9244
+ * @throws {Error} If either coordinate is not a valid number.
8412
9245
  */
8413
9246
  moveMapOriginToPosition(x, z) {
8414
- if (this.#mapConfig.viewMode === ViewMode.FOLLOW_TARGET) {
9247
+ if (__privateGet(this, _mapConfig2).viewMode === ViewMode.FOLLOW_TARGET) {
8415
9248
  console.warn("ThreeGeoPlay: ViewMode was set to FOLLOW_TARGET. Automatically switching to MANUAL mode.");
8416
- this.#mapConfig.viewMode = ViewMode.MANUAL;
8417
- }
8418
- if (typeof x !== "number" || isNaN(x)) {
8419
- throw new Error(`Invalid x coordinate: ${x}. Must be a number`);
8420
- }
8421
- if (typeof z !== "number" || isNaN(z)) {
8422
- throw new Error(`Invalid z coordinate: ${z}. Must be a number`);
9249
+ __privateGet(this, _mapConfig2).viewMode = ViewMode.MANUAL;
8423
9250
  }
9251
+ if (typeof x !== "number" || isNaN(x)) throw new Error(`Invalid x coordinate: ${x}. Must be a number`);
9252
+ if (typeof z !== "number" || isNaN(z)) throw new Error(`Invalid z coordinate: ${z}. Must be a number`);
8424
9253
  }
8425
9254
  /**
8426
- * Starts rendering the map into the scene.
8427
- * Triggers the initial tile fetch and geometry generation based on the current MapConfig.
8428
- * @throws {Error} If start() has already been called
8429
- * @returns {void}
9255
+ * Initialises the map, loads the first set of tiles and adds geometry to the scene.
9256
+ * Call this once, after configuring {@link MapConfig} and {@link MapStyle}.
9257
+ *
9258
+ * @throws {Error} If called more than once.
8430
9259
  */
8431
9260
  start() {
8432
- if (this.#isStarted) {
9261
+ if (__privateGet(this, _isStarted)) {
8433
9262
  console.warn("ThreeGeoPlay: Already started");
8434
9263
  return;
8435
9264
  }
8436
- this.tileManager = new TileManager(this.#mapConfig, this.#scene);
9265
+ this.tileManager = new TileManager(__privateGet(this, _mapConfig2), __privateGet(this, _scene3));
8437
9266
  this.tileManager.init();
8438
- this.#isStarted = true;
9267
+ __privateSet(this, _isStarted, true);
8439
9268
  }
8440
9269
  /**
8441
- * Updates ThreeGeoPlay internal state for the current frame.
8442
- *
8443
- * This method **must be called inside the user's Three.js animation loop**
8444
- * (e.g. inside the function passed to `requestAnimationFrame`).
8445
- * It is responsible for handling automatic map updates such as
8446
- * FOLLOW_TARGET tracking and time-based updates.
9270
+ * Processes per-frame updates: applies dirty config changes, updates tile
9271
+ * borders, and (in {@link ViewMode.FOLLOW_TARGET} mode) repositions the map
9272
+ * origin to track the follow target.
8447
9273
  *
8448
- * If this method is not called every frame, features like
8449
- * FOLLOW_TARGET mode and interval-based map updates will not work correctly.
9274
+ * **Must be called every frame inside your Three.js animation loop.**
8450
9275
  *
8451
- * Example usage:
8452
- *
8453
- * ```js
9276
+ * @example
8454
9277
  * function animate() {
8455
9278
  * requestAnimationFrame(animate);
8456
- *
8457
9279
  * geoPlay.onFrameUpdate();
8458
- *
8459
9280
  * renderer.render(scene, camera);
8460
9281
  * }
8461
- * ```
8462
- *
8463
- * @returns {void}
8464
9282
  */
8465
9283
  onFrameUpdate() {
8466
- var _a, _b, _c, _d, _e;
8467
- (_a = this.tileManager) == null ? void 0 : _a.updateBorders();
8468
- if (this.#mapConfig._isDirty) {
8469
- const dirty = this.#mapConfig._dirtyFields;
8470
- if (dirty.has("tileWorldSize")) {
8471
- (_b = this.tileManager) == null ? void 0 : _b.rescaleTiles(this.#mapConfig.tileWorldSize);
8472
- }
8473
- if (dirty.has("renderDistance")) {
8474
- (_c = this.tileManager) == null ? void 0 : _c.applyCenter();
8475
- }
8476
- if (dirty.has("mapStyle")) {
8477
- (_d = this.tileManager) == null ? void 0 : _d.updateMaterials();
8478
- }
9284
+ this.tileManager?.updateBorders();
9285
+ if (__privateGet(this, _mapConfig2)._isDirty) {
9286
+ const dirty = __privateGet(this, _mapConfig2)._dirtyFields;
9287
+ if (dirty.has("tileWorldSize")) this.tileManager?.rescaleTiles(__privateGet(this, _mapConfig2).tileWorldSize);
9288
+ if (dirty.has("renderDistance")) this.tileManager?.applyCenter();
9289
+ if (dirty.has("mapStyle")) this.tileManager?.updateMaterials();
8479
9290
  const needsRebuild = [
8480
9291
  "zoomLevel",
8481
9292
  "pbfTileProviderZXYurl",
@@ -8484,96 +9295,146 @@ var ThreeGeoPlay = class {
8484
9295
  "originLatLon"
8485
9296
  ].some((f) => dirty.has(f));
8486
9297
  if (needsRebuild) {
8487
- (_e = this.tileManager) == null ? void 0 : _e.destroy();
8488
- this.tileManager = new TileManager(this.#mapConfig, this.#scene);
9298
+ this.tileManager?.destroy();
9299
+ this.tileManager = new TileManager(__privateGet(this, _mapConfig2), __privateGet(this, _scene3));
8489
9300
  this.tileManager.init();
8490
9301
  }
8491
- this.#mapConfig.flushDirtyState();
9302
+ __privateGet(this, _mapConfig2).flushDirtyState();
8492
9303
  }
8493
- if (this.#mapConfig.viewMode === ViewMode.FOLLOW_TARGET) {
9304
+ if (__privateGet(this, _mapConfig2).viewMode === ViewMode.FOLLOW_TARGET) {
8494
9305
  const t = Date.now();
8495
- const interval = this.#mapConfig.FollowUpdateInterval;
8496
- console.log(this.#mapConfig.FollowUpdateInterval);
8497
- if (interval === 0 || t - this.#lastTime >= interval) {
8498
- this.#lastTime = t;
9306
+ const interval = __privateGet(this, _mapConfig2).FollowUpdateInterval;
9307
+ if (interval === 0 || t - __privateGet(this, _lastTime) >= interval) {
9308
+ __privateSet(this, _lastTime, t);
8499
9309
  this.tileManager.updateCenterFromPosition(
8500
- this.#followTarget.position.x,
8501
- this.#followTarget.position.z
9310
+ __privateGet(this, _followTarget).position.x,
9311
+ __privateGet(this, _followTarget).position.z
8502
9312
  );
8503
9313
  }
8504
9314
  }
8505
9315
  }
8506
9316
  /**
8507
- * Gets the current map configuration
8508
- * @returns {MapConfig} Current map configuration instance
9317
+ * Returns the active {@link MapConfig} instance.
9318
+ * Modify its properties directly to adjust zoom, render distance, tile layout, etc.
9319
+ * @returns {MapConfig}
8509
9320
  */
8510
9321
  getMapConfig() {
8511
- return this.#mapConfig;
9322
+ return __privateGet(this, _mapConfig2);
8512
9323
  }
8513
9324
  /**
8514
- * Replaces the current map configuration and applies it immediately.
8515
- * To update individual settings, modify a MapConfig instance and pass it here.
8516
- * @param {MapConfig} mapConfig - New map configuration instance
8517
- * @throws {Error} If config is invalid or not a MapConfig instance
9325
+ * Replaces the entire map configuration.
9326
+ * The new config is applied on the next {@link onFrameUpdate} call.
9327
+ *
9328
+ * @param {MapConfig} mapConfig - A fully constructed {@link MapConfig} instance.
9329
+ * @throws {Error} If `mapConfig` is not a valid {@link MapConfig} instance.
8518
9330
  */
8519
9331
  setMapConfig(mapConfig) {
8520
- if (!this.#validateConfig(mapConfig)) {
9332
+ if (!__privateMethod(this, _ThreeGeoPlay_instances, validateConfig_fn).call(this, mapConfig)) {
8521
9333
  throw new Error("ThreeGeoPlay: Invalid MapConfig provided");
8522
9334
  }
8523
- this.#mapConfig = mapConfig;
9335
+ __privateSet(this, _mapConfig2, mapConfig);
8524
9336
  }
8525
9337
  /**
8526
- * Gets the current map style
8527
- * @returns {MapStyle} Current map style instance
9338
+ * Returns the active {@link MapStyle} instance.
9339
+ * @returns {MapStyle}
8528
9340
  */
8529
9341
  getMapStyle() {
8530
- return this.#mapStyle;
9342
+ return __privateGet(this, _mapStyle2);
8531
9343
  }
8532
9344
  /**
8533
- * Sets a new map style
8534
- * @param {MapStyle} mapStyle - New map style instance
8535
- * @throws {Error} If style is invalid or not a MapStyle instance
9345
+ * Replaces the active map style.
9346
+ *
9347
+ * @param {MapStyle} mapStyle - A fully constructed {@link MapStyle} instance.
9348
+ * @throws {Error} If `mapStyle` is not a valid {@link MapStyle} instance.
8536
9349
  */
8537
9350
  setMapStyle(mapStyle) {
8538
- if (!this.#validateStyle(mapStyle)) {
9351
+ if (!__privateMethod(this, _ThreeGeoPlay_instances, validateStyle_fn).call(this, mapStyle)) {
8539
9352
  throw new Error("ThreeGeoPlay: Invalid MapStyle provided");
8540
9353
  }
8541
- this.#mapStyle = mapStyle;
9354
+ __privateSet(this, _mapStyle2, mapStyle);
8542
9355
  }
8543
9356
  /**
8544
- * Gets the Three.js scene
8545
- * @returns {THREE.Scene} The Three.js scene instance
9357
+ * Returns the Three.js scene passed to the constructor.
9358
+ * @returns {THREE.Scene}
8546
9359
  */
8547
9360
  getScene() {
8548
- return this.#scene;
9361
+ return __privateGet(this, _scene3);
8549
9362
  }
8550
9363
  /**
8551
- * Gets the Three.js camera
8552
- * @returns {THREE.Camera} The Three.js camera instance
9364
+ * Returns the Three.js camera passed to the constructor.
9365
+ * @returns {THREE.Camera}
8553
9366
  */
8554
9367
  getCamera() {
8555
- return this.#camera;
9368
+ return __privateGet(this, _camera);
8556
9369
  }
8557
9370
  /**
8558
- * Gets the Three.js renderer
8559
- * @returns {THREE.WebGLRenderer} The Three.js renderer instance
9371
+ * Returns the Three.js renderer passed to the constructor.
9372
+ * @returns {THREE.WebGLRenderer}
8560
9373
  */
8561
9374
  getRenderer() {
8562
- return this.#renderer;
9375
+ return __privateGet(this, _renderer);
8563
9376
  }
8564
9377
  /**
8565
- * Destroys ThreeGeoPlay and cleans up all resources
8566
- * @returns {void}
9378
+ * Destroys the ThreeGeoPlay instance and releases all held references.
9379
+ * After calling this method the instance must not be used again.
8567
9380
  */
8568
9381
  destroy() {
8569
- this.#scene = null;
8570
- this.#camera = null;
8571
- this.#renderer = null;
8572
- this.#mapConfig = null;
8573
- this.#mapStyle = null;
8574
- this.#lastTime = null;
9382
+ __privateSet(this, _scene3, null);
9383
+ __privateSet(this, _camera, null);
9384
+ __privateSet(this, _renderer, null);
9385
+ __privateSet(this, _mapConfig2, null);
9386
+ __privateSet(this, _mapStyle2, null);
9387
+ __privateSet(this, _lastTime, null);
8575
9388
  }
8576
9389
  };
9390
+ _isStarted = new WeakMap();
9391
+ _lastTime = new WeakMap();
9392
+ _mapConfig2 = new WeakMap();
9393
+ _mapStyle2 = new WeakMap();
9394
+ _scene3 = new WeakMap();
9395
+ _camera = new WeakMap();
9396
+ _renderer = new WeakMap();
9397
+ _followTarget = new WeakMap();
9398
+ _ThreeGeoPlay_instances = new WeakSet();
9399
+ // ─── Private helpers ─────────────────────────────────────────────────────
9400
+ /**
9401
+ * @param {THREE.Scene} scene
9402
+ * @param {THREE.Camera} camera
9403
+ * @param {THREE.WebGLRenderer} renderer
9404
+ * @throws {Error}
9405
+ * @private
9406
+ */
9407
+ validateConstructorParams_fn = function(scene, camera, renderer) {
9408
+ if (!scene) throw new Error("ThreeGeoPlay: threeScene is required");
9409
+ if (!camera) throw new Error("ThreeGeoPlay: threeCamera is required");
9410
+ if (!renderer) throw new Error("ThreeGeoPlay: threeRenderer is required");
9411
+ };
9412
+ /**
9413
+ * @param {MapConfig} config
9414
+ * @returns {boolean}
9415
+ * @private
9416
+ */
9417
+ validateConfig_fn = function(config) {
9418
+ if (!config) return false;
9419
+ if (!(config instanceof MapConfig)) {
9420
+ console.warn("ThreeGeoPlay: MapConfig must be an instance of MapConfig");
9421
+ return false;
9422
+ }
9423
+ return true;
9424
+ };
9425
+ /**
9426
+ * @param {MapStyle} style
9427
+ * @returns {boolean}
9428
+ * @private
9429
+ */
9430
+ validateStyle_fn = function(style) {
9431
+ if (!style) return false;
9432
+ if (!(style instanceof MapStyle)) {
9433
+ console.warn("ThreeGeoPlay: MapStyle must be an instance of MapStyle");
9434
+ return false;
9435
+ }
9436
+ return true;
9437
+ };
8577
9438
  // Annotate the CommonJS export names for ESM import in node:
8578
9439
  0 && (module.exports = {
8579
9440
  MapConfig,
@@ -8582,4 +9443,3 @@ var ThreeGeoPlay = class {
8582
9443
  TileLayout,
8583
9444
  ViewMode
8584
9445
  });
8585
- //# sourceMappingURL=index.js.map