From bc7c6718a62c8f2dceae61a06dc2cfdba30eeeb2 Mon Sep 17 00:00:00 2001 From: YiQianYao <42212176+2912401452@users.noreply.github.com> Date: Tue, 28 Sep 2021 17:08:20 +0800 Subject: [PATCH] Shihui dev (#786) 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: 增加地球、太阳的简单运动系统,优化部分代码结构 * chore: update version 2.5.25 -> 2.5.26 * style: lint style * feat: 在核心模块移除 threejs 的引用 * style: lint style * fix: 修复时间点击出错 * style: lint style --- docs/api/draw/draw_control.zh.md | 10 ++++----- docs/api/react/scene.en.md | 10 ++++----- docs/api/react/scene.zh.md | 10 ++++----- lerna.json | 2 +- packages/component/package.json | 6 +++--- packages/core/package.json | 4 ++-- .../services/interaction/PickingService.ts | 2 +- .../core/src/services/layer/ILayerService.ts | 21 +++++++------------ packages/l7/package.json | 14 ++++++------- packages/l7/src/version.ts | 2 +- packages/layers/package.json | 8 +++---- 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/three/src/core/threeRender.ts | 9 -------- packages/three/src/index.ts | 3 +-- packages/utils/package.json | 2 +- stories/3D_Model/Components/amap2_three.tsx | 4 ++-- stories/Map/components/mapCenter.tsx | 1 + 22 files changed, 69 insertions(+), 83 deletions(-) diff --git a/docs/api/draw/draw_control.zh.md b/docs/api/draw/draw_control.zh.md index 47c1796732..e35fd2d059 100644 --- a/docs/api/draw/draw_control.zh.md +++ b/docs/api/draw/draw_control.zh.md @@ -43,12 +43,12 @@ scene 对象 control 配置项 -| name | Type | Default | Description | -| -------- | --------------------------------------------- | ---------- | ------------------------------- | +| name | Type | Default | Description | +| -------- | ------------------------------------------------------------------------------------------------- | ---------- | ------------------------------- | | position | `bottomright、topright、 bottomleft 、topleft、 topcenter、bottomcenter、leftcenter、rightcenter` | `topright` | 组件位置 | -| layout | `horizontal、 vertical` | `vertical` | 组件布局 支持水平和垂直两种布局 | -| controls | `controlOptions` | | 设置 UI 组件添加哪些绘制工具 | -| style | | | 地图绘制样式 | +| layout | `horizontal、 vertical` | `vertical` | 组件布局 支持水平和垂直两种布局 | +| controls | `controlOptions` | | 设置 UI 组件添加哪些绘制工具 | +| style | | | 地图绘制样式 | **controlOptions** UI 组件配置项 diff --git a/docs/api/react/scene.en.md b/docs/api/react/scene.en.md index 4262746f37..b77a2a949b 100644 --- a/docs/api/react/scene.en.md +++ b/docs/api/react/scene.en.md @@ -76,12 +76,12 @@ Mapbox Map 地图配置项 [配置项](https://docs.mapbox.com/mapbox-gl-js/api/ ### scene option -| option | Type | Default | Description | -| --------------------- | --------- | ------------ | --------------------------------------------------------- | +| option | Type | Default | Description | +| --------------------- | --------- | ------------ | --------------------------------------------------------------------------------------------------------------- | | logoPosition | string | `bottomleft` | logo 位置 `bottomright | topright | bottomleft | topleft | topcenter | bottomcenter | leftcenter | rightcenter` | -| logoVisible | `boolean` | `true` | 是否显示 logo | -| antialias | `boolean` | `true` | 是否开启抗锯齿 | -| preserveDrawingBuffer | `boolean` | `false` | 是否保留缓冲区数据 | +| logoVisible | `boolean` | `true` | 是否显示 logo | +| antialias | `boolean` | `true` | 是否开启抗锯齿 | +| preserveDrawingBuffer | `boolean` | `false` | 是否保留缓冲区数据 | ### 获取 scene 对象 diff --git a/docs/api/react/scene.zh.md b/docs/api/react/scene.zh.md index ccbd0ff479..1891a0a20a 100644 --- a/docs/api/react/scene.zh.md +++ b/docs/api/react/scene.zh.md @@ -76,12 +76,12 @@ Mapbox Map 地图配置项 [配置项](https://docs.mapbox.com/mapbox-gl-js/api/ ### scene option -| option | Type | Default | Description | -| --------------------- | --------- | ------------ | --------------------------------------------------------- | +| option | Type | Default | Description | +| --------------------- | --------- | ------------ | --------------------------------------------------------------------------------------------------------------- | | logoPosition | string | `bottomleft` | logo 位置 `bottomright | topright | bottomleft | topleft | topcenter | bottomcenter | leftcenter | rightcenter` | -| logoVisible | `boolean` | `true` | 是否显示 logo | -| antialias | `boolean` | `true` | 是否开启抗锯齿 | -| preserveDrawingBuffer | `boolean` | `false` | 是否保留缓冲区数据 | +| logoVisible | `boolean` | `true` | 是否显示 logo | +| antialias | `boolean` | `true` | 是否开启抗锯齿 | +| preserveDrawingBuffer | `boolean` | `false` | 是否保留缓冲区数据 | ### 获取 scene 对象 diff --git a/lerna.json b/lerna.json index f71875eb8a..fee1113340 100644 --- a/lerna.json +++ b/lerna.json @@ -14,7 +14,7 @@ "message": "chore: publish" } }, - "version": "2.5.25", + "version": "2.5.26", "npmClient": "yarn", "useWorkspaces": true, "publishConfig": { diff --git a/packages/component/package.json b/packages/component/package.json index 01f5f6a7b8..85a52ab0a3 100644 --- a/packages/component/package.json +++ b/packages/component/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-component", - "version": "2.5.25", + "version": "2.5.26", "description": "", "main": "lib/index.js", "module": "es/index.js", @@ -25,8 +25,8 @@ "author": "lzxue", "license": "ISC", "dependencies": { - "@antv/l7-core": "^2.5.25", - "@antv/l7-utils": "^2.5.25", + "@antv/l7-core": "^2.5.26", + "@antv/l7-utils": "^2.5.26", "@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 3637d2d287..284c19a0e1 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-core", - "version": "2.5.25", + "version": "2.5.26", "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.25", + "@antv/l7-utils": "^2.5.26", "@babel/runtime": "^7.7.7", "@mapbox/tiny-sdf": "^1.1.1", "ajv": "^6.10.2", diff --git a/packages/core/src/services/interaction/PickingService.ts b/packages/core/src/services/interaction/PickingService.ts index 03077af060..e23a19ff1a 100644 --- a/packages/core/src/services/interaction/PickingService.ts +++ b/packages/core/src/services/interaction/PickingService.ts @@ -320,7 +320,7 @@ export default class PickingService implements IPickingService { featureId: number | null; }, ) { - layer.emit(target.type, target); + // layer.emit(target.type, target); // 判断是否发生事件冲突 if (isEventCrash(target)) { layer.emit(target.type, target); diff --git a/packages/core/src/services/layer/ILayerService.ts b/packages/core/src/services/layer/ILayerService.ts index 9784312ba1..6afbafd9dc 100644 --- a/packages/core/src/services/layer/ILayerService.ts +++ b/packages/core/src/services/layer/ILayerService.ts @@ -1,7 +1,6 @@ // @ts-ignore import { SyncBailHook, SyncHook, SyncWaterfallHook } from '@antv/async-hook'; import { Container } from 'inversify'; -import { AnimationMixer, Matrix4, Object3D } from 'three'; import Clock from '../../utils/clock'; import { ISceneConfig } from '../config/IConfigService'; import { IMapService } from '../map/IMapService'; @@ -235,35 +234,31 @@ export interface ILayer { altitude: number, rotation: [number, number, number], scale: [number, number, number], - ): Matrix4; + ): any; // 获取对应地图的经纬度平移矩阵 - getTranslateMatrix?(lnglat: ILngLat, altitude?: number): Matrix4; + getTranslateMatrix?(lnglat: ILngLat, altitude?: number): any; // 设置模型对应地图在经纬度和高度方向的平移 - applyObjectLngLat?( - object: Object3D, - lnglat: ILngLat, - altitude?: number, - ): void; + applyObjectLngLat?(object: any, lnglat: ILngLat, altitude?: number): void; // 根据经纬度设置模型对应地图的平移 - setObjectLngLat?(object: Object3D, lnglat: ILngLat, altitude?: number): void; + setObjectLngLat?(object: any, lnglat: ILngLat, altitude?: number): void; // 返回物体在场景中的经纬度 - getObjectLngLat?(object: Object3D): ILngLat; + getObjectLngLat?(object: any): ILngLat; // 将经纬度转为 three 世界坐标 lnglatToCoord?(lnglat: ILngLat): ILngLat; // 设置网格适配到地图坐标系 - adjustMeshToMap?(object: Object3D): void; + adjustMeshToMap?(object: any): void; // 设置网格的缩放 (主要是抹平 mapbox 底图时的差异,若是高德底图则可以直接设置网格的 scale 属性/方法) - setMeshScale?(object: Object3D, x: number, y: number, z: number): void; + setMeshScale?(object: any, x: number, y: number, z: number): void; // 增加加载模型的动画混合器 - addAnimateMixer?(mixer: AnimationMixer): void; + addAnimateMixer?(mixer: any): void; /** * 地球模式相关的方法 diff --git a/packages/l7/package.json b/packages/l7/package.json index 4adce6c9c5..ddd6c78d22 100644 --- a/packages/l7/package.json +++ b/packages/l7/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7", - "version": "2.5.25", + "version": "2.5.26", "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.25", - "@antv/l7-core": "^2.5.25", - "@antv/l7-layers": "^2.5.25", - "@antv/l7-maps": "^2.5.25", - "@antv/l7-scene": "^2.5.25", - "@antv/l7-utils": "^2.5.25", + "@antv/l7-component": "^2.5.26", + "@antv/l7-core": "^2.5.26", + "@antv/l7-layers": "^2.5.26", + "@antv/l7-maps": "^2.5.26", + "@antv/l7-scene": "^2.5.26", + "@antv/l7-utils": "^2.5.26", "@babel/runtime": "^7.7.7" }, "gitHead": "684ba4eb806a798713496d3fc0b4d1e17517dc31", diff --git a/packages/l7/src/version.ts b/packages/l7/src/version.ts index 0407197c7b..5bb6033bbb 100644 --- a/packages/l7/src/version.ts +++ b/packages/l7/src/version.ts @@ -1,2 +1,2 @@ -const version = '2.5.25'; +const version = '2.5.26'; export { version }; diff --git a/packages/layers/package.json b/packages/layers/package.json index 6caa1e8f0a..bfa9e96852 100644 --- a/packages/layers/package.json +++ b/packages/layers/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-layers", - "version": "2.5.25", + "version": "2.5.26", "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.25", - "@antv/l7-source": "^2.5.25", - "@antv/l7-utils": "^2.5.25", + "@antv/l7-core": "^2.5.26", + "@antv/l7-source": "^2.5.26", + "@antv/l7-utils": "^2.5.26", "@babel/runtime": "^7.7.7", "@mapbox/martini": "^0.2.0", "@turf/meta": "^6.0.2", diff --git a/packages/map/package.json b/packages/map/package.json index 3d044c90e9..9af41b8c16 100644 --- a/packages/map/package.json +++ b/packages/map/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-map", - "version": "2.5.25", + "version": "2.5.26", "description": "l7 map", "keywords": [], "author": "thinkinggis ", @@ -37,7 +37,7 @@ }, "homepage": "https://github.com/antvis/L7#readme", "dependencies": { - "@antv/l7-utils": "^2.5.25", + "@antv/l7-utils": "^2.5.26", "@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 818335c67d..b8f2b8d519 100644 --- a/packages/maps/package.json +++ b/packages/maps/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-maps", - "version": "2.5.25", + "version": "2.5.26", "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.25", - "@antv/l7-map": "^2.5.25", - "@antv/l7-utils": "^2.5.25", + "@antv/l7-core": "^2.5.26", + "@antv/l7-map": "^2.5.26", + "@antv/l7-utils": "^2.5.26", "@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 681c814c7c..81925f9093 100644 --- a/packages/renderer/package.json +++ b/packages/renderer/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-renderer", - "version": "2.5.25", + "version": "2.5.26", "description": "", "main": "lib/index.js", "module": "es/index.js", @@ -26,7 +26,7 @@ "gl": "^4.4.0" }, "dependencies": { - "@antv/l7-core": "^2.5.25", + "@antv/l7-core": "^2.5.26", "@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 d8e1f8b3c3..7d38ffbcb7 100644 --- a/packages/scene/package.json +++ b/packages/scene/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-scene", - "version": "2.5.25", + "version": "2.5.26", "description": "", "main": "lib/index.js", "module": "es/index.js", @@ -23,12 +23,12 @@ "author": "xiaoiver", "license": "ISC", "dependencies": { - "@antv/l7-component": "^2.5.25", - "@antv/l7-core": "^2.5.25", - "@antv/l7-layers": "^2.5.25", - "@antv/l7-maps": "^2.5.25", - "@antv/l7-renderer": "^2.5.25", - "@antv/l7-utils": "^2.5.25", + "@antv/l7-component": "^2.5.26", + "@antv/l7-core": "^2.5.26", + "@antv/l7-layers": "^2.5.26", + "@antv/l7-maps": "^2.5.26", + "@antv/l7-renderer": "^2.5.26", + "@antv/l7-utils": "^2.5.26", "@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 bb74c60e10..344cd73047 100644 --- a/packages/source/package.json +++ b/packages/source/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-source", - "version": "2.5.25", + "version": "2.5.26", "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.25", - "@antv/l7-utils": "^2.5.25", + "@antv/l7-core": "^2.5.26", + "@antv/l7-utils": "^2.5.26", "@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 b6dda612aa..18ee327c33 100644 --- a/packages/three/package.json +++ b/packages/three/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-three", - "version": "2.5.25", + "version": "2.5.26", "description": "three for L7 ", "keywords": [ "3D", @@ -44,9 +44,9 @@ }, "homepage": "https://github.com/antvis/L7#readme", "dependencies": { - "@antv/l7-core": "^2.5.25", - "@antv/l7-layers": "^2.5.25", - "@antv/l7-scene": "^2.5.25", + "@antv/l7-core": "^2.5.26", + "@antv/l7-layers": "^2.5.26", + "@antv/l7-scene": "^2.5.26", "@babel/runtime": "^7.7.7", "inversify": "^5.0.1", "reflect-metadata": "^0.1.13", diff --git a/packages/three/src/core/threeRender.ts b/packages/three/src/core/threeRender.ts index bf20995350..97ebc6f33d 100644 --- a/packages/three/src/core/threeRender.ts +++ b/packages/three/src/core/threeRender.ts @@ -1,13 +1,4 @@ import { Scene } from '@antv/l7-scene'; -import { - AnimationMixer, - Camera, - Matrix4, - PCFSoftShadowMap, - PerspectiveCamera, - Scene as ThreeScene, - WebGLRenderer, -} from 'three'; import { IThreeRenderService, ThreeRenderService, diff --git a/packages/three/src/index.ts b/packages/three/src/index.ts index 706814c559..9bbbcb6a51 100644 --- a/packages/three/src/index.ts +++ b/packages/three/src/index.ts @@ -1,5 +1,4 @@ -import { Object3D } from 'three'; import ThreeLayer from './core/baseLayer'; // import { IThreeJSLayer } from './core/IThreeJSLayer'; import ThreeRender from './core/threeRender'; -export { ThreeLayer, ThreeRender, Object3D }; +export { ThreeLayer, ThreeRender }; diff --git a/packages/utils/package.json b/packages/utils/package.json index 0c65877308..1d38ee8391 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-utils", - "version": "2.5.25", + "version": "2.5.26", "description": "", "main": "lib/index.js", "module": "es/index.js", diff --git a/stories/3D_Model/Components/amap2_three.tsx b/stories/3D_Model/Components/amap2_three.tsx index acdff94612..a8588b2cde 100644 --- a/stories/3D_Model/Components/amap2_three.tsx +++ b/stories/3D_Model/Components/amap2_three.tsx @@ -1,7 +1,7 @@ // @ts-ignore import { Scene } from '@antv/l7'; import { GaodeMap, GaodeMapV2, Mapbox } from '@antv/l7-maps'; -import { ThreeLayer, ThreeRender, Object3D } from '@antv/l7-three'; +import { ThreeLayer, ThreeRender } from '@antv/l7-three'; import * as React from 'react'; // import { DirectionalLight, Scene as ThreeScene } from 'three'; import * as THREE from 'three'; @@ -57,7 +57,7 @@ export default class GlTFThreeJSDemo extends React.Component { 'https://gw.alipayobjects.com/os/bmw-prod/3ca0a546-92d8-4ba0-a89c-017c218d5bea.gltf', (gltf) => { // @ts-ignore - const model: Object3D = gltf.scene; + const model = gltf.scene; layer.getSource().data.dataArray.forEach(({ coordinates }) => { layer.adjustMeshToMap(model); diff --git a/stories/Map/components/mapCenter.tsx b/stories/Map/components/mapCenter.tsx index e86d5c7415..f38c008698 100644 --- a/stories/Map/components/mapCenter.tsx +++ b/stories/Map/components/mapCenter.tsx @@ -60,6 +60,7 @@ export default class GaodeMapComponent extends React.Component { storkeWidth: 2, // offsets: [100, 100], }); + layer.on('click', () => console.log('click')); scene.addLayer(layer); scene.render(); this.scene = scene;