@deck.gl/aggregation-layers 8.9.33 → 8.9.35

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/hexagon-layer/hexagon-layer.ts"],"names":["nop","defaultProps","colorDomain","colorRange","defaultColorRange","getColorValue","type","value","getColorWeight","colorAggregation","lowerPercentile","min","max","upperPercentile","colorScaleType","onSetColorDomain","elevationDomain","elevationRange","getElevationValue","getElevationWeight","elevationAggregation","elevationLowerPercentile","elevationUpperPercentile","elevationScale","elevationScaleType","onSetElevationDomain","radius","coverage","extruded","hexagonAggregator","pointToHexbin","getPosition","x","position","material","_filterData","optional","HexagonLayer","cpuAggregator","CPUAggregator","getAggregator","props","getCellSize","state","aggregatorState","vertices","attributeManager","getAttributeManager","add","positions","size","accessor","opts","changeFlags","propsOrDataChanged","updateState","viewport","context","attributes","getAttributes","layerData","hexagonVertices","setState","convertLatLngToMeterOffset","Array","isArray","length","vertex0","vertex3","centroid","centroidFlat","projectFlat","getDistanceScales","metersPerUnit","map","vt","vtFlat","log","error","info","getPickingInfo","cell","getAccessor","getUpdateTriggers","transitions","SubLayerClass","getSubLayerClass","ColumnLayer","updateTriggers","_getSublayerUpdateTriggers","geometry","radiusCommon","radiusUnits","angle","diskResolution","getFillColor","_onGetSublayerColor","bind","getElevation","_onGetSublayerElevation","getSubLayerProps","id","data","AggregationLayer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAoBA;;AAUA;;AAEA;;AAEA;;AACA;;AACA;;;;;;;;;;AAMA,SAASA,GAAT,GAAe,CAAE;;AAEjB,IAAMC,YAA6C,GAAG;AAEpDC,EAAAA,WAAW,EAAE,IAFuC;AAGpDC,EAAAA,UAAU,EAAEC,6BAHwC;AAIpDC,EAAAA,aAAa,EAAE;AAACC,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE;AAA1B,GAJqC;AAKpDC,EAAAA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mBAAL,CAAyBC,IAAzB,CAA8B,IAA9B,CATX;AAUHC,QAAAA,YAAY,EAAE,KAAKC,uBAAL,CAA6BF,IAA7B,CAAkC,IAAlC,CAVX;AAWHb,QAAAA,WAAW,EAAEA,WAAW,IAAI;AAC1BW,UAAAA,YAAY,EAAEX,WAAW,CAAC/E,aAAZ,IAA6B+E,WAAW,CAAC5E,cAD7B;AAE1B0F,UAAAA,YAAY,EAAEd,WAAW,CAAClE,iBAAZ,IAAiCkE,WAAW,CAACjE;AAFjC;AAXzB,UAgBL,KAAKiF,gBAAL,CAAsB;AACpBC,QAAAA,EAAE,EAAE,cADgB;AAEpBb,QAAAA,cAAc,EAAdA;AAFoB,OAAtB,CAhBK,EAoBL;AACEc,QAAAA,IAAI,EAAE1D,eAAe,CAACgB,SAAhB,CAA0B0C;AADlC,OApBK,CAAP;AAwBD;;;EA5I2EC,yB;;;8BAAzDlE,Y,eAIA,c;8BAJAA,Y,kBAKGpC,Y","sourcesContent":["// Copyright (c) 2015 - 2017 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\nimport {\n Accessor,\n AccessorFunction,\n Color,\n log,\n Position,\n Material,\n UpdateParameters,\n DefaultProps\n} from '@deck.gl/core';\nimport {ColumnLayer} from '@deck.gl/layers';\n\nimport {defaultColorRange} from '../utils/color-utils';\n\nimport {pointToHexbin} from './hexagon-aggregator';\nimport CPUAggregator from '../utils/cpu-aggregator';\nimport AggregationLayer, {AggregationLayerProps} from '../aggregation-layer';\n\nimport GL from '@luma.gl/constants';\nimport {AggregateAccessor} from '../types';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nfunction nop() {}\n\nconst defaultProps: DefaultProps<HexagonLayerProps> = {\n // color\n colorDomain: null,\n colorRange: defaultColorRange,\n getColorValue: {type: 'accessor', value: null}, // default value is calcuated from `getColorWeight` and `colorAggregation`\n getColorWeight: {type: 'accessor', value: 1},\n colorAggregation: 'SUM',\n lowerPercentile: {type: 'number', value: 0, min: 0, max: 100},\n upperPercentile: {type: 'number', value: 100, min: 0, max: 100},\n colorScaleType: 'quantize',\n onSetColorDomain: nop,\n\n // elevation\n elevationDomain: null,\n elevationRange: [0, 1000],\n getElevationValue: {type: 'accessor', value: null}, // default value is calcuated from `getElevationWeight` and `elevationAggregation`\n getElevationWeight: {type: 'accessor', value: 1},\n elevationAggregation: 'SUM',\n elevationLowerPercentile: {type: 'number', value: 0, min: 0, max: 100},\n elevationUpperPercentile: {type: 'number', value: 100, min: 0, max: 100},\n elevationScale: {type: 'number', min: 0, value: 1},\n elevationScaleType: 'linear',\n onSetElevationDomain: nop,\n\n radius: {type: 'number', value: 1000, min: 1},\n coverage: {type: 'number', min: 0, max: 1, value: 1},\n extruded: false,\n hexagonAggregator: pointToHexbin,\n getPosition: {type: 'accessor', value: x => x.position},\n // Optional material for 'lighting' shader module\n material: true,\n\n // data filter\n _filterData: {type: 'function', value: null, optional: true}\n};\n\n/** All properties supported by by HexagonLayer. */\nexport type HexagonLayerProps<DataT = any> = _HexagonLayerProps<DataT> &\n AggregationLayerProps<DataT>;\n\n/** Properties added by HexagonLayer. */\ntype _HexagonLayerProps<DataT = any> = {\n /**\n * Radius of hexagon bin in meters. The hexagons are pointy-topped (rather than flat-topped).\n * @default 1000\n */\n radius?: number;\n\n /**\n * Function to aggregate data into hexagonal bins.\n * @default d3-hexbin\n */\n hexagonAggregator?: (props: any, params: any) => any;\n\n /**\n * Color scale input domain.\n * @default [min(colorWeight), max(colorWeight)]\n */\n colorDomain?: [number, number] | null;\n\n /**\n * Specified as an array of colors [color1, color2, ...].\n * @default `6-class YlOrRd` - [colorbrewer](http://colorbrewer2.org/#type=sequential&scheme=YlOrRd&n=6)\n */\n colorRange?: Color[];\n\n /**\n * Hexagon radius multiplier, clamped between 0 - 1.\n * @default 1\n */\n coverage?: number;\n\n /**\n * Elevation scale input domain. The elevation scale is a linear scale that maps number of counts to elevation.\n * @default [0, max(elevationWeight)]\n */\n elevationDomain?: [number, number] | null;\n\n /**\n * Elevation scale output range.\n * @default [0, 1000]\n */\n elevationRange?: [number, number];\n\n /**\n * Hexagon elevation multiplier.\n * @default 1\n */\n elevationScale?: number;\n\n /**\n * Whether to enable cell elevation. If set to false, all cell will be flat.\n * @default false\n */\n extruded?: boolean;\n\n /**\n * Filter bins and re-calculate color by `upperPercentile`.\n * Hexagons with color value larger than the `upperPercentile` will be hidden.\n * @default 100\n */\n upperPercentile?: number;\n\n /**\n * Filter bins and re-calculate color by `lowerPercentile`.\n * Hexagons with color value smaller than the `lowerPercentile` will be hidden.\n * @default 0\n */\n lowerPercentile?: number;\n\n /**\n * Filter bins and re-calculate elevation by `elevationUpperPercentile`.\n * Hexagons with elevation value larger than the `elevationUpperPercentile` will be hidden.\n * @default 100\n */\n elevationUpperPercentile?: number;\n\n /**\n * Filter bins and re-calculate elevation by `elevationLowerPercentile`.\n * Hexagons with elevation value larger than the `elevationLowerPercentile` will be hidden.\n * @default 0\n */\n elevationLowerPercentile?: number;\n\n /**\n * Scaling function used to determine the color of the grid cell, default value is 'quantize'.\n * Supported Values are 'quantize', 'quantile' and 'ordinal'.\n * @default 'quantize'\n */\n colorScaleType?: 'quantize' | 'quantile' | 'ordinal';\n\n /**\n * Scaling function used to determine the elevation of the grid cell, only supports 'linear'.\n */\n elevationScaleType?: 'linear';\n\n /**\n * Material settings for lighting effect. Applies if `extruded: true`.\n *\n * @default true\n * @see https://deck.gl/docs/developer-guide/using-lighting\n */\n material?: Material;\n\n /**\n * Defines the operation used to aggregate all data object weights to calculate a cell's color value.\n * @default 'SUM'\n */\n colorAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';\n\n /**\n * Defines the operation used to aggregate all data object weights to calculate a cell's elevation value.\n * @default 'SUM'\n */\n elevationAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';\n\n /**\n * Method called to retrieve the position of each object.\n * @default object => object.position\n */\n getPosition?: AccessorFunction<DataT, Position>;\n\n /**\n * The weight of a data object used to calculate the color value for a bin.\n * @default 1\n */\n getColorWeight?: Accessor<DataT, number>;\n\n /**\n * After data objects are aggregated into bins, this accessor is called on each cell to get the value that its color is based on.\n * @default null\n */\n getColorValue?: AggregateAccessor<DataT> | null;\n\n /**\n * The weight of a data object used to calculate the elevation value for a bin.\n * @default 1\n */\n getElevationWeight?: Accessor<DataT, number>;\n\n /**\n * After data objects are aggregated into bins, this accessor is called on each cell to get the value that its elevation is based on.\n * @default null\n */\n getElevationValue?: AggregateAccessor<DataT> | null;\n\n /**\n * This callback will be called when cell color domain has been calculated.\n * @default () => {}\n */\n onSetColorDomain?: (minMax: [number, number]) => void;\n\n /**\n * This callback will be called when cell elevation domain has been calculated.\n * @default () => {}\n */\n onSetElevationDomain?: (minMax: [number, number]) => void;\n\n /**\n * (Experimental) Filter data objects\n */\n _filterData: null | ((d: DataT) => boolean);\n};\n\n/** Aggregates data into a hexagon-based heatmap. The color and height of a hexagon are determined based on the objects it contains. */\nexport default class HexagonLayer<DataT, ExtraPropsT extends {} = {}> extends AggregationLayer<\n DataT,\n ExtraPropsT & Required<_HexagonLayerProps>\n> {\n static layerName = 'HexagonLayer';\n static defaultProps = defaultProps;\n\n state!: AggregationLayer<DataT>['state'] & {\n cpuAggregator: CPUAggregator;\n aggregatorState: any;\n };\n initializeState() {\n const cpuAggregator = new CPUAggregator({\n getAggregator: props => props.hexagonAggregator,\n getCellSize: props => props.radius\n });\n\n this.state = {\n cpuAggregator,\n aggregatorState: cpuAggregator.state,\n vertices: null\n };\n const attributeManager = this.getAttributeManager()!;\n attributeManager.add({\n positions: {size: 3, type: GL.DOUBLE, accessor: 'getPosition'}\n });\n // color and elevation attributes can't be added as attributes\n // they are calculated using 'getValue' accessor that takes an array of pints.\n }\n\n updateState(opts: UpdateParameters<this>) {\n super.updateState(opts);\n\n if (opts.changeFlags.propsOrDataChanged) {\n const aggregatorState = this.state.cpuAggregator.updateState(opts, {\n viewport: this.context.viewport,\n attributes: this.getAttributes()\n });\n if (this.state.aggregatorState.layerData !== aggregatorState.layerData) {\n // if user provided custom aggregator and returns hexagonVertices,\n // Need to recalculate radius and angle based on vertices\n const {hexagonVertices} = aggregatorState.layerData || {};\n this.setState({\n vertices: hexagonVertices && this.convertLatLngToMeterOffset(hexagonVertices)\n });\n }\n\n this.setState({\n // make a copy of the internal state of cpuAggregator for testing\n aggregatorState\n });\n }\n }\n\n convertLatLngToMeterOffset(hexagonVertices) {\n const {viewport} = this.context;\n if (Array.isArray(hexagonVertices) && hexagonVertices.length === 6) {\n // get centroid of hexagons\n const vertex0 = hexagonVertices[0];\n const vertex3 = hexagonVertices[3];\n\n const centroid = [(vertex0[0] + vertex3[0]) / 2, (vertex0[1] + vertex3[1]) / 2];\n const centroidFlat = viewport.projectFlat(centroid);\n\n const {metersPerUnit} = viewport.getDistanceScales(centroid);\n\n // offset all points by centroid to meter offset\n const vertices = hexagonVertices.map(vt => {\n const vtFlat = viewport.projectFlat(vt);\n\n return [\n (vtFlat[0] - centroidFlat[0]) * metersPerUnit[0],\n (vtFlat[1] - centroidFlat[1]) * metersPerUnit[1]\n ];\n });\n\n return vertices;\n }\n\n log.error('HexagonLayer: hexagonVertices needs to be an array of 6 points')();\n return null;\n }\n\n getPickingInfo({info}) {\n return this.state.cpuAggregator.getPickingInfo({info});\n }\n\n // create a method for testing\n _onGetSublayerColor(cell) {\n return this.state.cpuAggregator.getAccessor('fillColor')(cell);\n }\n\n // create a method for testing\n _onGetSublayerElevation(cell) {\n return this.state.cpuAggregator.getAccessor('elevation')(cell);\n }\n\n _getSublayerUpdateTriggers() {\n return this.state.cpuAggregator.getUpdateTriggers(this.props);\n }\n\n renderLayers() {\n const {elevationScale, extruded, coverage, material, transitions} = this.props;\n const {aggregatorState, vertices} = this.state;\n\n const SubLayerClass = this.getSubLayerClass('hexagon-cell', ColumnLayer);\n const updateTriggers = this._getSublayerUpdateTriggers();\n\n const geometry = vertices\n ? {vertices, radius: 1}\n : {\n // default geometry\n radius: aggregatorState.layerData.radiusCommon || 1,\n radiusUnits: 'common',\n angle: 90\n };\n return new SubLayerClass(\n {\n ...geometry,\n diskResolution: 6,\n elevationScale,\n extruded,\n coverage,\n material,\n\n getFillColor: this._onGetSublayerColor.bind(this),\n getElevation: this._onGetSublayerElevation.bind(this),\n transitions: transitions && {\n getFillColor: transitions.getColorValue || transitions.getColorWeight,\n getElevation: transitions.getElevationValue || transitions.getElevationWeight\n }\n },\n this.getSubLayerProps({\n id: 'hexagon-cell',\n updateTriggers\n }),\n {\n data: aggregatorState.layerData.data\n }\n );\n }\n}\n"],"file":"hexagon-layer.js"}
1
+ {"version":3,"sources":["../../../src/hexagon-layer/hexagon-layer.ts"],"names":["nop","defaultProps","colorDomain","colorRange","defaultColorRange","getColorValue","type","value","getColorWeight","colorAggregation","lowerPercentile","min","max","upperPercentile","colorScaleType","onSetColorDomain","elevationDomain","elevationRange","getElevationValue","getElevationWeight","elevationAggregation","elevationLowerPercentile","elevationUpperPercentile","elevationScale","elevationScaleType","onSetElevationDomain","radius","coverage","extruded","hexagonAggregator","pointToHexbin","getPosition","x","position","material","_filterData","optional","HexagonLayer","cpuAggregator","CPUAggregator","getAggregator","props","getCellSize","state","aggregatorState","vertices","attributeManager","getAttributeManager","add","positions","size","accessor","opts","changeFlags","propsOrDataChanged","updateState","viewport","context","attributes","getAttributes","layerData","hexagonVertices","setState","convertLatLngToMeterOffset","Array","isArray","length","vertex0","vertex3","centroid","centroidFlat","projectFlat","getDistanceScales","metersPerUnit","map","vt","vtFlat","log","error","info","getPickingInfo","cell","getAccessor","getUpdateTriggers","transitions","SubLayerClass","getSubLayerClass","ColumnLayer","updateTriggers","_getSublayerUpdateTriggers","geometry","radiusCommon","radiusUnits","angle","diskResolution","getFillColor","_onGetSublayerColor","bind","getElevation","_onGetSublayerElevation","getSubLayerProps","id","data","AggregationLayer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAoBA;;AAUA;;AAEA;;AAEA;;AACA;;AACA;;;;;;;;;;AAMA,SAASA,GAAT,GAAe,CAAE;;AAEjB,IAAMC,YAA6C,GAAG;AAEpDC,EAAAA,WAAW,EAAE,IAFuC;AAGpDC,EAAAA,UAAU,EAAEC,6BAHwC;AAIpDC,EAAAA,aAAa,EAAE;AAACC,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE;AAA1B,GAJqC;AAKpDC,EAAAA,cAAc,EAAE;AAACF,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE;AAA1B,GALoC;AAMpDE,EAAAA,gBAAgB,EAAE,KANkC;AAOpDC,EAAAA,eAAe,EAAE;AAACJ,IAAAA,IAAI,EAAE,QAAP;AAAiBC,IAAAA,KAAK,EAAE,CAAxB;AAA2BI,IAAAA,GAAG,EAAE,CAAhC;AAAmCC,IAAAA,GAAG,EAAE;AAAxC,GAPmC;AAQpDC,EAAAA,eAAe,EAAE;AAACP,IAAAA,IAAI,EAAE,QAAP;AAAiBC,IAAAA,KAAK,EAAE,GAAxB;AAA6BI,IAAAA,GAAG,EAA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,EAAdA;AAFoB,OAAtB,CAhBK,EAoBL;AACEc,QAAAA,IAAI,EAAE1D,eAAe,CAACgB,SAAhB,CAA0B0C;AADlC,OApBK,CAAP;AAwBD;;;EA5I2EC,yB;;;8BAAzDlE,Y,eAIA,c;8BAJAA,Y,kBAKGpC,Y","sourcesContent":["// Copyright (c) 2015 - 2017 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\nimport {\n Accessor,\n AccessorFunction,\n Color,\n log,\n Position,\n Material,\n UpdateParameters,\n DefaultProps\n} from '@deck.gl/core';\nimport {ColumnLayer} from '@deck.gl/layers';\n\nimport {defaultColorRange} from '../utils/color-utils';\n\nimport {pointToHexbin} from './hexagon-aggregator';\nimport CPUAggregator from '../utils/cpu-aggregator';\nimport AggregationLayer, {AggregationLayerProps} from '../aggregation-layer';\n\nimport GL from '@luma.gl/constants';\nimport {AggregateAccessor} from '../types';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nfunction nop() {}\n\nconst defaultProps: DefaultProps<HexagonLayerProps> = {\n // color\n colorDomain: null,\n colorRange: defaultColorRange,\n getColorValue: {type: 'accessor', value: null}, // default value is calcuated from `getColorWeight` and `colorAggregation`\n getColorWeight: {type: 'accessor', value: 1},\n colorAggregation: 'SUM',\n lowerPercentile: {type: 'number', value: 0, min: 0, max: 100},\n upperPercentile: {type: 'number', value: 100, min: 0, max: 100},\n colorScaleType: 'quantize',\n onSetColorDomain: nop,\n\n // elevation\n elevationDomain: null,\n elevationRange: [0, 1000],\n getElevationValue: {type: 'accessor', value: null}, // default value is calcuated from `getElevationWeight` and `elevationAggregation`\n getElevationWeight: {type: 'accessor', value: 1},\n elevationAggregation: 'SUM',\n elevationLowerPercentile: {type: 'number', value: 0, min: 0, max: 100},\n elevationUpperPercentile: {type: 'number', value: 100, min: 0, max: 100},\n elevationScale: {type: 'number', min: 0, value: 1},\n elevationScaleType: 'linear',\n onSetElevationDomain: nop,\n\n radius: {type: 'number', value: 1000, min: 1},\n coverage: {type: 'number', min: 0, max: 1, value: 1},\n extruded: false,\n hexagonAggregator: pointToHexbin,\n getPosition: {type: 'accessor', value: x => x.position},\n // Optional material for 'lighting' shader module\n material: true,\n\n // data filter\n _filterData: {type: 'function', value: null, optional: true}\n};\n\n/** All properties supported by by HexagonLayer. */\nexport type HexagonLayerProps<DataT = any> = _HexagonLayerProps<DataT> &\n AggregationLayerProps<DataT>;\n\n/** Properties added by HexagonLayer. */\ntype _HexagonLayerProps<DataT = any> = {\n /**\n * Radius of hexagon bin in meters. The hexagons are pointy-topped (rather than flat-topped).\n * @default 1000\n */\n radius?: number;\n\n /**\n * Function to aggregate data into hexagonal bins.\n * @default d3-hexbin\n */\n hexagonAggregator?: (props: any, params: any) => any;\n\n /**\n * Color scale input domain.\n * @default [min(colorWeight), max(colorWeight)]\n */\n colorDomain?: [number, number] | null;\n\n /**\n * Specified as an array of colors [color1, color2, ...].\n * @default `6-class YlOrRd` - [colorbrewer](http://colorbrewer2.org/#type=sequential&scheme=YlOrRd&n=6)\n */\n colorRange?: Color[];\n\n /**\n * Hexagon radius multiplier, clamped between 0 - 1.\n * @default 1\n */\n coverage?: number;\n\n /**\n * Elevation scale input domain. The elevation scale is a linear scale that maps number of counts to elevation.\n * @default [0, max(elevationWeight)]\n */\n elevationDomain?: [number, number] | null;\n\n /**\n * Elevation scale output range.\n * @default [0, 1000]\n */\n elevationRange?: [number, number];\n\n /**\n * Hexagon elevation multiplier.\n * @default 1\n */\n elevationScale?: number;\n\n /**\n * Whether to enable cell elevation. If set to false, all cell will be flat.\n * @default false\n */\n extruded?: boolean;\n\n /**\n * Filter bins and re-calculate color by `upperPercentile`.\n * Hexagons with color value larger than the `upperPercentile` will be hidden.\n * @default 100\n */\n upperPercentile?: number;\n\n /**\n * Filter bins and re-calculate color by `lowerPercentile`.\n * Hexagons with color value smaller than the `lowerPercentile` will be hidden.\n * @default 0\n */\n lowerPercentile?: number;\n\n /**\n * Filter bins and re-calculate elevation by `elevationUpperPercentile`.\n * Hexagons with elevation value larger than the `elevationUpperPercentile` will be hidden.\n * @default 100\n */\n elevationUpperPercentile?: number;\n\n /**\n * Filter bins and re-calculate elevation by `elevationLowerPercentile`.\n * Hexagons with elevation value larger than the `elevationLowerPercentile` will be hidden.\n * @default 0\n */\n elevationLowerPercentile?: number;\n\n /**\n * Scaling function used to determine the color of the grid cell, default value is 'quantize'.\n * Supported Values are 'quantize', 'quantile' and 'ordinal'.\n * @default 'quantize'\n */\n colorScaleType?: 'quantize' | 'quantile' | 'ordinal';\n\n /**\n * Scaling function used to determine the elevation of the grid cell, only supports 'linear'.\n */\n elevationScaleType?: 'linear';\n\n /**\n * Material settings for lighting effect. Applies if `extruded: true`.\n *\n * @default true\n * @see https://deck.gl/docs/developer-guide/using-lighting\n */\n material?: Material;\n\n /**\n * Defines the operation used to aggregate all data object weights to calculate a cell's color value.\n * @default 'SUM'\n */\n colorAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';\n\n /**\n * Defines the operation used to aggregate all data object weights to calculate a cell's elevation value.\n * @default 'SUM'\n */\n elevationAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';\n\n /**\n * Method called to retrieve the position of each object.\n * @default object => object.position\n */\n getPosition?: AccessorFunction<DataT, Position>;\n\n /**\n * The weight of a data object used to calculate the color value for a bin.\n * @default 1\n */\n getColorWeight?: Accessor<DataT, number>;\n\n /**\n * After data objects are aggregated into bins, this accessor is called on each cell to get the value that its color is based on.\n * @default null\n */\n getColorValue?: AggregateAccessor<DataT> | null;\n\n /**\n * The weight of a data object used to calculate the elevation value for a bin.\n * @default 1\n */\n getElevationWeight?: Accessor<DataT, number>;\n\n /**\n * After data objects are aggregated into bins, this accessor is called on each cell to get the value that its elevation is based on.\n * @default null\n */\n getElevationValue?: AggregateAccessor<DataT> | null;\n\n /**\n * This callback will be called when cell color domain has been calculated.\n * @default () => {}\n */\n onSetColorDomain?: (minMax: [number, number]) => void;\n\n /**\n * This callback will be called when cell elevation domain has been calculated.\n * @default () => {}\n */\n onSetElevationDomain?: (minMax: [number, number]) => void;\n\n /**\n * (Experimental) Filter data objects\n */\n _filterData: null | ((d: DataT) => boolean);\n};\n\n/** Aggregates data into a hexagon-based heatmap. The color and height of a hexagon are determined based on the objects it contains. */\nexport default class HexagonLayer<DataT, ExtraPropsT extends {} = {}> extends AggregationLayer<\n DataT,\n ExtraPropsT & Required<_HexagonLayerProps<DataT>>\n> {\n static layerName = 'HexagonLayer';\n static defaultProps = defaultProps;\n\n state!: AggregationLayer<DataT>['state'] & {\n cpuAggregator: CPUAggregator;\n aggregatorState: any;\n };\n initializeState() {\n const cpuAggregator = new CPUAggregator({\n getAggregator: props => props.hexagonAggregator,\n getCellSize: props => props.radius\n });\n\n this.state = {\n cpuAggregator,\n aggregatorState: cpuAggregator.state,\n vertices: null\n };\n const attributeManager = this.getAttributeManager()!;\n attributeManager.add({\n positions: {size: 3, type: GL.DOUBLE, accessor: 'getPosition'}\n });\n // color and elevation attributes can't be added as attributes\n // they are calculated using 'getValue' accessor that takes an array of pints.\n }\n\n updateState(opts: UpdateParameters<this>) {\n super.updateState(opts);\n\n if (opts.changeFlags.propsOrDataChanged) {\n const aggregatorState = this.state.cpuAggregator.updateState(opts, {\n viewport: this.context.viewport,\n attributes: this.getAttributes()\n });\n if (this.state.aggregatorState.layerData !== aggregatorState.layerData) {\n // if user provided custom aggregator and returns hexagonVertices,\n // Need to recalculate radius and angle based on vertices\n const {hexagonVertices} = aggregatorState.layerData || {};\n this.setState({\n vertices: hexagonVertices && this.convertLatLngToMeterOffset(hexagonVertices)\n });\n }\n\n this.setState({\n // make a copy of the internal state of cpuAggregator for testing\n aggregatorState\n });\n }\n }\n\n convertLatLngToMeterOffset(hexagonVertices) {\n const {viewport} = this.context;\n if (Array.isArray(hexagonVertices) && hexagonVertices.length === 6) {\n // get centroid of hexagons\n const vertex0 = hexagonVertices[0];\n const vertex3 = hexagonVertices[3];\n\n const centroid = [(vertex0[0] + vertex3[0]) / 2, (vertex0[1] + vertex3[1]) / 2];\n const centroidFlat = viewport.projectFlat(centroid);\n\n const {metersPerUnit} = viewport.getDistanceScales(centroid);\n\n // offset all points by centroid to meter offset\n const vertices = hexagonVertices.map(vt => {\n const vtFlat = viewport.projectFlat(vt);\n\n return [\n (vtFlat[0] - centroidFlat[0]) * metersPerUnit[0],\n (vtFlat[1] - centroidFlat[1]) * metersPerUnit[1]\n ];\n });\n\n return vertices;\n }\n\n log.error('HexagonLayer: hexagonVertices needs to be an array of 6 points')();\n return null;\n }\n\n getPickingInfo({info}) {\n return this.state.cpuAggregator.getPickingInfo({info});\n }\n\n // create a method for testing\n _onGetSublayerColor(cell) {\n return this.state.cpuAggregator.getAccessor('fillColor')(cell);\n }\n\n // create a method for testing\n _onGetSublayerElevation(cell) {\n return this.state.cpuAggregator.getAccessor('elevation')(cell);\n }\n\n _getSublayerUpdateTriggers() {\n return this.state.cpuAggregator.getUpdateTriggers(this.props);\n }\n\n renderLayers() {\n const {elevationScale, extruded, coverage, material, transitions} = this.props;\n const {aggregatorState, vertices} = this.state;\n\n const SubLayerClass = this.getSubLayerClass('hexagon-cell', ColumnLayer);\n const updateTriggers = this._getSublayerUpdateTriggers();\n\n const geometry = vertices\n ? {vertices, radius: 1}\n : {\n // default geometry\n radius: aggregatorState.layerData.radiusCommon || 1,\n radiusUnits: 'common',\n angle: 90\n };\n return new SubLayerClass(\n {\n ...geometry,\n diskResolution: 6,\n elevationScale,\n extruded,\n coverage,\n material,\n\n getFillColor: this._onGetSublayerColor.bind(this),\n getElevation: this._onGetSublayerElevation.bind(this),\n transitions: transitions && {\n getFillColor: transitions.getColorValue || transitions.getColorWeight,\n getElevation: transitions.getElevationValue || transitions.getElevationWeight\n }\n },\n this.getSubLayerProps({\n id: 'hexagon-cell',\n updateTriggers\n }),\n {\n data: aggregatorState.layerData.data\n }\n );\n }\n}\n"],"file":"hexagon-layer.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/hexagon-layer/hexagon-layer.ts"],"names":["log","ColumnLayer","defaultColorRange","pointToHexbin","CPUAggregator","AggregationLayer","nop","defaultProps","colorDomain","colorRange","getColorValue","type","value","getColorWeight","colorAggregation","lowerPercentile","min","max","upperPercentile","colorScaleType","onSetColorDomain","elevationDomain","elevationRange","getElevationValue","getElevationWeight","elevationAggregation","elevationLowerPercentile","elevationUpperPercentile","elevationScale","elevationScaleType","onSetElevationDomain","radius","coverage","extruded","hexagonAggregator","getPosition","x","position","material","_filterData","optional","HexagonLayer","initializeState","cpuAggregator","getAggregator","props","getCellSize","state","aggregatorState","vertices","attributeManager","getAttributeManager","add","positions","size","accessor","updateState","opts","changeFlags","propsOrDataChanged","viewport","context","attributes","getAttributes","layerData","hexagonVertices","setState","convertLatLngToMeterOffset","Array","isArray","length","vertex0","vertex3","centroid","centroidFlat","projectFlat","metersPerUnit","getDistanceScales","map","vt","vtFlat","error","getPickingInfo","info","_onGetSublayerColor","cell","getAccessor","_onGetSublayerElevation","_getSublayerUpdateTriggers","getUpdateTriggers","renderLayers","transitions","SubLayerClass","getSubLayerClass","updateTriggers","geometry","radiusCommon","radiusUnits","angle","diskResolution","getFillColor","bind","getElevation","getSubLayerProps","id","data"],"mappings":";AAoBA,SAIEA,GAJF,QASO,eATP;AAUA,SAAQC,WAAR,QAA0B,iBAA1B;AAEA,SAAQC,iBAAR,QAAgC,sBAAhC;AAEA,SAAQC,aAAR,QAA4B,sBAA5B;AACA,OAAOC,aAAP,MAA0B,yBAA1B;AACA,OAAOC,gBAAP,MAAsD,sBAAtD;;AAMA,SAASC,GAAT,GAAe,CAAE;;AAEjB,MAAMC,YAA6C,GAAG;AAEpDC,EAAAA,WAAW,EAAE,IAFuC;AAGpDC,EAAAA,UAAU,EAAEP,iBAHwC;AAIpDQ,EAAAA,aAAa,EAAE;AAACC,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE;AAA1B,GAJqC;AAKpDC,EAAAA,cAAc,EAAE;AAACF,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE;AAA1B,GALoC;AAMpDE,EAAAA,gBAAgB,EAAE,KANkC;AAOpDC,EAAAA,eAAe,EAAE;AAACJ,IAAAA,IAAI,EAAE,QAAP;AAAiBC,IAAAA,KAAK,EAAE,CAAxB;AAA2BI,IAAAA,GAAG,EAAE,CAAhC;AAAmCC,IAAAA,GAAG,EAAE;AAAxC,GAPmC;AAQpDC,EAAAA,eAAe,EAAE;AAACP,IAAAA,IAAI,EAAE,QAAP;AAAiBC,IAAAA,KAAK,EAAE,GAAxB;AAA6BI,IAAAA,GAAG,EAAE,CAAlC;AAAqCC,IAAAA,GAAG,EAAE;AAA1C,GARmC;AASpDE,EAAAA,cAAc,EAAE,UAToC;AAUpDC,EAAAA,gBAAgB,EAAEd,GAVkC;AAapDe,EAAAA,eAAe,EAAE,IAbmC;AAcpDC,EAAAA,cAAc,EAAE,CAAC,CAAD,EAAI,IAAJ,CAdoC;AAepDC,EAAAA,iBAAiB,EAAE;AAACZ,IA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G9C,QAAQ,GACrB;AAACA,MAAAA,QAAD;AAAWlB,MAAAA,MAAM,EAAE;AAAnB,KADqB,GAErB;AAEEA,MAAAA,MAAM,EAAEiB,eAAe,CAACgB,SAAhB,CAA0BgC,YAA1B,IAA0C,CAFpD;AAGEC,MAAAA,WAAW,EAAE,QAHf;AAIEC,MAAAA,KAAK,EAAE;AAJT,KAFJ;AAQA,WAAO,IAAIN,aAAJ,CACL,EACE,GAAGG,QADL;AAEEI,MAAAA,cAAc,EAAE,CAFlB;AAGEvE,MAAAA,cAHF;AAIEK,MAAAA,QAJF;AAKED,MAAAA,QALF;AAMEM,MAAAA,QANF;AAQE8D,MAAAA,YAAY,EAAE,KAAKhB,mBAAL,CAAyBiB,IAAzB,CAA8B,IAA9B,CARhB;AASEC,MAAAA,YAAY,EAAE,KAAKf,uBAAL,CAA6Bc,IAA7B,CAAkC,IAAlC,CAThB;AAUEV,MAAAA,WAAW,EAAEA,WAAW,IAAI;AAC1BS,QAAAA,YAAY,EAAET,WAAW,CAACjF,aAAZ,IAA6BiF,WAAW,CAAC9E,cAD7B;AAE1ByF,QAAAA,YAAY,EAAEX,WAAW,CAACpE,iBAAZ,IAAiCoE,WAAW,CAACnE;AAFjC;AAV9B,KADK,EAgBL,KAAK+E,gBAAL,CAAsB;AACpBC,MAAAA,EAAE,EAAE,cADgB;AAEpBV,MAAAA;AAFoB,KAAtB,CAhBK,EAoBL;AACEW,MAAAA,IAAI,EAAEzD,eAAe,CAACgB,SAAhB,CAA0ByC;AADlC,KApBK,CAAP;AAwBD;;AAzID;;gBAHmBhE,Y,eAIA,c;;gBAJAA,Y,kBAKGlC,Y","sourcesContent":["// Copyright (c) 2015 - 2017 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\nimport {\n Accessor,\n AccessorFunction,\n Color,\n log,\n Position,\n Material,\n UpdateParameters,\n DefaultProps\n} from '@deck.gl/core';\nimport {ColumnLayer} from '@deck.gl/layers';\n\nimport {defaultColorRange} from '../utils/color-utils';\n\nimport {pointToHexbin} from './hexagon-aggregator';\nimport CPUAggregator from '../utils/cpu-aggregator';\nimport AggregationLayer, {AggregationLayerProps} from '../aggregation-layer';\n\nimport GL from '@luma.gl/constants';\nimport {AggregateAccessor} from '../types';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nfunction nop() {}\n\nconst defaultProps: DefaultProps<HexagonLayerProps> = {\n // color\n colorDomain: null,\n colorRange: defaultColorRange,\n getColorValue: {type: 'accessor', value: null}, // default value is calcuated from `getColorWeight` and `colorAggregation`\n getColorWeight: {type: 'accessor', value: 1},\n colorAggregation: 'SUM',\n lowerPercentile: {type: 'number', value: 0, min: 0, max: 100},\n upperPercentile: {type: 'number', value: 100, min: 0, max: 100},\n colorScaleType: 'quantize',\n onSetColorDomain: nop,\n\n // elevation\n elevationDomain: null,\n elevationRange: [0, 1000],\n getElevationValue: {type: 'accessor', value: null}, // default value is calcuated from `getElevationWeight` and `elevationAggregation`\n getElevationWeight: {type: 'accessor', value: 1},\n elevationAggregation: 'SUM',\n elevationLowerPercentile: {type: 'number', value: 0, min: 0, max: 100},\n elevationUpperPercentile: {type: 'number', value: 100, min: 0, max: 100},\n elevationScale: {type: 'number', min: 0, value: 1},\n elevationScaleType: 'linear',\n onSetElevationDomain: nop,\n\n radius: {type: 'number', value: 1000, min: 1},\n coverage: {type: 'number', min: 0, max: 1, value: 1},\n extruded: false,\n hexagonAggregator: pointToHexbin,\n getPosition: {type: 'accessor', value: x => x.position},\n // Optional material for 'lighting' shader module\n material: true,\n\n // data filter\n _filterData: {type: 'function', value: null, optional: true}\n};\n\n/** All properties supported by by HexagonLayer. */\nexport type HexagonLayerProps<DataT = any> = _HexagonLayerProps<DataT> &\n AggregationLayerProps<DataT>;\n\n/** Properties added by HexagonLayer. */\ntype _HexagonLayerProps<DataT = any> = {\n /**\n * Radius of hexagon bin in meters. The hexagons are pointy-topped (rather than flat-topped).\n * @default 1000\n */\n radius?: number;\n\n /**\n * Function to aggregate data into hexagonal bins.\n * @default d3-hexbin\n */\n hexagonAggregator?: (props: any, params: any) => any;\n\n /**\n * Color scale input domain.\n * @default [min(colorWeight), max(colorWeight)]\n */\n colorDomain?: [number, number] | null;\n\n /**\n * Specified as an array of colors [color1, color2, ...].\n * @default `6-class YlOrRd` - [colorbrewer](http://colorbrewer2.org/#type=sequential&scheme=YlOrRd&n=6)\n */\n colorRange?: Color[];\n\n /**\n * Hexagon radius multiplier, clamped between 0 - 1.\n * @default 1\n */\n coverage?: number;\n\n /**\n * Elevation scale input domain. The elevation scale is a linear scale that maps number of counts to elevation.\n * @default [0, max(elevationWeight)]\n */\n elevationDomain?: [number, number] | null;\n\n /**\n * Elevation scale output range.\n * @default [0, 1000]\n */\n elevationRange?: [number, number];\n\n /**\n * Hexagon elevation multiplier.\n * @default 1\n */\n elevationScale?: number;\n\n /**\n * Whether to enable cell elevation. If set to false, all cell will be flat.\n * @default false\n */\n extruded?: boolean;\n\n /**\n * Filter bins and re-calculate color by `upperPercentile`.\n * Hexagons with color value larger than the `upperPercentile` will be hidden.\n * @default 100\n */\n upperPercentile?: number;\n\n /**\n * Filter bins and re-calculate color by `lowerPercentile`.\n * Hexagons with color value smaller than the `lowerPercentile` will be hidden.\n * @default 0\n */\n lowerPercentile?: number;\n\n /**\n * Filter bins and re-calculate elevation by `elevationUpperPercentile`.\n * Hexagons with elevation value larger than the `elevationUpperPercentile` will be hidden.\n * @default 100\n */\n elevationUpperPercentile?: number;\n\n /**\n * Filter bins and re-calculate elevation by `elevationLowerPercentile`.\n * Hexagons with elevation value larger than the `elevationLowerPercentile` will be hidden.\n * @default 0\n */\n elevationLowerPercentile?: number;\n\n /**\n * Scaling function used to determine the color of the grid cell, default value is 'quantize'.\n * Supported Values are 'quantize', 'quantile' and 'ordinal'.\n * @default 'quantize'\n */\n colorScaleType?: 'quantize' | 'quantile' | 'ordinal';\n\n /**\n * Scaling function used to determine the elevation of the grid cell, only supports 'linear'.\n */\n elevationScaleType?: 'linear';\n\n /**\n * Material settings for lighting effect. Applies if `extruded: true`.\n *\n * @default true\n * @see https://deck.gl/docs/developer-guide/using-lighting\n */\n material?: Material;\n\n /**\n * Defines the operation used to aggregate all data object weights to calculate a cell's color value.\n * @default 'SUM'\n */\n colorAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';\n\n /**\n * Defines the operation used to aggregate all data object weights to calculate a cell's elevation value.\n * @default 'SUM'\n */\n elevationAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';\n\n /**\n * Method called to retrieve the position of each object.\n * @default object => object.position\n */\n getPosition?: AccessorFunction<DataT, Position>;\n\n /**\n * The weight of a data object used to calculate the color value for a bin.\n * @default 1\n */\n getColorWeight?: Accessor<DataT, number>;\n\n /**\n * After data objects are aggregated into bins, this accessor is called on each cell to get the value that its color is based on.\n * @default null\n */\n getColorValue?: AggregateAccessor<DataT> | null;\n\n /**\n * The weight of a data object used to calculate the elevation value for a bin.\n * @default 1\n */\n getElevationWeight?: Accessor<DataT, number>;\n\n /**\n * After data objects are aggregated into bins, this accessor is called on each cell to get the value that its elevation is based on.\n * @default null\n */\n getElevationValue?: AggregateAccessor<DataT> | null;\n\n /**\n * This callback will be called when cell color domain has been calculated.\n * @default () => {}\n */\n onSetColorDomain?: (minMax: [number, number]) => void;\n\n /**\n * This callback will be called when cell elevation domain has been calculated.\n * @default () => {}\n */\n onSetElevationDomain?: (minMax: [number, number]) => void;\n\n /**\n * (Experimental) Filter data objects\n */\n _filterData: null | ((d: DataT) => boolean);\n};\n\n/** Aggregates data into a hexagon-based heatmap. The color and height of a hexagon are determined based on the objects it contains. */\nexport default class HexagonLayer<DataT, ExtraPropsT extends {} = {}> extends AggregationLayer<\n DataT,\n ExtraPropsT & Required<_HexagonLayerProps>\n> {\n static layerName = 'HexagonLayer';\n static defaultProps = defaultProps;\n\n state!: AggregationLayer<DataT>['state'] & {\n cpuAggregator: CPUAggregator;\n aggregatorState: any;\n };\n initializeState() {\n const cpuAggregator = new CPUAggregator({\n getAggregator: props => props.hexagonAggregator,\n getCellSize: props => props.radius\n });\n\n this.state = {\n cpuAggregator,\n aggregatorState: cpuAggregator.state,\n vertices: null\n };\n const attributeManager = this.getAttributeManager()!;\n attributeManager.add({\n positions: {size: 3, type: GL.DOUBLE, accessor: 'getPosition'}\n });\n // color and elevation attributes can't be added as attributes\n // they are calculated using 'getValue' accessor that takes an array of pints.\n }\n\n updateState(opts: UpdateParameters<this>) {\n super.updateState(opts);\n\n if (opts.changeFlags.propsOrDataChanged) {\n const aggregatorState = this.state.cpuAggregator.updateState(opts, {\n viewport: this.context.viewport,\n attributes: this.getAttributes()\n });\n if (this.state.aggregatorState.layerData !== aggregatorState.layerData) {\n // if user provided custom aggregator and returns hexagonVertices,\n // Need to recalculate radius and angle based on vertices\n const {hexagonVertices} = aggregatorState.layerData || {};\n this.setState({\n vertices: hexagonVertices && this.convertLatLngToMeterOffset(hexagonVertices)\n });\n }\n\n this.setState({\n // make a copy of the internal state of cpuAggregator for testing\n aggregatorState\n });\n }\n }\n\n convertLatLngToMeterOffset(hexagonVertices) {\n const {viewport} = this.context;\n if (Array.isArray(hexagonVertices) && hexagonVertices.length === 6) {\n // get centroid of hexagons\n const vertex0 = hexagonVertices[0];\n const vertex3 = hexagonVertices[3];\n\n const centroid = [(vertex0[0] + vertex3[0]) / 2, (vertex0[1] + vertex3[1]) / 2];\n const centroidFlat = viewport.projectFlat(centroid);\n\n const {metersPerUnit} = viewport.getDistanceScales(centroid);\n\n // offset all points by centroid to meter offset\n const vertices = hexagonVertices.map(vt => {\n const vtFlat = viewport.projectFlat(vt);\n\n return [\n (vtFlat[0] - centroidFlat[0]) * metersPerUnit[0],\n (vtFlat[1] - centroidFlat[1]) * metersPerUnit[1]\n ];\n });\n\n return vertices;\n }\n\n log.error('HexagonLayer: hexagonVertices needs to be an array of 6 points')();\n return null;\n }\n\n getPickingInfo({info}) {\n return this.state.cpuAggregator.getPickingInfo({info});\n }\n\n // create a method for testing\n _onGetSublayerColor(cell) {\n return this.state.cpuAggregator.getAccessor('fillColor')(cell);\n }\n\n // create a method for testing\n _onGetSublayerElevation(cell) {\n return this.state.cpuAggregator.getAccessor('elevation')(cell);\n }\n\n _getSublayerUpdateTriggers() {\n return this.state.cpuAggregator.getUpdateTriggers(this.props);\n }\n\n renderLayers() {\n const {elevationScale, extruded, coverage, material, transitions} = this.props;\n const {aggregatorState, vertices} = this.state;\n\n const SubLayerClass = this.getSubLayerClass('hexagon-cell', ColumnLayer);\n const updateTriggers = this._getSublayerUpdateTriggers();\n\n const geometry = vertices\n ? {vertices, radius: 1}\n : {\n // default geometry\n radius: aggregatorState.layerData.radiusCommon || 1,\n radiusUnits: 'common',\n angle: 90\n };\n return new SubLayerClass(\n {\n ...geometry,\n diskResolution: 6,\n elevationScale,\n extruded,\n coverage,\n material,\n\n getFillColor: this._onGetSublayerColor.bind(this),\n getElevation: this._onGetSublayerElevation.bind(this),\n transitions: transitions && {\n getFillColor: transitions.getColorValue || transitions.getColorWeight,\n getElevation: transitions.getElevationValue || transitions.getElevationWeight\n }\n },\n this.getSubLayerProps({\n id: 'hexagon-cell',\n updateTriggers\n }),\n {\n data: aggregatorState.layerData.data\n }\n );\n }\n}\n"],"file":"hexagon-layer.js"}
1
+ {"version":3,"sources":["../../../src/hexagon-layer/hexagon-layer.ts"],"names":["log","ColumnLayer","defaultColorRange","pointToHexbin","CPUAggregator","AggregationLayer","nop","defaultProps","colorDomain","colorRange","getColorValue","type","value","getColorWeight","colorAggregation","lowerPercentile","min","max","upperPercentile","colorScaleType","onSetColorDomain","elevationDomain","elevationRange","getElevationValue","getElevationWeight","elevationAggregation","elevationLowerPercentile","elevationUpperPercentile","elevationScale","elevationScaleType","onSetElevationDomain","radius","coverage","extruded","hexagonAggregator","getPosition","x","position","material","_filterData","optional","HexagonLayer","initializeState","cpuAggregator","getAggregator","props","getCellSize","state","aggregatorState","vertices","attributeManager","getAttributeManager","add","positions","size","accessor","updateState","opts","changeFlags","propsOrDataChanged","viewport","context","attributes","getAttributes","layerData","hexagonVertices","setState","convertLatLngToMeterOffset","Array","isArray","length","vertex0","vertex3","centroid","centroidFlat","projectFlat","metersPerUnit","getDistanceScales","map","vt","vtFlat","error","getPickingInfo","info","_onGetSublayerColor","cell","getAccessor","_onGetSublayerElevation","_getSublayerUpdateTriggers","getUpdateTriggers","renderLayers","transitions","SubLayerClass","getSubLayerClass","updateTriggers","geometry","radiusCommon","radiusUnits","angle","diskResolution","getFillColor","bind","getElevation","getSubLayerProps","id","data"],"mappings":";AAoBA,SAIEA,GAJF,QASO,eATP;AAUA,SAAQC,WAAR,QAA0B,iBAA1B;AAEA,SAAQC,iBAAR,QAAgC,sBAAhC;AAEA,SAAQC,aAAR,QAA4B,sBAA5B;AACA,OAAOC,aAAP,MAA0B,yBAA1B;AACA,OAAOC,gBAAP,MAAsD,sBAAtD;;AAMA,SAASC,GAAT,GAAe,CAAE;;AAEjB,MAAMC,YAA6C,GAAG;AAEpDC,EAAAA,WAAW,EAAE,IAFuC;AAGpDC,E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AAE,KAAKhB,mBAAL,CAAyBiB,IAAzB,CAA8B,IAA9B,CARhB;AASEC,MAAAA,YAAY,EAAE,KAAKf,uBAAL,CAA6Bc,IAA7B,CAAkC,IAAlC,CAThB;AAUEV,MAAAA,WAAW,EAAEA,WAAW,IAAI;AAC1BS,QAAAA,YAAY,EAAET,WAAW,CAACjF,aAAZ,IAA6BiF,WAAW,CAAC9E,cAD7B;AAE1ByF,QAAAA,YAAY,EAAEX,WAAW,CAACpE,iBAAZ,IAAiCoE,WAAW,CAACnE;AAFjC;AAV9B,KADK,EAgBL,KAAK+E,gBAAL,CAAsB;AACpBC,MAAAA,EAAE,EAAE,cADgB;AAEpBV,MAAAA;AAFoB,KAAtB,CAhBK,EAoBL;AACEW,MAAAA,IAAI,EAAEzD,eAAe,CAACgB,SAAhB,CAA0ByC;AADlC,KApBK,CAAP;AAwBD;;AAzID;;gBAHmBhE,Y,eAIA,c;;gBAJAA,Y,kBAKGlC,Y","sourcesContent":["// Copyright (c) 2015 - 2017 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\nimport {\n Accessor,\n AccessorFunction,\n Color,\n log,\n Position,\n Material,\n UpdateParameters,\n DefaultProps\n} from '@deck.gl/core';\nimport {ColumnLayer} from '@deck.gl/layers';\n\nimport {defaultColorRange} from '../utils/color-utils';\n\nimport {pointToHexbin} from './hexagon-aggregator';\nimport CPUAggregator from '../utils/cpu-aggregator';\nimport AggregationLayer, {AggregationLayerProps} from '../aggregation-layer';\n\nimport GL from '@luma.gl/constants';\nimport {AggregateAccessor} from '../types';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nfunction nop() {}\n\nconst defaultProps: DefaultProps<HexagonLayerProps> = {\n // color\n colorDomain: null,\n colorRange: defaultColorRange,\n getColorValue: {type: 'accessor', value: null}, // default value is calcuated from `getColorWeight` and `colorAggregation`\n getColorWeight: {type: 'accessor', value: 1},\n colorAggregation: 'SUM',\n lowerPercentile: {type: 'number', value: 0, min: 0, max: 100},\n upperPercentile: {type: 'number', value: 100, min: 0, max: 100},\n colorScaleType: 'quantize',\n onSetColorDomain: nop,\n\n // elevation\n elevationDomain: null,\n elevationRange: [0, 1000],\n getElevationValue: {type: 'accessor', value: null}, // default value is calcuated from `getElevationWeight` and `elevationAggregation`\n getElevationWeight: {type: 'accessor', value: 1},\n elevationAggregation: 'SUM',\n elevationLowerPercentile: {type: 'number', value: 0, min: 0, max: 100},\n elevationUpperPercentile: {type: 'number', value: 100, min: 0, max: 100},\n elevationScale: {type: 'number', min: 0, value: 1},\n elevationScaleType: 'linear',\n onSetElevationDomain: nop,\n\n radius: {type: 'number', value: 1000, min: 1},\n coverage: {type: 'number', min: 0, max: 1, value: 1},\n extruded: false,\n hexagonAggregator: pointToHexbin,\n getPosition: {type: 'accessor', value: x => x.position},\n // Optional material for 'lighting' shader module\n material: true,\n\n // data filter\n _filterData: {type: 'function', value: null, optional: true}\n};\n\n/** All properties supported by by HexagonLayer. */\nexport type HexagonLayerProps<DataT = any> = _HexagonLayerProps<DataT> &\n AggregationLayerProps<DataT>;\n\n/** Properties added by HexagonLayer. */\ntype _HexagonLayerProps<DataT = any> = {\n /**\n * Radius of hexagon bin in meters. The hexagons are pointy-topped (rather than flat-topped).\n * @default 1000\n */\n radius?: number;\n\n /**\n * Function to aggregate data into hexagonal bins.\n * @default d3-hexbin\n */\n hexagonAggregator?: (props: any, params: any) => any;\n\n /**\n * Color scale input domain.\n * @default [min(colorWeight), max(colorWeight)]\n */\n colorDomain?: [number, number] | null;\n\n /**\n * Specified as an array of colors [color1, color2, ...].\n * @default `6-class YlOrRd` - [colorbrewer](http://colorbrewer2.org/#type=sequential&scheme=YlOrRd&n=6)\n */\n colorRange?: Color[];\n\n /**\n * Hexagon radius multiplier, clamped between 0 - 1.\n * @default 1\n */\n coverage?: number;\n\n /**\n * Elevation scale input domain. The elevation scale is a linear scale that maps number of counts to elevation.\n * @default [0, max(elevationWeight)]\n */\n elevationDomain?: [number, number] | null;\n\n /**\n * Elevation scale output range.\n * @default [0, 1000]\n */\n elevationRange?: [number, number];\n\n /**\n * Hexagon elevation multiplier.\n * @default 1\n */\n elevationScale?: number;\n\n /**\n * Whether to enable cell elevation. If set to false, all cell will be flat.\n * @default false\n */\n extruded?: boolean;\n\n /**\n * Filter bins and re-calculate color by `upperPercentile`.\n * Hexagons with color value larger than the `upperPercentile` will be hidden.\n * @default 100\n */\n upperPercentile?: number;\n\n /**\n * Filter bins and re-calculate color by `lowerPercentile`.\n * Hexagons with color value smaller than the `lowerPercentile` will be hidden.\n * @default 0\n */\n lowerPercentile?: number;\n\n /**\n * Filter bins and re-calculate elevation by `elevationUpperPercentile`.\n * Hexagons with elevation value larger than the `elevationUpperPercentile` will be hidden.\n * @default 100\n */\n elevationUpperPercentile?: number;\n\n /**\n * Filter bins and re-calculate elevation by `elevationLowerPercentile`.\n * Hexagons with elevation value larger than the `elevationLowerPercentile` will be hidden.\n * @default 0\n */\n elevationLowerPercentile?: number;\n\n /**\n * Scaling function used to determine the color of the grid cell, default value is 'quantize'.\n * Supported Values are 'quantize', 'quantile' and 'ordinal'.\n * @default 'quantize'\n */\n colorScaleType?: 'quantize' | 'quantile' | 'ordinal';\n\n /**\n * Scaling function used to determine the elevation of the grid cell, only supports 'linear'.\n */\n elevationScaleType?: 'linear';\n\n /**\n * Material settings for lighting effect. Applies if `extruded: true`.\n *\n * @default true\n * @see https://deck.gl/docs/developer-guide/using-lighting\n */\n material?: Material;\n\n /**\n * Defines the operation used to aggregate all data object weights to calculate a cell's color value.\n * @default 'SUM'\n */\n colorAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';\n\n /**\n * Defines the operation used to aggregate all data object weights to calculate a cell's elevation value.\n * @default 'SUM'\n */\n elevationAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';\n\n /**\n * Method called to retrieve the position of each object.\n * @default object => object.position\n */\n getPosition?: AccessorFunction<DataT, Position>;\n\n /**\n * The weight of a data object used to calculate the color value for a bin.\n * @default 1\n */\n getColorWeight?: Accessor<DataT, number>;\n\n /**\n * After data objects are aggregated into bins, this accessor is called on each cell to get the value that its color is based on.\n * @default null\n */\n getColorValue?: AggregateAccessor<DataT> | null;\n\n /**\n * The weight of a data object used to calculate the elevation value for a bin.\n * @default 1\n */\n getElevationWeight?: Accessor<DataT, number>;\n\n /**\n * After data objects are aggregated into bins, this accessor is called on each cell to get the value that its elevation is based on.\n * @default null\n */\n getElevationValue?: AggregateAccessor<DataT> | null;\n\n /**\n * This callback will be called when cell color domain has been calculated.\n * @default () => {}\n */\n onSetColorDomain?: (minMax: [number, number]) => void;\n\n /**\n * This callback will be called when cell elevation domain has been calculated.\n * @default () => {}\n */\n onSetElevationDomain?: (minMax: [number, number]) => void;\n\n /**\n * (Experimental) Filter data objects\n */\n _filterData: null | ((d: DataT) => boolean);\n};\n\n/** Aggregates data into a hexagon-based heatmap. The color and height of a hexagon are determined based on the objects it contains. */\nexport default class HexagonLayer<DataT, ExtraPropsT extends {} = {}> extends AggregationLayer<\n DataT,\n ExtraPropsT & Required<_HexagonLayerProps<DataT>>\n> {\n static layerName = 'HexagonLayer';\n static defaultProps = defaultProps;\n\n state!: AggregationLayer<DataT>['state'] & {\n cpuAggregator: CPUAggregator;\n aggregatorState: any;\n };\n initializeState() {\n const cpuAggregator = new CPUAggregator({\n getAggregator: props => props.hexagonAggregator,\n getCellSize: props => props.radius\n });\n\n this.state = {\n cpuAggregator,\n aggregatorState: cpuAggregator.state,\n vertices: null\n };\n const attributeManager = this.getAttributeManager()!;\n attributeManager.add({\n positions: {size: 3, type: GL.DOUBLE, accessor: 'getPosition'}\n });\n // color and elevation attributes can't be added as attributes\n // they are calculated using 'getValue' accessor that takes an array of pints.\n }\n\n updateState(opts: UpdateParameters<this>) {\n super.updateState(opts);\n\n if (opts.changeFlags.propsOrDataChanged) {\n const aggregatorState = this.state.cpuAggregator.updateState(opts, {\n viewport: this.context.viewport,\n attributes: this.getAttributes()\n });\n if (this.state.aggregatorState.layerData !== aggregatorState.layerData) {\n // if user provided custom aggregator and returns hexagonVertices,\n // Need to recalculate radius and angle based on vertices\n const {hexagonVertices} = aggregatorState.layerData || {};\n this.setState({\n vertices: hexagonVertices && this.convertLatLngToMeterOffset(hexagonVertices)\n });\n }\n\n this.setState({\n // make a copy of the internal state of cpuAggregator for testing\n aggregatorState\n });\n }\n }\n\n convertLatLngToMeterOffset(hexagonVertices) {\n const {viewport} = this.context;\n if (Array.isArray(hexagonVertices) && hexagonVertices.length === 6) {\n // get centroid of hexagons\n const vertex0 = hexagonVertices[0];\n const vertex3 = hexagonVertices[3];\n\n const centroid = [(vertex0[0] + vertex3[0]) / 2, (vertex0[1] + vertex3[1]) / 2];\n const centroidFlat = viewport.projectFlat(centroid);\n\n const {metersPerUnit} = viewport.getDistanceScales(centroid);\n\n // offset all points by centroid to meter offset\n const vertices = hexagonVertices.map(vt => {\n const vtFlat = viewport.projectFlat(vt);\n\n return [\n (vtFlat[0] - centroidFlat[0]) * metersPerUnit[0],\n (vtFlat[1] - centroidFlat[1]) * metersPerUnit[1]\n ];\n });\n\n return vertices;\n }\n\n log.error('HexagonLayer: hexagonVertices needs to be an array of 6 points')();\n return null;\n }\n\n getPickingInfo({info}) {\n return this.state.cpuAggregator.getPickingInfo({info});\n }\n\n // create a method for testing\n _onGetSublayerColor(cell) {\n return this.state.cpuAggregator.getAccessor('fillColor')(cell);\n }\n\n // create a method for testing\n _onGetSublayerElevation(cell) {\n return this.state.cpuAggregator.getAccessor('elevation')(cell);\n }\n\n _getSublayerUpdateTriggers() {\n return this.state.cpuAggregator.getUpdateTriggers(this.props);\n }\n\n renderLayers() {\n const {elevationScale, extruded, coverage, material, transitions} = this.props;\n const {aggregatorState, vertices} = this.state;\n\n const SubLayerClass = this.getSubLayerClass('hexagon-cell', ColumnLayer);\n const updateTriggers = this._getSublayerUpdateTriggers();\n\n const geometry = vertices\n ? {vertices, radius: 1}\n : {\n // default geometry\n radius: aggregatorState.layerData.radiusCommon || 1,\n radiusUnits: 'common',\n angle: 90\n };\n return new SubLayerClass(\n {\n ...geometry,\n diskResolution: 6,\n elevationScale,\n extruded,\n coverage,\n material,\n\n getFillColor: this._onGetSublayerColor.bind(this),\n getElevation: this._onGetSublayerElevation.bind(this),\n transitions: transitions && {\n getFillColor: transitions.getColorValue || transitions.getColorWeight,\n getElevation: transitions.getElevationValue || transitions.getElevationWeight\n }\n },\n this.getSubLayerProps({\n id: 'hexagon-cell',\n updateTriggers\n }),\n {\n data: aggregatorState.layerData.data\n }\n );\n }\n}\n"],"file":"hexagon-layer.js"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@deck.gl/aggregation-layers",
3
3
  "description": "deck.gl layers that aggregate the input data into alternative representations",
4
4
  "license": "MIT",
5
- "version": "8.9.33",
5
+ "version": "8.9.35",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
@@ -41,5 +41,5 @@
41
41
  "@deck.gl/layers": "^8.0.0",
42
42
  "@luma.gl/core": "^8.0.0"
43
43
  },
44
- "gitHead": "20c3e14cb5b0b2021125f2cf9056e57466d473eb"
44
+ "gitHead": "e66c6a70455762cf1c3d7347a739d2bd661d2977"
45
45
  }
@@ -249,7 +249,7 @@ type _HexagonLayerProps<DataT = any> = {
249
249
  /** Aggregates data into a hexagon-based heatmap. The color and height of a hexagon are determined based on the objects it contains. */
250
250
  export default class HexagonLayer<DataT, ExtraPropsT extends {} = {}> extends AggregationLayer<
251
251
  DataT,
252
- ExtraPropsT & Required<_HexagonLayerProps>
252
+ ExtraPropsT & Required<_HexagonLayerProps<DataT>>
253
253
  > {
254
254
  static layerName = 'HexagonLayer';
255
255
  static defaultProps = defaultProps;
@@ -144,7 +144,7 @@ declare type _HexagonLayerProps<DataT = any> = {
144
144
  _filterData: null | ((d: DataT) => boolean);
145
145
  };
146
146
  /** Aggregates data into a hexagon-based heatmap. The color and height of a hexagon are determined based on the objects it contains. */
147
- export default class HexagonLayer<DataT, ExtraPropsT extends {} = {}> extends AggregationLayer<DataT, ExtraPropsT & Required<_HexagonLayerProps>> {
147
+ export default class HexagonLayer<DataT, ExtraPropsT extends {} = {}> extends AggregationLayer<DataT, ExtraPropsT & Required<_HexagonLayerProps<DataT>>> {
148
148
  static layerName: string;
149
149
  static defaultProps: DefaultProps<HexagonLayerProps<any>>;
150
150
  state: AggregationLayer<DataT>['state'] & {
@@ -1 +1 @@
1
- {"version":3,"file":"hexagon-layer.d.ts","sourceRoot":"","sources":["../../src/hexagon-layer/hexagon-layer.ts"],"names":[],"mappings":"AAoBA,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,KAAK,EAEL,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAK5C,OAAO,aAAa,MAAM,yBAAyB,CAAC;AACpD,OAAO,gBAAgB,EAAE,EAAC,qBAAqB,EAAC,MAAM,sBAAsB,CAAC;AAG7E,OAAO,EAAC,iB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