2020-08-10 10:44:28 +08:00
|
|
|
|
---
|
|
|
|
|
title: LineLayer
|
2022-01-05 19:36:38 +08:00
|
|
|
|
order: 0
|
2020-08-10 10:44:28 +08:00
|
|
|
|
---
|
2021-12-29 17:08:46 +08:00
|
|
|
|
|
2021-05-27 19:53:22 +08:00
|
|
|
|
`markdown:docs/common/style.md`
|
2021-12-29 17:08:46 +08:00
|
|
|
|
|
2022-01-05 19:36:38 +08:00
|
|
|
|
## 简介
|
2022-01-05 19:38:51 +08:00
|
|
|
|
|
2022-01-06 15:55:07 +08:00
|
|
|
|
L7 支持各种类型的线图层,包括平面路径、平面弧线、平面虚线、平面动画、3D 弧线等等。用户通过切换 shape 的参数,以及配置对应 shape 的线图层支持的 style 样式,可以得到各种类型的线。
|
2022-01-06 15:53:20 +08:00
|
|
|
|
|
2022-01-06 15:55:07 +08:00
|
|
|
|
✨ 不同的 lineLayer 会支持不同的相关特性,具体的使用可以请查看详细的文档
|
2021-05-27 19:53:22 +08:00
|
|
|
|
|
2022-01-06 16:57:38 +08:00
|
|
|
|
<img width="60%" style="display: block;margin: 0 auto;" alt="案例" src='https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*MxnRTrzcawcAAAAAAAAAAAAAARQnAQ'>
|
|
|
|
|
|
2021-05-27 19:53:22 +08:00
|
|
|
|
### shape
|
|
|
|
|
|
2022-01-06 17:50:47 +08:00
|
|
|
|
线图层支持 5 种 shape
|
2021-05-27 19:53:22 +08:00
|
|
|
|
|
2022-01-06 19:34:40 +08:00
|
|
|
|
- line 绘制路径图,
|
|
|
|
|
- arc 绘制弧线 通过贝塞尔曲线算法技术弧线
|
2021-05-27 19:53:22 +08:00
|
|
|
|
- greatcircle 大圆航线,地图两个点的最近距离不是两个点连线,而是大圆航线
|
2022-01-06 19:34:40 +08:00
|
|
|
|
- arc3d 3d 弧线地图 3D 视角
|
|
|
|
|
- wall 基于线图层的一种特殊形式
|
2021-05-27 19:53:22 +08:00
|
|
|
|
|
|
|
|
|
⚠️ 弧线只需要设置起止点坐标即可
|
|
|
|
|
|
2021-11-25 16:09:37 +08:00
|
|
|
|
```javascript
|
2021-12-29 17:08:46 +08:00
|
|
|
|
new LineLayer().source(data, {
|
|
|
|
|
parser: {
|
|
|
|
|
type: 'csv',
|
|
|
|
|
x: 'lng1',
|
|
|
|
|
y: 'lat1',
|
|
|
|
|
x1: 'lng2',
|
|
|
|
|
y1: 'lat2',
|
|
|
|
|
},
|
|
|
|
|
});
|
2021-05-27 19:53:22 +08:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
如果 geojson 数据绘制弧线图 coordinates 第一对坐标为起点,第二对为终点
|
|
|
|
|
|
2021-11-25 16:09:37 +08:00
|
|
|
|
```javascript
|
2021-05-27 19:53:22 +08:00
|
|
|
|
{
|
|
|
|
|
"type": "FeatureCollection",
|
|
|
|
|
"features": [
|
|
|
|
|
{
|
|
|
|
|
"type": "Feature",
|
|
|
|
|
"properties": {},
|
|
|
|
|
"geometry": {
|
|
|
|
|
"type": "LineString",
|
|
|
|
|
"coordinates": [
|
|
|
|
|
[
|
|
|
|
|
106.5234375,
|
|
|
|
|
57.51582286553883
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
136.40625,
|
|
|
|
|
61.77312286453146
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### size
|
|
|
|
|
|
2022-01-06 15:53:20 +08:00
|
|
|
|
线图层 不仅可以设置宽度,还可以设置线的高度
|
2021-05-27 19:53:22 +08:00
|
|
|
|
|
|
|
|
|
- size 类型为 number 则表示 line 的宽度
|
|
|
|
|
- size 类型为 [number , number] 分别表示宽度和高度
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
lineLayer.size(1); // 线的宽度为 1
|
|
|
|
|
lineLayer.size([1, 2]); // 宽度为1,高度2
|
|
|
|
|
```
|
2021-07-02 11:07:09 +08:00
|
|
|
|
|
2022-01-06 15:53:20 +08:00
|
|
|
|
### texture
|
2022-01-06 15:55:07 +08:00
|
|
|
|
|
2022-01-06 15:53:20 +08:00
|
|
|
|
线图层支持了纹理贴图的能力,不同 shape 的图层对 texturte 的支持情况会存在细微的差别,详细使用请查看相关图层的文档
|
2021-12-29 17:08:46 +08:00
|
|
|
|
|
2022-01-06 15:53:20 +08:00
|
|
|
|
`markdown:docs/api/line_layer/features/linear.zh.md`
|
2021-11-25 16:09:37 +08:00
|
|
|
|
|
2022-01-06 15:53:20 +08:00
|
|
|
|
`markdown:docs/api/line_layer/features/animate.zh.md`
|
2021-11-25 16:09:37 +08:00
|
|
|
|
|
2022-01-06 16:29:28 +08:00
|
|
|
|
`markdown:docs/api/line_layer/features/texture.zh.md`
|
|
|
|
|
|
2022-01-17 20:39:01 +08:00
|
|
|
|
`markdown:docs/api/line_layer/features/vertexHeight.zh.md`
|
2021-11-25 16:09:37 +08:00
|
|
|
|
|
2021-05-27 19:53:22 +08:00
|
|
|
|
`markdown:docs/common/layer/base.md`
|