mirror of https://gitee.com/antv-l7/antv-l7
parent
10a8af1cb1
commit
648357fe8e
|
@ -12,6 +12,36 @@ Invalid configuration object. MyPlugin has been initialised using a configuratio
|
||||||
和 Webpack 一样,我们也选择 [ajv](https://github.com/epoberezkin/ajv) 作为 JSON Schema 校验器。
|
和 Webpack 一样,我们也选择 [ajv](https://github.com/epoberezkin/ajv) 作为 JSON Schema 校验器。
|
||||||
目前我们只在 Layer 初始阶段进行校验,一旦校验失败会中断后续初始化插件的处理,并在控制台给出校验失败信息。后续需要在属性更新时同样进行校验。
|
目前我们只在 Layer 初始阶段进行校验,一旦校验失败会中断后续初始化插件的处理,并在控制台给出校验失败信息。后续需要在属性更新时同样进行校验。
|
||||||
|
|
||||||
|
## 地图参数校验
|
||||||
|
|
||||||
|
当用户传入地图参数时,需要进行校验:
|
||||||
|
```javascript
|
||||||
|
// l7-core/services/config/mapConfigSchema.ts
|
||||||
|
|
||||||
|
export default {
|
||||||
|
properties: {
|
||||||
|
// 地图缩放等级
|
||||||
|
zoom: {
|
||||||
|
type: 'number',
|
||||||
|
minimum: 0,
|
||||||
|
maximum: 20,
|
||||||
|
},
|
||||||
|
// 地图中心点
|
||||||
|
center: {
|
||||||
|
item: {
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
maxItems: 2,
|
||||||
|
minItems: 2,
|
||||||
|
},
|
||||||
|
// 仰角
|
||||||
|
pitch: {
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
## Layer 基类配置项 Schema
|
## Layer 基类配置项 Schema
|
||||||
|
|
||||||
目前在基类中我们声明了如下属性及其对应的校验规则:
|
目前在基类中我们声明了如下属性及其对应的校验规则:
|
||||||
|
|
|
@ -171,6 +171,7 @@ protected getConfigSchema() {
|
||||||
通过 `mapService` 引用。
|
通过 `mapService` 引用。
|
||||||
|
|
||||||
常用地图状态获取方法如下:
|
常用地图状态获取方法如下:
|
||||||
|
|
||||||
| 方法名 | 参数 | 返回值 | 说明 |
|
| 方法名 | 参数 | 返回值 | 说明 |
|
||||||
| -------- | ------------- | --------- | --------- |
|
| -------- | ------------- | --------- | --------- |
|
||||||
| getSize | 无 | `[number, number]` | 获取地图尺寸(像素单位) |
|
| getSize | 无 | `[number, number]` | 获取地图尺寸(像素单位) |
|
||||||
|
@ -196,7 +197,6 @@ protected getConfigSchema() {
|
||||||
通过 `rendererService` 引用。
|
通过 `rendererService` 引用。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 图层管理服务
|
### 图层管理服务
|
||||||
|
|
||||||
开发者不需要显式调用。用于管理场景中所有的图层,负责图层的创建、销毁。
|
开发者不需要显式调用。用于管理场景中所有的图层,负责图层的创建、销毁。
|
||||||
|
|
|
@ -39,12 +39,13 @@ L7 提供三种使用方式:CDN、Submodule 以及 React 组件。
|
||||||
// 创建场景
|
// 创建场景
|
||||||
const scene = new L7.Scene({
|
const scene = new L7.Scene({
|
||||||
id: 'map', // 容器 id
|
id: 'map', // 容器 id
|
||||||
type: 'mapbox', // 高德 amap 或者 mapbox
|
map: new L7.Mapbox({ // 高德地图为 L7.AMap
|
||||||
style: 'mapbox://styles/mapbox/streets-v9',
|
style: 'mapbox://styles/mapbox/streets-v9',
|
||||||
center: [110.19382669582967, 50.258134],
|
center: [110.19382669582967, 50.258134],
|
||||||
pitch: 0,
|
pitch: 0,
|
||||||
zoom: 3,
|
zoom: 3,
|
||||||
token: 'pg.xxx', // 高德或者 Mapbox 的 token
|
token: 'pg.xxx', // 高德或者 Mapbox 的 token
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
// 创建图层
|
// 创建图层
|
||||||
|
@ -89,16 +90,17 @@ L7 提供三种使用方式:CDN、Submodule 以及 React 组件。
|
||||||
|
|
||||||
## 通过 Submodule 使用
|
## 通过 Submodule 使用
|
||||||
|
|
||||||
首先通过 `npm/yarn` 安装 `@antv/l7`:
|
首先通过 `npm/yarn` 安装 `@antv/l7@beta`:
|
||||||
```bash
|
```bash
|
||||||
npm install --save @antv/l7
|
npm install --save @antv/l7@beta
|
||||||
// or
|
// or
|
||||||
yarn add @antv/l7
|
yarn add @antv/l7@beta
|
||||||
```
|
```
|
||||||
|
|
||||||
然后就可以使用其中包含的场景和各类图层:
|
然后就可以使用其中包含的场景和各类图层:
|
||||||
```typescript
|
```typescript
|
||||||
import { Scene, PolygonLayer } from '@antv/l7';
|
import { Scene, PolygonLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
(async function() {
|
(async function() {
|
||||||
// 获取数据
|
// 获取数据
|
||||||
|
@ -109,13 +111,14 @@ import { Scene, PolygonLayer } from '@antv/l7';
|
||||||
|
|
||||||
// 创建场景
|
// 创建场景
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
center: [110.19382669582967, 50.258134],
|
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new AMap({
|
||||||
style: 'dark',
|
center: [110.19382669582967, 50.258134],
|
||||||
type: 'amap',
|
pitch: 0,
|
||||||
zoom: 3,
|
style: 'dark',
|
||||||
token: 'pg.xxx', // 高德或者 Mapbox 的 token
|
zoom: 3,
|
||||||
|
token: 'pg.xxx', // 高德或者 Mapbox 的 token
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
// 创建图层
|
// 创建图层
|
||||||
|
@ -151,9 +154,10 @@ L7 目前的文档都通过这种方式使用,可以参考项目中的 stories
|
||||||
React 组件待开发,目前可以暂时以 Submodule 方式使用:
|
React 组件待开发,目前可以暂时以 Submodule 方式使用:
|
||||||
```tsx
|
```tsx
|
||||||
import { Scene, PolygonLayer } from '@antv/l7';
|
import { Scene, PolygonLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
export default class AMap extends React.Component {
|
export default class AMapExample extends React.Component {
|
||||||
private scene: Scene;
|
private scene: Scene;
|
||||||
|
|
||||||
public componentWillUnmount() {
|
public componentWillUnmount() {
|
||||||
|
@ -165,13 +169,14 @@ export default class AMap extends React.Component {
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/d2e0e930-fd44-4fca-8872-c1037b0fee7b.json',
|
'https://gw.alipayobjects.com/os/basement_prod/d2e0e930-fd44-4fca-8872-c1037b0fee7b.json',
|
||||||
);
|
);
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
center: [110.19382669582967, 50.258134],
|
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new AMap({
|
||||||
style: 'dark',
|
center: [110.19382669582967, 50.258134],
|
||||||
type: 'amap',
|
pitch: 0,
|
||||||
zoom: 3,
|
style: 'dark',
|
||||||
token: 'pg.xxx', // 高德或者 Mapbox 的 token
|
zoom: 3,
|
||||||
|
token: 'pg.xxx', // 高德或者 Mapbox 的 token
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
const layer = new PolygonLayer({});
|
const layer = new PolygonLayer({});
|
||||||
|
|
||||||
|
|
|
@ -344,9 +344,9 @@ yarn build
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### [WIP] 异步加载 Mapbox
|
### 按需引入地图依赖
|
||||||
|
|
||||||
以 L7 Bundler 方式使用时,由于需要在运行时根据用户配置项选择地图底图,会导致构建时需要将全部地图依赖引入,无法进行 TreeShaking。
|
以 L7 Bundler 方式使用时,由于需要在运行时根据用户配置项选择地图底图,会导致构建时需要将全部地图依赖引入,无法进行 TreeShaking。
|
||||||
目前高德地图使用运行时异步加载方式引入,不会导致该问题,但 Mapbox 同样使用 Bundler,对于高德用户就多余了。
|
目前高德地图使用运行时异步加载方式引入,不会导致该问题,但 Mapbox 同样使用 Bundler,对于高德用户就多余了。
|
||||||
|
|
||||||
一个可能的方案是对于 Mapbox 使用 CodeSplitting。在容器首次获取 Mapbox 地图服务时异步加载并缓存。
|
[ISSUE](https://github.com/antvis/L7/issues/86)
|
||||||
|
|
|
@ -136,11 +136,12 @@ void main() {
|
||||||
// 场景定义
|
// 场景定义
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
type: 'mapbox',
|
map: new Mapbox({
|
||||||
style: 'mapbox://styles/mapbox/streets-v9',
|
style: 'mapbox://styles/mapbox/streets-v9',
|
||||||
center: [110.19382669582967, 50.258134],
|
center: [110.19382669582967, 50.258134],
|
||||||
pitch: 0,
|
pitch: 0,
|
||||||
zoom: 3,
|
zoom: 3,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
// 注册自定义后处理效果
|
// 注册自定义后处理效果
|
||||||
scene.registerPostProcessingPass(
|
scene.registerPostProcessingPass(
|
||||||
|
@ -154,7 +155,6 @@ scene.registerPostProcessingPass(
|
||||||
和 L7 内置的后处理效果使用方法一致,通过效果名引用,同时传入定义参数即可:
|
和 L7 内置的后处理效果使用方法一致,通过效果名引用,同时传入定义参数即可:
|
||||||
```typescript
|
```typescript
|
||||||
const layer = new PolygonLayer({
|
const layer = new PolygonLayer({
|
||||||
enableMultiPassRenderer: true,
|
|
||||||
enablePicking: true,
|
enablePicking: true,
|
||||||
enableHighlight: true,
|
enableHighlight: true,
|
||||||
passes: [
|
passes: [
|
||||||
|
|
|
@ -10,19 +10,24 @@ order: 1
|
||||||
```javascript
|
```javascript
|
||||||
// Module 引用
|
// Module 引用
|
||||||
import { Scene } from '@antv/l7';
|
import { Scene } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
mapStyle: 'dark',
|
map: new AMap({
|
||||||
center: [ 110.770672, 34.159869 ],
|
style: 'dark',
|
||||||
pitch: 45,
|
center: [ 110.770672, 34.159869 ],
|
||||||
|
pitch: 45,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
// CDN 使用方法
|
// CDN 使用方法
|
||||||
const scene = new L7.Scene({
|
const scene = new L7.Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
mapStyle: 'dark',
|
map: new L7.AMap({
|
||||||
center: [ 110.770672, 34.159869 ],
|
style: 'dark',
|
||||||
pitch: 45,
|
center: [ 110.770672, 34.159869 ],
|
||||||
|
pitch: 45,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -43,20 +48,21 @@ const scene = new L7.Scene({
|
||||||
可以通过scene map 属性获取 map实例
|
可以通过scene map 属性获取 map实例
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const map = scene.map
|
const map = scene.map
|
||||||
|
|
||||||
```
|
```
|
||||||
为了统一不通底图之前的接口差异 L7 在scene层对map的方法做了统一,因此一些地图的操作方法可以通过scene调用这样,切换不同底图时保证表现一致。
|
为了统一不同底图之前的接口差异 L7 在scene层对map的方法做了统一,因此一些地图的操作方法可以通过scene调用这样,切换不同底图时保证表现一致。
|
||||||
|
|
||||||
示例代码
|
示例代码
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import { Scene } from '@antv/l7';
|
|
||||||
const scene =new L7.Scene({
|
const scene =new L7.Scene({
|
||||||
id:'map',
|
id: 'map',
|
||||||
mapStyle:'dark',
|
map: new L7.AMap({
|
||||||
center:[ 110.770672, 34.159869 ],
|
style: 'dark',
|
||||||
pitch:45
|
center: [ 110.770672, 34.159869 ],
|
||||||
|
pitch: 45,
|
||||||
|
}),
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
title: 场景 Scene
|
title: Scene
|
||||||
order: 1
|
order: 1
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -7,7 +7,29 @@ order: 1
|
||||||
|
|
||||||
## Scene
|
## Scene
|
||||||
|
|
||||||
L7 地理可视化 地图,图层,组件,以及可视化所需要的资源,如图片,字体通过Scene统一管理
|
```javascript
|
||||||
|
// Module 引用
|
||||||
|
import { Scene } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
const scene = new Scene({
|
||||||
|
id: 'map',
|
||||||
|
map: new AMap({
|
||||||
|
style: 'dark',
|
||||||
|
center: [ 110.770672, 34.159869 ],
|
||||||
|
pitch: 45,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
// CDN 使用方法
|
||||||
|
const scene = new L7.Scene({
|
||||||
|
id: 'map',
|
||||||
|
map: new L7.AMap({
|
||||||
|
style: 'dark',
|
||||||
|
center: [ 110.770672, 34.159869 ],
|
||||||
|
pitch: 45,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## Map
|
## Map
|
||||||
|
@ -26,7 +48,7 @@ L7 地理可视化 地图,图层,组件,以及可视化所需要的资源
|
||||||
可以通过scene map 属性获取 map实例
|
可以通过scene map 属性获取 map实例
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const map = scene.map
|
const map = scene.map
|
||||||
|
|
||||||
```
|
```
|
||||||
为了统一不同底图之前的接口差异 L7 在scene层对map的方法做了统一,因此一些地图的操作方法可以通过scene调用这样,切换不同底图时保证表现一致。
|
为了统一不同底图之前的接口差异 L7 在scene层对map的方法做了统一,因此一些地图的操作方法可以通过scene调用这样,切换不同底图时保证表现一致。
|
||||||
|
@ -34,24 +56,17 @@ L7 地理可视化 地图,图层,组件,以及可视化所需要的资源
|
||||||
示例代码
|
示例代码
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// Module 引用
|
const scene =new L7.Scene({
|
||||||
import { Scene } from '@antv/l7';
|
|
||||||
const scene = new Scene({
|
|
||||||
id: 'map',
|
id: 'map',
|
||||||
mapStyle: 'dark',
|
map: new L7.AMap({
|
||||||
center: [ 110.770672, 34.159869 ],
|
style: 'dark',
|
||||||
pitch: 45,
|
center: [ 110.770672, 34.159869 ],
|
||||||
});
|
pitch: 45,
|
||||||
|
}),
|
||||||
// CDN 使用方法
|
})
|
||||||
const scene = new L7.Scene({
|
|
||||||
id: 'map',
|
|
||||||
mapStyle: 'dark',
|
|
||||||
center: [ 110.770672, 34.159869 ],
|
|
||||||
pitch: 45,
|
|
||||||
});
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### 构造函数
|
### 构造函数
|
||||||
|
|
||||||
**Scene**
|
**Scene**
|
||||||
|
|
|
@ -35,13 +35,13 @@ order: 0
|
||||||
``` javascript
|
``` javascript
|
||||||
const scene = new L7.Scene({
|
const scene = new L7.Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
style: 'dark', // 样式URL
|
map: new L7.AMap({
|
||||||
center: [120.19382669582967, 30.258134],
|
style: 'dark', // 样式URL
|
||||||
pitch: 0,
|
center: [120.19382669582967, 30.258134],
|
||||||
zoom: 12,
|
pitch: 0,
|
||||||
type:'amap',
|
zoom: 12,
|
||||||
token: '高德地图token'
|
token: '高德地图token',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -111,12 +111,13 @@ fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json')
|
||||||
|
|
||||||
const scene = new L7.Scene({
|
const scene = new L7.Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
mapStyle: 'dark', // 样式URL
|
map: new L7.AMap({
|
||||||
center: [120.19382669582967, 30.258134],
|
style: 'dark', // 样式URL
|
||||||
pitch: 0,
|
center: [120.19382669582967, 30.258134],
|
||||||
zoom: 12,
|
pitch: 0,
|
||||||
type:'amap',
|
zoom: 12,
|
||||||
|
token: '高德地图token',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json')
|
fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json')
|
||||||
|
|
|
@ -35,13 +35,13 @@ order: 0
|
||||||
``` javascript
|
``` javascript
|
||||||
const scene = new L7.Scene({
|
const scene = new L7.Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
style: 'dark', // 样式URL
|
map: new L7.AMap({
|
||||||
center: [120.19382669582967, 30.258134],
|
style: 'dark', // 样式URL
|
||||||
pitch: 0,
|
center: [120.19382669582967, 30.258134],
|
||||||
zoom: 12,
|
pitch: 0,
|
||||||
type:'amap',
|
zoom: 12,
|
||||||
token: '高德地图token'
|
token: '高德地图token',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -111,12 +111,13 @@ fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json')
|
||||||
|
|
||||||
const scene = new L7.Scene({
|
const scene = new L7.Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
mapStyle: 'dark', // 样式URL
|
map: new L7.AMap({
|
||||||
center: [120.19382669582967, 30.258134],
|
style: 'dark', // 样式URL
|
||||||
pitch: 0,
|
center: [120.19382669582967, 30.258134],
|
||||||
zoom: 12,
|
pitch: 0,
|
||||||
type:'amap',
|
zoom: 12,
|
||||||
|
token: '高德地图token',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json')
|
fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json')
|
||||||
|
|
|
@ -42,13 +42,13 @@ order: 0
|
||||||
``` javascript
|
``` javascript
|
||||||
const scene = new L7.Scene({
|
const scene = new L7.Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
style: 'dark', // 样式URL
|
map: new L7.Mapbox({
|
||||||
center: [120.19382669582967, 30.258134],
|
style: 'dark', // 样式URL
|
||||||
pitch: 0,
|
center: [120.19382669582967, 30.258134],
|
||||||
zoom: 12,
|
pitch: 0,
|
||||||
type:'mapbox',
|
zoom: 12,
|
||||||
token: 'mapbox token'
|
token: 'mapbox token',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -118,12 +118,13 @@ fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json')
|
||||||
<script>
|
<script>
|
||||||
const scene = new L7.Scene({
|
const scene = new L7.Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
mapStyle: 'dark', // 样式URL
|
map: new L7.Mapbox({
|
||||||
center: [120.19382669582967, 30.258134],
|
style: 'dark', // 样式URL
|
||||||
pitch: 0,
|
center: [120.19382669582967, 30.258134],
|
||||||
zoom: 12,
|
pitch: 0,
|
||||||
type:'amap',
|
zoom: 12,
|
||||||
|
token: 'mapbox token',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json')
|
fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json')
|
||||||
|
|
|
@ -47,6 +47,7 @@ yarn add --save @antv/l7@beta
|
||||||
然后就可以使用其中包含的场景和各类图层:
|
然后就可以使用其中包含的场景和各类图层:
|
||||||
```typescript
|
```typescript
|
||||||
import { Scene, PolygonLayer } from '@antv/l7';
|
import { Scene, PolygonLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
(async function() {
|
(async function() {
|
||||||
// 获取数据
|
// 获取数据
|
||||||
|
@ -57,13 +58,14 @@ import { Scene, PolygonLayer } from '@antv/l7';
|
||||||
|
|
||||||
// 创建场景
|
// 创建场景
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
center: [110.19382669582967, 50.258134],
|
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new AMap({
|
||||||
style: 'dark',
|
center: [110.19382669582967, 50.258134],
|
||||||
type: 'amap',
|
pitch: 0,
|
||||||
zoom: 3,
|
style: 'dark',
|
||||||
token: 'pg.xxx', // 高德或者 Mapbox 的 token
|
zoom: 3,
|
||||||
|
token: 'pg.xxx', // 高德或者 Mapbox 的 token
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
// 创建图层
|
// 创建图层
|
||||||
|
@ -86,9 +88,6 @@ import { Scene, PolygonLayer } from '@antv/l7';
|
||||||
|
|
||||||
// 添加图层到场景中
|
// 添加图层到场景中
|
||||||
scene.addLayer(layer);
|
scene.addLayer(layer);
|
||||||
|
|
||||||
// 渲染场景
|
|
||||||
scene.render();
|
|
||||||
})();
|
})();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -103,6 +102,7 @@ L7 目前的文档都通过这种方式使用,可以参考项目中的 stories
|
||||||
React 组件待开发,目前可以暂时以 Submodule 方式使用:
|
React 组件待开发,目前可以暂时以 Submodule 方式使用:
|
||||||
```tsx
|
```tsx
|
||||||
import { Scene, PolygonLayer} from '@antv/l7';
|
import { Scene, PolygonLayer} from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
export default class AMap extends React.Component {
|
export default class AMap extends React.Component {
|
||||||
|
@ -117,13 +117,14 @@ export default class AMap extends React.Component {
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/d2e0e930-fd44-4fca-8872-c1037b0fee7b.json',
|
'https://gw.alipayobjects.com/os/basement_prod/d2e0e930-fd44-4fca-8872-c1037b0fee7b.json',
|
||||||
);
|
);
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
center: [110.19382669582967, 50.258134],
|
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new AMap({
|
||||||
style: 'dark',
|
center: [110.19382669582967, 50.258134],
|
||||||
type: 'amap',
|
pitch: 0,
|
||||||
zoom: 3,
|
style: 'dark',
|
||||||
token: 'pg.xxx', // 高德或者 Mapbox 的 token
|
zoom: 3,
|
||||||
|
token: 'pg.xxx', // 高德或者 Mapbox 的 token
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
const layer = new PolygonLayer({});
|
const layer = new PolygonLayer({});
|
||||||
|
|
||||||
|
@ -143,7 +144,6 @@ export default class AMap extends React.Component {
|
||||||
opacity: 0.8,
|
opacity: 0.8,
|
||||||
});
|
});
|
||||||
scene.addLayer(layer);
|
scene.addLayer(layer);
|
||||||
scene.render();
|
|
||||||
this.scene = scene;
|
this.scene = scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ yarn add --save @antv/l7@beta
|
||||||
然后就可以使用其中包含的场景和各类图层:
|
然后就可以使用其中包含的场景和各类图层:
|
||||||
```typescript
|
```typescript
|
||||||
import { Scene, PolygonLayer } from '@antv/l7';
|
import { Scene, PolygonLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
(async function() {
|
(async function() {
|
||||||
// 获取数据
|
// 获取数据
|
||||||
|
@ -57,13 +58,14 @@ import { Scene, PolygonLayer } from '@antv/l7';
|
||||||
|
|
||||||
// 创建场景
|
// 创建场景
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
center: [110.19382669582967, 50.258134],
|
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new AMap({
|
||||||
style: 'dark',
|
center: [110.19382669582967, 50.258134],
|
||||||
type: 'amap',
|
pitch: 0,
|
||||||
zoom: 3,
|
style: 'dark',
|
||||||
token: 'pg.xxx', // 高德或者 Mapbox 的 token
|
zoom: 3,
|
||||||
|
token: 'pg.xxx', // 高德或者 Mapbox 的 token
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
// 创建图层
|
// 创建图层
|
||||||
|
@ -86,9 +88,6 @@ import { Scene, PolygonLayer } from '@antv/l7';
|
||||||
|
|
||||||
// 添加图层到场景中
|
// 添加图层到场景中
|
||||||
scene.addLayer(layer);
|
scene.addLayer(layer);
|
||||||
|
|
||||||
// 渲染场景
|
|
||||||
scene.render();
|
|
||||||
})();
|
})();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -103,6 +102,7 @@ L7 目前的文档都通过这种方式使用,可以参考项目中的 stories
|
||||||
React 组件待开发,目前可以暂时以 Submodule 方式使用:
|
React 组件待开发,目前可以暂时以 Submodule 方式使用:
|
||||||
```tsx
|
```tsx
|
||||||
import { Scene, PolygonLayer} from '@antv/l7';
|
import { Scene, PolygonLayer} from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
export default class AMap extends React.Component {
|
export default class AMap extends React.Component {
|
||||||
|
@ -117,13 +117,14 @@ export default class AMap extends React.Component {
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/d2e0e930-fd44-4fca-8872-c1037b0fee7b.json',
|
'https://gw.alipayobjects.com/os/basement_prod/d2e0e930-fd44-4fca-8872-c1037b0fee7b.json',
|
||||||
);
|
);
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
center: [110.19382669582967, 50.258134],
|
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new AMap({
|
||||||
style: 'dark',
|
center: [110.19382669582967, 50.258134],
|
||||||
type: 'amap',
|
pitch: 0,
|
||||||
zoom: 3,
|
style: 'dark',
|
||||||
token: 'pg.xxx', // 高德或者 Mapbox 的 token
|
zoom: 3,
|
||||||
|
token: 'pg.xxx', // 高德或者 Mapbox 的 token
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
const layer = new PolygonLayer({});
|
const layer = new PolygonLayer({});
|
||||||
|
|
||||||
|
@ -143,7 +144,6 @@ export default class AMap extends React.Component {
|
||||||
opacity: 0.8,
|
opacity: 0.8,
|
||||||
});
|
});
|
||||||
scene.addLayer(layer);
|
scene.addLayer(layer);
|
||||||
scene.render();
|
|
||||||
this.scene = scene;
|
this.scene = scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
import { Scene, LineLayer } from '@antv/l7';
|
import { Scene, LineLayer } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new Mapbox({
|
||||||
type: 'mapbox',
|
style: 'dark',
|
||||||
style: 'dark',
|
pitch: 0,
|
||||||
center: [ 107.77791556935472, 35.443286920228644 ],
|
center: [ 107.77791556935472, 35.443286920228644 ],
|
||||||
zoom: 2.9142882493605033
|
zoom: 2.9142882493605033
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
window.mapScene = scene;
|
|
||||||
fetch('https://gw.alipayobjects.com/os/rmsportal/UEXQMifxtkQlYfChpPwT.txt')
|
fetch('https://gw.alipayobjects.com/os/rmsportal/UEXQMifxtkQlYfChpPwT.txt')
|
||||||
.then(res => res.text())
|
.then(res => res.text())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
import { Scene, LineLayer } from '@antv/l7';
|
import { Scene, LineLayer } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
center: [ 103.83735604457024, 1.360253881403068 ],
|
map: new Mapbox({
|
||||||
pitch: 4.00000000000001,
|
style: 'dark',
|
||||||
zoom: 10.210275860702593,
|
center: [ 103.83735604457024, 1.360253881403068 ],
|
||||||
rotation: 19.313180925794313,
|
pitch: 4.00000000000001,
|
||||||
type: 'mapbox',
|
zoom: 10.210275860702593,
|
||||||
style: 'dark'
|
rotation: 19.313180925794313,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
import { Scene, PointLayer } from '@antv/l7';
|
import { Scene, PointLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 35.210526315789465,
|
map: new AMap({
|
||||||
type: 'amap',
|
pitch: 35.210526315789465,
|
||||||
style: 'dark',
|
style: 'dark',
|
||||||
center: [ 104.288144, 31.239692 ],
|
center: [ 104.288144, 31.239692 ],
|
||||||
zoom: 4.4
|
zoom: 4.4,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
window.mapScene = scene;
|
|
||||||
fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json')
|
fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json')
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
import { Scene, HeatmapLayer } from '@antv/l7';
|
import { Scene, HeatmapLayer } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
style: 'dark',
|
map: new Mapbox({
|
||||||
pitch: 43,
|
style: 'dark',
|
||||||
center: [ 120.13383079335335, 29.651873105004427 ],
|
pitch: 43,
|
||||||
zoom: 7.068989519212174,
|
center: [ 120.13383079335335, 29.651873105004427 ],
|
||||||
type: 'mapbox'
|
zoom: 7.068989519212174,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
window.mapScene = scene;
|
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/a1a8158d-6fe3-424b-8e50-694ccf61c4d7.csv'
|
'https://gw.alipayobjects.com/os/basement_prod/a1a8158d-6fe3-424b-8e50-694ccf61c4d7.csv'
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
import { Scene, PointLayer } from '@antv/l7';
|
import { Scene, PointLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
type: 'amap',
|
map: new AMap({
|
||||||
style: 'dark',
|
center: [ 121.417463, 31.215175 ],
|
||||||
center: [ 121.417463, 31.215175 ],
|
pitch: 0,
|
||||||
pitch: 0,
|
zoom: 11,
|
||||||
zoom: 11
|
}),
|
||||||
});
|
});
|
||||||
window.mapScene = scene;
|
|
||||||
fetch('https://gw.alipayobjects.com/os/rmsportal/BElVQFEFvpAKzddxFZxJ.txt')
|
fetch('https://gw.alipayobjects.com/os/rmsportal/BElVQFEFvpAKzddxFZxJ.txt')
|
||||||
.then(res => res.text())
|
.then(res => res.text())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
import { Scene, PointLayer } from '@antv/l7';
|
import { Scene, PointLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 64.88,
|
map: new AMap({
|
||||||
type: 'amap',
|
pitch: 64.88,
|
||||||
style: 'dark',
|
style: 'dark',
|
||||||
center: [ 114.060288, 22.53684 ],
|
center: [ 114.060288, 22.53684 ],
|
||||||
zoom: 15.63
|
zoom: 15.63,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
window.mapScene = scene;
|
|
||||||
fetch(
|
fetch(
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/513add53-dcb2-4295-8860-9e7aa5236699.json'
|
'https://gw.alipayobjects.com/os/basement_prod/513add53-dcb2-4295-8860-9e7aa5236699.json'
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
import { Scene, HeatmapLayer } from '@antv/l7';
|
import { Scene, HeatmapLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
style: 'light',
|
map: new AMap({
|
||||||
pitch: 0,
|
style: 'light',
|
||||||
center: [ 107.054293, 35.246265 ],
|
pitch: 0,
|
||||||
zoom: 4.056,
|
center: [ 107.054293, 35.246265 ],
|
||||||
type: 'amap'
|
zoom: 4.056,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
window.mapScene = scene;
|
|
||||||
fetch(
|
fetch(
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/7359a5e9-3c5e-453f-b207-bc892fb23b84.csv'
|
'https://gw.alipayobjects.com/os/basement_prod/7359a5e9-3c5e-453f-b207-bc892fb23b84.csv'
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
import { Scene, HeatmapLayer } from '@antv/l7';
|
import { Scene, HeatmapLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
style: 'dark',
|
map: new AMap({
|
||||||
pitch: 0,
|
style: 'dark',
|
||||||
center: [ 110.097892, 33.853662 ],
|
pitch: 0,
|
||||||
zoom: 4.056,
|
center: [ 110.097892, 33.853662 ],
|
||||||
type: 'amap'
|
zoom: 4.056,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
window.mapScene = scene;
|
|
||||||
fetch(
|
fetch(
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/7359a5e9-3c5e-453f-b207-bc892fb23b84.csv'
|
'https://gw.alipayobjects.com/os/basement_prod/7359a5e9-3c5e-453f-b207-bc892fb23b84.csv'
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import { Scene, HeatmapLayer } from '@antv/l7';
|
import { Scene, HeatmapLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
style: 'light',
|
map: new AMap({
|
||||||
pitch: 0,
|
style: 'light',
|
||||||
center: [ 110.097892, 33.853662 ],
|
pitch: 0,
|
||||||
zoom: 4.056,
|
center: [ 110.097892, 33.853662 ],
|
||||||
type: 'amap'
|
zoom: 4.056,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
import { Scene, HeatmapLayer } from '@antv/l7';
|
import { Scene, HeatmapLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
style: 'dark',
|
map: new AMap({
|
||||||
pitch: 0,
|
style: 'dark',
|
||||||
center: [ 110.097892, 33.853662 ],
|
pitch: 0,
|
||||||
zoom: 4.056,
|
center: [ 110.097892, 33.853662 ],
|
||||||
type: 'amap'
|
zoom: 4.056,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
window.mapScene = scene;
|
|
||||||
fetch(
|
fetch(
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/7359a5e9-3c5e-453f-b207-bc892fb23b84.csv'
|
'https://gw.alipayobjects.com/os/basement_prod/7359a5e9-3c5e-453f-b207-bc892fb23b84.csv'
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import { Scene, HeatmapLayer } from '@antv/l7';
|
import { Scene, HeatmapLayer } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
style: 'dark',
|
map: new Mapbox({
|
||||||
pitch: 0,
|
style: 'dark',
|
||||||
center: [ 127.5671666579043, 7.445038892195569 ],
|
pitch: 0,
|
||||||
type: 'mapbox',
|
center: [ 127.5671666579043, 7.445038892195569 ],
|
||||||
zoom: 2.632456779444394
|
zoom: 2.632456779444394,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
import { Scene, HeatmapLayer } from '@antv/l7';
|
import { Scene, HeatmapLayer } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
style: 'dark',
|
map: new Mapbox({
|
||||||
pitch: 58.5,
|
style: 'dark',
|
||||||
center: [ 111.8759, 30.6942 ],
|
pitch: 58.5,
|
||||||
rotation: 0.519,
|
center: [ 111.8759, 30.6942 ],
|
||||||
type: 'mapbox',
|
rotation: 0.519,
|
||||||
zoom: 3.6116
|
zoom: 3.6116,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
window.mapScene = scene;
|
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/337ddbb7-aa3f-4679-ab60-d64359241955.json'
|
'https://gw.alipayobjects.com/os/basement_prod/337ddbb7-aa3f-4679-ab60-d64359241955.json'
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import { Scene, HeatmapLayer } from '@antv/l7';
|
import { Scene, HeatmapLayer } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
style: 'dark',
|
map: new Mapbox({
|
||||||
pitch: 0,
|
style: 'dark',
|
||||||
center: [ 127.5671666579043, 7.445038892195569 ],
|
pitch: 0,
|
||||||
type: 'mapbox',
|
center: [ 127.5671666579043, 7.445038892195569 ],
|
||||||
zoom: 2.632456779444394
|
zoom: 2.632456779444394
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
import { Scene, HeatmapLayer } from '@antv/l7';
|
import { Scene, HeatmapLayer } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
style: 'dark',
|
map: new Mapbox({
|
||||||
pitch: 47.49999999999995,
|
style: 'dark',
|
||||||
center: [ 112.50447776627743, 30.830476390931125 ],
|
pitch: 47.49999999999995,
|
||||||
zoom: 3.9879693680088626,
|
center: [ 112.50447776627743, 30.830476390931125 ],
|
||||||
type: 'mapbox'
|
zoom: 3.9879693680088626,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
window.mapScene = scene;
|
|
||||||
fetch(
|
fetch(
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/7359a5e9-3c5e-453f-b207-bc892fb23b84.csv'
|
'https://gw.alipayobjects.com/os/basement_prod/7359a5e9-3c5e-453f-b207-bc892fb23b84.csv'
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
import { Scene, HeatmapLayer } from '@antv/l7';
|
import { Scene, HeatmapLayer } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
style: 'light',
|
map: new Mapbox({
|
||||||
pitch: 56.499,
|
style: 'light',
|
||||||
center: [ 114.07737552216226, 22.542656745583486 ],
|
pitch: 56.499,
|
||||||
rotation: 39.19,
|
center: [ 114.07737552216226, 22.542656745583486 ],
|
||||||
zoom: 12.47985,
|
rotation: 39.19,
|
||||||
type: 'mapbox'
|
zoom: 12.47985,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
window.mapScene = scene;
|
|
||||||
fetch(
|
fetch(
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/513add53-dcb2-4295-8860-9e7aa5236699.json'
|
'https://gw.alipayobjects.com/os/basement_prod/513add53-dcb2-4295-8860-9e7aa5236699.json'
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
import { Scene, HeatmapLayer } from '@antv/l7';
|
import { Scene, HeatmapLayer } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
style: 'dark',
|
map: new Mapbox({
|
||||||
pitch: 43,
|
style: 'dark',
|
||||||
center: [ 120.13383079335335, 29.651873105004427 ],
|
pitch: 43,
|
||||||
zoom: 7.068989519212174,
|
center: [ 120.13383079335335, 29.651873105004427 ],
|
||||||
type: 'mapbox'
|
zoom: 7.068989519212174,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
window.mapScene = scene;
|
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/a1a8158d-6fe3-424b-8e50-694ccf61c4d7.csv'
|
'https://gw.alipayobjects.com/os/basement_prod/a1a8158d-6fe3-424b-8e50-694ccf61c4d7.csv'
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import { Scene, HeatmapLayer } from '@antv/l7';
|
import { Scene, HeatmapLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
style: 'light',
|
map: new AMap({
|
||||||
pitch: 0,
|
style: 'light',
|
||||||
center: [ 104.995156, 31.450658 ],
|
pitch: 0,
|
||||||
type: 'amap',
|
center: [ 104.995156, 31.450658 ],
|
||||||
zoom: 3.79
|
zoom: 3.79,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
import { Scene, LineLayer } from '@antv/l7';
|
import { Scene, LineLayer } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new Mapbox({
|
||||||
type: 'mapbox',
|
pitch: 0,
|
||||||
style: 'dark',
|
style: 'dark',
|
||||||
center: [ 0, 23.107329 ],
|
center: [ 0, 23.107329 ],
|
||||||
zoom: 0
|
zoom: 0,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/b83699f9-a96d-49b8-b2ea-f99299faebaf.json'
|
'https://gw.alipayobjects.com/os/basement_prod/b83699f9-a96d-49b8-b2ea-f99299faebaf.json'
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import { Scene, LineLayer } from '@antv/l7';
|
import { Scene, LineLayer } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new Mapbox({
|
||||||
type: 'mapbox',
|
pitch: 0,
|
||||||
style: 'dark',
|
style: 'dark',
|
||||||
center: [ 107.77791556935472, 35.443286920228644 ],
|
center: [ 107.77791556935472, 35.443286920228644 ],
|
||||||
zoom: 2.9142882493605033
|
zoom: 2.9142882493605033,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
fetch('https://gw.alipayobjects.com/os/rmsportal/UEXQMifxtkQlYfChpPwT.txt')
|
fetch('https://gw.alipayobjects.com/os/rmsportal/UEXQMifxtkQlYfChpPwT.txt')
|
||||||
.then(res => res.text())
|
.then(res => res.text())
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
import { Scene, LineLayer } from '@antv/l7';
|
import { Scene, LineLayer } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 60,
|
map: new Mapbox({
|
||||||
type: 'mapbox',
|
pitch: 60,
|
||||||
style: 'light',
|
type: 'mapbox',
|
||||||
center: [ -74.06967, 40.720399 ],
|
style: 'light',
|
||||||
zoom: 12.45977
|
center: [ -74.06967, 40.720399 ],
|
||||||
|
zoom: 12.45977,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
fetch(
|
fetch(
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/bd33a685-a17e-4686-bc79-b0e6a89fd950.csv'
|
'https://gw.alipayobjects.com/os/basement_prod/bd33a685-a17e-4686-bc79-b0e6a89fd950.csv'
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
import { Scene, LineLayer } from '@antv/l7';
|
import { Scene, LineLayer } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 60,
|
map: new Mapbox({
|
||||||
type: 'mapbox',
|
pitch: 60,
|
||||||
style: 'dark',
|
style: 'dark',
|
||||||
center: [ 104.34278, 41.12554 ],
|
center: [ 104.34278, 41.12554 ],
|
||||||
zoom: 2.94888,
|
zoom: 2.94888,
|
||||||
rotation: 42.3999
|
rotation: 42.3999,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch('https://gw.alipayobjects.com/os/rmsportal/UEXQMifxtkQlYfChpPwT.txt')
|
fetch('https://gw.alipayobjects.com/os/rmsportal/UEXQMifxtkQlYfChpPwT.txt')
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import { Scene, LineLayer } from '@antv/l7';
|
import { Scene, LineLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 53.6305,
|
map: new AMap({
|
||||||
type: 'amap',
|
pitch: 53.6305,
|
||||||
style: 'light',
|
style: 'light',
|
||||||
center: [ 102.600579, 23.114887 ],
|
center: [ 102.600579, 23.114887 ],
|
||||||
zoom: 14.66
|
zoom: 14.66
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch('https://gw.alipayobjects.com/os/rmsportal/ZVfOvhVCzwBkISNsuKCc.json')
|
fetch('https://gw.alipayobjects.com/os/rmsportal/ZVfOvhVCzwBkISNsuKCc.json')
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import { Scene, LineLayer } from '@antv/l7';
|
import { Scene, LineLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 26.842105263157915,
|
map: new AMap({
|
||||||
type: 'amap',
|
pitch: 26.842105263157915,
|
||||||
style: 'dark',
|
style: 'dark',
|
||||||
center: [ 102.599436, 23.116371 ],
|
center: [ 102.599436, 23.116371 ],
|
||||||
zoom: 14.78
|
zoom: 14.78,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch('https://gw.alipayobjects.com/os/rmsportal/ZVfOvhVCzwBkISNsuKCc.json')
|
fetch('https://gw.alipayobjects.com/os/rmsportal/ZVfOvhVCzwBkISNsuKCc.json')
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import { Scene, LineLayer } from '@antv/l7';
|
import { Scene, LineLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new AMap({
|
||||||
type: 'amap',
|
pitch: 0,
|
||||||
style: 'light',
|
style: 'light',
|
||||||
center: [ 104.117492, 36.492696 ],
|
center: [ 104.117492, 36.492696 ],
|
||||||
zoom: 3.89
|
zoom: 3.89,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import { Scene, LineLayer } from '@antv/l7';
|
import { Scene, LineLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new AMap({
|
||||||
type: 'amap',
|
pitch: 0,
|
||||||
style: 'light',
|
style: 'light',
|
||||||
center: [ 104.117492, 36.492696 ],
|
center: [ 104.117492, 36.492696 ],
|
||||||
zoom: 3.89
|
zoom: 3.89
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
import { Scene, LineLayer } from '@antv/l7';
|
import { Scene, LineLayer } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
center: [ 103.83735, 1.3602538 ],
|
map: new Mapbox({
|
||||||
pitch: 4.00000000000001,
|
center: [ 103.83735, 1.3602538 ],
|
||||||
zoom: 10.210275860702593,
|
pitch: 4.00000000000001,
|
||||||
rotation: 19.313180925794313,
|
zoom: 10.210275860702593,
|
||||||
type: 'mapbox',
|
rotation: 19.313180925794313,
|
||||||
style: 'dark'
|
style: 'dark',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
import { Scene, LineLayer } from '@antv/l7';
|
import { Scene, LineLayer } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
center: [ 103.83735604457024, 1.360253881403068 ],
|
map: new Mapbox({
|
||||||
pitch: 4.00000000000001,
|
center: [ 103.83735604457024, 1.360253881403068 ],
|
||||||
zoom: 10.210275860702593,
|
pitch: 4.00000000000001,
|
||||||
rotation: 19.313180925794313,
|
zoom: 10.210275860702593,
|
||||||
type: 'mapbox',
|
rotation: 19.313180925794313,
|
||||||
style: 'light'
|
style: 'light',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
import { Scene, LineLayer } from '@antv/l7';
|
import { Scene, LineLayer } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
center: [ 116.3956, 39.9392 ],
|
map: new Mapbox({
|
||||||
pitch: 0,
|
center: [ 116.3956, 39.9392 ],
|
||||||
zoom: 10,
|
pitch: 0,
|
||||||
rotation: 0,
|
zoom: 10,
|
||||||
type: 'mapbox',
|
rotation: 0,
|
||||||
style: 'dark'
|
style: 'dark',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
import { Scene, LineLayer } from '@antv/l7';
|
import { Scene, LineLayer } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
center: [ 116.3956, 39.9392 ],
|
map: new Mapbox({
|
||||||
pitch: 0,
|
center: [ 116.3956, 39.9392 ],
|
||||||
zoom: 10,
|
pitch: 0,
|
||||||
rotation: 0,
|
zoom: 10,
|
||||||
type: 'mapbox',
|
rotation: 0,
|
||||||
style: 'light'
|
style: 'light',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
import { Scene, PointLayer } from '@antv/l7';
|
import { Scene, PointLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new AMap({
|
||||||
type: 'amap',
|
pitch: 0,
|
||||||
style: 'light',
|
style: 'light',
|
||||||
center: [ 121.435159, 31.256971 ],
|
center: [ 121.435159, 31.256971 ],
|
||||||
zoom: 14.89,
|
zoom: 14.89,
|
||||||
minZoom: 10
|
minZoom: 10,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
fetch(
|
fetch(
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9140d288ae.json'
|
'https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9140d288ae.json'
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
import { Scene, PointLayer } from '@antv/l7';
|
import { Scene, PointLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new AMap({
|
||||||
type: 'amap',
|
pitch: 0,
|
||||||
style: 'light',
|
type: 'amap',
|
||||||
center: [ 140.067171, 36.26186 ],
|
style: 'light',
|
||||||
zoom: 5.32,
|
center: [ 140.067171, 36.26186 ],
|
||||||
maxZoom: 10
|
zoom: 5.32,
|
||||||
|
maxZoom: 10,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import { Scene, PointLayer } from '@antv/l7';
|
import { Scene, PointLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
type: 'amap',
|
map: new AMap({
|
||||||
style: 'light',
|
style: 'light',
|
||||||
center: [ -121.24357, 37.58264 ],
|
center: [ -121.24357, 37.58264 ],
|
||||||
pitch: 0,
|
pitch: 0,
|
||||||
zoom: 6.45
|
zoom: 6.45,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
import { Scene, PointLayer } from '@antv/l7';
|
import { Scene, PointLayer } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new Mapbox({
|
||||||
type: 'mapbox',
|
pitch: 0,
|
||||||
style: 'dark',
|
style: 'dark',
|
||||||
center: [ 96.99215001469588, 29.281597225674773 ],
|
center: [ 96.99215001469588, 29.281597225674773 ],
|
||||||
zoom: 2.194613775109773,
|
zoom: 2.194613775109773,
|
||||||
maxZoom: 10
|
maxZoom: 10,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
fetch(
|
fetch(
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/337ddbb7-aa3f-4679-ab60-d64359241955.json'
|
'https://gw.alipayobjects.com/os/basement_prod/337ddbb7-aa3f-4679-ab60-d64359241955.json'
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
import { Scene, Marker } from '@antv/l7';
|
import { Scene, Marker } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
import * as G2 from '@antv/g2';
|
import * as G2 from '@antv/g2';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
type: 'amap',
|
map: new AMap({
|
||||||
style: 'light',
|
style: 'light',
|
||||||
center: [ 2.6125016864608597, 49.359131 ],
|
center: [ 2.6125016864608597, 49.359131 ],
|
||||||
pitch: 0,
|
pitch: 0,
|
||||||
zoom: 4.19
|
zoom: 4.19,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
scene.render();
|
scene.render();
|
||||||
scene.on('loaded', () => {
|
scene.on('loaded', () => {
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
import { Scene, Marker } from '@antv/l7';
|
import { Scene, Marker } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
import * as G2 from '@antv/g2';
|
import * as G2 from '@antv/g2';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
type: 'amap',
|
map: new AMap({
|
||||||
style: 'light',
|
style: 'light',
|
||||||
center: [ 2.6125016864608597, 49.359131 ],
|
center: [ 2.6125016864608597, 49.359131 ],
|
||||||
pitch: 0,
|
pitch: 0,
|
||||||
zoom: 4.19
|
zoom: 4.19,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
scene.render();
|
scene.render();
|
||||||
scene.on('loaded', () => {
|
scene.on('loaded', () => {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Scene, Marker } from '@antv/l7';
|
import { Scene, Marker } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
import * as G2 from '@antv/g2';
|
import * as G2 from '@antv/g2';
|
||||||
|
|
||||||
const CSS = `.l7-marker .g2-guide-html {
|
const CSS = `.l7-marker .g2-guide-html {
|
||||||
|
@ -36,11 +37,12 @@ loadCssCode(CSS);
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new Mapbox({
|
||||||
type: 'mapbox',
|
pitch: 0,
|
||||||
style: 'dark',
|
style: 'dark',
|
||||||
center: [ 52.21496184144132, 24.121126851768906 ],
|
center: [ 52.21496184144132, 24.121126851768906 ],
|
||||||
zoom: 3.802
|
zoom: 3.802
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
scene.render();
|
scene.render();
|
||||||
scene.on('loaded', () => {
|
scene.on('loaded', () => {
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
import { Scene, PointLayer } from '@antv/l7';
|
import { Scene, PointLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 66.02383,
|
map: new AMap({
|
||||||
type: 'amap',
|
pitch: 66.02383,
|
||||||
style: 'dark',
|
style: 'dark',
|
||||||
center: [ 121.400257, 31.25287 ],
|
center: [ 121.400257, 31.25287 ],
|
||||||
zoom: 14.55,
|
zoom: 14.55,
|
||||||
rotation: 134.9507
|
rotation: 134.9507
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
window.mapScene = scene;
|
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9140d288ae.json'
|
'https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9140d288ae.json'
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
import { Scene, PointLayer } from '@antv/l7';
|
import { Scene, PointLayer } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 60,
|
map: new Mapbox({
|
||||||
type: 'mapbox',
|
pitch: 60,
|
||||||
style: 'light',
|
style: 'light',
|
||||||
center: [ 121.412224, 31.26192438 ],
|
center: [ 121.412224, 31.26192438 ],
|
||||||
zoom: 13.13438,
|
zoom: 13.13438,
|
||||||
rotation: 35.97133
|
rotation: 35.97133,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
window.mapScene = scene;
|
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9140d288ae.json'
|
'https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9140d288ae.json'
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
import { Scene, PointLayer } from '@antv/l7';
|
import { Scene, PointLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 35.210526315789465,
|
map: new AMap({
|
||||||
type: 'amap',
|
pitch: 35.210526315789465,
|
||||||
style: 'dark',
|
style: 'dark',
|
||||||
center: [ 104.288144, 31.239692 ],
|
center: [ 104.288144, 31.239692 ],
|
||||||
zoom: 4.4
|
zoom: 4.4,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
window.mapScene = scene;
|
|
||||||
fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json')
|
fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json')
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
import { Scene, PointLayer } from '@antv/l7';
|
import { Scene, PointLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 48.62562,
|
map: new AMap({
|
||||||
type: 'amap',
|
pitch: 48.62562,
|
||||||
style: 'light',
|
style: 'light',
|
||||||
center: [ 104.026043, 31.847 ],
|
center: [ 104.026043, 31.847 ],
|
||||||
rotation: -0.76,
|
rotation: -0.76,
|
||||||
zoom: 4.48
|
zoom: 4.48
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
window.mapScene = scene;
|
|
||||||
fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json')
|
fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json')
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import { Scene, PointLayer } from '@antv/l7';
|
import { Scene, PointLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new AMap({
|
||||||
type: 'amap',
|
pitch: 0,
|
||||||
style: 'light',
|
style: 'light',
|
||||||
center: [ 121.434765, 31.256735 ],
|
center: [ 121.434765, 31.256735 ],
|
||||||
zoom: 14.83
|
zoom: 14.83
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import { Scene, PointLayer } from '@antv/l7';
|
import { Scene, PointLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new AMap({
|
||||||
type: 'amap',
|
pitch: 0,
|
||||||
style: 'light',
|
style: 'light',
|
||||||
center: [ 116.276227, 35.256776 ],
|
center: [ 116.276227, 35.256776 ],
|
||||||
zoom: 6
|
zoom: 6
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
import { Scene, PointLayer } from '@antv/l7';
|
import { Scene, PointLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
type: 'amap',
|
map: new AMap({
|
||||||
style: 'dark',
|
style: 'dark',
|
||||||
center: [ 120.5969, 29.7918 ],
|
center: [ 120.5969, 29.7918 ],
|
||||||
pitch: 35,
|
pitch: 35,
|
||||||
zoom: 7,
|
zoom: 7,
|
||||||
rotation: 4.183582
|
rotation: 4.183582,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
scene.addImage(
|
scene.addImage(
|
||||||
'00',
|
'00',
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import { Scene, Marker } from '@antv/l7';
|
import { Scene, Marker } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
type: 'amap',
|
map: new AMap({
|
||||||
style: 'light',
|
style: 'light',
|
||||||
center: [ 105.790327, 36.495636 ],
|
center: [ 105.790327, 36.495636 ],
|
||||||
pitch: 0,
|
pitch: 0,
|
||||||
zoom: 4
|
zoom: 4,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
scene.render();
|
scene.render();
|
||||||
scene.on('loaded', () => {
|
scene.on('loaded', () => {
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
import { Scene, PointLayer } from '@antv/l7';
|
import { Scene, PointLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
type: 'amap',
|
map: new AMap({
|
||||||
style: 'dark',
|
style: 'dark',
|
||||||
center: [ 121.417463, 31.215175 ],
|
center: [ 121.417463, 31.215175 ],
|
||||||
pitch: 0,
|
pitch: 0,
|
||||||
zoom: 11
|
zoom: 11,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
window.mapScene = scene;
|
|
||||||
fetch('https://gw.alipayobjects.com/os/rmsportal/BElVQFEFvpAKzddxFZxJ.txt')
|
fetch('https://gw.alipayobjects.com/os/rmsportal/BElVQFEFvpAKzddxFZxJ.txt')
|
||||||
.then(res => res.text())
|
.then(res => res.text())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
import { Scene, PointLayer } from '@antv/l7';
|
import { Scene, PointLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 64.88,
|
map: new AMap({
|
||||||
type: 'amap',
|
pitch: 64.88,
|
||||||
style: 'dark',
|
style: 'dark',
|
||||||
center: [ 114.060288, 22.53684 ],
|
center: [ 114.060288, 22.53684 ],
|
||||||
zoom: 15.63
|
zoom: 15.63,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
window.mapScene = scene;
|
|
||||||
fetch(
|
fetch(
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/513add53-dcb2-4295-8860-9e7aa5236699.json'
|
'https://gw.alipayobjects.com/os/basement_prod/513add53-dcb2-4295-8860-9e7aa5236699.json'
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
import { Scene, PolygonLayer } from '@antv/l7';
|
import { Scene, PolygonLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new AMap({
|
||||||
type: 'amap',
|
pitch: 0,
|
||||||
style: 'dark',
|
style: 'dark',
|
||||||
center: [ 114.050008, 22.529272 ],
|
center: [ 114.050008, 22.529272 ],
|
||||||
zoom: 14.1
|
zoom: 14.1
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
window.mapScene = scene;
|
|
||||||
fetch(
|
fetch(
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/972566c5-a2b9-4a7e-8da1-bae9d0eb0117.json'
|
'https://gw.alipayobjects.com/os/basement_prod/972566c5-a2b9-4a7e-8da1-bae9d0eb0117.json'
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
import { Scene, PolygonLayer, LineLayer } from '@antv/l7';
|
import { Scene, PolygonLayer, LineLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new AMap({
|
||||||
type: 'amap',
|
pitch: 0,
|
||||||
style: 'light',
|
style: 'light',
|
||||||
center: [ 116.368652, 39.93866 ],
|
center: [ 116.368652, 39.93866 ],
|
||||||
zoom: 10.07
|
zoom: 10.07
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
window.mapScene = scene;
|
|
||||||
fetch(
|
fetch(
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/1d27c363-af3a-469e-ab5b-7a7e1ce4f311.json'
|
'https://gw.alipayobjects.com/os/basement_prod/1d27c363-af3a-469e-ab5b-7a7e1ce4f311.json'
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import { Scene, PolygonLayer, LineLayer } from '@antv/l7';
|
import { Scene, PolygonLayer, LineLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new AMap({
|
||||||
type: 'amap',
|
pitch: 0,
|
||||||
style: 'light',
|
style: 'light',
|
||||||
center: [ 107.042225, 37.66565 ],
|
center: [ 107.042225, 37.66565 ],
|
||||||
zoom: 3.87
|
zoom: 3.87
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch('https://gw.alipayobjects.com/os/rmsportal/JToMOWvicvJOISZFCkEI.json')
|
fetch('https://gw.alipayobjects.com/os/rmsportal/JToMOWvicvJOISZFCkEI.json')
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import { Scene, PolygonLayer, LineLayer } from '@antv/l7';
|
import { Scene, PolygonLayer, LineLayer } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new Mapbox({
|
||||||
type: 'mapbox',
|
pitch: 0,
|
||||||
style: 'light',
|
style: 'light',
|
||||||
center: [ 3.438, 40.16797 ],
|
center: [ 3.438, 40.16797 ],
|
||||||
zoom: 0.51329
|
zoom: 0.51329,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
Promise.all([
|
Promise.all([
|
||||||
fetch(
|
fetch(
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import { Scene, ImageLayer } from '@antv/l7';
|
import { Scene, ImageLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new AMap({
|
||||||
type: 'amap',
|
pitch: 0,
|
||||||
style: 'light',
|
style: 'light',
|
||||||
center: [ 121.268, 30.3628 ],
|
center: [ 121.268, 30.3628 ],
|
||||||
zoom: 13
|
zoom: 13,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
const layer = new ImageLayer({});
|
const layer = new ImageLayer({});
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import { Scene, ImageLayer } from '@antv/l7';
|
import { Scene, ImageLayer } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
|
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new AMap({
|
||||||
type: 'amap',
|
pitch: 0,
|
||||||
style: 'dark',
|
style: 'dark',
|
||||||
center: [ 115.5268, 34.3628 ],
|
center: [ 115.5268, 34.3628 ],
|
||||||
zoom: 7
|
zoom: 7,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
const layer = new ImageLayer({});
|
const layer = new ImageLayer({});
|
||||||
|
|
|
@ -4,3 +4,4 @@ require('./packages/component/src/css/l7.css');
|
||||||
window.geotiff = require('geotiff/dist/geotiff.bundle.min.js');
|
window.geotiff = require('geotiff/dist/geotiff.bundle.min.js');
|
||||||
window.g2 = require('@antv/g2');
|
window.g2 = require('@antv/g2');
|
||||||
window.l7 = require('@antv/l7');
|
window.l7 = require('@antv/l7');
|
||||||
|
window.l7Maps = require('@antv/l7-maps');
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
],
|
],
|
||||||
"allowBranch": [
|
"allowBranch": [
|
||||||
"master",
|
"master",
|
||||||
"develop",
|
"next"
|
||||||
"next",
|
|
||||||
"dev-container"
|
|
||||||
],
|
],
|
||||||
"message": "chore: publish"
|
"message": "chore: publish"
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ export default class Marker {
|
||||||
private markerOption: IMarkerOption;
|
private markerOption: IMarkerOption;
|
||||||
private defaultMarker: boolean;
|
private defaultMarker: boolean;
|
||||||
private popup: IPopup; // TODO: POPup
|
private popup: IPopup; // TODO: POPup
|
||||||
private mapservice: IMapService;
|
private mapservice: IMapService<unknown>;
|
||||||
private lngLat: ILngLat;
|
private lngLat: ILngLat;
|
||||||
private scene: IMarkerScene;
|
private scene: IMarkerScene;
|
||||||
constructor(option?: Partial<IMarkerOption>) {
|
constructor(option?: Partial<IMarkerOption>) {
|
||||||
|
|
|
@ -15,7 +15,7 @@ export interface IPopupOption {
|
||||||
}
|
}
|
||||||
export default class Popup extends EventEmitter implements IPopup {
|
export default class Popup extends EventEmitter implements IPopup {
|
||||||
private popupOption: IPopupOption;
|
private popupOption: IPopupOption;
|
||||||
private mapservice: IMapService;
|
private mapservice: IMapService<unknown>;
|
||||||
private lngLat: ILngLat;
|
private lngLat: ILngLat;
|
||||||
private content: HTMLElement;
|
private content: HTMLElement;
|
||||||
private closeButton: HTMLElement;
|
private closeButton: HTMLElement;
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
"inversify": "^5.0.1",
|
"inversify": "^5.0.1",
|
||||||
"inversify-inject-decorators": "^3.1.0",
|
"inversify-inject-decorators": "^3.1.0",
|
||||||
"lodash": "^4.17.15",
|
"lodash": "^4.17.15",
|
||||||
"mapbox-gl": "^1.2.1",
|
|
||||||
"merge-json-schemas": "^1.0.0",
|
"merge-json-schemas": "^1.0.0",
|
||||||
"probe.gl": "^3.1.1",
|
"probe.gl": "^3.1.1",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
|
@ -39,7 +38,6 @@
|
||||||
"viewport-mercator-project": "^6.2.1"
|
"viewport-mercator-project": "^6.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/amap-js-api": "^1.4.6",
|
|
||||||
"@types/gl-matrix": "^2.4.5",
|
"@types/gl-matrix": "^2.4.5",
|
||||||
"@types/hammerjs": "^2.0.36",
|
"@types/hammerjs": "^2.0.36",
|
||||||
"@types/lodash": "^4.14.138",
|
"@types/lodash": "^4.14.138",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { ILngLat, IMapService } from '../map/IMapService';
|
import { ILngLat, IMapService } from '../map/IMapService';
|
||||||
export interface IMarkerScene {
|
export interface IMarkerScene {
|
||||||
getMapService(): IMapService;
|
getMapService(): IMapService<unknown>;
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
export interface IMarker {
|
export interface IMarker {
|
||||||
|
|
|
@ -2,16 +2,14 @@ import Ajv from 'ajv';
|
||||||
import { injectable, postConstruct } from 'inversify';
|
import { injectable, postConstruct } from 'inversify';
|
||||||
import { ILayerConfig } from '../layer/ILayerService';
|
import { ILayerConfig } from '../layer/ILayerService';
|
||||||
import { IGlobalConfigService, ISceneConfig } from './IConfigService';
|
import { IGlobalConfigService, ISceneConfig } from './IConfigService';
|
||||||
|
import mapConfigSchema from './mapConfigSchema';
|
||||||
import sceneConfigSchema from './sceneConfigSchema';
|
import sceneConfigSchema from './sceneConfigSchema';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 场景默认配置项
|
* 场景默认配置项
|
||||||
*/
|
*/
|
||||||
const defaultSceneConfig: Partial<ISceneConfig> = {
|
const defaultSceneConfig: Partial<ISceneConfig> = {
|
||||||
type: 'amap',
|
id: 'map',
|
||||||
zoom: 5,
|
|
||||||
center: [107.622, 39.266],
|
|
||||||
pitch: 0,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,6 +77,11 @@ export default class GlobalConfigService implements IGlobalConfigService {
|
||||||
*/
|
*/
|
||||||
private sceneConfigValidator: Ajv.ValidateFunction;
|
private sceneConfigValidator: Ajv.ValidateFunction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地图配置项校验器
|
||||||
|
*/
|
||||||
|
private mapConfigValidator: Ajv.ValidateFunction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 全部图层配置项缓存
|
* 全部图层配置项缓存
|
||||||
*/
|
*/
|
||||||
|
@ -108,6 +111,10 @@ export default class GlobalConfigService implements IGlobalConfigService {
|
||||||
return this.validate(this.sceneConfigValidator, data);
|
return this.validate(this.sceneConfigValidator, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public validateMapConfig(data: object) {
|
||||||
|
return this.validate(this.mapConfigValidator, data);
|
||||||
|
}
|
||||||
|
|
||||||
public getLayerConfig<IChildLayerConfig>(
|
public getLayerConfig<IChildLayerConfig>(
|
||||||
layerId: string,
|
layerId: string,
|
||||||
): Partial<ILayerConfig & ISceneConfig & IChildLayerConfig> {
|
): Partial<ILayerConfig & ISceneConfig & IChildLayerConfig> {
|
||||||
|
@ -146,6 +153,7 @@ export default class GlobalConfigService implements IGlobalConfigService {
|
||||||
@postConstruct()
|
@postConstruct()
|
||||||
private registerSceneConfigSchemaValidator() {
|
private registerSceneConfigSchemaValidator() {
|
||||||
this.sceneConfigValidator = ajv.compile(sceneConfigSchema);
|
this.sceneConfigValidator = ajv.compile(sceneConfigSchema);
|
||||||
|
this.mapConfigValidator = ajv.compile(mapConfigSchema);
|
||||||
}
|
}
|
||||||
|
|
||||||
private validate(
|
private validate(
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
import Ajv from 'ajv';
|
import Ajv from 'ajv';
|
||||||
import { ILayerConfig } from '../layer/ILayerService';
|
import { ILayerConfig } from '../layer/ILayerService';
|
||||||
import { IMapConfig } from '../map/IMapService';
|
import { IMapWrapper } from '../map/IMapService';
|
||||||
import { IRenderConfig } from '../renderer/IRendererService';
|
import { IRenderConfig } from '../renderer/IRendererService';
|
||||||
|
|
||||||
export type ISceneConfig = IMapConfig & IRenderConfig;
|
export interface ISceneConfig extends IRenderConfig {
|
||||||
|
id: string;
|
||||||
|
map: IMapWrapper;
|
||||||
|
}
|
||||||
|
|
||||||
interface IValidateResult {
|
interface IValidateResult {
|
||||||
valid: boolean;
|
valid: boolean;
|
||||||
|
@ -25,6 +28,12 @@ export interface IGlobalConfigService {
|
||||||
*/
|
*/
|
||||||
validateSceneConfig(data: object): IValidateResult;
|
validateSceneConfig(data: object): IValidateResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验用户传入的地图配置项
|
||||||
|
* @param data 地图配置项
|
||||||
|
*/
|
||||||
|
validateMapConfig(data: object): IValidateResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取图层配置项
|
* 获取图层配置项
|
||||||
* @param layerId 图层 ID
|
* @param layerId 图层 ID
|
||||||
|
|
|
@ -1,12 +1,99 @@
|
||||||
|
import { Container } from 'inversify';
|
||||||
import 'reflect-metadata';
|
import 'reflect-metadata';
|
||||||
import ConfigService from '../ConfigService';
|
import { TYPES } from '../../../index';
|
||||||
|
import GlobalConfigService from '../ConfigService';
|
||||||
import { IGlobalConfigService } from '../IConfigService';
|
import { IGlobalConfigService } from '../IConfigService';
|
||||||
|
|
||||||
describe('ConfigService', () => {
|
describe('ConfigService', () => {
|
||||||
|
let container: Container;
|
||||||
let configService: IGlobalConfigService;
|
let configService: IGlobalConfigService;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeAll(() => {
|
||||||
configService = new ConfigService();
|
container = new Container();
|
||||||
|
container
|
||||||
|
.bind<IGlobalConfigService>(TYPES.IGlobalConfigService)
|
||||||
|
.to(GlobalConfigService);
|
||||||
|
configService = container.get<IGlobalConfigService>(
|
||||||
|
TYPES.IGlobalConfigService,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
|
container.unbind(TYPES.IGlobalConfigService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should validate scene's options according to JSON schema", () => {
|
||||||
|
const { valid, errorText } = configService.validateSceneConfig({
|
||||||
|
id: 0,
|
||||||
|
});
|
||||||
|
expect(valid).toBeFalsy();
|
||||||
|
expect(errorText).toMatch('id should be string');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
configService.validateSceneConfig({
|
||||||
|
id: 'map',
|
||||||
|
}).valid,
|
||||||
|
).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should validate map's `zoom` option", () => {
|
||||||
|
const { valid, errorText } = configService.validateMapConfig({
|
||||||
|
zoom: 100,
|
||||||
|
minZoom: 100,
|
||||||
|
maxZoom: -1,
|
||||||
|
});
|
||||||
|
expect(valid).toBeFalsy();
|
||||||
|
expect(errorText).toMatch('zoom should be <= 20');
|
||||||
|
expect(errorText).toMatch('minZoom should be <= 20');
|
||||||
|
expect(errorText).toMatch('maxZoom should be >= 0');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
configService.validateMapConfig({
|
||||||
|
zoom: 10,
|
||||||
|
minZoom: 1,
|
||||||
|
maxZoom: 15,
|
||||||
|
}).valid,
|
||||||
|
).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should validate map's `pitch` option", () => {
|
||||||
|
const { valid, errorText } = configService.validateMapConfig({
|
||||||
|
pitch: '1',
|
||||||
|
});
|
||||||
|
expect(valid).toBeFalsy();
|
||||||
|
expect(errorText).toMatch('pitch should be number');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
configService.validateMapConfig({
|
||||||
|
pitch: 10,
|
||||||
|
}).valid,
|
||||||
|
).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should validate map's `center` option", () => {
|
||||||
|
const { valid, errorText } = configService.validateMapConfig({
|
||||||
|
center: [1, 2, 3],
|
||||||
|
});
|
||||||
|
expect(valid).toBeFalsy();
|
||||||
|
expect(errorText).toMatch('center should NOT have more than 2 items');
|
||||||
|
|
||||||
|
const { valid: v2, errorText: e2 } = configService.validateMapConfig({
|
||||||
|
center: [1],
|
||||||
|
});
|
||||||
|
expect(v2).toBeFalsy();
|
||||||
|
expect(e2).toMatch('center should NOT have fewer than 2 items');
|
||||||
|
|
||||||
|
const { valid: v3, errorText: e3 } = configService.validateMapConfig({
|
||||||
|
center: 100,
|
||||||
|
});
|
||||||
|
expect(v3).toBeFalsy();
|
||||||
|
expect(e3).toMatch('center should be array');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
configService.validateMapConfig({
|
||||||
|
center: [100, 100],
|
||||||
|
}).valid,
|
||||||
|
).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should validate layer's options according to JSON schema", () => {
|
it("should validate layer's options according to JSON schema", () => {
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
/**
|
||||||
|
* 地图 Schema
|
||||||
|
*/
|
||||||
|
export default {
|
||||||
|
properties: {
|
||||||
|
// 地图缩放等级
|
||||||
|
zoom: {
|
||||||
|
type: 'number',
|
||||||
|
minimum: 0,
|
||||||
|
maximum: 20,
|
||||||
|
},
|
||||||
|
minZoom: {
|
||||||
|
type: 'number',
|
||||||
|
minimum: 0,
|
||||||
|
maximum: 20,
|
||||||
|
},
|
||||||
|
maxZoom: {
|
||||||
|
type: 'number',
|
||||||
|
minimum: 0,
|
||||||
|
maximum: 20,
|
||||||
|
},
|
||||||
|
// 地图中心点
|
||||||
|
center: {
|
||||||
|
type: 'array',
|
||||||
|
items: {
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
maxItems: 2,
|
||||||
|
minItems: 2,
|
||||||
|
},
|
||||||
|
// 仰角
|
||||||
|
pitch: {
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -1,5 +1,3 @@
|
||||||
import { MapType } from '../map/IMapService';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 场景 Schema
|
* 场景 Schema
|
||||||
*/
|
*/
|
||||||
|
@ -9,27 +7,5 @@ export default {
|
||||||
id: {
|
id: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
},
|
},
|
||||||
// 地图类型,目前支持高德 & Mapbox
|
|
||||||
type: {
|
|
||||||
enum: [MapType.amap, MapType.mapbox],
|
|
||||||
},
|
|
||||||
// 地图缩放等级
|
|
||||||
zoom: {
|
|
||||||
type: 'number',
|
|
||||||
minimum: 0,
|
|
||||||
maximum: 20,
|
|
||||||
},
|
|
||||||
// 地图中心点
|
|
||||||
center: {
|
|
||||||
item: {
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
maxItems: 2,
|
|
||||||
minItems: 2,
|
|
||||||
},
|
|
||||||
// 仰角
|
|
||||||
pitch: {
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/// <reference types="amap-js-api" />
|
import { Container } from 'inversify';
|
||||||
import { Map } from 'mapbox-gl';
|
|
||||||
import { IViewport } from '../camera/ICameraService';
|
import { IViewport } from '../camera/ICameraService';
|
||||||
export type Point = [number, number];
|
export type Point = [number, number];
|
||||||
export type Bounds = [[number, number], [number, number]];
|
export type Bounds = [[number, number], [number, number]];
|
||||||
|
@ -11,9 +10,14 @@ export interface IPoint {
|
||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
}
|
}
|
||||||
export interface IMapService {
|
|
||||||
map: AMap.Map | Map;
|
export interface IMapWrapper {
|
||||||
init(config: Partial<IMapConfig>): void;
|
setContainer(container: Container, id: string): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IMapService<RawMap = {}> {
|
||||||
|
map: RawMap;
|
||||||
|
init(): void;
|
||||||
destroy(): void;
|
destroy(): void;
|
||||||
onCameraChanged(callback: (viewport: IViewport) => void): void;
|
onCameraChanged(callback: (viewport: IViewport) => void): void;
|
||||||
// init map
|
// init map
|
||||||
|
@ -31,7 +35,7 @@ export interface IMapService {
|
||||||
getMinZoom(): number;
|
getMinZoom(): number;
|
||||||
getMaxZoom(): number;
|
getMaxZoom(): number;
|
||||||
// get map params
|
// get map params
|
||||||
getType(): MapType;
|
getType(): string;
|
||||||
getZoom(): number;
|
getZoom(): number;
|
||||||
getCenter(): ILngLat;
|
getCenter(): ILngLat;
|
||||||
getPitch(): number;
|
getPitch(): number;
|
||||||
|
@ -56,19 +60,12 @@ export interface IMapService {
|
||||||
lngLatToContainer(lnglat: Point): IPoint;
|
lngLatToContainer(lnglat: Point): IPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum MapType {
|
|
||||||
amap = 'amap',
|
|
||||||
mapbox = 'mapbox',
|
|
||||||
}
|
|
||||||
|
|
||||||
export const MapServiceEvent = ['mapload'];
|
export const MapServiceEvent = ['mapload'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 地图初始化配置项
|
* 地图初始化配置项
|
||||||
*/
|
*/
|
||||||
export interface IMapConfig {
|
export interface IMapConfig {
|
||||||
type: MapType | keyof typeof MapType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 容器 DOM id
|
* 容器 DOM id
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -121,7 +121,7 @@ export default class Scene extends EventEmitter implements ISceneService {
|
||||||
/**
|
/**
|
||||||
* 初始化底图
|
* 初始化底图
|
||||||
*/
|
*/
|
||||||
this.hooks.init.tapPromise('initMap', async (config: unknown) => {
|
this.hooks.init.tapPromise('initMap', async () => {
|
||||||
// 等待首次相机同步
|
// 等待首次相机同步
|
||||||
await new Promise((resolve) => {
|
await new Promise((resolve) => {
|
||||||
this.map.onCameraChanged((viewport: IViewport) => {
|
this.map.onCameraChanged((viewport: IViewport) => {
|
||||||
|
@ -129,7 +129,7 @@ export default class Scene extends EventEmitter implements ISceneService {
|
||||||
this.cameraService.update(viewport);
|
this.cameraService.update(viewport);
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
this.map.init(config as Partial<IMapCamera>);
|
this.map.init();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 重新绑定非首次相机更新事件
|
// 重新绑定非首次相机更新事件
|
||||||
|
|
|
@ -26,6 +26,7 @@ const TYPES = {
|
||||||
IFactoryNormalPass: Symbol.for('Factory<IFactoryNormalPass>'),
|
IFactoryNormalPass: Symbol.for('Factory<IFactoryNormalPass>'),
|
||||||
IMultiPassRenderer: Symbol.for('IMultiPassRenderer'),
|
IMultiPassRenderer: Symbol.for('IMultiPassRenderer'),
|
||||||
SceneID: Symbol.for('SceneID'),
|
SceneID: Symbol.for('SceneID'),
|
||||||
|
MapConfig: Symbol.for('MapConfig'),
|
||||||
};
|
};
|
||||||
|
|
||||||
export { TYPES };
|
export { TYPES };
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
import {
|
||||||
|
IGlobalConfigService,
|
||||||
|
ILogService,
|
||||||
|
IMapConfig,
|
||||||
|
IMapService,
|
||||||
|
IMapWrapper,
|
||||||
|
lazyInject,
|
||||||
|
TYPES,
|
||||||
|
} from '@antv/l7-core';
|
||||||
|
import { Container } from 'inversify';
|
||||||
|
|
||||||
|
export default class BaseMapWrapper<RawMap> implements IMapWrapper {
|
||||||
|
@lazyInject(TYPES.ILogService)
|
||||||
|
protected readonly logger: ILogService;
|
||||||
|
|
||||||
|
@lazyInject(TYPES.IGlobalConfigService)
|
||||||
|
protected readonly configService: IGlobalConfigService;
|
||||||
|
|
||||||
|
protected config: Partial<IMapConfig>;
|
||||||
|
|
||||||
|
constructor(config: Partial<IMapConfig>) {
|
||||||
|
this.config = config;
|
||||||
|
}
|
||||||
|
|
||||||
|
public setContainer(sceneContainer: Container, id: string) {
|
||||||
|
// 首先使用全局配置服务校验地图参数
|
||||||
|
const { valid, errorText } = this.configService.validateMapConfig(
|
||||||
|
this.config,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!valid) {
|
||||||
|
this.logger.error(errorText || '');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 绑定用户传入的原始地图参数
|
||||||
|
sceneContainer.bind<Partial<IMapConfig>>(TYPES.MapConfig).toConstantValue({
|
||||||
|
...this.config,
|
||||||
|
id,
|
||||||
|
});
|
||||||
|
sceneContainer
|
||||||
|
.bind<IMapService<RawMap>>(TYPES.IMapService)
|
||||||
|
.to(this.getServiceConstructor())
|
||||||
|
.inSingletonScope();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getServiceConstructor(): new (...args: any[]) => IMapService<
|
||||||
|
RawMap
|
||||||
|
> {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { IAMapInstance } from '../../typings/index';
|
||||||
|
import BaseMapWrapper from '../BaseMapWrapper';
|
||||||
|
import AMapService from './index';
|
||||||
|
|
||||||
|
export default class AMapWrapper extends BaseMapWrapper<
|
||||||
|
AMap.Map & IAMapInstance
|
||||||
|
> {
|
||||||
|
protected getServiceConstructor() {
|
||||||
|
return AMapService;
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,7 +11,6 @@ import {
|
||||||
IPoint,
|
IPoint,
|
||||||
IViewport,
|
IViewport,
|
||||||
MapServiceEvent,
|
MapServiceEvent,
|
||||||
MapType,
|
|
||||||
TYPES,
|
TYPES,
|
||||||
} from '@antv/l7-core';
|
} from '@antv/l7-core';
|
||||||
import { DOM } from '@antv/l7-utils';
|
import { DOM } from '@antv/l7-utils';
|
||||||
|
@ -40,16 +39,22 @@ const LNGLAT_OFFSET_ZOOM_THRESHOLD = 12;
|
||||||
* AMapService
|
* AMapService
|
||||||
*/
|
*/
|
||||||
@injectable()
|
@injectable()
|
||||||
export default class AMapService implements IMapService {
|
export default class AMapService
|
||||||
|
implements IMapService<AMap.Map & IAMapInstance> {
|
||||||
/**
|
/**
|
||||||
* 原始地图实例
|
* 原始地图实例
|
||||||
*/
|
*/
|
||||||
public map: AMap.Map & IAMapInstance;
|
public map: AMap.Map & IAMapInstance;
|
||||||
|
|
||||||
|
@inject(TYPES.MapConfig)
|
||||||
|
private readonly config: Partial<IMapConfig>;
|
||||||
|
|
||||||
@inject(TYPES.ICoordinateSystemService)
|
@inject(TYPES.ICoordinateSystemService)
|
||||||
private readonly coordinateSystemService: ICoordinateSystemService;
|
private readonly coordinateSystemService: ICoordinateSystemService;
|
||||||
|
|
||||||
@inject(TYPES.IEventEmitter)
|
@inject(TYPES.IEventEmitter)
|
||||||
private eventEmitter: any;
|
private eventEmitter: any;
|
||||||
|
|
||||||
private markerContainer: HTMLElement;
|
private markerContainer: HTMLElement;
|
||||||
private $mapContainer: HTMLElement | null;
|
private $mapContainer: HTMLElement | null;
|
||||||
|
|
||||||
|
@ -96,7 +101,7 @@ export default class AMapService implements IMapService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public getType() {
|
public getType() {
|
||||||
return MapType.amap;
|
return 'amap';
|
||||||
}
|
}
|
||||||
public getZoom(): number {
|
public getZoom(): number {
|
||||||
// 统一返回 Mapbox 缩放等级
|
// 统一返回 Mapbox 缩放等级
|
||||||
|
@ -196,7 +201,7 @@ export default class AMapService implements IMapService {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async init(mapConfig: IMapConfig): Promise<void> {
|
public async init(): Promise<void> {
|
||||||
const {
|
const {
|
||||||
id,
|
id,
|
||||||
style = 'light',
|
style = 'light',
|
||||||
|
@ -204,7 +209,7 @@ export default class AMapService implements IMapService {
|
||||||
maxZoom = 18,
|
maxZoom = 18,
|
||||||
token = AMAP_API_KEY,
|
token = AMAP_API_KEY,
|
||||||
...rest
|
...rest
|
||||||
} = mapConfig;
|
} = this.config;
|
||||||
// 高德地图创建独立的container;
|
// 高德地图创建独立的container;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import AMapService from './amap';
|
import AMap from './amap/Wrapper';
|
||||||
import MapboxService from './mapbox';
|
import Mapbox from './mapbox/Wrapper';
|
||||||
|
|
||||||
export { AMapService, MapboxService };
|
export { AMap, Mapbox };
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { Map } from 'mapbox-gl';
|
||||||
|
import { IMapboxInstance } from '../../typings/index';
|
||||||
|
import BaseMapWrapper from '../BaseMapWrapper';
|
||||||
|
import MapboxService from './index';
|
||||||
|
|
||||||
|
export default class MapboxWrapper extends BaseMapWrapper<
|
||||||
|
Map & IMapboxInstance
|
||||||
|
> {
|
||||||
|
protected getServiceConstructor() {
|
||||||
|
return MapboxService;
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,7 +11,6 @@ import {
|
||||||
IPoint,
|
IPoint,
|
||||||
IViewport,
|
IViewport,
|
||||||
MapServiceEvent,
|
MapServiceEvent,
|
||||||
MapType,
|
|
||||||
TYPES,
|
TYPES,
|
||||||
} from '@antv/l7-core';
|
} from '@antv/l7-core';
|
||||||
import { DOM } from '@antv/l7-utils';
|
import { DOM } from '@antv/l7-utils';
|
||||||
|
@ -33,8 +32,13 @@ const LNGLAT_OFFSET_ZOOM_THRESHOLD = 12;
|
||||||
* AMapService
|
* AMapService
|
||||||
*/
|
*/
|
||||||
@injectable()
|
@injectable()
|
||||||
export default class MapboxService implements IMapService {
|
export default class MapboxService
|
||||||
|
implements IMapService<Map & IMapboxInstance> {
|
||||||
public map: Map & IMapboxInstance;
|
public map: Map & IMapboxInstance;
|
||||||
|
|
||||||
|
@inject(TYPES.MapConfig)
|
||||||
|
private readonly config: Partial<IMapConfig>;
|
||||||
|
|
||||||
@inject(TYPES.ICoordinateSystemService)
|
@inject(TYPES.ICoordinateSystemService)
|
||||||
private readonly coordinateSystemService: ICoordinateSystemService;
|
private readonly coordinateSystemService: ICoordinateSystemService;
|
||||||
|
|
||||||
|
@ -79,7 +83,7 @@ export default class MapboxService implements IMapService {
|
||||||
// get mapStatus method
|
// get mapStatus method
|
||||||
|
|
||||||
public getType() {
|
public getType() {
|
||||||
return MapType.mapbox;
|
return 'mapbox';
|
||||||
}
|
}
|
||||||
public getZoom(): number {
|
public getZoom(): number {
|
||||||
return this.map.getZoom();
|
return this.map.getZoom();
|
||||||
|
@ -168,15 +172,15 @@ export default class MapboxService implements IMapService {
|
||||||
return this.map.project(lnglat);
|
return this.map.project(lnglat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async init(mapConfig: IMapConfig): Promise<void> {
|
public async init(): Promise<void> {
|
||||||
const {
|
const {
|
||||||
id,
|
id = 'map',
|
||||||
attributionControl = false,
|
attributionControl = false,
|
||||||
style = 'light',
|
style = 'light',
|
||||||
token = 'pk.eyJ1IjoieGlhb2l2ZXIiLCJhIjoiY2pxcmc5OGNkMDY3cjQzbG42cXk5NTl3YiJ9.hUC5Chlqzzh0FFd_aEc-uQ',
|
token = 'pk.eyJ1IjoieGlhb2l2ZXIiLCJhIjoiY2pxcmc5OGNkMDY3cjQzbG42cXk5NTl3YiJ9.hUC5Chlqzzh0FFd_aEc-uQ',
|
||||||
rotation = 0,
|
rotation = 0,
|
||||||
...rest
|
...rest
|
||||||
} = mapConfig;
|
} = this.config;
|
||||||
this.$mapContainer = document.getElementById(id);
|
this.$mapContainer = document.getElementById(id);
|
||||||
|
|
||||||
this.viewport = new Viewport();
|
this.viewport = new Viewport();
|
||||||
|
@ -199,7 +203,6 @@ export default class MapboxService implements IMapService {
|
||||||
|
|
||||||
// 不同于高德地图,需要手动触发首次渲染
|
// 不同于高德地图,需要手动触发首次渲染
|
||||||
this.handleCameraChanged();
|
this.handleCameraChanged();
|
||||||
this.removeLogoControl();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public destroy() {
|
public destroy() {
|
||||||
|
@ -207,6 +210,7 @@ export default class MapboxService implements IMapService {
|
||||||
if (this.map) {
|
if (this.map) {
|
||||||
this.map.remove();
|
this.map.remove();
|
||||||
this.$mapContainer = null;
|
this.$mapContainer = null;
|
||||||
|
this.removeLogoControl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public emit(name: string, ...args: any[]) {
|
public emit(name: string, ...args: any[]) {
|
||||||
|
@ -223,10 +227,7 @@ export default class MapboxService implements IMapService {
|
||||||
public onCameraChanged(callback: (viewport: IViewport) => void): void {
|
public onCameraChanged(callback: (viewport: IViewport) => void): void {
|
||||||
this.cameraChangedCallback = callback;
|
this.cameraChangedCallback = callback;
|
||||||
}
|
}
|
||||||
// 同步不同底图的配置项
|
|
||||||
private initMapConig(): void {
|
|
||||||
throw new Error('Method not implemented.');
|
|
||||||
}
|
|
||||||
private handleCameraChanged = () => {
|
private handleCameraChanged = () => {
|
||||||
// @see https://github.com/mapbox/mapbox-gl-js/issues/2572
|
// @see https://github.com/mapbox/mapbox-gl-js/issues/2572
|
||||||
const { lat, lng } = this.map.getCenter().wrap();
|
const { lat, lng } = this.map.getCenter().wrap();
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { ILayer } from '@antv/l7-core';
|
||||||
|
|
||||||
|
export default interface ILayerManager {
|
||||||
|
addLayer(layer: ILayer): void;
|
||||||
|
|
||||||
|
getLayers(): ILayer[];
|
||||||
|
|
||||||
|
getLayer(id: string): ILayer | undefined;
|
||||||
|
|
||||||
|
removeLayer(layer: ILayer): void;
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
import { Bounds, ILngLat, IPoint, Point } from '@antv/l7-core';
|
||||||
|
|
||||||
|
export default interface IMapController {
|
||||||
|
/**
|
||||||
|
* 当前缩放等级
|
||||||
|
*/
|
||||||
|
getZoom(): number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 中心点经纬度
|
||||||
|
*/
|
||||||
|
getCenter(): ILngLat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仰角
|
||||||
|
*/
|
||||||
|
getPitch(): number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逆时针旋转角度
|
||||||
|
*/
|
||||||
|
getRotation(): number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前地图可视区域 `[西南角、东北角]`
|
||||||
|
*/
|
||||||
|
getBounds(): Bounds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 放大地图
|
||||||
|
*/
|
||||||
|
zoomIn(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缩小地图
|
||||||
|
*/
|
||||||
|
zoomOut(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地图平移到指定点 `[x, y]`
|
||||||
|
*/
|
||||||
|
panTo(p: Point): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地图平移到指定点 `[x, y]`
|
||||||
|
*/
|
||||||
|
panBy(pixel: Point): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调整地图适合指定区域
|
||||||
|
*/
|
||||||
|
fitBounds(bound: Bounds): void;
|
||||||
|
|
||||||
|
setRotation(rotation: number): void;
|
||||||
|
|
||||||
|
setZoomAndCenter(zoom: number, center: Point): void;
|
||||||
|
|
||||||
|
setMapStyle(style: string): void;
|
||||||
|
|
||||||
|
pixelToLngLat(pixel: Point): ILngLat;
|
||||||
|
|
||||||
|
lngLatToPixel(lnglat: Point): IPoint;
|
||||||
|
|
||||||
|
containerToLngLat(pixel: Point): ILngLat;
|
||||||
|
|
||||||
|
lngLatToContainer(lnglat: Point): IPoint;
|
||||||
|
}
|
|
@ -10,22 +10,21 @@ import {
|
||||||
ILayer,
|
ILayer,
|
||||||
ILayerService,
|
ILayerService,
|
||||||
ILngLat,
|
ILngLat,
|
||||||
IMapConfig,
|
|
||||||
IMapService,
|
IMapService,
|
||||||
IMarker,
|
IMarker,
|
||||||
IPoint,
|
IPoint,
|
||||||
IPostProcessingPass,
|
IPostProcessingPass,
|
||||||
IRenderConfig,
|
|
||||||
IRendererService,
|
IRendererService,
|
||||||
|
ISceneConfig,
|
||||||
ISceneService,
|
ISceneService,
|
||||||
MapType,
|
|
||||||
Point,
|
Point,
|
||||||
SceneEventList,
|
SceneEventList,
|
||||||
TYPES,
|
TYPES,
|
||||||
} from '@antv/l7-core';
|
} from '@antv/l7-core';
|
||||||
import { AMapService, MapboxService } from '@antv/l7-maps';
|
|
||||||
import { ReglRendererService } from '@antv/l7-renderer';
|
import { ReglRendererService } from '@antv/l7-renderer';
|
||||||
import { Container } from 'inversify';
|
import { Container } from 'inversify';
|
||||||
|
import ILayerManager from './ILayerManager';
|
||||||
|
import IMapController from './IMapController';
|
||||||
import IPostProcessingPassPluggable from './IPostProcessingPassPluggable';
|
import IPostProcessingPassPluggable from './IPostProcessingPassPluggable';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,49 +37,39 @@ import IPostProcessingPassPluggable from './IPostProcessingPassPluggable';
|
||||||
* const scene = new Scene();
|
* const scene = new Scene();
|
||||||
* const pointLayer = new PointLayer();
|
* const pointLayer = new PointLayer();
|
||||||
* scene.addLayer(pointLayer);
|
* scene.addLayer(pointLayer);
|
||||||
* scene.render();
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class Scene implements IPostProcessingPassPluggable {
|
class Scene
|
||||||
// public map: AMap.Map | Map;
|
implements IPostProcessingPassPluggable, IMapController, ILayerManager {
|
||||||
private sceneService: ISceneService;
|
private sceneService: ISceneService;
|
||||||
private mapService: IMapService;
|
private mapService: IMapService<unknown>;
|
||||||
private controlService: IControlService;
|
private controlService: IControlService;
|
||||||
private layerService: ILayerService;
|
private layerService: ILayerService;
|
||||||
private iconService: IIconService;
|
private iconService: IIconService;
|
||||||
|
|
||||||
private container: Container;
|
private container: Container;
|
||||||
|
|
||||||
public constructor(config: IMapConfig & IRenderConfig) {
|
public constructor(config: ISceneConfig) {
|
||||||
const { type = MapType.amap } = config;
|
const { id, map } = config;
|
||||||
|
|
||||||
// 创建场景容器
|
// 创建场景容器
|
||||||
const sceneContainer = createSceneContainer();
|
const sceneContainer = createSceneContainer();
|
||||||
this.container = sceneContainer;
|
this.container = sceneContainer;
|
||||||
|
|
||||||
|
// 绑定地图服务
|
||||||
|
map.setContainer(sceneContainer, id);
|
||||||
|
|
||||||
// 绑定渲染引擎服务
|
// 绑定渲染引擎服务
|
||||||
sceneContainer
|
sceneContainer
|
||||||
.bind<IRendererService>(TYPES.IRendererService)
|
.bind<IRendererService>(TYPES.IRendererService)
|
||||||
.to(ReglRendererService)
|
.to(ReglRendererService)
|
||||||
.inSingletonScope();
|
.inSingletonScope();
|
||||||
|
|
||||||
// 根据用户传入参数绑定地图服务
|
|
||||||
let mapServiceImpl: new (...args: any[]) => IMapService;
|
|
||||||
if (type === MapType.mapbox) {
|
|
||||||
mapServiceImpl = MapboxService;
|
|
||||||
} else if (type === MapType.amap) {
|
|
||||||
mapServiceImpl = AMapService;
|
|
||||||
} else {
|
|
||||||
throw new Error('不支持的地图服务');
|
|
||||||
}
|
|
||||||
sceneContainer
|
|
||||||
.bind<IMapService>(TYPES.IMapService)
|
|
||||||
.to(mapServiceImpl)
|
|
||||||
.inSingletonScope();
|
|
||||||
|
|
||||||
// 依赖注入
|
// 依赖注入
|
||||||
this.sceneService = sceneContainer.get<ISceneService>(TYPES.ISceneService);
|
this.sceneService = sceneContainer.get<ISceneService>(TYPES.ISceneService);
|
||||||
this.mapService = sceneContainer.get<IMapService>(TYPES.IMapService);
|
this.mapService = sceneContainer.get<IMapService<unknown>>(
|
||||||
|
TYPES.IMapService,
|
||||||
|
);
|
||||||
this.iconService = sceneContainer.get<IIconService>(TYPES.IIconService);
|
this.iconService = sceneContainer.get<IIconService>(TYPES.IIconService);
|
||||||
this.controlService = sceneContainer.get<IControlService>(
|
this.controlService = sceneContainer.get<IControlService>(
|
||||||
TYPES.IControlService,
|
TYPES.IControlService,
|
||||||
|
@ -93,7 +82,7 @@ class Scene implements IPostProcessingPassPluggable {
|
||||||
this.addControl(new Logo());
|
this.addControl(new Logo());
|
||||||
}
|
}
|
||||||
|
|
||||||
public getMapService(): IMapService {
|
public getMapService(): IMapService<unknown> {
|
||||||
return this.mapService;
|
return this.mapService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +152,7 @@ class Scene implements IPostProcessingPassPluggable {
|
||||||
: this.sceneService.off(type, handle);
|
: this.sceneService.off(type, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// map method
|
// implements IMapController
|
||||||
|
|
||||||
public getZoom(): number {
|
public getZoom(): number {
|
||||||
return this.mapService.getZoom();
|
return this.mapService.getZoom();
|
||||||
|
@ -185,8 +174,6 @@ class Scene implements IPostProcessingPassPluggable {
|
||||||
return this.mapService.getBounds();
|
return this.mapService.getBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
// set Map status
|
|
||||||
|
|
||||||
public setRotation(rotation: number): void {
|
public setRotation(rotation: number): void {
|
||||||
this.mapService.setRotation(rotation);
|
this.mapService.setRotation(rotation);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { PolygonLayer, Scene } from '@antv/l7';
|
import { PolygonLayer, Scene } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
import * as dat from 'dat.gui';
|
import * as dat from 'dat.gui';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
|
@ -8,7 +9,7 @@ function convertRGB2Hex(rgb: number[]) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Mapbox extends React.Component {
|
export default class Polygon extends React.Component {
|
||||||
private gui: dat.GUI;
|
private gui: dat.GUI;
|
||||||
private $stats: Node;
|
private $stats: Node;
|
||||||
private scene: Scene;
|
private scene: Scene;
|
||||||
|
@ -29,11 +30,12 @@ export default class Mapbox extends React.Component {
|
||||||
);
|
);
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
type: 'mapbox',
|
map: new Mapbox({
|
||||||
style: 'mapbox://styles/mapbox/streets-v9',
|
style: 'mapbox://styles/mapbox/streets-v9',
|
||||||
center: [110.19382669582967, 50.258134],
|
center: [110.19382669582967, 50.258134],
|
||||||
pitch: 0,
|
pitch: 0,
|
||||||
zoom: 3,
|
zoom: 3,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
this.scene = scene;
|
this.scene = scene;
|
||||||
const layer = new PolygonLayer({
|
const layer = new PolygonLayer({
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { Marker, PolygonLayer, Scene } from '@antv/l7';
|
import { Marker, PolygonLayer, Scene } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
export default class MarkerComponent extends React.Component {
|
export default class MarkerComponent extends React.Component {
|
||||||
|
@ -16,11 +17,12 @@ export default class MarkerComponent extends React.Component {
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
type: 'mapbox',
|
map: new Mapbox({
|
||||||
style: 'mapbox://styles/mapbox/streets-v9',
|
style: 'mapbox://styles/mapbox/streets-v9',
|
||||||
center: [110.19382669582967, 30.258134],
|
center: [110.19382669582967, 30.258134],
|
||||||
pitch: 0,
|
pitch: 0,
|
||||||
zoom: 3,
|
zoom: 3,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
this.scene = scene;
|
this.scene = scene;
|
||||||
const layer = new PolygonLayer({});
|
const layer = new PolygonLayer({});
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { PolygonLayer, Popup, Scene } from '@antv/l7';
|
import { PolygonLayer, Popup, Scene } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
export default class PopupComponent extends React.Component {
|
export default class PopupComponent extends React.Component {
|
||||||
|
@ -16,11 +17,12 @@ export default class PopupComponent extends React.Component {
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
type: 'mapbox',
|
map: new Mapbox({
|
||||||
style: 'mapbox://styles/mapbox/streets-v9',
|
style: 'mapbox://styles/mapbox/streets-v9',
|
||||||
center: [110.19382669582967, 30.258134],
|
center: [110.19382669582967, 30.258134],
|
||||||
pitch: 0,
|
pitch: 0,
|
||||||
zoom: 3,
|
zoom: 3,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
this.scene = scene;
|
this.scene = scene;
|
||||||
const layer = new PolygonLayer({});
|
const layer = new PolygonLayer({});
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { PolygonLayer, Scale, Scene } from '@antv/l7';
|
import { PolygonLayer, Scale, Scene } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
export default class ScaleComponent extends React.Component {
|
export default class ScaleComponent extends React.Component {
|
||||||
|
@ -16,11 +17,12 @@ export default class ScaleComponent extends React.Component {
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
type: 'mapbox',
|
map: new Mapbox({
|
||||||
style: 'mapbox://styles/mapbox/streets-v9',
|
style: 'mapbox://styles/mapbox/streets-v9',
|
||||||
center: [110.19382669582967, 30.258134],
|
center: [110.19382669582967, 30.258134],
|
||||||
pitch: 0,
|
pitch: 0,
|
||||||
zoom: 3,
|
zoom: 3,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
this.scene = scene;
|
this.scene = scene;
|
||||||
const layer = new PolygonLayer({});
|
const layer = new PolygonLayer({});
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { PolygonLayer, Scene, Zoom } from '@antv/l7';
|
import { PolygonLayer, Scene, Zoom } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
|
@ -17,11 +18,12 @@ export default class ZoomComponent extends React.Component {
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
type: 'mapbox',
|
map: new Mapbox({
|
||||||
style: 'mapbox://styles/mapbox/streets-v9',
|
style: 'mapbox://styles/mapbox/streets-v9',
|
||||||
center: [110.19382669582967, 30.258134],
|
center: [110.19382669582967, 30.258134],
|
||||||
pitch: 0,
|
pitch: 0,
|
||||||
zoom: 3,
|
zoom: 3,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
this.scene = scene;
|
this.scene = scene;
|
||||||
const layer = new PolygonLayer({});
|
const layer = new PolygonLayer({});
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { LineLayer, Scene } from '@antv/l7';
|
import { LineLayer, Scene } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
export default class Arc2DLineDemo extends React.Component {
|
export default class Arc2DLineDemo extends React.Component {
|
||||||
|
@ -14,12 +15,13 @@ export default class Arc2DLineDemo extends React.Component {
|
||||||
'https://gw.alipayobjects.com/os/rmsportal/UEXQMifxtkQlYfChpPwT.txt',
|
'https://gw.alipayobjects.com/os/rmsportal/UEXQMifxtkQlYfChpPwT.txt',
|
||||||
);
|
);
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
center: [116.2825, 39.9],
|
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new Mapbox({
|
||||||
type: 'mapbox',
|
center: [116.2825, 39.9],
|
||||||
style: 'mapbox://styles/mapbox/dark-v9',
|
pitch: 0,
|
||||||
zoom: 2,
|
style: 'mapbox://styles/mapbox/dark-v9',
|
||||||
|
zoom: 2,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
const lineLayer = new LineLayer({
|
const lineLayer = new LineLayer({
|
||||||
enablePicking: true,
|
enablePicking: true,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { LineLayer, Scene } from '@antv/l7';
|
import { LineLayer, Scene } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
export default class ArcLineDemo extends React.Component {
|
export default class ArcLineDemo extends React.Component {
|
||||||
|
@ -14,12 +15,13 @@ export default class ArcLineDemo extends React.Component {
|
||||||
'https://gw.alipayobjects.com/os/rmsportal/UEXQMifxtkQlYfChpPwT.txt',
|
'https://gw.alipayobjects.com/os/rmsportal/UEXQMifxtkQlYfChpPwT.txt',
|
||||||
);
|
);
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
center: [116.2825, 39.9],
|
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new Mapbox({
|
||||||
type: 'mapbox',
|
center: [116.2825, 39.9],
|
||||||
style: 'mapbox://styles/mapbox/dark-v9',
|
pitch: 0,
|
||||||
zoom: 2,
|
style: 'mapbox://styles/mapbox/dark-v9',
|
||||||
|
zoom: 2,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
const lineLayer = new LineLayer({
|
const lineLayer = new LineLayer({
|
||||||
enablePicking: true,
|
enablePicking: true,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { HeatmapLayer, Scene } from '@antv/l7';
|
import { HeatmapLayer, Scene } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
|
@ -15,12 +16,13 @@ export default class HeatMapLayerDemo extends React.Component {
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/d3564b06-670f-46ea-8edb-842f7010a7c6.json',
|
'https://gw.alipayobjects.com/os/basement_prod/d3564b06-670f-46ea-8edb-842f7010a7c6.json',
|
||||||
);
|
);
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
center: [121.268, 30.3628],
|
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new Mapbox({
|
||||||
type: 'mapbox',
|
center: [121.268, 30.3628],
|
||||||
style: 'mapbox://styles/mapbox/dark-v10',
|
pitch: 0,
|
||||||
zoom: 2,
|
style: 'mapbox://styles/mapbox/dark-v10',
|
||||||
|
zoom: 2,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
const layer = new HeatmapLayer({
|
const layer = new HeatmapLayer({
|
||||||
enableTAA: false,
|
enableTAA: false,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { HeatmapLayer, Scene } from '@antv/l7';
|
import { HeatmapLayer, Scene } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
export default class GridHeatMap extends React.Component {
|
export default class GridHeatMap extends React.Component {
|
||||||
|
@ -16,11 +17,12 @@ export default class GridHeatMap extends React.Component {
|
||||||
const data = await response.text();
|
const data = await response.text();
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
style: 'dark',
|
map: new AMap({
|
||||||
pitch: 0,
|
style: 'dark',
|
||||||
center: [110.097892, 33.853662],
|
pitch: 0,
|
||||||
zoom: 4.056,
|
center: [110.097892, 33.853662],
|
||||||
type: 'amap',
|
zoom: 4.056,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
const layer = new HeatmapLayer({
|
const layer = new HeatmapLayer({
|
||||||
enablePicking: true,
|
enablePicking: true,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { LineLayer, Scene } from '@antv/l7';
|
import { LineLayer, Scene } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
export default class LineDemo extends React.Component {
|
export default class LineDemo extends React.Component {
|
||||||
|
@ -14,12 +15,13 @@ export default class LineDemo extends React.Component {
|
||||||
'https://gw.alipayobjects.com/os/rmsportal/ZVfOvhVCzwBkISNsuKCc.json',
|
'https://gw.alipayobjects.com/os/rmsportal/ZVfOvhVCzwBkISNsuKCc.json',
|
||||||
);
|
);
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
center: [102.602992, 23.107329],
|
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new Mapbox({
|
||||||
type: 'mapbox',
|
center: [102.602992, 23.107329],
|
||||||
style: 'mapbox://styles/mapbox/dark-v9',
|
pitch: 0,
|
||||||
zoom: 13,
|
style: 'mapbox://styles/mapbox/dark-v9',
|
||||||
|
zoom: 13,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
const lineLayer = new LineLayer({
|
const lineLayer = new LineLayer({
|
||||||
enableMultiPassRenderer: true,
|
enableMultiPassRenderer: true,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { PointLayer, Scene } from '@antv/l7';
|
import { PointLayer, Scene } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import data from '../data/data.json';
|
import data from '../data/data.json';
|
||||||
|
@ -12,15 +13,15 @@ export default class Point3D extends React.Component {
|
||||||
|
|
||||||
public componentDidMount() {
|
public componentDidMount() {
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
center: [120.19382669582967, 30.258134],
|
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new Mapbox({
|
||||||
type: 'mapbox',
|
center: [120.19382669582967, 30.258134],
|
||||||
style: 'mapbox://styles/mapbox/streets-v9',
|
pitch: 0,
|
||||||
zoom: 1,
|
style: 'mapbox://styles/mapbox/streets-v9',
|
||||||
|
zoom: 1,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
const pointLayer = new PointLayer({
|
const pointLayer = new PointLayer({
|
||||||
enableMultiPassRenderer: true,
|
|
||||||
enablePicking: true,
|
enablePicking: true,
|
||||||
enableHighlight: true,
|
enableHighlight: true,
|
||||||
onHover: (pickedFeature: any) => {
|
onHover: (pickedFeature: any) => {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { PointLayer, Scene } from '@antv/l7';
|
import { PointLayer, Scene } from '@antv/l7';
|
||||||
|
import { Mapbox } from '@antv/l7-maps';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import data from '../data/data.json';
|
import data from '../data/data.json';
|
||||||
|
@ -12,12 +13,13 @@ export default class Point3D extends React.Component {
|
||||||
|
|
||||||
public componentDidMount() {
|
public componentDidMount() {
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
center: [120.19382669582967, 30.258134],
|
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new Mapbox({
|
||||||
type: 'mapbox',
|
center: [120.19382669582967, 30.258134],
|
||||||
style: 'mapbox://styles/mapbox/streets-v9',
|
pitch: 0,
|
||||||
zoom: 1,
|
style: 'mapbox://styles/mapbox/streets-v9',
|
||||||
|
zoom: 1,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
const pointLayer = new PointLayer({
|
const pointLayer = new PointLayer({
|
||||||
enablePicking: true,
|
enablePicking: true,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { PointLayer, Scene } from '@antv/l7';
|
import { PointLayer, Scene } from '@antv/l7';
|
||||||
|
import { AMap } from '@antv/l7-maps';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
export default class PointImage extends React.Component {
|
export default class PointImage extends React.Component {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
@ -13,12 +14,13 @@ export default class PointImage extends React.Component {
|
||||||
'https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9140d288ae.json',
|
'https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9140d288ae.json',
|
||||||
);
|
);
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
center: [121.4, 31.258134],
|
|
||||||
zoom: 15,
|
|
||||||
id: 'map',
|
id: 'map',
|
||||||
pitch: 0,
|
map: new AMap({
|
||||||
type: 'amap',
|
center: [121.4, 31.258134],
|
||||||
style: 'dark',
|
zoom: 15,
|
||||||
|
pitch: 0,
|
||||||
|
style: 'dark',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
scene.addImage(
|
scene.addImage(
|
||||||
'00',
|
'00',
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue