@deck.gl/aggregation-layers 8.7.9 → 8.7.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +269 -259
- package/dist/es5/heatmap-layer/heatmap-layer-utils.js +5 -2
- package/dist/es5/heatmap-layer/heatmap-layer-utils.js.map +1 -1
- package/dist/es5/heatmap-layer/heatmap-layer.js +19 -13
- package/dist/es5/heatmap-layer/heatmap-layer.js.map +1 -1
- package/dist/esm/heatmap-layer/heatmap-layer-utils.js +5 -2
- package/dist/esm/heatmap-layer/heatmap-layer-utils.js.map +1 -1
- package/dist/esm/heatmap-layer/heatmap-layer.js +18 -13
- package/dist/esm/heatmap-layer/heatmap-layer.js.map +1 -1
- package/dist.min.js +1 -1
- package/package.json +2 -2
- package/src/heatmap-layer/heatmap-layer-utils.js +10 -5
- package/src/heatmap-layer/heatmap-layer.js +29 -14
|
@@ -111,9 +111,12 @@ function getTextureCoordinates(point, bounds) {
|
|
|
111
111
|
function getTextureParams(_ref) {
|
|
112
112
|
var gl = _ref.gl,
|
|
113
113
|
floatTargetSupport = _ref.floatTargetSupport;
|
|
114
|
-
return {
|
|
114
|
+
return floatTargetSupport ? {
|
|
115
115
|
format: (0, _core.isWebGL2)(gl) ? 34836 : 6408,
|
|
116
|
-
type:
|
|
116
|
+
type: 5126
|
|
117
|
+
} : {
|
|
118
|
+
format: 6408,
|
|
119
|
+
type: 5121
|
|
117
120
|
};
|
|
118
121
|
}
|
|
119
122
|
//# sourceMappingURL=heatmap-layer-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/heatmap-layer/heatmap-layer-utils.js"],"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","getTexture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D,IAAR,IAAgB,CAAhC;AAEA,SAAO,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,EAAsCa,MAAtC,EAA8C;AACnD,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,OAAoD;AAAA,MAAzBC,EAAyB,QAAzBA,EAAyB;AAAA,MAArBC,kBAAqB,QAArBA,kBAAqB;AACzD,
|
|
1
|
+
{"version":3,"sources":["../../../src/heatmap-layer/heatmap-layer-utils.js"],"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","gl","floatTargetSupport","format","type"],"mappings":";;;;;;;;;;;;;;;;AACA;;;;;;;;AAEO,SAASA,SAAT,CAAmBC,MAAnB,EAA2B;AAEhC,MAAMC,CAAC,GAAGD,MAAM,CAACE,GAAP,CAAW,UAAAC,CAAC;AAAA,WAAIA,CAAC,CAAC,CAAD,CAAL;AAAA,GAAZ,CAAV;AACA,MAAMC,CAAC,GAAGJ,MAAM,CAACE,GAAP,CAAW,UAAAC,CAAC;AAAA,WAAI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AaM,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,OAAoD;AAAA,MAAzBC,EAAyB,QAAzBA,EAAyB;AAAA,MAArBC,kBAAqB,QAArBA,kBAAqB;AACzD,SAAOA,kBAAkB,GACrB;AAEEC,IAAAA,MAAM,EAAE,oBAASF,EAAT,gBAFV;AAGEG,IAAAA,IAAI;AAHN,GADqB,GAMrB;AACED,IAAAA,MAAM,MADR;AAEEC,IAAAA,IAAI;AAFN,GANJ;AAUD","sourcesContent":["import GL from '@luma.gl/constants';\nimport {isWebGL2} from '@luma.gl/core';\n\nexport function getBounds(points) {\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, targetBounds) {\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, dimensions = 2) {\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, width, height) {\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, bounds) {\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({gl, floatTargetSupport}) {\n return floatTargetSupport\n ? {\n // format: should be RGBA32F on WebGL2 (float textures), RGBA in WebGL1 for float or non float textures\n format: isWebGL2(gl) ? 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"}
|
|
@@ -113,6 +113,7 @@ var defaultProps = {
|
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
115
|
var REQUIRED_FEATURES = [_core.FEATURES.BLEND_EQUATION_MINMAX, _core.FEATURES.TEXTURE_FLOAT];
|
|
116
|
+
var FLOAT_TARGET_FEATURES = [_core.FEATURES.COLOR_ATTACHMENT_RGBA32F, _core.FEATURES.FLOAT_BLEND];
|
|
116
117
|
var DIMENSIONS = {
|
|
117
118
|
data: {
|
|
118
119
|
props: ['radiusPixels']
|
|
@@ -346,7 +347,7 @@ var HeatmapLayer = function (_AggregationLayer) {
|
|
|
346
347
|
var gl = this.context.gl;
|
|
347
348
|
var weightsTextureSize = this.props.weightsTextureSize;
|
|
348
349
|
var textureSize = Math.min(weightsTextureSize, (0, _core.getParameters)(gl, 3379));
|
|
349
|
-
var floatTargetSupport = (0, _core.hasFeatures)(gl,
|
|
350
|
+
var floatTargetSupport = (0, _core.hasFeatures)(gl, FLOAT_TARGET_FEATURES);
|
|
350
351
|
|
|
351
352
|
var _getTextureParams = (0, _heatmapLayerUtils.getTextureParams)({
|
|
352
353
|
gl: gl,
|
|
@@ -540,7 +541,8 @@ var HeatmapLayer = function (_AggregationLayer) {
|
|
|
540
541
|
}, {
|
|
541
542
|
key: "_updateWeightmap",
|
|
542
543
|
value: function _updateWeightmap() {
|
|
543
|
-
var
|
|
544
|
+
var _this = this,
|
|
545
|
+
_weightsTexture$setPa;
|
|
544
546
|
|
|
545
547
|
var _this$props2 = this.props,
|
|
546
548
|
radiusPixels = _this$props2.radiusPixels,
|
|
@@ -577,17 +579,21 @@ var HeatmapLayer = function (_AggregationLayer) {
|
|
|
577
579
|
weightsTransform.update({
|
|
578
580
|
elementCount: this.getNumInstances()
|
|
579
581
|
});
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
582
|
+
(0, _core.withParameters)(this.context.gl, {
|
|
583
|
+
clearColor: [0, 0, 0, 0]
|
|
584
|
+
}, function () {
|
|
585
|
+
weightsTransform.run({
|
|
586
|
+
uniforms: uniforms,
|
|
587
|
+
parameters: {
|
|
588
|
+
blend: true,
|
|
589
|
+
depthTest: false,
|
|
590
|
+
blendFunc: [1, 1],
|
|
591
|
+
blendEquation: 32774
|
|
592
|
+
},
|
|
593
|
+
clearRenderTarget: true,
|
|
594
|
+
attributes: _this.getAttributes(),
|
|
595
|
+
moduleSettings: _this.getModuleSettings()
|
|
596
|
+
});
|
|
591
597
|
});
|
|
592
598
|
|
|
593
599
|
this._updateMaxWeightValue();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/heatmap-layer/heatmap-layer.js"],"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","DIMENSIONS","data","props","HeatmapLayer","gl","context","setState","supported","log","error","id","_setupTextureParams","_setupAttributes","_setupResources","changeFlags","somethingChanged","opts","state","_updateHeatmapState","oldProps","_getChangeFlags","dataChanged","viewportChanged","boundsChanged","_updateBounds","_updateTextureRenderingBounds","clearTimeout","updateTimer","isWeightMapDirty","viewportZoomChanged","_debouncedUpdateWeightmap","_updateColorTexture","_updateWeightmap","zoom","viewport","weightsTexture","triPositionBuffer","triTexCoordBuffer","maxWeightsTexture","colorTexture","updateTriggers","TriangleLayerClass","getSubLayerClass","TriangleLayer","getSubLayerProps","coordinateSystem","COORDINATE_SYSTEM","DEFAULT","attributes","positions","texCoords","vertexCount","maxTexture","aggregationMode","texture","weightsTransform","maxWeightTransform","delete","AttributeManager","stats","dimensions","isAttributeChanged","isAggregationDirty","compareAll","dimension","textureSize","format","Texture2D","width","height","attributeManager","getAttributeManager","add","size","accessor","weights","positionAttributeName","Math","floatTargetSupport","COLOR_ATTACHMENT_RGBA32F","weightsScale","warn","vs","vs_max","_fs","fs_max","weights_vs","weights_fs","shaders","Transform","elementCount","_targetTexture","_targetTextureVarying","_createTextures","weightsTransformShaders","getShaders","_createWeightsTransform","maxWeightsTransformShaders","_sourceTextures","inTexture","Buffer","byteLength","shaderOptions","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","clearRenderTarget","getAttributes","moduleSettings","getModuleSettings","_updateMaxWeightValue","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;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;AAEA,IAAMA,UAAU,GAAG,CAAnB;AACA,IAAMC,eAAe,GAAG;AACtBC,EAAAA,OAAO,EAAE,KADa;AAEtBC,EAAAA,UAAU,uQAFY;AAQtBC,EAAAA,UAAU;AARY,CAAxB;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,YAAY,GAAG;AACnBC,EAAAA,WAAW,EAAE;AAACC,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE,eAAAC,CAAC;AAAA,aAAIA,CAAC,CAACC,QAAN;AAAA;AAA3B,GADM;AAEnBC,EAAAA,SAAS,EAAE;AAACJ,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE;AAA1B,GAFQ;AAGnBI,EAAAA,SAAS,EAAE;AAACL,IAAAA,IAAI,EAAE,QAAP;AAAiBM,IAAAA,GAAG,EAAE,CAAtB;AAAyBL,IAAAA,KAAK,EAAE;AAAhC,GAHQ;AAInBM,E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,CAAD,CAAd,GAAoBJ,kBAAkB,CAAC,CAAD,CAHxC,EAIEI,cAAc,CAAC,CAAD,CAAd,GAAoBJ,kBAAkB,CAAC,CAAD,CAJxC,CADK,EAOLjF,IAPK,EAQLA,IARK,CAAP;AAUD;;;WAID,8BAAqBwD,YAArB,EAAmC;AACjC,uDAAiCA,YAAjC;AAAA,UAAO8B,IAAP;AAAA,UAAaC,IAAb;AAAA,UAAmBC,IAAnB;AAAA,UAAyBC,IAAzB;;AACA,UAAOhI,QAAP,GAAmB,KAAK7B,OAAxB,CAAO6B,QAAP;AACA,UAAMiI,eAAe,GAAGjI,QAAQ,CAACkI,iBAAT,CAA2B,CAACL,IAAD,EAAOC,IAAP,CAA3B,CAAxB;AACA,UAAMK,aAAa,GAAGnI,QAAQ,CAACkI,iBAAT,CAA2B,CAACH,IAAD,EAAOC,IAAP,CAA3B,CAAtB;AAEA,aAAOC,eAAe,CAACG,KAAhB,CAAsB,CAAtB,EAAyB,CAAzB,EAA4BC,MAA5B,CAAmCF,aAAa,CAACC,KAAd,CAAoB,CAApB,EAAuB,CAAvB,CAAnC,CAAP;AACD;;;EA3euCE,yB;;;AA8e1CrK,YAAY,CAACsK,SAAb,GAAyB,cAAzB;AACAtK,YAAY,CAAC1B,YAAb,GAA4BA,YAA5B","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 {Buffer, Texture2D, Transform, getParameters, FEATURES, hasFeatures} from '@luma.gl/core';\nimport {AttributeManager, COORDINATE_SYSTEM, log} from '@deck.gl/core';\nimport TriangleLayer from './triangle-layer';\nimport AggregationLayer from '../aggregation-layer';\nimport {defaultColorRange, colorRangeToFlatArray} from '../utils/color-utils';\nimport weights_vs from './weights-vs.glsl';\nimport weights_fs from './weights-fs.glsl';\nimport vs_max from './max-vs.glsl';\nimport fs_max 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 = {\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 // FEATURES.FLOAT_BLEND, // implictly supported when TEXTURE_FLOAT is supported\n];\n\nconst DIMENSIONS = {\n data: {\n props: ['radiusPixels']\n }\n};\n\nexport default class HeatmapLayer extends AggregationLayer {\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.initializeState(DIMENSIONS);\n this.setState({supported: true, colorDomain: DEFAULT_COLOR_DOMAIN});\n this._setupTextureParams();\n this._setupAttributes();\n this._setupResources();\n }\n\n shouldUpdateState({changeFlags}) {\n // Need to be updated when viewport changes\n return changeFlags.somethingChanged;\n }\n\n /* eslint-disable max-statements,complexity */\n updateState(opts) {\n if (!this.state.supported) {\n return;\n }\n super.updateState(opts);\n this._updateHeatmapState(opts);\n }\n\n _updateHeatmapState(opts) {\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() {\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() {\n super.finalizeState();\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) {\n const changeFlags = {};\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, FEATURES.COLOR_ATTACHMENT_RGBA32F);\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: vs_max,\n _fs: fs_max\n }\n : {\n vs: weights_vs,\n _fs: weights_fs\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 = false) {\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 = {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);\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 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 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 = {}) {\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\nHeatmapLayer.layerName = 'HeatmapLayer';\nHeatmapLayer.defaultProps = defaultProps;\n"],"file":"heatmap-layer.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/heatmap-layer/heatmap-layer.js"],"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","gl","context","setState","supported","log","error","id","_setupTextureParams","_setupAttributes","_setupResources","changeFlags","somethingChanged","opts","state","_updateHeatmapState","oldProps","_getChangeFlags","dataChanged","viewportChanged","boundsChanged","_updateBounds","_updateTextureRenderingBounds","clearTimeout","updateTimer","isWeightMapDirty","viewportZoomChanged","_debouncedUpdateWeightmap","_updateColorTexture","_updateWeightmap","zoom","viewport","weightsTexture","triPositionBuffer","triTexCoordBuffer","maxWeightsTexture","colorTexture","updateTriggers","TriangleLayerClass","getSubLayerClass","TriangleLayer","getSubLayerProps","coordinateSystem","COORDINATE_SYSTEM","DEFAULT","attributes","positions","texCoords","vertexCount","maxTexture","aggregationMode","texture","weightsTransform","maxWeightTransform","delete","AttributeManager","stats","dimensions","isAttributeChanged","isAggregationDirty","compareAll","dimension","textureSize","format","Texture2D","width","height","attributeManager","getAttributeManager","add","size","accessor","weights","positionAttributeName","Math","floatTargetSupport","weightsScale","warn","vs","vs_max","_fs","fs_max","weights_vs","weights_fs","shaders","Transform","elementCount","_targetTexture","_targetTextureVarying","_createTextures","weightsTransformShaders","getShaders","_createWeightsTransform","maxWeightsTransformShaders","_sourceTextures","inTexture","Buffer","byteLength","shaderOptions","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","_updateMaxWeightValue","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;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;AAEA,IAAMA,UAAU,GAAG,CAAnB;AACA,IAAMC,eAAe,GAAG;AACtBC,EAAAA,OAAO,EAAE,KADa;AAEtBC,EAAAA,UAAU,uQAFY;AAQtBC,EAAAA,UAAU;AARY,CAAxB;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,YAAY,GAAG;AACnBC,EAAAA,WAAW,EAAE;AAACC,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE,eAAAC,CAAC;AAAA,aAAIA,CAAC,CAACC,QAAN;AAAA;AAA3B,GADM;AAEnBC,EAAAA,SAAS,EAAE;AAACJ,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE;AAA1B,GAFQ;AAGnBI,EAAAA,SAAS,EAAE;AAACL,IAAAA,IAAI,EAAE,QAAP;AAAiBM,IAAAA,GAAG,EAAE,CAAtB;AAAyBL,IAAAA,KAAK,EAAE;AAAhC,GAHQ;AAInBM,EAAAA,YAAY,EAAE;AAACP,IAAAA,IAAI,EAAE,QAAP;AAAiBM,IAAAA,GAAG,EAAE,CAAtB;AAAyBE,IAAAA,GAAG,EAAE,GAA9B;AAAmCP,IAAAA,KAAK,EAAE;AAA1C,GAJK;AAKnBQ,EAAAA,UAAU,EAAEC,6BALO;AAMnBC,E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,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;;;WAID,8BAAqBuD,YAArB,EAAmC;AACjC,uDAAiCA,YAAjC;AAAA,UAAO+B,IAAP;AAAA,UAAaC,IAAb;AAAA,UAAmBC,IAAnB;AAAA,UAAyBC,IAAzB;;AACA,UAAOhI,QAAP,GAAmB,KAAK7B,OAAxB,CAAO6B,QAAP;AACA,UAAMiI,eAAe,GAAGjI,QAAQ,CAACkI,iBAAT,CAA2B,CAACL,IAAD,EAAOC,IAAP,CAA3B,CAAxB;AACA,UAAMK,aAAa,GAAGnI,QAAQ,CAACkI,iBAAT,CAA2B,CAACH,IAAD,EAAOC,IAAP,CAA3B,CAAtB;AAEA,aAAOC,eAAe,CAACG,KAAhB,CAAsB,CAAtB,EAAyB,CAAzB,EAA4BC,MAA5B,CAAmCF,aAAa,CAACC,KAAd,CAAoB,CAApB,EAAuB,CAAvB,CAAnC,CAAP;AACD;;;EA9euCE,yB;;;AAif1CrK,YAAY,CAACsK,SAAb,GAAyB,cAAzB;AACAtK,YAAY,CAAC7B,YAAb,GAA4BA,YAA5B","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 {AttributeManager, COORDINATE_SYSTEM, log} from '@deck.gl/core';\nimport TriangleLayer from './triangle-layer';\nimport AggregationLayer from '../aggregation-layer';\nimport {defaultColorRange, colorRangeToFlatArray} from '../utils/color-utils';\nimport weights_vs from './weights-vs.glsl';\nimport weights_fs from './weights-fs.glsl';\nimport vs_max from './max-vs.glsl';\nimport fs_max 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 = {\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 default class HeatmapLayer extends AggregationLayer {\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.initializeState(DIMENSIONS);\n this.setState({supported: true, colorDomain: DEFAULT_COLOR_DOMAIN});\n this._setupTextureParams();\n this._setupAttributes();\n this._setupResources();\n }\n\n shouldUpdateState({changeFlags}) {\n // Need to be updated when viewport changes\n return changeFlags.somethingChanged;\n }\n\n /* eslint-disable max-statements,complexity */\n updateState(opts) {\n if (!this.state.supported) {\n return;\n }\n super.updateState(opts);\n this._updateHeatmapState(opts);\n }\n\n _updateHeatmapState(opts) {\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() {\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() {\n super.finalizeState();\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) {\n const changeFlags = {};\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: vs_max,\n _fs: fs_max\n }\n : {\n vs: weights_vs,\n _fs: weights_fs\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 = false) {\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 = {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);\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 = {}) {\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\nHeatmapLayer.layerName = 'HeatmapLayer';\nHeatmapLayer.defaultProps = defaultProps;\n"],"file":"heatmap-layer.js"}
|
|
@@ -57,9 +57,12 @@ export function getTextureParams({
|
|
|
57
57
|
gl,
|
|
58
58
|
floatTargetSupport
|
|
59
59
|
}) {
|
|
60
|
-
return {
|
|
60
|
+
return floatTargetSupport ? {
|
|
61
61
|
format: isWebGL2(gl) ? 34836 : 6408,
|
|
62
|
-
type:
|
|
62
|
+
type: 5126
|
|
63
|
+
} : {
|
|
64
|
+
format: 6408,
|
|
65
|
+
type: 5121
|
|
63
66
|
};
|
|
64
67
|
}
|
|
65
68
|
//# sourceMappingURL=heatmap-layer-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/heatmap-layer/heatmap-layer-utils.js"],"names":["isWebGL2","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","gl","floatTargetSupport","format","type"],"mappings":"AACA,SAAQA,QAAR,QAAuB,eAAvB;AAEA,OAAO,SAASC,SAAT,CAAmBC,MAAnB,EAA2B;AAEhC,QAAMC,CAAC,GAAGD,MAAM,CAACE,GAAP,CAAWC,CAAC,IAAIA,CAAC,CAAC,CAAD,CAAjB,CAAV;AACA,QAAMC,CAAC,GAAGJ,MAAM,CAACE,GAAP,CAAWC,CAAC,IAAIA,CAAC,CAAC,CAAD,CAAjB,CAAV;AAEA,QAAME,IAAI,GAAGC,IAAI,CAACC,GAAL,CAASC,KAAT,CAAe,IAAf,EAAqBP,CAArB,CAAb;AACA,QAAMQ,IAAI,GAAGH,IAAI,CAACI,GAAL,CAASF,KAAT,CAAe,IAAf,EAAqBP,CAArB,CAAb;AACA,QAAMU,IAAI,GAAGL,IAAI,CAACC,GAAL,CAASC,KAAT,CAAe,IAAf,EAAqBJ,CAArB,CAAb;AACA,QAAMQ,IAAI,GAAGN,IAAI,CAACI,GAAL,CAASF,KAAT,CAAe,IAAf,EAAqB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hB;;AACA,MAAID,YAAY,GAAGC,aAAf,GAA+BH,KAAK,GAAGC,MAA3C,EAAmD;AAEjDG,IAAAA,QAAQ,GAAIJ,KAAK,GAAGC,MAAT,GAAmBE,aAA9B;AACD,GAHD,MAGO;AACLE,IAAAA,SAAS,GAAIJ,MAAM,GAAGD,KAAV,GAAmBE,YAA/B;AACD;;AAED,MAAIE,QAAQ,GAAGJ,KAAf,EAAsB;AACpBI,IAAAA,QAAQ,GAAGJ,KAAX;AACAK,IAAAA,SAAS,GAAGJ,MAAZ;AACD;;AAED,QAAMK,OAAO,GAAG,CAACtB,IAAI,GAAGJ,IAAR,IAAgB,CAAhC;AACA,QAAM2B,OAAO,GAAG,CAACpB,IAAI,GAAGD,IAAR,IAAgB,CAAhC;AAEA,SAAO,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;AAGD,OAAO,SAASG,qBAAT,CAA+BZ,KAA/B,EAAsCa,MAAtC,EAA8C;AACnD,QAAM,CAAC7B,IAAD,EAAOM,IAAP,EAAaF,IAAb,EAAmBG,IAAnB,IAA2BsB,MAAjC;AACA,SAAO,CAAC,CAACb,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;AAGD,OAAO,SAASwB,gBAAT,CAA0B;AAACC,EAAAA,EAAD;AAAKC,EAAAA;AAAL,CAA1B,EAAoD;AACzD,
|
|
1
|
+
{"version":3,"sources":["../../../src/heatmap-layer/heatmap-layer-utils.js"],"names":["isWebGL2","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","gl","floatTargetSupport","format","type"],"mappings":"AACA,SAAQA,QAAR,QAAuB,eAAvB;AAEA,OAAO,SAASC,SAAT,CAAmBC,MAAnB,EAA2B;AAEhC,QAAMC,CAAC,GAAGD,MAAM,CAACE,GAAP,CAAWC,CAAC,IAAIA,CAAC,CAAC,CAAD,CAAjB,CAAV;AACA,QAAMC,CAAC,GAAGJ,MAAM,CAACE,GAAP,CAAWC,CAAC,IAAIA,CAAC,CAAC,CAAD,CAAjB,CAAV;AAEA,QAAME,IAAI,GAAGC,IAAI,CAACC,GAAL,CAASC,KAAT,CAAe,IAAf,EAAqBP,CAArB,CAAb;AACA,QAAMQ,IAAI,GAAGH,IAAI,CAACI,GAAL,CAASF,KAAT,CAAe,IAAf,EAAqBP,CAArB,CAAb;AACA,QAAMU,IAAI,GAAGL,IAAI,CAACC,GAAL,CAASC,KAAT,CAAe,IAAf,EAAqBJ,CAArB,CAAb;AACA,QAAMQ,IAAI,GAAGN,IAAI,CAACI,GAAL,CAASF,KAAT,CAAe,IAAf,EAAqBJ,CAArB,CAAb;AAEA,SAAO,CAACC,IAAD,EAAOM,IAAP,EAAaF,IAAb,EAAmBG,IAAnB,CAAP;AACD;AAGD,OAAO,SAASC,aAAT,CAAuBC,aAAvB,EAAsCC,YAAtC,EAAoD;AACzD,MACEA,YAAY,CAAC,CAAD,CAAZ,IAAmBD,aAAa,CAAC,CAAD,CAAhC,IACAC,YAAY,CAAC,CAAD,CAAZ,IAAmBD,aAAa,CAAC,CAAD,CADhC,IAEAC,YAAY,CAAC,CAAD,CAAZ,IAAmBD,aAAa,CAAC,CAAD,CAFhC,IAGAC,YAAY,CAAC,CAAD,CAAZ,IAAmBD,aAAa,CAAC,CAAD,CAJlC,EAKE;AACA,WAAO,IAAP;AACD;;AACD,SAAO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AgB,CAAhC;AAEA,SAAO,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;AAGD,OAAO,SAASG,qBAAT,CAA+BZ,KAA/B,EAAsCa,MAAtC,EAA8C;AACnD,QAAM,CAAC7B,IAAD,EAAOM,IAAP,EAAaF,IAAb,EAAmBG,IAAnB,IAA2BsB,MAAjC;AACA,SAAO,CAAC,CAACb,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;AAGD,OAAO,SAASwB,gBAAT,CAA0B;AAACC,EAAAA,EAAD;AAAKC,EAAAA;AAAL,CAA1B,EAAoD;AACzD,SAAOA,kBAAkB,GACrB;AAEEC,IAAAA,MAAM,EAAExC,QAAQ,CAACsC,EAAD,CAAR,eAFV;AAGEG,IAAAA,IAAI;AAHN,GADqB,GAMrB;AACED,IAAAA,MAAM,MADR;AAEEC,IAAAA,IAAI;AAFN,GANJ;AAUD","sourcesContent":["import GL from '@luma.gl/constants';\nimport {isWebGL2} from '@luma.gl/core';\n\nexport function getBounds(points) {\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, targetBounds) {\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, dimensions = 2) {\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, width, height) {\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, bounds) {\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({gl, floatTargetSupport}) {\n return floatTargetSupport\n ? {\n // format: should be RGBA32F on WebGL2 (float textures), RGBA in WebGL1 for float or non float textures\n format: isWebGL2(gl) ? 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,5 +1,5 @@
|
|
|
1
1
|
import { getBounds, boundsContain, packVertices, scaleToAspectRatio, getTextureCoordinates, getTextureParams } from './heatmap-layer-utils';
|
|
2
|
-
import { Buffer, Texture2D, Transform, getParameters, FEATURES, hasFeatures } from '@luma.gl/core';
|
|
2
|
+
import { Buffer, Texture2D, Transform, getParameters, withParameters, FEATURES, hasFeatures } from '@luma.gl/core';
|
|
3
3
|
import { AttributeManager, COORDINATE_SYSTEM, log } from '@deck.gl/core';
|
|
4
4
|
import TriangleLayer from './triangle-layer';
|
|
5
5
|
import AggregationLayer from '../aggregation-layer';
|
|
@@ -71,6 +71,7 @@ const defaultProps = {
|
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
const REQUIRED_FEATURES = [FEATURES.BLEND_EQUATION_MINMAX, FEATURES.TEXTURE_FLOAT];
|
|
74
|
+
const FLOAT_TARGET_FEATURES = [FEATURES.COLOR_ATTACHMENT_RGBA32F, FEATURES.FLOAT_BLEND];
|
|
74
75
|
const DIMENSIONS = {
|
|
75
76
|
data: {
|
|
76
77
|
props: ['radiusPixels']
|
|
@@ -301,7 +302,7 @@ export default class HeatmapLayer extends AggregationLayer {
|
|
|
301
302
|
weightsTextureSize
|
|
302
303
|
} = this.props;
|
|
303
304
|
const textureSize = Math.min(weightsTextureSize, getParameters(gl, 3379));
|
|
304
|
-
const floatTargetSupport = hasFeatures(gl,
|
|
305
|
+
const floatTargetSupport = hasFeatures(gl, FLOAT_TARGET_FEATURES);
|
|
305
306
|
const {
|
|
306
307
|
format,
|
|
307
308
|
type
|
|
@@ -538,17 +539,21 @@ export default class HeatmapLayer extends AggregationLayer {
|
|
|
538
539
|
weightsTransform.update({
|
|
539
540
|
elementCount: this.getNumInstances()
|
|
540
541
|
});
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
542
|
+
withParameters(this.context.gl, {
|
|
543
|
+
clearColor: [0, 0, 0, 0]
|
|
544
|
+
}, () => {
|
|
545
|
+
weightsTransform.run({
|
|
546
|
+
uniforms,
|
|
547
|
+
parameters: {
|
|
548
|
+
blend: true,
|
|
549
|
+
depthTest: false,
|
|
550
|
+
blendFunc: [1, 1],
|
|
551
|
+
blendEquation: 32774
|
|
552
|
+
},
|
|
553
|
+
clearRenderTarget: true,
|
|
554
|
+
attributes: this.getAttributes(),
|
|
555
|
+
moduleSettings: this.getModuleSettings()
|
|
556
|
+
});
|
|
552
557
|
});
|
|
553
558
|
|
|
554
559
|
this._updateMaxWeightValue();
|