From f6847e15d644c84448dcb49ce3dc63f3ee0819fb Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Wed, 27 Feb 2019 15:33:38 +0800 Subject: [PATCH 1/2] feat(hexagon): hexagon heatmap --- .torch.compile.opts.js | 3 +- demos/hexgon.html | 76 ++++++++++++++++++++++++ package.json | 4 +- src/core/three.js | 2 +- src/geom/buffer/heatmap/hexagon.js | 32 ++++++++++ src/geom/material/hexagon.js | 31 ++++++++++ src/geom/shader/hexagon_frag.glsl | 8 +++ src/geom/shader/hexagon_vert.glsl | 17 ++++++ src/geom/shader/point_vert.glsl | 1 - src/geom/shader/polygon_vert.glsl | 1 - src/layer/heatmap.js | 27 +++++++++ src/layer/render/heatmap/hexagon.js | 21 +++++++ src/source/index.js | 2 + src/source/transform/grid.js | 2 +- src/source/transform/hexagon.js | 5 +- test/unit/geom/buffer/heatmap/hexagon.js | 35 +++++++++++ test/unit/shader-module/base-spec.js | 3 +- test/unit/source/transfrom/hexagon.js | 1 - webpack.config.js | 3 +- 19 files changed, 260 insertions(+), 14 deletions(-) create mode 100644 demos/hexgon.html create mode 100644 src/geom/buffer/heatmap/hexagon.js create mode 100644 src/geom/material/hexagon.js create mode 100644 src/geom/shader/hexagon_frag.glsl create mode 100644 src/geom/shader/hexagon_vert.glsl create mode 100644 src/layer/render/heatmap/hexagon.js create mode 100644 test/unit/geom/buffer/heatmap/hexagon.js diff --git a/.torch.compile.opts.js b/.torch.compile.opts.js index c2e828ddc9..cea3ac8770 100755 --- a/.torch.compile.opts.js +++ b/.torch.compile.opts.js @@ -1,5 +1,4 @@ const path = require('path'); - module.exports = { babelrc: { presets: [ @@ -10,7 +9,7 @@ module.exports = { include: [ 'src/**/*.js', 'test/**/*.js', - 'node_modules/three/**/*.js', + 'node_modules/_three@0.96.0@three/**/*.js', 'node_modules/simple-statistics/src/*.js' ], exclude: [ diff --git a/demos/hexgon.html b/demos/hexgon.html new file mode 100644 index 0000000000..ce5ed92af9 --- /dev/null +++ b/demos/hexgon.html @@ -0,0 +1,76 @@ + + + + + + + + + point_circle + + + + +
+ + + + + + + + diff --git a/package.json b/package.json index 01f457cb7e..e992b41020 100755 --- a/package.json +++ b/package.json @@ -78,11 +78,11 @@ "prepublishOnly": "npm run build-lib && npm run dist", "screenshot": "node ./bin/screenshot.js", "start": "npm run dev", - "test": "torch --compile --renderer --recursive test/unit", + "test": "torch --compile-opts ./.torch.compile.opts.js --compile --renderer --recursive test/unit", "test-all": "npm run test && npm run test-bugs", "test-bugs": "torch --compile --renderer --recursive test/bugs", "test-bugs-live": "torch --compile --interactive --watch --recursive test/bugs", - "test-live": "torch --compile --interactive --watch --recursive test/unit", + "test-live": "torch --compile --interactive --watch --recursive test/unit", "watch": "webpack --config webpack-dev.config.js", "win-dev": "node ./bin/win-dev.js" }, diff --git a/src/core/three.js b/src/core/three.js index 03359e840d..1658e39038 100644 --- a/src/core/three.js +++ b/src/core/three.js @@ -35,4 +35,4 @@ export { BufferAttribute } from 'three/src/core/BufferAttribute.js'; -// export * from '../../build/Three.js'; +// export * from '../../build/three.js'; diff --git a/src/geom/buffer/heatmap/hexagon.js b/src/geom/buffer/heatmap/hexagon.js new file mode 100644 index 0000000000..1d30f66807 --- /dev/null +++ b/src/geom/buffer/heatmap/hexagon.js @@ -0,0 +1,32 @@ +import { polygonPath } from '../../shape/path'; +import { fill } from '../../shape/polygon'; +export default function hexagonBuffer(layerData) { + const attribute = { + vertices: [], + miter: [], + colors: [], + pickingIds: [] + }; + const a = Math.cos(Math.PI / 6); + const points = [ + [ 0, -1, 0 ], + [ -a, -0.5, 0 ], + [ -a, 0.5, 0 ], + [ 0, 1, 0 ], + [ a, 0.5, 0 ], + [ a, -0.5, 0 ], + [ 0, -1, 0 ] + ]; + // const hexgonPoints = polygonPath(6); + const hexgonFill = fill([ points ]); + const { positionsIndex, positions } = hexgonFill; + layerData.forEach(element => { + positionsIndex.forEach(pointIndex => { + attribute.vertices.push(...element.coordinates); + attribute.miter.push(positions[pointIndex][0], positions[pointIndex][1]); + attribute.pickingIds.push(element.id); + attribute.colors.push(...element.color); + }); + }); + return attribute; +} diff --git a/src/geom/material/hexagon.js b/src/geom/material/hexagon.js new file mode 100644 index 0000000000..4b2e0896c8 --- /dev/null +++ b/src/geom/material/hexagon.js @@ -0,0 +1,31 @@ +import grid_frag from '../shader/hexagon_frag.glsl'; +import grid_vert from '../shader/hexagon_vert.glsl'; +import Material from './material'; + + +export default class hexagonMaterial extends Material { + getDefaultParameters() { + return { + uniforms: { + u_opacity: { value: 1.0 }, + u_time: { value: 0 }, + u_radius: { value: 0.01 }, + u_angle: { value: 0.01 }, + u_coverage: { value: 0.8 } + }, + defines: { + + } + }; + } + constructor(_uniforms, _defines, parameters) { + super(parameters); + const { uniforms, defines } = this.getDefaultParameters(); + this.uniforms = Object.assign(uniforms, this.setUniform(_uniforms)); + this.type = 'hexagonMaterial'; + this.defines = Object.assign(defines, _defines); + this.vertexShader = grid_vert; + this.fragmentShader = grid_frag; + this.transparent = true; + } +} diff --git a/src/geom/shader/hexagon_frag.glsl b/src/geom/shader/hexagon_frag.glsl new file mode 100644 index 0000000000..042dde511e --- /dev/null +++ b/src/geom/shader/hexagon_frag.glsl @@ -0,0 +1,8 @@ + precision highp float; + uniform float u_opacity; + varying vec4 v_color; + void main() { + vec4 color = v_color; + gl_FragColor = color; + gl_FragColor.a =color.a*u_opacity; +} \ No newline at end of file diff --git a/src/geom/shader/hexagon_vert.glsl b/src/geom/shader/hexagon_vert.glsl new file mode 100644 index 0000000000..30268d4861 --- /dev/null +++ b/src/geom/shader/hexagon_vert.glsl @@ -0,0 +1,17 @@ +precision highp float; +attribute vec2 miter; +attribute vec4 a_color; +uniform float u_radius; +uniform float u_coverage; +uniform float u_angle; +varying vec4 v_color; + +void main() { + mat4 matModelViewProjection = projectionMatrix * modelViewMatrix; + mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle)); + v_color = a_color; + vec2 offset =vec2(rotationMatrix * miter * u_radius * u_coverage ); + float x = position.x + offset.x; + float y = position.y + offset.y; + gl_Position = matModelViewProjection * vec4(x, y, position.z, 1.0); +} \ No newline at end of file diff --git a/src/geom/shader/point_vert.glsl b/src/geom/shader/point_vert.glsl index 55b7d76a76..a39283badf 100644 --- a/src/geom/shader/point_vert.glsl +++ b/src/geom/shader/point_vert.glsl @@ -2,7 +2,6 @@ precision highp float; attribute vec4 a_color; attribute float a_size; attribute float a_shape; -attribute vec4 a_idColor; uniform vec4 u_stroke; uniform float u_strokeWidth; uniform float u_opacity; diff --git a/src/geom/shader/polygon_vert.glsl b/src/geom/shader/polygon_vert.glsl index eba0b62d02..5ae3a3c2a1 100644 --- a/src/geom/shader/polygon_vert.glsl +++ b/src/geom/shader/polygon_vert.glsl @@ -3,7 +3,6 @@ precision highp float; #define diffuseRatio 0.4 #define specularRatio 0.1 attribute vec4 a_color; -attribute vec4 a_idColor; attribute vec2 faceUv; attribute vec3 a_shape; attribute vec3 a_size; diff --git a/src/layer/heatmap.js b/src/layer/heatmap.js index f9971a55da..3b23ad98da 100644 --- a/src/layer/heatmap.js +++ b/src/layer/heatmap.js @@ -1,6 +1,8 @@ import Layer from '../core/layer'; import gridBuffer from '../geom/buffer/heatmap/grid'; import DrawGrid from './render/heatmap/gird'; +import DrawHexagon from './render/heatmap/hexagon'; +import hexagonBuffer from '../geom/buffer/heatmap/hexagon'; export default class HeatMapLayer extends Layer { shape(type) { @@ -13,6 +15,30 @@ export default class HeatMapLayer extends Layer { } _prepareRender() { this.init(); + switch (this.shapeType) { + case 'grid' : + this._drawGrid(); + break; + case 'hexagon' : + this._drawHexagon(); + break; + default: + this._drawGrid(); + } + } + _drawHexagon() { + const style = this.get('styleOptions'); + const { radius } = this.layerSource.data; + this._buffer = new hexagonBuffer(this.layerData); + const config = { + ...style, + radius + }; + const Mesh = new DrawHexagon(this._buffer, config); + this.add(Mesh); + + } + _drawGrid() { this.type = 'heatmap'; const style = this.get('styleOptions'); const { xOffset, yOffset } = this.layerSource.data; @@ -25,4 +51,5 @@ export default class HeatMapLayer extends Layer { const girdMesh = new DrawGrid(this._buffer, config); this.add(girdMesh); } + } diff --git a/src/layer/render/heatmap/hexagon.js b/src/layer/render/heatmap/hexagon.js new file mode 100644 index 0000000000..04b7580cbd --- /dev/null +++ b/src/layer/render/heatmap/hexagon.js @@ -0,0 +1,21 @@ +import * as THREE from '../../../core/three'; +import GridMaterial from '../../../geom/material/hexagon'; +export default function DrawHexagon(attributes, style) { + const { opacity, radius, angle, coverage } = style; + const geometry = new THREE.BufferGeometry(); + geometry.addAttribute('position', new THREE.Float32BufferAttribute(attributes.vertices, 3)); + geometry.addAttribute('miter', new THREE.Float32BufferAttribute(attributes.miter, 2)); + geometry.addAttribute('a_color', new THREE.Float32BufferAttribute(attributes.colors, 4)); + geometry.addAttribute('pickingId', new THREE.Float32BufferAttribute(attributes.pickingIds, 1)); + const material = new GridMaterial({ + u_opacity: opacity, + u_radius: radius, + u_angle: angle / 180 * Math.PI, + u_coverage: coverage + }, { + SHAPE: false + }); + const hexgonMesh = new THREE.Mesh(geometry, material); + return hexgonMesh; +} + diff --git a/src/source/index.js b/src/source/index.js index ff88ba484e..1d7fe62ba4 100644 --- a/src/source/index.js +++ b/src/source/index.js @@ -8,6 +8,7 @@ import raster from './parser/raster'; import { registerTransform, registerParser } from './factory'; import { aggregatorToGrid } from './transform/grid'; +import { pointToHexbin } from './transform/hexagon'; import { map } from './transform/map'; registerParser('geojson', geojson); @@ -18,6 +19,7 @@ registerParser('raster', raster); // 注册transform registerTransform('grid', aggregatorToGrid); +registerTransform('hexagon', pointToHexbin); registerTransform('map', map); export { getTransform, registerTransform, getParser, registerParser } from './factory'; diff --git a/src/source/transform/grid.js b/src/source/transform/grid.js index d2ace3476c..21440bae89 100644 --- a/src/source/transform/grid.js +++ b/src/source/transform/grid.js @@ -17,8 +17,8 @@ export function aggregatorToGrid(data, option) { const { gridHash, gridOffset } = _pointsGridHash(dataArray, size); const layerData = _getGridLayerDataFromGridHash(gridHash, gridOffset, option); return { - xOffset: gridOffset.xOffset / 360 * (256 << 20) / 2, yOffset: gridOffset.xOffset / 360 * (256 << 20) / 2, + xOffset: gridOffset.xOffset / 360 * (256 << 20) / 2, dataArray: layerData }; } diff --git a/src/source/transform/hexagon.js b/src/source/transform/hexagon.js index f0aa9692f1..c550dc32ac 100644 --- a/src/source/transform/hexagon.js +++ b/src/source/transform/hexagon.js @@ -20,7 +20,7 @@ export function pointToHexbin(data, option) { .y(d => d.coordinates[1]); const hexbinBins = newHexbin(screenPoints); const result = { - size: pixlSize + radius: pixlSize }; result.dataArray = hexbinBins.map((hex, index) => { if (option.field && option.method) { @@ -31,8 +31,9 @@ export function pointToHexbin(data, option) { item[option.method] = hex[option.method]; return { ...item, + count: hex.length, coordinates: unProjectFlat([ hex.x, hex.y ]), - id: index + 1 + _id: index + 1 }; }); return result; diff --git a/test/unit/geom/buffer/heatmap/hexagon.js b/test/unit/geom/buffer/heatmap/hexagon.js new file mode 100644 index 0000000000..c92074bca3 --- /dev/null +++ b/test/unit/geom/buffer/heatmap/hexagon.js @@ -0,0 +1,35 @@ +import { expect } from 'chai'; +import hexagonBuffer from '../../../../../src/geom/buffer/heatmap/hexagon'; +describe('hexagon heatMap buffer', () => { + const layerData = [ + { color: [ 1, 1, 0, 1 ], coordinates: [ 120.12063099925889, 30.263947783103486, 0 ], id: 1 }, + { color: [ 1, 0.5, 0, 1 ], coordinates: [ 120.12218696039365, 30.263947783103486, 0 ], id: 2 }, + { + color: [ 1, 0.1, 0, 1 ], + coordinates: [ 120.12374292152843, 30.263947783103486, 0 ], + id: 3 + }, + { color: [ 1, 0, 0.2, 1 ], coordinates: [ 120.1252988826632, 30.263947783103486, 0 ], id: 4 }, + { + color: [ 0, 1, 0, 1 ], + coordinates: [ 120.12607686323062, 30.263947783103486, 0 ], + id: 5 + }, + { + color: [ 1, 1, 0, 1 ], + coordinates: [ 120.12685484379799, 30.263947783103486, 0 ], + id: 6 + }, + { color: [ 1, 1, 1, 1 ], coordinates: [ 120.12841080493274, 30.263947783103486, 0 ], id: 7 }, + { color: [ 0, 1, 1, 1 ], coordinates: [ 120.13230070776972, 30.263947783103486, 0 ], id: 8 }, + { color: [ 0, 1, 0, 1 ], coordinates: [ 120.12763282436538, 30.263947783103486, 0 ], id: 9 }, + { color: [ 1, 1, 0, 1 ], coordinates: [ 120.12996676606754, 30.263947783103486, 0 ], id: 10 } + ]; + it('hexagon buffer', () => { + const attribute = hexagonBuffer(layerData); + expect(attribute.colors.length).eql(480); + expect(attribute.miter.length).eql(240); + expect(attribute.pickingIds.length).eql(120); + expect(attribute.vertices.length).eql(360); + }); +}); diff --git a/test/unit/shader-module/base-spec.js b/test/unit/shader-module/base-spec.js index 8f2b35c079..ebe8cd9b43 100644 --- a/test/unit/shader-module/base-spec.js +++ b/test/unit/shader-module/base-spec.js @@ -24,9 +24,8 @@ describe('test shader module', function() { it('should import a module correctly.', function() { const { vs, fs } = getModule('module1'); - expect(vs).eq('#define PI 3.14'); - expect(fs).eq(''); + expect(fs.replace(/(\s+)|(\n)+|(\r\n)+/g, '')).eqls('#ifdefGL_FRAGMENT_PRECISION_HIGHprecisionhighpfloat;#elseprecisionmediumpfloat;#endif'); }); }); diff --git a/test/unit/source/transfrom/hexagon.js b/test/unit/source/transfrom/hexagon.js index aad4edb018..8fd3ce4dc6 100644 --- a/test/unit/source/transfrom/hexagon.js +++ b/test/unit/source/transfrom/hexagon.js @@ -18,6 +18,5 @@ describe('hexagon Test', function() { }; const hexgonGrid = pointToHexbin(data, { size: 100, field: 'v', method: 'sum' }); expect(hexgonGrid.dataArray.length).eql(567); - console.log(hexgonGrid); }); }); diff --git a/webpack.config.js b/webpack.config.js index 9106df5d7f..823d9ef161 100755 --- a/webpack.config.js +++ b/webpack.config.js @@ -4,7 +4,8 @@ const pkg = require('./package.json'); module.exports = { devtool: 'cheap-source-map', entry: { - l7: './src/index.js' + l7: './src/index.js', + three: './src/core/three.js' }, output: { filename: '[name].js', From da24002fa585cfb04f87b6d931e040286feb71b2 Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Wed, 27 Feb 2019 16:44:33 +0800 Subject: [PATCH 2/2] update three --- .eslintignore | 1 + .torch.compile.opts.js | 5 +- package.json | 2 +- src/geo/lngLat.js | 75 --------------------------- src/geom/buffer/heatmap/hexagon.js | 1 - src/geom/buffer/point/normalBuffer.js | 2 +- src/layer/heatmap.js | 1 - src/layer/lineLayer.js | 1 - src/layer/pointLayer.js | 2 - src/source/transform/grid.js | 6 --- 10 files changed, 6 insertions(+), 90 deletions(-) delete mode 100644 src/geo/lngLat.js diff --git a/.eslintignore b/.eslintignore index 81629f01bf..776103ec61 100755 --- a/.eslintignore +++ b/.eslintignore @@ -7,3 +7,4 @@ node_modules/ demos/assets/ demos/index.html demos/* +src/core/three.js diff --git a/.torch.compile.opts.js b/.torch.compile.opts.js index cea3ac8770..142e0804d2 100755 --- a/.torch.compile.opts.js +++ b/.torch.compile.opts.js @@ -3,13 +3,14 @@ module.exports = { babelrc: { presets: [ "@babel/preset-env" - ] + ], }, extensions: ['.js'], include: [ 'src/**/*.js', 'test/**/*.js', - 'node_modules/_three@0.96.0@three/**/*.js', + 'node_modules/_three@0.101.1@three/**/*.js', + 'node_modules/three/**/*.js', 'node_modules/simple-statistics/src/*.js' ], exclude: [ diff --git a/package.json b/package.json index e992b41020..c28b5a396a 100755 --- a/package.json +++ b/package.json @@ -109,7 +109,7 @@ "polyline-normals": "^2.0.2", "rbush": "^2.0.2", "simple-statistics": "^7.0.1", - "three": "^0.96.0", + "three": "^0.101.1", "venn.js": "^0.2.20", "viewport-mercator-project": "^5.2.0", "webworkify-webpack": "^2.1.3", diff --git a/src/geo/lngLat.js b/src/geo/lngLat.js deleted file mode 100644 index b635918f0c..0000000000 --- a/src/geo/lngLat.js +++ /dev/null @@ -1,75 +0,0 @@ -self._wkHandlers={};; - - function _prep_h17(){function a(b,c,d,e,g,k){var l=[0,0,0,0,0],n=d.slice(0,4).concat(l),p=[],s=Math.PI/180*6,A=void 0,I=void 0,A=d.slice(0,2),D=m(e),F=m(g),I=q.normalize(h(D).fg(h(A))),C=q.normalize(h(F).fg(h(A)));q.OK(I,k)?(A=q.oD(I),I=q.oD(C)):(A=q.oD(C),I=q.oD(I),k=[F,D],D=k[0],F=k[1],g=[g,e],e=g[0],g=g[1]);D=Math.ceil(Math.abs(I-A)/s);30<=D&&(D=60-D);for(k=0;kMath.sqrt(3)/2&&(d=Math.sqrt(3)/2);c=c.oJ(d)}return c}function g(a,c,e){if(void 0===e||!0===e)b.push(a[0],a[1]),b.push(-c.y,c.x,0,0),b.push(m,0,0),d.push(a[2]);if(void 0===e||!1===e)b.push(a[0],a[1]),b.push(c.y,-c.x,0,0),b.push(m,0,0),d.push(a[2])}for(var k=a[0],l=a[a.length-1],m=0,n=void 0;k[0]===l[0]&&k[1]===l[1]&&k!==l;)a.pop(),l=a[a.length-1];a.push(k);a.push(a[1]);a.unshift(l);var p=a.length;a.forEach(function(a,d, k){var l=k[d-1];k=k[d+1];var r=void 0;l&&(m+=q.Fd(a,l));if(0===d||d===p-1)0===d?(r=q.normalize(h(k[0]-a[0],k[1]-a[1])),c.push(0,1,2)):(r=q.normalize(h(a[0]-l[0],a[1]-l[1])),d=b.length/9+2,c.push(d-3,d-1,d-2)),g(a,r);else{d=q.normalize(h(a[0]-l[0],a[1]-l[1]));k=q.normalize(h(k[0]-a[0],k[1]-a[1]));l=q.normalize(d.multiply(-1).mi(k));n=q.OK(l,d);g(a,e(d,k),!0);g(a,e(d,k),!1);g(a,e(d,k),!0);g(a,e(d,k),!1);a=b.length/9-4;k=a+2;var r=9*a,s=r+9,x=s+9,B=x+9;d=Math.abs(q.cos(d,l)/q.sin(d,l));n?(b[r+7]=d,b[s+ 7]=-d,b[x+7]=-d,b[B+7]=d):(b[r+7]=-d,b[s+7]=d,b[x+7]=d,b[B+7]=-d);c.push(a,a-1,a+1);c.push(k,k+1,k+2)}})}function e(c,d,e){function g(a,b){if(p)for(;0=a&&(a+=2*Math.PI);return a}},s={mi:function(a){return h(this.x+a.x,this.y+a.y)},fg:function(a){return h(this.x-a.x,this.y-a.y)},multiply:function(a){return"number"===typeof a?h(this.x*a,this.y*a):this.x*a.x+this.y*a.y},oJ:function(a){return h(this.x/a,this.y/a)},NC:function(a){var b=a.y;return this.x===a.x&&this.y===b}};return{parse:function(a,b){var h=a.lineJoin,h=void 0===h?"bevel":h,k= a.lineCap,k=void 0===k?"butt":k,l=a.Zda,l=void 0===l?!1:l,m=a.tn,n=void 0===m?!1:m,p=a.LX,m=a.Iia,q=void 0===m?!0:m,m=a.Sda,s=[],A=[],I=g(a.Nr,void 0===p?!0:p),p=[];l?(d(I,s,A,p),h=s.length,[0,1,2,h/9-1,h/9-2].forEach(function(a){s[9*a+8]=-1})):(c(I,s,A,h,n,p),e(I,s,A,k,p));q&&(s=new Float32Array(s),A=65535=h||b.jn;if(d||b){d=1 { - const { color, size, id, coordinates} = item; + const { color, size, id, coordinates } = item; attributes.vertices.push(...coordinates); attributes.colors.push(...color); attributes.pickingIds.push(id); diff --git a/src/layer/heatmap.js b/src/layer/heatmap.js index 3b23ad98da..73b9b0b1b7 100644 --- a/src/layer/heatmap.js +++ b/src/layer/heatmap.js @@ -36,7 +36,6 @@ export default class HeatMapLayer extends Layer { }; const Mesh = new DrawHexagon(this._buffer, config); this.add(Mesh); - } _drawGrid() { this.type = 'heatmap'; diff --git a/src/layer/lineLayer.js b/src/layer/lineLayer.js index c83c3f0a88..ff672b9196 100644 --- a/src/layer/lineLayer.js +++ b/src/layer/lineLayer.js @@ -11,7 +11,6 @@ export default class LineLayer extends Layer { render() { this.type = 'polyline'; this.init(); - const source = this.layerSource; const layerData = this.layerData; const style = this.get('styleOptions'); const buffer = this._buffer = new LineBuffer({ diff --git a/src/layer/pointLayer.js b/src/layer/pointLayer.js index 7acbdfbf53..39eb197c6d 100644 --- a/src/layer/pointLayer.js +++ b/src/layer/pointLayer.js @@ -37,7 +37,6 @@ export default class PointLayer extends Layer { this._textPoint(); return; } - const source = this.layerSource; const style = this.get('styleOptions'); const pointShapeType = this._getShape(); @@ -98,7 +97,6 @@ export default class PointLayer extends Layer { } _textPoint() { - const source = this.layerSource; const styleOptions = this.get('styleOptions'); const buffer = new TextBuffer({ type: this.shapeType, diff --git a/src/source/transform/grid.js b/src/source/transform/grid.js index 21440bae89..4098f15e15 100644 --- a/src/source/transform/grid.js +++ b/src/source/transform/grid.js @@ -5,12 +5,6 @@ import * as statistics from './statistics'; const R_EARTH = 6378000; -/** - * 计算方格密度图 - * @param {*} data 经纬度数据 和属性数据 - * @param {*} size 半径大小 单位 km - * @return - */ export function aggregatorToGrid(data, option) { const dataArray = data.dataArray; const { size = 10 } = option;