deeptwins-engine-3d 0.1.44 → 0.1.45

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.
@@ -157,9 +157,7 @@ var BaseVideo = /*#__PURE__*/function () {
157
157
  key: "_drawCanvas",
158
158
  value: function _drawCanvas(options) {
159
159
  var width = options.width,
160
- height = options.height,
161
- _options$featherSize = options.featherSize,
162
- featherSize = _options$featherSize === void 0 ? 100 : _options$featherSize;
160
+ height = options.height;
163
161
  var canvas = document.createElement('canvas');
164
162
  canvas.width = width;
165
163
  canvas.height = height;
@@ -15,6 +15,7 @@ import { cloneDeep, flattenDeep, merge } from 'lodash';
15
15
  import { v4 as uuidv4 } from 'uuid';
16
16
  import { DEFAULT_POINT_CLUSTER_STYLE } from "../constant";
17
17
  import BaseSource from "../graphicLayer/BaseSource";
18
+ import BillboardPrimitive from "../graphicLayer/BillboardPrimitive";
18
19
  import PrimitiveCluster from "../tool/PrimitiveCluster";
19
20
  import * as utils from "../tool/utils";
20
21
  var PointCluster = /*#__PURE__*/function () {
@@ -68,17 +69,21 @@ var PointCluster = /*#__PURE__*/function () {
68
69
  primitiveCluster.pixelRange = this.options.pixelRange;
69
70
  primitiveCluster.minimumClusterSize = 1;
70
71
  this.source.forEach(function (t) {
71
- var billboard = _objectSpread(_objectSpread({
72
- id: uuidv4()
73
- }, merge({
72
+ var style = BillboardPrimitive.handleOptions(merge({
74
73
  width: 30,
75
74
  height: 30
76
- }, _this.options.billboard || {})), {}, {
75
+ }, utils.styleFun(cloneDeep(_this.options.billboard || {}), t.properties)));
76
+ var billboard = _objectSpread(_objectSpread({
77
+ id: uuidv4()
78
+ }, style), {}, {
77
79
  position: t.positions,
78
- source: t
80
+ properties: t.properties,
81
+ geometry: t.geometry,
82
+ style: _this.options.billboard
79
83
  });
80
84
  _this.billboards.push(billboard);
81
- _this.billboardsCollectionCombine.add(billboard);
85
+ var billboarded = _this.billboardsCollectionCombine.add(billboard);
86
+ billboarded.properties = t.properties;
82
87
  });
83
88
 
84
89
  // 将数据传给primitiveCluster的标签属性
@@ -101,16 +106,38 @@ var PointCluster = /*#__PURE__*/function () {
101
106
  }
102
107
  }
103
108
  if (step == -1) {
104
- if (_this.options.billboard) {
105
- var _this$options$billboa, _this$options$billboa2, _this$options$billboa3;
106
- cluster.billboard.image = (_this$options$billboa = _this.options.billboard) === null || _this$options$billboa === void 0 ? void 0 : _this$options$billboa.image;
107
- cluster.billboard.width = (_this$options$billboa2 = _this.options.billboard) === null || _this$options$billboa2 === void 0 ? void 0 : _this$options$billboa2.width;
108
- cluster.billboard.height = (_this$options$billboa3 = _this.options.billboard) === null || _this$options$billboa3 === void 0 ? void 0 : _this$options$billboa3.height;
109
- } else {
109
+ if (_this.options.onCustomRender) {
110
110
  cluster.billboard.show = false;
111
+ var clusterPoints = _this.billboards.filter(function (t) {
112
+ return clusteredEntities.includes(t.id);
113
+ });
114
+ _this.options.onCustomRender(step, utils.cartesian3ToLngLatAlt(cluster.billboard.position), clusterPoints);
115
+ } else {
116
+ if (_this.options.billboard) {
117
+ var billboard = _this.billboardsCollectionCombine._billboards.find(function (t) {
118
+ return clusteredEntities.includes(t.id);
119
+ });
120
+ var style = BillboardPrimitive.handleOptions(merge({
121
+ width: 30,
122
+ height: 30
123
+ }, utils.styleFun(cloneDeep(_this.options.billboard || {}), (billboard === null || billboard === void 0 ? void 0 : billboard.properties) || {})));
124
+ Object.keys(style).forEach(function (key) {
125
+ cluster.billboard[key] = style[key];
126
+ });
127
+ } else {
128
+ cluster.billboard.show = false;
129
+ }
111
130
  }
112
131
  } else {
113
- cluster.billboard.image = _this._drawImage(clusteredEntities.length, _this.options.grade[step].size, _this.options.grade[step].color);
132
+ if (_this.options.onCustomRender) {
133
+ cluster.billboard.show = false;
134
+ var _clusterPoints = _this.billboards.filter(function (t) {
135
+ return clusteredEntities.includes(t.id);
136
+ });
137
+ _this.options.onCustomRender(step, utils.cartesian3ToLngLatAlt(cluster.billboard.position), _clusterPoints);
138
+ } else {
139
+ cluster.billboard.image = _this._drawImage(clusteredEntities.length, _this.options.grade[step].size, _this.options.grade[step].color);
140
+ }
114
141
  }
115
142
  });
116
143
  }