@deck.gl/aggregation-layers 9.0.0-beta.1 → 9.0.0-beta.2

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 (41) hide show
  1. package/dist/dist.dev.js +3287 -310
  2. package/dist/es5/heatmap-layer/heatmap-layer-utils.js +0 -15
  3. package/dist/es5/heatmap-layer/heatmap-layer-utils.js.map +1 -1
  4. package/dist/es5/heatmap-layer/heatmap-layer.js +103 -97
  5. package/dist/es5/heatmap-layer/heatmap-layer.js.map +1 -1
  6. package/dist/es5/heatmap-layer/max-vs.glsl.js +1 -1
  7. package/dist/es5/heatmap-layer/triangle-layer-fragment.glsl.js +1 -1
  8. package/dist/es5/heatmap-layer/triangle-layer.js +26 -27
  9. package/dist/es5/heatmap-layer/triangle-layer.js.map +1 -1
  10. package/dist/es5/heatmap-layer/weights-vs.glsl.js +1 -1
  11. package/dist/esm/heatmap-layer/heatmap-layer-utils.js +0 -13
  12. package/dist/esm/heatmap-layer/heatmap-layer-utils.js.map +1 -1
  13. package/dist/esm/heatmap-layer/heatmap-layer.js +99 -87
  14. package/dist/esm/heatmap-layer/heatmap-layer.js.map +1 -1
  15. package/dist/esm/heatmap-layer/max-vs.glsl.js +11 -5
  16. package/dist/esm/heatmap-layer/max-vs.glsl.js.map +1 -1
  17. package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js +2 -2
  18. package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js.map +1 -1
  19. package/dist/esm/heatmap-layer/triangle-layer.js +21 -23
  20. package/dist/esm/heatmap-layer/triangle-layer.js.map +1 -1
  21. package/dist/esm/heatmap-layer/weights-vs.glsl.js +4 -2
  22. package/dist/esm/heatmap-layer/weights-vs.glsl.js.map +1 -1
  23. package/dist.min.js +85 -75
  24. package/package.json +7 -7
  25. package/src/heatmap-layer/heatmap-layer-utils.ts +0 -23
  26. package/src/heatmap-layer/heatmap-layer.ts +87 -105
  27. package/src/heatmap-layer/max-vs.glsl.ts +11 -5
  28. package/src/heatmap-layer/triangle-layer-fragment.glsl.ts +2 -2
  29. package/src/heatmap-layer/triangle-layer.ts +17 -23
  30. package/src/heatmap-layer/weights-vs.glsl.ts +4 -2
  31. package/typed/heatmap-layer/heatmap-layer-utils.d.ts +0 -9
  32. package/typed/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -1
  33. package/typed/heatmap-layer/heatmap-layer.d.ts +4 -4
  34. package/typed/heatmap-layer/heatmap-layer.d.ts.map +1 -1
  35. package/typed/heatmap-layer/max-vs.glsl.d.ts +1 -1
  36. package/typed/heatmap-layer/max-vs.glsl.d.ts.map +1 -1
  37. package/typed/heatmap-layer/triangle-layer-fragment.glsl.d.ts +1 -1
  38. package/typed/heatmap-layer/triangle-layer.d.ts +10 -2
  39. package/typed/heatmap-layer/triangle-layer.d.ts.map +1 -1
  40. package/typed/heatmap-layer/weights-vs.glsl.d.ts +1 -1
  41. package/typed/heatmap-layer/weights-vs.glsl.d.ts.map +1 -1
@@ -10,12 +10,9 @@ exports.boundsContain = boundsContain;
10
10
  exports.packVertices = packVertices;
11
11
  exports.scaleToAspectRatio = scaleToAspectRatio;
12
12
  exports.getTextureCoordinates = getTextureCoordinates;
13
- exports.getTextureParams = getTextureParams;
14
13
 
15
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
16
15
 
17
- var _constants = require("@luma.gl/constants");
18
-
19
16
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
20
17
 
21
18
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -107,16 +104,4 @@ function getTextureCoordinates(point, bounds) {
107
104
 
108
105
  return [(point[0] - xMin) / (xMax - xMin), (point[1] - yMin) / (yMax - yMin)];
109
106
  }
110
-
111
- function getTextureParams(_ref) {
112
- var device = _ref.device,
113
- floatTargetSupport = _ref.floatTargetSupport;
114
- return floatTargetSupport ? {
115
- format: device.info.type === 'webgl2' ? 34836 : 6408,
116
- type: 5126
117
- } : {
118
- format: 6408,
119
- type: 5121
120
- };
121
- }
122
107
  //# sourceMappingURL=heatmap-layer-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/heatmap-layer/heatmap-layer-utils.ts"],"names":["getBounds","points","x","map","p","y","xMin","Math","min","apply","xMax","max","yMin","yMax","boundsContain","currentBounds","targetBounds","scratchArray","Float32Array","packVertices","dimensions","index","point","i","scaleToAspectRatio","boundingBox","width","height","currentWidth","currentHeight","newWidth","newHeight","xCenter","yCenter","getTextureCoordinates","bounds","getTextureParams","device","floatTargetSupport","format","info","type"],"mappings":";;;;;;;;;;;;;;;;AACA;;;;;;;;AAEO,SAASA,SAAT,CAAmBC,MAAnB,EAAiD;AAEtD,MAAMC,CAAC,GAAGD,MAAM,CAACE,GAAP,CAAW,UAAAC,CAAC;AAAA,WAAIA,CAAC,CAAC,CAAD,CAAL;AAAA,GAAZ,CAAV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,EAAgDa,MAAhD,EAAkE;AACvE,6CAAiCA,MAAjC;AAAA,MAAO7B,IAAP;AAAA,MAAaM,IAAb;AAAA,MAAmBF,IAAnB;AAAA,MAAyBG,IAAzB;;AACA,SAAO,CAAC,CAACS,KAAK,CAAC,CAAD,CAAL,GAAWhB,IAAZ,KAAqBI,IAAI,GAAGJ,IAA5B,CAAD,EAAoC,CAACgB,KAAK,CAAC,CAAD,CAAL,GAAWV,IAAZ,KAAqBC,IAAI,GAAGD,IAA5B,CAApC,CAAP;AACD;;AAGM,SAASwB,gBAAT,OAMJ;AAAA,MALDC,MAKC,QALDA,MAKC;AAAA,MAJDC,kBAIC,QAJDA,kBAIC;AACD,SAAOA,kBAAkB,GACrB;AAEEC,IAAAA,MAAM,EAAEF,MAAM,CAACG,IAAP,CAAYC,IAAZ,KAAqB,QAArB,eAFV;AAGEA,IAAAA,IAAI;AAHN,GADqB,GAMrB;AACEF,IAAAA,MAAM,MADR;AAEEE,IAAAA,IAAI;AAFN,GANJ;AAUD","sourcesContent":["import {Device} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\n\nexport function getBounds(points: number[][]): number[] {\n // Now build bounding box in world space (aligned to world coordiante system)\n const x = points.map(p => p[0]);\n const y = points.map(p => p[1]);\n\n const xMin = Math.min.apply(null, x);\n const xMax = Math.max.apply(null, x);\n const yMin = Math.min.apply(null, y);\n const yMax = Math.max.apply(null, y);\n\n return [xMin, yMin, xMax, yMax];\n}\n\n// true if currentBounds contains targetBounds, false otherwise\nexport function boundsContain(currentBounds: number[], targetBounds: number[]): boolean {\n if (\n targetBounds[0] >= currentBounds[0] &&\n targetBounds[2] <= currentBounds[2] &&\n targetBounds[1] >= currentBounds[1] &&\n targetBounds[3] <= currentBounds[3]\n ) {\n return true;\n }\n return false;\n}\n\nconst scratchArray = new Float32Array(12);\n\n// For given rectangle bounds generates two triangles vertices that coverit completely\nexport function packVertices(points: number[][], dimensions: number = 2): Float32Array {\n let index = 0;\n for (const point of points) {\n for (let i = 0; i < dimensions; i++) {\n scratchArray[index++] = point[i] || 0;\n }\n }\n return scratchArray;\n}\n\n// Expands boundingBox:[xMin, yMin, xMax, yMax] to match aspect ratio of given width and height\nexport function scaleToAspectRatio(boundingBox: number[], width: number, height: number): number[] {\n const [xMin, yMin, xMax, yMax] = boundingBox;\n\n const currentWidth = xMax - xMin;\n const currentHeight = yMax - yMin;\n\n let newWidth = currentWidth;\n let newHeight = currentHeight;\n if (currentWidth / currentHeight < width / height) {\n // expand bounding box width\n newWidth = (width / height) * currentHeight;\n } else {\n newHeight = (height / width) * currentWidth;\n }\n\n if (newWidth < width) {\n newWidth = width;\n newHeight = height;\n }\n\n const xCenter = (xMax + xMin) / 2;\n const yCenter = (yMax + yMin) / 2;\n\n return [\n xCenter - newWidth / 2,\n yCenter - newHeight / 2,\n xCenter + newWidth / 2,\n yCenter + newHeight / 2\n ];\n}\n\n// Get texture coordiante of point inside a bounding box\nexport function getTextureCoordinates(point: number[], bounds: number[]) {\n const [xMin, yMin, xMax, yMax] = bounds;\n return [(point[0] - xMin) / (xMax - xMin), (point[1] - yMin) / (yMax - yMin)];\n}\n\n// Returns format and type for creating texture objects\nexport function getTextureParams({\n device,\n floatTargetSupport\n}: {\n device: Device;\n floatTargetSupport?: boolean;\n}) {\n return floatTargetSupport\n ? {\n // format: should be RGBA32F on WebGL2 (float textures), RGBA in WebGL1 for float or non float textures\n format: device.info.type === 'webgl2' ? GL.RGBA32F : GL.RGBA,\n type: GL.FLOAT\n }\n : {\n format: GL.RGBA,\n type: GL.UNSIGNED_BYTE\n };\n}\n"],"file":"heatmap-layer-utils.js"}
1
+ {"version":3,"sources":["../../../src/heatmap-layer/heatmap-layer-utils.ts"],"names":["getBounds","points","x","map","p","y","xMin","Math","min","apply","xMax","max","yMin","yMax","boundsContain","currentBounds","targetBounds","scratchArray","Float32Array","packVertices","dimensions","index","point","i","scaleToAspectRatio","boundingBox","width","height","currentWidth","currentHeight","newWidth","newHeight","xCenter","yCenter","getText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,CACLoB,OAAO,GAAGF,QAAQ,GAAG,CADhB,EAELG,OAAO,GAAGF,SAAS,GAAG,CAFjB,EAGLC,OAAO,GAAGF,QAAQ,GAAG,CAHhB,EAILG,OAAO,GAAGF,SAAS,GAAG,CAJjB,CAAP;AAMD;;AAGM,SAASG,qBAAT,CAA+BZ,KAA/B,EAAgDa,MAAhD,EAAkE;AACvE,6CAAiCA,MAAjC;AAAA,MAAO7B,IAAP;AAAA,MAAaM,IAAb;AAAA,MAAmBF,IAAnB;AAAA,MAAyBG,IAAzB;;AACA,SAAO,CAAC,CAACS,KAAK,CAAC,CAAD,CAAL,GAAWhB,IAAZ,KAAqBI,IAAI,GAAGJ,IAA5B,CAAD,EAAoC,CAACgB,KAAK,CAAC,CAAD,CAAL,GAAWV,IAAZ,KAAqBC,IAAI,GAAGD,IAA5B,CAApC,CAAP;AACD","sourcesContent":["export function getBounds(points: number[][]): number[] {\n // Now build bounding box in world space (aligned to world coordiante system)\n const x = points.map(p => p[0]);\n const y = points.map(p => p[1]);\n\n const xMin = Math.min.apply(null, x);\n const xMax = Math.max.apply(null, x);\n const yMin = Math.min.apply(null, y);\n const yMax = Math.max.apply(null, y);\n\n return [xMin, yMin, xMax, yMax];\n}\n\n// true if currentBounds contains targetBounds, false otherwise\nexport function boundsContain(currentBounds: number[], targetBounds: number[]): boolean {\n if (\n targetBounds[0] >= currentBounds[0] &&\n targetBounds[2] <= currentBounds[2] &&\n targetBounds[1] >= currentBounds[1] &&\n targetBounds[3] <= currentBounds[3]\n ) {\n return true;\n }\n return false;\n}\n\nconst scratchArray = new Float32Array(12);\n\n// For given rectangle bounds generates two triangles vertices that coverit completely\nexport function packVertices(points: number[][], dimensions: number = 2): Float32Array {\n let index = 0;\n for (const point of points) {\n for (let i = 0; i < dimensions; i++) {\n scratchArray[index++] = point[i] || 0;\n }\n }\n return scratchArray;\n}\n\n// Expands boundingBox:[xMin, yMin, xMax, yMax] to match aspect ratio of given width and height\nexport function scaleToAspectRatio(boundingBox: number[], width: number, height: number): number[] {\n const [xMin, yMin, xMax, yMax] = boundingBox;\n\n const currentWidth = xMax - xMin;\n const currentHeight = yMax - yMin;\n\n let newWidth = currentWidth;\n let newHeight = currentHeight;\n if (currentWidth / currentHeight < width / height) {\n // expand bounding box width\n newWidth = (width / height) * currentHeight;\n } else {\n newHeight = (height / width) * currentWidth;\n }\n\n if (newWidth < width) {\n newWidth = width;\n newHeight = height;\n }\n\n const xCenter = (xMax + xMin) / 2;\n const yCenter = (yMax + yMin) / 2;\n\n return [\n xCenter - newWidth / 2,\n yCenter - newHeight / 2,\n xCenter + newWidth / 2,\n yCenter + newHeight / 2\n ];\n}\n\n// Get texture coordiante of point inside a bounding box\nexport function getTextureCoordinates(point: number[], bounds: number[]) {\n const [xMin, yMin, xMax, yMax] = bounds;\n return [(point[0] - xMin) / (xMax - xMin), (point[1] - yMin) / (yMax - yMin)];\n}\n"],"file":"heatmap-layer-utils.js"}
@@ -27,8 +27,6 @@ var _constants = require("@luma.gl/constants");
27
27
 
28
28
  var _engine = require("@luma.gl/engine");
29
29
 
30
- var _webgl = require("@luma.gl/webgl");
31
-
32
30
  var _core = require("@deck.gl/core");
33
31
 
34
32
  var _triangleLayer = _interopRequireDefault(require("./triangle-layer"));
@@ -58,8 +56,8 @@ var TEXTURE_PROPS = {
58
56
  format: 'rgba8unorm',
59
57
  mipmaps: false,
60
58
  sampler: {
61
- minFilter: 'nearest',
62
- magFilter: 'nearest',
59
+ minFilter: 'linear',
60
+ magFilter: 'linear',
63
61
  addressModeU: 'clamp-to-edge',
64
62
  addressModeV: 'clamp-to-edge'
65
63
  }
@@ -256,7 +254,7 @@ var HeatmapLayer = function (_AggregationLayer) {
256
254
  maxTexture: maxWeightsTexture,
257
255
  colorTexture: colorTexture,
258
256
  aggregationMode: AGGREGATION_MODE[aggregation] || 0,
259
- texture: weightsTexture,
257
+ weightsTexture: weightsTexture,
260
258
  intensity: intensity,
261
259
  threshold: threshold,
262
260
  colorDomain: colorDomain
@@ -314,19 +312,18 @@ var HeatmapLayer = function (_AggregationLayer) {
314
312
  _proto._createTextures = function _createTextures() {
315
313
  var _this$state3 = this.state,
316
314
  textureSize = _this$state3.textureSize,
317
- format = _this$state3.format,
318
- type = _this$state3.type;
315
+ format = _this$state3.format;
319
316
  this.setState({
320
- weightsTexture: this.context.device.createTexture(_objectSpread({
317
+ weightsTexture: this.context.device.createTexture(_objectSpread(_objectSpread({}, TEXTURE_PROPS), {}, {
321
318
  width: textureSize,
322
319
  height: textureSize,
323
- format: format,
324
- type: type
325
- }, TEXTURE_PROPS)),
326
- maxWeightsTexture: this.context.device.createTexture(_objectSpread({
327
- format: format,
328
- type: type
329
- }, TEXTURE_PROPS))
320
+ format: format
321
+ })),
322
+ maxWeightsTexture: this.context.device.createTexture(_objectSpread(_objectSpread({}, TEXTURE_PROPS), {}, {
323
+ width: 1,
324
+ height: 1,
325
+ format: format
326
+ }))
330
327
  });
331
328
  };
332
329
 
@@ -355,48 +352,40 @@ var HeatmapLayer = function (_AggregationLayer) {
355
352
  var floatTargetSupport = FLOAT_TARGET_FEATURES.every(function (feature) {
356
353
  return device.features.has(feature);
357
354
  });
358
-
359
- var _getTextureParams = (0, _heatmapLayerUtils.getTextureParams)({
360
- device: device,
361
- floatTargetSupport: floatTargetSupport
362
- }),
363
- format = _getTextureParams.format,
364
- type = _getTextureParams.type;
365
-
355
+ var format = floatTargetSupport ? 'rgba32float' : 'rgba8unorm';
366
356
  var weightsScale = floatTargetSupport ? 1 : 1 / 255;
367
357
  this.setState({
368
358
  textureSize: textureSize,
369
359
  format: format,
370
- type: type,
371
360
  weightsScale: weightsScale
372
361
  });
373
362
 
374
363
  if (!floatTargetSupport) {
375
- _core.log.warn("HeatmapLayer: ".concat(this.id, " rendering to float texture not supported, fallingback to low precession format"))();
364
+ _core.log.warn("HeatmapLayer: ".concat(this.id, " rendering to float texture not supported, falling back to low precision format"))();
376
365
  }
377
366
  };
378
367
 
379
- _proto.getShaders = function getShaders(type) {
380
- return (0, _get2.default)((0, _getPrototypeOf2.default)(HeatmapLayer.prototype), "getShaders", this).call(this, type === 'max-weights-transform' ? {
381
- vs: _maxVs.default,
382
- _fs: _maxFs.default
383
- } : {
384
- vs: _weightsVs.default,
385
- _fs: _weightsFs.default
386
- });
387
- };
388
-
389
- _proto._createWeightsTransform = function _createWeightsTransform() {
368
+ _proto._createWeightsTransform = function _createWeightsTransform(shaders) {
390
369
  var _weightsTransform;
391
370
 
392
- var shaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
393
371
  var weightsTransform = this.state.weightsTransform;
394
- (_weightsTransform = weightsTransform) === null || _weightsTransform === void 0 ? void 0 : _weightsTransform.delete();
372
+ var weightsTexture = this.state.weightsTexture;
373
+ var attributeManager = this.getAttributeManager();
374
+ (_weightsTransform = weightsTransform) === null || _weightsTransform === void 0 ? void 0 : _weightsTransform.destroy();
395
375
  weightsTransform = new _engine.TextureTransform(this.context.device, _objectSpread({
396
376
  id: "".concat(this.id, "-weights-transform"),
377
+ bufferLayout: attributeManager.getBufferLayouts(),
397
378
  vertexCount: 1,
398
- targetTexture: this.state.weightsTexture,
399
- targetTextureVarying: 'weightsTexture'
379
+ targetTexture: weightsTexture,
380
+ parameters: {
381
+ depthWriteEnabled: false,
382
+ blendColorOperation: 'add',
383
+ blendColorSrcFactor: 'one',
384
+ blendColorDstFactor: 'one',
385
+ blendAlphaSrcFactor: 'one',
386
+ blendAlphaDstFactor: 'one'
387
+ },
388
+ topology: 'point-list'
400
389
  }, shaders));
401
390
  this.setState({
402
391
  weightsTransform: weightsTransform
@@ -406,58 +395,74 @@ var HeatmapLayer = function (_AggregationLayer) {
406
395
  _proto._setupResources = function _setupResources() {
407
396
  this._createTextures();
408
397
 
398
+ var device = this.context.device;
409
399
  var _this$state4 = this.state,
410
400
  textureSize = _this$state4.textureSize,
411
401
  weightsTexture = _this$state4.weightsTexture,
412
402
  maxWeightsTexture = _this$state4.maxWeightsTexture;
413
- var weightsTransformShaders = this.getShaders('weights-transform');
403
+ var weightsTransformShaders = this.getShaders({
404
+ vs: _weightsVs.default,
405
+ fs: _weightsFs.default
406
+ });
414
407
 
415
408
  this._createWeightsTransform(weightsTransformShaders);
416
409
 
417
- var maxWeightsTransformShaders = this.getShaders('max-weights-transform');
418
- var maxWeightTransform = new _engine.TextureTransform(this.context.device, _objectSpread(_objectSpread({
410
+ var maxWeightsTransformShaders = this.getShaders({
411
+ vs: _maxVs.default,
412
+ fs: _maxFs.default
413
+ });
414
+ var maxWeightTransform = new _engine.TextureTransform(device, _objectSpread(_objectSpread({
419
415
  id: "".concat(this.id, "-max-weights-transform"),
420
- _sourceTextures: {
416
+ bindings: {
421
417
  inTexture: weightsTexture
422
418
  },
423
- _targetTexture: maxWeightsTexture,
424
- _targetTextureVarying: 'outTexture'
419
+ uniforms: {
420
+ textureSize: textureSize
421
+ },
422
+ targetTexture: maxWeightsTexture
425
423
  }, maxWeightsTransformShaders), {}, {
426
- elementCount: textureSize * textureSize
424
+ vertexCount: textureSize * textureSize,
425
+ topology: 'point-list',
426
+ parameters: {
427
+ depthWriteEnabled: false,
428
+ blendColorOperation: 'max',
429
+ blendAlphaOperation: 'max',
430
+ blendColorSrcFactor: 'one',
431
+ blendColorDstFactor: 'one',
432
+ blendAlphaSrcFactor: 'one',
433
+ blendAlphaDstFactor: 'one'
434
+ }
427
435
  }));
428
436
  this.setState({
429
437
  weightsTexture: weightsTexture,
430
438
  maxWeightsTexture: maxWeightsTexture,
431
439
  maxWeightTransform: maxWeightTransform,
432
440
  zoom: null,
433
- triPositionBuffer: this.context.device.createBuffer({
434
- byteLength: 48,
435
- accessor: {
436
- size: 3
437
- }
441
+ triPositionBuffer: device.createBuffer({
442
+ byteLength: 48
438
443
  }),
439
- triTexCoordBuffer: this.context.device.createBuffer({
440
- byteLength: 48,
441
- accessor: {
442
- size: 2
443
- }
444
+ triTexCoordBuffer: device.createBuffer({
445
+ byteLength: 48
444
446
  })
445
447
  });
446
448
  };
447
449
 
448
450
  _proto.updateShaders = function updateShaders(shaderOptions) {
449
- this._createWeightsTransform(shaderOptions);
451
+ this._createWeightsTransform(_objectSpread({
452
+ vs: _weightsVs.default,
453
+ fs: _weightsFs.default
454
+ }, shaderOptions));
450
455
  };
451
456
 
452
457
  _proto._updateMaxWeightValue = function _updateMaxWeightValue() {
453
- var maxWeightTransform = this.state.maxWeightTransform;
458
+ var _this$state5 = this.state,
459
+ maxWeightTransform = _this$state5.maxWeightTransform,
460
+ textureSize = _this$state5.textureSize;
454
461
  maxWeightTransform.run({
455
462
  parameters: {
456
- blend: true,
457
- depthTest: false,
458
- blendFunc: [1, 1],
459
- blendEquation: 32776
460
- }
463
+ viewport: [0, 0, 1, 1]
464
+ },
465
+ clearColor: [0, 0, 0, 0]
461
466
  });
462
467
  };
463
468
 
@@ -498,11 +503,11 @@ var HeatmapLayer = function (_AggregationLayer) {
498
503
  };
499
504
 
500
505
  _proto._updateTextureRenderingBounds = function _updateTextureRenderingBounds() {
501
- var _this$state5 = this.state,
502
- triPositionBuffer = _this$state5.triPositionBuffer,
503
- triTexCoordBuffer = _this$state5.triTexCoordBuffer,
504
- normalizedCommonBounds = _this$state5.normalizedCommonBounds,
505
- viewportCorners = _this$state5.viewportCorners;
506
+ var _this$state6 = this.state,
507
+ triPositionBuffer = _this$state6.triPositionBuffer,
508
+ triTexCoordBuffer = _this$state6.triTexCoordBuffer,
509
+ normalizedCommonBounds = _this$state6.normalizedCommonBounds,
510
+ viewportCorners = _this$state6.viewportCorners;
506
511
  var viewport = this.context.viewport;
507
512
  triPositionBuffer.write((0, _heatmapLayerUtils.packVertices)(viewportCorners, 3));
508
513
  var textureBounds = viewportCorners.map(function (p) {
@@ -512,21 +517,25 @@ var HeatmapLayer = function (_AggregationLayer) {
512
517
  };
513
518
 
514
519
  _proto._updateColorTexture = function _updateColorTexture(opts) {
520
+ var _colorTexture;
521
+
515
522
  var colorRange = opts.props.colorRange;
516
523
  var colorTexture = this.state.colorTexture;
517
524
  var colors = (0, _colorUtils.colorRangeToFlatArray)(colorRange, false, Uint8Array);
518
525
 
519
- if (colorTexture) {
520
- colorTexture.setImageData({
521
- data: colors,
522
- width: colorRange.length
526
+ if (colorTexture && ((_colorTexture = colorTexture) === null || _colorTexture === void 0 ? void 0 : _colorTexture.width) === colorRange.length) {
527
+ colorTexture.setSubImageData({
528
+ data: colors
523
529
  });
524
530
  } else {
525
- colorTexture = this.context.device.createTexture(_objectSpread({
531
+ var _colorTexture2;
532
+
533
+ (_colorTexture2 = colorTexture) === null || _colorTexture2 === void 0 ? void 0 : _colorTexture2.destroy();
534
+ colorTexture = this.context.device.createTexture(_objectSpread(_objectSpread({}, TEXTURE_PROPS), {}, {
526
535
  data: colors,
527
536
  width: colorRange.length,
528
537
  height: 1
529
- }, TEXTURE_PROPS));
538
+ }));
530
539
  }
531
540
 
532
541
  this.setState({
@@ -535,16 +544,14 @@ var HeatmapLayer = function (_AggregationLayer) {
535
544
  };
536
545
 
537
546
  _proto._updateWeightmap = function _updateWeightmap() {
538
- var _this3 = this;
539
-
540
547
  var _this$props2 = this.props,
541
548
  radiusPixels = _this$props2.radiusPixels,
542
549
  colorDomain = _this$props2.colorDomain,
543
550
  aggregation = _this$props2.aggregation;
544
- var _this$state6 = this.state,
545
- worldBounds = _this$state6.worldBounds,
546
- textureSize = _this$state6.textureSize,
547
- weightsScale = _this$state6.weightsScale;
551
+ var _this$state7 = this.state,
552
+ worldBounds = _this$state7.worldBounds,
553
+ textureSize = _this$state7.textureSize,
554
+ weightsScale = _this$state7.weightsScale;
548
555
  var weightsTransform = this.state.weightsTransform;
549
556
  this.state.isWeightMapDirty = false;
550
557
 
@@ -562,30 +569,29 @@ var HeatmapLayer = function (_AggregationLayer) {
562
569
  this.state.colorDomain = colorDomain || DEFAULT_COLOR_DOMAIN;
563
570
  }
564
571
 
572
+ var attributeManager = this.getAttributeManager();
573
+ var attributes = attributeManager.getAttributes();
574
+ var moduleSettings = this.getModuleSettings();
575
+ var positions = attributes.positions.buffer;
565
576
  var uniforms = {
566
577
  radiusPixels: radiusPixels,
567
578
  commonBounds: commonBounds,
568
579
  textureWidth: textureSize,
569
580
  weightsScale: weightsScale
570
581
  };
571
- weightsTransform.update({
572
- elementCount: this.getNumInstances()
582
+ var weights = attributes.weights.buffer;
583
+ weightsTransform.model.setAttributes({
584
+ positions: positions,
585
+ weights: weights
573
586
  });
574
- (0, _webgl.withGLParameters)(this.context.gl, {
587
+ weightsTransform.model.setVertexCount(this.getNumInstances());
588
+ weightsTransform.model.setUniforms(uniforms);
589
+ weightsTransform.model.updateModuleSettings(moduleSettings);
590
+ weightsTransform.run({
591
+ parameters: {
592
+ viewport: [0, 0, textureSize, textureSize]
593
+ },
575
594
  clearColor: [0, 0, 0, 0]
576
- }, function () {
577
- weightsTransform.run({
578
- uniforms: uniforms,
579
- parameters: {
580
- blend: true,
581
- depthTest: false,
582
- blendFunc: [1, 1],
583
- blendEquation: 32774
584
- },
585
- clearRenderTarget: true,
586
- attributes: _this3.getAttributes(),
587
- moduleSettings: _this3.getModuleSettings()
588
- });
589
595
  });
590
596
 
591
597
  this._updateMaxWeightValue();
@@ -1 +1 @@
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","TextureTransform","targetTexture","targetTextureVarying","weightsTransformShaders","maxWeightsTransformShaders","_sourceTextures","inTexture","_targetTexture","_targetTextureVarying","elementCount","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","write","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;;A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CAAlB,CAAzB,CAAnB;AACAU,MAAAA,cAAc,GAAGrI,QAAQ,CAACmG,eAAT,CAAyB,CAACyB,OAAD,EAAUC,MAAV,EAAkB,CAAlB,CAAzB,CAAjB;AACD;;AAED,WAAO,2CACL,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,EAOLvF,IAPK,EAQLA,IARK,CAAP;AAUD,G;;SAIDoD,oB,GAAA,8BAAqBU,YAArB,EAAmC;AACjC,qDAAiCA,YAAjC;AAAA,QAAO8B,IAAP;AAAA,QAAaC,IAAb;AAAA,QAAmBC,IAAnB;AAAA,QAAyBC,IAAzB;;AACA,QAAOzI,QAAP,GAAmB,KAAKjC,OAAxB,CAAOiC,QAAP;AACA,QAAM0I,eAAe,GAAG1I,QAAQ,CAAC2I,iBAAT,CAA2B,CAACL,IAAD,EAAOC,IAAP,CAA3B,CAAxB;AACA,QAAMK,aAAa,GAAG5I,QAAQ,CAAC2I,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;;;AAHWrL,Y,CAIZsL,S,GAAY,c;AAJAtL,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 {Buffer, DeviceFeature, Texture, TextureProps, TextureFormat} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\nimport {TextureTransform, TextureTransformProps} from '@luma.gl/engine';\nimport {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?: Buffer;\n triTexCoordBuffer?: Buffer;\n weightsTransform?: TextureTransform;\n maxWeightTransform?: TextureTransform;\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 weightsTransform?.delete();\n\n weightsTransform = new TextureTransform(this.context.device, {\n id: `${this.id}-weights-transform`,\n vertexCount: 1,\n targetTexture: this.state.weightsTexture!,\n targetTextureVarying: 'weightsTexture',\n ...shaders\n } as TextureTransformProps);\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 TextureTransform(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 // @ts-expect-error TODO(v9): Resolve errors.\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!.write(packVertices(viewportCorners, 3));\n\n const textureBounds = viewportCorners.map(p =>\n getTextureCoordinates(viewport.projectPosition(p), normalizedCommonBounds!)\n );\n triTexCoordBuffer!.write(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 // @ts-expect-error TODO(v9): Resolve errors.\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 // 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"}
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","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","_createWeightsTransform","shaders","TextureTransform","bufferLayout","getBufferLayouts","targetTexture","parameters","depthWriteEnabled","blendColorOperation","blendColorSrcFactor","blendColorDstFactor","blendAlphaSrcFactor","blendAlphaDstFactor","topology","weightsTransformShaders","getShaders","vs","weightsVs","fs","weightsFs","maxWeightsTransformShaders","maxVs","maxFs","bindings","inTexture","uniforms","blendAlphaOperation","createBuffer","byteLength","updateShaders","shaderOptions","_updateMaxWeightValue","run","clearColor","forceUpdate","viewportCorners","unproject","map","p","fround","visibleWorldBounds","newState","worldBounds","scaledCommonBounds","_worldToCommonBounds","_commonToWorldBounds","LNGLAT","normalizedCommonBounds","write","textureBounds","projectPosition","colors","Uint8Array","length","setSubImageData","commonBounds","useLayerCoordinateSystem","metersPerPixel","distanceScales","metersPerUnit","getAttributes","moduleSettings","getModuleSettings","buffer","textureWidth","model","setAttributes","setVertexCount","getNumInstances","setUniforms","updateModuleSettings","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;;AAQA;;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,QADJ;AAEPC,IAAAA,SAAS,EAAE,QAFJ;AAGPC,IAAAA,YAAY,EAAE,eAHP;AAIPC,IAAAA,YAAY,EAAE;AAJP;AAHyB,CAApC;AAUA,IAAMC,oBAAoB,GAAG,CAAC,CAAD,EAAI,CAAJ,CAA7B;AACA,IAAMC,gBAAgB,GAAG;AACvBC,EAAAA,GAAG,EAAE,CADkB;AAEvBC,EAAAA,IAAI,EAAE;AAFiB,CAAzB;AAKA,IAAMC,YAA6C,GAAG;AACpDC,EAAAA,WAAW,EAAE;AAACC,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE,eAACC,CAAD;AAAA,aAAYA,CAAC,CAACC,QAAd;AAAA;AAA1B,GADuC;AAEpDC,EAAAA,SAAS,EAAE;AAACJ,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE;AAA1B,GAFyC;AAGpDI,EAAAA,SAAS,EAAE;AAACL,IAAAA,IAAI,EAAE,QAAP;AAAiBM,IAAAA,GAAG,EAAE,CAAtB;AAAyBL,IAAAA,KAAK,EAAE;AAAhC,GAHyC;AAIpDM,EAAAA,YAAY,EAAE;AAACP,IAAAA,IAAI,EAAE,QAAP;AAAiBM,IAAAA,GAAG,EAAE,CAAtB;AAAyBE,IAAAA,GAAG,EAAE,GAA9B;AAAmCP,IAAAA,KAAK,EAAE;AA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EI,cAAc,CAAC,CAAD,CAAd,GAAoBJ,kBAAkB,CAAC,CAAD,CAHxC,EAIEI,cAAc,CAAC,CAAD,CAAd,GAAoBJ,kBAAkB,CAAC,CAAD,CAJxC,CADK,EAOL3F,IAPK,EAQLA,IARK,CAAP;AAUD,G;;SAIDuD,oB,GAAA,8BAAqBU,YAArB,EAAmC;AACjC,qDAAiCA,YAAjC;AAAA,QAAO+B,IAAP;AAAA,QAAaC,IAAb;AAAA,QAAmBC,IAAnB;AAAA,QAAyBC,IAAzB;;AACA,QAAO5I,QAAP,GAAmB,KAAKjC,OAAxB,CAAOiC,QAAP;AACA,QAAM6I,eAAe,GAAG7I,QAAQ,CAAC8I,iBAAT,CAA2B,CAACL,IAAD,EAAOC,IAAP,CAA3B,CAAxB;AACA,QAAMK,aAAa,GAAG/I,QAAQ,CAAC8I,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;;;EA9fOE,yB;;;AAHWxL,Y,CAIZyL,S,GAAY,c;AAJAzL,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} from './heatmap-layer-utils';\nimport {Buffer, DeviceFeature, Texture, TextureProps, TextureFormat} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\nimport {TextureTransform, TextureTransformProps} from '@luma.gl/engine';\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 maxVs from './max-vs.glsl';\nimport maxFs 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: 'linear',\n magFilter: 'linear',\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?: Buffer;\n triTexCoordBuffer?: Buffer;\n weightsTransform?: TextureTransform;\n maxWeightTransform?: TextureTransform;\n textureSize: number;\n format: TextureFormat;\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 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} = this.state;\n\n this.setState({\n weightsTexture: this.context.device.createTexture({\n ...TEXTURE_PROPS,\n width: textureSize,\n height: textureSize,\n format\n }),\n maxWeightsTexture: this.context.device.createTexture({\n ...TEXTURE_PROPS,\n width: 1,\n height: 1,\n format\n })\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: TextureFormat = floatTargetSupport ? 'rgba32float' : 'rgba8unorm';\n const weightsScale = floatTargetSupport ? 1 : 1 / 255;\n this.setState({textureSize, format, weightsScale});\n if (!floatTargetSupport) {\n log.warn(\n `HeatmapLayer: ${this.id} rendering to float texture not supported, falling back to low precision format`\n )();\n }\n }\n\n _createWeightsTransform(shaders: {vs: string; fs?: string}) {\n let {weightsTransform} = this.state;\n const {weightsTexture} = this.state;\n const attributeManager = this.getAttributeManager()!;\n\n weightsTransform?.destroy();\n weightsTransform = new TextureTransform(this.context.device, {\n id: `${this.id}-weights-transform`,\n bufferLayout: attributeManager.getBufferLayouts(),\n vertexCount: 1,\n targetTexture: weightsTexture!,\n parameters: {\n depthWriteEnabled: false,\n blendColorOperation: 'add',\n blendColorSrcFactor: 'one',\n blendColorDstFactor: 'one',\n blendAlphaSrcFactor: 'one',\n blendAlphaDstFactor: 'one'\n },\n topology: 'point-list',\n ...shaders\n } as TextureTransformProps);\n\n this.setState({weightsTransform});\n }\n\n _setupResources() {\n this._createTextures();\n const {device} = this.context;\n const {textureSize, weightsTexture, maxWeightsTexture} = this.state;\n\n const weightsTransformShaders = this.getShaders({\n vs: weightsVs,\n fs: weightsFs\n });\n this._createWeightsTransform(weightsTransformShaders);\n\n const maxWeightsTransformShaders = this.getShaders({vs: maxVs, fs: maxFs});\n const maxWeightTransform = new TextureTransform(device, {\n id: `${this.id}-max-weights-transform`,\n bindings: {inTexture: weightsTexture},\n uniforms: {textureSize},\n targetTexture: maxWeightsTexture,\n ...maxWeightsTransformShaders,\n vertexCount: textureSize * textureSize,\n topology: 'point-list',\n parameters: {\n depthWriteEnabled: false,\n blendColorOperation: 'max',\n blendAlphaOperation: 'max',\n blendColorSrcFactor: 'one',\n blendColorDstFactor: 'one',\n blendAlphaSrcFactor: 'one',\n blendAlphaDstFactor: 'one'\n }\n });\n\n this.setState({\n weightsTexture,\n maxWeightsTexture,\n maxWeightTransform,\n zoom: null,\n triPositionBuffer: device.createBuffer({byteLength: 48}),\n triTexCoordBuffer: device.createBuffer({byteLength: 48})\n });\n }\n\n // overwrite super class method to update transform model\n updateShaders(shaderOptions) {\n // shader params (modules, injects) changed, update model object\n this._createWeightsTransform({\n vs: weightsVs,\n fs: weightsFs,\n ...shaderOptions\n });\n }\n\n _updateMaxWeightValue() {\n const {maxWeightTransform, textureSize} = this.state;\n\n maxWeightTransform!.run({\n parameters: {viewport: [0, 0, 1, 1]},\n clearColor: [0, 0, 0, 0]\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!.write(packVertices(viewportCorners, 3));\n\n const textureBounds = viewportCorners.map(p =>\n getTextureCoordinates(viewport.projectPosition(p), normalizedCommonBounds!)\n );\n triTexCoordBuffer!.write(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 && colorTexture?.width === colorRange.length) {\n // TODO(v9): Unclear whether `setSubImageData` is a public API, or what to use if not.\n (colorTexture as any).setSubImageData({data: colors});\n } else {\n colorTexture?.destroy();\n colorTexture = this.context.device.createTexture({\n ...TEXTURE_PROPS,\n data: colors,\n width: colorRange.length,\n height: 1\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 attributeManager = this.getAttributeManager()!;\n const attributes = attributeManager.getAttributes();\n const moduleSettings = this.getModuleSettings();\n const positions = attributes.positions.buffer;\n const uniforms = {radiusPixels, commonBounds, textureWidth: textureSize, weightsScale};\n const weights = attributes.weights.buffer;\n weightsTransform.model.setAttributes({positions, weights});\n weightsTransform.model.setVertexCount(this.getNumInstances());\n weightsTransform.model.setUniforms(uniforms);\n weightsTransform.model.updateModuleSettings(moduleSettings);\n weightsTransform.run({\n parameters: {viewport: [0, 0, textureSize, textureSize]},\n clearColor: [0, 0, 0, 0]\n });\n\n this._updateMaxWeightValue();\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"}
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = "#version 300 es\nin vec4 inTexture;\nout vec4 outTexture;\n\nvoid main()\n{\noutTexture = inTexture;\ngl_Position = vec4(0, 0, 0, 1.);\ngl_PointSize = 1.0;\n}\n";
7
+ var _default = "#version 300 es\nuniform sampler2D inTexture;\nuniform float textureSize;\nout vec4 outTexture;\n\nvoid main()\n{\n int yIndex = gl_VertexID / int(textureSize);\n int xIndex = gl_VertexID - (yIndex * int(textureSize));\n vec2 uv = (0.5 + vec2(float(xIndex), float(yIndex))) / textureSize;\n outTexture = texture(inTexture, uv);\n\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n gl_PointSize = 1.0;\n}\n";
8
8
  exports.default = _default;
9
9
  //# sourceMappingURL=max-vs.glsl.js.map