线图重构升级,统一标准化配置参数
- Dominant language
- TypeScript
- Stars
- 4.1k
- Forks
- 656
- PR merge metrics
- No merged PRs in 30d
Description
### AntV Open Source Contribution Plan(可选)
- [X] 我同意将这个 Issue 参与 OSCP 计划
### Issue 类型
专家任务
### 任务介绍
https://github.com/antvis/L7/blob/master/packages/layers/src/line/shaders/line_vert.glsl#L129
- 统一高度参数 u_heightfixed(pixeled,or meter 单位)、u_raisingHeight(baseheight) 等单位标准化,
```gsls
f(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
lineHeight *= 0.2; // 保持和 amap/mapbox 一致的效果
h *= 0.2;
if(u_heightfixed < 1.0) {
lineHeight = project_pixel(a_Size.y);
}
gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h + u_raisingHeight, 1.0));
} else {
// mapbox - amap
// 兼容 mapbox 在线高度上的效果表现基本一致
if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
// mapbox
// 保持高度相对不变
float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
h *= mapboxZoomScale;
h += u_raisingHeight * mapboxZoomScale;
if(u_heightfixed > 0.0) {
lineHeight *= mapboxZoomScale;
}
} else {
// amap
h += u_raisingHeight;
// lineHeight 顶点偏移高度
if(u_heightfixed < 1.0) {
lineHeight *= pow(2.0, 20.0 - u_Zoom);
}
}
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));
}
```
### 参考说明
任务要求:
- 熟悉 WebGL ,熟悉 shader 语言编写
- 了解线图层,顶点构造原理
- 了解地图单位换算关系
Contributor guide
Assessment
This issue has not been assessed yet.