docs: react scene

This commit is contained in:
thinkinggis 2020-03-08 15:19:21 +08:00
parent a6f004b65e
commit 56e535cac3
5 changed files with 67 additions and 74 deletions

View File

@ -4,37 +4,42 @@ order: 1
---
## Scene Props
| prop name | Type | Default | Description |
| ---- | ---- | ---- | ---- |
|option |`Object`||layer配置项|
|source|||数据源配置项|
|color |`attributeOption`||颜色通道|
|shape |`attributeOption`||图层形状属性|
|size |`attributeOption`||图层大小属性|
|style |`Object`||图层样式|
|scale |`Object`||图层度量|
|filter |`Function`||图层数据过滤方法|
|select |`boolean` `Object`||图层选中高亮|
|active | `boolean` `Object`|`false`|图层hover高亮|
|onLayerLoad|`Function`||图层添加完成后回调用于获取layer对象|
| ----------- | ------------------ | ------- | --------------------------------------- |
| option | `Object` | | layer 配置项 |
| source | | | 数据源配置项 |
| color | `attributeOption` | | 颜色通道 |
| shape | `attributeOption` | | 图层形状属性 |
| size | `attributeOption` | | 图层大小属性 |
| style | `Object` | | 图层样式 |
| scale | `Object` | | 图层度量 |
| filter | `Function` | | 图层数据过滤方法 |
| select | `boolean` `Object` | | 图层选中高亮 |
| active | `boolean` `Object` | `false` | 图层 hover 高亮 |
| onLayerLoad | `Function` | | 图层添加完成后回调,用于获取 layer 对象 |
### attributeOption
color, size, shape 等图形映射通道配置项
#### option
- field 映射字段,如果是常量设置为 null
- values 映射值 支持 常量数组回调函数如果values为数组或回调需要设置field字段
- values 映射值 支持 常量,数组,回调函数,如果 values 为数组或回调需要设置 field 字段
### sourceOption
数据源配置项
#### Option
- data 支持 geojson、csv、json
- parser 数据解析配置项
- transforms 数据处理配置项
```jsx
import {PolygonLayer } from '@antv/l7-react';
import { PolygonLayer } from '@antv/l7-react';
<PolygonLayer
key={'2'}
source={{
@ -42,14 +47,7 @@ import {PolygonLayer } from '@antv/l7-react';
}}
color={{
field: 'name',
values: [
'#2E8AE6',
'#69D1AB',
'#DAF291',
'#FFD591',
'#FF7A45',
'#CF1D49',
],
values: ['#2E8AE6', '#69D1AB', '#DAF291', '#FFD591', '#FF7A45', '#CF1D49'],
}}
shape={{
values: 'fill',
@ -57,5 +55,5 @@ import {PolygonLayer } from '@antv/l7-react';
style={{
opacity: 1,
}}
/>
/>;
```

View File

@ -2,10 +2,11 @@
title: 高德地图
order: 1
---
| prop name | Type | Default | Description |
| ---- | ---- | ---- | ---- | ---- |
| style | `Object` | `null` | scene css样式 |
| className | `string` |`null` | 样式名称 |
| map | `Object` |`Required` | 地图配置项 |
| ------------- | ---------- | ---------- | ------------------ |
| style | `Object` | `null` | scene css 样式 |
| className | `string` | `null` | 样式名称 |
| map | `Object` | `Required` | 地图配置项 |
| option | `Object` | `void` | scene 配置项 |
| onSceneLoaded | `Function` |`void` | scene加载回调函数 |
| onSceneLoaded | `Function` | `void` | scene 加载回调函数 |

View File

@ -2,62 +2,57 @@
title: 高德地图
order: 1
---
## Scene Props
| prop name | Type | Default | Description |
| ---- | ---- | ---- | ---- |
| style | `Object` | `null` | scene css样式 |
| className | `string` |`null` | 样式名称 |
| map | `Object` |`Required` | map option [地图配置项]() |
| ------------- | ---------- | ---------- | -------------------------------------- |
| style | `Object` | `null` | scene css 样式 |
| className | `string` | `null` | 样式名称 |
| map | `Object` | `Required` | map option [地图配置项]() |
| option | `Object` | `void` | scene option 配置项 [详情](#map-props) |
| onSceneLoaded | `Function` |`void` | scene加载回调函数 |
| onSceneLoaded | `Function` | `void` | scene 加载回调函数 |
```jsx
import { AMapScene } from '@antv/l7-react';
<AMapScene
option={{
}}
map={{
style:'light',
center:[112,20],
token:'',
}}
/>
option={{}}
map={{
style: 'light',
center: [112, 20],
token: '',
}}
/>;
```
### map option
地图配置项
| option | Type | Default | Description |
| ---- | ---- | ---- |----|
| style | `string` | `light` | 地图样式 `dark|light|normal|blank` L7默认提供四种样式同时也支持自定义样式 |
| token |`string`|`Required`|地图密钥,需要平台申请|
| plugin |`string[]`|`null`|高德地图[API插件](https://lbs.amap.com/api/javascript-api/guide/abc/plugins) `['AMap.ToolBar','AMap.Driving']`|
| center |`number`|null|地图中心点|
| pitch |`number`|0|地图倾角|
| rotation |`number`|0|地图旋转角|
| zoom |`number`|null|地图缩放等级|
| maxZoom |`number`|0|最大缩放等级|
| minZoom |`number`|AMap 18 ,Mapbox 20|最小缩放等级|
| -------- | ---------- | ------------------ | --------------------------------------------------------------------------------------------------------------- |
| style | `string` | `light` | 地图样式 `dark|light|normal|blank` L7 默认提供四种样式,同时也支持自定义样式 |
| token | `string` | `Required` | 地图密钥,需要平台申请 |
| plugin | `string[]` | `null` | 高德地图[API 插件](https://lbs.amap.com/api/javascript-api/guide/abc/plugins) `['AMap.ToolBar','AMap.Driving']` |
| center | `number` | null | 地图中心点 |
| pitch | `number` | 0 | 地图倾角 |
| rotation | `number` | 0 | 地图旋转角 |
| zoom | `number` | null | 地图缩放等级 |
| maxZoom | `number` | 0 | 最大缩放等级 |
| minZoom | `number` | AMap 18 ,Mapbox 20 | 最小缩放等级 |
其他配置项见地图文档
高德地图 Map [配置项](https://lbs.amap.com/api/javascript-api/reference/map)
Mapbox Map 地图配置项 [配置项](https://docs.mapbox.com/mapbox-gl-js/api/#map)
其他配置项和底图一致
### scene option
| option | Type | Default | Description |
| ---- | ---- | ---- | ---- |
| logoPosition | string | `bottomleft` | logo位置 `bottomright|topright|bottomleft|topleft` |
| logoVisible | `boolean` | `true` | 是否显示logo |
| --------------------- | --------- | ------------ | --------------------------------------------------- |
| logoPosition | string | `bottomleft` | logo 位置 `bottomright|topright|bottomleft|topleft` |
| logoVisible | `boolean` | `true` | 是否显示 logo |
| antialias | `boolean` | `true` | 是否开启抗锯齿 |
| preserveDrawingBuffer | `boolean` | `false` | 是否保留缓冲区数据 |

View File

@ -53,7 +53,6 @@ export default class Point3D extends React.Component {
scene.addLayer(pointLayer);
const hander = () => {
console.log('click');
};
scene.on('click', hander);
this.scene = scene;