deeptwins-engine-3d 0.1.21 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -50,7 +50,7 @@ loadCss(Cesium.buildModuleUrl('Widgets/widgets.css'));
50
50
  export var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
51
51
  _classCallCheck(this, DeepTwinsEngine3D);
52
52
  });
53
- _defineProperty(DeepTwinsEngine3D, "Version", "0.1.21");
53
+ _defineProperty(DeepTwinsEngine3D, "Version", "0.1.23");
54
54
  _defineProperty(DeepTwinsEngine3D, "Map", Map);
55
55
  _defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
56
56
  _defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
@@ -4,10 +4,12 @@ export default class Airspace {
4
4
  options: any;
5
5
  primitives: any[];
6
6
  isDestroyed: boolean;
7
+ private _events;
7
8
  constructor(map: any, geoJson: any, options?: any);
8
9
  getMap(): any;
9
10
  private _canOperate;
10
11
  sliceArrayAsync(data: any[], chunkSize?: number): void;
12
+ on(eventType: string, event: any): void;
11
13
  create(source: any[]): void;
12
14
  destroy(): void;
13
15
  }
@@ -21,6 +21,7 @@ var Airspace = /*#__PURE__*/function () {
21
21
  _defineProperty(this, "options", void 0);
22
22
  _defineProperty(this, "primitives", []);
23
23
  _defineProperty(this, "isDestroyed", false);
24
+ _defineProperty(this, "_events", {});
24
25
  this._mapContext = map._mapContext;
25
26
  this.options = merge(DEFAULT_AIRSPACE_STYLE(), options);
26
27
  var source = BaseSource.geoJsonToGeoCartesian3Array(geoJson);
@@ -49,16 +50,24 @@ var Airspace = /*#__PURE__*/function () {
49
50
  value: function sliceArrayAsync(data) {
50
51
  var _this = this;
51
52
  var chunkSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10000;
52
- if (!this._canOperate()) {
53
- return;
54
- }
53
+ if (!this._canOperate()) return;
55
54
  var processChunk = function processChunk() {
56
- if (data.length === 0) return;
55
+ if (data.length === 0) {
56
+ _this._events.over && _this._events.over();
57
+ return;
58
+ }
57
59
  _this.create(data.splice(0, chunkSize));
58
60
  setTimeout(processChunk, 0); // 让出主线程,下一帧继续
59
61
  };
60
62
  processChunk();
61
63
  }
64
+
65
+ // 事件
66
+ }, {
67
+ key: "on",
68
+ value: function on(eventType, event) {
69
+ this._events[eventType] = event;
70
+ }
62
71
  }, {
63
72
  key: "create",
64
73
  value: function create(source) {
@@ -95,6 +104,7 @@ var Airspace = /*#__PURE__*/function () {
95
104
  this.primitives[i].removeAll();
96
105
  }
97
106
  this.primitives = [];
107
+ this._events = {};
98
108
  }
99
109
  }]);
100
110
  return Airspace;