@antv/l7-layers 2.16.0 → 2.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/es/core/BaseLayer.d.ts +3 -0
  2. package/es/core/BaseLayer.js +76 -80
  3. package/es/core/BaseModel.d.ts +9 -71
  4. package/es/core/BaseModel.js +75 -357
  5. package/es/core/CommonStyleAttribute.d.ts +2 -0
  6. package/es/core/CommonStyleAttribute.js +66 -0
  7. package/es/core/interface.d.ts +13 -3
  8. package/es/core/shape/extrude.js +18 -6
  9. package/es/core/triangulation.d.ts +12 -0
  10. package/es/core/triangulation.js +70 -0
  11. package/es/heatmap/models/grid.js +1 -1
  12. package/es/heatmap/models/grid3d.js +1 -1
  13. package/es/heatmap/models/heatmap.d.ts +1 -0
  14. package/es/heatmap/models/heatmap.js +17 -13
  15. package/es/heatmap/models/hexagon.js +1 -1
  16. package/es/heatmap/shaders/grid_vert.glsl +2 -2
  17. package/es/heatmap/shaders/hexagon_3d_vert.glsl +2 -2
  18. package/es/heatmap/shaders/hexagon_vert.glsl +2 -2
  19. package/es/line/index.d.ts +1 -0
  20. package/es/line/index.js +3 -2
  21. package/es/line/models/arc.js +9 -45
  22. package/es/line/models/arc_3d.js +12 -45
  23. package/es/line/models/earthArc_3d.js +6 -40
  24. package/es/line/models/{half.d.ts → flow.d.ts} +1 -11
  25. package/es/line/models/flow.js +167 -0
  26. package/es/line/models/great_circle.js +4 -38
  27. package/es/line/models/index.d.ts +1 -1
  28. package/es/line/models/index.js +3 -3
  29. package/es/line/models/line.js +7 -41
  30. package/es/line/models/linearline.js +4 -38
  31. package/es/line/models/simpleLine.d.ts +0 -1
  32. package/es/line/models/simpleLine.js +4 -43
  33. package/es/line/shaders/dash/arc_dash_frag.glsl +3 -6
  34. package/es/line/shaders/dash/arc_dash_vert.glsl +6 -46
  35. package/es/line/shaders/dash/line_dash_frag.glsl +4 -7
  36. package/es/line/shaders/dash/line_dash_vert.glsl +3 -33
  37. package/es/line/shaders/flow/flow_line_frag.glsl +13 -0
  38. package/es/line/shaders/flow/flow_line_vert.glsl +83 -0
  39. package/es/line/shaders/line_arc_3d_frag.glsl +6 -6
  40. package/es/line/shaders/line_arc_3d_vert.glsl +4 -34
  41. package/es/line/shaders/line_arc_frag.glsl +7 -11
  42. package/es/line/shaders/line_arc_great_circle_frag.glsl +5 -6
  43. package/es/line/shaders/line_arc_great_circle_vert.glsl +4 -32
  44. package/es/line/shaders/line_arc_vert.glsl +9 -45
  45. package/es/line/shaders/line_frag.glsl +15 -17
  46. package/es/line/shaders/line_vert.glsl +3 -34
  47. package/es/line/shaders/linear/arc3d_linear_frag.glsl +5 -19
  48. package/es/line/shaders/linear/arc3d_linear_vert.glsl +9 -48
  49. package/es/line/shaders/linear/arc_linear_frag.glsl +2 -30
  50. package/es/line/shaders/linear/arc_linear_vert.glsl +9 -45
  51. package/es/line/shaders/linear/line_linear_frag.glsl +5 -6
  52. package/es/line/shaders/linearLine/line_linear_frag.glsl +2 -14
  53. package/es/line/shaders/linearLine/line_linear_vert.glsl +14 -32
  54. package/es/line/shaders/simple/simpleline_frag.glsl +1 -5
  55. package/es/line/shaders/simple/simpleline_linear_frag.glsl +2 -6
  56. package/es/line/shaders/simple/simpleline_vert.glsl +7 -33
  57. package/es/plugins/DataMappingPlugin.js +20 -34
  58. package/es/plugins/LayerModelPlugin.js +13 -1
  59. package/es/plugins/ShaderUniformPlugin.js +3 -3
  60. package/es/point/index.d.ts +1 -0
  61. package/es/point/index.js +1 -0
  62. package/es/point/models/earthExtrude.d.ts +0 -3
  63. package/es/point/models/earthExtrude.js +2 -40
  64. package/es/point/models/earthFill.d.ts +0 -1
  65. package/es/point/models/earthFill.js +9 -60
  66. package/es/point/models/extrude.d.ts +0 -3
  67. package/es/point/models/extrude.js +3 -42
  68. package/es/point/models/fill.d.ts +0 -1
  69. package/es/point/models/fill.js +15 -76
  70. package/es/point/models/fillmage.js +6 -43
  71. package/es/point/models/image.js +7 -41
  72. package/es/point/models/normal.js +2 -2
  73. package/es/point/models/radar.d.ts +0 -1
  74. package/es/point/models/radar.js +4 -13
  75. package/es/point/models/simplePoint.d.ts +0 -1
  76. package/es/point/models/simplePoint.js +8 -49
  77. package/es/point/models/text.js +17 -47
  78. package/es/point/shaders/animate/wave_frag.glsl +1 -11
  79. package/es/point/shaders/earth/extrude_frag.glsl +5 -17
  80. package/es/point/shaders/earth/extrude_vert.glsl +14 -29
  81. package/es/point/shaders/earth/fill_frag.glsl +5 -14
  82. package/es/point/shaders/earth/fill_vert.glsl +1 -75
  83. package/es/point/shaders/extrude/extrude_frag.glsl +3 -29
  84. package/es/point/shaders/extrude/extrude_vert.glsl +27 -35
  85. package/es/point/shaders/fill_frag.glsl +9 -20
  86. package/es/point/shaders/fill_vert.glsl +16 -101
  87. package/es/point/shaders/image/fillImage_frag.glsl +2 -5
  88. package/es/point/shaders/image/fillImage_vert.glsl +4 -47
  89. package/es/point/shaders/image_frag.glsl +1 -5
  90. package/es/point/shaders/image_vert.glsl +1 -44
  91. package/es/point/shaders/normal_frag.glsl +0 -2
  92. package/es/point/shaders/normal_vert.glsl +2 -1
  93. package/es/point/shaders/radar/radar_vert.glsl +2 -2
  94. package/es/point/shaders/simplePoint_frag.glsl +0 -7
  95. package/es/point/shaders/simplePoint_vert.glsl +3 -45
  96. package/es/point/shaders/text_frag.glsl +6 -19
  97. package/es/point/shaders/text_vert.glsl +5 -66
  98. package/es/polygon/index.d.ts +1 -0
  99. package/es/polygon/index.js +1 -0
  100. package/es/polygon/models/extrude.d.ts +0 -3
  101. package/es/polygon/models/extrude.js +86 -82
  102. package/es/polygon/models/fill.d.ts +0 -4
  103. package/es/polygon/models/fill.js +8 -47
  104. package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -23
  105. package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +7 -5
  106. package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +7 -32
  107. package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +33 -38
  108. package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +12 -9
  109. package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +16 -44
  110. package/es/polygon/shaders/polygon_frag.glsl +0 -5
  111. package/es/polygon/shaders/polygon_linear_frag.glsl +0 -8
  112. package/es/polygon/shaders/polygon_linear_vert.glsl +0 -32
  113. package/es/polygon/shaders/polygon_vert.glsl +1 -27
  114. package/es/utils/layerData.js +2 -2
  115. package/lib/core/BaseLayer.js +74 -78
  116. package/lib/core/BaseModel.js +74 -356
  117. package/lib/core/CommonStyleAttribute.js +72 -0
  118. package/lib/core/shape/extrude.js +18 -6
  119. package/lib/core/triangulation.js +72 -0
  120. package/lib/heatmap/models/grid.js +1 -1
  121. package/lib/heatmap/models/grid3d.js +1 -1
  122. package/lib/heatmap/models/heatmap.js +17 -13
  123. package/lib/heatmap/models/hexagon.js +1 -1
  124. package/lib/heatmap/shaders/grid_vert.glsl +2 -2
  125. package/lib/heatmap/shaders/hexagon_3d_vert.glsl +2 -2
  126. package/lib/heatmap/shaders/hexagon_vert.glsl +2 -2
  127. package/lib/line/index.js +3 -2
  128. package/lib/line/models/arc.js +9 -45
  129. package/lib/line/models/arc_3d.js +12 -45
  130. package/lib/line/models/earthArc_3d.js +6 -40
  131. package/lib/line/models/flow.js +174 -0
  132. package/lib/line/models/great_circle.js +4 -38
  133. package/lib/line/models/index.js +3 -3
  134. package/lib/line/models/line.js +7 -41
  135. package/lib/line/models/linearline.js +4 -38
  136. package/lib/line/models/simpleLine.js +4 -43
  137. package/lib/line/shaders/dash/arc_dash_frag.glsl +3 -6
  138. package/lib/line/shaders/dash/arc_dash_vert.glsl +6 -46
  139. package/lib/line/shaders/dash/line_dash_frag.glsl +4 -7
  140. package/lib/line/shaders/dash/line_dash_vert.glsl +3 -33
  141. package/lib/line/shaders/flow/flow_line_frag.glsl +13 -0
  142. package/lib/line/shaders/flow/flow_line_vert.glsl +83 -0
  143. package/lib/line/shaders/line_arc_3d_frag.glsl +6 -6
  144. package/lib/line/shaders/line_arc_3d_vert.glsl +4 -34
  145. package/lib/line/shaders/line_arc_frag.glsl +7 -11
  146. package/lib/line/shaders/line_arc_great_circle_frag.glsl +5 -6
  147. package/lib/line/shaders/line_arc_great_circle_vert.glsl +4 -32
  148. package/lib/line/shaders/line_arc_vert.glsl +9 -45
  149. package/lib/line/shaders/line_frag.glsl +15 -17
  150. package/lib/line/shaders/line_vert.glsl +3 -34
  151. package/lib/line/shaders/linear/arc3d_linear_frag.glsl +5 -19
  152. package/lib/line/shaders/linear/arc3d_linear_vert.glsl +9 -48
  153. package/lib/line/shaders/linear/arc_linear_frag.glsl +2 -30
  154. package/lib/line/shaders/linear/arc_linear_vert.glsl +9 -45
  155. package/lib/line/shaders/linear/line_linear_frag.glsl +5 -6
  156. package/lib/line/shaders/linearLine/line_linear_frag.glsl +2 -14
  157. package/lib/line/shaders/linearLine/line_linear_vert.glsl +14 -32
  158. package/lib/line/shaders/simple/simpleline_frag.glsl +1 -5
  159. package/lib/line/shaders/simple/simpleline_linear_frag.glsl +2 -6
  160. package/lib/line/shaders/simple/simpleline_vert.glsl +7 -33
  161. package/lib/plugins/DataMappingPlugin.js +20 -34
  162. package/lib/plugins/LayerModelPlugin.js +13 -1
  163. package/lib/plugins/ShaderUniformPlugin.js +3 -3
  164. package/lib/point/index.js +1 -0
  165. package/lib/point/models/earthExtrude.js +2 -40
  166. package/lib/point/models/earthFill.js +9 -60
  167. package/lib/point/models/extrude.js +3 -42
  168. package/lib/point/models/fill.js +15 -76
  169. package/lib/point/models/fillmage.js +6 -43
  170. package/lib/point/models/image.js +7 -41
  171. package/lib/point/models/normal.js +2 -2
  172. package/lib/point/models/radar.js +4 -13
  173. package/lib/point/models/simplePoint.js +8 -49
  174. package/lib/point/models/text.js +15 -45
  175. package/lib/point/shaders/animate/wave_frag.glsl +1 -11
  176. package/lib/point/shaders/earth/extrude_frag.glsl +5 -17
  177. package/lib/point/shaders/earth/extrude_vert.glsl +14 -29
  178. package/lib/point/shaders/earth/fill_frag.glsl +5 -14
  179. package/lib/point/shaders/earth/fill_vert.glsl +1 -75
  180. package/lib/point/shaders/extrude/extrude_frag.glsl +3 -29
  181. package/lib/point/shaders/extrude/extrude_vert.glsl +27 -35
  182. package/lib/point/shaders/fill_frag.glsl +9 -20
  183. package/lib/point/shaders/fill_vert.glsl +16 -101
  184. package/lib/point/shaders/image/fillImage_frag.glsl +2 -5
  185. package/lib/point/shaders/image/fillImage_vert.glsl +4 -47
  186. package/lib/point/shaders/image_frag.glsl +1 -5
  187. package/lib/point/shaders/image_vert.glsl +1 -44
  188. package/lib/point/shaders/normal_frag.glsl +0 -2
  189. package/lib/point/shaders/normal_vert.glsl +2 -1
  190. package/lib/point/shaders/radar/radar_vert.glsl +2 -2
  191. package/lib/point/shaders/simplePoint_frag.glsl +0 -7
  192. package/lib/point/shaders/simplePoint_vert.glsl +3 -45
  193. package/lib/point/shaders/text_frag.glsl +6 -19
  194. package/lib/point/shaders/text_vert.glsl +5 -66
  195. package/lib/polygon/index.js +1 -0
  196. package/lib/polygon/models/extrude.js +86 -82
  197. package/lib/polygon/models/fill.js +8 -47
  198. package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -23
  199. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +7 -5
  200. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +7 -32
  201. package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +33 -38
  202. package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +12 -9
  203. package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +16 -44
  204. package/lib/polygon/shaders/polygon_frag.glsl +0 -5
  205. package/lib/polygon/shaders/polygon_linear_frag.glsl +0 -8
  206. package/lib/polygon/shaders/polygon_linear_vert.glsl +0 -32
  207. package/lib/polygon/shaders/polygon_vert.glsl +1 -27
  208. package/lib/utils/layerData.js +2 -2
  209. package/package.json +7 -7
  210. package/es/line/models/half.js +0 -267
  211. package/es/line/shaders/half/line_half_frag.glsl +0 -53
  212. package/es/line/shaders/half/line_half_vert.glsl +0 -169
  213. package/es/utils/dataMappingStyle.d.ts +0 -31
  214. package/es/utils/dataMappingStyle.js +0 -137
  215. package/lib/line/models/half.js +0 -274
  216. package/lib/line/shaders/half/line_half_frag.glsl +0 -53
  217. package/lib/line/shaders/half/line_half_vert.glsl +0 -169
  218. package/lib/utils/dataMappingStyle.js +0 -140
@@ -37,11 +37,7 @@ uniform float u_arrowHeight: 3.0;
37
37
  uniform float u_arrowWidth: 2.0;
38
38
  uniform float u_tailWidth: 1.0;
39
39
 
40
- uniform float u_opacity: 1.0;
41
- varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
42
-
43
- #pragma include "styleMapping"
44
- #pragma include "styleMappingCalOpacity"
40
+ varying vec4 v_texture_data;
45
41
 
46
42
  vec2 calculateArrow(vec2 offset) {
47
43
  /*
@@ -87,31 +83,7 @@ vec2 calculateArrow(vec2 offset) {
87
83
 
88
84
  void main() {
89
85
  // cal style mapping - 数据纹理映射部分的计算
90
- styleMappingMat = mat4(
91
- 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
92
- 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
93
- 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
94
- 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV
95
- );
96
-
97
- float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
98
- float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
99
- float columnWidth = 1.0/columnCount; // 列宽
100
- float rowHeight = 1.0/rowCount; // 行高
101
- float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
102
- float id = a_vertexId; // 第n个顶点
103
- float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
104
- float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
105
86
 
106
- // cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
107
- // 按顺序从 cell 中取值、若没有则自动往下取值
108
- float textureOffset = 0.0; // 在 cell 中取值的偏移量
109
-
110
- vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
111
- styleMappingMat[0][0] = opacityAndOffset.r;
112
- textureOffset = opacityAndOffset.g;
113
- // cal style mapping - 数据纹理映射部分的计算
114
-
115
87
  float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
116
88
 
117
89
  v_iconMapUV = a_iconMapUV;
@@ -141,12 +113,9 @@ void main() {
141
113
  float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // 线横向偏移的距离(向两侧偏移的和)
142
114
  float linePixelSize = project_pixel(a_Size.x) * 2.0; // 定点位置偏移,按地图等级缩放后的距离 单侧 * 2
143
115
  float texV = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
144
-
116
+
117
+ v_texture_data = vec4(currentLinePointRatio, lineDistance, d_texPixelLen, texV);
145
118
  // 设置数据集的参数
146
- styleMappingMat[3][0] = currentLinePointRatio; // 当前点位距离占线总长的比例
147
- styleMappingMat[3][1] = lineDistance; // 当前顶点的距离
148
- styleMappingMat[3][2] = d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
149
- styleMappingMat[3][3] = texV; // 线图层贴图部分的 v 坐标值
150
119
 
151
120
  vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
152
121
 
@@ -1,34 +1,20 @@
1
1
 
2
2
  #define Animate 0.0
3
-
4
- uniform float u_opacity;
5
- uniform float u_blur : 0.9;
6
- varying float v_segmentIndex;
7
- uniform float segmentNumber;
8
-
9
3
  uniform float u_time;
10
4
  uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
5
+ varying vec4 v_Color;
11
6
 
12
- uniform float u_linearColor: 0;
13
- uniform vec4 u_sourceColor;
14
- uniform vec4 u_targetColor;
15
-
16
- varying mat4 styleMappingMat;
17
-
7
+ varying float v_distance_ratio;
18
8
  #pragma include "picking"
19
9
 
20
10
  void main() {
21
- float opacity = styleMappingMat[0][0];
22
- float animateSpeed = 0.0; // 运动速度
23
- float d_distance_ratio = styleMappingMat[3].g; // 当前点位距离占线总长的比例
24
-
25
- gl_FragColor = mix(u_sourceColor, u_targetColor, v_segmentIndex/segmentNumber);
26
11
 
27
- gl_FragColor.a *= opacity;
12
+ float animateSpeed = 0.0; // 运动速度
13
+ gl_FragColor = v_Color;
28
14
 
29
15
  if(u_animate.x == Animate) {
30
16
  animateSpeed = u_time / u_animate.y;
31
- float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);
17
+ float alpha =1.0 - fract( mod(1.0- v_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);
32
18
 
33
19
  alpha = (alpha + u_animate.w -1.0) / u_animate.w;
34
20
  // alpha = smoothstep(0., 1., alpha);
@@ -15,22 +15,19 @@ uniform mat4 u_ModelMatrix;
15
15
  uniform mat4 u_Mvp;
16
16
  uniform float segmentNumber;
17
17
  uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
18
+ uniform vec4 u_sourceColor;
19
+ uniform vec4 u_targetColor;
18
20
 
19
21
  uniform float u_line_type: 0.0;
20
22
  uniform vec4 u_dash_array: [10.0, 5., 0, 0];
21
23
  uniform float u_icon_step: 100;
22
24
  uniform float u_line_texture: 0.0;
23
- uniform float u_opacity: 1.0;
25
+ varying float v_distance_ratio;
24
26
 
25
27
  varying vec4 v_dash_array;
26
28
  varying vec4 v_color;
27
- varying float v_segmentIndex;
28
29
  varying vec2 v_iconMapUV;
29
- varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
30
-
31
-
32
- #pragma include "styleMapping"
33
- #pragma include "styleMappingCalOpacity"
30
+ varying vec4 v_Color;
34
31
 
35
32
  #pragma include "projection"
36
33
  #pragma include "project"
@@ -99,30 +96,6 @@ vec3 lglt2xyz(vec2 lnglat) {
99
96
 
100
97
  void main() {
101
98
  // cal style mapping - 数据纹理映射部分的计算
102
- styleMappingMat = mat4(
103
- 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
104
- 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
105
- 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
106
- 0.0, 0.0, 0.0, 0.0 // dataset 数据集
107
- );
108
-
109
- float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
110
- float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
111
- float columnWidth = 1.0/columnCount; // 列宽
112
- float rowHeight = 1.0/rowCount; // 行高
113
- float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
114
- float id = a_vertexId; // 第n个顶点
115
- float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
116
- float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
117
-
118
- // cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
119
- // 按顺序从 cell 中取值、若没有则自动往下取值
120
- float textureOffset = 0.0; // 在 cell 中取值的偏移量
121
-
122
- vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
123
- styleMappingMat[0][0] = opacityAndOffset.r;
124
- textureOffset = opacityAndOffset.g;
125
- // cal style mapping - 数据纹理映射部分的计算
126
99
 
127
100
  v_color = a_Color;
128
101
  vec2 source = project_position(vec4(a_Instance.rg, 0, 0)).xy;
@@ -146,32 +119,20 @@ void main() {
146
119
  v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / (total_Distance / segmentNumber * segmentIndex);
147
120
  }
148
121
  if(u_animate.x == Animate) {
149
- d_distance_ratio = segmentIndex / segmentNumber;
122
+ v_distance_ratio = segmentIndex / segmentNumber;
150
123
  }
151
- styleMappingMat[3].g = d_distance_ratio; // 当前点位距离占线总长的比例
124
+
152
125
 
153
126
  float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
154
127
  vec3 curr = getPos(source, target, segmentRatio);
155
128
  vec3 next = getPos(source, target, nextSegmentRatio);
156
129
  vec2 offset = getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y);
157
- // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);
158
-
159
130
 
160
- v_segmentIndex = a_Position.x;
161
- if(LineTexture == u_line_texture && u_line_type != LineTypeDash) { // 开启贴图模式
131
+ float animateSpeed = 0.0; // 运动速度
132
+ v_Color = mix(u_sourceColor, u_targetColor, a_Position.x/segmentNumber);
162
133
 
163
- float arcDistrance = length(source - target);
164
- float pixelLen = project_pixel_texture(u_icon_step);
165
- styleMappingMat[3].b = floor(arcDistrance/pixelLen); // 贴图在弧线上重复的数量
134
+ v_Color.a *= opacity;
166
135
 
167
- vec2 projectOffset = project_pixel(offset);
168
- float lineOffsetWidth = length(projectOffset + projectOffset * sign(a_Position.y)); // 线横向偏移的距离
169
- float linePixelSize = project_pixel(a_Size); // 定点位置偏移,按地图等级缩放后的距离
170
- styleMappingMat[3].a = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
171
-
172
- v_iconMapUV = a_iconMapUV;
173
- }
174
-
175
136
 
176
137
  // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + project_pixel(offset), curr.z, 1.0));
177
138
  if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
@@ -1,38 +1,10 @@
1
- #define Animate 0.0
2
- #define LineTexture 1.0
3
-
4
- uniform float u_opacity;
5
- uniform float u_textureBlend;
6
- uniform float u_blur : 0.9;
7
- uniform float u_line_type: 0.0;
8
- // varying vec2 v_normal;
9
- varying vec4 v_dash_array;
10
1
  varying vec4 v_color;
11
2
 
12
- uniform float u_time;
13
- uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
14
-
15
- uniform float u_line_texture;
16
- uniform sampler2D u_texture;
17
- uniform vec2 u_textSize;
18
-
19
- uniform float segmentNumber;
20
- varying vec2 v_iconMapUV;
21
-
22
- varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
23
-
24
- uniform float u_linearColor: 0;
25
- uniform vec4 u_sourceColor;
26
- uniform vec4 u_targetColor;
27
-
28
3
  #pragma include "picking"
29
4
 
30
5
  void main() {
31
- float opacity = styleMappingMat[0][0];
32
- float d_segmentIndex = styleMappingMat[3].r; // 当前顶点在弧线中所处的分段位置
6
+ // 当前顶点在弧线中所处的分段位置
33
7
 
34
- // 设置弧线的底色
35
- gl_FragColor = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);
36
- gl_FragColor.a *= opacity;
8
+ gl_FragColor = v_Color;
37
9
  gl_FragColor = filterColor(gl_FragColor);
38
10
  }
@@ -7,17 +7,16 @@ uniform mat4 u_ModelMatrix;
7
7
  uniform mat4 u_Mvp;
8
8
  uniform float segmentNumber;
9
9
  varying vec4 v_color;
10
+ varying float v_segmentIndex;
10
11
 
11
12
  uniform float u_lineDir: 1.0;
12
13
 
13
14
  uniform float u_thetaOffset: 0.314;
15
+ uniform vec4 u_sourceColor;
16
+ uniform vec4 u_targetColor;
17
+
14
18
 
15
- uniform float u_opacity: 1.0;
16
- varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
17
19
 
18
- #pragma include "styleMapping"
19
- #pragma include "styleMappingCalOpacity"
20
- #pragma include "styleMappingCalThetaOffset"
21
20
 
22
21
  #pragma include "projection"
23
22
  #pragma include "project"
@@ -73,37 +72,6 @@ vec2 getNormal(vec2 line_clipspace, float offset_direction) {
73
72
  void main() {
74
73
  v_color = a_Color;
75
74
 
76
- // cal style mapping - 数据纹理映射部分的计算
77
- styleMappingMat = mat4(
78
- 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
79
- 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
80
- 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
81
- 0.0, 0.0, 0.0, 0.0 // dataset 数据集
82
- );
83
-
84
- float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
85
- float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
86
- float columnWidth = 1.0/columnCount; // 列宽
87
- float rowHeight = 1.0/rowCount; // 行高
88
- float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
89
- float id = a_vertexId; // 第n个顶点
90
- float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
91
- float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
92
-
93
- // cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke -> thetaOffset...
94
- // 按顺序从 cell 中取值、若没有则自动往下取值
95
- float textureOffset = 0.0; // 在 cell 中取值的偏移量
96
-
97
- vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
98
- styleMappingMat[0][0] = opacityAndOffset.r;
99
- textureOffset = opacityAndOffset.g;
100
-
101
- vec2 thetaOffsetAndOffset = calThetaOffsetAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
102
- styleMappingMat[0][1] = thetaOffsetAndOffset.r;
103
- textureOffset = thetaOffsetAndOffset.g;
104
- // cal style mapping - 数据纹理映射部分的计算
105
-
106
-
107
75
  vec2 source = a_Instance.rg; // 起始点
108
76
  vec2 target = a_Instance.ba; // 终点
109
77
  float segmentIndex = a_Position.x;
@@ -112,12 +80,8 @@ void main() {
112
80
  float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));
113
81
  float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
114
82
  float d_distance_ratio;
115
-
116
- styleMappingMat[3].b = d_distance_ratio;
117
-
118
- // styleMappingMat[0][1] - arcThetaOffset
119
- vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, styleMappingMat[0][1]), 0.0, 1.0));
120
- vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, styleMappingMat[0][1]), 0.0, 1.0));
83
+ vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, u_thetaOffset, 0.0, 1.0));
84
+ vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, u_thetaOffset), 0.0, 1.0));
121
85
  // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);
122
86
  //unProjCustomCoord
123
87
 
@@ -125,11 +89,11 @@ void main() {
125
89
 
126
90
 
127
91
  float d_segmentIndex = a_Position.x + 1.0; // 当前顶点在弧线中所处的分段位置
128
- styleMappingMat[3].r = d_segmentIndex;
129
92
 
130
- // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));
93
+ v_Color = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);
94
+ v_Color.a *= u_opacity;
95
+
131
96
  if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
132
- // gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));
133
97
  gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));
134
98
  } else {
135
99
  gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));
@@ -1,19 +1,18 @@
1
1
  varying vec4 v_color;
2
+ varying vec4 v_texture_data;
2
3
  uniform float u_linearDir: 1.0;
3
4
  uniform float u_linearColor: 0;
4
5
  uniform vec4 u_sourceColor;
5
6
  uniform vec4 u_targetColor;
7
+ uniform float u_opacity: 1.0;
6
8
 
7
9
  #pragma include "picking"
8
10
 
9
11
 
10
- varying mat4 styleMappingMat;
11
-
12
12
  void main() {
13
- float opacity = styleMappingMat[0][0];
14
- float linearRadio = styleMappingMat[3][0]; // 当前点位距离占线总长的比例
13
+ float linearRadio = v_texture_data.r; // 当前点位距离占线总长的比例
15
14
  if(u_linearDir < 1.0) {
16
- linearRadio = styleMappingMat[3][3];
15
+ linearRadio = v_texture_data.a;
17
16
  }
18
17
 
19
18
  if(u_linearColor == 1.0) { // 使用渐变颜色
@@ -22,6 +21,6 @@ void main() {
22
21
  gl_FragColor = v_color;
23
22
  }
24
23
 
25
- gl_FragColor.a *= opacity; // 全局透明度
24
+ gl_FragColor.a *= u_opacity; // 全局透明度
26
25
  gl_FragColor = filterColor(gl_FragColor);
27
26
  }
@@ -1,20 +1,8 @@
1
- uniform float u_opacity : 1.0;
2
- uniform sampler2D u_texture;
3
- uniform float u_linearDir: 1.0;
4
1
 
2
+ varying vec4 v_Color;
5
3
  #pragma include "picking"
6
-
7
- varying mat4 styleMappingMat;
8
-
9
4
  void main() {
10
- float opacity = styleMappingMat[0][0];
11
- float linearRadio = styleMappingMat[3].r; // 当前点位距离占线总长的比例
12
- if(u_linearDir < 1.0) {
13
- linearRadio = styleMappingMat[3][3];
14
- }
15
-
16
- gl_FragColor = texture2D(u_texture, vec2(linearRadio, 0.5));
17
5
 
18
- gl_FragColor.a *= opacity; // 全局透明度
6
+ gl_FragColor = v_Color; // 全局透明度
19
7
  gl_FragColor = filterColor(gl_FragColor);
20
8
  }
@@ -14,43 +14,18 @@ uniform mat4 u_Mvp;
14
14
  uniform float u_heightfixed: 0.0;
15
15
  uniform float u_vertexScale: 1.0;
16
16
  uniform float u_raisingHeight: 0.0;
17
+ uniform float u_opacity : 1.0;
18
+ uniform sampler2D u_texture;
19
+ uniform float u_linearDir: 1.0;
20
+ varying vec4 v_Color;
17
21
 
18
- uniform float u_opacity: 1.0;
19
22
 
20
23
  #pragma include "projection"
21
24
  #pragma include "picking"
22
25
 
23
- varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
24
-
25
- #pragma include "styleMapping"
26
- #pragma include "styleMappingCalOpacity"
27
26
 
28
27
  void main() {
29
- // cal style mapping - 数据纹理映射部分的计算
30
- styleMappingMat = mat4(
31
- 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
32
- 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
33
- 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
34
- 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV
35
- );
36
-
37
- float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
38
- float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
39
- float columnWidth = 1.0/columnCount; // 列宽
40
- float rowHeight = 1.0/rowCount; // 行高
41
- float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
42
- float id = a_vertexId; // 第n个顶点
43
- float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
44
- float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
45
-
46
- // cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
47
- // 按顺序从 cell 中取值、若没有则自动往下取值
48
- float textureOffset = 0.0; // 在 cell 中取值的偏移量
49
28
 
50
- vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
51
- styleMappingMat[0][0] = opacityAndOffset.r;
52
- textureOffset = opacityAndOffset.g;
53
- // cal style mapping - 数据纹理映射部分的计算
54
29
 
55
30
  vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);
56
31
 
@@ -64,9 +39,16 @@ void main() {
64
39
  float linePixelSize = project_pixel(a_Size.x) * 2.0; // 定点位置偏移,按地图等级缩放后的距离 单侧 * 2
65
40
  float texV = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
66
41
 
67
- // 设置数据集的参数
68
- styleMappingMat[3][0] = currentLinePointRatio; // 当前点位距离占线总长的比例
69
- styleMappingMat[3][3] = texV; // 线图层贴图部分的 v 坐标值
42
+ float linearRadio =currentLinePointRatio; // 当前点位距离占线总长的比例
43
+ if(u_linearDir < 1.0) {
44
+ linearRadio = texV;
45
+ }
46
+
47
+ v_Color = texture2D(u_texture, vec2(linearRadio, 0.5));
48
+
49
+ v_Color.a *= u_opacity; // 全局透明度
50
+
51
+
70
52
 
71
53
  vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
72
54
 
@@ -1,10 +1,6 @@
1
1
 
2
2
  varying vec4 v_color;
3
- varying mat4 styleMappingMat;
4
3
  void main() {
5
- float opacity = styleMappingMat[0][0];
6
- float d_distance_ratio = styleMappingMat[3].r; // 当前点位距离占线总长的比例
7
-
8
4
  gl_FragColor = v_color;
9
- gl_FragColor.a *= opacity; // 全局透明度
5
+
10
6
  }
@@ -1,11 +1,7 @@
1
1
  uniform vec4 u_sourceColor;
2
2
  uniform vec4 u_targetColor;
3
-
4
- varying mat4 styleMappingMat;
3
+ uniform float opacity;
5
4
  void main() {
6
- float opacity = styleMappingMat[0][0];
7
-
8
- // styleMappingMat[3][0] 当前点位距离占线总长的比例
9
- gl_FragColor = mix(u_sourceColor, u_targetColor, styleMappingMat[3][0]);
5
+ gl_FragColor = mix(u_sourceColor, u_targetColor, v_distanceScale);
10
6
  gl_FragColor.a *= opacity; // 全局透明度
11
7
  }
@@ -10,47 +10,21 @@ uniform mat4 u_Mvp;
10
10
 
11
11
  uniform float u_opacity: 1.0;
12
12
  uniform float u_vertexScale: 1.0;
13
+ uniform vec4 u_sourceColor;
14
+ uniform vec4 u_targetColor;
13
15
 
14
- #pragma include "projection"
15
16
 
16
- varying vec4 v_color;
17
17
 
18
- varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
18
+ #pragma include "projection"
19
19
 
20
- #pragma include "styleMapping"
21
- #pragma include "styleMappingCalOpacity"
20
+ varying vec4 v_color;
21
+ varying float v_distanceScale;
22
22
 
23
23
  void main() {
24
- // cal style mapping - 数据纹理映射部分的计算
25
- styleMappingMat = mat4(
26
- 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
27
- 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
28
- 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
29
- 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV
30
- );
31
24
 
32
- float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
33
- float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
34
- float columnWidth = 1.0/columnCount; // 列宽
35
- float rowHeight = 1.0/rowCount; // 行高
36
- float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
37
- float id = a_vertexId; // 第n个顶点
38
- float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
39
- float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
40
-
41
- // cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
42
- // 按顺序从 cell 中取值、若没有则自动往下取值
43
- float textureOffset = 0.0; // 在 cell 中取值的偏移量
44
-
45
- vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
46
- styleMappingMat[0][0] = opacityAndOffset.r;
47
- textureOffset = opacityAndOffset.g;
48
- // cal style mapping - 数据纹理映射部分的计算
49
-
50
-
51
25
  v_color = a_Color;
52
- styleMappingMat[3][0] = a_Distance / a_Total_Distance;
53
-
26
+ v_distanceScale = a_Distance / a_Total_Distance;
27
+ v_color = vec4(a_Color.xyz, a_Color.w * u_opacity);
54
28
  vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
55
29
 
56
30
  float h = float(a_Position.z) * u_vertexScale; // 线顶点的高度 - 兼容不存在第三个数值的情况
@@ -98,7 +98,9 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IMapService),
98
98
  }
99
99
  if (attributesToRemapping.length) {
100
100
  // 过滤数据
101
- var encodeData = _this.mapping(layer, attributesToRemapping, filterData, layer.getEncodedData());
101
+ var encodeData = _this.mapping(layer, attributesToRemapping, filterData, layer.getEncodedData() // TODO 优化
102
+ );
103
+
102
104
  layer.setEncodedData(encodeData);
103
105
  }
104
106
 
@@ -125,7 +127,7 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IMapService),
125
127
  // 数据处理 在数据进行 mapping 生成 encodeData 之前对数据进行处理
126
128
  // 在各个 layer 中继承
127
129
 
128
- filterData = layer.processData(filterData);
130
+ filterData = layer.processData(filterData); // 目前只有简单线需要处理
129
131
  var encodeData = this.mapping(layer, attributes, filterData, undefined);
130
132
  layer.setEncodedData(encodeData);
131
133
  if (dataArray.length === 0 && layer.encodeDataLength === 0) {
@@ -157,8 +159,8 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IMapService),
157
159
  }, preRecord);
158
160
  usedAttributes.forEach(function (attribute) {
159
161
  var values = _this3.applyAttributeMapping(attribute, record);
160
- // TODO: 支持每个属性配置 postprocess
161
- if (attribute.name === 'color') {
162
+ // TODO: 支持每个属性配置 postprocess}
163
+ if (attribute.name === 'color' || attribute.name === 'stroke') {
162
164
  values = values.map(function (c) {
163
165
  return rgb2arr(c);
164
166
  });
@@ -171,7 +173,7 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IMapService),
171
173
  encodeRecord.shape = _this3.fontService.getIconFontKey(encodeRecord[attribute.name]);
172
174
  }
173
175
  });
174
- if (arrow.enable && (encodeRecord.shape === 'line' || encodeRecord.shape === 'halfLine')) {
176
+ if (arrow.enable && encodeRecord.shape === 'line') {
175
177
  // 只有在线图层且支持配置箭头的时候进行插入顶点的处理
176
178
  var coords = encodeRecord.coordinates;
177
179
  // @ts-ignore
@@ -202,36 +204,20 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IMapService),
202
204
  // 根据地图的类型判断是否需要对点位数据进行处理, 若是高德2.0则需要对坐标进行相对偏移
203
205
  if (mappedData.length > 0 && this.mapService.version === Version['GAODE2.x']) {
204
206
  var layerCenter = layer.coordCenter || layer.getSource().center;
205
- if (typeof mappedData[0].coordinates[0] === 'number') {
206
- // 单个的点数据
207
+ // 单个的点数据
208
+ // @ts-ignore
209
+ mappedData
210
+ // TODO: 避免经纬度被重复计算导致坐标位置偏移
211
+ .filter(function (d) {
212
+ return !d.originCoordinates;
213
+ }).map(function (d) {
214
+ d.version = Version['GAODE2.x'];
207
215
  // @ts-ignore
208
- mappedData
209
- // TODO: 避免经纬度被重复计算导致坐标位置偏移
210
- .filter(function (d) {
211
- return !d.originCoordinates;
212
- }).map(function (d) {
213
- d.version = Version['GAODE2.x'];
214
- // @ts-ignore
215
- d.originCoordinates = cloneDeep(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
216
- // @ts-ignore
217
- // d.coordinates = this.mapService.lngLatToCoord(d.coordinates);
218
- d.coordinates = _this4.mapService.lngLatToCoordByLayer(d.coordinates, layerCenter);
219
- });
220
- } else {
221
- // 连续的线、面数据
222
- mappedData
223
- // TODO: 避免经纬度被重复计算导致坐标位置偏移
224
- .filter(function (d) {
225
- return !d.originCoordinates;
226
- }).map(function (d) {
227
- d.version = Version['GAODE2.x'];
228
- // @ts-ignore
229
- d.originCoordinates = cloneDeep(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
230
- // @ts-ignore
231
- // d.coordinates = this.mapService.lngLatToCoords(d.coordinates);
232
- d.coordinates = _this4.mapService.lngLatToCoordsByLayer(d.coordinates, layerCenter);
233
- });
234
- }
216
+ d.originCoordinates = cloneDeep(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
217
+ // @ts-ignore
218
+ // d.coordinates = this.mapService.lngLatToCoord(d.coordinates);
219
+ d.coordinates = _this4.mapService.coordToAMap2RelativeCoordinates(d.coordinates, layerCenter);
220
+ });
235
221
  }
236
222
  }
237
223
  }, {
@@ -21,7 +21,7 @@ var LayerModelPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
21
21
  return _regeneratorRuntime.wrap(function _callee$(_context) {
22
22
  while (1) switch (_context.prev = _context.next) {
23
23
  case 0:
24
- // 更新Model 配置项
24
+ // 更新Model 配置项 style options
25
25
  layer.prepareBuildModel();
26
26
  // 初始化 Model
27
27
  _context.next = 3;
@@ -69,6 +69,8 @@ var LayerModelPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
69
69
  _context3.next = 2;
70
70
  return this.build(layer);
71
71
  case 2:
72
+ layer.styleNeedUpdate = false;
73
+ case 3:
72
74
  case "end":
73
75
  return _context3.stop();
74
76
  }
@@ -140,6 +142,16 @@ var LayerModelPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
140
142
  return _ref2.apply(this, arguments);
141
143
  };
142
144
  }());
145
+ layer.hooks.beforeRender.tap('LayerModelPlugin', function () {
146
+ // 判断数据映射是否需要更新
147
+ if (layer.styleNeedUpdate) {
148
+ _this.prepareLayerModel(layer).then(function () {
149
+ layer.styleNeedUpdate = false;
150
+ layer.renderLayers();
151
+ });
152
+ }
153
+ layer.styleNeedUpdate = false;
154
+ });
143
155
  }
144
156
  }]);
145
157
  return LayerModelPlugin;