@aibee/crc-bmap 0.0.15 → 0.0.16

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
@@ -839,6 +839,7 @@ var Layer = class extends Object3D5 {
839
839
  var GraphicLayer = class extends Layer {
840
840
  constructor(context) {
841
841
  super(context);
842
+ __publicField(this, "graphicMap", /* @__PURE__ */ new Map());
842
843
  }
843
844
  getCenter() {
844
845
  const box = new Box33().setFromObject(this);
@@ -847,6 +848,7 @@ var GraphicLayer = class extends Layer {
847
848
  createGraphic(options) {
848
849
  const graphic = new Graphic(this.context, options);
849
850
  this.add(graphic);
851
+ this.graphicMap.set(options.id, graphic);
850
852
  return graphic;
851
853
  }
852
854
  /**
@@ -2349,6 +2351,26 @@ var BMap = class extends EventDispatcher6 {
2349
2351
  this.context.control.enableRotate = true;
2350
2352
  }
2351
2353
  }
2354
+ /**
2355
+ * 根据nodeId 获取graphic
2356
+ */
2357
+ getGraphicByNodeId(nodeId) {
2358
+ if (this.context.currentFloor) {
2359
+ return this.context.currentFloor.graphicLayer.graphicMap.get(nodeId) || null;
2360
+ }
2361
+ return null;
2362
+ }
2363
+ deleteGraphic(graphic) {
2364
+ if (this.context.currentFloor) {
2365
+ this.context.currentFloor.graphicLayer.remove(graphic);
2366
+ graphic.dispose();
2367
+ this.context.currentFloor.graphicLayer.graphicMap.delete(graphic.options.id);
2368
+ }
2369
+ }
2370
+ createGraphicByOptions(options) {
2371
+ var _a;
2372
+ return (_a = this.context.currentFloor) == null ? void 0 : _a.graphicLayer.createGraphic(options);
2373
+ }
2352
2374
  dispose() {
2353
2375
  this.context.dispose();
2354
2376
  clearTextTexture();