From 7bfdb4b7c1e0a4720a461234e405fc909c390863 Mon Sep 17 00:00:00 2001 From: YiQianYao <42212176+2912401452@users.noreply.github.com> Date: Tue, 12 Oct 2021 14:39:08 +0800 Subject: [PATCH] Shihui dev (#797) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add getModelMatrix into viewport * feat: 新增地球模式 (初步构建) * feat: 完善地球交互 * style: lint style * feat: 调整地球图层缩放的方向 * style: lint style * feat: 增加地球模式的 pointLayer/fill 图层 * style: lint style * feat: 增加地球、太阳的简单运动系统,优化部分代码结构 * fix: 修复时间点击出错 * style: lint style * fix: 修复地图 panBy 方法参数错误 * style: lint style * feat: pointLayer/cylinder 圆柱兼容地球模式 * style: lint style * feat: 修复 pointLayer/fill 在拾取是破面严重的情况 * style: lint style * feat: 增加 arc 弧度调节 * feat: 增加 lineLayer/arc3d 兼容地球模式 * style: lint style * feat: 增加地球图层 - 大气层 * style: lint style * feat: 增加设置可视化层背景色的能力 * style: lint style * feat: 增加地球外发光效果 * style: lint style * feat: 允许用户不使用 layer 的 source 方法 - 地球模式下光晕图层不需要传数据 * style: lint style * feat: 调整光晕的 shader 计算 * chore: update version 2.5.32 -> 2.5.33 * feat: 调整地球大气层的渲染层级 * style: lint style * feat: 调整案例 * style: lint style --- lerna.json | 2 +- packages/component/package.json | 6 +-- packages/core/package.json | 4 +- packages/l7/package.json | 14 +++--- packages/l7/src/version.ts | 2 +- packages/layers/package.json | 8 ++-- .../layers/src/earth/models/atmosphere.ts | 2 + packages/layers/src/earth/models/base.ts | 2 + packages/map/package.json | 4 +- packages/maps/package.json | 8 ++-- packages/renderer/package.json | 4 +- packages/scene/package.json | 14 +++--- packages/source/package.json | 6 +-- packages/three/package.json | 8 ++-- packages/utils/package.json | 2 +- stories/customMap/components/earth.tsx | 48 ++++++++++++++++--- stories/customMap/components/earth2.tsx | 33 +------------ 17 files changed, 87 insertions(+), 80 deletions(-) diff --git a/lerna.json b/lerna.json index 5f17e3dbf9..b808377bd1 100644 --- a/lerna.json +++ b/lerna.json @@ -14,7 +14,7 @@ "message": "chore: publish" } }, - "version": "2.5.32", + "version": "2.5.33", "npmClient": "yarn", "useWorkspaces": true, "publishConfig": { diff --git a/packages/component/package.json b/packages/component/package.json index 5e1304a16a..5c9dd6889e 100644 --- a/packages/component/package.json +++ b/packages/component/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-component", - "version": "2.5.32", + "version": "2.5.33", "description": "", "main": "lib/index.js", "module": "es/index.js", @@ -25,8 +25,8 @@ "author": "lzxue", "license": "ISC", "dependencies": { - "@antv/l7-core": "^2.5.32", - "@antv/l7-utils": "^2.5.32", + "@antv/l7-core": "^2.5.33", + "@antv/l7-utils": "^2.5.33", "@babel/runtime": "^7.7.7", "eventemitter3": "^4.0.0", "inversify": "^5.0.1", diff --git a/packages/core/package.json b/packages/core/package.json index 54fac72cb4..37a8960168 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-core", - "version": "2.5.32", + "version": "2.5.33", "description": "", "main": "lib/index.js", "module": "es/index.js", @@ -24,7 +24,7 @@ "license": "ISC", "dependencies": { "@antv/async-hook": "^2.1.0", - "@antv/l7-utils": "^2.5.32", + "@antv/l7-utils": "^2.5.33", "@babel/runtime": "^7.7.7", "@mapbox/tiny-sdf": "^1.1.1", "ajv": "^6.10.2", diff --git a/packages/l7/package.json b/packages/l7/package.json index b6a8515db4..0d92d425aa 100644 --- a/packages/l7/package.json +++ b/packages/l7/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7", - "version": "2.5.32", + "version": "2.5.33", "description": "A Large-scale WebGL-powered Geospatial Data Visualization", "main": "lib/index.js", "module": "es/index.js", @@ -25,12 +25,12 @@ "author": "antv", "license": "MIT", "dependencies": { - "@antv/l7-component": "^2.5.32", - "@antv/l7-core": "^2.5.32", - "@antv/l7-layers": "^2.5.32", - "@antv/l7-maps": "^2.5.32", - "@antv/l7-scene": "^2.5.32", - "@antv/l7-utils": "^2.5.32", + "@antv/l7-component": "^2.5.33", + "@antv/l7-core": "^2.5.33", + "@antv/l7-layers": "^2.5.33", + "@antv/l7-maps": "^2.5.33", + "@antv/l7-scene": "^2.5.33", + "@antv/l7-utils": "^2.5.33", "@babel/runtime": "^7.7.7" }, "gitHead": "684ba4eb806a798713496d3fc0b4d1e17517dc31", diff --git a/packages/l7/src/version.ts b/packages/l7/src/version.ts index e9d870d0f7..36a721c77f 100644 --- a/packages/l7/src/version.ts +++ b/packages/l7/src/version.ts @@ -1,2 +1,2 @@ -const version = '2.5.32'; +const version = '2.5.33'; export { version }; diff --git a/packages/layers/package.json b/packages/layers/package.json index dd26da258f..0a52605bc9 100644 --- a/packages/layers/package.json +++ b/packages/layers/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-layers", - "version": "2.5.32", + "version": "2.5.33", "description": "L7's collection of built-in layers", "main": "lib/index.js", "module": "es/index.js", @@ -24,9 +24,9 @@ "license": "ISC", "dependencies": { "@antv/async-hook": "^2.1.0", - "@antv/l7-core": "^2.5.32", - "@antv/l7-source": "^2.5.32", - "@antv/l7-utils": "^2.5.32", + "@antv/l7-core": "^2.5.33", + "@antv/l7-source": "^2.5.33", + "@antv/l7-utils": "^2.5.33", "@babel/runtime": "^7.7.7", "@mapbox/martini": "^0.2.0", "@turf/meta": "^6.0.2", diff --git a/packages/layers/src/earth/models/atmosphere.ts b/packages/layers/src/earth/models/atmosphere.ts index e8a8e1e350..9134e583d2 100644 --- a/packages/layers/src/earth/models/atmosphere.ts +++ b/packages/layers/src/earth/models/atmosphere.ts @@ -34,6 +34,8 @@ export default class EarthAtomSphereModel extends BaseModel { } public buildModels(): IModel[] { + // TODO: 调整图层的绘制顺序 地球大气层 + this.layer.zIndex = -997; return [ this.layer.buildLayerModel({ moduleName: 'earthAtmoSphere', diff --git a/packages/layers/src/earth/models/base.ts b/packages/layers/src/earth/models/base.ts index 314042aaae..098b64338a 100644 --- a/packages/layers/src/earth/models/base.ts +++ b/packages/layers/src/earth/models/base.ts @@ -91,6 +91,8 @@ export default class BaseEarthModel extends BaseModel { } public buildModels(): IModel[] { + // TODO: 调整图层的绘制顺序 地球大气层 + this.layer.zIndex = -998; return [ this.layer.buildLayerModel({ moduleName: 'baseEarth', diff --git a/packages/map/package.json b/packages/map/package.json index 836950b0b7..95a113dab7 100644 --- a/packages/map/package.json +++ b/packages/map/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-map", - "version": "2.5.32", + "version": "2.5.33", "description": "l7 map", "keywords": [], "author": "thinkinggis ", @@ -37,7 +37,7 @@ }, "homepage": "https://github.com/antvis/L7#readme", "dependencies": { - "@antv/l7-utils": "^2.5.32", + "@antv/l7-utils": "^2.5.33", "@babel/runtime": "^7.7.7", "@mapbox/point-geometry": "^0.1.0", "@mapbox/unitbezier": "^0.0.0", diff --git a/packages/maps/package.json b/packages/maps/package.json index 5e205f017f..b741ae8c68 100644 --- a/packages/maps/package.json +++ b/packages/maps/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-maps", - "version": "2.5.32", + "version": "2.5.33", "description": "", "main": "lib/index.js", "module": "es/index.js", @@ -27,9 +27,9 @@ "license": "ISC", "dependencies": { "@amap/amap-jsapi-loader": "^0.0.3", - "@antv/l7-core": "^2.5.32", - "@antv/l7-map": "^2.5.32", - "@antv/l7-utils": "^2.5.32", + "@antv/l7-core": "^2.5.33", + "@antv/l7-map": "^2.5.33", + "@antv/l7-utils": "^2.5.33", "@babel/runtime": "^7.7.7", "@types/amap-js-api": "^1.4.6", "@types/mapbox-gl": "^1.11.2", diff --git a/packages/renderer/package.json b/packages/renderer/package.json index a4c4bb67b8..ca5580de8e 100644 --- a/packages/renderer/package.json +++ b/packages/renderer/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-renderer", - "version": "2.5.32", + "version": "2.5.33", "description": "", "main": "lib/index.js", "module": "es/index.js", @@ -26,7 +26,7 @@ "gl": "^4.4.0" }, "dependencies": { - "@antv/l7-core": "^2.5.32", + "@antv/l7-core": "^2.5.33", "@babel/runtime": "^7.7.7", "inversify": "^5.0.1", "l7regl": "^0.0.14", diff --git a/packages/scene/package.json b/packages/scene/package.json index d2b60b3a7d..a44b4897d9 100644 --- a/packages/scene/package.json +++ b/packages/scene/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-scene", - "version": "2.5.32", + "version": "2.5.33", "description": "", "main": "lib/index.js", "module": "es/index.js", @@ -23,12 +23,12 @@ "author": "xiaoiver", "license": "ISC", "dependencies": { - "@antv/l7-component": "^2.5.32", - "@antv/l7-core": "^2.5.32", - "@antv/l7-layers": "^2.5.32", - "@antv/l7-maps": "^2.5.32", - "@antv/l7-renderer": "^2.5.32", - "@antv/l7-utils": "^2.5.32", + "@antv/l7-component": "^2.5.33", + "@antv/l7-core": "^2.5.33", + "@antv/l7-layers": "^2.5.33", + "@antv/l7-maps": "^2.5.33", + "@antv/l7-renderer": "^2.5.33", + "@antv/l7-utils": "^2.5.33", "@babel/runtime": "^7.7.7", "inversify": "^5.0.1", "mapbox-gl": "^1.2.1", diff --git a/packages/source/package.json b/packages/source/package.json index 7593ed1c15..98b8d5be15 100644 --- a/packages/source/package.json +++ b/packages/source/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-source", - "version": "2.5.32", + "version": "2.5.33", "description": "", "main": "lib/index.js", "module": "es/index.js", @@ -26,8 +26,8 @@ "license": "ISC", "dependencies": { "@antv/async-hook": "^2.1.0", - "@antv/l7-core": "^2.5.32", - "@antv/l7-utils": "^2.5.32", + "@antv/l7-core": "^2.5.33", + "@antv/l7-utils": "^2.5.33", "@babel/runtime": "^7.7.7", "@mapbox/geojson-rewind": "^0.4.0", "@turf/helpers": "^6.1.4", diff --git a/packages/three/package.json b/packages/three/package.json index 54b354f992..88fd3d92c1 100644 --- a/packages/three/package.json +++ b/packages/three/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-three", - "version": "2.5.32", + "version": "2.5.33", "description": "three for L7 ", "keywords": [ "3D", @@ -44,9 +44,9 @@ }, "homepage": "https://github.com/antvis/L7#readme", "dependencies": { - "@antv/l7-core": "^2.5.32", - "@antv/l7-layers": "^2.5.32", - "@antv/l7-scene": "^2.5.32", + "@antv/l7-core": "^2.5.33", + "@antv/l7-layers": "^2.5.33", + "@antv/l7-scene": "^2.5.33", "@babel/runtime": "^7.7.7", "inversify": "^5.0.1", "reflect-metadata": "^0.1.13", diff --git a/packages/utils/package.json b/packages/utils/package.json index b986a27d38..415c554312 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-utils", - "version": "2.5.32", + "version": "2.5.33", "description": "", "main": "lib/index.js", "module": "es/index.js", diff --git a/stories/customMap/components/earth.tsx b/stories/customMap/components/earth.tsx index 48e038972c..b069189086 100644 --- a/stories/customMap/components/earth.tsx +++ b/stories/customMap/components/earth.tsx @@ -22,6 +22,28 @@ export default class ScaleComponent extends React.Component { }); var d = [ + { lng: 121.61865234375, lat: 25.29437116258816 }, + { lng: 121.058349609375, lat: 25.015928763367857 }, + { lng: 120.7177734375, lat: 24.587090339209634 }, + { lng: 120.28930664062499, lat: 23.936054914599815 }, + { lng: 120.12451171875, lat: 23.553916518321625 }, + { lng: 120.08056640625, lat: 23.120153621695614 }, + { lng: 120.234375, lat: 22.867317960075614 }, + { lng: 120.43212890625, lat: 22.52270570348246 }, + { lng: 120.65185546875, lat: 22.370396344320053 }, + { lng: 120.750732421875, lat: 21.922663209325922 }, + { lng: 120.948486328125, lat: 22.268764039073968 }, + { lng: 121.124267578125, lat: 22.806567100271522 }, + { lng: 121.56372070312499, lat: 23.915970370510227 }, + { lng: 121.88232421875, lat: 24.557116164309626 }, + { lng: 121.95922851562501, lat: 25.075648445630527 }, + { lng: 109.97314453125, lat: 20.076570104545173 }, + { lng: 108.896484375, lat: 19.663280219987662 }, + { lng: 108.61083984375, lat: 18.979025953255267 }, + { lng: 108.80859375, lat: 18.47960905583197 }, + { lng: 109.599609375, lat: 18.35452552912664 }, + { lng: 110.32470703125, lat: 18.771115062337024 }, + { lng: 111.005859375, lat: 19.78738018198621 }, { lng: 110, lat: 30 }, { lng: 127.657407, lat: 49.76027 }, { lng: 129.397818, lat: 49.4406 }, @@ -352,11 +374,11 @@ export default class ScaleComponent extends React.Component { }, }, ) - .shape('circle') - // .shape('cylinder') + // .shape('circle') + .shape('cylinder') .color('#f00') - // .size('', () => [1, 1, 10]) - .size(20) + .size('', () => [1, 1, 10]) + // .size(20) .style({ // opacity: 0.6, }) @@ -407,13 +429,25 @@ export default class ScaleComponent extends React.Component { // earthTime: 4.0 earthTime: 0.1, }, - }); - // .animate(true); + }) + .animate(true); // earthlayer.setEarthTime(4.0) + + const atomLayer = new EarthLayer() + .color('#2E8AE6') + .shape('atomSphere') + .style({ + opacity: 1, + }); + + const bloomLayer = new EarthLayer().color('#fff').shape('bloomSphere'); + scene.on('loaded', () => { scene.addLayer(earthlayer); scene.addLayer(pointlayer); - // console.log(pointlayer) + + scene.addLayer(atomLayer); + scene.addLayer(bloomLayer); earthlayer.setEarthTime(4.0); }); diff --git a/stories/customMap/components/earth2.tsx b/stories/customMap/components/earth2.tsx index 9b063e2b2a..ecea895796 100644 --- a/stories/customMap/components/earth2.tsx +++ b/stories/customMap/components/earth2.tsx @@ -23,36 +23,6 @@ export default class ScaleComponent extends React.Component { scene.setBgColor('#333'); - let data = [ - { - lng1: 100, - lat1: 30.0, - lng2: 130, - lat2: 30, - }, - ]; - - const lineLayer = new LineLayer({ - blend: 'normal', - }) - .source(data, { - parser: { - type: 'json', - x: 'lng1', - y: 'lat1', - x1: 'lng2', - y1: 'lat2', - }, - }) - .size(2) - .shape('arc3d') - .color('#8C1EB2'); - // .animate(true) - // .animate({ - // duration: 50, - // interval: 0.2, - // trailLength: 0.05, - // }); fetch( 'https://gw.alipayobjects.com/os/basement_prod/a5ac7bce-181b-40d1-8a16-271356264ad8.json', ) @@ -79,7 +49,7 @@ export default class ScaleComponent extends React.Component { }) .color('#b97feb') .shape('arc3d') - .size(1) + .size(0.5) .active(true) .animate({ interval: 2, @@ -143,7 +113,6 @@ export default class ScaleComponent extends React.Component { // earthlayer.setEarthTime(4.0); scene.addLayer(atomLayer); scene.addLayer(bloomLayer); - scene.addLayer(lineLayer); }); }