Shihui dev (#786)

* 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
This commit is contained in:
YiQianYao 2021-09-28 17:08:20 +08:00 committed by GitHub
parent 0bcc822cdd
commit bc7c6718a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 69 additions and 83 deletions

View File

@ -43,12 +43,12 @@ scene 对象
control 配置项 control 配置项
| name | Type | Default | Description | | name | Type | Default | Description |
| -------- | --------------------------------------------- | ---------- | ------------------------------- | | -------- | ------------------------------------------------------------------------------------------------- | ---------- | ------------------------------- |
| position | `bottomright、topright、 bottomleft 、topleft、 topcenter、bottomcenter、leftcenter、rightcenter` | `topright` | 组件位置 | | position | `bottomright、topright、 bottomleft 、topleft、 topcenter、bottomcenter、leftcenter、rightcenter` | `topright` | 组件位置 |
| layout | `horizontal、 vertical` | `vertical` | 组件布局 支持水平和垂直两种布局 | | layout | `horizontal、 vertical` | `vertical` | 组件布局 支持水平和垂直两种布局 |
| controls | `controlOptions` | | 设置 UI 组件添加哪些绘制工具 | | controls | `controlOptions` | | 设置 UI 组件添加哪些绘制工具 |
| style | | | 地图绘制样式 | | style | | | 地图绘制样式 |
**controlOptions** **controlOptions**
UI 组件配置项 UI 组件配置项

View File

@ -76,12 +76,12 @@ Mapbox Map 地图配置项 [配置项](https://docs.mapbox.com/mapbox-gl-js/api/
### scene option ### scene option
| option | Type | Default | Description | | option | Type | Default | Description |
| --------------------- | --------- | ------------ | --------------------------------------------------------- | | --------------------- | --------- | ------------ | --------------------------------------------------------------------------------------------------------------- |
| logoPosition | string | `bottomleft` | logo 位置 `bottomright | topright | bottomleft | topleft | topcenter | bottomcenter | leftcenter | rightcenter` | | logoPosition | string | `bottomleft` | logo 位置 `bottomright | topright | bottomleft | topleft | topcenter | bottomcenter | leftcenter | rightcenter` |
| logoVisible | `boolean` | `true` | 是否显示 logo | | logoVisible | `boolean` | `true` | 是否显示 logo |
| antialias | `boolean` | `true` | 是否开启抗锯齿 | | antialias | `boolean` | `true` | 是否开启抗锯齿 |
| preserveDrawingBuffer | `boolean` | `false` | 是否保留缓冲区数据 | | preserveDrawingBuffer | `boolean` | `false` | 是否保留缓冲区数据 |
### 获取 scene 对象 ### 获取 scene 对象

View File

@ -76,12 +76,12 @@ Mapbox Map 地图配置项 [配置项](https://docs.mapbox.com/mapbox-gl-js/api/
### scene option ### scene option
| option | Type | Default | Description | | option | Type | Default | Description |
| --------------------- | --------- | ------------ | --------------------------------------------------------- | | --------------------- | --------- | ------------ | --------------------------------------------------------------------------------------------------------------- |
| logoPosition | string | `bottomleft` | logo 位置 `bottomright | topright | bottomleft | topleft | topcenter | bottomcenter | leftcenter | rightcenter` | | logoPosition | string | `bottomleft` | logo 位置 `bottomright | topright | bottomleft | topleft | topcenter | bottomcenter | leftcenter | rightcenter` |
| logoVisible | `boolean` | `true` | 是否显示 logo | | logoVisible | `boolean` | `true` | 是否显示 logo |
| antialias | `boolean` | `true` | 是否开启抗锯齿 | | antialias | `boolean` | `true` | 是否开启抗锯齿 |
| preserveDrawingBuffer | `boolean` | `false` | 是否保留缓冲区数据 | | preserveDrawingBuffer | `boolean` | `false` | 是否保留缓冲区数据 |
### 获取 scene 对象 ### 获取 scene 对象

View File

@ -14,7 +14,7 @@
"message": "chore: publish" "message": "chore: publish"
} }
}, },
"version": "2.5.25", "version": "2.5.26",
"npmClient": "yarn", "npmClient": "yarn",
"useWorkspaces": true, "useWorkspaces": true,
"publishConfig": { "publishConfig": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7-component", "name": "@antv/l7-component",
"version": "2.5.25", "version": "2.5.26",
"description": "", "description": "",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -25,8 +25,8 @@
"author": "lzxue", "author": "lzxue",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@antv/l7-core": "^2.5.25", "@antv/l7-core": "^2.5.26",
"@antv/l7-utils": "^2.5.25", "@antv/l7-utils": "^2.5.26",
"@babel/runtime": "^7.7.7", "@babel/runtime": "^7.7.7",
"eventemitter3": "^4.0.0", "eventemitter3": "^4.0.0",
"inversify": "^5.0.1", "inversify": "^5.0.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7-core", "name": "@antv/l7-core",
"version": "2.5.25", "version": "2.5.26",
"description": "", "description": "",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -24,7 +24,7 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@antv/async-hook": "^2.1.0", "@antv/async-hook": "^2.1.0",
"@antv/l7-utils": "^2.5.25", "@antv/l7-utils": "^2.5.26",
"@babel/runtime": "^7.7.7", "@babel/runtime": "^7.7.7",
"@mapbox/tiny-sdf": "^1.1.1", "@mapbox/tiny-sdf": "^1.1.1",
"ajv": "^6.10.2", "ajv": "^6.10.2",

View File

@ -320,7 +320,7 @@ export default class PickingService implements IPickingService {
featureId: number | null; featureId: number | null;
}, },
) { ) {
layer.emit(target.type, target); // layer.emit(target.type, target);
// 判断是否发生事件冲突 // 判断是否发生事件冲突
if (isEventCrash(target)) { if (isEventCrash(target)) {
layer.emit(target.type, target); layer.emit(target.type, target);

View File

@ -1,7 +1,6 @@
// @ts-ignore // @ts-ignore
import { SyncBailHook, SyncHook, SyncWaterfallHook } from '@antv/async-hook'; import { SyncBailHook, SyncHook, SyncWaterfallHook } from '@antv/async-hook';
import { Container } from 'inversify'; import { Container } from 'inversify';
import { AnimationMixer, Matrix4, Object3D } from 'three';
import Clock from '../../utils/clock'; import Clock from '../../utils/clock';
import { ISceneConfig } from '../config/IConfigService'; import { ISceneConfig } from '../config/IConfigService';
import { IMapService } from '../map/IMapService'; import { IMapService } from '../map/IMapService';
@ -235,35 +234,31 @@ export interface ILayer {
altitude: number, altitude: number,
rotation: [number, number, number], rotation: [number, number, number],
scale: [number, number, number], scale: [number, number, number],
): Matrix4; ): any;
// 获取对应地图的经纬度平移矩阵 // 获取对应地图的经纬度平移矩阵
getTranslateMatrix?(lnglat: ILngLat, altitude?: number): Matrix4; getTranslateMatrix?(lnglat: ILngLat, altitude?: number): any;
// 设置模型对应地图在经纬度和高度方向的平移 // 设置模型对应地图在经纬度和高度方向的平移
applyObjectLngLat?( applyObjectLngLat?(object: any, lnglat: ILngLat, altitude?: number): void;
object: Object3D,
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 世界坐标 // 将经纬度转为 three 世界坐标
lnglatToCoord?(lnglat: ILngLat): ILngLat; lnglatToCoord?(lnglat: ILngLat): ILngLat;
// 设置网格适配到地图坐标系 // 设置网格适配到地图坐标系
adjustMeshToMap?(object: Object3D): void; adjustMeshToMap?(object: any): void;
// 设置网格的缩放 (主要是抹平 mapbox 底图时的差异,若是高德底图则可以直接设置网格的 scale 属性/方法) // 设置网格的缩放 (主要是抹平 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;
/** /**
* *

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7", "name": "@antv/l7",
"version": "2.5.25", "version": "2.5.26",
"description": "A Large-scale WebGL-powered Geospatial Data Visualization", "description": "A Large-scale WebGL-powered Geospatial Data Visualization",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -25,12 +25,12 @@
"author": "antv", "author": "antv",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@antv/l7-component": "^2.5.25", "@antv/l7-component": "^2.5.26",
"@antv/l7-core": "^2.5.25", "@antv/l7-core": "^2.5.26",
"@antv/l7-layers": "^2.5.25", "@antv/l7-layers": "^2.5.26",
"@antv/l7-maps": "^2.5.25", "@antv/l7-maps": "^2.5.26",
"@antv/l7-scene": "^2.5.25", "@antv/l7-scene": "^2.5.26",
"@antv/l7-utils": "^2.5.25", "@antv/l7-utils": "^2.5.26",
"@babel/runtime": "^7.7.7" "@babel/runtime": "^7.7.7"
}, },
"gitHead": "684ba4eb806a798713496d3fc0b4d1e17517dc31", "gitHead": "684ba4eb806a798713496d3fc0b4d1e17517dc31",

View File

@ -1,2 +1,2 @@
const version = '2.5.25'; const version = '2.5.26';
export { version }; export { version };

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7-layers", "name": "@antv/l7-layers",
"version": "2.5.25", "version": "2.5.26",
"description": "L7's collection of built-in layers", "description": "L7's collection of built-in layers",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -24,9 +24,9 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@antv/async-hook": "^2.1.0", "@antv/async-hook": "^2.1.0",
"@antv/l7-core": "^2.5.25", "@antv/l7-core": "^2.5.26",
"@antv/l7-source": "^2.5.25", "@antv/l7-source": "^2.5.26",
"@antv/l7-utils": "^2.5.25", "@antv/l7-utils": "^2.5.26",
"@babel/runtime": "^7.7.7", "@babel/runtime": "^7.7.7",
"@mapbox/martini": "^0.2.0", "@mapbox/martini": "^0.2.0",
"@turf/meta": "^6.0.2", "@turf/meta": "^6.0.2",

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7-map", "name": "@antv/l7-map",
"version": "2.5.25", "version": "2.5.26",
"description": "l7 map", "description": "l7 map",
"keywords": [], "keywords": [],
"author": "thinkinggis <lzx199065@gmail.com>", "author": "thinkinggis <lzx199065@gmail.com>",
@ -37,7 +37,7 @@
}, },
"homepage": "https://github.com/antvis/L7#readme", "homepage": "https://github.com/antvis/L7#readme",
"dependencies": { "dependencies": {
"@antv/l7-utils": "^2.5.25", "@antv/l7-utils": "^2.5.26",
"@babel/runtime": "^7.7.7", "@babel/runtime": "^7.7.7",
"@mapbox/point-geometry": "^0.1.0", "@mapbox/point-geometry": "^0.1.0",
"@mapbox/unitbezier": "^0.0.0", "@mapbox/unitbezier": "^0.0.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7-maps", "name": "@antv/l7-maps",
"version": "2.5.25", "version": "2.5.26",
"description": "", "description": "",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -27,9 +27,9 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@amap/amap-jsapi-loader": "^0.0.3", "@amap/amap-jsapi-loader": "^0.0.3",
"@antv/l7-core": "^2.5.25", "@antv/l7-core": "^2.5.26",
"@antv/l7-map": "^2.5.25", "@antv/l7-map": "^2.5.26",
"@antv/l7-utils": "^2.5.25", "@antv/l7-utils": "^2.5.26",
"@babel/runtime": "^7.7.7", "@babel/runtime": "^7.7.7",
"@types/amap-js-api": "^1.4.6", "@types/amap-js-api": "^1.4.6",
"@types/mapbox-gl": "^1.11.2", "@types/mapbox-gl": "^1.11.2",

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7-renderer", "name": "@antv/l7-renderer",
"version": "2.5.25", "version": "2.5.26",
"description": "", "description": "",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -26,7 +26,7 @@
"gl": "^4.4.0" "gl": "^4.4.0"
}, },
"dependencies": { "dependencies": {
"@antv/l7-core": "^2.5.25", "@antv/l7-core": "^2.5.26",
"@babel/runtime": "^7.7.7", "@babel/runtime": "^7.7.7",
"inversify": "^5.0.1", "inversify": "^5.0.1",
"l7regl": "^0.0.14", "l7regl": "^0.0.14",

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7-scene", "name": "@antv/l7-scene",
"version": "2.5.25", "version": "2.5.26",
"description": "", "description": "",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -23,12 +23,12 @@
"author": "xiaoiver", "author": "xiaoiver",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@antv/l7-component": "^2.5.25", "@antv/l7-component": "^2.5.26",
"@antv/l7-core": "^2.5.25", "@antv/l7-core": "^2.5.26",
"@antv/l7-layers": "^2.5.25", "@antv/l7-layers": "^2.5.26",
"@antv/l7-maps": "^2.5.25", "@antv/l7-maps": "^2.5.26",
"@antv/l7-renderer": "^2.5.25", "@antv/l7-renderer": "^2.5.26",
"@antv/l7-utils": "^2.5.25", "@antv/l7-utils": "^2.5.26",
"@babel/runtime": "^7.7.7", "@babel/runtime": "^7.7.7",
"inversify": "^5.0.1", "inversify": "^5.0.1",
"mapbox-gl": "^1.2.1", "mapbox-gl": "^1.2.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7-source", "name": "@antv/l7-source",
"version": "2.5.25", "version": "2.5.26",
"description": "", "description": "",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -26,8 +26,8 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@antv/async-hook": "^2.1.0", "@antv/async-hook": "^2.1.0",
"@antv/l7-core": "^2.5.25", "@antv/l7-core": "^2.5.26",
"@antv/l7-utils": "^2.5.25", "@antv/l7-utils": "^2.5.26",
"@babel/runtime": "^7.7.7", "@babel/runtime": "^7.7.7",
"@mapbox/geojson-rewind": "^0.4.0", "@mapbox/geojson-rewind": "^0.4.0",
"@turf/helpers": "^6.1.4", "@turf/helpers": "^6.1.4",

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7-three", "name": "@antv/l7-three",
"version": "2.5.25", "version": "2.5.26",
"description": "three for L7 ", "description": "three for L7 ",
"keywords": [ "keywords": [
"3D", "3D",
@ -44,9 +44,9 @@
}, },
"homepage": "https://github.com/antvis/L7#readme", "homepage": "https://github.com/antvis/L7#readme",
"dependencies": { "dependencies": {
"@antv/l7-core": "^2.5.25", "@antv/l7-core": "^2.5.26",
"@antv/l7-layers": "^2.5.25", "@antv/l7-layers": "^2.5.26",
"@antv/l7-scene": "^2.5.25", "@antv/l7-scene": "^2.5.26",
"@babel/runtime": "^7.7.7", "@babel/runtime": "^7.7.7",
"inversify": "^5.0.1", "inversify": "^5.0.1",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",

View File

@ -1,13 +1,4 @@
import { Scene } from '@antv/l7-scene'; import { Scene } from '@antv/l7-scene';
import {
AnimationMixer,
Camera,
Matrix4,
PCFSoftShadowMap,
PerspectiveCamera,
Scene as ThreeScene,
WebGLRenderer,
} from 'three';
import { import {
IThreeRenderService, IThreeRenderService,
ThreeRenderService, ThreeRenderService,

View File

@ -1,5 +1,4 @@
import { Object3D } from 'three';
import ThreeLayer from './core/baseLayer'; import ThreeLayer from './core/baseLayer';
// import { IThreeJSLayer } from './core/IThreeJSLayer'; // import { IThreeJSLayer } from './core/IThreeJSLayer';
import ThreeRender from './core/threeRender'; import ThreeRender from './core/threeRender';
export { ThreeLayer, ThreeRender, Object3D }; export { ThreeLayer, ThreeRender };

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7-utils", "name": "@antv/l7-utils",
"version": "2.5.25", "version": "2.5.26",
"description": "", "description": "",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",

View File

@ -1,7 +1,7 @@
// @ts-ignore // @ts-ignore
import { Scene } from '@antv/l7'; import { Scene } from '@antv/l7';
import { GaodeMap, GaodeMapV2, Mapbox } from '@antv/l7-maps'; 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 * as React from 'react';
// import { DirectionalLight, Scene as ThreeScene } from 'three'; // import { DirectionalLight, Scene as ThreeScene } from 'three';
import * as THREE 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', 'https://gw.alipayobjects.com/os/bmw-prod/3ca0a546-92d8-4ba0-a89c-017c218d5bea.gltf',
(gltf) => { (gltf) => {
// @ts-ignore // @ts-ignore
const model: Object3D = gltf.scene; const model = gltf.scene;
layer.getSource().data.dataArray.forEach(({ coordinates }) => { layer.getSource().data.dataArray.forEach(({ coordinates }) => {
layer.adjustMeshToMap(model); layer.adjustMeshToMap(model);

View File

@ -60,6 +60,7 @@ export default class GaodeMapComponent extends React.Component {
storkeWidth: 2, storkeWidth: 2,
// offsets: [100, 100], // offsets: [100, 100],
}); });
layer.on('click', () => console.log('click'));
scene.addLayer(layer); scene.addLayer(layer);
scene.render(); scene.render();
this.scene = scene; this.scene = scene;