From 82b9ea3afce12ee9935201edeb4cb2fc54f71585 Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Tue, 19 Nov 2019 10:21:43 +0800 Subject: [PATCH 1/2] refactor(layer): point,polygon line model --- examples/gallery/basic/demo/arcCircle.js | 4 +- examples/gallery/basic/demo/column_dark.js | 4 +- examples/gallery/basic/demo/normal.js | 4 +- examples/gallery/basic/demo/point.js | 4 +- examples/line/arc/demo/arc.js | 10 +- examples/line/arc/demo/arcCircle.js | 41 +++--- examples/line/arc/demo/trip_arc.js | 7 +- examples/line/arc/demo/trip_arc_dark.js | 6 +- examples/point/bubble/demo/color.js | 2 +- examples/point/bubble/demo/meta.json | 18 +-- examples/point/bubble/demo/point.js | 2 +- .../point/{scatter => bubble}/demo/scatter.js | 0 examples/point/bubble/demo/world.js | 3 +- examples/point/column/demo/clumn_shape.js | 16 +-- .../point/column/demo/clumn_shape_light.js | 18 +-- examples/point/column/demo/column_dark.js | 18 +-- examples/point/column/demo/column_light.js | 14 +- examples/point/image/demo/image.js | 34 ++--- examples/point/image/demo/locate.js | 18 ++- examples/point/image/demo/weather.js | 8 +- examples/point/scatter/demo/meta.json | 7 +- examples/point/scatter/demo/normal.js | 4 +- .../normal.js => scatter/demo/normal2.js} | 4 +- examples/polygon/3d/demo/polygon.js | 6 +- .../core/src/services/layer/ILayerService.ts | 21 ++- packages/layers/src/core/BaseLayer.ts | 23 ++-- packages/layers/src/core/baseModel.ts | 55 ++++++++ packages/layers/src/core/triangulation.ts | 15 +- packages/layers/src/index.ts | 19 +-- packages/layers/src/line/index.ts | 129 ++---------------- packages/layers/src/line/{ => models}/arc.ts | 67 ++++----- .../src/line/{arc3d.ts => models/arc_3d.ts} | 62 ++++----- packages/layers/src/line/models/dash.ts | 22 +++ .../line/{arc2d.ts => models/great_circle.ts} | 70 ++++------ packages/layers/src/line/models/index.ts | 15 ++ packages/layers/src/line/models/line.ts | 120 ++++++++++++++++ .../layers/src/point/buffers/ExtrudeBuffer.ts | 79 ----------- .../layers/src/point/buffers/ImageBuffer.ts | 22 --- packages/layers/src/point/index.ts | 57 ++++++-- .../layers/src/point/{ => models}/extrude.ts | 60 ++++---- .../layers/src/point/{ => models}/fill.ts | 75 ++++------ .../layers/src/point/{ => models}/image.ts | 78 ++++------- packages/layers/src/point/models/index.ts | 17 +++ .../layers/src/point/{ => models}/normal.ts | 64 +++------ packages/layers/src/point/models/text.ts | 30 ++++ packages/layers/src/polygon/index.ts | 41 ++---- packages/layers/src/polygon/models/extrude.ts | 92 +++++++++++++ packages/layers/src/polygon/models/fill.ts | 47 +++++++ packages/layers/src/polygon/models/index.ts | 11 ++ packages/layers/src/polygon/polygon3D.ts | 8 +- 50 files changed, 829 insertions(+), 722 deletions(-) rename examples/point/{scatter => bubble}/demo/scatter.js (100%) rename examples/point/{bubble/demo/normal.js => scatter/demo/normal2.js} (90%) create mode 100644 packages/layers/src/core/baseModel.ts rename packages/layers/src/line/{ => models}/arc.ts (58%) rename packages/layers/src/line/{arc3d.ts => models/arc_3d.ts} (58%) create mode 100644 packages/layers/src/line/models/dash.ts rename packages/layers/src/line/{arc2d.ts => models/great_circle.ts} (58%) create mode 100644 packages/layers/src/line/models/index.ts create mode 100644 packages/layers/src/line/models/line.ts delete mode 100644 packages/layers/src/point/buffers/ExtrudeBuffer.ts delete mode 100644 packages/layers/src/point/buffers/ImageBuffer.ts rename packages/layers/src/point/{ => models}/extrude.ts (68%) rename packages/layers/src/point/{ => models}/fill.ts (61%) rename packages/layers/src/point/{ => models}/image.ts (58%) create mode 100644 packages/layers/src/point/models/index.ts rename packages/layers/src/point/{ => models}/normal.ts (58%) create mode 100644 packages/layers/src/point/models/text.ts create mode 100644 packages/layers/src/polygon/models/extrude.ts create mode 100644 packages/layers/src/polygon/models/fill.ts create mode 100644 packages/layers/src/polygon/models/index.ts diff --git a/examples/gallery/basic/demo/arcCircle.js b/examples/gallery/basic/demo/arcCircle.js index 597aeae5e0..06ffc318b8 100644 --- a/examples/gallery/basic/demo/arcCircle.js +++ b/examples/gallery/basic/demo/arcCircle.js @@ -1,4 +1,4 @@ -import { Arc2DLineLayer } from '@l7/layers'; +import { LineLayer } from '@l7/layers'; import { Scene } from '@l7/scene'; const scene = new Scene({ id: 'map', @@ -13,7 +13,7 @@ fetch('https://gw.alipayobjects.com/os/rmsportal/UEXQMifxtkQlYfChpPwT.txt') .then((res) => res.text()) .then((data) => { const layer = - new Arc2DLineLayer({}) + new LineLayer({}) .source(data, { parser: { type: 'csv', diff --git a/examples/gallery/basic/demo/column_dark.js b/examples/gallery/basic/demo/column_dark.js index 3633414bf5..13ae28f991 100644 --- a/examples/gallery/basic/demo/column_dark.js +++ b/examples/gallery/basic/demo/column_dark.js @@ -1,5 +1,5 @@ import { Scene } from '@l7/scene'; -import { Point3dLayer} from '@l7/layers' +import { PointLayer} from '@l7/layers' const scene = new Scene({ id: 'map', @@ -15,7 +15,7 @@ fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json') .then((res) => res.json()) .then((data) => { const pointLayer = - new Point3dLayer({ + new PointLayer({ }) .source(data.list, { parser: { diff --git a/examples/gallery/basic/demo/normal.js b/examples/gallery/basic/demo/normal.js index 2ff1f932ab..6c52952426 100644 --- a/examples/gallery/basic/demo/normal.js +++ b/examples/gallery/basic/demo/normal.js @@ -1,6 +1,6 @@ import { Scene } from '@l7/scene'; -import { PointNormalLayer } from '@l7/layers' +import { PointLayer } from '@l7/layers' const scene = new Scene({ id: 'map', type: 'amap', @@ -15,7 +15,7 @@ fetch('https://gw.alipayobjects.com/os/rmsportal/BElVQFEFvpAKzddxFZxJ.txt') .then((res) => res.text()) .then((data) => { const pointLayer = - new PointNormalLayer({ + new PointLayer({ }) .source(data, { parser: { diff --git a/examples/gallery/basic/demo/point.js b/examples/gallery/basic/demo/point.js index 019931bf2b..a5269a917c 100644 --- a/examples/gallery/basic/demo/point.js +++ b/examples/gallery/basic/demo/point.js @@ -1,6 +1,6 @@ import { Scene } from '@l7/scene'; -import { PointNormalLayer } from '@l7/layers' +import { PointLayer } from '@l7/layers' const scene = new Scene({ id: 'map', pitch: 64.88, @@ -15,7 +15,7 @@ fetch('https://gw.alipayobjects.com/os/basement_prod/513add53-dcb2-4295-8860-9e7 .then((res) => res.json()) .then((data) => { const pointLayer = - new PointNormalLayer({ + new PointLayer({ }) .source(data) diff --git a/examples/line/arc/demo/arc.js b/examples/line/arc/demo/arc.js index 7b398c7da1..6b33943cce 100644 --- a/examples/line/arc/demo/arc.js +++ b/examples/line/arc/demo/arc.js @@ -1,4 +1,4 @@ -import { ArcLineLayer } from '@l7/layers'; +import { LineLayer } from '@l7/layers'; import { Scene } from '@l7/scene'; const scene = new Scene({ id: 'map', @@ -8,11 +8,11 @@ const scene = new Scene({ center: [0., 23.107329], zoom: 0, }); - +console.time('loadData'); fetch('https://gw.alipayobjects.com/os/basement_prod/b83699f9-a96d-49b8-b2ea-f99299faebaf.json') .then((res) => res.json()) .then((data) => { - + console.timeEnd('loadData'); function getAirportCoord(idx) { return [data.airports[idx][3], data.airports[idx][4]]; } @@ -24,9 +24,9 @@ fetch('https://gw.alipayobjects.com/os/basement_prod/b83699f9-a96d-49b8-b2ea-f99 ] } }); - + console.timeEnd('loadData'); const layer = - new ArcLineLayer({}) + new LineLayer({}) .source(routes, { parser: { type: 'json', diff --git a/examples/line/arc/demo/arcCircle.js b/examples/line/arc/demo/arcCircle.js index 597aeae5e0..4e68836834 100644 --- a/examples/line/arc/demo/arcCircle.js +++ b/examples/line/arc/demo/arcCircle.js @@ -1,4 +1,4 @@ -import { Arc2DLineLayer } from '@l7/layers'; +import { LineLayer } from '@l7/layers'; import { Scene } from '@l7/scene'; const scene = new Scene({ id: 'map', @@ -8,28 +8,27 @@ const scene = new Scene({ center: [107.77791556935472, 35.443286920228644], zoom: 2.9142882493605033, }); -window.mapScene = scene; fetch('https://gw.alipayobjects.com/os/rmsportal/UEXQMifxtkQlYfChpPwT.txt') .then((res) => res.text()) .then((data) => { const layer = - new Arc2DLineLayer({}) - .source(data, { - parser: { - type: 'csv', - x: 'lng1', - y: 'lat1', - x1: 'lng2', - y1: 'lat2', - }, - }) - .size(1) - .shape('arc') - .color('#8C1EB2') - .style({ - opacity: 0.8, - blur: 0.99 - }) - ; - scene.addLayer(layer); + new LineLayer({}) + .source(data, { + parser: { + type: 'csv', + x: 'lng1', + y: 'lat1', + x1: 'lng2', + y1: 'lat2', + }, + }) + .size(1) + .shape('greatcircle') + .color('#8C1EB2') + .style({ + opacity: 0.8, + blur: 0.99 + }) + ; + scene.addLayer(layer); }) diff --git a/examples/line/arc/demo/trip_arc.js b/examples/line/arc/demo/trip_arc.js index 0b838e8304..7f2cee60cf 100644 --- a/examples/line/arc/demo/trip_arc.js +++ b/examples/line/arc/demo/trip_arc.js @@ -1,4 +1,4 @@ -import { Arc3DLineLayer } from '@l7/layers'; +import { LineLayer } from '@l7/layers'; import { Scene } from '@l7/scene'; const scene = new Scene({ id: 'map', @@ -8,12 +8,11 @@ const scene = new Scene({ center: [-74.06355155037261,40.73507179789368], zoom: 11.8623, }); -window.mapScene = scene; fetch('https://gw.alipayobjects.com/os/basement_prod/bd33a685-a17e-4686-bc79-b0e6a89fd950.csv') .then((res) => res.text()) .then((data) => { const layer = - new Arc3DLineLayer({}) + new LineLayer({}) .source(data, { parser: { type: 'csv', @@ -24,7 +23,7 @@ fetch('https://gw.alipayobjects.com/os/basement_prod/bd33a685-a17e-4686-bc79-b0e }, }) .size(1) - .shape('arc') + .shape('arc3d') .color('#0C47BF') .style({ opacity: 1, diff --git a/examples/line/arc/demo/trip_arc_dark.js b/examples/line/arc/demo/trip_arc_dark.js index fc11f18c29..f09d7bf956 100644 --- a/examples/line/arc/demo/trip_arc_dark.js +++ b/examples/line/arc/demo/trip_arc_dark.js @@ -1,4 +1,4 @@ -import { Arc3DLineLayer } from '@l7/layers'; +import { LineLayer } from '@l7/layers'; import { Scene } from '@l7/scene'; const scene = new Scene({ id: 'map', @@ -15,7 +15,7 @@ fetch('https://gw.alipayobjects.com/os/rmsportal/UEXQMifxtkQlYfChpPwT.txt') .then((res) => res.text()) .then((data) => { const layer = - new Arc3DLineLayer({}) + new LineLayer({}) .source(data, { parser: { type: 'csv', @@ -26,7 +26,7 @@ fetch('https://gw.alipayobjects.com/os/rmsportal/UEXQMifxtkQlYfChpPwT.txt') }, }) .size(1) - .shape('arc') + .shape('arc3d') .color('#FF7C6A') .style({ opacity: 0.8, diff --git a/examples/point/bubble/demo/color.js b/examples/point/bubble/demo/color.js index 09dddb35d8..81cf0df2ba 100644 --- a/examples/point/bubble/demo/color.js +++ b/examples/point/bubble/demo/color.js @@ -1,5 +1,5 @@ import { Scene } from '@l7/scene'; -import { PointLayer, PointImageLayer } from '@l7/layers' +import { PointLayer } from '@l7/layers' const scene = new Scene({ id: 'map', pitch: 0, diff --git a/examples/point/bubble/demo/meta.json b/examples/point/bubble/demo/meta.json index ac14fcf566..9c9bf0e4ca 100644 --- a/examples/point/bubble/demo/meta.json +++ b/examples/point/bubble/demo/meta.json @@ -8,8 +8,8 @@ "filename": "point.js", "title": "气泡图", "screenshot":"https://gw.alipayobjects.com/mdn/antv_site/afts/img/A*_9ETS5_1yCEAAAAAAAAAAABkARQnAQ" - - }, + + }, { "filename": "color.js", "title": "形状映射", @@ -19,13 +19,13 @@ "filename": "world.js", "title": "气泡图", "screenshot": "https://gw.alipayobjects.com/mdn/antv_site/afts/img/A*DMREQYwsCF4AAAAAAAAAAABkARQnAQ" - - }, - { - "filename": "normal.js", - "title": "城市亮度图", - "screenshot": "https://gw.alipayobjects.com/mdn/antv_site/afts/img/A*Xp7iRaORYuIAAAAAAAAAAABkARQnAQ" - + + }, { + "filename": "scatter.js", + "title": "定点图", + "screenshot":"https://gw.alipayobjects.com/mdn/antv_site/afts/img/A*Jt3ZSb8VH98AAAAAAAAAAABkARQnAQ" + } + ] } diff --git a/examples/point/bubble/demo/point.js b/examples/point/bubble/demo/point.js index 3866c4b935..cf8b433ced 100644 --- a/examples/point/bubble/demo/point.js +++ b/examples/point/bubble/demo/point.js @@ -1,5 +1,5 @@ import { Scene } from '@l7/scene'; -import { PointLayer, PointImageLayer } from '@l7/layers' +import { PointLayer } from '@l7/layers' const scene = new Scene({ id: 'map', pitch: 0, diff --git a/examples/point/scatter/demo/scatter.js b/examples/point/bubble/demo/scatter.js similarity index 100% rename from examples/point/scatter/demo/scatter.js rename to examples/point/bubble/demo/scatter.js diff --git a/examples/point/bubble/demo/world.js b/examples/point/bubble/demo/world.js index 78c8e426c8..7071939514 100644 --- a/examples/point/bubble/demo/world.js +++ b/examples/point/bubble/demo/world.js @@ -1,5 +1,5 @@ import { Scene } from '@l7/scene'; -import { PointLayer, PointImageLayer } from '@l7/layers' +import { PointLayer } from '@l7/layers' const scene = new Scene({ id: 'map', pitch: 0, @@ -9,7 +9,6 @@ const scene = new Scene({ zoom: 2.194613775109773, maxZoom: 10 }); -window.mapScene = scene; fetch('https://gw.alipayobjects.com/os/basement_prod/337ddbb7-aa3f-4679-ab60-d64359241955.json') .then((res) => res.json()) .then((data) => { diff --git a/examples/point/column/demo/clumn_shape.js b/examples/point/column/demo/clumn_shape.js index 5a3e9c1c76..b0e15f99a8 100644 --- a/examples/point/column/demo/clumn_shape.js +++ b/examples/point/column/demo/clumn_shape.js @@ -1,11 +1,11 @@ import { Scene } from '@l7/scene'; -import { Point3dLayer } from '@l7/layers' +import { PointLayer } from '@l7/layers' const scene = new Scene({ id: 'map', pitch: 65.68421052631578, type: 'amap', style: 'dark', - center: [121.3917,31.259242], + center: [121.3917, 31.259242], zoom: 14.55, rotation: 120 @@ -16,7 +16,7 @@ fetch('https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9 .then((res) => res.json()) .then((data) => { const pointLayer = - new Point3dLayer({ + new PointLayer({ }) .source(data, { parser: { @@ -24,16 +24,16 @@ fetch('https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9 x: 'longitude', y: 'latitude' } - }).shape('name',['cylinder', 'triangleColumn', 'hexagonColumn','squareColumn']) - .size('unit_price', (h)=>{ - return [ 6,6, h / 500 ] + }).shape('name', ['cylinder', 'triangleColumn', 'hexagonColumn', 'squareColumn']) + .size('unit_price', (h) => { + return [6, 6, h / 500] }) - .color('name',['#739DFF', "#61FCBF",'#FFDE74','#FF896F']) + .color('name', ['#739DFF', "#61FCBF", '#FFDE74', '#FF896F']) .style({ opacity: 1.0, }) - scene.addLayer(pointLayer); + scene.addLayer(pointLayer); }); diff --git a/examples/point/column/demo/clumn_shape_light.js b/examples/point/column/demo/clumn_shape_light.js index 1b04e5549e..fc56b053db 100644 --- a/examples/point/column/demo/clumn_shape_light.js +++ b/examples/point/column/demo/clumn_shape_light.js @@ -1,12 +1,12 @@ import { Scene } from '@l7/scene'; -import { Point3dLayer } from '@l7/layers' +import { PointLayer } from '@l7/layers' const scene = new Scene({ id: 'map', pitch: 65.68421052631578, type: 'mapbox', style: 'light', - center: [121.3917,31.259242], - zoom: 14.55, + center: [121.3917, 31.259242], + zoom: 13.55, rotation: 120 }); @@ -16,7 +16,7 @@ fetch('https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9 .then((res) => res.json()) .then((data) => { const pointLayer = - new Point3dLayer({ + new PointLayer({ }) .source(data, { parser: { @@ -24,16 +24,16 @@ fetch('https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9 x: 'longitude', y: 'latitude' } - }).shape('name',['cylinder', 'triangleColumn', 'hexagonColumn','squareColumn']) - .size('unit_price', (h)=>{ - return [ 6,6, h / 500 ] + }).shape('name', ['cylinder', 'triangleColumn', 'hexagonColumn', 'squareColumn']) + .size('unit_price', (h) => { + return [6, 6, h / 500] }) - .color('name',['#5B8FF9', "#70E3B5",'#FFD458','#FF7C6A']) + .color('name', ['#5B8FF9', "#70E3B5", '#FFD458', '#FF7C6A']) .style({ opacity: 1.0, }) - scene.addLayer(pointLayer); + scene.addLayer(pointLayer); }); diff --git a/examples/point/column/demo/column_dark.js b/examples/point/column/demo/column_dark.js index 3633414bf5..510a465964 100644 --- a/examples/point/column/demo/column_dark.js +++ b/examples/point/column/demo/column_dark.js @@ -1,5 +1,5 @@ import { Scene } from '@l7/scene'; -import { Point3dLayer} from '@l7/layers' +import { PointLayer } from '@l7/layers' const scene = new Scene({ id: 'map', @@ -15,7 +15,7 @@ fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json') .then((res) => res.json()) .then((data) => { const pointLayer = - new Point3dLayer({ + new PointLayer({ }) .source(data.list, { parser: { @@ -23,22 +23,22 @@ fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json') x: 'j', y: 'w' } - }) + }) .shape('cylinder') - .size('t', function(level) { + .size('t', function (level) { return [1, 2, level * 2 + 20]; }) - .color('t',[ + .color('t', [ '#094D4A', '#146968', '#1D7F7E', '#289899', '#34B6B7', '#4AC5AF', '#5FD3A6', '#7BE39E', '#A1EDB8', '#CEF8D6' - ],) + ]) .style({ opacity: 1.0, }) - scene.addLayer(pointLayer); - console.log(pointLayer); - + scene.addLayer(pointLayer); + console.log(pointLayer); + }); \ No newline at end of file diff --git a/examples/point/column/demo/column_light.js b/examples/point/column/demo/column_light.js index 533383f793..adcc29fa43 100644 --- a/examples/point/column/demo/column_light.js +++ b/examples/point/column/demo/column_light.js @@ -1,5 +1,5 @@ import { Scene } from '@l7/scene'; -import { Point3dLayer} from '@l7/layers' +import { PointLayer } from '@l7/layers' const scene = new Scene({ id: 'map', @@ -15,7 +15,7 @@ fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json') .then((res) => res.json()) .then((data) => { const pointLayer = - new Point3dLayer({ + new PointLayer({ }) .source(data.list, { parser: { @@ -23,16 +23,16 @@ fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json') x: 'j', y: 'w' } - }) + }) .shape('cylinder') - .size('t', function(level) { + .size('t', function (level) { return [1, 2, level * 2 + 20]; }) .color('#006CFF') .style({ opacity: 1.0, }) - scene.addLayer(pointLayer); - console.log(pointLayer); - + scene.addLayer(pointLayer); + console.log(pointLayer); + }); \ No newline at end of file diff --git a/examples/point/image/demo/image.js b/examples/point/image/demo/image.js index 7a27ead997..5da7f57cb4 100644 --- a/examples/point/image/demo/image.js +++ b/examples/point/image/demo/image.js @@ -1,31 +1,31 @@ import { Scene } from '@l7/scene'; -import { PointImageLayer } from '@l7/layers' +import { PointLayer } from '@l7/layers' console.log(this); const scene = new Scene({ id: 'map', pitch: 0, type: 'amap', style: 'light', - center: [121.434765,31.256735], + center: [121.434765, 31.256735], zoom: 14.83, }); fetch('https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9140d288ae.json') .then((res) => res.json()) .then((data) => { - scene.addImage( - '00', - 'https://gw.alipayobjects.com/zos/basement_prod/604b5e7f-309e-40db-b95b-4fac746c5153.svg', - ); - scene.addImage( - '01', - 'https://gw.alipayobjects.com/zos/basement_prod/30580bc9-506f-4438-8c1a-744e082054ec.svg', - ); - scene.addImage( - '02', - 'https://gw.alipayobjects.com/zos/basement_prod/7aa1f460-9f9f-499f-afdf-13424aa26bbf.svg', - ); - const imageLayer = new PointImageLayer() + scene.addImage( + '00', + 'https://gw.alipayobjects.com/zos/basement_prod/604b5e7f-309e-40db-b95b-4fac746c5153.svg', + ); + scene.addImage( + '01', + 'https://gw.alipayobjects.com/zos/basement_prod/30580bc9-506f-4438-8c1a-744e082054ec.svg', + ); + scene.addImage( + '02', + 'https://gw.alipayobjects.com/zos/basement_prod/7aa1f460-9f9f-499f-afdf-13424aa26bbf.svg', + ); + const imageLayer = new PointLayer() .source(data, { parser: { type: 'json', @@ -33,9 +33,9 @@ fetch('https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9 y: 'latitude' } }) - .shape('name', ['00', '01','02']) + .shape('name', ['00', '01', '02']) .size(20); - scene.addLayer(imageLayer); + scene.addLayer(imageLayer); }); diff --git a/examples/point/image/demo/locate.js b/examples/point/image/demo/locate.js index 1ae31084bb..c067cabf80 100644 --- a/examples/point/image/demo/locate.js +++ b/examples/point/image/demo/locate.js @@ -1,6 +1,5 @@ import { Scene } from '@l7/scene'; -import { PointImageLayer } from '@l7/layers' -console.log(this); +import { PointLayer } from '@l7/layers' const scene = new Scene({ id: 'map', pitch: 0, @@ -13,18 +12,17 @@ const scene = new Scene({ fetch('https://gw.alipayobjects.com/os/basement_prod/e2fc6e0a-af2a-4320-96e5-d9f5a5fda442.json') .then((res) => res.json()) .then((data) => { - scene.addImage( - 'marker', - 'https://gw.alipayobjects.com/mdn/antv_site/afts/img/A*BJ6cTpDcuLcAAAAAAAAAAABkARQnAQ', - ); - const imageLayer = new PointImageLayer() - .source(data,) + scene.addImage( + 'marker', + 'https://gw.alipayobjects.com/mdn/antv_site/afts/img/A*BJ6cTpDcuLcAAAAAAAAAAABkARQnAQ', + ); + const imageLayer = new PointLayer() + .source(data) .shape('marker') .size(12); - scene.addLayer(imageLayer); + scene.addLayer(imageLayer); }); -window.mapscene =scene; diff --git a/examples/point/image/demo/weather.js b/examples/point/image/demo/weather.js index 9df619e98d..d7634d3d56 100644 --- a/examples/point/image/demo/weather.js +++ b/examples/point/image/demo/weather.js @@ -1,5 +1,5 @@ import { Scene } from '@l7/scene'; -import { PointImageLayer } from '@l7/layers' +import { PointLayer } from '@l7/layers' const scene = new Scene({ id: 'map', type: 'amap', @@ -25,13 +25,13 @@ fetch('https://gw.alipayobjects.com/os/basement_prod/c6042c6b-45fd-4e2e-adf8-fdb .then((res) => res.json()) .then((data) => { - const imageLayer = new PointImageLayer() + const imageLayer = new PointLayer() .source(data) - .shape('w', function(w) { + .shape('w', function (w) { return w; }) .size(15) - scene.addLayer(imageLayer); + scene.addLayer(imageLayer); }); diff --git a/examples/point/scatter/demo/meta.json b/examples/point/scatter/demo/meta.json index 2072bea186..f592a11c51 100644 --- a/examples/point/scatter/demo/meta.json +++ b/examples/point/scatter/demo/meta.json @@ -5,10 +5,9 @@ }, "demos": [ { - "filename": "scatter.js", - "title": "定点图", - "screenshot":"https://gw.alipayobjects.com/mdn/antv_site/afts/img/A*Jt3ZSb8VH98AAAAAAAAAAABkARQnAQ" - + "filename": "normal2.js", + "title": "城市亮度图", + "screenshot": "https://gw.alipayobjects.com/mdn/antv_site/afts/img/A*Xp7iRaORYuIAAAAAAAAAAABkARQnAQ" }, { "filename": "normal.js", diff --git a/examples/point/scatter/demo/normal.js b/examples/point/scatter/demo/normal.js index 2ff1f932ab..6c52952426 100644 --- a/examples/point/scatter/demo/normal.js +++ b/examples/point/scatter/demo/normal.js @@ -1,6 +1,6 @@ import { Scene } from '@l7/scene'; -import { PointNormalLayer } from '@l7/layers' +import { PointLayer } from '@l7/layers' const scene = new Scene({ id: 'map', type: 'amap', @@ -15,7 +15,7 @@ fetch('https://gw.alipayobjects.com/os/rmsportal/BElVQFEFvpAKzddxFZxJ.txt') .then((res) => res.text()) .then((data) => { const pointLayer = - new PointNormalLayer({ + new PointLayer({ }) .source(data, { parser: { diff --git a/examples/point/bubble/demo/normal.js b/examples/point/scatter/demo/normal2.js similarity index 90% rename from examples/point/bubble/demo/normal.js rename to examples/point/scatter/demo/normal2.js index 019931bf2b..a5269a917c 100644 --- a/examples/point/bubble/demo/normal.js +++ b/examples/point/scatter/demo/normal2.js @@ -1,6 +1,6 @@ import { Scene } from '@l7/scene'; -import { PointNormalLayer } from '@l7/layers' +import { PointLayer } from '@l7/layers' const scene = new Scene({ id: 'map', pitch: 64.88, @@ -15,7 +15,7 @@ fetch('https://gw.alipayobjects.com/os/basement_prod/513add53-dcb2-4295-8860-9e7 .then((res) => res.json()) .then((data) => { const pointLayer = - new PointNormalLayer({ + new PointLayer({ }) .source(data) diff --git a/examples/polygon/3d/demo/polygon.js b/examples/polygon/3d/demo/polygon.js index 2774579d1c..90521c91ef 100644 --- a/examples/polygon/3d/demo/polygon.js +++ b/examples/polygon/3d/demo/polygon.js @@ -1,5 +1,5 @@ import { Scene } from '@l7/scene'; -import { Polygon3DLayer } from '@l7/layers' +import { PolygonLayer } from '@l7/layers' const scene = new Scene({ id: 'map', pitch: 15.05263, @@ -14,10 +14,10 @@ fetch('https://gw.alipayobjects.com/os/basement_prod/972566c5-a2b9-4a7e-8da1-bae .then((res) => res.json()) .then((data) => { const layer = - new Polygon3DLayer ({ + new PolygonLayer ({ }) .source(data) - .shape('fill') + .shape('extrude') .size('h20',[100, 120, 160, 200, 260, 500]) .color('h20', ['#816CAD', '#A67FB5', '#C997C7', diff --git a/packages/core/src/services/layer/ILayerService.ts b/packages/core/src/services/layer/ILayerService.ts index d84e9b0c8b..f1361fbf20 100644 --- a/packages/core/src/services/layer/ILayerService.ts +++ b/packages/core/src/services/layer/ILayerService.ts @@ -1,8 +1,9 @@ import { SyncBailHook, SyncHook } from 'tapable'; import Clock from '../../utils/clock'; import { IGlobalConfigService } from '../config/IConfigService'; -import { IModel } from '../renderer/IModel'; +import { IModel, IModelInitializationOptions } from '../renderer/IModel'; import { IMultiPassRenderer } from '../renderer/IMultiPassRenderer'; +import { IUniform } from '../renderer/IUniform'; import { ISource, ISourceCFG } from '../source/ISourceService'; import { IAnimateOption, @@ -12,6 +13,7 @@ import { IStyleAttributeService, StyleAttrField, StyleAttributeOption, + Triangulation, } from './IStyleAttributeService'; export interface ILayerGlobalConfig { @@ -24,6 +26,19 @@ export interface ILayerGlobalConfig { [key: string]: IScale; }; } +export interface ILayerModelInitializationOptions { + moduleName: string; + vertexShader: string; + fragmentShader: string; + triangulation: Triangulation; +} +export interface ILayerModel { + getUninforms(): IModelUniform; + buildModels(): IModel[]; +} +export interface IModelUniform { + [key: string]: IUniform; +} export interface IPickedFeature { x: number; @@ -59,6 +74,10 @@ export interface ILayer { }; multiPassRenderer: IMultiPassRenderer; styleAttributeService: IStyleAttributeService; + buildLayerModel( + options: ILayerModelInitializationOptions & + Partial, + ): IModel; init(): ILayer; size(field: StyleAttrField, value?: StyleAttributeOption): ILayer; color(field: StyleAttrField, value?: StyleAttributeOption): ILayer; diff --git a/packages/layers/src/core/BaseLayer.ts b/packages/layers/src/core/BaseLayer.ts index fcb90df68b..d429712f89 100644 --- a/packages/layers/src/core/BaseLayer.ts +++ b/packages/layers/src/core/BaseLayer.ts @@ -9,6 +9,8 @@ import { IInteractionService, ILayer, ILayerInitializationOptions, + ILayerModel, + ILayerModelInitializationOptions, ILayerPlugin, ILayerService, IMapService, @@ -38,13 +40,6 @@ import { SyncBailHook, SyncHook } from 'tapable'; import { normalizePasses } from '../plugins/MultiPassRendererPlugin'; import baseLayerSchema from './schema'; -export interface ILayerModelInitializationOptions { - moduleName: string; - vertexShader: string; - fragmentShader: string; - triangulation: Triangulation; -} - /** * 分配 layer id */ @@ -110,15 +105,15 @@ export default class BaseLayer extends EventEmitter public readonly configService: IGlobalConfigService; @lazyInject(TYPES.IIconService) - protected readonly iconService: IIconService; + public readonly iconService: IIconService; @lazyInject(TYPES.IFontService) - protected readonly fontService: IFontService; - - protected layerSource: Source; + public readonly fontService: IFontService; @lazyInject(TYPES.IRendererService) - protected readonly rendererService: IRendererService; + public readonly rendererService: IRendererService; + + protected layerSource: Source; @lazyInject(TYPES.IShaderModuleService) protected readonly shaderModuleService: IShaderModuleService; @@ -129,6 +124,8 @@ export default class BaseLayer extends EventEmitter @lazyInject(TYPES.ILayerService) protected readonly layerService: ILayerService; + protected layerModel: ILayerModel; + protected enodeOptions: { [type: string]: { field: StyleAttributeField; @@ -441,7 +438,7 @@ export default class BaseLayer extends EventEmitter this.interactionService.triggerHover({ x, y }); } - protected buildLayerModel( + public buildLayerModel( options: ILayerModelInitializationOptions & Partial, ): IModel { diff --git a/packages/layers/src/core/baseModel.ts b/packages/layers/src/core/baseModel.ts new file mode 100644 index 0000000000..78201d7479 --- /dev/null +++ b/packages/layers/src/core/baseModel.ts @@ -0,0 +1,55 @@ +import { + AttributeType, + gl, + IEncodeFeature, + IFontService, + IGlobalConfigService, + IIconService, + ILayer, + ILayerModel, + ILayerPlugin, + ILogService, + IMapService, + IModel, + IModelUniform, + IRendererService, + IStyleAttributeService, + lazyInject, + TYPES, +} from '@l7/core'; + +export default class BaseModel implements ILayerModel { + protected layer: ILayer; + + @lazyInject(TYPES.IGlobalConfigService) + protected readonly configService: IGlobalConfigService; + + @lazyInject(TYPES.IIconService) + protected readonly iconService: IIconService; + + @lazyInject(TYPES.IFontService) + protected readonly fontService: IFontService; + + @lazyInject(TYPES.IRendererService) + protected readonly rendererService: IRendererService; + + @lazyInject(TYPES.IMapService) + protected readonly map: IMapService; + + constructor(layer: ILayer) { + this.layer = layer; + this.registerBuiltinAttributes(); + } + + public getUninforms(): IModelUniform { + throw new Error('Method not implemented.'); + } + + public buildModels(): IModel[] { + throw new Error('Method not implemented.'); + } + + protected registerBuiltinAttributes() { + throw new Error('Method not implemented.'); + } +} diff --git a/packages/layers/src/core/triangulation.ts b/packages/layers/src/core/triangulation.ts index 97495b5bb9..896309f71f 100644 --- a/packages/layers/src/core/triangulation.ts +++ b/packages/layers/src/core/triangulation.ts @@ -1,5 +1,6 @@ import { IEncodeFeature } from '@l7/core'; import { aProjectFlat, lngLatToMeters } from '@l7/utils'; +import earcut from 'earcut'; import { vec3 } from 'gl-matrix'; import getNormals from '../utils/polylineNormal'; import extrudePolygon, { @@ -82,6 +83,18 @@ export function LineTriangulation(feature: IEncodeFeature) { }; } +export function polygonTriangulation(feature: IEncodeFeature) { + const { coordinates } = feature; + const flattengeo = earcut.flatten(coordinates as number[][][]); + const { vertices, dimensions, holes } = flattengeo; + + return { + indices: earcut(vertices, holes, dimensions), + vertices, + size: dimensions, + }; +} + export function PolygonExtrudeTriangulation(feature: IEncodeFeature) { const coordinates = feature.coordinates as IPosition[][]; const { positions, index, normals } = extrude_PolygonNormal( @@ -155,7 +168,7 @@ export function RasterImageTriangulation(feature: IEncodeFeature) { * @param segNum 弧线线段数 */ export function LineArcTriangulation(feature: IEncodeFeature) { - const segNum = 30; + const segNum = 20; const coordinates = feature.coordinates as IPosition[]; const positions = []; const indexArray = []; diff --git a/packages/layers/src/index.ts b/packages/layers/src/index.ts index e52676d63d..f638f93223 100644 --- a/packages/layers/src/index.ts +++ b/packages/layers/src/index.ts @@ -4,20 +4,15 @@ import HeatMapGrid3dLayer from './heatmap/gird3d'; import HeatMapGridLayer from './heatmap/grid'; import HeatMapLayer from './heatmap/heatmap'; import HeatMapHexagonLayer from './heatmap/hexagon'; -import ArcLineLayer from './line/arc'; -import Arc2DLineLayer from './line/arc2d'; -import Arc3DLineLayer from './line/arc3d'; + import DashLineLayer from './line/dash'; import LineLayer from './line/index'; -import Point3dLayer from './point/extrude'; -import PointLayer from './point/fill'; -import PointImageLayer from './point/image'; -import PointNormalLayer from './point/normal'; +import PointLayer from './point'; import TextLayer from './point/text'; // import Point from './point/point'; import PolygonLayer from './polygon'; -import Polygon3DLayer from './polygon/polygon3D'; +// import Polygon3DLayer from './polygon/polygon3D'; import ImageLayer from './raster/image'; import RasterLayer from './raster/raster'; import Raster2DLayer from './raster/raster2d'; @@ -83,19 +78,13 @@ export { BaseLayer, PointLayer, PolygonLayer, - Point3dLayer, - PointImageLayer, LineLayer, DashLineLayer, - Polygon3DLayer, + // Polygon3DLayer, ImageLayer, - ArcLineLayer, - Arc2DLineLayer, - Arc3DLineLayer, RasterLayer, HeatMapLayer, TextLayer, - PointNormalLayer, HeatMapGrid3dLayer, HeatMapHexagonLayer, HeatMapGridLayer, diff --git a/packages/layers/src/line/index.ts b/packages/layers/src/line/index.ts index 66a8e3f3bf..a7f431164a 100644 --- a/packages/layers/src/line/index.ts +++ b/packages/layers/src/line/index.ts @@ -1,8 +1,6 @@ import { AttributeType, gl, IEncodeFeature, ILayer } from '@l7/core'; import BaseLayer from '../core/BaseLayer'; -import { LineTriangulation } from '../core/triangulation'; -import line_frag from './shaders/line_frag.glsl'; -import line_vert from './shaders/line_vert.glsl'; +import LineModels, { LineModelType } from './models'; interface IPointLayerStyleOptions { opacity: number; } @@ -24,129 +22,24 @@ export default class LineLayer extends BaseLayer { } protected renderModels() { - const { - enable, - interval = 0.2, - trailLength = 0.2, - duration = 2, - } = this.animateOptions; - const animate = enable ? 1 : 0; - const { opacity } = this.getStyleOptions(); this.models.forEach((model) => model.draw({ - uniforms: { - u_opacity: opacity || 1.0, - u_time: - this.layerService.clock.getElapsedTime() - this.animateStartTime, - u_animate: [animate, duration, interval, trailLength], - }, + uniforms: this.layerModel.getUninforms(), }), ); return this; } protected buildModels() { - this.registerBuiltinAttributes(this); - this.models = [ - this.buildLayerModel({ - moduleName: 'line', - vertexShader: line_vert, - fragmentShader: line_frag, - triangulation: LineTriangulation, - blend: { - enable: true, - func: { - srcRGB: gl.SRC_ALPHA, - srcAlpha: 1, - dstRGB: gl.ONE_MINUS_SRC_ALPHA, - dstAlpha: 1, - }, - }, - }), - ]; - // this.initAnimate(); + const shape = this.getModelType(); + this.layerModel = new LineModels[shape](this); + this.models = this.layerModel.buildModels(); } - - private registerBuiltinAttributes(layer: ILayer) { - // point layer size; - layer.styleAttributeService.registerStyleAttribute({ - name: 'size', - type: AttributeType.Attribute, - descriptor: { - name: 'a_Size', - buffer: { - // give the WebGL driver a hint that this buffer may change - usage: gl.DYNAMIC_DRAW, - data: [], - type: gl.FLOAT, - }, - size: 2, - update: ( - feature: IEncodeFeature, - featureIdx: number, - vertex: number[], - attributeIdx: number, - ) => { - const { size } = feature; - return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0]; - }, - }, - }); - - // point layer size; - layer.styleAttributeService.registerStyleAttribute({ - name: 'normal', - type: AttributeType.Attribute, - descriptor: { - name: 'a_Normal', - buffer: { - // give the WebGL driver a hint that this buffer may change - usage: gl.STATIC_DRAW, - data: [], - type: gl.FLOAT, - }, - size: 3, - update: ( - feature: IEncodeFeature, - featureIdx: number, - vertex: number[], - attributeIdx: number, - normal: number[], - ) => { - return normal; - }, - }, - }); - - layer.styleAttributeService.registerStyleAttribute({ - name: 'miter', - type: AttributeType.Attribute, - descriptor: { - name: 'a_Miter', - buffer: { - // give the WebGL driver a hint that this buffer may change - usage: gl.DYNAMIC_DRAW, - data: [], - type: gl.FLOAT, - }, - size: 1, - update: ( - feature: IEncodeFeature, - featureIdx: number, - vertex: number[], - attributeIdx: number, - ) => { - return [vertex[4]]; - }, - }, - }); - } - // 拆分的动画插件 - private initAnimate() { - const { enable } = this.animateOptions; - if (enable) { - this.layerService.startAnimate(); - this.animateStartTime = this.layerService.clock.getElapsedTime(); - } + private getModelType(): LineModelType { + const shapeAttribute = this.styleAttributeService.getLayerStyleAttribute( + 'shape', + ); + const shape = shapeAttribute?.scale?.field as LineModelType; + return shape || 'line'; } } diff --git a/packages/layers/src/line/arc.ts b/packages/layers/src/line/models/arc.ts similarity index 58% rename from packages/layers/src/line/arc.ts rename to packages/layers/src/line/models/arc.ts index aa325cfc13..ef8a5816f7 100644 --- a/packages/layers/src/line/arc.ts +++ b/packages/layers/src/line/models/arc.ts @@ -1,46 +1,39 @@ -import { AttributeType, gl, IEncodeFeature, ILayer } from '@l7/core'; -import BaseLayer from '../core/BaseLayer'; -import { LineArcTriangulation } from '../core/triangulation'; -import line_arc_frag from './shaders/line_arc_frag.glsl'; -import line_arc2d_vert from './shaders/line_bezier_vert.glsl'; +import { + AttributeType, + gl, + IEncodeFeature, + ILayer, + ILayerModel, + IModel, + IModelUniform, +} from '@l7/core'; + +import BaseModel from '../../core/baseModel'; +import { LineArcTriangulation } from '../../core/triangulation'; +import line_arc_frag from '../shaders/line_arc_frag.glsl'; +import line_arc2d_vert from '../shaders/line_bezier_vert.glsl'; + interface IArcLayerStyleOptions { opacity: number; segmentNumber: number; blur: number; } -export default class ArcLineLayer extends BaseLayer { - public name: string = 'LineLayer'; - - protected getConfigSchema() { +export default class ArcModel extends BaseModel { + public getUninforms(): IModelUniform { + const { + opacity, + blur = 0.99, + } = this.layer.getStyleOptions() as IArcLayerStyleOptions; return { - properties: { - opacity: { - type: 'number', - minimum: 0, - maximum: 1, - }, - }, + u_opacity: opacity || 1, + segmentNumber: 30, + u_blur: blur, }; } - protected renderModels() { - const { opacity, blur = 0.99 } = this.getStyleOptions(); - this.models.forEach((model) => - model.draw({ - uniforms: { - u_opacity: opacity || 1, - segmentNumber: 30, - u_blur: blur, - }, - }), - ); - return this; - } - - protected buildModels() { - this.registerBuiltinAttributes(this); - this.models = [ - this.buildLayerModel({ + public buildModels(): IModel[] { + return [ + this.layer.buildLayerModel({ moduleName: 'arc2dline', vertexShader: line_arc2d_vert, fragmentShader: line_arc_frag, @@ -59,9 +52,9 @@ export default class ArcLineLayer extends BaseLayer { ]; } - private registerBuiltinAttributes(layer: ILayer) { + protected registerBuiltinAttributes() { // point layer size; - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'size', type: AttributeType.Attribute, descriptor: { @@ -85,7 +78,7 @@ export default class ArcLineLayer extends BaseLayer { }, }); - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'instance', // 弧线起始点信息 type: AttributeType.Attribute, descriptor: { diff --git a/packages/layers/src/line/arc3d.ts b/packages/layers/src/line/models/arc_3d.ts similarity index 58% rename from packages/layers/src/line/arc3d.ts rename to packages/layers/src/line/models/arc_3d.ts index 369ca56356..5c3ff2bd72 100644 --- a/packages/layers/src/line/arc3d.ts +++ b/packages/layers/src/line/models/arc_3d.ts @@ -1,44 +1,33 @@ -import { AttributeType, gl, IEncodeFeature, ILayer } from '@l7/core'; -import BaseLayer from '../core/BaseLayer'; -import { LineArcTriangulation } from '../core/triangulation'; -import line_arc_frag from './shaders/line_arc_frag.glsl'; -import line_arc_vert from './shaders/line_arc_vert.glsl'; +import { + AttributeType, + gl, + IEncodeFeature, + ILayer, + ILayerModel, + IModel, + IModelUniform, +} from '@l7/core'; +import BaseModel from '../../core/baseModel'; +import { LineArcTriangulation } from '../../core/triangulation'; +import line_arc_frag from '../shaders/line_arc_frag.glsl'; +import line_arc_vert from '../shaders/line_arc_vert.glsl'; + interface IArcLayerStyleOptions { opacity: number; segmentNumber: number; } -export default class Arc3DLineLayer extends BaseLayer { - public name: string = 'LineLayer'; - - protected getConfigSchema() { +export default class Arc3DModel extends BaseModel { + public getUninforms(): IModelUniform { + const { opacity } = this.layer.getStyleOptions() as IArcLayerStyleOptions; return { - properties: { - opacity: { - type: 'number', - minimum: 0, - maximum: 1, - }, - }, + u_opacity: opacity || 1, + segmentNumber: 30, }; } - protected renderModels() { - const { opacity } = this.getStyleOptions(); - this.models.forEach((model) => - model.draw({ - uniforms: { - u_opacity: opacity || 1, - segmentNumber: 30, - }, - }), - ); - return this; - } - - protected buildModels() { - this.registerBuiltinAttributes(this); - this.models = [ - this.buildLayerModel({ + public buildModels(): IModel[] { + return [ + this.layer.buildLayerModel({ moduleName: 'arcline', vertexShader: line_arc_vert, fragmentShader: line_arc_frag, @@ -55,10 +44,9 @@ export default class Arc3DLineLayer extends BaseLayer { }), ]; } - - private registerBuiltinAttributes(layer: ILayer) { + protected registerBuiltinAttributes() { // point layer size; - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'size', type: AttributeType.Attribute, descriptor: { @@ -82,7 +70,7 @@ export default class Arc3DLineLayer extends BaseLayer { }, }); - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'instance', // 弧线起始点信息 type: AttributeType.Attribute, descriptor: { diff --git a/packages/layers/src/line/models/dash.ts b/packages/layers/src/line/models/dash.ts new file mode 100644 index 0000000000..7aa44a4dbc --- /dev/null +++ b/packages/layers/src/line/models/dash.ts @@ -0,0 +1,22 @@ +import { + AttributeType, + gl, + IEncodeFeature, + ILayer, + ILayerModel, + IModel, +} from '@l7/core'; + +import BaseModel from '../../core/baseModel'; +export default class ArcModel extends BaseModel { + public getUninforms() { + throw new Error('Method not implemented.'); + } + + public buildModels(): IModel[] { + throw new Error('Method not implemented.'); + } + private registerBuiltinAttributes() { + throw new Error('Method not implemented.'); + } +} diff --git a/packages/layers/src/line/arc2d.ts b/packages/layers/src/line/models/great_circle.ts similarity index 58% rename from packages/layers/src/line/arc2d.ts rename to packages/layers/src/line/models/great_circle.ts index c35b23edba..5a990694e5 100644 --- a/packages/layers/src/line/arc2d.ts +++ b/packages/layers/src/line/models/great_circle.ts @@ -1,48 +1,39 @@ -import { AttributeType, gl, IEncodeFeature, ILayer } from '@l7/core'; -import BaseLayer from '../core/BaseLayer'; -import { LineArcTriangulation } from '../core/triangulation'; -import line_arc2d_vert from './shaders/line_arc2d_vert.glsl'; -import line_arc_frag from './shaders/line_arc_frag.glsl'; +import { + AttributeType, + gl, + IEncodeFeature, + ILayer, + ILayerModel, + IModel, + IModelUniform, +} from '@l7/core'; + +import BaseModel from '../../core/baseModel'; +import { LineArcTriangulation } from '../../core/triangulation'; +import line_arc2d_vert from '../shaders/line_arc2d_vert.glsl'; +import line_arc_frag from '../shaders/line_arc_frag.glsl'; + interface IArcLayerStyleOptions { opacity: number; segmentNumber: number; blur: number; } -export default class ArcCircleLineLayer extends BaseLayer< - IArcLayerStyleOptions -> { - public name: string = 'LineLayer'; - - protected getConfigSchema() { +export default class GreatCircleModel extends BaseModel { + public getUninforms(): IModelUniform { + const { + opacity, + blur = 0.99, + } = this.layer.getStyleOptions() as IArcLayerStyleOptions; return { - properties: { - opacity: { - type: 'number', - minimum: 0, - maximum: 1, - }, - }, + u_opacity: opacity || 1, + segmentNumber: 30, + u_blur: blur, }; } - protected renderModels() { - const { opacity, blur = 0.99 } = this.getStyleOptions(); - this.models.forEach((model) => - model.draw({ - uniforms: { - u_opacity: opacity || 1, - segmentNumber: 30, - u_blur: blur, - }, - }), - ); - return this; - } - - protected buildModels() { - this.registerBuiltinAttributes(this); - this.models = [ - this.buildLayerModel({ + public buildModels(): IModel[] { + return [ + this.layer.buildLayerModel({ moduleName: 'arc2dline', vertexShader: line_arc2d_vert, fragmentShader: line_arc_frag, @@ -60,10 +51,9 @@ export default class ArcCircleLineLayer extends BaseLayer< }), ]; } - - private registerBuiltinAttributes(layer: ILayer) { + protected registerBuiltinAttributes() { // point layer size; - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'size', type: AttributeType.Attribute, descriptor: { @@ -87,7 +77,7 @@ export default class ArcCircleLineLayer extends BaseLayer< }, }); - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'instance', // 弧线起始点信息 type: AttributeType.Attribute, descriptor: { diff --git a/packages/layers/src/line/models/index.ts b/packages/layers/src/line/models/index.ts new file mode 100644 index 0000000000..54a3a124e8 --- /dev/null +++ b/packages/layers/src/line/models/index.ts @@ -0,0 +1,15 @@ +import ArcModel from './arc'; +import Arc3DModel from './arc_3d'; +import GreatCircleModel from './great_circle'; +import LineModel from './line'; + +export type LineModelType = 'arc' | 'arc3d' | 'greatcircle' | 'line'; + +const LineModels: { [key in LineModelType]: any } = { + arc: ArcModel, + arc3d: Arc3DModel, + greatcircle: GreatCircleModel, + line: LineModel, +}; + +export default LineModels; diff --git a/packages/layers/src/line/models/line.ts b/packages/layers/src/line/models/line.ts new file mode 100644 index 0000000000..c4c8bcd0c3 --- /dev/null +++ b/packages/layers/src/line/models/line.ts @@ -0,0 +1,120 @@ +import { + AttributeType, + gl, + IEncodeFeature, + ILayer, + ILayerModel, + IModel, + IModelUniform, +} from '@l7/core'; + +import BaseModel from '../../core/baseModel'; +import { LineTriangulation } from '../../core/triangulation'; +import line_frag from '../shaders/line_frag.glsl'; +import line_vert from '../shaders/line_vert.glsl'; + +interface ILineLayerStyleOptions { + opacity: number; +} +export default class LineModel extends BaseModel { + public getUninforms(): IModelUniform { + const { opacity } = this.layer.getStyleOptions() as ILineLayerStyleOptions; + return { + u_opacity: opacity || 1.0, + }; + } + + public buildModels(): IModel[] { + return [ + this.layer.buildLayerModel({ + moduleName: 'line', + vertexShader: line_vert, + fragmentShader: line_frag, + triangulation: LineTriangulation, + blend: { + enable: true, + func: { + srcRGB: gl.SRC_ALPHA, + srcAlpha: 1, + dstRGB: gl.ONE_MINUS_SRC_ALPHA, + dstAlpha: 1, + }, + }, + }), + ]; + } + protected registerBuiltinAttributes() { + // point layer size; + this.layer.styleAttributeService.registerStyleAttribute({ + name: 'size', + type: AttributeType.Attribute, + descriptor: { + name: 'a_Size', + buffer: { + // give the WebGL driver a hint that this buffer may change + usage: gl.DYNAMIC_DRAW, + data: [], + type: gl.FLOAT, + }, + size: 2, + update: ( + feature: IEncodeFeature, + featureIdx: number, + vertex: number[], + attributeIdx: number, + ) => { + const { size } = feature; + return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0]; + }, + }, + }); + + // point layer size; + this.layer.styleAttributeService.registerStyleAttribute({ + name: 'normal', + type: AttributeType.Attribute, + descriptor: { + name: 'a_Normal', + buffer: { + // give the WebGL driver a hint that this buffer may change + usage: gl.STATIC_DRAW, + data: [], + type: gl.FLOAT, + }, + size: 3, + update: ( + feature: IEncodeFeature, + featureIdx: number, + vertex: number[], + attributeIdx: number, + normal: number[], + ) => { + return normal; + }, + }, + }); + + this.layer.styleAttributeService.registerStyleAttribute({ + name: 'miter', + type: AttributeType.Attribute, + descriptor: { + name: 'a_Miter', + buffer: { + // give the WebGL driver a hint that this buffer may change + usage: gl.DYNAMIC_DRAW, + data: [], + type: gl.FLOAT, + }, + size: 1, + update: ( + feature: IEncodeFeature, + featureIdx: number, + vertex: number[], + attributeIdx: number, + ) => { + return [vertex[4]]; + }, + }, + }); + } +} diff --git a/packages/layers/src/point/buffers/ExtrudeBuffer.ts b/packages/layers/src/point/buffers/ExtrudeBuffer.ts deleted file mode 100644 index f0cd0d8d1a..0000000000 --- a/packages/layers/src/point/buffers/ExtrudeBuffer.ts +++ /dev/null @@ -1,79 +0,0 @@ -// import BaseBuffer, { -// IBufferInfo, -// IEncodeFeature, -// Position, -// } from '../../core/BaseBuffer'; -// import extrudePolygon, { IExtrudeGeomety } from '../shape/extrude'; -// import { geometryShape, ShapeType2D, ShapeType3D } from '../shape/Path'; -// interface IGeometryCache { -// [key: string]: IExtrudeGeomety; -// } -// export default class ExtrudeBuffer extends BaseBuffer { -// private indexOffset: number = 0; -// private verticesOffset: number = 0; -// private geometryCache: IGeometryCache; -// public buildFeatures() { -// const layerData = this.data as IEncodeFeature[]; -// layerData.forEach((feature: IEncodeFeature) => { -// this.calculateFill(feature); -// }); -// } - -// protected calculateFeatures() { -// const layerData = this.data as IEncodeFeature[]; -// this.geometryCache = {}; -// this.verticesOffset = 0; -// this.indexOffset = 0; -// layerData.forEach((feature: IEncodeFeature) => { -// const { shape } = feature; -// const { positions, index } = this.getGeometry(shape as ShapeType3D); -// this.verticesCount += positions.length / 3; -// this.indexCount += index.length; -// }); -// } -// protected initAttributes() { -// super.initAttributes(); -// this.attributes.miters = new Float32Array(this.verticesCount * 3); -// this.attributes.normals = new Float32Array(this.verticesCount * 3); -// this.attributes.sizes = new Float32Array(this.verticesCount * 3); -// } -// private calculateFill(feature: IEncodeFeature) { -// const { coordinates, shape } = feature; -// const instanceGeometry = this.getGeometry(shape as ShapeType3D); -// const numPoint = instanceGeometry.positions.length / 3; -// feature.bufferInfo = { -// verticesOffset: this.verticesOffset, -// indexOffset: this.indexOffset, -// dimensions: 3, -// }; -// this.encodeArray(feature, numPoint); -// this.attributes.miters.set( -// instanceGeometry.positions, -// this.verticesOffset * 3, -// ); -// const indexArray = instanceGeometry.index.map((v) => { -// return v + this.verticesOffset; -// }); -// this.indexArray.set(indexArray, this.indexOffset); -// const position: number[] = []; -// for (let i = 0; i < numPoint; i++) { -// const coor = coordinates as Position; -// position.push(coor[0], coor[1], coor[2] || 0); -// } -// this.attributes.positions.set(position, this.verticesOffset * 3); -// this.verticesOffset += numPoint; -// this.indexOffset += indexArray.length; -// } - -// private getGeometry(shape: ShapeType3D): IExtrudeGeomety { -// if (this.geometryCache && this.geometryCache[shape]) { -// return this.geometryCache[shape]; -// } -// const path = geometryShape[shape] -// ? geometryShape[shape]() -// : geometryShape.cylinder(); -// const geometry = extrudePolygon([path]); -// this.geometryCache[shape] = geometry; -// return geometry; -// } -// } diff --git a/packages/layers/src/point/buffers/ImageBuffer.ts b/packages/layers/src/point/buffers/ImageBuffer.ts deleted file mode 100644 index 03aef61af5..0000000000 --- a/packages/layers/src/point/buffers/ImageBuffer.ts +++ /dev/null @@ -1,22 +0,0 @@ -// import BaseBuffer, { IEncodeFeature, Position } from '../../core/BaseBuffer'; -// export default class ImageBuffer extends BaseBuffer { -// protected calculateFeatures() { -// const layerData = this.data as IEncodeFeature[]; -// this.verticesCount = layerData.length; -// this.indexCount = layerData.length; -// } -// protected buildFeatures() { -// const layerData = this.data as IEncodeFeature[]; -// this.attributes.uv = new Float32Array(this.verticesCount * 2); -// layerData.forEach((item: IEncodeFeature, index: number) => { -// const { color = [0, 0, 0, 0], size, id, shape, coordinates } = item; -// const { x, y } = this.iconMap[shape as string] || { x: 0, y: 0 }; -// const coor = coordinates as Position; -// this.attributes.positions.set(coor, index * 3); -// this.attributes.colors.set(color, index * 4); -// this.attributes.pickingIds.set([id as number], index); -// this.attributes.sizes.set([size as number], index); // -// this.attributes.uv.set([x, y], index * 2); -// }); -// } -// } diff --git a/packages/layers/src/point/index.ts b/packages/layers/src/point/index.ts index 5ff8f0ff9a..d2a556c092 100644 --- a/packages/layers/src/point/index.ts +++ b/packages/layers/src/point/index.ts @@ -1,18 +1,6 @@ -import { - AttributeType, - gl, - IEncodeFeature, - ILayer, - ILayerPlugin, - ILogService, - IStyleAttributeService, - lazyInject, - TYPES, -} from '@l7/core'; +import { IEncodeFeature } from '@l7/core'; import BaseLayer from '../core/BaseLayer'; -import { rgb2arr } from '../utils/color'; -import pointFillFrag from './shaders/fill_frag.glsl'; -import pointFillVert from './shaders/fill_vert.glsl'; +import PointModels, { PointType } from './models/index'; interface IPointLayerStyleOptions { opacity: number; strokeWidth: number; @@ -20,7 +8,6 @@ interface IPointLayerStyleOptions { } export default class PointLayer extends BaseLayer { public name: string = 'PointLayer'; - protected getConfigSchema() { return { properties: { @@ -32,4 +19,44 @@ export default class PointLayer extends BaseLayer { }, }; } + protected renderModels() { + this.models.forEach((model) => + model.draw({ + uniforms: this.layerModel.getUninforms(), + }), + ); + return this; + } + + protected buildModels() { + const modelType = this.getModelType(); + this.layerModel = new PointModels[modelType](this); + this.models = this.layerModel.buildModels(); + } + + private getModelType(): PointType { + // pointlayer + // 2D、 3d、 shape、image、text、normal、 + const layerData = this.getEncodedData(); + const { shape2d, shape3d } = this.configService.getConfig(); + const iconMap = this.iconService.getIconMap(); + const item = layerData.find((fe: IEncodeFeature) => { + return fe.hasOwnProperty('shape'); + }); + if (!item) { + return 'normal'; + } else { + const shape = item.shape; + if (shape2d?.indexOf(shape as string) !== -1) { + return 'fill'; + } + if (shape3d?.indexOf(shape as string) !== -1) { + return 'extrude'; + } + if (iconMap.hasOwnProperty(shape as string)) { + return 'image'; + } + return 'text'; + } + } } diff --git a/packages/layers/src/point/extrude.ts b/packages/layers/src/point/models/extrude.ts similarity index 68% rename from packages/layers/src/point/extrude.ts rename to packages/layers/src/point/models/extrude.ts index 82d4cf7ce3..0b7495f7b1 100644 --- a/packages/layers/src/point/extrude.ts +++ b/packages/layers/src/point/models/extrude.ts @@ -1,42 +1,29 @@ -import { AttributeType, gl, IEncodeFeature, ILayer } from '@l7/core'; -import BaseLayer from '../core/BaseLayer'; -import { PointExtrudeTriangulation } from '../core/triangulation'; -import pointExtrudeFrag from './shaders/extrude_frag.glsl'; -import pointExtrudeVert from './shaders/extrude_vert.glsl'; +import { + AttributeType, + gl, + IEncodeFeature, + ILayer, + ILayerModel, + IModel, +} from '@l7/core'; +import BaseModel from '../../core/baseModel'; +import { PointExtrudeTriangulation } from '../../core/triangulation'; +import pointExtrudeFrag from '../shaders/extrude_frag.glsl'; +import pointExtrudeVert from '../shaders/extrude_vert.glsl'; interface IPointLayerStyleOptions { opacity: number; } -export default class PointLayer extends BaseLayer { - public name: string = 'PointLayer'; - - protected getConfigSchema() { +export default class ExtrudeModel extends BaseModel { + public getUninforms() { + const { opacity } = this.layer.getStyleOptions() as IPointLayerStyleOptions; return { - properties: { - opacity: { - type: 'number', - minimum: 0, - maximum: 1, - }, - }, + u_opacity: opacity || 1.0, }; } - protected renderModels() { - const { opacity } = this.getStyleOptions(); - this.models.forEach((model) => - model.draw({ - uniforms: { - u_opacity: opacity || 1.0, - }, - }), - ); - return this; - } - - protected buildModels() { - this.registerBuiltinAttributes(this); - this.models = [ - this.buildLayerModel({ + public buildModels(): IModel[] { + return [ + this.layer.buildLayerModel({ moduleName: 'pointExtrude', vertexShader: pointExtrudeVert, fragmentShader: pointExtrudeFrag, @@ -53,10 +40,9 @@ export default class PointLayer extends BaseLayer { }), ]; } - - private registerBuiltinAttributes(layer: ILayer) { + protected registerBuiltinAttributes() { // point layer size; - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'size', type: AttributeType.Attribute, descriptor: { @@ -93,7 +79,7 @@ export default class PointLayer extends BaseLayer { }); // point layer size; - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'normal', type: AttributeType.Attribute, descriptor: { @@ -116,7 +102,7 @@ export default class PointLayer extends BaseLayer { }, }, }); - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'pos', type: AttributeType.Attribute, descriptor: { diff --git a/packages/layers/src/point/fill.ts b/packages/layers/src/point/models/fill.ts similarity index 61% rename from packages/layers/src/point/fill.ts rename to packages/layers/src/point/models/fill.ts index a94fefbe69..2a1277a9b3 100644 --- a/packages/layers/src/point/fill.ts +++ b/packages/layers/src/point/models/fill.ts @@ -3,78 +3,52 @@ import { gl, IEncodeFeature, ILayer, + ILayerModel, ILayerPlugin, ILogService, + IModel, IStyleAttributeService, lazyInject, TYPES, } from '@l7/core'; -import BaseLayer from '../core/BaseLayer'; -import { rgb2arr } from '../utils/color'; -import pointFillFrag from './shaders/fill_frag.glsl'; -import pointFillVert from './shaders/fill_vert.glsl'; +import BaseModel from '../../core/baseModel'; +import { PointFillTriangulation } from '../../core/triangulation'; +import { rgb2arr } from '../../utils/color'; +import pointFillFrag from '../shaders/fill_frag.glsl'; +import pointFillVert from '../shaders/fill_vert.glsl'; interface IPointLayerStyleOptions { opacity: number; strokeWidth: number; strokeColor: string; } -export function PointTriangulation(feature: IEncodeFeature) { - const coordinates = feature.coordinates as number[]; - return { - vertices: [...coordinates, ...coordinates, ...coordinates, ...coordinates], - extrude: [-1, -1, 1, -1, 1, 1, -1, 1], - indices: [0, 1, 2, 2, 3, 0], - size: coordinates.length, - }; -} -export default class PointLayer extends BaseLayer { - public name: string = 'PointLayer'; - - protected getConfigSchema() { - return { - properties: { - opacity: { - type: 'number', - minimum: 0, - maximum: 1, - }, - }, - }; - } - - protected renderModels() { +export default class FillModel extends BaseModel { + public getUninforms() { const { opacity = 1, strokeColor = 'rgb(0,0,0,0)', strokeWidth = 1, - } = this.getStyleOptions(); - this.models.forEach((model) => - model.draw({ - uniforms: { - u_opacity: opacity, - u_stroke_width: strokeWidth, - u_stroke_color: rgb2arr(strokeColor), - }, - }), - ); - return this; + } = this.layer.getStyleOptions() as IPointLayerStyleOptions; + return { + u_opacity: opacity, + u_stroke_width: strokeWidth, + u_stroke_color: rgb2arr(strokeColor), + }; } - protected buildModels() { - this.registerBuiltinAttributes(this); - this.models = [ - this.buildLayerModel({ + public buildModels(): IModel[] { + return [ + this.layer.buildLayerModel({ moduleName: 'pointfill', vertexShader: pointFillVert, fragmentShader: pointFillFrag, - triangulation: PointTriangulation, + triangulation: PointFillTriangulation, depth: { enable: false }, }), ]; } - private registerBuiltinAttributes(layer: ILayer) { - layer.styleAttributeService.registerStyleAttribute({ + protected registerBuiltinAttributes() { + this.layer.styleAttributeService.registerStyleAttribute({ name: 'extrude', type: AttributeType.Attribute, descriptor: { @@ -100,7 +74,7 @@ export default class PointLayer extends BaseLayer { }); // point layer size; - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'size', type: AttributeType.Attribute, descriptor: { @@ -125,7 +99,7 @@ export default class PointLayer extends BaseLayer { }); // point layer size; - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'shape', type: AttributeType.Attribute, descriptor: { @@ -144,7 +118,8 @@ export default class PointLayer extends BaseLayer { attributeIdx: number, ) => { const { shape = 2 } = feature; - const shape2d = layer.configService.getConfig().shape2d as string[]; + const shape2d = this.layer.configService.getConfig() + .shape2d as string[]; const shapeIndex = shape2d.indexOf(shape as string); return [shapeIndex]; }, diff --git a/packages/layers/src/point/image.ts b/packages/layers/src/point/models/image.ts similarity index 58% rename from packages/layers/src/point/image.ts rename to packages/layers/src/point/models/image.ts index 0112f7be08..569b7935d6 100644 --- a/packages/layers/src/point/image.ts +++ b/packages/layers/src/point/models/image.ts @@ -3,73 +3,44 @@ import { gl, IEncodeFeature, ILayer, - ILayerPlugin, - ILogService, - IStyleAttributeService, + ILayerModel, + IModel, ITexture2D, - lazyInject, - TYPES, } from '@l7/core'; -import BaseLayer from '../core/BaseLayer'; -import { PointImageTriangulation } from '../core/triangulation'; -import pointImageFrag from './shaders/image_frag.glsl'; -import pointImageVert from './shaders/image_vert.glsl'; + +import BaseModel from '../../core/baseModel'; +import { PointImageTriangulation } from '../../core/triangulation'; +import pointImageFrag from '../shaders/image_frag.glsl'; +import pointImageVert from '../shaders/image_vert.glsl'; interface IPointLayerStyleOptions { opacity: number; } -export function PointTriangulation(feature: IEncodeFeature) { - const coordinates = feature.coordinates as number[]; - return { - vertices: [...coordinates, ...coordinates, ...coordinates, ...coordinates], - extrude: [-1, -1, 1, -1, 1, 1, -1, 1], - indices: [0, 1, 2, 2, 3, 0], - size: coordinates.length, - }; -} -export default class PointLayer extends BaseLayer { - public name: string = 'PointLayer'; + +export default class ImageModel extends BaseModel { private texture: ITexture2D; - protected getConfigSchema() { + + public getUninforms() { + const { opacity } = this.layer.getStyleOptions() as IPointLayerStyleOptions; return { - properties: { - opacity: { - type: 'number', - minimum: 0, - maximum: 1, - }, - }, + u_opacity: opacity || 1.0, + u_texture: this.texture, + u_textSize: [1024, this.iconService.canvasHeight || 128], }; } - protected renderModels() { - const { opacity } = this.getStyleOptions(); - const { createTexture2D } = this.rendererService; - this.models.forEach((model) => - model.draw({ - uniforms: { - u_opacity: opacity || 1.0, - u_texture: this.texture, - u_textSize: [1024, this.iconService.canvasHeight || 128], - }, - }), - ); - - return this; - } - - protected buildModels() { - this.registerBuiltinAttributes(this); + public buildModels(): IModel[] { + this.registerBuiltinAttributes(); this.updateTexture(); this.iconService.on('imageUpdate', () => { this.updateTexture(); - this.renderModels(); + this.layer.render(); // TODO 调用全局render }); - this.models = [ - this.buildLayerModel({ + return [ + this.layer.buildLayerModel({ moduleName: 'pointImage', vertexShader: pointImageVert, fragmentShader: pointImageFrag, - triangulation: PointTriangulation, + triangulation: PointImageTriangulation, primitive: gl.POINTS, depth: { enable: false }, blend: { @@ -85,9 +56,9 @@ export default class PointLayer extends BaseLayer { ]; } - private registerBuiltinAttributes(layer: ILayer) { + protected registerBuiltinAttributes() { // point layer size; - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'size', type: AttributeType.Attribute, descriptor: { @@ -112,7 +83,7 @@ export default class PointLayer extends BaseLayer { }); // point layer size; - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'uv', type: AttributeType.Attribute, descriptor: { @@ -139,6 +110,7 @@ export default class PointLayer extends BaseLayer { }, }); } + private updateTexture() { const { createTexture2D } = this.rendererService; this.texture = createTexture2D({ diff --git a/packages/layers/src/point/models/index.ts b/packages/layers/src/point/models/index.ts new file mode 100644 index 0000000000..8dd5b347a6 --- /dev/null +++ b/packages/layers/src/point/models/index.ts @@ -0,0 +1,17 @@ +import { ILayerModel } from '@l7/core'; +import ExtrudeModel from './extrude'; +import FillModel from './fill'; +import IMageModel from './image'; +import NormalModel from './normal'; + +export type PointType = 'fill' | 'image' | 'normal' | 'extrude' | 'text'; + +const PointModels: { [key in PointType]: any } = { + fill: FillModel, + image: IMageModel, + normal: NormalModel, + extrude: ExtrudeModel, + text: null, +}; + +export default PointModels; diff --git a/packages/layers/src/point/normal.ts b/packages/layers/src/point/models/normal.ts similarity index 58% rename from packages/layers/src/point/normal.ts rename to packages/layers/src/point/models/normal.ts index 85c725619b..1d4dd89172 100644 --- a/packages/layers/src/point/normal.ts +++ b/packages/layers/src/point/models/normal.ts @@ -3,16 +3,15 @@ import { gl, IEncodeFeature, ILayer, - ILayerPlugin, - ILogService, - IStyleAttributeService, - lazyInject, - TYPES, + ILayerModel, + IModel, } from '@l7/core'; -import BaseLayer from '../core/BaseLayer'; -import { rgb2arr } from '../utils/color'; -import normalFrag from './shaders/normal_frag.glsl'; -import normalVert from './shaders/normal_vert.glsl'; + +import BaseModel from '../../core/baseModel'; +import { rgb2arr } from '../../utils/color'; +import normalFrag from '../shaders/normal_frag.glsl'; +import normalVert from '../shaders/normal_vert.glsl'; + interface IPointLayerStyleOptions { opacity: number; strokeWidth: number; @@ -26,45 +25,24 @@ export function PointTriangulation(feature: IEncodeFeature) { size: coordinates.length, }; } -export default class PointNormalLayer extends BaseLayer< - IPointLayerStyleOptions -> { - public name: string = 'PointLayer'; - protected getConfigSchema() { - return { - properties: { - opacity: { - type: 'number', - minimum: 0, - maximum: 1, - }, - }, - }; - } - - protected renderModels() { +export default class NormalModel extends BaseModel { + public getUninforms() { const { opacity = 1, strokeColor = 'rgb(0,0,0,0)', strokeWidth = 1, - } = this.getStyleOptions(); - this.models.forEach((model) => - model.draw({ - uniforms: { - u_opacity: opacity, - u_stroke_width: strokeWidth, - u_stroke_color: rgb2arr(strokeColor), - }, - }), - ); - return this; + } = this.layer.getStyleOptions() as IPointLayerStyleOptions; + return { + u_opacity: opacity, + u_stroke_width: strokeWidth, + u_stroke_color: rgb2arr(strokeColor), + }; } - protected buildModels() { - this.registerBuiltinAttributes(this); - this.models = [ - this.buildLayerModel({ + public buildModels(): IModel[] { + return [ + this.layer.buildLayerModel({ moduleName: 'normalpoint', vertexShader: normalVert, fragmentShader: normalFrag, @@ -84,9 +62,9 @@ export default class PointNormalLayer extends BaseLayer< ]; } - private registerBuiltinAttributes(layer: ILayer) { + protected registerBuiltinAttributes() { // point layer size; - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'size', type: AttributeType.Attribute, descriptor: { diff --git a/packages/layers/src/point/models/text.ts b/packages/layers/src/point/models/text.ts new file mode 100644 index 0000000000..202557d9e5 --- /dev/null +++ b/packages/layers/src/point/models/text.ts @@ -0,0 +1,30 @@ +import { + AttributeType, + gl, + IEncodeFeature, + ILayer, + ILayerModel, + IModel, +} from '@l7/core'; +import BaseLayer from '../core/BaseLayer'; +import { PointExtrudeTriangulation } from '../core/triangulation'; +import pointExtrudeFrag from './shaders/extrude_frag.glsl'; +import pointExtrudeVert from './shaders/extrude_vert.glsl'; + +export default class ExtrudeModel implements ILayerModel { + private layer: ILayer; + constructor(layer: ILayer) { + this.layer = layer; + this.registerBuiltinAttributes(); + } + public getUninforms() { + throw new Error('Method not implemented.'); + } + + public buildModels(): IModel[] { + throw new Error('Method not implemented.'); + } + private registerBuiltinAttributes() { + throw new Error('Method not implemented.'); + } +} diff --git a/packages/layers/src/polygon/index.ts b/packages/layers/src/polygon/index.ts index 715caf4cf2..52e663069b 100644 --- a/packages/layers/src/polygon/index.ts +++ b/packages/layers/src/polygon/index.ts @@ -1,25 +1,11 @@ import { IEncodeFeature } from '@l7/core'; -import earcut from 'earcut'; import BaseLayer from '../core/BaseLayer'; -import polygon_frag from './shaders/polygon_frag.glsl'; -import polygon_vert from './shaders/polygon_vert.glsl'; +import PolygonModels, { PolygonModelType } from './models/'; interface IPolygonLayerStyleOptions { opacity: number; } -export function polygonTriangulation(feature: IEncodeFeature) { - const { coordinates } = feature; - const flattengeo = earcut.flatten(coordinates as number[][][]); - const { vertices, dimensions, holes } = flattengeo; - - return { - indices: earcut(vertices, holes, dimensions), - vertices, - size: dimensions, - }; -} - export default class PolygonLayer extends BaseLayer { public name: string = 'PolygonLayer'; @@ -36,26 +22,25 @@ export default class PolygonLayer extends BaseLayer { } protected renderModels() { - const { opacity } = this.getStyleOptions(); this.models.forEach((model) => model.draw({ - uniforms: { - u_opacity: opacity || 1.0, - }, + uniforms: this.layerModel.getUninforms(), }), ); return this; } protected buildModels() { - this.models = [ - this.buildLayerModel({ - moduleName: 'polygon', - vertexShader: polygon_vert, - fragmentShader: polygon_frag, - triangulation: polygonTriangulation, - depth: { enable: false }, - }), - ]; + const shape = this.getModelType(); + this.layerModel = new PolygonModels[shape](this); + this.models = this.layerModel.buildModels(); + } + + private getModelType(): PolygonModelType { + const shapeAttribute = this.styleAttributeService.getLayerStyleAttribute( + 'shape', + ); + const shape = shapeAttribute?.scale?.field as PolygonModelType; + return shape || 'fill'; } } diff --git a/packages/layers/src/polygon/models/extrude.ts b/packages/layers/src/polygon/models/extrude.ts new file mode 100644 index 0000000000..ac4dafc960 --- /dev/null +++ b/packages/layers/src/polygon/models/extrude.ts @@ -0,0 +1,92 @@ +import { + AttributeType, + gl, + IEncodeFeature, + ILayer, + ILayerModel, + ILayerPlugin, + ILogService, + IModel, + IStyleAttributeService, + lazyInject, + TYPES, +} from '@l7/core'; +import BaseModel from '../../core/baseModel'; +import { PolygonExtrudeTriangulation } from '../../core/triangulation'; +import polygonExtrudeFrag from '../shaders/polygon_extrude_frag.glsl'; +import polygonExtrudeVert from '../shaders/polygon_extrude_vert.glsl'; +interface IPolygonLayerStyleOptions { + opacity: number; +} +export default class ExtrudeModel extends BaseModel { + public getUninforms() { + const { + opacity = 1, + } = this.layer.getStyleOptions() as IPolygonLayerStyleOptions; + return { + u_opacity: opacity, + }; + } + + public buildModels(): IModel[] { + return [ + this.layer.buildLayerModel({ + moduleName: 'polygonExtrude', + vertexShader: polygonExtrudeVert, + fragmentShader: polygonExtrudeFrag, + triangulation: PolygonExtrudeTriangulation, + }), + ]; + } + + protected registerBuiltinAttributes() { + // point layer size; + this.layer.styleAttributeService.registerStyleAttribute({ + name: 'normal', + type: AttributeType.Attribute, + descriptor: { + name: 'a_Normal', + buffer: { + // give the WebGL driver a hint that this buffer may change + usage: gl.STATIC_DRAW, + data: [], + type: gl.FLOAT, + }, + size: 3, + update: ( + feature: IEncodeFeature, + featureIdx: number, + vertex: number[], + attributeIdx: number, + normal: number[], + ) => { + return normal; + }, + }, + }); + + this.layer.styleAttributeService.registerStyleAttribute({ + name: 'size', + type: AttributeType.Attribute, + descriptor: { + name: 'a_Size', + buffer: { + // give the WebGL driver a hint that this buffer may change + usage: gl.DYNAMIC_DRAW, + data: [], + type: gl.FLOAT, + }, + size: 1, + update: ( + feature: IEncodeFeature, + featureIdx: number, + vertex: number[], + attributeIdx: number, + ) => { + const { size } = feature; + return Array.isArray(size) ? [size[0]] : [size as number]; + }, + }, + }); + } +} diff --git a/packages/layers/src/polygon/models/fill.ts b/packages/layers/src/polygon/models/fill.ts new file mode 100644 index 0000000000..26c88f60aa --- /dev/null +++ b/packages/layers/src/polygon/models/fill.ts @@ -0,0 +1,47 @@ +import { + AttributeType, + gl, + IEncodeFeature, + ILayer, + ILayerModel, + ILayerPlugin, + ILogService, + IModel, + IStyleAttributeService, + lazyInject, + TYPES, +} from '@l7/core'; +import BaseModel from '../../core/baseModel'; +import { polygonTriangulation } from '../../core/triangulation'; +import polygon_frag from '../shaders/polygon_frag.glsl'; +import polygon_vert from '../shaders/polygon_vert.glsl'; + +interface IPolygonLayerStyleOptions { + opacity: number; +} +export default class FillModel extends BaseModel { + public getUninforms() { + const { + opacity = 1, + } = this.layer.getStyleOptions() as IPolygonLayerStyleOptions; + return { + u_opacity: opacity, + }; + } + + public buildModels(): IModel[] { + return [ + this.layer.buildLayerModel({ + moduleName: 'polygon', + vertexShader: polygon_vert, + fragmentShader: polygon_frag, + triangulation: polygonTriangulation, + depth: { enable: false }, + }), + ]; + } + + protected registerBuiltinAttributes() { + // point layer size; + } +} diff --git a/packages/layers/src/polygon/models/index.ts b/packages/layers/src/polygon/models/index.ts new file mode 100644 index 0000000000..cf0495ccca --- /dev/null +++ b/packages/layers/src/polygon/models/index.ts @@ -0,0 +1,11 @@ +import ExtrudeModel from './extrude'; +import FillModel from './fill'; + +export type PolygonModelType = 'fill' | 'extrude'; + +const PolygonModels: { [key in PolygonModelType]: any } = { + fill: FillModel, + extrude: ExtrudeModel, +}; + +export default PolygonModels; diff --git a/packages/layers/src/polygon/polygon3D.ts b/packages/layers/src/polygon/polygon3D.ts index afdb5d86ed..a320d45145 100644 --- a/packages/layers/src/polygon/polygon3D.ts +++ b/packages/layers/src/polygon/polygon3D.ts @@ -1,8 +1,8 @@ import { AttributeType, gl, IEncodeFeature, ILayer } from '@l7/core'; import BaseLayer from '../core/BaseLayer'; import { PolygonExtrudeTriangulation } from '../core/triangulation'; -import pointExtrudeFrag from './shaders/polygon_extrude_frag.glsl'; -import pointExtrudeVert from './shaders/polygon_extrude_vert.glsl'; +import polygonExtrudeFrag from './shaders/polygon_extrude_frag.glsl'; +import polygonExtrudeVert from './shaders/polygon_extrude_vert.glsl'; interface IPointLayerStyleOptions { opacity: number; } @@ -38,8 +38,8 @@ export default class PolygonLayer extends BaseLayer { this.models = [ this.buildLayerModel({ moduleName: 'polygonExtrude', - vertexShader: pointExtrudeVert, - fragmentShader: pointExtrudeFrag, + vertexShader: polygonExtrudeVert, + fragmentShader: polygonExtrudeFrag, triangulation: PolygonExtrudeTriangulation, }), ]; From a7bee08137582453d1177ae957512caaa53ffda4 Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Tue, 19 Nov 2019 19:03:17 +0800 Subject: [PATCH 2/2] refactor(heatmap): heatmap model --- docs/API/L7.en.md | 2 +- docs/API/L7.zh.md | 2 +- examples/gallery/basic/demo/light.js | 6 +- examples/gallery/basic/index.en.md | 2 +- examples/heatmap/grid/demo/china.js | 4 +- examples/heatmap/grid/demo/grid1.js | 4 +- examples/heatmap/grid/demo/heatmap3.js | 64 +- examples/heatmap/grid/demo/world.js | 4 +- examples/heatmap/heatmap/demo/heatmap.js | 12 +- examples/heatmap/heatmap/demo/heatmap3d.js | 4 +- .../heatmap/heatmap/demo/heatmap_purple.js | 8 +- examples/heatmap/heatmap/index.en.md | 2 - examples/heatmap/heatmap/index.zh.md | 2 - examples/heatmap/hexagon/demo/china.js | 6 +- examples/heatmap/hexagon/demo/hexagon.js | 6 +- examples/heatmap/hexagon/demo/light.js | 2 +- examples/heatmap/hexagon/demo/world.js | 4 +- examples/line/isoline/index.en.md | 2 - examples/line/isoline/index.zh.md | 2 - examples/line/path/index.en.md | 2 - examples/line/path/index.zh.md | 2 - examples/polygon/3d/index.en.md | 2 - examples/polygon/3d/index.zh.md | 2 - examples/polygon/fill/index.en.md | 2 - examples/polygon/fill/index.zh.md | 2 - gatsby-config.js | 4 +- package.json | 3 +- .../core/src/services/layer/ILayerService.ts | 1 + packages/layers/src/core/baseModel.ts | 13 + packages/layers/src/core/triangulation.ts | 15 +- packages/layers/src/heatmap/index.ts | 168 ++---- .../layers/src/heatmap/{ => models}/grid.ts | 72 +-- .../heatmap/{gird3d.ts => models/grid3d.ts} | 75 ++- .../src/heatmap/{ => models}/heatmap.ts | 123 ++-- .../src/heatmap/{ => models}/hexagon.ts | 70 +-- packages/layers/src/heatmap/models/index.ts | 20 + packages/layers/src/index.ts | 21 +- packages/layers/src/point/models/fill.ts | 3 +- packages/layers/src/point/models/image.ts | 3 +- packages/layers/src/point/models/normal.ts | 3 +- packages/layers/src/point/models/text.ts | 18 +- packages/source/src/transform/grid.ts | 1 + packages/source/src/transform/hexagon.ts | 1 + site/css/home.css | 18 + site/locale.json | 3 +- site/pages/index.zh.tsx | 8 +- yarn.lock | 549 ++++++++++++++---- 47 files changed, 795 insertions(+), 547 deletions(-) rename packages/layers/src/heatmap/{ => models}/grid.ts (54%) rename packages/layers/src/heatmap/{gird3d.ts => models/grid3d.ts} (60%) rename packages/layers/src/heatmap/{ => models}/heatmap.ts (76%) rename packages/layers/src/heatmap/{ => models}/hexagon.ts (54%) create mode 100644 packages/layers/src/heatmap/models/index.ts create mode 100644 site/css/home.css diff --git a/docs/API/L7.en.md b/docs/API/L7.en.md index 1d4f309843..fc4302c64b 100644 --- a/docs/API/L7.en.md +++ b/docs/API/L7.en.md @@ -2,5 +2,5 @@ title: Introduction order: 0 redirect_from: - - /en/docs/API + - /en/docs/api/ --- diff --git a/docs/API/L7.zh.md b/docs/API/L7.zh.md index ee73dd9e10..7978e8db8e 100644 --- a/docs/API/L7.zh.md +++ b/docs/API/L7.zh.md @@ -2,5 +2,5 @@ title: 简介 order: 0 redirect_from: - - /zh/docs/API + - /zh/docs/api/ --- diff --git a/examples/gallery/basic/demo/light.js b/examples/gallery/basic/demo/light.js index d738fd8570..c320e7905d 100644 --- a/examples/gallery/basic/demo/light.js +++ b/examples/gallery/basic/demo/light.js @@ -1,4 +1,4 @@ -import { HeatMapHexagonLayer, HeatMapGrid3dLayer } from '@l7/layers'; +import { HeatmapLayer } from '@l7/layers'; import { Scene } from '@l7/scene'; const scene = new Scene({ id: 'map', @@ -17,7 +17,7 @@ fetch( ) .then((res) => res.text()) .then((data) => { - const layer = new HeatMapGrid3dLayer({}) + const layer = new HeatmapLayer({}) .source(data, { parser:{ @@ -37,7 +37,7 @@ fetch( .size('sum', (sum)=>{ return sum * 200; }) - .shape('hexagon') + .shape('hexagonColumn') .style({ coverage: 0.8, angle: 0, diff --git a/examples/gallery/basic/index.en.md b/examples/gallery/basic/index.en.md index b86df30c9c..49d0b7d4f7 100644 --- a/examples/gallery/basic/index.en.md +++ b/examples/gallery/basic/index.en.md @@ -2,5 +2,5 @@ title: Gallery order: 0 redirect_from: - - /zh/examples/ + - /en/examples/ --- diff --git a/examples/heatmap/grid/demo/china.js b/examples/heatmap/grid/demo/china.js index c9112ec36a..939f2ad46c 100644 --- a/examples/heatmap/grid/demo/china.js +++ b/examples/heatmap/grid/demo/china.js @@ -1,4 +1,4 @@ -import { HeatMapGridLayer, HeatMapGrid3dLayer } from '@l7/layers'; +import { HeatmapLayer } from '@l7/layers'; import { Scene } from '@l7/scene'; const scene = new Scene({ id: 'map', @@ -14,7 +14,7 @@ fetch( ) .then((res) => res.text()) .then((data) => { - const layer = new HeatMapGridLayer({}) + const layer = new HeatmapLayer({}) .source(data, { parser: { type: 'csv', diff --git a/examples/heatmap/grid/demo/grid1.js b/examples/heatmap/grid/demo/grid1.js index f60f3fcb8e..0749d47367 100644 --- a/examples/heatmap/grid/demo/grid1.js +++ b/examples/heatmap/grid/demo/grid1.js @@ -1,4 +1,4 @@ -import { HeatMapGridLayer, HeatMapGrid3dLayer } from '@l7/layers'; +import { HeatmapLayer } from '@l7/layers'; import { Scene } from '@l7/scene'; const scene = new Scene({ id: 'map', @@ -14,7 +14,7 @@ fetch( ) .then((res) => res.text()) .then((data) => { - const layer = new HeatMapGridLayer({}) + const layer = new HeatmapLayer({}) .source(data, { parser: { type: 'csv', diff --git a/examples/heatmap/grid/demo/heatmap3.js b/examples/heatmap/grid/demo/heatmap3.js index 0cbd9874e5..edcbcd7805 100644 --- a/examples/heatmap/grid/demo/heatmap3.js +++ b/examples/heatmap/grid/demo/heatmap3.js @@ -1,11 +1,11 @@ -import { HeatMapGridLayer } from '@l7/layers'; +import { HeatmapLayer } from '@l7/layers'; import { Scene } from '@l7/scene'; const scene = new Scene({ id: 'map', style: 'light', pitch: 0, pitch: 0, - center: [110.097892, 33.853662], + center: [110.097892, 33.853662], zoom: 4.056, type: 'amap', }); @@ -15,36 +15,36 @@ fetch( ) .then((res) => res.text()) .then((data) => { - const layer = new HeatMapGridLayer({}) + const layer = new HeatmapLayer({}) .source(data, { - parser: { - type: 'csv', - x: 'lng', - y: 'lat' - }, - transforms:[ - { - type: 'grid', - size: 20000, - field:'v', - method:'sum' - } - ] - }) - .size('count',(value)=>{ - return value * 0; - }) - .shape('circle') - .style({ - coverage: 0.9, - angle: 0, - }) - .color('count', [ - '#8C1EB2','#8C1EB2','#DA05AA', - '#F0051A','#FF2A3C','#FF4818', - '#FF4818', '#FF8B18', - '#F77B00', '#ED9909', - '#ECC357', '#EDE59C' - ].reverse()) + parser: { + type: 'csv', + x: 'lng', + y: 'lat' + }, + transforms: [ + { + type: 'grid', + size: 20000, + field: 'v', + method: 'sum' + } + ] + }) + .size('count', (value) => { + return value * 0; + }) + .shape('circle') + .style({ + coverage: 0.9, + angle: 0, + }) + .color('count', [ + '#8C1EB2', '#8C1EB2', '#DA05AA', + '#F0051A', '#FF2A3C', '#FF4818', + '#FF4818', '#FF8B18', + '#F77B00', '#ED9909', + '#ECC357', '#EDE59C' + ].reverse()) scene.addLayer(layer); }); diff --git a/examples/heatmap/grid/demo/world.js b/examples/heatmap/grid/demo/world.js index f42b751168..ec14b9070e 100644 --- a/examples/heatmap/grid/demo/world.js +++ b/examples/heatmap/grid/demo/world.js @@ -1,4 +1,4 @@ -import { HeatMapGridLayer, HeatMapGrid3dLayer } from '@l7/layers'; +import { HeatmapLayer } from '@l7/layers'; import { Scene } from '@l7/scene'; const scene = new Scene({ id: 'map', @@ -15,7 +15,7 @@ fetch( ) .then((res) => res.text()) .then((data) => { - const layer = new HeatMapGridLayer({}) + const layer = new HeatmapLayer({}) .source(data, { parser: { type: 'csv', diff --git a/examples/heatmap/heatmap/demo/heatmap.js b/examples/heatmap/heatmap/demo/heatmap.js index 5bac4d5ba1..02a09b2a76 100644 --- a/examples/heatmap/heatmap/demo/heatmap.js +++ b/examples/heatmap/heatmap/demo/heatmap.js @@ -1,10 +1,10 @@ import { Scene } from '@l7/scene'; -import { HeatMapLayer } from '@l7/layers'; +import { HeatmapLayer } from '@l7/layers'; const scene = new Scene({ id: 'map', style: 'dark', pitch: 0, - center: [127.5671666579043,7.445038892195569], + center: [127.5671666579043, 7.445038892195569], type: 'mapbox', zoom: 2.632456779444394 }); @@ -13,15 +13,17 @@ fetch('https://gw.alipayobjects.com/os/basement_prod/d3564b06-670f-46ea-8edb-842 .then((res) => res.json()) .then((data) => { const layer = - new HeatMapLayer({ + new HeatmapLayer({ }) - .source(data).size('mag', [0, 1.0]) // weight映射通道 + .source(data) + .shape('heatmap') + .size('mag', [0, 1.0]) // weight映射通道 .style({ intensity: 2, radius: 20, opacity: 1.0, rampColors: { - colors: [ '#FF4818', '#F7B74A', '#FFF598', '#91EABC', '#2EA9A1', '#206C7C' ].reverse(), + colors: ['#FF4818', '#F7B74A', '#FFF598', '#91EABC', '#2EA9A1', '#206C7C'].reverse(), positions: [0, 0.2, 0.4, 0.6, 0.8, 1.0] } }) diff --git a/examples/heatmap/heatmap/demo/heatmap3d.js b/examples/heatmap/heatmap/demo/heatmap3d.js index 9f3fc42c36..dae67271d5 100644 --- a/examples/heatmap/heatmap/demo/heatmap3d.js +++ b/examples/heatmap/heatmap/demo/heatmap3d.js @@ -1,5 +1,5 @@ import { Scene } from '@l7/scene'; -import { HeatMapLayer } from '@l7/layers'; +import { HeatmapLayer } from '@l7/layers'; const scene = new Scene({ id: 'map', style: 'dark', @@ -14,7 +14,7 @@ fetch('https://gw.alipayobjects.com/os/basement_prod/337ddbb7-aa3f-4679-ab60-d64 .then((res) => res.json()) .then((data) => { const layer = - new HeatMapLayer({ + new HeatmapLayer({ }) .source(data) .size('capacity', [0, 1]) diff --git a/examples/heatmap/heatmap/demo/heatmap_purple.js b/examples/heatmap/heatmap/demo/heatmap_purple.js index 7bd8158628..46898e6e04 100644 --- a/examples/heatmap/heatmap/demo/heatmap_purple.js +++ b/examples/heatmap/heatmap/demo/heatmap_purple.js @@ -1,5 +1,5 @@ import { Scene } from '@l7/scene'; -import { HeatMapLayer } from '@l7/layers'; +import { HeatmapLayer } from '@l7/layers'; const scene = new Scene({ id: 'map', style: 'dark', @@ -13,9 +13,11 @@ fetch('https://gw.alipayobjects.com/os/basement_prod/d3564b06-670f-46ea-8edb-842 .then((res) => res.json()) .then((data) => { const layer = - new HeatMapLayer({ + new HeatmapLayer({ }) - .source(data).size('mag', [0, 1.0]) // weight映射通道 + .source(data) + .shape('heatmap') + .size('mag', [0, 1.0]) // weight映射通道 .style({ intensity: 2, radius: 20, diff --git a/examples/heatmap/heatmap/index.en.md b/examples/heatmap/heatmap/index.en.md index d2e2897ad7..f71ebbe652 100644 --- a/examples/heatmap/heatmap/index.en.md +++ b/examples/heatmap/heatmap/index.en.md @@ -1,6 +1,4 @@ --- title: HeatMap order: 0 -redirect_from: - - /en/examples/heatmap/ --- diff --git a/examples/heatmap/heatmap/index.zh.md b/examples/heatmap/heatmap/index.zh.md index ea61d8545d..e651ddabef 100644 --- a/examples/heatmap/heatmap/index.zh.md +++ b/examples/heatmap/heatmap/index.zh.md @@ -1,6 +1,4 @@ --- title: 经典热力图 order: 0 -redirect_from: - - /zh/examples/heatmap/ --- diff --git a/examples/heatmap/hexagon/demo/china.js b/examples/heatmap/hexagon/demo/china.js index cb2d6e5b01..662e10a24c 100644 --- a/examples/heatmap/hexagon/demo/china.js +++ b/examples/heatmap/hexagon/demo/china.js @@ -1,4 +1,4 @@ -import { HeatMapGridLayer, HeatMapGrid3dLayer } from '@l7/layers'; +import { HeatmapLayer } from '@l7/layers'; import { Scene } from '@l7/scene'; const scene = new Scene({ id: 'map', @@ -14,7 +14,7 @@ fetch( ) .then((res) => res.text()) .then((data) => { - const layer = new HeatMapGrid3dLayer({}) + const layer = new HeatmapLayer({}) .source(data, { parser: { type: 'csv', @@ -33,7 +33,7 @@ fetch( .size('sum',(value)=>{ return value * 20; }) - .shape('hexagon') + .shape('hexagonColumn') .color('count',[ '#FF4818', '#F7B74A', '#FFF598', '#FF40F3', diff --git a/examples/heatmap/hexagon/demo/hexagon.js b/examples/heatmap/hexagon/demo/hexagon.js index 7ada568b37..66465b4804 100644 --- a/examples/heatmap/hexagon/demo/hexagon.js +++ b/examples/heatmap/hexagon/demo/hexagon.js @@ -1,4 +1,4 @@ -import { HeatMapGridLayer, HeatMapGrid3dLayer } from '@l7/layers'; +import { HeatmapLayer } from '@l7/layers'; import { Scene } from '@l7/scene'; const scene = new Scene({ id: 'map', @@ -14,7 +14,7 @@ fetch( ) .then((res) => res.json()) .then((data) => { - const layer = new HeatMapGrid3dLayer({}) + const layer = new HeatmapLayer({}) .source(data, { transforms: [ { @@ -26,7 +26,7 @@ fetch( ], }) .size('sum', [0, 600]) - .shape('hexagon') + .shape('hexagonColumn') .style({ coverage: 0.8, angle: 0, diff --git a/examples/heatmap/hexagon/demo/light.js b/examples/heatmap/hexagon/demo/light.js index d738fd8570..e4b47cf5da 100644 --- a/examples/heatmap/hexagon/demo/light.js +++ b/examples/heatmap/hexagon/demo/light.js @@ -37,7 +37,7 @@ fetch( .size('sum', (sum)=>{ return sum * 200; }) - .shape('hexagon') + .shape('hexagonColumn') .style({ coverage: 0.8, angle: 0, diff --git a/examples/heatmap/hexagon/demo/world.js b/examples/heatmap/hexagon/demo/world.js index 3da1ea4608..93c757e3e3 100644 --- a/examples/heatmap/hexagon/demo/world.js +++ b/examples/heatmap/hexagon/demo/world.js @@ -1,5 +1,5 @@ import { Scene } from '@l7/scene'; -import { HeatMapGridLayer, HeatMapGrid3dLayer } from '@l7/layers'; +import { HeatmapLayer } from '@l7/layers'; const scene = new Scene({ id: 'map', style: 'light', @@ -13,7 +13,7 @@ fetch('https://gw.alipayobjects.com/os/basement_prod/337ddbb7-aa3f-4679-ab60-d64 .then((res) => res.json()) .then((data) => { const layer = - new HeatMapGrid3dLayer({ + new HeatmapLayer({ }) .source(data, { transforms: [ diff --git a/examples/line/isoline/index.en.md b/examples/line/isoline/index.en.md index 7eb5a36ef4..afbfabfb29 100644 --- a/examples/line/isoline/index.en.md +++ b/examples/line/isoline/index.en.md @@ -1,6 +1,4 @@ --- title: Isoline Map order: 2 -redirect_from: - - /en/examples/line/ --- diff --git a/examples/line/isoline/index.zh.md b/examples/line/isoline/index.zh.md index 42311d50ba..03330c22e5 100644 --- a/examples/line/isoline/index.zh.md +++ b/examples/line/isoline/index.zh.md @@ -1,6 +1,4 @@ --- title: 等值线地图 order: 2 -redirect_from: - - /zh/examples/line/ --- diff --git a/examples/line/path/index.en.md b/examples/line/path/index.en.md index 25f949740b..d62b6f276a 100644 --- a/examples/line/path/index.en.md +++ b/examples/line/path/index.en.md @@ -1,7 +1,5 @@ --- title: Path Map order: 0 -redirect_from: - - /en/examples/line/ --- diff --git a/examples/line/path/index.zh.md b/examples/line/path/index.zh.md index 8b26f1e716..02e511f417 100644 --- a/examples/line/path/index.zh.md +++ b/examples/line/path/index.zh.md @@ -1,6 +1,4 @@ --- title: 路径地图 order: 0 -redirect_from: - - /zh/examples/line/ --- diff --git a/examples/polygon/3d/index.en.md b/examples/polygon/3d/index.en.md index e526d0c5e7..bc3ca8ef68 100644 --- a/examples/polygon/3d/index.en.md +++ b/examples/polygon/3d/index.en.md @@ -1,6 +1,4 @@ --- title: Extrude Map order: 0 -redirect_from: - - /en/examples/polygon/ --- diff --git a/examples/polygon/3d/index.zh.md b/examples/polygon/3d/index.zh.md index 62cb4fb498..1298ab2e17 100644 --- a/examples/polygon/3d/index.zh.md +++ b/examples/polygon/3d/index.zh.md @@ -1,6 +1,4 @@ --- title: 3D填充图 order: 0 -redirect_from: - - /zh/examples/polygon/ --- diff --git a/examples/polygon/fill/index.en.md b/examples/polygon/fill/index.en.md index 7d1cd7a11d..c8e3fe60e2 100644 --- a/examples/polygon/fill/index.en.md +++ b/examples/polygon/fill/index.en.md @@ -1,6 +1,4 @@ --- title: Choropleth Map order: 0 -redirect_from: - - /en/examples --- diff --git a/examples/polygon/fill/index.zh.md b/examples/polygon/fill/index.zh.md index 4527d4fc81..e4703fd9c1 100644 --- a/examples/polygon/fill/index.zh.md +++ b/examples/polygon/fill/index.zh.md @@ -1,6 +1,4 @@ --- title: 填充地图 order: 0 -redirect_from: - - /zh/examples --- diff --git a/gatsby-config.js b/gatsby-config.js index ed59c5ecda..72c7e7c49b 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -14,12 +14,12 @@ module.exports = { githubUrl: 'https://github.com/antvis/L7', navs: [ { - slug: 'docs/API', + slug: 'docs/api', title: { zh: '文档', en: 'Document', }, - redirect: 'API/L7', + redirect: 'api/l7', }, { slug: 'docs/tutorial', diff --git a/package.json b/package.json index fd89c1029d..c0d244a216 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,6 @@ "react-dom": "^16.12.0", "react-i18next": "^11.0.1", "rimraf": "^2.6.2", - "geotiff": "^1.0.0-beta.6", "rollup": "^1.27.0", "rollup-plugin-analyzer": "^3.2.2", "rollup-plugin-babel": "^4.3.3", @@ -113,7 +112,7 @@ "site:build": "npm run site:clean && gatsby build --prefix-paths", "site:clean": "gatsby clean", "site:deploy": "NODE_ENV=site npm run site:build && gh-pages -d public", - "site:publish":"gh-pages -d public", + "site:publish": "gh-pages -d public", "prebuild": "run-p tsc lint", "build": "yarn clean && lerna run build", "todo:postbuild": "yarn build:declarations", diff --git a/packages/core/src/services/layer/ILayerService.ts b/packages/core/src/services/layer/ILayerService.ts index f1361fbf20..16959dcdc3 100644 --- a/packages/core/src/services/layer/ILayerService.ts +++ b/packages/core/src/services/layer/ILayerService.ts @@ -33,6 +33,7 @@ export interface ILayerModelInitializationOptions { triangulation: Triangulation; } export interface ILayerModel { + render(): void; getUninforms(): IModelUniform; buildModels(): IModel[]; } diff --git a/packages/layers/src/core/baseModel.ts b/packages/layers/src/core/baseModel.ts index 78201d7479..ffc238dee5 100644 --- a/packages/layers/src/core/baseModel.ts +++ b/packages/layers/src/core/baseModel.ts @@ -1,6 +1,7 @@ import { AttributeType, gl, + ICameraService, IEncodeFeature, IFontService, IGlobalConfigService, @@ -13,12 +14,15 @@ import { IModel, IModelUniform, IRendererService, + IShaderModuleService, IStyleAttributeService, lazyInject, TYPES, } from '@l7/core'; export default class BaseModel implements ILayerModel { + @lazyInject(TYPES.IStyleAttributeService) + public styleAttributeService: IStyleAttributeService; protected layer: ILayer; @lazyInject(TYPES.IGlobalConfigService) @@ -33,9 +37,15 @@ export default class BaseModel implements ILayerModel { @lazyInject(TYPES.IRendererService) protected readonly rendererService: IRendererService; + @lazyInject(TYPES.IShaderModuleService) + protected readonly shaderModuleService: IShaderModuleService; + @lazyInject(TYPES.IMapService) protected readonly map: IMapService; + @lazyInject(TYPES.ICameraService) + protected readonly camera: ICameraService; + constructor(layer: ILayer) { this.layer = layer; this.registerBuiltinAttributes(); @@ -49,6 +59,9 @@ export default class BaseModel implements ILayerModel { throw new Error('Method not implemented.'); } + public render() { + throw new Error('Method not implemented.'); + } protected registerBuiltinAttributes() { throw new Error('Method not implemented.'); } diff --git a/packages/layers/src/core/triangulation.ts b/packages/layers/src/core/triangulation.ts index 896309f71f..0aba288b64 100644 --- a/packages/layers/src/core/triangulation.ts +++ b/packages/layers/src/core/triangulation.ts @@ -315,13 +315,20 @@ function checkIsClosed(points: number[][][]) { } function getHeatmapGeometry(shape: ShapeType2D | ShapeType3D): IExtrudeGeomety { + const shape3d = [ + 'cylinder', + 'triangleColumn', + 'hexagonColumn', + 'squareColumn', + ]; const path = geometryShape[shape] ? geometryShape[shape]() : geometryShape.circle(); - // const geometry = ShapeType2D[str as ShapeType2D] - // ? fillPolygon([path]) - // : extrudePolygon([path]); - const geometry = fillPolygon([path]); + const geometry = + shape3d.indexOf(shape) === -1 + ? fillPolygon([path]) + : extrudePolygon([path]); + // const geometry = fillPolygon([path]); return geometry; } // 热力图计算范围 diff --git a/packages/layers/src/heatmap/index.ts b/packages/layers/src/heatmap/index.ts index 2e62569547..0e0de961e1 100644 --- a/packages/layers/src/heatmap/index.ts +++ b/packages/layers/src/heatmap/index.ts @@ -1,112 +1,60 @@ -// import { -// gl, -// IRendererService, -// IShaderModuleService, -// lazyInject, -// TYPES, -// } from '@l7/core'; -// import BaseLayer from '../core/BaseLayer'; -// import GridHeatMapBuffer from './buffers/GridBuffer'; -// import hexagon_frag from './shaders/hexagon_frag.glsl'; -// import hexagon_vert from './shaders/hexagon_vert.glsl'; +import { AttributeType, gl, IEncodeFeature, ILayer } from '@l7/core'; +import BaseLayer from '../core/BaseLayer'; +import HeatMapModels, { HeatMapModelType } from './models'; +interface IPointLayerStyleOptions { + opacity: number; +} +export default class HeatMapLayer extends BaseLayer { + public name: string = 'HeatMapLayer'; + protected getConfigSchema() { + return { + properties: { + opacity: { + type: 'number', + minimum: 0, + maximum: 1, + }, + }, + }; + } -// export default class HeatMapLayer extends BaseLayer { -// public name: string = 'HeatMapLayer'; + protected renderModels() { + const shape = this.getModelType(); + if (shape === 'heatmap') { + this.layerModel.render(); + return; + } + this.models.forEach((model) => + model.draw({ + uniforms: this.layerModel.getUninforms(), + }), + ); + return this; + } -// @lazyInject(TYPES.IShaderModuleService) -// private readonly shaderModule: IShaderModuleService; - -// @lazyInject(TYPES.IRendererService) -// private readonly renderer: IRendererService; - -// protected renderModels() { -// this.models.forEach((model) => -// model.draw({ -// uniforms: { -// u_ModelMatrix: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], -// }, -// }), -// ); -// return this; -// } - -// protected buildModels(): void { -// this.shaderModule.registerModule('grid', { -// vs: hexagon_vert, -// fs: hexagon_frag, -// }); -// this.models = []; -// const { vs, fs, uniforms } = this.shaderModule.getModule('grid'); -// const buffer = new GridHeatMapBuffer({ -// data: this.getEncodedData(), -// }); -// const { -// createAttribute, -// createBuffer, -// createElements, -// createModel, -// } = this.renderer; - -// this.models.push( -// createModel({ -// attributes: { -// a_miter: createAttribute({ -// buffer: createBuffer({ -// data: buffer.instanceGeometry.positions, -// type: gl.FLOAT, -// }), -// size: 3, -// divisor: 0, -// }), -// // a_normal: createAttribute({ -// // buffer: createBuffer({ -// // data: buffer.attributes.normals, -// // type: gl.FLOAT, -// // }), -// // size: 3, -// // }), -// a_color: createAttribute({ -// buffer: createBuffer({ -// data: buffer.attributes.colors, -// type: gl.FLOAT, -// }), -// size: 4, -// divisor: 1, -// }), -// // a_size: createAttribute({ -// // buffer: createBuffer({ -// // data: buffer.attributes.sizes, -// // type: gl.FLOAT, -// // }), -// // size: 1, -// // divisor: 1, -// // }), -// a_Position: createAttribute({ -// buffer: createBuffer({ -// data: buffer.attributes.positions, -// type: gl.FLOAT, -// }), -// size: 3, -// divisor: 1, -// }), -// }, -// uniforms: { -// ...uniforms, -// u_opacity: (this.styleOption.opacity as number) || 1.0, -// u_radius: [ -// this.getSource().data.xOffset, -// this.getSource().data.yOffset, -// ], -// }, -// fs, -// vs, -// count: buffer.instanceGeometry.index.length, -// instances: buffer.verticesCount, -// elements: createElements({ -// data: buffer.instanceGeometry.index, -// type: gl.UNSIGNED_INT, -// }), -// }), -// ); -// } -// } + protected buildModels() { + const shape = this.getModelType(); + this.layerModel = new HeatMapModels[shape](this); + this.models = this.layerModel.buildModels(); + } + private getModelType(): HeatMapModelType { + const shapeAttribute = this.styleAttributeService.getLayerStyleAttribute( + 'shape', + ); + const { shape3d } = this.configService.getConfig(); + const source = this.getSource(); + const sourceType = source.data.type; + const shape = + (shapeAttribute?.scale?.field as HeatMapModelType) || 'heatmap'; + if (shape === 'heatmap' || shape === 'heatmap3d') { + return 'heatmap'; + } + if (sourceType === 'hexagon') { + return shape3d?.indexOf(shape) === -1 ? 'hexagon' : 'grid3d'; + } + if (sourceType === 'grid') { + return shape3d?.indexOf(shape) === -1 ? 'grid' : 'grid3d'; + } + return 'heatmap'; + } +} diff --git a/packages/layers/src/heatmap/grid.ts b/packages/layers/src/heatmap/models/grid.ts similarity index 54% rename from packages/layers/src/heatmap/grid.ts rename to packages/layers/src/heatmap/models/grid.ts index 0e7d9b9687..96dbed19a6 100644 --- a/packages/layers/src/heatmap/grid.ts +++ b/packages/layers/src/heatmap/models/grid.ts @@ -1,48 +1,39 @@ -import { AttributeType, gl, IEncodeFeature, ILayer } from '@l7/core'; -import BaseLayer from '../core/BaseLayer'; -import { HeatmapGridTriangulation } from '../core/triangulation'; -import heatmapGridVert from './shaders/grid_vert.glsl'; -import heatmapGridFrag from './shaders/hexagon_frag.glsl'; +import { + AttributeType, + gl, + IEncodeFeature, + ILayer, + ILayerModel, + IModel, + IModelUniform, +} from '@l7/core'; +import BaseModel from '../../core/baseModel'; +import { HeatmapGridTriangulation } from '../../core/triangulation'; +import heatmapGridVert from '../shaders/grid_vert.glsl'; +import heatmapGridFrag from '../shaders/hexagon_frag.glsl'; interface IHeatMapLayerStyleOptions { opacity: number; coverage: number; } -export default class HeatMapGrid extends BaseLayer { - public name: string = 'heatMapGridLayer'; - - protected getConfigSchema() { +export default class GridModel extends BaseModel { + public getUninforms(): IModelUniform { + const { + opacity, + coverage, + } = this.layer.getStyleOptions() as IHeatMapLayerStyleOptions; return { - properties: { - opacity: { - type: 'number', - minimum: 0, - maximum: 1, - }, - }, + u_opacity: opacity || 1.0, + u_coverage: coverage || 0.9, + u_radius: [ + this.layer.getSource().data.xOffset, + this.layer.getSource().data.yOffset, + ], }; } - protected renderModels() { - const { opacity, coverage } = this.getStyleOptions(); - this.models.forEach((model) => - model.draw({ - uniforms: { - u_opacity: opacity || 1.0, - u_coverage: coverage || 0.9, - u_radius: [ - this.getSource().data.xOffset, - this.getSource().data.yOffset, - ], - }, - }), - ); - return this; - } - - protected buildModels() { - this.registerBuiltinAttributes(this); - this.models = [ - this.buildLayerModel({ + public buildModels(): IModel[] { + return [ + this.layer.buildLayerModel({ moduleName: 'gridheatmap', vertexShader: heatmapGridVert, fragmentShader: heatmapGridFrag, @@ -52,10 +43,9 @@ export default class HeatMapGrid extends BaseLayer { }), ]; } - - private registerBuiltinAttributes(layer: ILayer) { + protected registerBuiltinAttributes() { // point layer size; - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'size', type: AttributeType.Attribute, descriptor: { @@ -80,7 +70,7 @@ export default class HeatMapGrid extends BaseLayer { }); // point layer size; - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'pos', // 顶点经纬度位置 type: AttributeType.Attribute, descriptor: { diff --git a/packages/layers/src/heatmap/gird3d.ts b/packages/layers/src/heatmap/models/grid3d.ts similarity index 60% rename from packages/layers/src/heatmap/gird3d.ts rename to packages/layers/src/heatmap/models/grid3d.ts index 0c441e39a0..6433facdcd 100644 --- a/packages/layers/src/heatmap/gird3d.ts +++ b/packages/layers/src/heatmap/models/grid3d.ts @@ -1,48 +1,40 @@ -import { AttributeType, gl, IEncodeFeature, ILayer } from '@l7/core'; -import BaseLayer from '../core/BaseLayer'; -import { PointExtrudeTriangulation } from '../core/triangulation'; -import heatmapGrid3dVert from './shaders/hexagon_3d_vert.glsl'; -import heatmapGridFrag from './shaders/hexagon_frag.glsl'; +import { + AttributeType, + gl, + IEncodeFeature, + ILayer, + ILayerModel, + IModel, + IModelUniform, +} from '@l7/core'; +import BaseModel from '../../core/baseModel'; +import { PointExtrudeTriangulation } from '../../core/triangulation'; +import heatmapGrid3dVert from '../shaders/hexagon_3d_vert.glsl'; +import heatmapGridFrag from '../shaders/hexagon_frag.glsl'; + interface IHeatMapLayerStyleOptions { opacity: number; coverage: number; } -export default class HeatMapGrid extends BaseLayer { - public name: string = 'hexgaon'; - - protected getConfigSchema() { +export default class Grid3DModel extends BaseModel { + public getUninforms(): IModelUniform { + const { + opacity, + coverage, + } = this.layer.getStyleOptions() as IHeatMapLayerStyleOptions; return { - properties: { - opacity: { - type: 'number', - minimum: 0, - maximum: 1, - }, - }, + u_opacity: opacity || 1.0, + u_coverage: coverage || 1.0, + u_radius: [ + this.layer.getSource().data.xOffset, + this.layer.getSource().data.yOffset, + ], }; } - protected renderModels() { - const { opacity, coverage } = this.getStyleOptions(); - this.models.forEach((model) => - model.draw({ - uniforms: { - u_opacity: opacity || 1.0, - u_coverage: coverage || 1.0, - u_radius: [ - this.getSource().data.xOffset, - this.getSource().data.yOffset, - ], - }, - }), - ); - return this; - } - - protected buildModels() { - this.registerBuiltinAttributes(this); - this.models = [ - this.buildLayerModel({ + public buildModels(): IModel[] { + return [ + this.layer.buildLayerModel({ moduleName: 'grid3dheatmap', vertexShader: heatmapGrid3dVert, fragmentShader: heatmapGridFrag, @@ -51,10 +43,9 @@ export default class HeatMapGrid extends BaseLayer { }), ]; } - - private registerBuiltinAttributes(layer: ILayer) { + protected registerBuiltinAttributes() { // point layer size; - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'size', type: AttributeType.Attribute, descriptor: { @@ -79,7 +70,7 @@ export default class HeatMapGrid extends BaseLayer { }); // point layer size; - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'normal', type: AttributeType.Attribute, descriptor: { @@ -102,7 +93,7 @@ export default class HeatMapGrid extends BaseLayer { }, }, }); - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'pos', // 顶点经纬度位置 type: AttributeType.Attribute, descriptor: { diff --git a/packages/layers/src/heatmap/heatmap.ts b/packages/layers/src/heatmap/models/heatmap.ts similarity index 76% rename from packages/layers/src/heatmap/heatmap.ts rename to packages/layers/src/heatmap/models/heatmap.ts index 98606bca8f..47aad15ca2 100644 --- a/packages/layers/src/heatmap/heatmap.ts +++ b/packages/layers/src/heatmap/models/heatmap.ts @@ -5,26 +5,24 @@ import { IEncodeFeature, IFramebuffer, ILayer, - ILayerPlugin, - ILogService, + ILayerModel, IModel, - IStyleAttributeService, + IModelUniform, ITexture2D, lazyInject, TYPES, } from '@l7/core'; import { mat4 } from 'gl-matrix'; -import BaseLayer from '../core/BaseLayer'; -import { HeatmapTriangulation } from '../core/triangulation'; -import { generateColorRamp, IColorRamp } from '../utils/color'; -import heatmap3DFrag from './shaders/heatmap_3d_frag.glsl'; -import heatmap3DVert from './shaders/heatmap_3d_vert.glsl'; -import heatmapColorFrag from './shaders/heatmap_frag.glsl'; -import heatmapFrag from './shaders/heatmap_framebuffer_frag.glsl'; -import heatmapVert from './shaders/heatmap_framebuffer_vert.glsl'; -import heatmapColorVert from './shaders/heatmap_vert.glsl'; -import { heatMap3DTriangulation } from './triangulation'; - +import BaseModel from '../../core/baseModel'; +import { HeatmapTriangulation } from '../../core/triangulation'; +import { generateColorRamp, IColorRamp } from '../../utils/color'; +import heatmap3DFrag from '../shaders/heatmap_3d_frag.glsl'; +import heatmap3DVert from '../shaders/heatmap_3d_vert.glsl'; +import heatmapColorFrag from '../shaders/heatmap_frag.glsl'; +import heatmapFrag from '../shaders/heatmap_framebuffer_frag.glsl'; +import heatmapVert from '../shaders/heatmap_framebuffer_vert.glsl'; +import heatmapColorVert from '../shaders/heatmap_vert.glsl'; +import { heatMap3DTriangulation } from '../triangulation'; interface IHeatMapLayerStyleOptions { opacity: number; intensity: number; @@ -32,34 +30,16 @@ interface IHeatMapLayerStyleOptions { rampColors: IColorRamp; } -export default class HeatMapLayer extends BaseLayer { - public name: string = 'HeatMapLayer'; +export default class HeatMapModel extends BaseModel { protected texture: ITexture2D; protected colorTexture: ITexture2D; - @lazyInject(TYPES.ICameraService) - protected readonly camera: ICameraService; protected heatmapFramerBuffer: IFramebuffer; private intensityModel: IModel; private colorModel: IModel; + private shapeType: string; - protected getConfigSchema() { - return { - properties: { - opacity: { - type: 'number', - minimum: 0, - maximum: 1, - }, - }, - }; - } - - protected renderModels() { + public render() { const { clear, useFramebuffer } = this.rendererService; - const shapeAttr = this.styleAttributeService.getLayerStyleAttribute( - 'shape', - ); - const shapeType = shapeAttr?.scale?.field || 'heatmap'; useFramebuffer(this.heatmapFramerBuffer, () => { clear({ color: [0, 0, 0, 0], @@ -69,27 +49,14 @@ export default class HeatMapLayer extends BaseLayer { }); this.drawIntensityMode(); }); - // this.draw3DHeatMap(); - shapeType === 'heatmap' ? this.drawColorMode() : this.draw3DHeatMap(); - // this.drawIntensityMode(); - return this; + this.shapeType === 'heatmap' ? this.drawColorMode() : this.draw3DHeatMap(); } - protected buildModels() { - const shapeAttr = this.styleAttributeService.getLayerStyleAttribute( - 'shape', - ); - const shapeType = shapeAttr?.scale?.field || 'heatmap'; - this.registerBuiltinAttributes(this); - this.intensityModel = this.buildHeatMapIntensity(); - this.models = [this.intensityModel]; - this.colorModel = - shapeType === 'heatmap' - ? this.buildHeatmapColor() - : this.build3dHeatMap(); - this.models.push(this.colorModel); - const { rampColors } = this.getStyleOptions(); - const imageData = generateColorRamp(rampColors as IColorRamp); + public getUninforms(): IModelUniform { + throw new Error('Method not implemented.'); + } + + public buildModels(): IModel[] { const { createFramebuffer, clear, @@ -97,8 +64,26 @@ export default class HeatMapLayer extends BaseLayer { createTexture2D, useFramebuffer, } = this.rendererService; + const shapeAttr = this.layer.styleAttributeService.getLayerStyleAttribute( + 'shape', + ); + const shapeType = shapeAttr?.scale?.field || 'heatmap'; + this.shapeType = shapeType as string; + // 生成热力图密度图 + this.intensityModel = this.buildHeatMapIntensity(); + // 渲染到屏幕 + this.colorModel = + shapeType === 'heatmap' + ? this.buildHeatmapColor() // 2D + : this.build3dHeatMap(); // 3D + const { + rampColors, + } = this.layer.getStyleOptions() as IHeatMapLayerStyleOptions; + const imageData = generateColorRamp(rampColors as IColorRamp); const { width, height } = getViewportSize(); + + // 初始化密度图纹理 this.heatmapFramerBuffer = createFramebuffer({ color: createTexture2D({ width, @@ -110,6 +95,8 @@ export default class HeatMapLayer extends BaseLayer { }), }); + // 初始化颜色纹理 + this.colorTexture = createTexture2D({ data: imageData.data, width: imageData.width, @@ -120,10 +107,11 @@ export default class HeatMapLayer extends BaseLayer { mag: gl.LINEAR, flipY: true, }); - } - private registerBuiltinAttributes(layer: ILayer) { - layer.styleAttributeService.registerStyleAttribute({ + return [this.intensityModel, this.colorModel]; + } + protected registerBuiltinAttributes() { + this.layer.styleAttributeService.registerStyleAttribute({ name: 'dir', type: AttributeType.Attribute, descriptor: { @@ -147,7 +135,7 @@ export default class HeatMapLayer extends BaseLayer { }); // point layer size; - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'size', type: AttributeType.Attribute, descriptor: { @@ -171,9 +159,8 @@ export default class HeatMapLayer extends BaseLayer { }, }); } - private buildHeatMapIntensity(): IModel { - return this.buildLayerModel({ + return this.layer.buildLayerModel({ moduleName: 'heatmapintensity', vertexShader: heatmapVert, fragmentShader: heatmapFrag, @@ -250,8 +237,13 @@ export default class HeatMapLayer extends BaseLayer { }), }); } + private drawIntensityMode() { - const { opacity, intensity = 10, radius = 5 } = this.getStyleOptions(); + const { + opacity, + intensity = 10, + radius = 5, + } = this.layer.getStyleOptions() as IHeatMapLayerStyleOptions; this.intensityModel.draw({ uniforms: { u_opacity: opacity || 1.0, @@ -262,7 +254,9 @@ export default class HeatMapLayer extends BaseLayer { } private drawColorMode() { - const { opacity } = this.getStyleOptions(); + const { + opacity, + } = this.layer.getStyleOptions() as IHeatMapLayerStyleOptions; this.colorModel.draw({ uniforms: { u_opacity: opacity || 1.0, @@ -271,8 +265,11 @@ export default class HeatMapLayer extends BaseLayer { }, }); } + private draw3DHeatMap() { - const { opacity } = this.getStyleOptions(); + const { + opacity, + } = this.layer.getStyleOptions() as IHeatMapLayerStyleOptions; const invert = mat4.invert( mat4.create(), // @ts-ignore diff --git a/packages/layers/src/heatmap/hexagon.ts b/packages/layers/src/heatmap/models/hexagon.ts similarity index 54% rename from packages/layers/src/heatmap/hexagon.ts rename to packages/layers/src/heatmap/models/hexagon.ts index afa9ef0f13..f26a081afd 100644 --- a/packages/layers/src/heatmap/hexagon.ts +++ b/packages/layers/src/heatmap/models/hexagon.ts @@ -1,48 +1,39 @@ -import { AttributeType, gl, IEncodeFeature, ILayer } from '@l7/core'; -import BaseLayer from '../core/BaseLayer'; -import { HeatmapGridTriangulation } from '../core/triangulation'; -import heatmapGridFrag from './shaders/hexagon_frag.glsl'; -import heatmapGridVert from './shaders/hexagon_vert.glsl'; +import { + AttributeType, + gl, + IEncodeFeature, + IModel, + IModelUniform, +} from '@l7/core'; +import BaseModel from '../../core/baseModel'; +import { HeatmapGridTriangulation } from '../../core/triangulation'; +import heatmapGridFrag from '../shaders/hexagon_frag.glsl'; +import heatmapGridVert from '../shaders/hexagon_vert.glsl'; + interface IHeatMapLayerStyleOptions { opacity: number; coverage: number; } -export default class HeatMapGrid extends BaseLayer { - public name: string = 'heatMapGridLayer'; - protected getConfigSchema() { +export default class HexagonModel extends BaseModel { + public getUninforms(): IModelUniform { + const { + opacity, + coverage, + } = this.layer.getStyleOptions() as IHeatMapLayerStyleOptions; return { - properties: { - opacity: { - type: 'number', - minimum: 0, - maximum: 1, - }, - }, + u_opacity: opacity || 1.0, + u_coverage: coverage || 0.9, + u_radius: [ + this.layer.getSource().data.xOffset, + this.layer.getSource().data.yOffset, + ], }; } - protected renderModels() { - const { opacity, coverage } = this.getStyleOptions(); - this.models.forEach((model) => - model.draw({ - uniforms: { - u_opacity: opacity || 1.0, - u_coverage: coverage || 0.9, - u_radius: [ - this.getSource().data.xOffset, - this.getSource().data.yOffset, - ], - }, - }), - ); - return this; - } - - protected buildModels() { - this.registerBuiltinAttributes(this); - this.models = [ - this.buildLayerModel({ + public buildModels(): IModel[] { + return [ + this.layer.buildLayerModel({ moduleName: 'hexagonheatmap', vertexShader: heatmapGridVert, fragmentShader: heatmapGridFrag, @@ -52,10 +43,9 @@ export default class HeatMapGrid extends BaseLayer { }), ]; } - - private registerBuiltinAttributes(layer: ILayer) { + protected registerBuiltinAttributes() { // point layer size; - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'size', type: AttributeType.Attribute, descriptor: { @@ -80,7 +70,7 @@ export default class HeatMapGrid extends BaseLayer { }); // point layer size; - layer.styleAttributeService.registerStyleAttribute({ + this.layer.styleAttributeService.registerStyleAttribute({ name: 'pos', // 顶点经纬度位置 type: AttributeType.Attribute, descriptor: { diff --git a/packages/layers/src/heatmap/models/index.ts b/packages/layers/src/heatmap/models/index.ts new file mode 100644 index 0000000000..1bcd1cf6af --- /dev/null +++ b/packages/layers/src/heatmap/models/index.ts @@ -0,0 +1,20 @@ +import GridModel from './grid'; +import Grid3DModel from './grid3d'; +import HeatMapModel from './heatmap'; +import HexagonModel from './hexagon'; + +export type HeatMapModelType = + | 'heatmap' + | 'heatmap3d' + | 'hexagon' + | 'grid' + | 'grid3d'; + +const HeatMapModels: { [key in HeatMapModelType]: any } = { + heatmap: HeatMapModel, + heatmap3d: HeatMapModel, + grid: GridModel, + grid3d: Grid3DModel, + hexagon: HexagonModel, +}; +export default HeatMapModels; diff --git a/packages/layers/src/index.ts b/packages/layers/src/index.ts index f638f93223..ad87701059 100644 --- a/packages/layers/src/index.ts +++ b/packages/layers/src/index.ts @@ -1,21 +1,12 @@ import { container, ILayerPlugin, TYPES } from '@l7/core'; import BaseLayer from './core/BaseLayer'; -import HeatMapGrid3dLayer from './heatmap/gird3d'; -import HeatMapGridLayer from './heatmap/grid'; -import HeatMapLayer from './heatmap/heatmap'; -import HeatMapHexagonLayer from './heatmap/hexagon'; - +import HeatmapLayer from './heatmap'; import DashLineLayer from './line/dash'; import LineLayer from './line/index'; import PointLayer from './point'; - -import TextLayer from './point/text'; -// import Point from './point/point'; import PolygonLayer from './polygon'; -// import Polygon3DLayer from './polygon/polygon3D'; import ImageLayer from './raster/image'; import RasterLayer from './raster/raster'; -import Raster2DLayer from './raster/raster2d'; import ConfigSchemaValidationPlugin from './plugins/ConfigSchemaValidationPlugin'; import DataMappingPlugin from './plugins/DataMappingPlugin'; @@ -80,15 +71,7 @@ export { PolygonLayer, LineLayer, DashLineLayer, - // Polygon3DLayer, ImageLayer, RasterLayer, - HeatMapLayer, - TextLayer, - HeatMapGrid3dLayer, - HeatMapHexagonLayer, - HeatMapGridLayer, - Raster2DLayer, - // ImageLayer, - // HeatMapLayer, + HeatmapLayer, }; diff --git a/packages/layers/src/point/models/fill.ts b/packages/layers/src/point/models/fill.ts index 2a1277a9b3..560a6dda18 100644 --- a/packages/layers/src/point/models/fill.ts +++ b/packages/layers/src/point/models/fill.ts @@ -7,6 +7,7 @@ import { ILayerPlugin, ILogService, IModel, + IModelUniform, IStyleAttributeService, lazyInject, TYPES, @@ -22,7 +23,7 @@ interface IPointLayerStyleOptions { strokeColor: string; } export default class FillModel extends BaseModel { - public getUninforms() { + public getUninforms(): IModelUniform { const { opacity = 1, strokeColor = 'rgb(0,0,0,0)', diff --git a/packages/layers/src/point/models/image.ts b/packages/layers/src/point/models/image.ts index 569b7935d6..0b15517b6d 100644 --- a/packages/layers/src/point/models/image.ts +++ b/packages/layers/src/point/models/image.ts @@ -5,6 +5,7 @@ import { ILayer, ILayerModel, IModel, + IModelUniform, ITexture2D, } from '@l7/core'; @@ -19,7 +20,7 @@ interface IPointLayerStyleOptions { export default class ImageModel extends BaseModel { private texture: ITexture2D; - public getUninforms() { + public getUninforms(): IModelUniform { const { opacity } = this.layer.getStyleOptions() as IPointLayerStyleOptions; return { u_opacity: opacity || 1.0, diff --git a/packages/layers/src/point/models/normal.ts b/packages/layers/src/point/models/normal.ts index 1d4dd89172..eedabe8b84 100644 --- a/packages/layers/src/point/models/normal.ts +++ b/packages/layers/src/point/models/normal.ts @@ -5,6 +5,7 @@ import { ILayer, ILayerModel, IModel, + IModelUniform, } from '@l7/core'; import BaseModel from '../../core/baseModel'; @@ -27,7 +28,7 @@ export function PointTriangulation(feature: IEncodeFeature) { } export default class NormalModel extends BaseModel { - public getUninforms() { + public getUninforms(): IModelUniform { const { opacity = 1, strokeColor = 'rgb(0,0,0,0)', diff --git a/packages/layers/src/point/models/text.ts b/packages/layers/src/point/models/text.ts index 202557d9e5..e05be1db44 100644 --- a/packages/layers/src/point/models/text.ts +++ b/packages/layers/src/point/models/text.ts @@ -5,26 +5,22 @@ import { ILayer, ILayerModel, IModel, + IModelUniform, } from '@l7/core'; -import BaseLayer from '../core/BaseLayer'; +import BaseModel from '../../core/baseModel'; import { PointExtrudeTriangulation } from '../core/triangulation'; -import pointExtrudeFrag from './shaders/extrude_frag.glsl'; -import pointExtrudeVert from './shaders/extrude_vert.glsl'; +import pointExtrudeFrag from '../shaders/extrude_frag.glsl'; +import pointExtrudeVert from '../shaders/extrude_vert.glsl'; -export default class ExtrudeModel implements ILayerModel { - private layer: ILayer; - constructor(layer: ILayer) { - this.layer = layer; - this.registerBuiltinAttributes(); - } - public getUninforms() { +export default class ExtrudeModel extends BaseModel { + public getUninforms(): IModelUniform { throw new Error('Method not implemented.'); } public buildModels(): IModel[] { throw new Error('Method not implemented.'); } - private registerBuiltinAttributes() { + protected registerBuiltinAttributes() { throw new Error('Method not implemented.'); } } diff --git a/packages/source/src/transform/grid.ts b/packages/source/src/transform/grid.ts index 92f8d5a1fd..92f47f1ad5 100644 --- a/packages/source/src/transform/grid.ts +++ b/packages/source/src/transform/grid.ts @@ -23,6 +23,7 @@ export function aggregatorToGrid(data: IParserData, option: ITransform) { yOffset: gridOffset.yOffset / 1.8, xOffset: gridOffset.xOffset / 1.8, radius: gridOffset.xOffset, + type: 'grid', dataArray: layerData, }; } diff --git a/packages/source/src/transform/hexagon.ts b/packages/source/src/transform/hexagon.ts index 804e6e4ddd..06cdd48d54 100644 --- a/packages/source/src/transform/hexagon.ts +++ b/packages/source/src/transform/hexagon.ts @@ -52,6 +52,7 @@ export function pointToHexbin(data: IParserData, option: ITransform) { radius: pixlSize, xOffset: pixlSize, yOffset: pixlSize, + type: 'hexagon', }; return result; } diff --git a/site/css/home.css b/site/css/home.css new file mode 100644 index 0000000000..834043ddc3 --- /dev/null +++ b/site/css/home.css @@ -0,0 +1,18 @@ +.home_l7_feature_img { + width:100px; +} +.feature-logo { + height: 100px !important; +} +.cover-image { + margin-top: 40px; + margin-left: 30px; + max-height: 600px; +} +@media only screen and (max-height: 800px) { + .cover-image { + margin-top: 40px; + margin-left: 270px; + max-height: 400px; + } +} diff --git a/site/locale.json b/site/locale.json index 24c3eabe59..20b4342958 100644 --- a/site/locale.json +++ b/site/locale.json @@ -1,5 +1,6 @@ { - "L7 地理空间可视化引擎": "Geospatial Visualization
Analysis Framework", + "L7 地理空间可视化引擎": "Geospatial Visualization + Analysis Framework", "地理空间数据可视化": "Geospatial Data Visualization Analysis Framework", "L7 是由蚂蚁金服 AntV 数据可视化团队推出的基于WebGL的开源大规模地理空间数据可视分析开发框架。": "Large-scale WebGL-powered Geospatial data visualization analysis framework", "架构上灵活可扩展":"Flexible and scalable", diff --git a/site/pages/index.zh.tsx b/site/pages/index.zh.tsx index 548e5b119a..fedac0b988 100644 --- a/site/pages/index.zh.tsx +++ b/site/pages/index.zh.tsx @@ -4,6 +4,7 @@ import Cases from '@antv/gatsby-theme-antv/site/components/Cases'; import Companies from '@antv/gatsby-theme-antv/site/components/Companies'; import Features from '@antv/gatsby-theme-antv/site/components/Features'; import SEO from '@antv/gatsby-theme-antv/site/components/Seo'; +import '../css/home.css'; import React from 'react'; import { useTranslation } from 'react-i18next'; @@ -78,12 +79,7 @@ const IndexPage = () => { } diff --git a/yarn.lock b/yarn.lock index bba611753e..7db3944c1e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -89,9 +89,9 @@ wolfy87-eventemitter "~5.1.0" "@antv/gatsby-theme-antv@^0.9.52": - version "0.9.58" - resolved "https://registry.npm.alibaba-inc.com/@antv/gatsby-theme-antv/download/@antv/gatsby-theme-antv-0.9.58.tgz#df9845c275ed5e5547beff11fd9024be02637367" - integrity sha1-35hFwnXtXlVHvv8R/ZAkvgJjc2c= + version "0.9.69" + resolved "https://registry.npm.alibaba-inc.com/@antv/gatsby-theme-antv/download/@antv/gatsby-theme-antv-0.9.69.tgz#039e5b13ebf0c77ab28265b07566a98a2dd60489" + integrity sha1-A55bE+vwx3qygmWwdWapii3WBIk= dependencies: "@babel/plugin-transform-modules-umd" "^7.2.0" "@babel/preset-env" "^7.6.3" @@ -113,6 +113,7 @@ classnames "^2.2.6" codemirror "^5.49.2" codesandbox "^2.1.10" + docsearch.js "^2.6.3" gatsby "^2.15.16" gatsby-image "^2.2.19" gatsby-plugin-antd "^2.0.2" @@ -166,7 +167,7 @@ react-slick "^0.25.2" react-split-pane "^0.1.87" react-test-renderer "^16.9.0" - react-use "^13.6.3" + react-use "^13.8.0" release-it "^12.4.3" shallowequal "^1.1.0" slick-carousel "^1.8.1" @@ -1568,9 +1569,9 @@ yargs "^9.0.0" "@hapi/address@2.x.x": - version "2.1.2" - resolved "https://registry.npm.alibaba-inc.com/@hapi/address/download/@hapi/address-2.1.2.tgz#1c794cd6dbf2354d1eb1ef10e0303f573e1c7222" - integrity sha1-HHlM1tvyNU0ese8Q4DA/Vz4cciI= + version "2.1.4" + resolved "https://registry.npm.alibaba-inc.com/@hapi/address/download/@hapi/address-2.1.4.tgz#5d67ed43f3fd41a69d4b9ff7b56e7c0d1d0a81e5" + integrity sha1-XWftQ/P9QaadS5/3tW58DR0KgeU= "@hapi/bourne@1.x.x": version "1.3.2" @@ -3723,7 +3724,12 @@ dependencies: "@types/lodash" "*" -"@types/lodash@*", "@types/lodash@^4.14.138": +"@types/lodash@*": + version "4.14.149" + resolved "https://registry.npm.alibaba-inc.com/@types/lodash/download/@types/lodash-4.14.149.tgz#1342d63d948c6062838fbf961012f74d4e638440" + integrity sha1-E0LWPZSMYGKDj7+WEBL3TU5jhEA= + +"@types/lodash@^4.14.138": version "4.14.148" resolved "https://registry.npm.alibaba-inc.com/@types/lodash/download/@types/lodash-4.14.148.tgz#ffa2786721707b335c6aa1465e6d3d74016fbd3e" integrity sha1-/6J4ZyFwezNcaqFGXm09dAFvvT4= @@ -3745,7 +3751,12 @@ resolved "https://registry.npm.alibaba-inc.com/@types/mkdirp/download/@types/mkdirp-0.3.29.tgz#7f2ad7ec55f914482fc9b1ec4bb1ae6028d46066" integrity sha1-fyrX7FX5FEgvybHsS7GuYCjUYGY= -"@types/node@*", "@types/node@>= 8", "@types/node@^12.0.2", "@types/node@^12.7.3": +"@types/node@*", "@types/node@>= 8": + version "12.12.9" + resolved "https://registry.npm.alibaba-inc.com/@types/node/download/@types/node-12.12.9.tgz#0b5ae05516b757cbff2e82c04500190aef986c7b" + integrity sha1-C1rgVRa3V8v/LoLARQAZCu+YbHs= + +"@types/node@^12.0.2", "@types/node@^12.7.3": version "12.12.8" resolved "https://registry.npm.alibaba-inc.com/@types/node/download/@types/node-12.12.8.tgz#dab418655af39ce2fa99286a0bed21ef8072ac9d" integrity sha1-2rQYZVrznOL6mShqC+0h74ByrJ0= @@ -3942,42 +3953,43 @@ "@types/yargs-parser" "*" "@typescript-eslint/eslint-plugin@^2.7.0": - version "2.7.0" - resolved "https://registry.npm.alibaba-inc.com/@typescript-eslint/eslint-plugin/download/@typescript-eslint/eslint-plugin-2.7.0.tgz#dff176bdb73dfd7e2e43062452189bd1b9db6021" - integrity sha1-3/F2vbc9/X4uQwYkUhib0bnbYCE= + version "2.8.0" + resolved "https://registry.npm.alibaba-inc.com/@typescript-eslint/eslint-plugin/download/@typescript-eslint/eslint-plugin-2.8.0.tgz#eca584d46094ebebc3cb3e9fb625bfbc904a534d" + integrity sha1-7KWE1GCU6+vDyz6ftiW/vJBKU00= dependencies: - "@typescript-eslint/experimental-utils" "2.7.0" - eslint-utils "^1.4.2" + "@typescript-eslint/experimental-utils" "2.8.0" + eslint-utils "^1.4.3" functional-red-black-tree "^1.0.1" - regexpp "^2.0.1" + regexpp "^3.0.0" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@2.7.0": - version "2.7.0" - resolved "https://registry.npm.alibaba-inc.com/@typescript-eslint/experimental-utils/download/@typescript-eslint/experimental-utils-2.7.0.tgz#58d790a3884df3041b5a5e08f9e5e6b7c41864b5" - integrity sha1-WNeQo4hN8wQbWl4I+eXmt8QYZLU= +"@typescript-eslint/experimental-utils@2.8.0": + version "2.8.0" + resolved "https://registry.npm.alibaba-inc.com/@typescript-eslint/experimental-utils/download/@typescript-eslint/experimental-utils-2.8.0.tgz#208b4164d175587e9b03ce6fea97d55f19c30ca9" + integrity sha1-IItBZNF1WH6bA85v6pfVXxnDDKk= dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/typescript-estree" "2.7.0" + "@typescript-eslint/typescript-estree" "2.8.0" eslint-scope "^5.0.0" "@typescript-eslint/parser@^2.7.0": - version "2.7.0" - resolved "https://registry.npm.alibaba-inc.com/@typescript-eslint/parser/download/@typescript-eslint/parser-2.7.0.tgz#b5e6a4944e2b68dba1e7fbfd5242e09ff552fd12" - integrity sha1-teaklE4raNuh5/v9UkLgn/VS/RI= + version "2.8.0" + resolved "https://registry.npm.alibaba-inc.com/@typescript-eslint/parser/download/@typescript-eslint/parser-2.8.0.tgz#e10f7c40c8cf2fb19920c879311e6c46ad17bacb" + integrity sha1-4Q98QMjPL7GZIMh5MR5sRq0Xuss= dependencies: "@types/eslint-visitor-keys" "^1.0.0" - "@typescript-eslint/experimental-utils" "2.7.0" - "@typescript-eslint/typescript-estree" "2.7.0" + "@typescript-eslint/experimental-utils" "2.8.0" + "@typescript-eslint/typescript-estree" "2.8.0" eslint-visitor-keys "^1.1.0" -"@typescript-eslint/typescript-estree@2.7.0": - version "2.7.0" - resolved "https://registry.npm.alibaba-inc.com/@typescript-eslint/typescript-estree/download/@typescript-eslint/typescript-estree-2.7.0.tgz#34fd98c77a07b40d04d5b4203eddd3abeab909f4" - integrity sha1-NP2Yx3oHtA0E1bQgPt3Tq+q5CfQ= +"@typescript-eslint/typescript-estree@2.8.0": + version "2.8.0" + resolved "https://registry.npm.alibaba-inc.com/@typescript-eslint/typescript-estree/download/@typescript-eslint/typescript-estree-2.8.0.tgz#fcc3fe6532840085d29b75432c8a59895876aeca" + integrity sha1-/MP+ZTKEAIXSm3VDLIpZiVh2rso= dependencies: debug "^4.1.1" - glob "^7.1.4" + eslint-visitor-keys "^1.1.0" + glob "^7.1.6" is-glob "^4.0.1" lodash.unescape "4.0.1" semver "^6.3.0" @@ -4255,6 +4267,11 @@ agent-base@~4.2.1: dependencies: es6-promisify "^5.0.0" +agentkeepalive@^2.2.0: + version "2.2.0" + resolved "https://registry.npm.alibaba-inc.com/agentkeepalive/download/agentkeepalive-2.2.0.tgz#c5d1bd4b129008f1163f236f86e5faea2026e2ef" + integrity sha1-xdG9SxKQCPEWPyNvhuX66iAm4u8= + agentkeepalive@^3.3.0, agentkeepalive@^3.4.1: version "3.5.2" resolved "https://registry.npm.alibaba-inc.com/agentkeepalive/download/agentkeepalive-3.5.2.tgz#a113924dd3fa24a0bc3b78108c450c2abee00f67" @@ -4329,6 +4346,27 @@ ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" +algoliasearch@^3.24.5: + version "3.35.1" + resolved "https://registry.npm.alibaba-inc.com/algoliasearch/download/algoliasearch-3.35.1.tgz#297d15f534a3507cab2f5dfb996019cac7568f0c" + integrity sha1-KX0V9TSjUHyrL137mWAZysdWjww= + dependencies: + agentkeepalive "^2.2.0" + debug "^2.6.9" + envify "^4.0.0" + es6-promise "^4.1.0" + events "^1.1.0" + foreach "^2.0.5" + global "^4.3.2" + inherits "^2.0.1" + isarray "^2.0.1" + load-script "^1.0.0" + object-keys "^1.0.11" + querystring-es3 "^0.2.1" + reduce "^1.0.1" + semver "^5.1.0" + tunnel-agent "^0.6.0" + align-text@^0.1.1, align-text@^0.1.3: version "0.1.4" resolved "https://registry.npm.alibaba-inc.com/align-text/download/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" @@ -4373,11 +4411,11 @@ ansi-escapes@^3.0.0, ansi-escapes@^3.2.0: integrity sha1-h4C5j/nb9WOBUtHx/lwde0RCl2s= ansi-escapes@^4.2.1: - version "4.2.1" - resolved "https://registry.npm.alibaba-inc.com/ansi-escapes/download/ansi-escapes-4.2.1.tgz#4dccdb846c3eee10f6d64dea66273eab90c37228" - integrity sha1-TczbhGw+7hD21k3qZic+q5DDcig= + version "4.3.0" + resolved "https://registry.npm.alibaba-inc.com/ansi-escapes/download/ansi-escapes-4.3.0.tgz#a4ce2b33d6b214b7950d8595c212f12ac9cc569d" + integrity sha1-pM4rM9ayFLeVDYWVwhLxKsnMVp0= dependencies: - type-fest "^0.5.2" + type-fest "^0.8.1" ansi-html@0.0.7: version "0.0.7" @@ -4429,9 +4467,9 @@ ansicolors@~0.2.1: integrity sha1-vgiVmQl7dKXJxKhKDNvNtivYeu8= antd@^3.25.0: - version "3.25.1" - resolved "https://registry.npm.alibaba-inc.com/antd/download/antd-3.25.1.tgz#c23732e63fc01fed30d9ab708e9ef4e71527ed82" - integrity sha1-wjcy5j/AH+0w2atwjp705xUn7YI= + version "3.25.2" + resolved "https://registry.npm.alibaba-inc.com/antd/download/antd-3.25.2.tgz#6994e2f9639194c08dce4634c6296577ad44ac9d" + integrity sha1-aZTi+WORlMCNzkY0xilld61ErJ0= dependencies: "@ant-design/create-react-context" "^0.2.4" "@ant-design/icons" "~2.1.1" @@ -4849,7 +4887,14 @@ auto-bind@^2.0.0: dependencies: "@types/react" "^16.8.12" -autoprefixer@^9.0.0, autoprefixer@^9.4.9, autoprefixer@^9.7.1: +autocomplete.js@0.36.0: + version "0.36.0" + resolved "https://registry.npm.alibaba-inc.com/autocomplete.js/download/autocomplete.js-0.36.0.tgz#94fe775fe64b6cd42e622d076dc7fd26bedd837b" + integrity sha1-lP53X+ZLbNQuYi0Hbcf9Jr7dg3s= + dependencies: + immediate "^3.2.3" + +autoprefixer@^9.0.0, autoprefixer@^9.4.9: version "9.7.1" resolved "https://registry.npm.alibaba-inc.com/autoprefixer/download/autoprefixer-9.7.1.tgz#9ffc44c55f5ca89253d9bb7186cefb01ef57747f" integrity sha1-n/xExV9cqJJT2btxhs77Ae9XdH8= @@ -4862,6 +4907,19 @@ autoprefixer@^9.0.0, autoprefixer@^9.4.9, autoprefixer@^9.7.1: postcss "^7.0.21" postcss-value-parser "^4.0.2" +autoprefixer@^9.7.1: + version "9.7.2" + resolved "https://registry.npm.alibaba-inc.com/autoprefixer/download/autoprefixer-9.7.2.tgz#26cf729fbb709323b40171a874304884dcceffed" + integrity sha1-Js9yn7twkyO0AXGodDBIhNzO/+0= + dependencies: + browserslist "^4.7.3" + caniuse-lite "^1.0.30001010" + chalk "^2.4.2" + normalize-range "^0.1.2" + num2fraction "^1.2.2" + postcss "^7.0.23" + postcss-value-parser "^4.0.2" + awesome-typescript-loader@^5.2.1: version "5.2.1" resolved "https://registry.npm.alibaba-inc.com/awesome-typescript-loader/download/awesome-typescript-loader-5.2.1.tgz#a41daf7847515f4925cdbaa3075d61f289e913fc" @@ -5858,14 +5916,14 @@ browserslist@4.7.0: electron-to-chromium "^1.3.247" node-releases "^1.1.29" -browserslist@^4.0.0, browserslist@^4.6.0, browserslist@^4.7.2: - version "4.7.2" - resolved "https://registry.npm.alibaba-inc.com/browserslist/download/browserslist-4.7.2.tgz#1bb984531a476b5d389cedecb195b2cd69fb1348" - integrity sha1-G7mEUxpHa104nO3ssZWyzWn7E0g= +browserslist@^4.0.0, browserslist@^4.6.0, browserslist@^4.7.2, browserslist@^4.7.3: + version "4.7.3" + resolved "https://registry.npm.alibaba-inc.com/browserslist/download/browserslist-4.7.3.tgz#02341f162b6bcc1e1028e30624815d4924442dc3" + integrity sha1-AjQfFitrzB4QKOMGJIFdSSRELcM= dependencies: - caniuse-lite "^1.0.30001004" - electron-to-chromium "^1.3.295" - node-releases "^1.1.38" + caniuse-lite "^1.0.30001010" + electron-to-chromium "^1.3.306" + node-releases "^1.1.40" bs-logger@0.x: version "0.2.6" @@ -6211,7 +6269,12 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000844, caniuse-lite@^1.0.30000989, caniuse-lite@^1.0.30001004, caniuse-lite@^1.0.30001006: +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000844, caniuse-lite@^1.0.30001006, caniuse-lite@^1.0.30001010: + version "1.0.30001010" + resolved "https://registry.npm.alibaba-inc.com/caniuse-lite/download/caniuse-lite-1.0.30001010.tgz#397a14034d384260453cc81994f494626d34b938" + integrity sha1-OXoUA004QmBFPMgZlPSUYm00uTg= + +caniuse-lite@^1.0.30000989: version "1.0.30001009" resolved "https://registry.npm.alibaba-inc.com/caniuse-lite/download/caniuse-lite-1.0.30001009.tgz#69b77997b882a7aee6af24c8d7d2fa27ee41f348" integrity sha1-abd5l7iCp67mryTI19L6J+5B80g= @@ -8403,6 +8466,19 @@ dns-txt@^2.0.2: dependencies: buffer-indexof "^1.0.0" +docsearch.js@^2.6.3: + version "2.6.3" + resolved "https://registry.npm.alibaba-inc.com/docsearch.js/download/docsearch.js-2.6.3.tgz#57cb4600d3b6553c677e7cbbe6a734593e38625d" + integrity sha1-V8tGANO2VTxnfny75qc0WT44Yl0= + dependencies: + algoliasearch "^3.24.5" + autocomplete.js "0.36.0" + hogan.js "^3.0.2" + request "^2.87.0" + stack-utils "^1.0.1" + to-factory "^1.0.0" + zepto "^1.2.0" + doctrine@1.5.0: version "1.5.0" resolved "https://registry.npm.alibaba-inc.com/doctrine/download/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" @@ -8672,7 +8748,7 @@ ejs@^2.6.1: resolved "https://registry.npm.alibaba-inc.com/ejs/download/ejs-2.7.2.tgz#749037c4c09bd57626a6140afbe6b7e650661614" integrity sha1-dJA3xMCb1XYmphQK++a35lBmFhQ= -electron-to-chromium@^1.3.247, electron-to-chromium@^1.3.295, electron-to-chromium@^1.3.47: +electron-to-chromium@^1.3.247, electron-to-chromium@^1.3.306, electron-to-chromium@^1.3.47: version "1.3.306" resolved "https://registry.npm.alibaba-inc.com/electron-to-chromium/download/electron-to-chromium-1.3.306.tgz#e8265301d053d5f74e36cb876486830261fbe946" integrity sha1-6CZTAdBT1fdONsuHZIaDAmH76UY= @@ -8841,6 +8917,14 @@ envify@^3.0.0: jstransform "^11.0.3" through "~2.3.4" +envify@^4.0.0: + version "4.1.0" + resolved "https://registry.npm.alibaba-inc.com/envify/download/envify-4.1.0.tgz#f39ad3db9d6801b4e6b478b61028d3f0b6819f7e" + integrity sha1-85rT251oAbTmtHi2ECjT8LaBn34= + dependencies: + esprima "^4.0.0" + through "~2.3.4" + envinfo@^7.4.0: version "7.4.0" resolved "https://registry.npm.alibaba-inc.com/envinfo/download/envinfo-7.4.0.tgz#bef4ece9e717423aaf0c3584651430b735ad6630" @@ -8926,9 +9010,9 @@ err-code@^1.0.0: integrity sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA= errlop@^1.1.2: - version "1.2.0" - resolved "https://registry.npm.alibaba-inc.com/errlop/download/errlop-1.2.0.tgz#15d02f8232e788da39b6472fb76809fff423a7d8" - integrity sha1-FdAvgjLniNo5tkcvt2gJ//Qjp9g= + version "1.3.0" + resolved "https://registry.npm.alibaba-inc.com/errlop/download/errlop-1.3.0.tgz#ae6624cf8ba838ca0d34770606c230878586ee44" + integrity sha1-rmYkz4uoOMoNNHcGBsIwh4WG7kQ= dependencies: editions "^2.2.0" @@ -9001,7 +9085,7 @@ es6-iterator@~2.0.3: es5-ext "^0.10.35" es6-symbol "^3.1.1" -es6-promise@^4.0.3: +es6-promise@^4.0.3, es6-promise@^4.1.0: version "4.2.8" resolved "https://registry.npm.alibaba-inc.com/es6-promise/download/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" integrity sha1-TrIVlMlyvEBVPSduUQU5FD21Pgo= @@ -9178,7 +9262,7 @@ eslint-scope@^5.0.0: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-utils@^1.4.2, eslint-utils@^1.4.3: +eslint-utils@^1.4.3: version "1.4.3" resolved "https://registry.npm.alibaba-inc.com/eslint-utils/download/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f" integrity sha1-dP7HxU0Hdrb2fgJRBAtYBlZOmB8= @@ -9316,6 +9400,11 @@ eventlistener@0.0.1: resolved "https://registry.npm.alibaba-inc.com/eventlistener/download/eventlistener-0.0.1.tgz#ed2baabb852227af2bcf889152c72c63ca532eb8" integrity sha1-7Suqu4UiJ68rz4iRUscsY8pTLrg= +events@^1.1.0: + version "1.1.1" + resolved "https://registry.npm.alibaba-inc.com/events/download/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" + integrity sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ= + events@^3.0.0: version "3.0.0" resolved "https://registry.npm.alibaba-inc.com/events/download/events-3.0.0.tgz#9a0a0dfaf62893d92b875b8f2698ca4114973e88" @@ -10167,6 +10256,11 @@ for-own@^0.1.3: dependencies: for-in "^1.0.1" +foreach@^2.0.5: + version "2.0.5" + resolved "https://registry.npm.alibaba-inc.com/foreach/download/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" + integrity sha1-C+4AUBiusmDQo6865ljdATbsG5k= + forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.npm.alibaba-inc.com/forever-agent/download/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" @@ -10383,10 +10477,10 @@ fuse.js@^3.4.4: resolved "https://registry.npm.alibaba-inc.com/fuse.js/download/fuse.js-3.4.5.tgz#8954fb43f9729bd5dbcb8c08f251db552595a7a6" integrity sha1-iVT7Q/lym9Xby4wI8lHbVSWVp6Y= -gatsby-cli@^2.8.11: - version "2.8.11" - resolved "https://registry.npm.alibaba-inc.com/gatsby-cli/download/gatsby-cli-2.8.11.tgz#fafe232904183797a829fd94c8f8b54f590cc6c6" - integrity sha1-+v4jKQQYN5eoKf2UyPi1T1kMxsY= +gatsby-cli@^2.8.11, gatsby-cli@^2.8.12: + version "2.8.12" + resolved "https://registry.npm.alibaba-inc.com/gatsby-cli/download/gatsby-cli-2.8.12.tgz#e1d870a15258003b3ee6db68a24d5b6bc9d4368d" + integrity sha1-4dhwoVJYADs+5ttook1ba8nUNo0= dependencies: "@babel/code-frame" "^7.5.5" "@babel/runtime" "^7.7.2" @@ -10403,8 +10497,8 @@ gatsby-cli@^2.8.11: execa "^3.3.0" fs-exists-cached "^1.0.0" fs-extra "^8.1.0" - gatsby-core-utils "^1.0.19" - gatsby-telemetry "^1.1.37" + gatsby-core-utils "^1.0.20" + gatsby-telemetry "^1.1.38" hosted-git-info "^3.0.2" is-valid-path "^0.1.1" lodash "^4.17.15" @@ -10431,10 +10525,10 @@ gatsby-cli@^2.8.11: ink "^2.5.0" ink-spinner "^3.0.1" -gatsby-core-utils@^1.0.19: - version "1.0.19" - resolved "https://registry.npm.alibaba-inc.com/gatsby-core-utils/download/gatsby-core-utils-1.0.19.tgz#670a0eefe8fc8517c5b87573be6cd817d4b1a96a" - integrity sha1-ZwoO7+j8hRfFuHVzvmzYF9SxqWo= +gatsby-core-utils@^1.0.19, gatsby-core-utils@^1.0.20: + version "1.0.20" + resolved "https://registry.npm.alibaba-inc.com/gatsby-core-utils/download/gatsby-core-utils-1.0.20.tgz#f4788c2591fa7165c87f0ee5e8edf664c91978ea" + integrity sha1-9HiMJZH6cWXIfw7l6O32ZMkZeOo= dependencies: ci-info "2.0.0" @@ -10463,19 +10557,19 @@ gatsby-link@^2.2.24: "@types/reach__router" "^1.2.6" prop-types "^15.7.2" -gatsby-page-utils@^0.0.30: - version "0.0.30" - resolved "https://registry.npm.alibaba-inc.com/gatsby-page-utils/download/gatsby-page-utils-0.0.30.tgz#dac099d695540f769fafaf156744f6017ea21a59" - integrity sha1-2sCZ1pVUD3afr68VZ0T2AX6iGlk= +gatsby-page-utils@^0.0.31: + version "0.0.31" + resolved "https://registry.npm.alibaba-inc.com/gatsby-page-utils/download/gatsby-page-utils-0.0.31.tgz#4314675d059627a56cc2ca66e921a5aa105058c0" + integrity sha1-QxRnXQWWJ6Vswspm6SGlqhBQWMA= dependencies: "@babel/runtime" "^7.7.2" bluebird "^3.7.1" chokidar "3.3.0" fs-exists-cached "^1.0.0" + gatsby-core-utils "^1.0.20" glob "^7.1.6" lodash "^4.17.15" micromatch "^3.1.10" - slash "^3.0.0" gatsby-plugin-antd@^2.0.2: version "2.1.0" @@ -10500,7 +10594,14 @@ gatsby-plugin-copy-files@^1.0.3: dependencies: fs-extra "^4.0.0" -gatsby-plugin-google-analytics@^2.1.16, gatsby-plugin-google-analytics@^2.1.27: +gatsby-plugin-google-analytics@^2.1.16: + version "2.1.28" + resolved "https://registry.npm.alibaba-inc.com/gatsby-plugin-google-analytics/download/gatsby-plugin-google-analytics-2.1.28.tgz#3f3b5105a1d47e3f07b1d4a4383e5173f483534c" + integrity sha1-PztRBaHUfj8HsdSkOD5Rc/SDU0w= + dependencies: + "@babel/runtime" "^7.7.2" + +gatsby-plugin-google-analytics@^2.1.27: version "2.1.27" resolved "https://registry.npm.alibaba-inc.com/gatsby-plugin-google-analytics/download/gatsby-plugin-google-analytics-2.1.27.tgz#adbf24bb971ce3fb67ecdc3dcec36b833ff70abc" integrity sha1-rb8ku5cc4/tn7Nw9zsNrgz/3Crw= @@ -10532,12 +10633,12 @@ gatsby-plugin-less@^3.0.6: less-loader "^5.0.0" gatsby-plugin-manifest@^2.2.16: - version "2.2.28" - resolved "https://registry.npm.alibaba-inc.com/gatsby-plugin-manifest/download/gatsby-plugin-manifest-2.2.28.tgz#17464f404c58b748ebd34efbf783a6f5b0f85f1b" - integrity sha1-F0ZPQExYt0jr007794Om9bD4Xxs= + version "2.2.29" + resolved "https://registry.npm.alibaba-inc.com/gatsby-plugin-manifest/download/gatsby-plugin-manifest-2.2.29.tgz#f5c4d65c424059007f8c23a49e332436614c03a4" + integrity sha1-9cTWXEJAWQB/jCOknjMkNmFMA6Q= dependencies: "@babel/runtime" "^7.7.2" - gatsby-core-utils "^1.0.19" + gatsby-core-utils "^1.0.20" semver "^5.7.1" sharp "^0.23.2" @@ -10557,27 +10658,27 @@ gatsby-plugin-nprogress@^2.1.12: nprogress "^0.2.0" gatsby-plugin-offline@^3.0.7: - version "3.0.21" - resolved "https://registry.npm.alibaba-inc.com/gatsby-plugin-offline/download/gatsby-plugin-offline-3.0.21.tgz#0fad8f372c6414ab7b3475838729126b13dd49e2" - integrity sha1-D62PNyxkFKt7NHWDhykSaxPdSeI= + version "3.0.22" + resolved "https://registry.npm.alibaba-inc.com/gatsby-plugin-offline/download/gatsby-plugin-offline-3.0.22.tgz#a8fb03e4d6abbd8cc14a03a9427424734675d484" + integrity sha1-qPsD5NarvYzBSgOpQnQkc0Z11IQ= dependencies: "@babel/runtime" "^7.7.2" cheerio "^1.0.0-rc.3" + gatsby-core-utils "^1.0.20" glob "^7.1.6" idb-keyval "^3.2.0" lodash "^4.17.15" - slash "^3.0.0" workbox-build "^4.3.1" -gatsby-plugin-page-creator@^2.1.25, gatsby-plugin-page-creator@^2.1.30: - version "2.1.30" - resolved "https://registry.npm.alibaba-inc.com/gatsby-plugin-page-creator/download/gatsby-plugin-page-creator-2.1.30.tgz#ee57c6a8ac4cdbed7fa3ae99e6ada0df427d7fed" - integrity sha1-7lfGqKxM2+1/o66Z5q2g30J9f+0= +gatsby-plugin-page-creator@^2.1.25, gatsby-plugin-page-creator@^2.1.30, gatsby-plugin-page-creator@^2.1.31: + version "2.1.31" + resolved "https://registry.npm.alibaba-inc.com/gatsby-plugin-page-creator/download/gatsby-plugin-page-creator-2.1.31.tgz#21554d125d5bd333b5307ea12ece7da297a8eb89" + integrity sha1-IVVNEl1b0zO1MH6hLs59opeo64k= dependencies: "@babel/runtime" "^7.7.2" bluebird "^3.7.1" fs-exists-cached "^1.0.0" - gatsby-page-utils "^0.0.30" + gatsby-page-utils "^0.0.31" glob "^7.1.6" lodash "^4.17.15" micromatch "^3.1.10" @@ -10597,15 +10698,15 @@ gatsby-plugin-remove-trailing-slashes@^2.1.9: "@babel/runtime" "^7.7.2" gatsby-plugin-sharp@^2.2.22: - version "2.3.0" - resolved "https://registry.npm.alibaba-inc.com/gatsby-plugin-sharp/download/gatsby-plugin-sharp-2.3.0.tgz#50f545f9b54c68727a560cc1f08590d032a787a0" - integrity sha1-UPVF+bVMaHJ6VgzB8IWQ0DKnh6A= + version "2.3.2" + resolved "https://registry.npm.alibaba-inc.com/gatsby-plugin-sharp/download/gatsby-plugin-sharp-2.3.2.tgz#bf9eb6234f7a6c38a9611466f4bd7fae14635dd4" + integrity sha1-v562I096bDipYRRm9L1/rhRjXdQ= dependencies: "@babel/runtime" "^7.7.2" async "^2.6.3" bluebird "^3.7.1" fs-extra "^8.1.0" - gatsby-core-utils "^1.0.19" + gatsby-core-utils "^1.0.20" got "^8.3.2" imagemin "^6.1.0" imagemin-mozjpeg "^8.0.0" @@ -10693,9 +10794,9 @@ gatsby-remark-reading-time@^1.0.1: reading-time "^1.1.3" gatsby-source-filesystem@^2.1.22: - version "2.1.37" - resolved "https://registry.npm.alibaba-inc.com/gatsby-source-filesystem/download/gatsby-source-filesystem-2.1.37.tgz#2738e3031028730952e042cf45421873c2f18d58" - integrity sha1-JzjjAxAocwlS4ELPRUIYc8LxjVg= + version "2.1.38" + resolved "https://registry.npm.alibaba-inc.com/gatsby-source-filesystem/download/gatsby-source-filesystem-2.1.38.tgz#174fbef19826844c92e5679cb2e379eeb52acf80" + integrity sha1-F0++8ZgmhEyS5WecsuN57rUqz4A= dependencies: "@babel/runtime" "^7.7.2" better-queue "^3.8.10" @@ -10703,7 +10804,7 @@ gatsby-source-filesystem@^2.1.22: chokidar "3.3.0" file-type "^12.4.0" fs-extra "^8.1.0" - gatsby-core-utils "^1.0.19" + gatsby-core-utils "^1.0.20" got "^7.1.0" md5-file "^3.2.3" mime "^2.4.4" @@ -10722,10 +10823,10 @@ gatsby-source-github@^0.0.2: lodash "~4.17.5" yup "~0.24.1" -gatsby-telemetry@^1.1.37: - version "1.1.37" - resolved "https://registry.npm.alibaba-inc.com/gatsby-telemetry/download/gatsby-telemetry-1.1.37.tgz#bf640de90ae07c85587e70745472f0777998c468" - integrity sha1-v2QN6QrgfIVYfnB0VHLwd3mYxGg= +gatsby-telemetry@^1.1.37, gatsby-telemetry@^1.1.38: + version "1.1.38" + resolved "https://registry.npm.alibaba-inc.com/gatsby-telemetry/download/gatsby-telemetry-1.1.38.tgz#e8ac949565b87e37699ccbd067f55cc2fe62793e" + integrity sha1-6KyUlWW4fjdpnMvQZ/Vcwv5ieT4= dependencies: "@babel/code-frame" "^7.5.5" "@babel/runtime" "^7.7.2" @@ -10734,7 +10835,7 @@ gatsby-telemetry@^1.1.37: configstore "^5.0.0" envinfo "^7.4.0" fs-extra "^8.1.0" - gatsby-core-utils "^1.0.19" + gatsby-core-utils "^1.0.20" git-up "4.0.1" is-docker "2.0.0" lodash "^4.17.15" @@ -10746,13 +10847,13 @@ gatsby-telemetry@^1.1.37: uuid "3.3.3" gatsby-transformer-remark@^2.6.24: - version "2.6.35" - resolved "https://registry.npm.alibaba-inc.com/gatsby-transformer-remark/download/gatsby-transformer-remark-2.6.35.tgz#f91ce377e6cc758515cf80d4b19169880e640c1b" - integrity sha1-+Rzjd+bMdYUVz4DUsZFpiA5kDBs= + version "2.6.37" + resolved "https://registry.npm.alibaba-inc.com/gatsby-transformer-remark/download/gatsby-transformer-remark-2.6.37.tgz#695202116d94a85f02a122753e8a1d22f73a12b3" + integrity sha1-aVICEW2UqF8CoSJ1PoodIvc6ErM= dependencies: "@babel/runtime" "^7.7.2" bluebird "^3.7.1" - gatsby-core-utils "^1.0.19" + gatsby-core-utils "^1.0.20" gray-matter "^4.0.2" hast-util-raw "^4.0.0" hast-util-to-html "^4.0.1" @@ -10785,7 +10886,144 @@ gatsby-transformer-sharp@^2.2.14: semver "^5.7.1" sharp "^0.23.2" -gatsby@^2.15.16, gatsby@^2.17.7: +gatsby@^2.15.16: + version "2.17.17" + resolved "https://registry.npm.alibaba-inc.com/gatsby/download/gatsby-2.17.17.tgz#f0999ce134d9abc8f29fc783abe90f69d3b08269" + integrity sha1-8Jmc4TTZq8jyn8eDq+kPadOwgmk= + dependencies: + "@babel/code-frame" "^7.5.5" + "@babel/core" "^7.7.2" + "@babel/parser" "^7.7.3" + "@babel/polyfill" "^7.7.0" + "@babel/runtime" "^7.7.2" + "@babel/traverse" "^7.7.2" + "@gatsbyjs/relay-compiler" "2.0.0-printer-fix.4" + "@hapi/joi" "^15.1.1" + "@mikaelkristiansson/domready" "^1.0.9" + "@pieh/friendly-errors-webpack-plugin" "1.7.0-chalk-2" + "@reach/router" "^1.2.1" + "@typescript-eslint/eslint-plugin" "^2.7.0" + "@typescript-eslint/parser" "^2.7.0" + address "1.1.2" + autoprefixer "^9.7.1" + axios "^0.19.0" + babel-core "7.0.0-bridge.0" + babel-eslint "^10.0.3" + babel-loader "^8.0.6" + babel-plugin-add-module-exports "^0.3.3" + babel-plugin-dynamic-import-node "^2.3.0" + babel-plugin-remove-graphql-queries "^2.7.16" + babel-preset-gatsby "^0.2.22" + better-opn "1.0.0" + better-queue "^3.8.10" + bluebird "^3.7.1" + browserslist "3.2.8" + cache-manager "^2.10.1" + cache-manager-fs-hash "^0.0.7" + chalk "^2.4.2" + chokidar "3.3.0" + common-tags "^1.8.0" + compression "^1.7.4" + convert-hrtime "^3.0.0" + copyfiles "^2.1.1" + core-js "^2.6.10" + cors "^2.8.5" + css-loader "^1.0.1" + debug "^3.2.6" + del "^5.1.0" + detect-port "^1.3.0" + devcert-san "^0.3.3" + dotenv "^8.2.0" + eslint "^6.6.0" + eslint-config-react-app "^5.0.2" + eslint-loader "^2.2.1" + eslint-plugin-flowtype "^3.13.0" + eslint-plugin-graphql "^3.1.0" + eslint-plugin-import "^2.18.2" + eslint-plugin-jsx-a11y "^6.2.3" + eslint-plugin-react "^7.16.0" + eslint-plugin-react-hooks "^1.7.0" + event-source-polyfill "^1.0.9" + express "^4.17.1" + express-graphql "^0.9.0" + fast-levenshtein "^2.0.6" + file-loader "^1.1.11" + flat "^4.1.0" + fs-exists-cached "1.0.0" + fs-extra "^8.1.0" + gatsby-cli "^2.8.12" + gatsby-core-utils "^1.0.20" + gatsby-graphiql-explorer "^0.2.28" + gatsby-link "^2.2.24" + gatsby-plugin-page-creator "^2.1.31" + gatsby-react-router-scroll "^2.1.16" + gatsby-telemetry "^1.1.38" + glob "^7.1.6" + got "8.3.2" + graphql "^14.5.8" + graphql-compose "^6.3.7" + graphql-playground-middleware-express "^1.7.12" + invariant "^2.2.4" + is-relative "^1.0.0" + is-relative-url "^3.0.0" + is-wsl "^2.1.1" + jest-worker "^24.9.0" + json-loader "^0.5.7" + json-stringify-safe "^5.0.1" + lodash "^4.17.15" + lokijs "^1.5.8" + md5 "^2.2.1" + md5-file "^3.2.3" + micromatch "^3.1.10" + mime "^2.4.4" + mini-css-extract-plugin "^0.8.0" + mitt "^1.2.0" + mkdirp "^0.5.1" + moment "^2.24.0" + name-all-modules-plugin "^1.0.1" + normalize-path "^2.1.1" + null-loader "^0.1.1" + opentracing "^0.14.4" + optimize-css-assets-webpack-plugin "^5.0.3" + parseurl "^1.3.3" + physical-cpu-count "^2.0.0" + pnp-webpack-plugin "^1.5.0" + postcss-flexbugs-fixes "^3.3.1" + postcss-loader "^2.1.6" + prompts "^2.3.0" + prop-types "^15.7.2" + raw-loader "^0.5.1" + react-dev-utils "^4.2.3" + react-error-overlay "^3.0.0" + react-hot-loader "^4.12.16" + redux "^4.0.4" + redux-thunk "^2.3.0" + semver "^5.7.1" + shallow-compare "^1.2.2" + sift "^5.1.0" + signal-exit "^3.0.2" + slugify "^1.3.6" + socket.io "^2.3.0" + stack-trace "^0.0.10" + string-similarity "^1.2.2" + style-loader "^0.23.1" + terser-webpack-plugin "1.4.1" + "true-case-path" "^2.2.1" + type-of "^2.0.1" + url-loader "^1.1.2" + util.promisify "^1.0.0" + uuid "^3.3.3" + v8-compile-cache "^1.1.2" + webpack "~4.41.2" + webpack-dev-middleware "^3.7.2" + webpack-dev-server "^3.9.0" + webpack-hot-middleware "^2.25.0" + webpack-merge "^4.2.2" + webpack-stats-plugin "^0.3.0" + xstate "^4.6.7" + yaml-loader "^0.5.0" + +gatsby@^2.17.7: version "2.17.15" resolved "https://registry.npm.alibaba-inc.com/gatsby/download/gatsby-2.17.15.tgz#731e44f4292256889f374d434d56ace29ac2cfec" integrity sha1-cx5E9CkiVoifN01DTVas4prCz+w= @@ -11770,9 +12008,9 @@ has-symbol-support-x@^1.4.1: integrity sha1-FAn5i8ACR9pF2mfO4KNvKC/yZFU= has-symbols@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.alibaba-inc.com/has-symbols/download/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" - integrity sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q= + version "1.0.1" + resolved "https://registry.npm.alibaba-inc.com/has-symbols/download/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" + integrity sha1-n1IUdYpEGWxAbZvXbOv4HsLdMeg= has-to-string-tag-x@^1.2.0: version "1.4.1" @@ -11968,6 +12206,14 @@ hmac-drbg@^1.0.0: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" +hogan.js@^3.0.2: + version "3.0.2" + resolved "https://registry.npm.alibaba-inc.com/hogan.js/download/hogan.js-3.0.2.tgz#4cd9e1abd4294146e7679e41d7898732b02c7bfd" + integrity sha1-TNnhq9QpQUbnZ55B14mHMrAse/0= + dependencies: + mkdirp "0.3.0" + nopt "1.0.10" + hoist-non-react-statics@^2.3.1, hoist-non-react-statics@^2.5.0: version "2.5.5" resolved "https://registry.npm.alibaba-inc.com/hoist-non-react-statics/download/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47" @@ -12398,6 +12644,11 @@ imagemin@^6.1.0: pify "^4.0.1" replace-ext "^1.0.0" +immediate@^3.2.3: + version "3.2.3" + resolved "https://registry.npm.alibaba-inc.com/immediate/download/immediate-3.2.3.tgz#d140fa8f614659bd6541233097ddaac25cdd991c" + integrity sha1-0UD6j2FGWb1lQSMwl92qwlzdmRw= + immer@1.10.0: version "1.10.0" resolved "https://registry.npm.alibaba-inc.com/immer/download/immer-1.10.0.tgz#bad67605ba9c810275d91e1c2a47d4582e98286d" @@ -13387,6 +13638,11 @@ isarray@2.0.1: resolved "https://registry.npm.alibaba-inc.com/isarray/download/isarray-2.0.1.tgz#a37d94ed9cda2d59865c9f76fe596ee1f338741e" integrity sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4= +isarray@^2.0.1: + version "2.0.5" + resolved "https://registry.npm.alibaba-inc.com/isarray/download/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" + integrity sha1-ivHkwSISRMxiRZ+vOJQNTmRKVyM= + isexe@^2.0.0: version "2.0.0" resolved "https://registry.npm.alibaba-inc.com/isexe/download/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" @@ -14428,6 +14684,11 @@ load-json-file@^5.3.0: strip-bom "^3.0.0" type-fest "^0.3.0" +load-script@^1.0.0: + version "1.0.0" + resolved "https://registry.npm.alibaba-inc.com/load-script/download/load-script-1.0.0.tgz#0491939e0bee5643ee494a7e3da3d2bac70c6ca4" + integrity sha1-BJGTngvuVkPuSUp+PaPSuscMbKQ= + loader-fs-cache@^1.0.0: version "1.0.2" resolved "https://registry.npm.alibaba-inc.com/loader-fs-cache/download/loader-fs-cache-1.0.2.tgz#54cedf6b727e1779fd8f01205f05f6e88706f086" @@ -15580,6 +15841,11 @@ mkdirp@*, mkdirp@0.5.1, mkdirp@0.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5 dependencies: minimist "0.0.8" +mkdirp@0.3.0: + version "0.3.0" + resolved "https://registry.npm.alibaba-inc.com/mkdirp/download/mkdirp-0.3.0.tgz#1bbf5ab1ba827af23575143490426455f481fe1e" + integrity sha1-G79asbqCevI1dRQ0kEJkVfSB/h4= + modify-values@^1.0.0: version "1.0.1" resolved "https://registry.npm.alibaba-inc.com/modify-values/download/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" @@ -15993,7 +16259,7 @@ node-pre-gyp@^0.12.0: semver "^5.3.0" tar "^4" -node-releases@^1.1.29, node-releases@^1.1.38: +node-releases@^1.1.29, node-releases@^1.1.40: version "1.1.40" resolved "https://registry.npm.alibaba-inc.com/node-releases/download/node-releases-1.1.40.tgz#a94facfa8e2d612302601ca1361741d529c4515a" integrity sha1-qU+s+o4tYSMCYByhNhdB1SnEUVo= @@ -16036,6 +16302,13 @@ noop-logger@^0.1.1: resolved "https://registry.npm.alibaba-inc.com/noop-logger/download/noop-logger-0.1.1.tgz#94a2b1633c4f1317553007d8966fd0e841b6a4c2" integrity sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI= +nopt@1.0.10: + version "1.0.10" + resolved "https://registry.npm.alibaba-inc.com/nopt/download/nopt-1.0.10.tgz#6ddd21bd2a31417b92727dd585f8a6f37608ebee" + integrity sha1-bd0hvSoxQXuScn3Vhfim83YI6+4= + dependencies: + abbrev "1" + "nopt@2 || 3": version "3.0.6" resolved "https://registry.npm.alibaba-inc.com/nopt/download/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" @@ -16326,7 +16599,7 @@ object-is@^1.0.1: resolved "https://registry.npm.alibaba-inc.com/object-is/download/object-is-1.0.1.tgz#0aa60ec9989a0b3ed795cf4d06f62cf1ad6539b6" integrity sha1-CqYOyZiaCz7Xlc9NBvYs8a1lObY= -object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.1.1: +object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.1.0, object-keys@^1.1.1: version "1.1.1" resolved "https://registry.npm.alibaba-inc.com/object-keys/download/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha1-HEfyct8nfzsdrwYWd9nILiMixg4= @@ -17849,7 +18122,16 @@ postcss@^6.0.0, postcss@^6.0.1, postcss@^6.0.2, postcss@^6.0.23, postcss@^6.0.8: source-map "^0.6.1" supports-color "^5.4.0" -postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.13, postcss@^7.0.14, postcss@^7.0.16, postcss@^7.0.17, postcss@^7.0.18, postcss@^7.0.2, postcss@^7.0.21, postcss@^7.0.5, postcss@^7.0.6, postcss@^7.0.7: +postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.21, postcss@^7.0.23, postcss@^7.0.5: + version "7.0.23" + resolved "https://registry.npm.alibaba-inc.com/postcss/download/postcss-7.0.23.tgz#9f9759fad661b15964f3cfc3140f66f1e05eadc1" + integrity sha1-n5dZ+tZhsVlk88/DFA9m8eBercE= + dependencies: + chalk "^2.4.2" + source-map "^0.6.1" + supports-color "^6.1.0" + +postcss@^7.0.13, postcss@^7.0.14, postcss@^7.0.16, postcss@^7.0.17, postcss@^7.0.18, postcss@^7.0.2, postcss@^7.0.6, postcss@^7.0.7: version "7.0.21" resolved "https://registry.npm.alibaba-inc.com/postcss/download/postcss-7.0.21.tgz#06bb07824c19c2021c5d056d5b10c35b989f7e17" integrity sha1-BrsHgkwZwgIcXQVtWxDDW5iffhc= @@ -17870,7 +18152,7 @@ potrace@^2.1.2: dependencies: jimp "^0.6.4" -prebuild-install@^5.1.0, prebuild-install@^5.3.2: +prebuild-install@^5.1.0, prebuild-install@^5.3.3: version "5.3.3" resolved "https://registry.npm.alibaba-inc.com/prebuild-install/download/prebuild-install-5.3.3.tgz#ef4052baac60d465f5ba6bf003c9c1de79b9da8e" integrity sha1-70BSuqxg1GX1umvwA8nB3nm52o4= @@ -18254,7 +18536,7 @@ query-string@^5.0.1: object-assign "^4.1.0" strict-uri-encode "^1.0.0" -querystring-es3@^0.2.0: +querystring-es3@^0.2.0, querystring-es3@^0.2.1: version "0.2.1" resolved "https://registry.npm.alibaba-inc.com/querystring-es3/download/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" integrity sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM= @@ -19218,7 +19500,7 @@ react-transition-group@^2.2.1: prop-types "^15.6.2" react-lifecycles-compat "^3.0.4" -react-use@^13.6.3: +react-use@^13.8.0: version "13.8.0" resolved "https://registry.npm.alibaba-inc.com/react-use/download/react-use-13.8.0.tgz#5e8badaaa5614a1925fd28ad22d01cc1c52e0ff1" integrity sha1-XoutqqVhShkl/SitItAcwcUuD/E= @@ -19513,6 +19795,13 @@ redeyed@~0.4.0: dependencies: esprima "~1.0.4" +reduce@^1.0.1: + version "1.0.2" + resolved "https://registry.npm.alibaba-inc.com/reduce/download/reduce-1.0.2.tgz#0cd680ad3ffe0b060e57a5c68bdfce37168d361b" + integrity sha1-DNaArT/+CwYOV6XGi9/ONxaNNhs= + dependencies: + object-keys "^1.1.0" + redux-thunk@^2.3.0: version "2.3.0" resolved "https://registry.npm.alibaba-inc.com/redux-thunk/download/redux-thunk-2.3.0.tgz#51c2c19a185ed5187aaa9a2d08b666d0d6467622" @@ -19609,6 +19898,11 @@ regexpp@^2.0.1: resolved "https://registry.npm.alibaba-inc.com/regexpp/download/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" integrity sha1-jRnTHPYySCtYkEn4KB+T28uk0H8= +regexpp@^3.0.0: + version "3.0.0" + resolved "https://registry.npm.alibaba-inc.com/regexpp/download/regexpp-3.0.0.tgz#dd63982ee3300e67b41c1956f850aa680d9d330e" + integrity sha1-3WOYLuMwDme0HBlW+FCqaA2dMw4= + regexpu-core@^1.0.0: version "1.0.0" resolved "https://registry.npm.alibaba-inc.com/regexpu-core/download/regexpu-core-1.0.0.tgz#86a763f58ee4d7c2f6b102e4764050de7ed90c6b" @@ -20697,15 +20991,15 @@ sharkdown@^0.1.0: split "~0.2.10" sharp@^0.23.2: - version "0.23.2" - resolved "https://registry.npm.alibaba-inc.com/sharp/download/sharp-0.23.2.tgz#5f8b77513aa1f7e4d0dd969a3904ced75486c1d7" - integrity sha1-X4t3UTqh9+TQ3ZaaOQTO11SGwdc= + version "0.23.3" + resolved "https://registry.npm.alibaba-inc.com/sharp/download/sharp-0.23.3.tgz#549770a4c671b9bd221f00639452a3eb803a0ed1" + integrity sha1-VJdwpMZxub0iHwBjlFKj64A6DtE= dependencies: color "^3.1.2" detect-libc "^1.0.3" nan "^2.14.0" npmlog "^4.1.2" - prebuild-install "^5.3.2" + prebuild-install "^5.3.3" semver "^6.3.0" simple-get "^3.1.0" tar "^5.0.5" @@ -20892,6 +21186,11 @@ slide@^1.1.6: resolved "https://registry.npm.alibaba-inc.com/slide/download/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" integrity sha1-VusCfWW00tzmyy4tMsTUr8nh1wc= +slugify@^1.3.6: + version "1.3.6" + resolved "https://registry.npm.alibaba-inc.com/slugify/download/slugify-1.3.6.tgz#ba5fd6159b570fe4811d02ea9b1f4906677638c3" + integrity sha1-ul/WFZtXD+SBHQLqmx9JBmd2OMM= + smart-buffer@^1.0.13: version "1.1.15" resolved "https://registry.npm.alibaba-inc.com/smart-buffer/download/smart-buffer-1.1.15.tgz#7f114b5b65fab3e2a35aa775bb12f0d1c649bf16" @@ -22307,6 +22606,11 @@ to-buffer@^1.1.1: resolved "https://registry.npm.alibaba-inc.com/to-buffer/download/to-buffer-1.1.1.tgz#493bd48f62d7c43fcded313a03dcadb2e1213a80" integrity sha1-STvUj2LXxD/N7TE6A9ytsuEhOoA= +to-factory@^1.0.0: + version "1.0.0" + resolved "https://registry.npm.alibaba-inc.com/to-factory/download/to-factory-1.0.0.tgz#8738af8bd97120ad1d4047972ada5563bf9479b1" + integrity sha1-hzivi9lxIK0dQEeXKtpVY7+UebE= + to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.npm.alibaba-inc.com/to-fast-properties/download/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" @@ -22559,16 +22863,16 @@ type-fest@^0.3.0: resolved "https://registry.npm.alibaba-inc.com/type-fest/download/type-fest-0.3.1.tgz#63d00d204e059474fe5e1b7c011112bbd1dc29e1" integrity sha1-Y9ANIE4FlHT+Xht8ARESu9HcKeE= -type-fest@^0.5.2: - version "0.5.2" - resolved "https://registry.npm.alibaba-inc.com/type-fest/download/type-fest-0.5.2.tgz#d6ef42a0356c6cd45f49485c3b6281fc148e48a2" - integrity sha1-1u9CoDVsbNRfSUhcO2KB/BSOSKI= - type-fest@^0.6.0: version "0.6.0" resolved "https://registry.npm.alibaba-inc.com/type-fest/download/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b" integrity sha1-jSojcNPfiG61yQraHFv2GIrPg4s= +type-fest@^0.8.1: + version "0.8.1" + resolved "https://registry.npm.alibaba-inc.com/type-fest/download/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" + integrity sha1-CeJJ696FHTseSNJ8EFREZn8XuD0= + type-is@~1.6.17, type-is@~1.6.18: version "1.6.18" resolved "https://registry.npm.alibaba-inc.com/type-is/download/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" @@ -23547,9 +23851,9 @@ which@1, which@^1.2.12, which@^1.2.14, which@^1.2.9, which@^1.3.0, which@^1.3.1: isexe "^2.0.0" which@^2.0.1: - version "2.0.1" - resolved "https://registry.npm.alibaba-inc.com/which/download/which-2.0.1.tgz#f1cf94d07a8e571b6ff006aeb91d0300c47ef0a4" - integrity sha1-8c+U0HqOVxtv8AauuR0DAMR+8KQ= + version "2.0.2" + resolved "https://registry.npm.alibaba-inc.com/which/download/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha1-fGqN0KY2oDJ+ELWckobu6T8/UbE= dependencies: isexe "^2.0.0" @@ -24221,6 +24525,11 @@ yurnalist@^1.1.1: strip-ansi "^5.2.0" strip-bom "^4.0.0" +zepto@^1.2.0: + version "1.2.0" + resolved "https://registry.npm.alibaba-inc.com/zepto/download/zepto-1.2.0.tgz#e127bd9e66fd846be5eab48c1394882f7c0e4f98" + integrity sha1-4Se9nmb9hGvl6rSME5SIL3wOT5g= + zwitch@^1.0.0: version "1.0.4" resolved "https://registry.npm.alibaba-inc.com/zwitch/download/zwitch-1.0.4.tgz#93b1b993b13c8926753a41afaf8f27bbfac6be8b"