2020-08-10 10:44:28 +08:00
|
|
|
---
|
|
|
|
title: 3D填充图
|
|
|
|
order: 1
|
|
|
|
---
|
2021-12-29 17:08:46 +08:00
|
|
|
|
2020-11-21 03:51:18 +08:00
|
|
|
`markdown:docs/common/style.md`
|
2020-08-20 17:09:45 +08:00
|
|
|
|
2020-08-10 10:44:28 +08:00
|
|
|
## 使用
|
2020-08-20 17:09:45 +08:00
|
|
|
|
2020-08-10 10:44:28 +08:00
|
|
|
```javascript
|
2020-08-20 17:09:45 +08:00
|
|
|
import { PolygonLayer } from '@antv/l7';
|
2020-08-10 10:44:28 +08:00
|
|
|
const layer = new PolygonLayer();
|
|
|
|
```
|
2020-08-20 17:09:45 +08:00
|
|
|
|
2020-08-10 10:44:28 +08:00
|
|
|
### shape
|
2020-08-20 17:09:45 +08:00
|
|
|
|
|
|
|
3D Polygon 将多边形沿 Z 轴向上拉伸
|
|
|
|
|
2020-08-10 10:44:28 +08:00
|
|
|
- extrude 常量不支持数据映射
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
layer.shape('extrude');
|
|
|
|
```
|
|
|
|
|
|
|
|
### size
|
2020-08-20 17:09:45 +08:00
|
|
|
|
|
|
|
size 代表拉伸的高度,支持数据映射
|
2020-08-10 10:44:28 +08:00
|
|
|
|
|
|
|
```javascript
|
2020-08-20 17:09:45 +08:00
|
|
|
layer.size(10); // 高度设置成常量
|
|
|
|
layer.size('floor', [0, 2000]); // 根据floor字段进行数据映射默认为线
|
|
|
|
layer.size('floor', (floor) => {
|
|
|
|
// 通过回调函数设置size
|
|
|
|
return floor * 2;
|
|
|
|
});
|
2020-08-10 10:44:28 +08:00
|
|
|
```
|
2020-08-20 17:09:45 +08:00
|
|
|
|
2021-12-29 17:08:46 +08:00
|
|
|
## 额外的 style 配置
|
2021-12-06 23:05:20 +08:00
|
|
|
|
2021-12-29 17:08:46 +08:00
|
|
|
- pickLight 设置 3D 填充图
|
2021-12-06 23:05:20 +08:00
|
|
|
|
2021-12-29 17:08:46 +08:00
|
|
|
pickLight 默认为 false 表示对拾取的颜色不进行光照计算,开启后会增加部分额外的计算。
|
2021-12-06 23:05:20 +08:00
|
|
|
|
|
|
|
```javascript
|
|
|
|
style({
|
2021-12-29 17:08:46 +08:00
|
|
|
pickLight: true, // 默认为 false
|
|
|
|
});
|
|
|
|
```
|
2021-12-06 23:05:20 +08:00
|
|
|
|
2021-12-29 17:08:46 +08:00
|
|
|
[光照拾取](../../../../examples/react/covid#covid_extrude)
|
2021-12-06 23:05:20 +08:00
|
|
|
|
2020-11-16 15:19:41 +08:00
|
|
|
`markdown:docs/common/layer/base.md`
|