@deck.gl/aggregation-layers 8.10.0-alpha.7 → 9.0.0-alpha.4

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 (185) hide show
  1. package/dist/dist.dev.js +9372 -356
  2. package/dist/es5/aggregation-layer.js +4 -6
  3. package/dist/es5/aggregation-layer.js.map +1 -1
  4. package/dist/es5/contour-layer/contour-layer.js +13 -2
  5. package/dist/es5/contour-layer/contour-layer.js.map +1 -1
  6. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js +12 -1
  7. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js.map +1 -1
  8. package/dist/es5/cpu-grid-layer/grid-aggregator.js +12 -8
  9. package/dist/es5/cpu-grid-layer/grid-aggregator.js.map +1 -1
  10. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js +27 -13
  11. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js.map +1 -1
  12. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js +19 -10
  13. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js.map +1 -1
  14. package/dist/es5/grid-aggregation-layer.js +7 -9
  15. package/dist/es5/grid-aggregation-layer.js.map +1 -1
  16. package/dist/es5/grid-layer/grid-layer.js +1 -1
  17. package/dist/es5/grid-layer/grid-layer.js.map +1 -1
  18. package/dist/es5/heatmap-layer/heatmap-layer-utils.js +3 -3
  19. package/dist/es5/heatmap-layer/heatmap-layer-utils.js.map +1 -1
  20. package/dist/es5/heatmap-layer/heatmap-layer.js +58 -55
  21. package/dist/es5/heatmap-layer/heatmap-layer.js.map +1 -1
  22. package/dist/es5/heatmap-layer/triangle-layer.js +22 -12
  23. package/dist/es5/heatmap-layer/triangle-layer.js.map +1 -1
  24. package/dist/es5/hexagon-layer/hexagon-aggregator.js.map +1 -1
  25. package/dist/es5/hexagon-layer/hexagon-layer.js +2 -0
  26. package/dist/es5/hexagon-layer/hexagon-layer.js.map +1 -1
  27. package/dist/es5/index.js.map +1 -1
  28. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js +23 -20
  29. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js.map +1 -1
  30. package/dist/es5/screen-grid-layer/screen-grid-layer.js +6 -6
  31. package/dist/es5/screen-grid-layer/screen-grid-layer.js.map +1 -1
  32. package/dist/es5/utils/aggregation-operation-utils.js.map +1 -1
  33. package/dist/es5/utils/bin-sorter.js.map +1 -1
  34. package/dist/es5/utils/cpu-aggregator.js +11 -7
  35. package/dist/es5/utils/cpu-aggregator.js.map +1 -1
  36. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +7 -2
  37. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +1 -1
  38. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +83 -60
  39. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +1 -1
  40. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +3 -3
  41. package/dist/es5/utils/grid-aggregation-utils.js.map +1 -1
  42. package/dist/es5/utils/prop-utils.js.map +1 -1
  43. package/dist/es5/utils/resource-utils.js +12 -23
  44. package/dist/es5/utils/resource-utils.js.map +1 -1
  45. package/dist/esm/aggregation-layer.js +4 -5
  46. package/dist/esm/aggregation-layer.js.map +1 -1
  47. package/dist/esm/contour-layer/contour-layer.js +7 -1
  48. package/dist/esm/contour-layer/contour-layer.js.map +1 -1
  49. package/dist/esm/cpu-grid-layer/cpu-grid-layer.js +6 -0
  50. package/dist/esm/cpu-grid-layer/cpu-grid-layer.js.map +1 -1
  51. package/dist/esm/cpu-grid-layer/grid-aggregator.js +2 -1
  52. package/dist/esm/cpu-grid-layer/grid-aggregator.js.map +1 -1
  53. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js +19 -10
  54. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js.map +1 -1
  55. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js +13 -10
  56. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js.map +1 -1
  57. package/dist/esm/grid-aggregation-layer.js +4 -8
  58. package/dist/esm/grid-aggregation-layer.js.map +1 -1
  59. package/dist/esm/grid-layer/grid-layer.js +1 -1
  60. package/dist/esm/grid-layer/grid-layer.js.map +1 -1
  61. package/dist/esm/heatmap-layer/heatmap-layer-utils.js +3 -3
  62. package/dist/esm/heatmap-layer/heatmap-layer-utils.js.map +1 -1
  63. package/dist/esm/heatmap-layer/heatmap-layer.js +40 -58
  64. package/dist/esm/heatmap-layer/heatmap-layer.js.map +1 -1
  65. package/dist/esm/heatmap-layer/triangle-layer.js +13 -7
  66. package/dist/esm/heatmap-layer/triangle-layer.js.map +1 -1
  67. package/dist/esm/hexagon-layer/hexagon-aggregator.js.map +1 -1
  68. package/dist/esm/hexagon-layer/hexagon-layer.js +1 -0
  69. package/dist/esm/hexagon-layer/hexagon-layer.js.map +1 -1
  70. package/dist/esm/index.js.map +1 -1
  71. package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js +21 -24
  72. package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js.map +1 -1
  73. package/dist/esm/screen-grid-layer/screen-grid-layer.js +5 -8
  74. package/dist/esm/screen-grid-layer/screen-grid-layer.js.map +1 -1
  75. package/dist/esm/utils/aggregation-operation-utils.js.map +1 -1
  76. package/dist/esm/utils/bin-sorter.js.map +1 -1
  77. package/dist/esm/utils/cpu-aggregator.js +11 -7
  78. package/dist/esm/utils/cpu-aggregator.js.map +1 -1
  79. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js.map +1 -1
  80. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js.map +1 -1
  81. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js.map +1 -1
  82. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js.map +1 -1
  83. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +4 -3
  84. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +1 -1
  85. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +62 -51
  86. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +1 -1
  87. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +3 -3
  88. package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js.map +1 -1
  89. package/dist/esm/utils/grid-aggregation-utils.js.map +1 -1
  90. package/dist/esm/utils/prop-utils.js.map +1 -1
  91. package/dist/esm/utils/resource-utils.js +10 -17
  92. package/dist/esm/utils/resource-utils.js.map +1 -1
  93. package/dist.min.js +185 -30
  94. package/package.json +7 -5
  95. package/src/aggregation-layer.ts +7 -6
  96. package/src/contour-layer/contour-layer.ts +25 -9
  97. package/src/cpu-grid-layer/cpu-grid-layer.ts +8 -3
  98. package/src/cpu-grid-layer/{grid-aggregator.js → grid-aggregator.ts} +28 -4
  99. package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +38 -27
  100. package/src/gpu-grid-layer/gpu-grid-layer.ts +18 -12
  101. package/src/grid-aggregation-layer.ts +39 -13
  102. package/src/grid-layer/grid-layer.ts +2 -2
  103. package/src/heatmap-layer/heatmap-layer-utils.ts +10 -4
  104. package/src/heatmap-layer/heatmap-layer.ts +74 -67
  105. package/src/heatmap-layer/triangle-layer.ts +26 -22
  106. package/src/hexagon-layer/{hexagon-aggregator.js → hexagon-aggregator.ts} +5 -1
  107. package/src/hexagon-layer/hexagon-layer.ts +8 -5
  108. package/src/index.ts +0 -1
  109. package/src/screen-grid-layer/screen-grid-cell-layer.ts +36 -33
  110. package/src/screen-grid-layer/screen-grid-layer.ts +12 -11
  111. package/src/utils/{aggregation-operation-utils.js → aggregation-operation-utils.ts} +8 -2
  112. package/src/utils/bin-sorter.ts +1 -1
  113. package/src/utils/{cpu-aggregator.js → cpu-aggregator.ts} +42 -30
  114. package/src/utils/gpu-grid-aggregation/{gpu-grid-aggregator-constants.js → gpu-grid-aggregator-constants.ts} +4 -4
  115. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +3 -3
  116. package/src/utils/gpu-grid-aggregation/{gpu-grid-aggregator.js → gpu-grid-aggregator.ts} +123 -94
  117. package/src/utils/{grid-aggregation-utils.js → grid-aggregation-utils.ts} +1 -1
  118. package/src/utils/resource-utils.ts +59 -0
  119. package/typed/aggregation-layer.d.ts +4 -3
  120. package/typed/aggregation-layer.d.ts.map +1 -1
  121. package/typed/contour-layer/contour-layer.d.ts +19 -5
  122. package/typed/contour-layer/contour-layer.d.ts.map +1 -1
  123. package/typed/cpu-grid-layer/cpu-grid-layer.d.ts +8 -3
  124. package/typed/cpu-grid-layer/cpu-grid-layer.d.ts.map +1 -1
  125. package/typed/cpu-grid-layer/grid-aggregator.d.ts +16 -4
  126. package/typed/cpu-grid-layer/grid-aggregator.d.ts.map +1 -1
  127. package/typed/gpu-grid-layer/gpu-grid-cell-layer.d.ts +18 -4
  128. package/typed/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +1 -1
  129. package/typed/gpu-grid-layer/gpu-grid-layer.d.ts +8 -3
  130. package/typed/gpu-grid-layer/gpu-grid-layer.d.ts.map +1 -1
  131. package/typed/grid-aggregation-layer.d.ts +39 -4
  132. package/typed/grid-aggregation-layer.d.ts.map +1 -1
  133. package/typed/grid-layer/grid-layer.d.ts +2 -2
  134. package/typed/grid-layer/grid-layer.d.ts.map +1 -1
  135. package/typed/heatmap-layer/heatmap-layer-utils.d.ts +7 -5
  136. package/typed/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -1
  137. package/typed/heatmap-layer/heatmap-layer.d.ts +19 -6
  138. package/typed/heatmap-layer/heatmap-layer.d.ts.map +1 -1
  139. package/typed/heatmap-layer/triangle-layer.d.ts +10 -6
  140. package/typed/heatmap-layer/triangle-layer.d.ts.map +1 -1
  141. package/typed/hexagon-layer/hexagon-aggregator.d.ts +6 -3
  142. package/typed/hexagon-layer/hexagon-aggregator.d.ts.map +1 -1
  143. package/typed/hexagon-layer/hexagon-layer.d.ts +5 -4
  144. package/typed/hexagon-layer/hexagon-layer.d.ts.map +1 -1
  145. package/typed/index.d.ts.map +1 -1
  146. package/typed/screen-grid-layer/screen-grid-cell-layer.d.ts +10 -9
  147. package/typed/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
  148. package/typed/screen-grid-layer/screen-grid-layer.d.ts +6 -4
  149. package/typed/screen-grid-layer/screen-grid-layer.d.ts.map +1 -1
  150. package/typed/utils/aggregation-operation-utils.d.ts +18 -12
  151. package/typed/utils/aggregation-operation-utils.d.ts.map +1 -1
  152. package/typed/utils/bin-sorter.d.ts +1 -1
  153. package/typed/utils/bin-sorter.d.ts.map +1 -1
  154. package/typed/utils/cpu-aggregator.d.ts +28 -14
  155. package/typed/utils/cpu-aggregator.d.ts.map +1 -1
  156. package/typed/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +1 -1
  157. package/typed/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +1 -1
  158. package/typed/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +1 -1
  159. package/typed/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +1 -1
  160. package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +1 -1
  161. package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +1 -1
  162. package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +1 -1
  163. package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +1 -1
  164. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +35 -33
  165. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +1 -1
  166. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +1 -1
  167. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +29 -19
  168. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +1 -1
  169. package/typed/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +1 -1
  170. package/typed/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +1 -1
  171. package/typed/utils/grid-aggregation-utils.d.ts +11 -5
  172. package/typed/utils/grid-aggregation-utils.d.ts.map +1 -1
  173. package/typed/utils/prop-utils.d.ts +1 -1
  174. package/typed/utils/prop-utils.d.ts.map +1 -1
  175. package/typed/utils/resource-utils.d.ts +13 -3
  176. package/typed/utils/resource-utils.d.ts.map +1 -1
  177. package/LICENSE +0 -19
  178. package/src/utils/resource-utils.js +0 -51
  179. /package/src/utils/gpu-grid-aggregation/{aggregate-all-fs.glsl.js → aggregate-all-fs.glsl.ts} +0 -0
  180. /package/src/utils/gpu-grid-aggregation/{aggregate-all-vs.glsl.js → aggregate-all-vs.glsl.ts} +0 -0
  181. /package/src/utils/gpu-grid-aggregation/{aggregate-to-grid-fs.glsl.js → aggregate-to-grid-fs.glsl.ts} +0 -0
  182. /package/src/utils/gpu-grid-aggregation/{aggregate-to-grid-vs.glsl.js → aggregate-to-grid-vs.glsl.ts} +0 -0
  183. /package/src/utils/gpu-grid-aggregation/{gpu-grid-aggregator-utils.js → gpu-grid-aggregator-utils.ts} +0 -0
  184. /package/src/utils/gpu-grid-aggregation/{transform-mean-vs.glsl.js → transform-mean-vs.glsl.ts} +0 -0
  185. /package/src/utils/{prop-utils.js → prop-utils.ts} +0 -0
@@ -9,6 +9,8 @@ exports.default = void 0;
9
9
 
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
11
 
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+
12
14
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
15
 
14
16
  var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
@@ -19,13 +21,15 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
19
21
 
20
22
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
23
 
22
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
-
24
24
  var _heatmapLayerUtils = require("./heatmap-layer-utils");
25
25
 
26
- var _core = require("@luma.gl/core");
26
+ var _constants = require("@luma.gl/constants");
27
27
 
28
- var _core2 = require("@deck.gl/core");
28
+ var _engine = require("@luma.gl/engine");
29
+
30
+ var _webgl = require("@luma.gl/webgl");
31
+
32
+ var _core = require("@deck.gl/core");
29
33
 
30
34
  var _triangleLayer = _interopRequireDefault(require("./triangle-layer"));
31
35
 
@@ -41,8 +45,6 @@ var _maxVs = _interopRequireDefault(require("./max-vs.glsl"));
41
45
 
42
46
  var _maxFs = _interopRequireDefault(require("./max-fs.glsl"));
43
47
 
44
- var _parameters;
45
-
46
48
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
47
49
 
48
50
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
@@ -52,10 +54,15 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
52
54
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
53
55
 
54
56
  var RESOLUTION = 2;
55
- var TEXTURE_OPTIONS = {
57
+ var TEXTURE_PROPS = {
58
+ format: 'rgba8unorm',
56
59
  mipmaps: false,
57
- parameters: (_parameters = {}, (0, _defineProperty2.default)(_parameters, 10240, 9729), (0, _defineProperty2.default)(_parameters, 10241, 9729), (0, _defineProperty2.default)(_parameters, 10242, 33071), (0, _defineProperty2.default)(_parameters, 10243, 33071), _parameters),
58
- dataFormat: 6408
60
+ sampler: {
61
+ minFilter: 'nearest',
62
+ magFilter: 'nearest',
63
+ addressModeU: 'clamp-to-edge',
64
+ addressModeV: 'clamp-to-edge'
65
+ }
59
66
  };
60
67
  var DEFAULT_COLOR_DOMAIN = [0, 0];
61
68
  var AGGREGATION_MODE = {
@@ -110,8 +117,8 @@ var defaultProps = {
110
117
  value: 500
111
118
  }
112
119
  };
113
- var REQUIRED_FEATURES = [_core.FEATURES.BLEND_EQUATION_MINMAX, _core.FEATURES.TEXTURE_FLOAT];
114
- var FLOAT_TARGET_FEATURES = [_core.FEATURES.COLOR_ATTACHMENT_RGBA32F, _core.FEATURES.FLOAT_BLEND];
120
+ var REQUIRED_FEATURES = ['blend-minmax-webgl1', 'texture-formats-float32-webgl1'];
121
+ var FLOAT_TARGET_FEATURES = ['texture-renderable-float32-webgl', 'texture-blend-float-webgl1'];
115
122
  var DIMENSIONS = {
116
123
  data: {
117
124
  props: ['radiusPixels']
@@ -140,14 +147,16 @@ var HeatmapLayer = function (_AggregationLayer) {
140
147
  var _proto = HeatmapLayer.prototype;
141
148
 
142
149
  _proto.initializeState = function initializeState() {
143
- var gl = this.context.gl;
150
+ var _this2 = this;
144
151
 
145
- if (!(0, _core.hasFeatures)(gl, REQUIRED_FEATURES)) {
152
+ if (!REQUIRED_FEATURES.every(function (feature) {
153
+ return _this2.context.device.features.has(feature);
154
+ })) {
146
155
  this.setState({
147
156
  supported: false
148
157
  });
149
158
 
150
- _core2.log.error("HeatmapLayer: ".concat(this.id, " is not supported on this browser"))();
159
+ _core.log.error("HeatmapLayer: ".concat(this.id, " is not supported on this browser"))();
151
160
 
152
161
  return;
153
162
  }
@@ -236,7 +245,7 @@ var HeatmapLayer = function (_AggregationLayer) {
236
245
  id: 'triangle-layer',
237
246
  updateTriggers: updateTriggers
238
247
  }), {
239
- coordinateSystem: _core2.COORDINATE_SYSTEM.DEFAULT,
248
+ coordinateSystem: _core.COORDINATE_SYSTEM.DEFAULT,
240
249
  data: {
241
250
  attributes: {
242
251
  positions: triPositionBuffer,
@@ -265,13 +274,13 @@ var HeatmapLayer = function (_AggregationLayer) {
265
274
  triTexCoordBuffer = _this$state2.triTexCoordBuffer,
266
275
  colorTexture = _this$state2.colorTexture,
267
276
  updateTimer = _this$state2.updateTimer;
268
- weightsTransform === null || weightsTransform === void 0 ? void 0 : weightsTransform.delete();
269
- weightsTexture === null || weightsTexture === void 0 ? void 0 : weightsTexture.delete();
270
- maxWeightTransform === null || maxWeightTransform === void 0 ? void 0 : maxWeightTransform.delete();
271
- maxWeightsTexture === null || maxWeightsTexture === void 0 ? void 0 : maxWeightsTexture.delete();
272
- triPositionBuffer === null || triPositionBuffer === void 0 ? void 0 : triPositionBuffer.delete();
273
- triTexCoordBuffer === null || triTexCoordBuffer === void 0 ? void 0 : triTexCoordBuffer.delete();
274
- colorTexture === null || colorTexture === void 0 ? void 0 : colorTexture.delete();
277
+ weightsTransform === null || weightsTransform === void 0 ? void 0 : weightsTransform.destroy();
278
+ weightsTexture === null || weightsTexture === void 0 ? void 0 : weightsTexture.destroy();
279
+ maxWeightTransform === null || maxWeightTransform === void 0 ? void 0 : maxWeightTransform.destroy();
280
+ maxWeightsTexture === null || maxWeightsTexture === void 0 ? void 0 : maxWeightsTexture.destroy();
281
+ triPositionBuffer === null || triPositionBuffer === void 0 ? void 0 : triPositionBuffer.destroy();
282
+ triTexCoordBuffer === null || triTexCoordBuffer === void 0 ? void 0 : triTexCoordBuffer.destroy();
283
+ colorTexture === null || colorTexture === void 0 ? void 0 : colorTexture.destroy();
275
284
 
276
285
  if (updateTimer) {
277
286
  clearTimeout(updateTimer);
@@ -279,7 +288,7 @@ var HeatmapLayer = function (_AggregationLayer) {
279
288
  };
280
289
 
281
290
  _proto._getAttributeManager = function _getAttributeManager() {
282
- return new _core2.AttributeManager(this.context.gl, {
291
+ return new _core.AttributeManager(this.context.device, {
283
292
  id: this.props.id,
284
293
  stats: this.context.stats
285
294
  });
@@ -288,10 +297,10 @@ var HeatmapLayer = function (_AggregationLayer) {
288
297
  _proto._getChangeFlags = function _getChangeFlags(opts) {
289
298
  var changeFlags = {};
290
299
  var dimensions = this.state.dimensions;
291
- changeFlags.dataChanged = this.isAttributeChanged() || this.isAggregationDirty(opts, {
300
+ changeFlags.dataChanged = this.isAttributeChanged() && 'attribute changed' || this.isAggregationDirty(opts, {
292
301
  compareAll: true,
293
302
  dimension: dimensions.data
294
- });
303
+ }) && 'aggregation is dirty';
295
304
  changeFlags.viewportChanged = opts.changeFlags.viewportChanged;
296
305
  var zoom = this.state.zoom;
297
306
 
@@ -303,22 +312,21 @@ var HeatmapLayer = function (_AggregationLayer) {
303
312
  };
304
313
 
305
314
  _proto._createTextures = function _createTextures() {
306
- var gl = this.context.gl;
307
315
  var _this$state3 = this.state,
308
316
  textureSize = _this$state3.textureSize,
309
317
  format = _this$state3.format,
310
318
  type = _this$state3.type;
311
319
  this.setState({
312
- weightsTexture: new _core.Texture2D(gl, _objectSpread({
320
+ weightsTexture: this.context.device.createTexture(_objectSpread({
313
321
  width: textureSize,
314
322
  height: textureSize,
315
323
  format: format,
316
324
  type: type
317
- }, TEXTURE_OPTIONS)),
318
- maxWeightsTexture: new _core.Texture2D(gl, _objectSpread({
325
+ }, TEXTURE_PROPS)),
326
+ maxWeightsTexture: this.context.device.createTexture(_objectSpread({
319
327
  format: format,
320
328
  type: type
321
- }, TEXTURE_OPTIONS))
329
+ }, TEXTURE_PROPS))
322
330
  });
323
331
  };
324
332
 
@@ -341,13 +349,15 @@ var HeatmapLayer = function (_AggregationLayer) {
341
349
  };
342
350
 
343
351
  _proto._setupTextureParams = function _setupTextureParams() {
344
- var gl = this.context.gl;
352
+ var device = this.context.device;
345
353
  var weightsTextureSize = this.props.weightsTextureSize;
346
- var textureSize = Math.min(weightsTextureSize, (0, _core.getParameters)(gl, 3379));
347
- var floatTargetSupport = (0, _core.hasFeatures)(gl, FLOAT_TARGET_FEATURES);
354
+ var textureSize = Math.min(weightsTextureSize, device.limits.maxTextureDimension2D);
355
+ var floatTargetSupport = FLOAT_TARGET_FEATURES.every(function (feature) {
356
+ return device.features.has(feature);
357
+ });
348
358
 
349
359
  var _getTextureParams = (0, _heatmapLayerUtils.getTextureParams)({
350
- gl: gl,
360
+ device: device,
351
361
  floatTargetSupport: floatTargetSupport
352
362
  }),
353
363
  format = _getTextureParams.format,
@@ -362,7 +372,7 @@ var HeatmapLayer = function (_AggregationLayer) {
362
372
  });
363
373
 
364
374
  if (!floatTargetSupport) {
365
- _core2.log.warn("HeatmapLayer: ".concat(this.id, " rendering to float texture not supported, fallingback to low precession format"))();
375
+ _core.log.warn("HeatmapLayer: ".concat(this.id, " rendering to float texture not supported, fallingback to low precession format"))();
366
376
  }
367
377
  };
368
378
 
@@ -380,11 +390,10 @@ var HeatmapLayer = function (_AggregationLayer) {
380
390
  var _weightsTransform;
381
391
 
382
392
  var shaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
383
- var gl = this.context.gl;
384
393
  var weightsTransform = this.state.weightsTransform;
385
394
  var weightsTexture = this.state.weightsTexture;
386
395
  (_weightsTransform = weightsTransform) === null || _weightsTransform === void 0 ? void 0 : _weightsTransform.delete();
387
- weightsTransform = new _core.Transform(gl, _objectSpread({
396
+ weightsTransform = new _engine.Transform(this.context.device, _objectSpread({
388
397
  id: "".concat(this.id, "-weights-transform"),
389
398
  elementCount: 1,
390
399
  _targetTexture: weightsTexture,
@@ -396,8 +405,6 @@ var HeatmapLayer = function (_AggregationLayer) {
396
405
  };
397
406
 
398
407
  _proto._setupResources = function _setupResources() {
399
- var gl = this.context.gl;
400
-
401
408
  this._createTextures();
402
409
 
403
410
  var _this$state4 = this.state,
@@ -409,7 +416,7 @@ var HeatmapLayer = function (_AggregationLayer) {
409
416
  this._createWeightsTransform(weightsTransformShaders);
410
417
 
411
418
  var maxWeightsTransformShaders = this.getShaders('max-weights-transform');
412
- var maxWeightTransform = new _core.Transform(gl, _objectSpread(_objectSpread({
419
+ var maxWeightTransform = new _engine.Transform(this.context.device, _objectSpread(_objectSpread({
413
420
  id: "".concat(this.id, "-max-weights-transform"),
414
421
  _sourceTextures: {
415
422
  inTexture: weightsTexture
@@ -424,13 +431,13 @@ var HeatmapLayer = function (_AggregationLayer) {
424
431
  maxWeightsTexture: maxWeightsTexture,
425
432
  maxWeightTransform: maxWeightTransform,
426
433
  zoom: null,
427
- triPositionBuffer: new _core.Buffer(gl, {
434
+ triPositionBuffer: this.context.device.createBuffer({
428
435
  byteLength: 48,
429
436
  accessor: {
430
437
  size: 3
431
438
  }
432
439
  }),
433
- triTexCoordBuffer: new _core.Buffer(gl, {
440
+ triTexCoordBuffer: this.context.device.createBuffer({
434
441
  byteLength: 48,
435
442
  accessor: {
436
443
  size: 2
@@ -473,7 +480,7 @@ var HeatmapLayer = function (_AggregationLayer) {
473
480
 
474
481
  var worldBounds = this._commonToWorldBounds(scaledCommonBounds);
475
482
 
476
- if (this.props.coordinateSystem === _core2.COORDINATE_SYSTEM.LNGLAT) {
483
+ if (this.props.coordinateSystem === _core.COORDINATE_SYSTEM.LNGLAT) {
477
484
  worldBounds[1] = Math.max(worldBounds[1], -85.051129);
478
485
  worldBounds[3] = Math.min(worldBounds[3], 85.051129);
479
486
  worldBounds[0] = Math.max(worldBounds[0], -360);
@@ -516,11 +523,11 @@ var HeatmapLayer = function (_AggregationLayer) {
516
523
  width: colorRange.length
517
524
  });
518
525
  } else {
519
- colorTexture = new _core.Texture2D(this.context.gl, _objectSpread({
526
+ colorTexture = this.context.device.createTexture(_objectSpread({
520
527
  data: colors,
521
528
  width: colorRange.length,
522
529
  height: 1
523
- }, TEXTURE_OPTIONS));
530
+ }, TEXTURE_PROPS));
524
531
  }
525
532
 
526
533
  this.setState({
@@ -529,19 +536,17 @@ var HeatmapLayer = function (_AggregationLayer) {
529
536
  };
530
537
 
531
538
  _proto._updateWeightmap = function _updateWeightmap() {
532
- var _this2 = this,
533
- _weightsTexture$setPa;
539
+ var _this3 = this;
534
540
 
535
541
  var _this$props2 = this.props,
536
542
  radiusPixels = _this$props2.radiusPixels,
537
543
  colorDomain = _this$props2.colorDomain,
538
544
  aggregation = _this$props2.aggregation;
539
545
  var _this$state6 = this.state,
540
- weightsTransform = _this$state6.weightsTransform,
541
546
  worldBounds = _this$state6.worldBounds,
542
547
  textureSize = _this$state6.textureSize,
543
- weightsTexture = _this$state6.weightsTexture,
544
548
  weightsScale = _this$state6.weightsScale;
549
+ var weightsTransform = this.state.weightsTransform;
545
550
  this.state.isWeightMapDirty = false;
546
551
 
547
552
  var commonBounds = this._worldToCommonBounds(worldBounds, {
@@ -567,7 +572,7 @@ var HeatmapLayer = function (_AggregationLayer) {
567
572
  weightsTransform.update({
568
573
  elementCount: this.getNumInstances()
569
574
  });
570
- (0, _core.withParameters)(this.context.gl, {
575
+ (0, _webgl.withGLParameters)(this.context.gl, {
571
576
  clearColor: [0, 0, 0, 0]
572
577
  }, function () {
573
578
  weightsTransform.run({
@@ -579,14 +584,12 @@ var HeatmapLayer = function (_AggregationLayer) {
579
584
  blendEquation: 32774
580
585
  },
581
586
  clearRenderTarget: true,
582
- attributes: _this2.getAttributes(),
583
- moduleSettings: _this2.getModuleSettings()
587
+ attributes: _this3.getAttributes(),
588
+ moduleSettings: _this3.getModuleSettings()
584
589
  });
585
590
  });
586
591
 
587
592
  this._updateMaxWeightValue();
588
-
589
- weightsTexture.setParameters((_weightsTexture$setPa = {}, (0, _defineProperty2.default)(_weightsTexture$setPa, 10240, 9729), (0, _defineProperty2.default)(_weightsTexture$setPa, 10241, 9729), _weightsTexture$setPa));
590
593
  };
591
594
 
592
595
  _proto._debouncedUpdateWeightmap = function _debouncedUpdateWeightmap() {
@@ -631,7 +634,7 @@ var HeatmapLayer = function (_AggregationLayer) {
631
634
  var viewport = this.context.viewport;
632
635
  var textureSize = this.state.textureSize;
633
636
  var coordinateSystem = this.props.coordinateSystem;
634
- var offsetMode = useLayerCoordinateSystem && (coordinateSystem === _core2.COORDINATE_SYSTEM.LNGLAT_OFFSETS || coordinateSystem === _core2.COORDINATE_SYSTEM.METER_OFFSETS);
637
+ var offsetMode = useLayerCoordinateSystem && (coordinateSystem === _core.COORDINATE_SYSTEM.LNGLAT_OFFSETS || coordinateSystem === _core.COORDINATE_SYSTEM.METER_OFFSETS);
635
638
  var offsetOriginCommon = offsetMode ? viewport.projectPosition(this.props.coordinateOrigin) : [0, 0];
636
639
  var size = textureSize * RESOLUTION / viewport.scale;
637
640
  var bottomLeftCommon;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/heatmap-layer/heatmap-layer.ts"],"names":["RESOLUTION","TEXTURE_OPTIONS","mipmaps","parameters","dataFormat","DEFAULT_COLOR_DOMAIN","AGGREGATION_MODE","SUM","MEAN","defaultProps","getPosition","type","value","x","position","getWeight","intensity","min","radiusPixels","max","colorRange","defaultColorRange","threshold","colorDomain","optional","aggregation","weightsTextureSize","debounceTimeout","REQUIRED_FEATURES","FEATURES","BLEND_EQUATION_MINMAX","TEXTURE_FLOAT","FLOAT_TARGET_FEATURES","COLOR_ATTACHMENT_RGBA32F","FLOAT_BLEND","DIMENSIONS","data","props","HeatmapLayer","state","initializeState","gl","context","setState","supported","log","error","id","_setupTextureParams","_setupAttributes","_setupResources","shouldUpdateState","changeFlags","somethingChanged","updateState","opts","_updateHeatmapState","oldProps","_getChangeFlags","dataChanged","viewportChanged","boundsChanged","_updateBounds","_updateTextureRenderingBounds","clearTimeout","updateTimer","isWeightMapDirty","viewportZoomChanged","_debouncedUpdateWeightmap","_updateColorTexture","_updateWeightmap","zoom","viewport","renderLayers","weightsTexture","triPositionBuffer","triTexCoordBuffer","maxWeightsTexture","colorTexture","updateTriggers","TriangleLayerClass","getSubLayerClass","TriangleLayer","getSubLayerProps","coordinateSystem","COORDINATE_SYSTEM","DEFAULT","attributes","positions","texCoords","vertexCount","maxTexture","aggregationMode","texture","finalizeState","weightsTransform","maxWeightTransform","delete","_getAttributeManager","AttributeManager","stats","dimensions","isAttributeChanged","isAggregationDirty","compareAll","dimension","_createTextures","textureSize","format","Texture2D","width","height","attributeManager","getAttributeManager","add","size","accessor","weights","positionAttributeName","Math","floatTargetSupport","weightsScale","warn","getShaders","vs","vsMax","_fs","fsMax","weightsVs","weightsFs","_createWeightsTransform","shaders","Transform","elementCount","_targetTexture","_targetTextureVarying","weightsTransformShaders","maxWeightsTransformShaders","_sourceTextures","inTexture","Buffer","byteLength","updateShaders","shaderOptions","_updateMaxWeightValue","run","blend","depthTest","blendFunc","blendEquation","forceUpdate","viewportCorners","unproject","map","p","fround","visibleWorldBounds","newState","worldBounds","scaledCommonBounds","_worldToCommonBounds","_commonToWorldBounds","LNGLAT","normalizedCommonBounds","subData","textureBounds","projectPosition","colors","Uint8Array","setImageData","length","commonBounds","useLayerCoordinateSystem","metersPerPixel","distanceScales","metersPerUnit","uniforms","textureWidth","update","getNumInstances","clearColor","clearRenderTarget","getAttributes","moduleSettings","getModuleSettings","setParameters","fromTimer","setTimeout","bind","minLong","minLat","maxLong","maxLat","offsetMode","LNGLAT_OFFSETS","METER_OFFSETS","offsetOriginCommon","coordinateOrigin","scale","bottomLeftCommon","topRightCommon","xMin","yMin","xMax","yMax","bottomLeftWorld","unprojectPosition","topRightWorld","slice","concat","AggregationLayer","layerName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsBA;;AAQA;;AASA;;AAeA;;AACA;;A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ACL,CACEO,gBAAgB,CAAC,CAAD,CAAhB,GAAsBH,kBAAkB,CAAC,CAAD,CAD1C,EAEEG,gBAAgB,CAAC,CAAD,CAAhB,GAAsBH,kBAAkB,CAAC,CAAD,CAF1C,EAGEI,cAAc,CAAC,CAAD,CAAd,GAAoBJ,kBAAkB,CAAC,CAAD,CAHxC,EAIEI,cAAc,CAAC,CAAD,CAAd,GAAoBJ,kBAAkB,CAAC,CAAD,CAJxC,CADK,EAOLjF,IAPK,EAQLA,IARK,CAAP;AAUD,G;;SAID8C,oB,GAAA,8BAAqBU,YAArB,EAAmC;AACjC,qDAAiCA,YAAjC;AAAA,QAAO8B,IAAP;AAAA,QAAaC,IAAb;AAAA,QAAmBC,IAAnB;AAAA,QAAyBC,IAAzB;;AACA,QAAOpI,QAAP,GAAmB,KAAK9B,OAAxB,CAAO8B,QAAP;AACA,QAAMqI,eAAe,GAAGrI,QAAQ,CAACsI,iBAAT,CAA2B,CAACL,IAAD,EAAOC,IAAP,CAA3B,CAAxB;AACA,QAAMK,aAAa,GAAGvI,QAAQ,CAACsI,iBAAT,CAA2B,CAACH,IAAD,EAAOC,IAAP,CAA3B,CAAtB;AAEA,WAAOC,eAAe,CAACG,KAAhB,CAAsB,CAAtB,EAAyB,CAAzB,EAA4BC,MAA5B,CAAmCF,aAAa,CAACC,KAAd,CAAoB,CAApB,EAAuB,CAAvB,CAAnC,CAAP;AACD,G;;;EAjgBOE,yB;;;AAHW5K,Y,CAIZ6K,S,GAAY,c;AAJA7K,Y,CAKZ7B,Y,GAAeA,Y","sourcesContent":["// Copyright (c) 2015 - 2019 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n/* global setTimeout clearTimeout */\nimport GL from '@luma.gl/constants';\nimport {\n getBounds,\n boundsContain,\n packVertices,\n scaleToAspectRatio,\n getTextureCoordinates,\n getTextureParams\n} from './heatmap-layer-utils';\nimport {\n Buffer,\n Texture2D,\n Transform,\n getParameters,\n withParameters,\n FEATURES,\n hasFeatures\n} from '@luma.gl/core';\nimport {\n Accessor,\n AccessorFunction,\n AttributeManager,\n ChangeFlags,\n Color,\n COORDINATE_SYSTEM,\n Layer,\n LayerContext,\n LayersList,\n log,\n Position,\n UpdateParameters,\n DefaultProps\n} from '@deck.gl/core';\nimport TriangleLayer from './triangle-layer';\nimport AggregationLayer, {AggregationLayerProps} from '../aggregation-layer';\nimport {defaultColorRange, colorRangeToFlatArray} from '../utils/color-utils';\nimport weightsVs from './weights-vs.glsl';\nimport weightsFs from './weights-fs.glsl';\nimport vsMax from './max-vs.glsl';\nimport fsMax from './max-fs.glsl';\n\nconst RESOLUTION = 2; // (number of common space pixels) / (number texels)\nconst TEXTURE_OPTIONS = {\n mipmaps: false,\n parameters: {\n [GL.TEXTURE_MAG_FILTER]: GL.LINEAR,\n [GL.TEXTURE_MIN_FILTER]: GL.LINEAR,\n [GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,\n [GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE\n },\n dataFormat: GL.RGBA\n};\nconst DEFAULT_COLOR_DOMAIN = [0, 0];\nconst AGGREGATION_MODE = {\n SUM: 0,\n MEAN: 1\n};\n\nconst defaultProps: DefaultProps<HeatmapLayerProps> = {\n getPosition: {type: 'accessor', value: x => x.position},\n getWeight: {type: 'accessor', value: 1},\n intensity: {type: 'number', min: 0, value: 1},\n radiusPixels: {type: 'number', min: 1, max: 100, value: 50},\n colorRange: defaultColorRange,\n threshold: {type: 'number', min: 0, max: 1, value: 0.05},\n colorDomain: {type: 'array', value: null, optional: true},\n // 'SUM' or 'MEAN'\n aggregation: 'SUM',\n weightsTextureSize: {type: 'number', min: 128, max: 2048, value: 2048},\n debounceTimeout: {type: 'number', min: 0, max: 1000, value: 500}\n};\n\nconst REQUIRED_FEATURES = [\n FEATURES.BLEND_EQUATION_MINMAX, // max weight calculation\n FEATURES.TEXTURE_FLOAT // weight-map as texture\n];\n\nconst FLOAT_TARGET_FEATURES = [\n FEATURES.COLOR_ATTACHMENT_RGBA32F, // ability to render to float texture\n FEATURES.FLOAT_BLEND // ability to blend when rendering to float texture\n];\n\nconst DIMENSIONS = {\n data: {\n props: ['radiusPixels']\n }\n};\n\nexport type HeatmapLayerProps<DataT = any> = _HeatmapLayerProps<DataT> &\n AggregationLayerProps<DataT>;\n\ntype _HeatmapLayerProps<DataT> = {\n /**\n * Radius of the circle in pixels, to which the weight of an object is distributed.\n *\n * @default 30\n */\n radiusPixels?: number;\n\n /**\n * Specified as an array of colors [color1, color2, ...].\n *\n * @default `6-class YlOrRd` - [colorbrewer](http://colorbrewer2.org/#type=sequential&scheme=YlOrRd&n=6)\n */\n colorRange?: Color[];\n\n /**\n * Value that is multiplied with the total weight at a pixel to obtain the final weight.\n *\n * @default 1\n */\n intensity?: number;\n\n /**\n * Ratio of the fading weight to the max weight, between `0` and `1`.\n *\n * For example, `0.1` affects all pixels with weight under 10% of the max.\n *\n * Ignored when `colorDomain` is specified.\n * @default 0.05\n */\n threshold?: number;\n\n /**\n * Controls how weight values are mapped to the `colorRange`, as an array of two numbers [`minValue`, `maxValue`].\n *\n * @default null\n */\n colorDomain?: [number, number] | null;\n\n /**\n * Defines the type of aggregation operation\n *\n * V valid values are 'SUM', 'MEAN'.\n *\n * @default 'SUM'\n */\n aggregation?: 'SUM' | 'MEAN';\n\n /**\n * Specifies the size of weight texture.\n * @default 2048\n */\n weightsTextureSize?: number;\n\n /**\n * Interval in milliseconds during which changes to the viewport don't trigger aggregation.\n *\n * @default 500\n */\n debounceTimeout?: number;\n\n /**\n * Method called to retrieve the position of each object.\n *\n * @default d => d.position\n */\n getPosition?: AccessorFunction<DataT, Position>;\n\n /**\n * The weight of each object.\n *\n * @default 1\n */\n getWeight?: Accessor<DataT, number>;\n};\n\n/** Visualizes the spatial distribution of data. */\nexport default class HeatmapLayer<\n DataT = any,\n ExtraPropsT extends {} = {}\n> extends AggregationLayer<DataT, ExtraPropsT & Required<_HeatmapLayerProps<DataT>>> {\n static layerName = 'HeatmapLayer';\n static defaultProps = defaultProps;\n\n state!: AggregationLayer<DataT>['state'] & {\n supported: boolean;\n colorDomain?: number[];\n isWeightMapDirty?: boolean;\n weightsTexture?: Texture2D;\n zoom?: number;\n worldBounds?: number[];\n normalizedCommonBounds?: number[];\n updateTimer?: any;\n triPositionBuffer?: Buffer;\n triTexCoordBuffer?: Buffer;\n };\n\n initializeState() {\n const {gl} = this.context;\n if (!hasFeatures(gl, REQUIRED_FEATURES)) {\n this.setState({supported: false});\n log.error(`HeatmapLayer: ${this.id} is not supported on this browser`)();\n return;\n }\n super.initializeAggregationLayer(DIMENSIONS);\n this.setState({supported: true, colorDomain: DEFAULT_COLOR_DOMAIN});\n this._setupTextureParams();\n this._setupAttributes();\n this._setupResources();\n }\n\n shouldUpdateState({changeFlags}: UpdateParameters<this>) {\n // Need to be updated when viewport changes\n return changeFlags.somethingChanged;\n }\n\n /* eslint-disable max-statements,complexity */\n updateState(opts: UpdateParameters<this>) {\n if (!this.state.supported) {\n return;\n }\n super.updateState(opts);\n this._updateHeatmapState(opts);\n }\n\n _updateHeatmapState(opts: UpdateParameters<this>) {\n const {props, oldProps} = opts;\n const changeFlags = this._getChangeFlags(opts);\n\n if (changeFlags.dataChanged || changeFlags.viewportChanged) {\n // if data is changed, do not debounce and immediately update the weight map\n changeFlags.boundsChanged = this._updateBounds(changeFlags.dataChanged);\n this._updateTextureRenderingBounds();\n }\n\n if (changeFlags.dataChanged || changeFlags.boundsChanged) {\n // Update weight map immediately\n clearTimeout(this.state.updateTimer);\n this.setState({isWeightMapDirty: true});\n } else if (changeFlags.viewportZoomChanged) {\n // Update weight map when zoom stops\n this._debouncedUpdateWeightmap();\n }\n\n if (props.colorRange !== oldProps.colorRange) {\n this._updateColorTexture(opts);\n }\n\n if (this.state.isWeightMapDirty) {\n this._updateWeightmap();\n }\n\n this.setState({zoom: opts.context.viewport.zoom});\n }\n\n renderLayers(): LayersList | Layer {\n if (!this.state.supported) {\n return [];\n }\n const {\n weightsTexture,\n triPositionBuffer,\n triTexCoordBuffer,\n maxWeightsTexture,\n colorTexture,\n colorDomain\n } = this.state;\n const {updateTriggers, intensity, threshold, aggregation} = this.props;\n\n const TriangleLayerClass = this.getSubLayerClass('triangle', TriangleLayer);\n\n return new TriangleLayerClass(\n this.getSubLayerProps({\n id: 'triangle-layer',\n updateTriggers\n }),\n {\n // position buffer is filled with world coordinates generated from viewport.unproject\n // i.e. LNGLAT if geospatial, CARTESIAN otherwise\n coordinateSystem: COORDINATE_SYSTEM.DEFAULT,\n data: {\n attributes: {\n positions: triPositionBuffer,\n texCoords: triTexCoordBuffer\n }\n },\n vertexCount: 4,\n maxTexture: maxWeightsTexture,\n colorTexture,\n aggregationMode: AGGREGATION_MODE[aggregation] || 0,\n texture: weightsTexture,\n intensity,\n threshold,\n colorDomain\n }\n );\n }\n\n finalizeState(context: LayerContext) {\n super.finalizeState(context);\n const {\n weightsTransform,\n weightsTexture,\n maxWeightTransform,\n maxWeightsTexture,\n triPositionBuffer,\n triTexCoordBuffer,\n colorTexture,\n updateTimer\n } = this.state;\n weightsTransform?.delete();\n weightsTexture?.delete();\n maxWeightTransform?.delete();\n maxWeightsTexture?.delete();\n triPositionBuffer?.delete();\n triTexCoordBuffer?.delete();\n colorTexture?.delete();\n if (updateTimer) {\n clearTimeout(updateTimer);\n }\n }\n\n // PRIVATE\n\n // override Composite layer private method to create AttributeManager instance\n _getAttributeManager() {\n return new AttributeManager(this.context.gl, {\n id: this.props.id,\n stats: this.context.stats\n });\n }\n\n _getChangeFlags(opts: UpdateParameters<this>) {\n const changeFlags: Partial<ChangeFlags> & {\n boundsChanged?: boolean;\n viewportZoomChanged?: boolean;\n } = {};\n const {dimensions} = this.state;\n changeFlags.dataChanged =\n this.isAttributeChanged() || // if any attribute is changed\n this.isAggregationDirty(opts, {\n compareAll: true,\n dimension: dimensions.data\n });\n changeFlags.viewportChanged = opts.changeFlags.viewportChanged;\n\n const {zoom} = this.state;\n if (!opts.context.viewport || opts.context.viewport.zoom !== zoom) {\n changeFlags.viewportZoomChanged = true;\n }\n\n return changeFlags;\n }\n\n _createTextures() {\n const {gl} = this.context;\n const {textureSize, format, type} = this.state;\n\n this.setState({\n weightsTexture: new Texture2D(gl, {\n width: textureSize,\n height: textureSize,\n format,\n type,\n ...TEXTURE_OPTIONS\n }),\n maxWeightsTexture: new Texture2D(gl, {format, type, ...TEXTURE_OPTIONS}) // 1 X 1 texture,\n });\n }\n\n _setupAttributes() {\n const attributeManager = this.getAttributeManager()!;\n attributeManager.add({\n positions: {size: 3, type: GL.DOUBLE, accessor: 'getPosition'},\n weights: {size: 1, accessor: 'getWeight'}\n });\n this.setState({positionAttributeName: 'positions'});\n }\n\n _setupTextureParams() {\n const {gl} = this.context;\n const {weightsTextureSize} = this.props;\n\n const textureSize = Math.min(weightsTextureSize, getParameters(gl, gl.MAX_TEXTURE_SIZE));\n const floatTargetSupport = hasFeatures(gl, FLOAT_TARGET_FEATURES);\n const {format, type} = getTextureParams({gl, floatTargetSupport});\n const weightsScale = floatTargetSupport ? 1 : 1 / 255;\n this.setState({textureSize, format, type, weightsScale});\n if (!floatTargetSupport) {\n log.warn(\n `HeatmapLayer: ${this.id} rendering to float texture not supported, fallingback to low precession format`\n )();\n }\n }\n\n getShaders(type) {\n return super.getShaders(\n type === 'max-weights-transform'\n ? {\n vs: vsMax,\n _fs: fsMax\n }\n : {\n vs: weightsVs,\n _fs: weightsFs\n }\n );\n }\n\n _createWeightsTransform(shaders = {}) {\n const {gl} = this.context;\n let {weightsTransform} = this.state;\n const {weightsTexture} = this.state;\n weightsTransform?.delete();\n\n weightsTransform = new Transform(gl, {\n id: `${this.id}-weights-transform`,\n elementCount: 1,\n _targetTexture: weightsTexture,\n _targetTextureVarying: 'weightsTexture',\n ...shaders\n });\n this.setState({weightsTransform});\n }\n\n _setupResources() {\n const {gl} = this.context;\n this._createTextures();\n const {textureSize, weightsTexture, maxWeightsTexture} = this.state;\n\n const weightsTransformShaders = this.getShaders('weights-transform');\n this._createWeightsTransform(weightsTransformShaders);\n\n const maxWeightsTransformShaders = this.getShaders('max-weights-transform');\n const maxWeightTransform = new Transform(gl, {\n id: `${this.id}-max-weights-transform`,\n _sourceTextures: {\n inTexture: weightsTexture\n },\n _targetTexture: maxWeightsTexture,\n _targetTextureVarying: 'outTexture',\n ...maxWeightsTransformShaders,\n elementCount: textureSize * textureSize\n });\n\n this.setState({\n weightsTexture,\n maxWeightsTexture,\n maxWeightTransform,\n zoom: null,\n triPositionBuffer: new Buffer(gl, {\n byteLength: 48,\n accessor: {size: 3}\n }),\n triTexCoordBuffer: new Buffer(gl, {\n byteLength: 48,\n accessor: {size: 2}\n })\n });\n }\n\n // overwrite super class method to update transform model\n updateShaders(shaderOptions) {\n // sahder params (modules, injects) changed, update model object\n this._createWeightsTransform(shaderOptions);\n }\n\n _updateMaxWeightValue() {\n const {maxWeightTransform} = this.state;\n maxWeightTransform.run({\n parameters: {\n blend: true,\n depthTest: false,\n blendFunc: [GL.ONE, GL.ONE],\n blendEquation: GL.MAX\n }\n });\n }\n\n // Computes world bounds area that needs to be processed for generate heatmap\n _updateBounds(forceUpdate: any = false): boolean {\n const {viewport} = this.context;\n\n // Unproject all 4 corners of the current screen coordinates into world coordinates (lng/lat)\n // Takes care of viewport has non zero bearing/pitch (i.e axis not aligned with world coordiante system)\n const viewportCorners = [\n viewport.unproject([0, 0]),\n viewport.unproject([viewport.width, 0]),\n viewport.unproject([viewport.width, viewport.height]),\n viewport.unproject([0, viewport.height])\n ].map(p => p.map(Math.fround));\n\n // #1: get world bounds for current viewport extends\n const visibleWorldBounds = getBounds(viewportCorners); // TODO: Change to visible bounds\n\n const newState: Partial<HeatmapLayer['state']> = {visibleWorldBounds, viewportCorners};\n let boundsChanged = false;\n\n if (\n forceUpdate ||\n !this.state.worldBounds ||\n !boundsContain(this.state.worldBounds, visibleWorldBounds)\n ) {\n // #2 : convert world bounds to common (Flat) bounds\n // #3 : extend common bounds to match aspect ratio with viewport\n const scaledCommonBounds = this._worldToCommonBounds(visibleWorldBounds);\n\n // #4 :convert aligned common bounds to world bounds\n const worldBounds = this._commonToWorldBounds(scaledCommonBounds);\n\n // Clip webmercator projection limits\n if (this.props.coordinateSystem === COORDINATE_SYSTEM.LNGLAT) {\n worldBounds[1] = Math.max(worldBounds[1], -85.051129);\n worldBounds[3] = Math.min(worldBounds[3], 85.051129);\n worldBounds[0] = Math.max(worldBounds[0], -360);\n worldBounds[2] = Math.min(worldBounds[2], 360);\n }\n\n // #5: now convert world bounds to common using Layer's coordiante system and origin\n const normalizedCommonBounds = this._worldToCommonBounds(worldBounds);\n\n newState.worldBounds = worldBounds;\n newState.normalizedCommonBounds = normalizedCommonBounds;\n\n boundsChanged = true;\n }\n this.setState(newState);\n return boundsChanged;\n }\n\n _updateTextureRenderingBounds() {\n // Just render visible portion of the texture\n const {triPositionBuffer, triTexCoordBuffer, normalizedCommonBounds, viewportCorners} =\n this.state;\n\n const {viewport} = this.context;\n\n triPositionBuffer.subData(packVertices(viewportCorners, 3));\n\n const textureBounds = viewportCorners.map(p =>\n getTextureCoordinates(viewport.projectPosition(p), normalizedCommonBounds!)\n );\n triTexCoordBuffer.subData(packVertices(textureBounds, 2));\n }\n\n _updateColorTexture(opts) {\n const {colorRange} = opts.props;\n let {colorTexture} = this.state;\n const colors = colorRangeToFlatArray(colorRange, false, Uint8Array as any);\n\n if (colorTexture) {\n colorTexture.setImageData({\n data: colors,\n width: colorRange.length\n });\n } else {\n colorTexture = new Texture2D(this.context.gl, {\n data: colors,\n width: colorRange.length,\n height: 1,\n ...TEXTURE_OPTIONS\n });\n }\n this.setState({colorTexture});\n }\n\n _updateWeightmap() {\n const {radiusPixels, colorDomain, aggregation} = this.props;\n const {weightsTransform, worldBounds, textureSize, weightsTexture, weightsScale} = this.state;\n this.state.isWeightMapDirty = false;\n\n // convert world bounds to common using Layer's coordiante system and origin\n const commonBounds = this._worldToCommonBounds(worldBounds, {\n useLayerCoordinateSystem: true\n });\n\n if (colorDomain && aggregation === 'SUM') {\n // scale color domain to weight per pixel\n const {viewport} = this.context;\n const metersPerPixel =\n (viewport.distanceScales.metersPerUnit[2] * (commonBounds[2] - commonBounds[0])) /\n textureSize;\n this.state.colorDomain = colorDomain.map(x => x * metersPerPixel * weightsScale);\n } else {\n this.state.colorDomain = colorDomain || DEFAULT_COLOR_DOMAIN;\n }\n\n const uniforms = {\n radiusPixels,\n commonBounds,\n textureWidth: textureSize,\n weightsScale\n };\n // Attribute manager sets data array count as instaceCount on model\n // we need to set that as elementCount on 'weightsTransform'\n weightsTransform.update({\n elementCount: this.getNumInstances()\n });\n // Need to explictly specify clearColor as external context may have modified it\n withParameters(this.context.gl, {clearColor: [0, 0, 0, 0]}, () => {\n weightsTransform.run({\n uniforms,\n parameters: {\n blend: true,\n depthTest: false,\n blendFunc: [GL.ONE, GL.ONE],\n blendEquation: GL.FUNC_ADD\n },\n clearRenderTarget: true,\n attributes: this.getAttributes(),\n moduleSettings: this.getModuleSettings()\n });\n });\n this._updateMaxWeightValue();\n\n // reset filtering parameters (TODO: remove once luma issue#1193 is fixed)\n weightsTexture.setParameters({\n [GL.TEXTURE_MAG_FILTER]: GL.LINEAR,\n [GL.TEXTURE_MIN_FILTER]: GL.LINEAR\n });\n }\n\n _debouncedUpdateWeightmap(fromTimer = false) {\n let {updateTimer} = this.state;\n const {debounceTimeout} = this.props;\n\n if (fromTimer) {\n updateTimer = null;\n // update\n this._updateBounds(true);\n this._updateTextureRenderingBounds();\n this.setState({isWeightMapDirty: true});\n } else {\n this.setState({isWeightMapDirty: false});\n clearTimeout(updateTimer);\n updateTimer = setTimeout(this._debouncedUpdateWeightmap.bind(this, true), debounceTimeout);\n }\n\n this.setState({updateTimer});\n }\n\n // input: worldBounds: [minLong, minLat, maxLong, maxLat]\n // input: opts.useLayerCoordinateSystem : layers coordiante system is used\n // optput: commonBounds: [minX, minY, maxX, maxY] scaled to fit the current texture\n _worldToCommonBounds(worldBounds, opts: {useLayerCoordinateSystem?: boolean} = {}) {\n const {useLayerCoordinateSystem = false} = opts;\n const [minLong, minLat, maxLong, maxLat] = worldBounds;\n const {viewport} = this.context;\n const {textureSize} = this.state;\n const {coordinateSystem} = this.props;\n\n const offsetMode =\n useLayerCoordinateSystem &&\n (coordinateSystem === COORDINATE_SYSTEM.LNGLAT_OFFSETS ||\n coordinateSystem === COORDINATE_SYSTEM.METER_OFFSETS);\n const offsetOriginCommon = offsetMode\n ? viewport.projectPosition(this.props.coordinateOrigin)\n : [0, 0];\n const size = (textureSize * RESOLUTION) / viewport.scale;\n\n let bottomLeftCommon;\n let topRightCommon;\n\n // Y-axis is flipped between World and Common bounds\n if (useLayerCoordinateSystem && !offsetMode) {\n bottomLeftCommon = this.projectPosition([minLong, minLat, 0]);\n topRightCommon = this.projectPosition([maxLong, maxLat, 0]);\n } else {\n bottomLeftCommon = viewport.projectPosition([minLong, minLat, 0]);\n topRightCommon = viewport.projectPosition([maxLong, maxLat, 0]);\n }\n // Ignore z component\n return scaleToAspectRatio(\n [\n bottomLeftCommon[0] - offsetOriginCommon[0],\n bottomLeftCommon[1] - offsetOriginCommon[1],\n topRightCommon[0] - offsetOriginCommon[0],\n topRightCommon[1] - offsetOriginCommon[1]\n ],\n size,\n size\n );\n }\n\n // input commonBounds: [xMin, yMin, xMax, yMax]\n // output worldBounds: [minLong, minLat, maxLong, maxLat]\n _commonToWorldBounds(commonBounds) {\n const [xMin, yMin, xMax, yMax] = commonBounds;\n const {viewport} = this.context;\n const bottomLeftWorld = viewport.unprojectPosition([xMin, yMin]);\n const topRightWorld = viewport.unprojectPosition([xMax, yMax]);\n\n return bottomLeftWorld.slice(0, 2).concat(topRightWorld.slice(0, 2));\n }\n}\n"],"file":"heatmap-layer.js"}
1
+ {"version":3,"sources":["../../../src/heatmap-layer/heatmap-layer.ts"],"names":["RESOLUTION","TEXTURE_PROPS","format","mipmaps","sampler","minFilter","magFilter","addressModeU","addressModeV","DEFAULT_COLOR_DOMAIN","AGGREGATION_MODE","SUM","MEAN","defaultProps","getPosition","type","value","x","position","getWeight","intensity","min","radiusPixels","max","colorRange","defaultColorRange","threshold","colorDomain","optional","aggregation","weightsTextureSize","debounceTimeout","REQUIRED_FEATURES","FLOAT_TARGET_FEATURES","DIMENSIONS","data","props","HeatmapLayer","state","initializeState","every","feature","context","device","features","has","setState","supported","log","error","id","_setupTextureParams","_setupAttributes","_setupResources","shouldUpdateState","changeFlags","somethingChanged","updateState","opts","_updateHeatmapState","oldProps","_getChangeFlags","dataChanged","viewportChanged","boundsChanged","_updateBounds","_updateTextureRenderingBounds","clearTimeout","updateTimer","isWeightMapDirty","viewportZoomChanged","_debouncedUpdateWeightmap","_updateColorTexture","_updateWeightmap","zoom","viewport","renderLayers","weightsTexture","triPositionBuffer","triTexCoordBuffer","maxWeightsTexture","colorTexture","updateTriggers","TriangleLayerClass","getSubLayerClass","TriangleLayer","getSubLayerProps","coordinateSystem","COORDINATE_SYSTEM","DEFAULT","attributes","positions","texCoords","vertexCount","maxTexture","aggregationMode","texture","finalizeState","weightsTransform","maxWeightTransform","destroy","_getAttributeManager","AttributeManager","stats","dimensions","isAttributeChanged","isAggregationDirty","compareAll","dimension","_createTextures","textureSize","createTexture","width","height","attributeManager","getAttributeManager","add","size","accessor","weights","positionAttributeName","Math","limits","maxTextureDimension2D","floatTargetSupport","weightsScale","warn","getShaders","vs","vsMax","_fs","fsMax","weightsVs","weightsFs","_createWeightsTransform","shaders","delete","Transform","elementCount","_targetTexture","_targetTextureVarying","weightsTransformShaders","maxWeightsTransformShaders","_sourceTextures","inTexture","createBuffer","byteLength","updateShaders","shaderOptions","_updateMaxWeightValue","run","parameters","blend","depthTest","blendFunc","blendEquation","forceUpdate","viewportCorners","unproject","map","p","fround","visibleWorldBounds","newState","worldBounds","scaledCommonBounds","_worldToCommonBounds","_commonToWorldBounds","LNGLAT","normalizedCommonBounds","subData","textureBounds","projectPosition","colors","Uint8Array","setImageData","length","commonBounds","useLayerCoordinateSystem","metersPerPixel","distanceScales","metersPerUnit","uniforms","textureWidth","update","getNumInstances","gl","clearColor","clearRenderTarget","getAttributes","moduleSettings","getModuleSettings","fromTimer","setTimeout","bind","minLong","minLat","maxLong","maxLat","offsetMode","LNGLAT_OFFSETS","METER_OFFSETS","offsetOriginCommon","coordinateOrigin","scale","bottomLeftCommon","topRightCommon","xMin","yMin","xMax","yMax","bottomLeftWorld","unprojectPosition","topRightWorld","slice","concat","AggregationLayer","layerName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqBA;;AASA;;AACA;;AACA;;AACA;;AAeA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,UAAU,GAAG,CAAnB;AACA,IAAMC,aAA2B,GAAG;AAClCC,EAAAA,MAAM,EAAE,YAD0B;AAElCC,EAAAA,OAAO,EAAE,KAFyB;AAGlCC,EAAAA,OAAO,EAAE;AACPC,IAAAA,SAAS,EAAE,SADJ;AAEPC,IAAAA,SAAS,EAAE,SAFJ;AAGPC,IAAAA,YAAY,EAAE,eAH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B,GAAsBH,kBAAkB,CAAC,CAAD,CAF1C,EAGEI,cAAc,CAAC,CAAD,CAAd,GAAoBJ,kBAAkB,CAAC,CAAD,CAHxC,EAIEI,cAAc,CAAC,CAAD,CAAd,GAAoBJ,kBAAkB,CAAC,CAAD,CAJxC,CADK,EAOLrF,IAPK,EAQLA,IARK,CAAP;AAUD,G;;SAIDkD,oB,GAAA,8BAAqBU,YAArB,EAAmC;AACjC,qDAAiCA,YAAjC;AAAA,QAAO8B,IAAP;AAAA,QAAaC,IAAb;AAAA,QAAmBC,IAAnB;AAAA,QAAyBC,IAAzB;;AACA,QAAOvI,QAAP,GAAmB,KAAKjC,OAAxB,CAAOiC,QAAP;AACA,QAAMwI,eAAe,GAAGxI,QAAQ,CAACyI,iBAAT,CAA2B,CAACL,IAAD,EAAOC,IAAP,CAA3B,CAAxB;AACA,QAAMK,aAAa,GAAG1I,QAAQ,CAACyI,iBAAT,CAA2B,CAACH,IAAD,EAAOC,IAAP,CAA3B,CAAtB;AAEA,WAAOC,eAAe,CAACG,KAAhB,CAAsB,CAAtB,EAAyB,CAAzB,EAA4BC,MAA5B,CAAmCF,aAAa,CAACC,KAAd,CAAoB,CAApB,EAAuB,CAAvB,CAAnC,CAAP;AACD,G;;;EA9gBOE,yB;;;AAHWnL,Y,CAIZoL,S,GAAY,c;AAJApL,Y,CAKZxB,Y,GAAeA,Y","sourcesContent":["// Copyright (c) 2015 - 2019 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n/* global setTimeout clearTimeout */\nimport {\n getBounds,\n boundsContain,\n packVertices,\n scaleToAspectRatio,\n getTextureCoordinates,\n getTextureParams\n} from './heatmap-layer-utils';\nimport {DeviceFeature, Texture, TextureProps, TextureFormat} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\nimport {Transform} from '@luma.gl/engine';\nimport {BufferWithAccessor, withGLParameters} from '@luma.gl/webgl';\nimport {\n Accessor,\n AccessorFunction,\n AttributeManager,\n ChangeFlags,\n Color,\n COORDINATE_SYSTEM,\n Layer,\n LayerContext,\n LayersList,\n log,\n Position,\n UpdateParameters,\n DefaultProps\n} from '@deck.gl/core';\nimport TriangleLayer from './triangle-layer';\nimport AggregationLayer, {AggregationLayerProps} from '../aggregation-layer';\nimport {defaultColorRange, colorRangeToFlatArray} from '../utils/color-utils';\nimport weightsVs from './weights-vs.glsl';\nimport weightsFs from './weights-fs.glsl';\nimport vsMax from './max-vs.glsl';\nimport fsMax from './max-fs.glsl';\n\nconst RESOLUTION = 2; // (number of common space pixels) / (number texels)\nconst TEXTURE_PROPS: TextureProps = {\n format: 'rgba8unorm',\n mipmaps: false,\n sampler: {\n minFilter: 'nearest',\n magFilter: 'nearest',\n addressModeU: 'clamp-to-edge',\n addressModeV: 'clamp-to-edge'\n }\n};\nconst DEFAULT_COLOR_DOMAIN = [0, 0];\nconst AGGREGATION_MODE = {\n SUM: 0,\n MEAN: 1\n};\n\nconst defaultProps: DefaultProps<HeatmapLayerProps> = {\n getPosition: {type: 'accessor', value: (x: any) => x.position},\n getWeight: {type: 'accessor', value: 1},\n intensity: {type: 'number', min: 0, value: 1},\n radiusPixels: {type: 'number', min: 1, max: 100, value: 50},\n colorRange: defaultColorRange,\n threshold: {type: 'number', min: 0, max: 1, value: 0.05},\n colorDomain: {type: 'array', value: null, optional: true},\n // 'SUM' or 'MEAN'\n aggregation: 'SUM',\n weightsTextureSize: {type: 'number', min: 128, max: 2048, value: 2048},\n debounceTimeout: {type: 'number', min: 0, max: 1000, value: 500}\n};\n\nconst REQUIRED_FEATURES: DeviceFeature[] = [\n 'blend-minmax-webgl1', // max weight calculation\n 'texture-formats-float32-webgl1' // weight-map as texture\n];\n\nconst FLOAT_TARGET_FEATURES: DeviceFeature[] = [\n 'texture-renderable-float32-webgl', // ability to render to float texture\n 'texture-blend-float-webgl1' // ability to blend when rendering to float texture\n];\n\nconst DIMENSIONS = {\n data: {\n props: ['radiusPixels']\n }\n};\n\nexport type HeatmapLayerProps<DataT = unknown> = _HeatmapLayerProps<DataT> &\n AggregationLayerProps<DataT>;\n\ntype _HeatmapLayerProps<DataT> = {\n /**\n * Radius of the circle in pixels, to which the weight of an object is distributed.\n *\n * @default 30\n */\n radiusPixels?: number;\n\n /**\n * Specified as an array of colors [color1, color2, ...].\n *\n * @default `6-class YlOrRd` - [colorbrewer](http://colorbrewer2.org/#type=sequential&scheme=YlOrRd&n=6)\n */\n colorRange?: Color[];\n\n /**\n * Value that is multiplied with the total weight at a pixel to obtain the final weight.\n *\n * @default 1\n */\n intensity?: number;\n\n /**\n * Ratio of the fading weight to the max weight, between `0` and `1`.\n *\n * For example, `0.1` affects all pixels with weight under 10% of the max.\n *\n * Ignored when `colorDomain` is specified.\n * @default 0.05\n */\n threshold?: number;\n\n /**\n * Controls how weight values are mapped to the `colorRange`, as an array of two numbers [`minValue`, `maxValue`].\n *\n * @default null\n */\n colorDomain?: [number, number] | null;\n\n /**\n * Defines the type of aggregation operation\n *\n * V valid values are 'SUM', 'MEAN'.\n *\n * @default 'SUM'\n */\n aggregation?: 'SUM' | 'MEAN';\n\n /**\n * Specifies the size of weight texture.\n * @default 2048\n */\n weightsTextureSize?: number;\n\n /**\n * Interval in milliseconds during which changes to the viewport don't trigger aggregation.\n *\n * @default 500\n */\n debounceTimeout?: number;\n\n /**\n * Method called to retrieve the position of each object.\n *\n * @default d => d.position\n */\n getPosition?: AccessorFunction<DataT, Position>;\n\n /**\n * The weight of each object.\n *\n * @default 1\n */\n getWeight?: Accessor<DataT, number>;\n};\n\n/** Visualizes the spatial distribution of data. */\nexport default class HeatmapLayer<\n DataT = any,\n ExtraPropsT extends {} = {}\n> extends AggregationLayer<DataT, ExtraPropsT & Required<_HeatmapLayerProps<DataT>>> {\n static layerName = 'HeatmapLayer';\n static defaultProps = defaultProps;\n\n state!: AggregationLayer<DataT>['state'] & {\n supported: boolean;\n colorDomain?: number[];\n isWeightMapDirty?: boolean;\n weightsTexture?: Texture;\n maxWeightsTexture?: Texture;\n colorTexture?: Texture;\n zoom?: number;\n worldBounds?: number[];\n normalizedCommonBounds?: number[];\n updateTimer?: any;\n triPositionBuffer?: BufferWithAccessor;\n triTexCoordBuffer?: BufferWithAccessor;\n weightsTransform?: Transform;\n maxWeightTransform?: Transform;\n textureSize: number;\n format: TextureFormat;\n type: GL;\n weightsScale: number;\n visibleWorldBounds: number[];\n viewportCorners: number[][];\n };\n\n initializeState() {\n if (!REQUIRED_FEATURES.every(feature => this.context.device.features.has(feature))) {\n this.setState({supported: false});\n log.error(`HeatmapLayer: ${this.id} is not supported on this browser`)();\n return;\n }\n super.initializeAggregationLayer(DIMENSIONS);\n this.setState({supported: true, colorDomain: DEFAULT_COLOR_DOMAIN});\n this._setupTextureParams();\n this._setupAttributes();\n this._setupResources();\n }\n\n shouldUpdateState({changeFlags}: UpdateParameters<this>) {\n // Need to be updated when viewport changes\n return changeFlags.somethingChanged;\n }\n\n /* eslint-disable max-statements,complexity */\n updateState(opts: UpdateParameters<this>) {\n if (!this.state.supported) {\n return;\n }\n super.updateState(opts);\n this._updateHeatmapState(opts);\n }\n\n _updateHeatmapState(opts: UpdateParameters<this>) {\n const {props, oldProps} = opts;\n const changeFlags = this._getChangeFlags(opts);\n\n if (changeFlags.dataChanged || changeFlags.viewportChanged) {\n // if data is changed, do not debounce and immediately update the weight map\n changeFlags.boundsChanged = this._updateBounds(changeFlags.dataChanged);\n this._updateTextureRenderingBounds();\n }\n\n if (changeFlags.dataChanged || changeFlags.boundsChanged) {\n // Update weight map immediately\n clearTimeout(this.state.updateTimer);\n this.setState({isWeightMapDirty: true});\n } else if (changeFlags.viewportZoomChanged) {\n // Update weight map when zoom stops\n this._debouncedUpdateWeightmap();\n }\n\n if (props.colorRange !== oldProps.colorRange) {\n this._updateColorTexture(opts);\n }\n\n if (this.state.isWeightMapDirty) {\n this._updateWeightmap();\n }\n\n this.setState({zoom: opts.context.viewport.zoom});\n }\n\n renderLayers(): LayersList | Layer {\n if (!this.state.supported) {\n return [];\n }\n const {\n weightsTexture,\n triPositionBuffer,\n triTexCoordBuffer,\n maxWeightsTexture,\n colorTexture,\n colorDomain\n } = this.state;\n const {updateTriggers, intensity, threshold, aggregation} = this.props;\n\n const TriangleLayerClass = this.getSubLayerClass('triangle', TriangleLayer);\n\n return new TriangleLayerClass(\n this.getSubLayerProps({\n id: 'triangle-layer',\n updateTriggers\n }),\n {\n // position buffer is filled with world coordinates generated from viewport.unproject\n // i.e. LNGLAT if geospatial, CARTESIAN otherwise\n coordinateSystem: COORDINATE_SYSTEM.DEFAULT,\n data: {\n attributes: {\n positions: triPositionBuffer,\n texCoords: triTexCoordBuffer\n }\n },\n vertexCount: 4,\n maxTexture: maxWeightsTexture,\n colorTexture,\n aggregationMode: AGGREGATION_MODE[aggregation] || 0,\n texture: weightsTexture,\n intensity,\n threshold,\n colorDomain\n }\n );\n }\n\n finalizeState(context: LayerContext) {\n super.finalizeState(context);\n const {\n weightsTransform,\n weightsTexture,\n maxWeightTransform,\n maxWeightsTexture,\n triPositionBuffer,\n triTexCoordBuffer,\n colorTexture,\n updateTimer\n } = this.state;\n weightsTransform?.destroy();\n weightsTexture?.destroy();\n maxWeightTransform?.destroy();\n maxWeightsTexture?.destroy();\n triPositionBuffer?.destroy();\n triTexCoordBuffer?.destroy();\n colorTexture?.destroy();\n if (updateTimer) {\n clearTimeout(updateTimer);\n }\n }\n\n // PRIVATE\n\n // override Composite layer private method to create AttributeManager instance\n _getAttributeManager() {\n return new AttributeManager(this.context.device, {\n id: this.props.id,\n stats: this.context.stats\n });\n }\n\n _getChangeFlags(opts: UpdateParameters<this>) {\n const changeFlags: Partial<ChangeFlags> & {\n boundsChanged?: boolean;\n viewportZoomChanged?: boolean;\n } = {};\n const {dimensions} = this.state;\n changeFlags.dataChanged =\n (this.isAttributeChanged() && 'attribute changed') || // if any attribute is changed\n (this.isAggregationDirty(opts, {\n compareAll: true,\n dimension: dimensions.data\n }) &&\n 'aggregation is dirty');\n changeFlags.viewportChanged = opts.changeFlags.viewportChanged;\n\n const {zoom} = this.state;\n if (!opts.context.viewport || opts.context.viewport.zoom !== zoom) {\n changeFlags.viewportZoomChanged = true;\n }\n\n return changeFlags;\n }\n\n _createTextures() {\n const {textureSize, format, type} = this.state;\n\n this.setState({\n weightsTexture: this.context.device.createTexture({\n width: textureSize,\n height: textureSize,\n format,\n type,\n ...TEXTURE_PROPS\n }),\n maxWeightsTexture: this.context.device.createTexture({format, type, ...TEXTURE_PROPS}) // 1 X 1 texture,\n });\n }\n\n _setupAttributes() {\n const attributeManager = this.getAttributeManager()!;\n attributeManager.add({\n positions: {size: 3, type: GL.DOUBLE, accessor: 'getPosition'},\n weights: {size: 1, accessor: 'getWeight'}\n });\n this.setState({positionAttributeName: 'positions'});\n }\n\n _setupTextureParams() {\n const {device} = this.context;\n const {weightsTextureSize} = this.props;\n\n const textureSize = Math.min(weightsTextureSize, device.limits.maxTextureDimension2D as number);\n const floatTargetSupport = FLOAT_TARGET_FEATURES.every(feature => device.features.has(feature));\n const {format, type} = getTextureParams({device, floatTargetSupport});\n const weightsScale = floatTargetSupport ? 1 : 1 / 255;\n this.setState({textureSize, format, type, weightsScale});\n if (!floatTargetSupport) {\n log.warn(\n `HeatmapLayer: ${this.id} rendering to float texture not supported, fallingback to low precession format`\n )();\n }\n }\n\n getShaders(type) {\n return super.getShaders(\n type === 'max-weights-transform'\n ? {\n vs: vsMax,\n _fs: fsMax\n }\n : {\n vs: weightsVs,\n _fs: weightsFs\n }\n );\n }\n\n _createWeightsTransform(shaders = {}) {\n let {weightsTransform} = this.state;\n const {weightsTexture} = this.state;\n weightsTransform?.delete();\n\n weightsTransform = new Transform(this.context.device, {\n id: `${this.id}-weights-transform`,\n elementCount: 1,\n _targetTexture: weightsTexture,\n _targetTextureVarying: 'weightsTexture',\n ...shaders\n });\n this.setState({weightsTransform});\n }\n\n _setupResources() {\n this._createTextures();\n const {textureSize, weightsTexture, maxWeightsTexture} = this.state;\n\n const weightsTransformShaders = this.getShaders('weights-transform');\n this._createWeightsTransform(weightsTransformShaders);\n\n const maxWeightsTransformShaders = this.getShaders('max-weights-transform');\n const maxWeightTransform = new Transform(this.context.device, {\n id: `${this.id}-max-weights-transform`,\n _sourceTextures: {\n inTexture: weightsTexture\n },\n _targetTexture: maxWeightsTexture,\n _targetTextureVarying: 'outTexture',\n ...maxWeightsTransformShaders,\n elementCount: textureSize * textureSize\n });\n\n this.setState({\n weightsTexture,\n maxWeightsTexture,\n maxWeightTransform,\n zoom: null,\n triPositionBuffer: this.context.device.createBuffer({\n byteLength: 48,\n // @ts-expect-error\n accessor: {size: 3}\n }),\n triTexCoordBuffer: this.context.device.createBuffer({\n byteLength: 48,\n // @ts-expect-error\n accessor: {size: 2}\n })\n });\n }\n\n // overwrite super class method to update transform model\n updateShaders(shaderOptions) {\n // sahder params (modules, injects) changed, update model object\n this._createWeightsTransform(shaderOptions);\n }\n\n _updateMaxWeightValue() {\n const {maxWeightTransform} = this.state;\n maxWeightTransform!.run({\n parameters: {\n blend: true,\n depthTest: false,\n blendFunc: [GL.ONE, GL.ONE],\n blendEquation: GL.MAX\n }\n });\n }\n\n // Computes world bounds area that needs to be processed for generate heatmap\n _updateBounds(forceUpdate: any = false): boolean {\n const {viewport} = this.context;\n\n // Unproject all 4 corners of the current screen coordinates into world coordinates (lng/lat)\n // Takes care of viewport has non zero bearing/pitch (i.e axis not aligned with world coordiante system)\n const viewportCorners = [\n viewport.unproject([0, 0]),\n viewport.unproject([viewport.width, 0]),\n viewport.unproject([viewport.width, viewport.height]),\n viewport.unproject([0, viewport.height])\n ].map(p => p.map(Math.fround));\n\n // #1: get world bounds for current viewport extends\n const visibleWorldBounds = getBounds(viewportCorners); // TODO: Change to visible bounds\n\n const newState: Partial<HeatmapLayer['state']> = {visibleWorldBounds, viewportCorners};\n let boundsChanged = false;\n\n if (\n forceUpdate ||\n !this.state.worldBounds ||\n !boundsContain(this.state.worldBounds, visibleWorldBounds)\n ) {\n // #2 : convert world bounds to common (Flat) bounds\n // #3 : extend common bounds to match aspect ratio with viewport\n const scaledCommonBounds = this._worldToCommonBounds(visibleWorldBounds);\n\n // #4 :convert aligned common bounds to world bounds\n const worldBounds = this._commonToWorldBounds(scaledCommonBounds);\n\n // Clip webmercator projection limits\n if (this.props.coordinateSystem === COORDINATE_SYSTEM.LNGLAT) {\n worldBounds[1] = Math.max(worldBounds[1], -85.051129);\n worldBounds[3] = Math.min(worldBounds[3], 85.051129);\n worldBounds[0] = Math.max(worldBounds[0], -360);\n worldBounds[2] = Math.min(worldBounds[2], 360);\n }\n\n // #5: now convert world bounds to common using Layer's coordiante system and origin\n const normalizedCommonBounds = this._worldToCommonBounds(worldBounds);\n\n newState.worldBounds = worldBounds;\n newState.normalizedCommonBounds = normalizedCommonBounds;\n\n boundsChanged = true;\n }\n this.setState(newState);\n return boundsChanged;\n }\n\n _updateTextureRenderingBounds() {\n // Just render visible portion of the texture\n const {triPositionBuffer, triTexCoordBuffer, normalizedCommonBounds, viewportCorners} =\n this.state;\n\n const {viewport} = this.context;\n\n triPositionBuffer!.subData(packVertices(viewportCorners, 3));\n\n const textureBounds = viewportCorners.map(p =>\n getTextureCoordinates(viewport.projectPosition(p), normalizedCommonBounds!)\n );\n triTexCoordBuffer!.subData(packVertices(textureBounds, 2));\n }\n\n _updateColorTexture(opts) {\n const {colorRange} = opts.props;\n let {colorTexture} = this.state;\n const colors = colorRangeToFlatArray(colorRange, false, Uint8Array as any);\n\n if (colorTexture) {\n // @ts-expect-error TODO - no longer supported in v9?\n colorTexture.setImageData({\n data: colors,\n width: colorRange.length\n });\n } else {\n colorTexture = this.context.device.createTexture({\n data: colors,\n width: colorRange.length,\n height: 1,\n ...TEXTURE_PROPS\n });\n }\n this.setState({colorTexture});\n }\n\n _updateWeightmap() {\n const {radiusPixels, colorDomain, aggregation} = this.props;\n const {worldBounds, textureSize, weightsScale} = this.state;\n const weightsTransform = this.state.weightsTransform!;\n this.state.isWeightMapDirty = false;\n\n // convert world bounds to common using Layer's coordiante system and origin\n const commonBounds = this._worldToCommonBounds(worldBounds, {\n useLayerCoordinateSystem: true\n });\n\n if (colorDomain && aggregation === 'SUM') {\n // scale color domain to weight per pixel\n const {viewport} = this.context;\n const metersPerPixel =\n (viewport.distanceScales.metersPerUnit[2] * (commonBounds[2] - commonBounds[0])) /\n textureSize;\n this.state.colorDomain = colorDomain.map(x => x * metersPerPixel * weightsScale);\n } else {\n this.state.colorDomain = colorDomain || DEFAULT_COLOR_DOMAIN;\n }\n\n const uniforms = {\n radiusPixels,\n commonBounds,\n textureWidth: textureSize,\n weightsScale\n };\n // Attribute manager sets data array count as instaceCount on model\n // we need to set that as elementCount on 'weightsTransform'\n weightsTransform.update({\n elementCount: this.getNumInstances()\n });\n // Need to explictly specify clearColor as external context may have modified it\n withGLParameters(this.context.gl, {clearColor: [0, 0, 0, 0]}, () => {\n weightsTransform.run({\n uniforms,\n parameters: {\n blend: true,\n depthTest: false,\n blendFunc: [GL.ONE, GL.ONE],\n blendEquation: GL.FUNC_ADD\n },\n clearRenderTarget: true,\n // @ts-expect-error TODO - no longer supported in v9?\n attributes: this.getAttributes(),\n moduleSettings: this.getModuleSettings()\n });\n });\n this._updateMaxWeightValue();\n\n // reset filtering parameters (TODO: remove once luma issue#1193 is fixed)\n // TODO v9 sampler support in luma.gl needs to improve\n // weightsTexture.setSampler({\n // magFilter: 'linear',\n // minFilter: 'linear'\n // });\n }\n\n _debouncedUpdateWeightmap(fromTimer = false) {\n let {updateTimer} = this.state;\n const {debounceTimeout} = this.props;\n\n if (fromTimer) {\n updateTimer = null;\n // update\n this._updateBounds(true);\n this._updateTextureRenderingBounds();\n this.setState({isWeightMapDirty: true});\n } else {\n this.setState({isWeightMapDirty: false});\n clearTimeout(updateTimer);\n updateTimer = setTimeout(this._debouncedUpdateWeightmap.bind(this, true), debounceTimeout);\n }\n\n this.setState({updateTimer});\n }\n\n // input: worldBounds: [minLong, minLat, maxLong, maxLat]\n // input: opts.useLayerCoordinateSystem : layers coordiante system is used\n // optput: commonBounds: [minX, minY, maxX, maxY] scaled to fit the current texture\n _worldToCommonBounds(worldBounds, opts: {useLayerCoordinateSystem?: boolean} = {}) {\n const {useLayerCoordinateSystem = false} = opts;\n const [minLong, minLat, maxLong, maxLat] = worldBounds;\n const {viewport} = this.context;\n const {textureSize} = this.state;\n const {coordinateSystem} = this.props;\n\n const offsetMode =\n useLayerCoordinateSystem &&\n (coordinateSystem === COORDINATE_SYSTEM.LNGLAT_OFFSETS ||\n coordinateSystem === COORDINATE_SYSTEM.METER_OFFSETS);\n const offsetOriginCommon = offsetMode\n ? viewport.projectPosition(this.props.coordinateOrigin)\n : [0, 0];\n const size = (textureSize * RESOLUTION) / viewport.scale;\n\n let bottomLeftCommon;\n let topRightCommon;\n\n // Y-axis is flipped between World and Common bounds\n if (useLayerCoordinateSystem && !offsetMode) {\n bottomLeftCommon = this.projectPosition([minLong, minLat, 0]);\n topRightCommon = this.projectPosition([maxLong, maxLat, 0]);\n } else {\n bottomLeftCommon = viewport.projectPosition([minLong, minLat, 0]);\n topRightCommon = viewport.projectPosition([maxLong, maxLat, 0]);\n }\n // Ignore z component\n return scaleToAspectRatio(\n [\n bottomLeftCommon[0] - offsetOriginCommon[0],\n bottomLeftCommon[1] - offsetOriginCommon[1],\n topRightCommon[0] - offsetOriginCommon[0],\n topRightCommon[1] - offsetOriginCommon[1]\n ],\n size,\n size\n );\n }\n\n // input commonBounds: [xMin, yMin, xMax, yMax]\n // output worldBounds: [minLong, minLat, maxLong, maxLat]\n _commonToWorldBounds(commonBounds) {\n const [xMin, yMin, xMax, yMax] = commonBounds;\n const {viewport} = this.context;\n const bottomLeftWorld = viewport.unprojectPosition([xMin, yMin]);\n const topRightWorld = viewport.unprojectPosition([xMax, yMax]);\n\n return bottomLeftWorld.slice(0, 2).concat(topRightWorld.slice(0, 2));\n }\n}\n"],"file":"heatmap-layer.js"}
@@ -17,9 +17,9 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
17
17
 
18
18
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
19
19
 
20
- var _core = require("@luma.gl/core");
20
+ var _engine = require("@luma.gl/engine");
21
21
 
22
- var _core2 = require("@deck.gl/core");
22
+ var _core = require("@deck.gl/core");
23
23
 
24
24
  var _triangleLayerVertex = _interopRequireDefault(require("./triangle-layer-vertex.glsl"));
25
25
 
@@ -39,8 +39,17 @@ var TriangleLayer = function (_Layer) {
39
39
  var _super = _createSuper(TriangleLayer);
40
40
 
41
41
  function TriangleLayer() {
42
+ var _this;
43
+
42
44
  (0, _classCallCheck2.default)(this, TriangleLayer);
43
- return _super.apply(this, arguments);
45
+
46
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
47
+ args[_key] = arguments[_key];
48
+ }
49
+
50
+ _this = _super.call.apply(_super, [this].concat(args));
51
+ _this.state = void 0;
52
+ return _this;
44
53
  }
45
54
 
46
55
  var _proto = TriangleLayer.prototype;
@@ -49,12 +58,12 @@ var TriangleLayer = function (_Layer) {
49
58
  return {
50
59
  vs: _triangleLayerVertex.default,
51
60
  fs: _triangleLayerFragment.default,
52
- modules: [_core2.project32]
61
+ modules: [_core.project32]
53
62
  };
54
63
  };
55
64
 
56
65
  _proto.initializeState = function initializeState(_ref) {
57
- var gl = _ref.gl;
66
+ var device = _ref.device;
58
67
  var attributeManager = this.getAttributeManager();
59
68
  attributeManager.add({
60
69
  positions: {
@@ -67,16 +76,16 @@ var TriangleLayer = function (_Layer) {
67
76
  }
68
77
  });
69
78
  this.setState({
70
- model: this._getModel(gl)
79
+ model: this._getModel(device)
71
80
  });
72
81
  };
73
82
 
74
- _proto._getModel = function _getModel(gl) {
83
+ _proto._getModel = function _getModel(device) {
75
84
  var vertexCount = this.props.vertexCount;
76
- return new _core.Model(gl, _objectSpread(_objectSpread({}, this.getShaders()), {}, {
85
+ return new _engine.Model(device, _objectSpread(_objectSpread({}, this.getShaders()), {}, {
77
86
  id: this.props.id,
78
- geometry: new _core.Geometry({
79
- drawMode: 6,
87
+ geometry: new _engine.Geometry({
88
+ topology: 'triangle-fan-webgl',
80
89
  vertexCount: vertexCount
81
90
  })
82
91
  }));
@@ -101,11 +110,12 @@ var TriangleLayer = function (_Layer) {
101
110
  threshold: threshold,
102
111
  aggregationMode: aggregationMode,
103
112
  colorDomain: colorDomain
104
- })).draw();
113
+ }));
114
+ model.draw(this.context.renderPass);
105
115
  };
106
116
 
107
117
  return TriangleLayer;
108
- }(_core2.Layer);
118
+ }(_core.Layer);
109
119
 
110
120
  exports.default = TriangleLayer;
111
121
  TriangleLayer.layerName = 'TriangleLayer';