mirage2d 1.1.38 → 1.1.39

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.
Files changed (79) hide show
  1. package/dist/config/json/mapConfig.json +1 -1
  2. package/dist/mirage2d.es.js +333 -382
  3. package/dist/mirage2d.umd.js +9 -9
  4. package/dist/src/Layer/XMap.d.ts +4 -9
  5. package/dist/src/Layer/XMap.d.ts.map +1 -1
  6. package/dist/src/Layer/{ClusterImageLayer.d.ts → graphicLayer/ClusterImageLayer.d.ts} +1 -1
  7. package/dist/src/Layer/{ClusterImageLayer.d.ts.map → graphicLayer/ClusterImageLayer.d.ts.map} +1 -1
  8. package/dist/src/Layer/{ClusterLayer.d.ts → graphicLayer/ClusterLayer.d.ts} +1 -1
  9. package/dist/src/Layer/{ClusterLayer.d.ts.map → graphicLayer/ClusterLayer.d.ts.map} +1 -1
  10. package/dist/src/Layer/graphicLayer/DayNightLayer.d.ts +7 -0
  11. package/dist/src/Layer/graphicLayer/DayNightLayer.d.ts.map +1 -0
  12. package/dist/src/Layer/graphicLayer/GraphicImageLayer.d.ts +6 -0
  13. package/dist/src/Layer/graphicLayer/GraphicImageLayer.d.ts.map +1 -0
  14. package/dist/src/Layer/{GraphicLayer.d.ts → graphicLayer/GraphicLayer.d.ts} +3 -3
  15. package/dist/src/Layer/{GraphicLayer.d.ts.map → graphicLayer/GraphicLayer.d.ts.map} +1 -1
  16. package/dist/src/Layer/{HeatmapLayer.d.ts → graphicLayer/HeatmapLayer.d.ts} +1 -2
  17. package/dist/src/Layer/graphicLayer/HeatmapLayer.d.ts.map +1 -0
  18. package/dist/src/Layer/graphicLayer/KmlLayer.d.ts +6 -0
  19. package/dist/src/Layer/graphicLayer/KmlLayer.d.ts.map +1 -0
  20. package/dist/src/Layer/{PathLayer.d.ts → graphicLayer/PathLayer.d.ts} +2 -3
  21. package/dist/src/Layer/{PathLayer.d.ts.map → graphicLayer/PathLayer.d.ts.map} +1 -1
  22. package/dist/src/Layer/{WfsLayer.d.ts → graphicLayer/WfsLayer.d.ts} +2 -2
  23. package/dist/src/Layer/{WfsLayer.d.ts.map → graphicLayer/WfsLayer.d.ts.map} +1 -1
  24. package/dist/src/Layer/index.d.ts +18 -18
  25. package/dist/src/Layer/index.d.ts.map +1 -1
  26. package/dist/src/Layer/{ArcGisMapServerLayer.d.ts → tileLayer/ArcGisMapServerLayer.d.ts} +3 -2
  27. package/dist/src/Layer/tileLayer/ArcGisMapServerLayer.d.ts.map +1 -0
  28. package/dist/src/Layer/{ArcGisTileXyzLayer.d.ts → tileLayer/ArcGisTileXyzLayer.d.ts} +4 -8
  29. package/dist/src/Layer/tileLayer/ArcGisTileXyzLayer.d.ts.map +1 -0
  30. package/dist/src/Layer/tileLayer/GeoImageLayer.d.ts +33 -0
  31. package/dist/src/Layer/tileLayer/GeoImageLayer.d.ts.map +1 -0
  32. package/dist/src/Layer/{PbfLayer.d.ts → tileLayer/PbfLayer.d.ts} +1 -2
  33. package/dist/src/Layer/{PbfLayer.d.ts.map → tileLayer/PbfLayer.d.ts.map} +1 -1
  34. package/dist/src/Layer/tileLayer/TifLayer.d.ts +13 -0
  35. package/dist/src/Layer/tileLayer/TifLayer.d.ts.map +1 -0
  36. package/dist/src/Layer/{TileGroupLayer.d.ts → tileLayer/TileGroupLayer.d.ts} +1 -1
  37. package/dist/src/Layer/{TileGroupLayer.d.ts.map → tileLayer/TileGroupLayer.d.ts.map} +1 -1
  38. package/dist/src/Layer/{TileXyzLayer.d.ts → tileLayer/TileXyzLayer.d.ts} +4 -9
  39. package/dist/src/Layer/tileLayer/TileXyzLayer.d.ts.map +1 -0
  40. package/dist/src/Layer/{WmsLayer.d.ts → tileLayer/WmsLayer.d.ts} +1 -1
  41. package/dist/src/Layer/{WmsLayer.d.ts.map → tileLayer/WmsLayer.d.ts.map} +1 -1
  42. package/dist/src/Layer/tileLayer/WmtsLayer.d.ts +12 -0
  43. package/dist/src/Layer/tileLayer/WmtsLayer.d.ts.map +1 -0
  44. package/dist/src/Layer/tileLayer/imageLayer.d.ts +13 -0
  45. package/dist/src/Layer/tileLayer/imageLayer.d.ts.map +1 -0
  46. package/dist/src/base/baseGraphicLayer.d.ts.map +1 -1
  47. package/dist/src/base/baseLayer.d.ts +6 -1
  48. package/dist/src/base/baseLayer.d.ts.map +1 -1
  49. package/dist/src/base/baseOptionType.d.ts +35 -3
  50. package/dist/src/base/baseOptionType.d.ts.map +1 -1
  51. package/dist/src/base/baseTileLayer.d.ts +5 -1
  52. package/dist/src/base/baseTileLayer.d.ts.map +1 -1
  53. package/dist/src/extend/Control/baseLayerSwitch.d.ts +1 -1
  54. package/dist/src/extend/Control/baseLayerSwitch.d.ts.map +1 -1
  55. package/dist/src/extend/Control/swipe.d.ts +3 -3
  56. package/dist/src/extend/Control/swipe.d.ts.map +1 -1
  57. package/package.json +1 -1
  58. package/dist/MirageHttp.es.js +0 -5268
  59. package/dist/MirageHttp.es.js.map +0 -1
  60. package/dist/MirageHttp.umd.js +0 -2
  61. package/dist/MirageHttp.umd.js.map +0 -1
  62. package/dist/src/Layer/ArcGisMapServerLayer.d.ts.map +0 -1
  63. package/dist/src/Layer/ArcGisTileXyzLayer.d.ts.map +0 -1
  64. package/dist/src/Layer/DayNightLayer.d.ts +0 -7
  65. package/dist/src/Layer/DayNightLayer.d.ts.map +0 -1
  66. package/dist/src/Layer/GeoImageLayer.d.ts +0 -66
  67. package/dist/src/Layer/GeoImageLayer.d.ts.map +0 -1
  68. package/dist/src/Layer/GraphicImageLayer.d.ts +0 -6
  69. package/dist/src/Layer/GraphicImageLayer.d.ts.map +0 -1
  70. package/dist/src/Layer/HeatmapLayer.d.ts.map +0 -1
  71. package/dist/src/Layer/KmlLayer.d.ts +0 -6
  72. package/dist/src/Layer/KmlLayer.d.ts.map +0 -1
  73. package/dist/src/Layer/TifLayer.d.ts +0 -25
  74. package/dist/src/Layer/TifLayer.d.ts.map +0 -1
  75. package/dist/src/Layer/TileXyzLayer.d.ts.map +0 -1
  76. package/dist/src/Layer/WmtsLayer.d.ts +0 -23
  77. package/dist/src/Layer/WmtsLayer.d.ts.map +0 -1
  78. package/dist/src/Layer/imageLayer.d.ts +0 -21
  79. package/dist/src/Layer/imageLayer.d.ts.map +0 -1
@@ -35613,12 +35613,19 @@ class baseLayer extends base {
35613
35613
  __publicField(this, "layer");
35614
35614
  __publicField(this, "layerclass");
35615
35615
  __publicField(this, "_isShow");
35616
+ __publicField(this, "_isAdded");
35617
+ __publicField(this, "option");
35616
35618
  this.layerid = layerid;
35617
35619
  this.layerclass = "";
35620
+ this._isAdded = false;
35618
35621
  this._map = null;
35619
35622
  this.contextmenuitems = [];
35620
35623
  this.contextmenu = null;
35621
35624
  this.EventType = EventType;
35625
+ let mOption = {
35626
+ radio: false
35627
+ };
35628
+ this.option = Object.assign({}, mOption, Options);
35622
35629
  }
35623
35630
  initContextmenu(menuitems) {
35624
35631
  this.contextmenu = new Base({
@@ -35681,6 +35688,12 @@ class baseLayer extends base {
35681
35688
  get show() {
35682
35689
  return this.layer.getVisible();
35683
35690
  }
35691
+ set isAdded(isadded) {
35692
+ this._isAdded = isadded;
35693
+ }
35694
+ get isAdded() {
35695
+ return this._isAdded;
35696
+ }
35684
35697
  }
35685
35698
  var featuretype;
35686
35699
  (function(featuretype2) {
@@ -79743,7 +79756,6 @@ class baseGraphicLayer extends baseLayer {
79743
79756
  __publicField(this, "_source");
79744
79757
  __publicField(this, "_draw");
79745
79758
  __publicField(this, "_tipPoint");
79746
- __publicField(this, "option");
79747
79759
  this.option = {
79748
79760
  autoPointSize: false,
79749
79761
  enabledRightMenu: false,
@@ -80483,8 +80495,10 @@ class baseGraphicLayer extends baseLayer {
80483
80495
  appendTo(map6) {
80484
80496
  var _a2;
80485
80497
  this._map = map6;
80486
- if (this.layer)
80498
+ if (this.layer) {
80487
80499
  (_a2 = this._map) == null ? void 0 : _a2.addLayer(this.layer);
80500
+ this.isAdded = true;
80501
+ }
80488
80502
  this.initSelect();
80489
80503
  this._map.on("singleclick", (evt) => {
80490
80504
  var _a3;
@@ -86340,10 +86354,21 @@ class baseTileLayer extends baseLayer {
86340
86354
  __publicField(this, "erode");
86341
86355
  __publicField(this, "erodeFilter");
86342
86356
  __publicField(this, "paperFilter");
86357
+ __publicField(this, "mImageExtent");
86343
86358
  this.layerclass = "tilelayer";
86359
+ this.mImageExtent = null;
86360
+ this.option = { zIndex: 900, projection: "EPSG:3857", url: "", ImageExtent: null, ImageExtentWKID: crsType.EPSG3857, opacity: 1 };
86361
+ this.option = Object.assign({}, this.option, Options);
86362
+ if (this.option.ImageExtent) {
86363
+ this.mImageExtent = [this.option.ImageExtent.xmin, this.option.ImageExtent.ymin, this.option.ImageExtent.xmax, this.option.ImageExtent.ymax];
86364
+ if (this.option.ImageExtentWKID == crsType.EPSG4326) {
86365
+ this.mImageExtent = transformExtent(this.mImageExtent, "EPSG:4326", "EPSG:3857");
86366
+ }
86367
+ }
86344
86368
  }
86345
86369
  appendTo(map6, graphicLayer, selectTransform) {
86346
86370
  map6.addLayer(this.layer);
86371
+ this.isAdded = true;
86347
86372
  }
86348
86373
  addFilter(option) {
86349
86374
  let set3 = {
@@ -86507,12 +86532,9 @@ class baseTileLayer extends baseLayer {
86507
86532
  class ArcGisTileXyzLayer extends baseTileLayer {
86508
86533
  constructor(layerid, Options) {
86509
86534
  super(layerid, Options);
86510
- __publicField(this, "option");
86511
86535
  this.layerid = layerid;
86512
86536
  this.layertype = "TileXyzLayer";
86513
86537
  let that = this;
86514
- this.option = { zIndex: 900 };
86515
- this.option = Object.assign({}, this.option, Options);
86516
86538
  this.layerSource = new XYZ$1({
86517
86539
  tileUrlFunction: function(tileCoord, pixelRatio, proj2) {
86518
86540
  var x2 = "C" + that.padLeft(tileCoord[1], 8, 16);
@@ -86527,8 +86549,8 @@ class ArcGisTileXyzLayer extends baseTileLayer {
86527
86549
  source: this.layerSource
86528
86550
  });
86529
86551
  this.layer.set("layerid", layerid);
86530
- if (Options.ImageExtent) {
86531
- this.layer.setExtent(transformExtent(Options.ImageExtent, "EPSG:4326", "EPSG:3857"));
86552
+ if (this.mImageExtent) {
86553
+ this.layer.setExtent(this.mImageExtent);
86532
86554
  }
86533
86555
  this.layerSource.on("tileloadstart", function() {
86534
86556
  });
@@ -86551,8 +86573,8 @@ class ArcGisMapServerLayer extends baseTileLayer {
86551
86573
  source: this.layerSource
86552
86574
  });
86553
86575
  this.layer.set("layerid", layerid);
86554
- if (Options.ImageExtent) {
86555
- this.layer.setExtent(transformExtent(Options.ImageExtent, "EPSG:4326", "EPSG:3857"));
86576
+ if (this.mImageExtent) {
86577
+ this.layer.setExtent(this.mImageExtent);
86556
86578
  }
86557
86579
  this.layerSource.on("tileloadstart", function() {
86558
86580
  });
@@ -88483,7 +88505,7 @@ class TileXyzLayer extends baseTileLayer {
88483
88505
  super(layerid, Options);
88484
88506
  __publicField(this, "projection");
88485
88507
  this.layertype = "TileXyzLayer";
88486
- this.projection = "EPSG:3857";
88508
+ this.projection = this.option.projection;
88487
88509
  if (Options.chinaCRS == "GCJ02") {
88488
88510
  this.setGCJ02();
88489
88511
  }
@@ -88498,8 +88520,8 @@ class TileXyzLayer extends baseTileLayer {
88498
88520
  useInterimTilesOnError: false
88499
88521
  });
88500
88522
  this.layer.set("layerid", layerid);
88501
- if (Options.ImageExtent) {
88502
- this.layer.setExtent(transformExtent(Options.ImageExtent, "EPSG:4326", "EPSG:3857"));
88523
+ if (this.mImageExtent) {
88524
+ this.layer.setExtent(this.mImageExtent);
88503
88525
  }
88504
88526
  this.layerSource.on("tileloadstart", function() {
88505
88527
  });
@@ -88653,18 +88675,11 @@ class TileGroupLayer extends baseTileLayer {
88653
88675
  class imageLayer extends baseTileLayer {
88654
88676
  constructor(layerid, options) {
88655
88677
  super(layerid, options);
88656
- __publicField(this, "option");
88657
- this.option = { zIndex: 900, projection: "EPSG:3857", url: "", ImageExtent: null, ImageExtentWKID: crsType.EPSG3857, opacity: 1 };
88658
- this.option = Object.assign({}, this.option, options);
88659
- let mImageExtent = [this.option.ImageExtent.xmin, this.option.ImageExtent.ymin, this.option.ImageExtent.xmax, this.option.ImageExtent.ymax];
88660
- if (this.option.ImageExtentWKID == crsType.EPSG4326) {
88661
- mImageExtent = transformExtent(mImageExtent, "EPSG:4326", "EPSG:3857");
88662
- }
88663
88678
  this.layertype = "imageLayer";
88664
88679
  this.layerSource = new Static$1({
88665
88680
  url: this.option.url,
88666
88681
  projection: this.option.projection,
88667
- imageExtent: mImageExtent
88682
+ imageExtent: this.mImageExtent
88668
88683
  });
88669
88684
  this.layer = new ol_layer_Image({
88670
88685
  source: this.layerSource,
@@ -88678,9 +88693,6 @@ class imageLayer extends baseTileLayer {
88678
88693
  this.layerSource.on("tileloaderror", function() {
88679
88694
  });
88680
88695
  }
88681
- appendTo(map6) {
88682
- map6.addLayer(this.layer);
88683
- }
88684
88696
  }
88685
88697
  function _typeof$2(obj) {
88686
88698
  "@babel/helpers - typeof";
@@ -102050,7 +102062,7 @@ class Locationbar extends ol_control_Control {
102050
102062
  }
102051
102063
  }
102052
102064
  class baseLayerSwitch extends ol_control_Control {
102053
- constructor(opt_options, baseLayerList, xmap) {
102065
+ constructor(opt_options, baseLayerList, setBaseLayer) {
102054
102066
  const options = opt_options || {};
102055
102067
  const mianImage = new Image();
102056
102068
  mianImage.src = "image/basemaps/bingimage.png";
@@ -102084,7 +102096,7 @@ class baseLayerSwitch extends ol_control_Control {
102084
102096
  dropDown.className = "mirage-mapswitch-baseLayerPicker-dropDown";
102085
102097
  mianImage.src = e2.currentTarget.children[0].src;
102086
102098
  mianLabel.innerHTML = e2.currentTarget.innerText;
102087
- xmap.setBaseLayer(e2.currentTarget.innerText);
102099
+ setBaseLayer(e2.currentTarget.innerText);
102088
102100
  }, false);
102089
102101
  dropDown.appendChild(selectedItem);
102090
102102
  });
@@ -102467,21 +102479,59 @@ ol_control_Swipe.prototype.postcompose = function(e2) {
102467
102479
  }
102468
102480
  }
102469
102481
  };
102470
- class swipeControl {
102471
- constructor(map6) {
102472
- __publicField(this, "_xmap");
102482
+ class eventTarget {
102483
+ constructor() {
102484
+ __publicField(this, "events", new Map());
102485
+ }
102486
+ on(type, handler, once) {
102487
+ if (!this.events.has(type)) {
102488
+ this.events.set(type, []);
102489
+ }
102490
+ (this.events.get(type) || []).push({
102491
+ handler,
102492
+ once
102493
+ });
102494
+ return () => {
102495
+ this.off(type, handler);
102496
+ };
102497
+ }
102498
+ once(type, handler) {
102499
+ return this.on(type, handler, true);
102500
+ }
102501
+ fire(type, ...args) {
102502
+ let i2 = 0;
102503
+ while (i2 < (this.events.get(type) || []).length) {
102504
+ const handlers = this.events.get(type) || [];
102505
+ const { handler, once } = handlers[i2];
102506
+ if (once) {
102507
+ handlers.splice(i2--, 1);
102508
+ }
102509
+ i2++;
102510
+ handler(...args);
102511
+ }
102512
+ }
102513
+ off(type, handler) {
102514
+ if (!type)
102515
+ return;
102516
+ if (!handler) {
102517
+ this.events.set(type, []);
102518
+ return;
102519
+ }
102520
+ this.events.set(type, (this.events.get(type) || []).filter((item) => item.handler !== handler));
102521
+ }
102522
+ }
102523
+ class swipeControl extends eventTarget {
102524
+ constructor() {
102525
+ super();
102473
102526
  __publicField(this, "_swipe");
102474
- this._xmap = map6;
102475
102527
  this._swipe = new ol_control_Swipe();
102476
102528
  }
102477
102529
  show(leftlayerID, rightlayerID, orientation2 = "vertical") {
102478
- this._xmap.getMap().addControl(this._swipe);
102479
- this._swipe.addLayer(this._xmap.getLayer(leftlayerID), false);
102480
- this._swipe.addLayer(this._xmap.getLayer(rightlayerID), true);
102530
+ this.fire("show", { swipe: this._swipe, leftlayerID, rightlayerID });
102481
102531
  this._swipe.set("orientation", orientation2);
102482
102532
  }
102483
102533
  hide() {
102484
- this._xmap.getMap().removeControl(this._swipe);
102534
+ this.fire("hide", this._swipe);
102485
102535
  }
102486
102536
  }
102487
102537
  var ol_interaction_Transform = function(options) {
@@ -103526,6 +103576,9 @@ class MirageMap extends baseMap {
103526
103576
  __publicField(this, "controls");
103527
103577
  __publicField(this, "selectTransform");
103528
103578
  __publicField(this, "Proj");
103579
+ this._layerArray = [];
103580
+ this.baseLayer = [];
103581
+ this._view = null;
103529
103582
  this._mapOption = {
103530
103583
  zoom: 13,
103531
103584
  center: { lng: 102.103952024454, lat: 26.1693520685273 },
@@ -103577,9 +103630,36 @@ class MirageMap extends baseMap {
103577
103630
  }
103578
103631
  if (option.map) {
103579
103632
  this._mapOption = option.map;
103580
- this._mapOption.basemaps.forEach((element) => {
103581
- if (!element.id) {
103582
- element.id = toolbox.uuid15();
103633
+ this._mapOption.basemaps.forEach((layer) => {
103634
+ if (!layer.id) {
103635
+ layer.id = toolbox.uuid15();
103636
+ }
103637
+ if (this._mapOption.basemap === layer.name) {
103638
+ layer.id = "baselayer";
103639
+ }
103640
+ let mlayer;
103641
+ switch (layer.type) {
103642
+ case layertype.TileGroupLayer:
103643
+ if (layer.layers) {
103644
+ mlayer = new TileGroupLayer(layer.id, layer);
103645
+ }
103646
+ break;
103647
+ case layertype.arcgisMapServer:
103648
+ mlayer = new ArcGisMapServerLayer(layer.id, layer);
103649
+ break;
103650
+ case layertype.arcgisMapTile:
103651
+ mlayer = new ArcGisTileXyzLayer(layer.id, layer);
103652
+ break;
103653
+ case layertype.imageLayer:
103654
+ mlayer = new imageLayer(layer.id, layer);
103655
+ break;
103656
+ default:
103657
+ mlayer = new TileXyzLayer(layer.id, layer);
103658
+ break;
103659
+ }
103660
+ this._layerArray.push(mlayer);
103661
+ if (this._mapOption.basemap === layer.name) {
103662
+ this.baseLayer.push(mlayer.layer);
103583
103663
  }
103584
103664
  });
103585
103665
  }
@@ -103592,13 +103672,19 @@ class MirageMap extends baseMap {
103592
103672
  return;
103593
103673
  }
103594
103674
  console.info(user.showlog, "color:orange;font-weight:bold;font-size:14px;", "color:blue;font-size:12px;line-height:20px;");
103595
- this._layerArray = [];
103596
- this._view = null;
103597
103675
  this.controls = {
103598
103676
  locationbar: null,
103599
103677
  baseLayerSwitch: null,
103600
- swipe: new swipeControl(this)
103678
+ swipe: new swipeControl()
103601
103679
  };
103680
+ this.controls.swipe.on("show", (e2) => {
103681
+ this._map.addControl(e2.swipe);
103682
+ e2.swipe.addLayer(this.getLayer(e2.leftlayerID), false);
103683
+ e2.swipe.addLayer(this.getLayer(e2.rightlayerID), true);
103684
+ });
103685
+ this.controls.swipe.on("hide", (swipe) => {
103686
+ this._map.removeControl(swipe);
103687
+ });
103602
103688
  this.Proj = new proj();
103603
103689
  this.init(mapID);
103604
103690
  } else {
@@ -103659,7 +103745,6 @@ class MirageMap extends baseMap {
103659
103745
  }
103660
103746
  }
103661
103747
  });
103662
- this.baseLayer = this.initLayer();
103663
103748
  this._map = new ol_Map({
103664
103749
  controls: defaults$1({ zoom: false }),
103665
103750
  target: mapID,
@@ -103679,7 +103764,9 @@ class MirageMap extends baseMap {
103679
103764
  this._map.addControl(this.controls.locationbar);
103680
103765
  }
103681
103766
  }
103682
- this.controls.baseLayerSwitch = new baseLayerSwitch({}, this._mapOption.basemaps, this);
103767
+ this.controls.baseLayerSwitch = new baseLayerSwitch({}, this._mapOption.basemaps, (e2) => {
103768
+ this.setBaseLayer(e2);
103769
+ });
103683
103770
  this._map.addControl(this.controls.baseLayerSwitch);
103684
103771
  this._select = new Select$1({
103685
103772
  condition: pointerMove,
@@ -103914,11 +104001,6 @@ class MirageMap extends baseMap {
103914
104001
  });
103915
104002
  return control;
103916
104003
  }
103917
- initLayer() {
103918
- return [
103919
- this.getBaseLayer(this._mapOption.basemap)
103920
- ];
103921
- }
103922
104004
  setBaseLayerVisible(isshow = true) {
103923
104005
  let baselayer = this.getUserLayer("baselayer");
103924
104006
  baselayer.layer.setVisible(isshow);
@@ -103926,26 +104008,24 @@ class MirageMap extends baseMap {
103926
104008
  setBaseLayer(layername, maskOption) {
103927
104009
  if (this._map) {
103928
104010
  let layers = this._map.getLayers();
103929
- this._layerArray.forEach((layer, index2) => {
103930
- if (layer.layerid == "baselayer") {
103931
- this._layerArray.splice(index2, 1);
103932
- }
103933
- });
104011
+ let baselayer = this.getBaseLayer(layername);
104012
+ baselayer.layer.set("layerid", "baselayer");
103934
104013
  layers.forEach((layer, index2) => {
103935
104014
  if (layer.get("layerid") == "baselayer") {
103936
104015
  layers.remove(layer);
103937
- layers.insertAt(0, this.getBaseLayer(layername));
104016
+ layers.insertAt(0, baselayer.layer);
103938
104017
  }
103939
104018
  });
103940
- let baselayer = this.getUserLayer("baselayer");
103941
- baselayer.addFilter(maskOption);
104019
+ if (maskOption) {
104020
+ baselayer.addFilter(maskOption);
104021
+ }
103942
104022
  }
103943
104023
  }
103944
104024
  getMap() {
103945
104025
  return this._map;
103946
104026
  }
103947
104027
  getLayers() {
103948
- return this._mapOption.basemaps;
104028
+ return this._layerArray;
103949
104029
  }
103950
104030
  getLayer(layerid) {
103951
104031
  if (this._map) {
@@ -103985,77 +104065,14 @@ class MirageMap extends baseMap {
103985
104065
  }
103986
104066
  getBaseLayer(layername) {
103987
104067
  let layerGroup;
103988
- this._mapOption.basemaps.forEach((layer) => {
103989
- if (layer.name == layername) {
103990
- switch (layer.type) {
103991
- case layertype.TileGroupLayer:
103992
- if (layer.layers) {
103993
- layerGroup = new TileGroupLayer("baselayer", layer);
103994
- }
103995
- break;
103996
- case layertype.arcgisMapServer:
103997
- layerGroup = new ArcGisMapServerLayer("baselayer", {
103998
- id: "baselayer",
103999
- name: layer.name,
104000
- url: layer.url,
104001
- ratio: 1,
104002
- params: {}
104003
- });
104004
- break;
104005
- case layertype.arcgisMapTile:
104006
- layerGroup = new ArcGisTileXyzLayer("baselayer", {
104007
- url: layer.url
104008
- });
104009
- break;
104010
- case layertype.imageLayer:
104011
- layerGroup = new imageLayer("baselayer", {
104012
- url: layer.url,
104013
- ImageExtent: layer.ImageExtent
104014
- });
104015
- break;
104016
- default:
104017
- layerGroup = new TileXyzLayer("baselayer", layer);
104018
- break;
104019
- }
104020
- }
104068
+ layerGroup = this._layerArray.find(function(item, index2, arr) {
104069
+ return item.option.name == layername;
104021
104070
  });
104022
- this._layerArray.push(layerGroup);
104023
- return layerGroup.layer;
104071
+ layerGroup.layerid = "baselayer";
104072
+ layerGroup.layer.set("layerid", "baselayer");
104073
+ return layerGroup;
104024
104074
  }
104025
104075
  addLayer(layer) {
104026
- if (layer.type) {
104027
- let layerGroup;
104028
- switch (layer.type) {
104029
- case layertype.TileGroupLayer:
104030
- if (layer.layers) {
104031
- layerGroup = new TileGroupLayer(layer.id, layer);
104032
- }
104033
- break;
104034
- case layertype.arcgisMapServer:
104035
- layerGroup = new ArcGisMapServerLayer(layer.id, {
104036
- name: layer.name,
104037
- url: layer.url,
104038
- ratio: 1,
104039
- params: {}
104040
- });
104041
- break;
104042
- case layertype.arcgisMapTile:
104043
- layerGroup = new ArcGisTileXyzLayer(layer.id, {
104044
- url: layer.url
104045
- });
104046
- break;
104047
- case layertype.imageLayer:
104048
- layerGroup = new imageLayer(layer.id, {
104049
- url: layer.url,
104050
- ImageExtent: layer.ImageExtent
104051
- });
104052
- break;
104053
- default:
104054
- layerGroup = new TileXyzLayer(layer.id, layer);
104055
- break;
104056
- }
104057
- layer = layerGroup;
104058
- }
104059
104076
  layer.appendTo(this._map, this.GraphicLayer, this.selectTransform);
104060
104077
  this._layerArray.push(layer);
104061
104078
  }
@@ -105047,9 +105064,6 @@ class HeatmapLayer extends baseGraphicLayer {
105047
105064
  });
105048
105065
  this.layer.set("layerid", layerid);
105049
105066
  }
105050
- appendTo(map6) {
105051
- map6.addLayer(this.layer);
105052
- }
105053
105067
  setBlur(blur) {
105054
105068
  this.layer.setBlur(parseInt(blur, 10));
105055
105069
  }
@@ -105057,74 +105071,6 @@ class HeatmapLayer extends baseGraphicLayer {
105057
105071
  this.layer.setRadius(parseInt(radius, 10));
105058
105072
  }
105059
105073
  }
105060
- class WmsLayer extends baseTileLayer {
105061
- constructor(layerid, Options) {
105062
- super(layerid, Options);
105063
- this.layertype = "ImageWMSLayer";
105064
- this.layerSource = new ImageWMS$1(Options);
105065
- this.layer = new ol_layer_Image({
105066
- source: this.layerSource
105067
- });
105068
- this.layer.set("layerid", layerid);
105069
- if (Options.ImageExtent) {
105070
- this.layer.setExtent(transformExtent(Options.ImageExtent, "EPSG:4326", "EPSG:3857"));
105071
- }
105072
- this.layerSource.on("tileloadstart", function() {
105073
- });
105074
- this.layerSource.on("tileloadend", function() {
105075
- });
105076
- this.layerSource.on("tileloaderror", function() {
105077
- });
105078
- }
105079
- }
105080
- class WmtsLayer extends baseTileLayer {
105081
- constructor(layerid, Options) {
105082
- super(layerid, Options);
105083
- __publicField(this, "option");
105084
- this.layertype = "ImageWMSLayer";
105085
- this.option = { zIndex: 900, ImageExtent: null, ImageExtentWKID: crsType.EPSG3857, opacity: 0.7, attributions: "", layer: "", url: "", matrixSet: "GoogleMapsCompatible", format: "image/png" };
105086
- this.option = Object.assign({}, this.option, Options);
105087
- const projection2 = get$5("EPSG:3857");
105088
- const projectionExtent = projection2.getExtent();
105089
- const size11 = getWidth(projectionExtent) / 256;
105090
- const resolutions = new Array(19);
105091
- const matrixIds = new Array(19);
105092
- for (let z2 = 0; z2 < 19; ++z2) {
105093
- resolutions[z2] = size11 / Math.pow(2, z2);
105094
- matrixIds[z2] = z2;
105095
- }
105096
- this.layerSource = new WMTS$1({
105097
- attributions: this.option.attributions,
105098
- url: this.option.url,
105099
- layer: this.option.layer,
105100
- matrixSet: this.option.matrixSet,
105101
- format: this.option.format,
105102
- projection: projection2,
105103
- tileGrid: new WMTSTileGrid$1({
105104
- origin: getTopLeft(projectionExtent),
105105
- resolutions,
105106
- matrixIds
105107
- }),
105108
- style: "default",
105109
- wrapX: true
105110
- });
105111
- this.layer = new TileLayer$2({
105112
- zIndex: this.option.zIndex,
105113
- opacity: this.option.opacity,
105114
- source: this.layerSource
105115
- });
105116
- this.layer.set("layerid", layerid);
105117
- if (Options.ImageExtent) {
105118
- this.layer.setExtent(transformExtent(Options.ImageExtent, "EPSG:4326", "EPSG:3857"));
105119
- }
105120
- this.layerSource.on("tileloadstart", function() {
105121
- });
105122
- this.layerSource.on("tileloadend", function() {
105123
- });
105124
- this.layerSource.on("tileloaderror", function() {
105125
- });
105126
- }
105127
- }
105128
105074
  var XML_SCHEMA_INSTANCE_URI = "http://www.w3.org/2001/XMLSchema-instance";
105129
105075
  function createElementNS(namespaceURI, qualifiedName) {
105130
105076
  return getDocument().createElementNS(namespaceURI, qualifiedName);
@@ -111726,92 +111672,6 @@ class DayNightLayer extends baseGraphicLayer {
111726
111672
  this._source.setTime(value);
111727
111673
  }
111728
111674
  }
111729
- class XWebGLPointsLayer extends baseLayer {
111730
- constructor(layerid, options) {
111731
- super(layerid, options);
111732
- this.layertype = "XWebGLPointsLayer";
111733
- this._source = new VectorSource$1({ wrapX: false });
111734
- var style2 = {
111735
- symbol: {
111736
- symbolType: "circle",
111737
- size: [
111738
- "interpolate",
111739
- ["exponential", 2.5],
111740
- ["zoom"],
111741
- 2,
111742
- 1,
111743
- 12,
111744
- 8,
111745
- 16,
111746
- 12
111747
- ],
111748
- color: "#ffed02",
111749
- offset: [0, 0],
111750
- opacity: 0.95
111751
- }
111752
- };
111753
- this.Layer = new WebGLPointsLayer$1({
111754
- source: this._source,
111755
- style: style2,
111756
- disableHitDetection: false,
111757
- colorCallback: function(feature2, vertex, component) {
111758
- debugger;
111759
- console.log("colorCallback");
111760
- },
111761
- attributes: [
111762
- {
111763
- name: "color",
111764
- callback: function(feature2) {
111765
- debugger;
111766
- console.log(feature2);
111767
- }
111768
- },
111769
- {
111770
- name: "size",
111771
- callback: function(feature2) {
111772
- debugger;
111773
- console.log(feature2);
111774
- }
111775
- },
111776
- {
111777
- name: "GraphicColor",
111778
- callback: function(feature2) {
111779
- debugger;
111780
- console.log(feature2);
111781
- }
111782
- }
111783
- ]
111784
- });
111785
- this.Layer.on(featureType.onClick, (e2) => {
111786
- if (e2.feature) {
111787
- this.trigger(featureType.onClick, e2.feature.getProperties());
111788
- }
111789
- });
111790
- }
111791
- appendTo(map6) {
111792
- var _a2;
111793
- this._map = map6;
111794
- (_a2 = this._map) == null ? void 0 : _a2.addLayer(this.Layer);
111795
- }
111796
- addGeoJson(classname, GeoJson) {
111797
- let FeaturesList = this.formatJsonTo3857(GeoJson);
111798
- this.addFeatures(classname, FeaturesList);
111799
- }
111800
- addFeatures(classname, FeaturesList) {
111801
- var _a2;
111802
- debugger;
111803
- let zoom = (_a2 = this._map) == null ? void 0 : _a2.getView().getZoom();
111804
- FeaturesList.forEach((feature2) => {
111805
- feature2.set("classname", classname);
111806
- if (!feature2.get("featuretype")) {
111807
- feature2.set("featuretype", featuretype.vector);
111808
- }
111809
- let sss = MirageDefaultStyle.getFeaturesDefaultStyle(feature2, zoom, false);
111810
- feature2.setStyle(sss);
111811
- });
111812
- this._source.addFeatures(FeaturesList);
111813
- }
111814
- }
111815
111675
  class kmlLayer extends baseGraphicLayer {
111816
111676
  constructor(layerid, options) {
111817
111677
  super(layerid, options);
@@ -111836,45 +111696,6 @@ class kmlLayer extends baseGraphicLayer {
111836
111696
  });
111837
111697
  }
111838
111698
  }
111839
- class TifLayer extends baseTileLayer {
111840
- constructor(layerid, options) {
111841
- super(layerid, options);
111842
- __publicField(this, "option");
111843
- this.option = { zIndex: 900, url: "", ImageExtent: null, ImageExtentWKID: crsType.EPSG3857 };
111844
- this.option = Object.assign({}, this.option, options);
111845
- if (this.option.ImageExtentWKID == crsType.EPSG4326) {
111846
- this.option.ImageExtent = transformExtent(this.option.ImageExtent, "EPSG:3857", "EPSG:4326");
111847
- }
111848
- this.layertype = "GeoTIFFLayer";
111849
- this.layerSource = new GeoTIFF({
111850
- sources: [
111851
- {
111852
- url: this.option.url
111853
- }
111854
- ]
111855
- });
111856
- this.layer = new TileLayer({
111857
- source: this.layerSource
111858
- });
111859
- this.layer.set("layerid", layerid);
111860
- if (this.option.ImageExtent) {
111861
- this.layer.setExtent(this.option.ImageExtent, "EPSG:4326", "EPSG:3857");
111862
- }
111863
- this.layerSource.on("tileloadstart", function() {
111864
- });
111865
- this.layerSource.on("tileloadend", function() {
111866
- });
111867
- this.layerSource.on("tileloaderror", function() {
111868
- });
111869
- }
111870
- padLeft(val, num, radix) {
111871
- let str = val.toString(radix || 10);
111872
- return (new Array(num).join("0") + str).slice(-num);
111873
- }
111874
- appendTo(map6) {
111875
- map6.addLayer(this.layer);
111876
- }
111877
- }
111878
111699
  var ol_coordinate_dist2d = function(p110, p210) {
111879
111700
  var dx = p110[0] - p210[0];
111880
111701
  var dy = p110[1] - p210[1];
@@ -113379,12 +113200,6 @@ class PathLayer extends baseGraphicLayer {
113379
113200
  var path2 = pathfinder.findPath(p110, p210);
113380
113201
  console.log(path2);
113381
113202
  }
113382
- appendTo(map6) {
113383
- var _a2;
113384
- this._map = map6;
113385
- if (this.layer)
113386
- (_a2 = this._map) == null ? void 0 : _a2.addLayer(this.layer);
113387
- }
113388
113203
  addGeoJsonUrl(classname, url) {
113389
113204
  let rs = this.getFile(url, "text/json");
113390
113205
  let json = this.formatJsonTo3857(JSON.parse(rs));
@@ -113457,6 +113272,103 @@ class PathLayer extends baseGraphicLayer {
113457
113272
  });
113458
113273
  }
113459
113274
  }
113275
+ class WmsLayer extends baseTileLayer {
113276
+ constructor(layerid, Options) {
113277
+ super(layerid, Options);
113278
+ this.layertype = "ImageWMSLayer";
113279
+ this.layerSource = new ImageWMS$1(Options);
113280
+ this.layer = new ol_layer_Image({
113281
+ source: this.layerSource
113282
+ });
113283
+ this.layer.set("layerid", layerid);
113284
+ if (this.mImageExtent) {
113285
+ this.layer.setExtent(this.mImageExtent);
113286
+ }
113287
+ this.layerSource.on("tileloadstart", function() {
113288
+ });
113289
+ this.layerSource.on("tileloadend", function() {
113290
+ });
113291
+ this.layerSource.on("tileloaderror", function() {
113292
+ });
113293
+ }
113294
+ }
113295
+ class WmtsLayer extends baseTileLayer {
113296
+ constructor(layerid, Options) {
113297
+ super(layerid, Options);
113298
+ this.layertype = "ImageWMSLayer";
113299
+ let option = { opacity: 0.7, attributions: "", layer: "", matrixSet: "GoogleMapsCompatible", format: "image/png" };
113300
+ this.option = Object.assign({}, option, Options);
113301
+ const projection2 = get$5("EPSG:3857");
113302
+ const projectionExtent = projection2.getExtent();
113303
+ const size11 = getWidth(projectionExtent) / 256;
113304
+ const resolutions = new Array(19);
113305
+ const matrixIds = new Array(19);
113306
+ for (let z2 = 0; z2 < 19; ++z2) {
113307
+ resolutions[z2] = size11 / Math.pow(2, z2);
113308
+ matrixIds[z2] = z2;
113309
+ }
113310
+ this.layerSource = new WMTS$1({
113311
+ attributions: this.option.attributions,
113312
+ url: this.option.url,
113313
+ layer: this.option.layer,
113314
+ matrixSet: this.option.matrixSet,
113315
+ format: this.option.format,
113316
+ projection: projection2,
113317
+ tileGrid: new WMTSTileGrid$1({
113318
+ origin: getTopLeft(projectionExtent),
113319
+ resolutions,
113320
+ matrixIds
113321
+ }),
113322
+ style: "default",
113323
+ wrapX: true
113324
+ });
113325
+ this.layer = new TileLayer$2({
113326
+ zIndex: this.option.zIndex,
113327
+ opacity: this.option.opacity,
113328
+ source: this.layerSource
113329
+ });
113330
+ this.layer.set("layerid", layerid);
113331
+ if (this.mImageExtent) {
113332
+ this.layer.setExtent(this.mImageExtent);
113333
+ }
113334
+ this.layerSource.on("tileloadstart", function() {
113335
+ });
113336
+ this.layerSource.on("tileloadend", function() {
113337
+ });
113338
+ this.layerSource.on("tileloaderror", function() {
113339
+ });
113340
+ }
113341
+ }
113342
+ class TifLayer extends baseTileLayer {
113343
+ constructor(layerid, options) {
113344
+ super(layerid, options);
113345
+ this.layertype = "GeoTIFFLayer";
113346
+ this.layerSource = new GeoTIFF({
113347
+ sources: [
113348
+ {
113349
+ url: this.option.url
113350
+ }
113351
+ ]
113352
+ });
113353
+ this.layer = new TileLayer({
113354
+ source: this.layerSource
113355
+ });
113356
+ this.layer.set("layerid", layerid);
113357
+ if (this.mImageExtent) {
113358
+ this.layer.setExtent(this.mImageExtent);
113359
+ }
113360
+ this.layerSource.on("tileloadstart", function() {
113361
+ });
113362
+ this.layerSource.on("tileloadend", function() {
113363
+ });
113364
+ this.layerSource.on("tileloaderror", function() {
113365
+ });
113366
+ }
113367
+ padLeft(val, num, radix) {
113368
+ let str = val.toString(radix || 10);
113369
+ return (new Array(num).join("0") + str).slice(-num);
113370
+ }
113371
+ }
113460
113372
  var ol_layer_GeoImage = function(options) {
113461
113373
  ol_layer_Image.call(this, options);
113462
113374
  };
@@ -113634,14 +113546,10 @@ ol_source_GeoImage.prototype.calculateExtent = function(usemask) {
113634
113546
  class GeoImageLayer extends baseTileLayer {
113635
113547
  constructor(layerid, options) {
113636
113548
  super(layerid, options);
113637
- __publicField(this, "option");
113638
113549
  __publicField(this, "GraphicLayer");
113639
113550
  __publicField(this, "graphic");
113640
113551
  __publicField(this, "mSelectTransform");
113641
- this.option = {
113642
- zIndex: 900,
113643
- projection: "EPSG:3857",
113644
- url: "",
113552
+ let option = {
113645
113553
  imageCenter: [0, 0],
113646
113554
  imageScale: [1, 1],
113647
113555
  imageRotate: 0,
@@ -113649,14 +113557,14 @@ class GeoImageLayer extends baseTileLayer {
113649
113557
  opacity: 1,
113650
113558
  hashEdit: false
113651
113559
  };
113652
- this.option = Object.assign({}, this.option, options);
113560
+ this.option = Object.assign({}, this.option, option);
113653
113561
  if (this.option.ImageExtentWKID == crsType.EPSG4326) {
113654
113562
  this.option.imageCenter = fromLonLat(this.option.imageCenter);
113655
113563
  }
113656
113564
  this.layertype = "GeoImageLayer";
113657
113565
  this.layerSource = new ol_source_GeoImage({
113658
113566
  url: this.option.url,
113659
- projection: this.option.projection,
113567
+ imageMask: [],
113660
113568
  imageCenter: this.option.imageCenter,
113661
113569
  imageScale: this.option.imageScale,
113662
113570
  imageRotate: Number(this.option.imageRotate * Math.PI / 180)
@@ -113722,6 +113630,7 @@ class GeoImageLayer extends baseTileLayer {
113722
113630
  }
113723
113631
  appendTo(map6, mGraphicLayer, mSelectTransform) {
113724
113632
  map6.addLayer(this.layer);
113633
+ this.isAdded = true;
113725
113634
  this.mSelectTransform = mSelectTransform;
113726
113635
  this.GraphicLayer = mGraphicLayer;
113727
113636
  }
@@ -113786,31 +113695,114 @@ class PbfLayer extends baseLayer {
113786
113695
  });
113787
113696
  this.layer.set("layerid", layerid);
113788
113697
  }
113698
+ }
113699
+ class XWebGLPointsLayer extends baseLayer {
113700
+ constructor(layerid, options) {
113701
+ super(layerid, options);
113702
+ this.layertype = "XWebGLPointsLayer";
113703
+ this._source = new VectorSource$1({ wrapX: false });
113704
+ var style2 = {
113705
+ symbol: {
113706
+ symbolType: "circle",
113707
+ size: [
113708
+ "interpolate",
113709
+ ["exponential", 2.5],
113710
+ ["zoom"],
113711
+ 2,
113712
+ 1,
113713
+ 12,
113714
+ 8,
113715
+ 16,
113716
+ 12
113717
+ ],
113718
+ color: "#ffed02",
113719
+ offset: [0, 0],
113720
+ opacity: 0.95
113721
+ }
113722
+ };
113723
+ this.Layer = new WebGLPointsLayer$1({
113724
+ source: this._source,
113725
+ style: style2,
113726
+ disableHitDetection: false,
113727
+ colorCallback: function(feature2, vertex, component) {
113728
+ debugger;
113729
+ console.log("colorCallback");
113730
+ },
113731
+ attributes: [
113732
+ {
113733
+ name: "color",
113734
+ callback: function(feature2) {
113735
+ debugger;
113736
+ console.log(feature2);
113737
+ }
113738
+ },
113739
+ {
113740
+ name: "size",
113741
+ callback: function(feature2) {
113742
+ debugger;
113743
+ console.log(feature2);
113744
+ }
113745
+ },
113746
+ {
113747
+ name: "GraphicColor",
113748
+ callback: function(feature2) {
113749
+ debugger;
113750
+ console.log(feature2);
113751
+ }
113752
+ }
113753
+ ]
113754
+ });
113755
+ this.Layer.on(featureType.onClick, (e2) => {
113756
+ if (e2.feature) {
113757
+ this.trigger(featureType.onClick, e2.feature.getProperties());
113758
+ }
113759
+ });
113760
+ }
113789
113761
  appendTo(map6) {
113790
- map6.addLayer(this.layer);
113762
+ var _a2;
113763
+ this._map = map6;
113764
+ (_a2 = this._map) == null ? void 0 : _a2.addLayer(this.Layer);
113765
+ }
113766
+ addGeoJson(classname, GeoJson) {
113767
+ let FeaturesList = this.formatJsonTo3857(GeoJson);
113768
+ this.addFeatures(classname, FeaturesList);
113769
+ }
113770
+ addFeatures(classname, FeaturesList) {
113771
+ var _a2;
113772
+ debugger;
113773
+ let zoom = (_a2 = this._map) == null ? void 0 : _a2.getView().getZoom();
113774
+ FeaturesList.forEach((feature2) => {
113775
+ feature2.set("classname", classname);
113776
+ if (!feature2.get("featuretype")) {
113777
+ feature2.set("featuretype", featuretype.vector);
113778
+ }
113779
+ let sss = MirageDefaultStyle.getFeaturesDefaultStyle(feature2, zoom, false);
113780
+ feature2.setStyle(sss);
113781
+ });
113782
+ this._source.addFeatures(FeaturesList);
113791
113783
  }
113792
113784
  }
113793
113785
  var index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
113794
113786
  __proto__: null,
113795
113787
  ClusterLayer,
113796
113788
  HeatmapLayer,
113797
- TileXyzLayer,
113798
- ArcGisMapServerLayer,
113799
- ArcGisTileXyzLayer,
113800
- WmsLayer,
113801
- WmtsLayer,
113802
113789
  WfsLayer,
113803
113790
  ClusterImageLayer,
113804
113791
  GraphicLayer,
113805
113792
  GraphicImageLayer,
113806
113793
  DayNightLayer,
113807
- XWebGLPointsLayer,
113808
113794
  kmlLayer,
113809
- TifLayer,
113810
113795
  PathLayer,
113796
+ TileXyzLayer,
113797
+ ArcGisMapServerLayer,
113798
+ ArcGisTileXyzLayer,
113799
+ WmsLayer,
113800
+ WmtsLayer,
113801
+ TifLayer,
113811
113802
  imageLayer,
113812
113803
  GeoImageLayer,
113813
- PbfLayer
113804
+ PbfLayer,
113805
+ XWebGLPointsLayer
113814
113806
  }, Symbol.toStringTag, { value: "Module" }));
113815
113807
  class tykg extends base {
113816
113808
  constructor() {
@@ -114028,47 +114020,6 @@ var resource = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
114028
114020
  __proto__: null,
114029
114021
  getJSON
114030
114022
  }, Symbol.toStringTag, { value: "Module" }));
114031
- class eventTarget {
114032
- constructor() {
114033
- __publicField(this, "events", new Map());
114034
- }
114035
- on(type, handler, once) {
114036
- if (!this.events.has(type)) {
114037
- this.events.set(type, []);
114038
- }
114039
- (this.events.get(type) || []).push({
114040
- handler,
114041
- once
114042
- });
114043
- return () => {
114044
- this.off(type, handler);
114045
- };
114046
- }
114047
- once(type, handler) {
114048
- return this.on(type, handler, true);
114049
- }
114050
- fire(type, ...args) {
114051
- let i2 = 0;
114052
- while (i2 < (this.events.get(type) || []).length) {
114053
- const handlers = this.events.get(type) || [];
114054
- const { handler, once } = handlers[i2];
114055
- if (once) {
114056
- handlers.splice(i2--, 1);
114057
- }
114058
- i2++;
114059
- handler(...args);
114060
- }
114061
- }
114062
- off(type, handler) {
114063
- if (!type)
114064
- return;
114065
- if (!handler) {
114066
- this.events.set(type, []);
114067
- return;
114068
- }
114069
- this.events.set(type, (this.events.get(type) || []).filter((item) => item.handler !== handler));
114070
- }
114071
- }
114072
114023
  class baseGaode {
114073
114024
  constructor(options) {
114074
114025
  __publicField(this, "option");