@aibee/crc-bmap 0.0.20 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/bmap.esm.js CHANGED
@@ -707,7 +707,8 @@ var defaultOptions2 = {
707
707
  text: "",
708
708
  level: 1,
709
709
  collision_enable: true,
710
- opacity: 1
710
+ opacity: 1,
711
+ id: ""
711
712
  };
712
713
  var Poi = class extends Object3D4 {
713
714
  constructor(context, options) {
@@ -916,6 +917,12 @@ var PoiLayer = class extends Layer {
916
917
  this.remove(poi);
917
918
  poi.dispose();
918
919
  }
920
+ removePoiById(id) {
921
+ const poi = this.pois.find((item) => item.options.id === id);
922
+ if (poi) {
923
+ this.removePoi(poi);
924
+ }
925
+ }
919
926
  /**
920
927
  * 保存poi按照level排序
921
928
  * @param poi
@@ -2237,6 +2244,7 @@ var BMap = class extends EventDispatcher6 {
2237
2244
  const [x, y] = item.info.geometry.cds;
2238
2245
  item.info.geometry.cds = [x - center2[0], y - center2[1]];
2239
2246
  }
2247
+ item.info.transformToBuildingGround = true;
2240
2248
  });
2241
2249
  }
2242
2250
  if (!this.config.useFloorCache) {
@@ -2308,6 +2316,9 @@ var BMap = class extends EventDispatcher6 {
2308
2316
  }
2309
2317
  createGraphicPoi(graphic, options) {
2310
2318
  if (this.context.currentFloor) {
2319
+ if (options.id === void 0) {
2320
+ options.id = graphic.options.id;
2321
+ }
2311
2322
  const poi = this.context.currentFloor.addPoi(options);
2312
2323
  const position = graphic.getCenter();
2313
2324
  position.z += graphic.options.height / 2;
@@ -2486,24 +2497,30 @@ var BMap = class extends EventDispatcher6 {
2486
2497
  }
2487
2498
  createGraphicByOptions(options) {
2488
2499
  var _a;
2489
- if (this.currentBuildGround) {
2490
- const center2 = getCenter(this.currentBuildGround.info.geometry.cds[0]);
2491
- if (options.geometry.type === "polygon") {
2492
- options.geometry.cds.map((cds) => {
2493
- if (Array.isArray(cds)) {
2494
- cds.forEach((coord) => {
2495
- coord[0] -= center2[0];
2496
- coord[1] -= center2[1];
2497
- });
2498
- }
2499
- });
2500
- } else {
2501
- const [x, y] = options.geometry.cds;
2502
- options.geometry.cds = [x - center2[0], y - center2[1]];
2500
+ if (!options.transformToBuildingGround) {
2501
+ if (this.currentBuildGround) {
2502
+ const center2 = getCenter(this.currentBuildGround.info.geometry.cds[0]);
2503
+ if (options.geometry.type === "polygon") {
2504
+ options.geometry.cds.map((cds) => {
2505
+ if (Array.isArray(cds)) {
2506
+ cds.forEach((coord) => {
2507
+ coord[0] -= center2[0];
2508
+ coord[1] -= center2[1];
2509
+ });
2510
+ }
2511
+ });
2512
+ } else {
2513
+ const [x, y] = options.geometry.cds;
2514
+ options.geometry.cds = [x - center2[0], y - center2[1]];
2515
+ }
2503
2516
  }
2504
2517
  }
2505
2518
  return (_a = this.context.currentFloor) == null ? void 0 : _a.graphicLayer.createGraphic(options);
2506
2519
  }
2520
+ removePoiById(id) {
2521
+ var _a;
2522
+ return (_a = this.context.currentFloor) == null ? void 0 : _a.poiLayer.removePoiById(id);
2523
+ }
2507
2524
  dispose() {
2508
2525
  this.context.dispose();
2509
2526
  clearTextTexture();