@antv/l7-layers 2.17.4 → 2.17.5

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 (250) hide show
  1. package/es/Geometry/index.js +9 -31
  2. package/es/Geometry/models/billboard.js +51 -89
  3. package/es/Geometry/models/plane.js +81 -143
  4. package/es/Geometry/models/sprite.js +60 -118
  5. package/es/canvas/index.js +10 -33
  6. package/es/canvas/models/canvas.js +41 -97
  7. package/es/citybuliding/building.js +8 -27
  8. package/es/citybuliding/models/build.js +57 -82
  9. package/es/core/BaseLayer.js +325 -483
  10. package/es/core/BaseModel.js +51 -80
  11. package/es/core/CommonStyleAttribute.js +2 -5
  12. package/es/core/LayerPickService.js +21 -32
  13. package/es/core/TextureService.js +0 -13
  14. package/es/core/interface.js +17 -24
  15. package/es/core/shape/Path.js +13 -20
  16. package/es/core/shape/extrude.js +27 -39
  17. package/es/core/triangulation.js +99 -136
  18. package/es/earth/index.js +9 -33
  19. package/es/earth/models/atmosphere.js +30 -54
  20. package/es/earth/models/base.js +47 -85
  21. package/es/earth/models/bloomsphere.js +30 -54
  22. package/es/earth/utils.js +9 -13
  23. package/es/heatmap/index.js +10 -40
  24. package/es/heatmap/models/grid.js +28 -52
  25. package/es/heatmap/models/grid3d.js +28 -52
  26. package/es/heatmap/models/heatmap.js +92 -149
  27. package/es/heatmap/models/hexagon.js +28 -52
  28. package/es/heatmap/triangulation.js +0 -4
  29. package/es/image/index.js +9 -28
  30. package/es/image/models/image.js +66 -100
  31. package/es/index.js +9 -17
  32. package/es/line/index.js +9 -35
  33. package/es/line/models/arc.js +63 -112
  34. package/es/line/models/arc_3d.js +58 -102
  35. package/es/line/models/earthArc_3d.js +60 -105
  36. package/es/line/models/flow.js +36 -60
  37. package/es/line/models/great_circle.js +53 -94
  38. package/es/line/models/line.js +92 -144
  39. package/es/line/models/linearline.js +42 -74
  40. package/es/line/models/simpleLine.js +38 -67
  41. package/es/line/models/wall.js +52 -92
  42. package/es/line/shaders/dash/line_dash_vert.glsl +1 -2
  43. package/es/line/shaders/line_frag.glsl +1 -3
  44. package/es/line/shaders/line_vert.glsl +2 -0
  45. package/es/line/shaders/linear/line_linear_frag.glsl +1 -1
  46. package/es/mask/index.js +9 -28
  47. package/es/mask/models/fill.js +29 -54
  48. package/es/plugins/DataMappingPlugin.js +78 -114
  49. package/es/plugins/DataSourcePlugin.js +45 -68
  50. package/es/plugins/FeatureScalePlugin.js +67 -122
  51. package/es/plugins/LayerAnimateStylePlugin.js +0 -5
  52. package/es/plugins/LayerMaskPlugin.js +3 -11
  53. package/es/plugins/LayerModelPlugin.js +69 -118
  54. package/es/plugins/LayerStylePlugin.js +4 -9
  55. package/es/plugins/LightingPlugin.js +12 -18
  56. package/es/plugins/MultiPassRendererPlugin.js +11 -16
  57. package/es/plugins/PixelPickingPlugin.js +12 -21
  58. package/es/plugins/RegisterStyleAttributePlugin.js +5 -12
  59. package/es/plugins/ShaderUniformPlugin.js +13 -27
  60. package/es/plugins/UpdateModelPlugin.js +0 -5
  61. package/es/plugins/UpdateStyleAttributePlugin.js +5 -11
  62. package/es/point/index.js +26 -78
  63. package/es/point/models/earthExtrude.js +58 -95
  64. package/es/point/models/earthFill.js +52 -80
  65. package/es/point/models/extrude.js +57 -94
  66. package/es/point/models/fill.js +56 -81
  67. package/es/point/models/fillmage.js +60 -100
  68. package/es/point/models/image.js +47 -83
  69. package/es/point/models/index.js +2 -2
  70. package/es/point/models/normal.js +30 -54
  71. package/es/point/models/radar.js +38 -63
  72. package/es/point/models/simplePoint.js +38 -62
  73. package/es/point/models/text.js +199 -296
  74. package/es/point/shape/extrude.js +4 -13
  75. package/es/polygon/index.js +11 -41
  76. package/es/polygon/models/extrude.js +87 -135
  77. package/es/polygon/models/fill.js +50 -79
  78. package/es/polygon/models/index.js +3 -2
  79. package/es/polygon/models/ocean.js +42 -76
  80. package/es/polygon/models/water.js +37 -71
  81. package/es/raster/buffers/triangulation.js +2 -4
  82. package/es/raster/index.js +9 -32
  83. package/es/raster/models/raster.js +80 -116
  84. package/es/raster/models/rasterRgb.js +84 -127
  85. package/es/raster/models/rasterTerrainRgb.js +56 -84
  86. package/es/tile/interaction/getRasterData.js +14 -20
  87. package/es/tile/interaction/utils.js +7 -9
  88. package/es/tile/manager/base.js +63 -96
  89. package/es/tile/service/TileLayerService.js +33 -55
  90. package/es/tile/service/TilePickService.js +26 -40
  91. package/es/tile/service/TileSourceService.js +3 -7
  92. package/es/tile/tileFactory/DebugTile.js +29 -46
  93. package/es/tile/tileFactory/ImageTile.js +20 -38
  94. package/es/tile/tileFactory/MaskTile.js +22 -43
  95. package/es/tile/tileFactory/RasterRGBTile.js +22 -42
  96. package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
  97. package/es/tile/tileFactory/RasterTile.js +30 -53
  98. package/es/tile/tileFactory/Tile.js +63 -97
  99. package/es/tile/tileFactory/VectorTile.js +41 -68
  100. package/es/tile/tileFactory/index.js +0 -11
  101. package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
  102. package/es/tile/tileFactory/util.js +0 -3
  103. package/es/tile/tileLayer/BaseLayer.js +105 -146
  104. package/es/tile/utils.js +1 -1
  105. package/es/utils/blend.js +0 -2
  106. package/es/utils/collision-index.js +9 -16
  107. package/es/utils/extrude_polyline.js +101 -149
  108. package/es/utils/grid-index.js +2 -27
  109. package/es/utils/identityScale.js +0 -8
  110. package/es/utils/layerData.js +30 -44
  111. package/es/utils/multiPassRender.js +11 -13
  112. package/es/utils/polylineNormal.js +31 -37
  113. package/es/utils/simpleLine.js +2 -16
  114. package/es/utils/stencil.js +2 -3
  115. package/es/utils/symbol-layout.js +27 -53
  116. package/es/wind/index.js +9 -29
  117. package/es/wind/models/utils.js +26 -51
  118. package/es/wind/models/wind.js +101 -147
  119. package/es/wind/models/windRender.js +53 -66
  120. package/lib/Geometry/index.js +9 -38
  121. package/lib/Geometry/models/billboard.js +51 -97
  122. package/lib/Geometry/models/index.js +0 -5
  123. package/lib/Geometry/models/plane.js +79 -151
  124. package/lib/Geometry/models/sprite.js +60 -127
  125. package/lib/canvas/index.js +10 -40
  126. package/lib/canvas/models/canvas.js +41 -101
  127. package/lib/canvas/models/index.js +0 -3
  128. package/lib/citybuliding/building.js +8 -35
  129. package/lib/citybuliding/models/build.js +57 -92
  130. package/lib/core/BaseLayer.js +325 -474
  131. package/lib/core/BaseModel.js +51 -90
  132. package/lib/core/CommonStyleAttribute.js +2 -7
  133. package/lib/core/LayerPickService.js +21 -37
  134. package/lib/core/TextureService.js +0 -16
  135. package/lib/core/interface.js +21 -31
  136. package/lib/core/schema.js +0 -1
  137. package/lib/core/shape/Path.js +14 -31
  138. package/lib/core/shape/extrude.js +27 -62
  139. package/lib/core/triangulation.js +98 -177
  140. package/lib/earth/index.js +9 -43
  141. package/lib/earth/models/atmosphere.js +30 -63
  142. package/lib/earth/models/base.js +47 -90
  143. package/lib/earth/models/bloomsphere.js +30 -63
  144. package/lib/earth/utils.js +7 -31
  145. package/lib/heatmap/index.js +10 -48
  146. package/lib/heatmap/models/grid.js +28 -60
  147. package/lib/heatmap/models/grid3d.js +28 -60
  148. package/lib/heatmap/models/heatmap.js +92 -166
  149. package/lib/heatmap/models/hexagon.js +28 -60
  150. package/lib/heatmap/models/index.js +0 -6
  151. package/lib/heatmap/triangulation.js +0 -5
  152. package/lib/image/index.js +9 -36
  153. package/lib/image/models/image.js +66 -109
  154. package/lib/image/models/index.js +0 -3
  155. package/lib/index.js +7 -61
  156. package/lib/line/index.js +9 -40
  157. package/lib/line/models/arc.js +61 -122
  158. package/lib/line/models/arc_3d.js +56 -113
  159. package/lib/line/models/earthArc_3d.js +58 -115
  160. package/lib/line/models/flow.js +36 -70
  161. package/lib/line/models/great_circle.js +53 -104
  162. package/lib/line/models/index.js +0 -11
  163. package/lib/line/models/line.js +90 -152
  164. package/lib/line/models/linearline.js +42 -86
  165. package/lib/line/models/simpleLine.js +38 -77
  166. package/lib/line/models/wall.js +52 -103
  167. package/lib/line/shaders/dash/line_dash_vert.glsl +1 -2
  168. package/lib/line/shaders/line_frag.glsl +1 -3
  169. package/lib/line/shaders/line_vert.glsl +2 -0
  170. package/lib/line/shaders/linear/line_linear_frag.glsl +1 -1
  171. package/lib/mask/index.js +9 -36
  172. package/lib/mask/models/fill.js +29 -63
  173. package/lib/mask/models/index.js +0 -3
  174. package/lib/plugins/DataMappingPlugin.js +78 -125
  175. package/lib/plugins/DataSourcePlugin.js +45 -76
  176. package/lib/plugins/FeatureScalePlugin.js +67 -138
  177. package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
  178. package/lib/plugins/LayerMaskPlugin.js +4 -17
  179. package/lib/plugins/LayerModelPlugin.js +70 -127
  180. package/lib/plugins/LayerStylePlugin.js +5 -14
  181. package/lib/plugins/LightingPlugin.js +12 -25
  182. package/lib/plugins/MultiPassRendererPlugin.js +11 -22
  183. package/lib/plugins/PixelPickingPlugin.js +12 -27
  184. package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
  185. package/lib/plugins/ShaderUniformPlugin.js +13 -34
  186. package/lib/plugins/UpdateModelPlugin.js +1 -10
  187. package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
  188. package/lib/point/index.js +26 -83
  189. package/lib/point/models/earthExtrude.js +58 -106
  190. package/lib/point/models/earthFill.js +52 -110
  191. package/lib/point/models/extrude.js +57 -103
  192. package/lib/point/models/fill.js +54 -90
  193. package/lib/point/models/fillmage.js +58 -107
  194. package/lib/point/models/image.js +47 -92
  195. package/lib/point/models/index.js +1 -12
  196. package/lib/point/models/normal.js +30 -64
  197. package/lib/point/models/radar.js +38 -72
  198. package/lib/point/models/simplePoint.js +38 -72
  199. package/lib/point/models/text.js +199 -305
  200. package/lib/point/shape/extrude.js +4 -20
  201. package/lib/polygon/index.js +11 -48
  202. package/lib/polygon/models/extrude.js +87 -146
  203. package/lib/polygon/models/fill.js +50 -89
  204. package/lib/polygon/models/index.js +2 -14
  205. package/lib/polygon/models/ocean.js +42 -88
  206. package/lib/polygon/models/water.js +37 -82
  207. package/lib/raster/buffers/triangulation.js +3 -7
  208. package/lib/raster/index.js +9 -40
  209. package/lib/raster/models/index.js +0 -5
  210. package/lib/raster/models/raster.js +80 -125
  211. package/lib/raster/models/rasterRgb.js +84 -139
  212. package/lib/raster/models/rasterTerrainRgb.js +56 -93
  213. package/lib/tile/interaction/getRasterData.js +14 -25
  214. package/lib/tile/interaction/utils.js +7 -19
  215. package/lib/tile/manager/base.js +63 -104
  216. package/lib/tile/service/TileLayerService.js +33 -60
  217. package/lib/tile/service/TilePickService.js +26 -48
  218. package/lib/tile/service/TileSourceService.js +2 -16
  219. package/lib/tile/style/utils.js +0 -3
  220. package/lib/tile/tileFactory/DebugTile.js +29 -54
  221. package/lib/tile/tileFactory/ImageTile.js +20 -46
  222. package/lib/tile/tileFactory/MaskTile.js +22 -51
  223. package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
  224. package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
  225. package/lib/tile/tileFactory/RasterTile.js +30 -63
  226. package/lib/tile/tileFactory/Tile.js +63 -102
  227. package/lib/tile/tileFactory/VectorTile.js +41 -76
  228. package/lib/tile/tileFactory/index.js +0 -25
  229. package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
  230. package/lib/tile/tileFactory/util.js +0 -9
  231. package/lib/tile/tileLayer/BaseLayer.js +105 -153
  232. package/lib/tile/utils.js +1 -5
  233. package/lib/utils/blend.js +0 -5
  234. package/lib/utils/collision-index.js +9 -25
  235. package/lib/utils/extrude_polyline.js +101 -181
  236. package/lib/utils/grid-index.js +2 -28
  237. package/lib/utils/identityScale.js +0 -9
  238. package/lib/utils/layerData.js +30 -49
  239. package/lib/utils/multiPassRender.js +11 -16
  240. package/lib/utils/polylineNormal.js +31 -66
  241. package/lib/utils/simpleLine.js +2 -21
  242. package/lib/utils/stencil.js +0 -4
  243. package/lib/utils/symbol-layout.js +27 -55
  244. package/lib/wind/index.js +9 -37
  245. package/lib/wind/models/index.js +0 -3
  246. package/lib/wind/models/utils.js +26 -62
  247. package/lib/wind/models/wind.js +101 -157
  248. package/lib/wind/models/windRender.js +53 -71
  249. package/lib/wind/models/windShader.js +0 -1
  250. package/package.json +7 -7
@@ -7,50 +7,35 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
7
7
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
9
  import _regeneratorRuntime from "@babel/runtime/regenerator";
10
-
11
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
-
13
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
-
15
12
  import { AttributeType, gl } from '@antv/l7-core';
16
13
  import { generateColorRamp } from '@antv/l7-utils';
17
14
  import { isNumber } from 'lodash';
18
15
  import BaseModel from "../../core/BaseModel";
19
16
  import { LinearDir } from "../../core/interface";
20
17
  import { LineTriangulation } from "../../core/triangulation";
21
-
22
18
  /* babel-plugin-inline-import '../shaders/linearLine/line_linear_frag.glsl' */
23
19
  var linear_line_frag = "\nvarying vec4 v_Color;\n#pragma include \"picking\"\nvoid main() {\n\n gl_FragColor = v_Color; // \u5168\u5C40\u900F\u660E\u5EA6\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
24
-
25
20
  /* babel-plugin-inline-import '../shaders/linearLine/line_linear_vert.glsl' */
26
21
  var linear_line_vert = "\nattribute float a_Miter;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\n// dash line\nattribute float a_Total_Distance;\nattribute vec2 a_DistanceAndIndex;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_heightfixed: 0.0;\nuniform float u_vertexScale: 1.0;\nuniform float u_raisingHeight: 0.0;\nuniform float u_opacity : 1.0;\nuniform sampler2D u_texture;\nuniform float u_linearDir: 1.0;\nvarying vec4 v_Color;\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n float lineDistance = a_DistanceAndIndex.x;\n float currentLinePointRatio = lineDistance / a_Total_Distance;\n \n\n float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\uFF08\u5411\u4E24\u4FA7\u504F\u79FB\u7684\u548C\uFF09\n float linePixelSize = project_pixel(a_Size.x) * 2.0; // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB \u5355\u4FA7 * 2\n float texV = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n float linearRadio =currentLinePointRatio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n if(u_linearDir < 1.0) {\n linearRadio = texV;\n }\n\n v_Color = texture2D(u_texture, vec2(linearRadio, 0.5));\n\n v_Color.a *= u_opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n\n\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5 vertex height\n float lineHeight = a_Size.y; // size \u7B2C\u4E8C\u4E2A\u53C2\u6570\u4EE3\u8868\u7684\u9AD8\u5EA6 [linewidth, lineheight]\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n lineHeight *= 0.2; // \u4FDD\u6301\u548C amap/mapbox \u4E00\u81F4\u7684\u6548\u679C\n h *= 0.2;\n if(u_heightfixed < 1.0) {\n lineHeight = project_pixel(a_Size.y);\n }\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h + u_raisingHeight, 1.0));\n } else {\n // mapbox - amap\n \n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // mapbox\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n h *= mapboxZoomScale;\n h += u_raisingHeight * mapboxZoomScale;\n if(u_heightfixed > 0.0) {\n lineHeight *= mapboxZoomScale;\n }\n \n } else {\n // amap\n h += u_raisingHeight;\n // lineHeight \u9876\u70B9\u504F\u79FB\u9AD8\u5EA6\n if(u_heightfixed < 1.0) {\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
27
-
28
22
  var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
29
23
  _inherits(LinearLineModel, _BaseModel);
30
-
31
24
  var _super = _createSuper(LinearLineModel);
32
-
33
25
  function LinearLineModel() {
34
26
  var _this;
35
-
36
27
  _classCallCheck(this, LinearLineModel);
37
-
38
28
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
39
29
  args[_key] = arguments[_key];
40
30
  }
41
-
42
31
  _this = _super.call.apply(_super, [this].concat(args));
43
-
44
32
  _defineProperty(_assertThisInitialized(_this), "updateTexture", function () {
45
33
  var createTexture2D = _this.rendererService.createTexture2D;
46
-
47
34
  if (_this.colorTexture) {
48
35
  _this.colorTexture.destroy();
49
36
  }
50
-
51
37
  var _ref = _this.layer.getLayerConfig(),
52
- rampColors = _ref.rampColors;
53
-
38
+ rampColors = _ref.rampColors;
54
39
  var imageData = generateColorRamp(rampColors);
55
40
  _this.colorTexture = createTexture2D({
56
41
  data: new Uint8Array(imageData.data),
@@ -63,35 +48,32 @@ var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
63
48
  flipY: false
64
49
  });
65
50
  });
66
-
67
51
  return _this;
68
52
  }
69
-
70
53
  _createClass(LinearLineModel, [{
71
54
  key: "getUninforms",
72
55
  value: function getUninforms() {
73
56
  var _ref2 = this.layer.getLayerConfig(),
74
- _ref2$opacity = _ref2.opacity,
75
- opacity = _ref2$opacity === void 0 ? 1 : _ref2$opacity,
76
- _ref2$vertexHeightSca = _ref2.vertexHeightScale,
77
- vertexHeightScale = _ref2$vertexHeightSca === void 0 ? 20.0 : _ref2$vertexHeightSca,
78
- _ref2$raisingHeight = _ref2.raisingHeight,
79
- raisingHeight = _ref2$raisingHeight === void 0 ? 0 : _ref2$raisingHeight,
80
- _ref2$heightfixed = _ref2.heightfixed,
81
- heightfixed = _ref2$heightfixed === void 0 ? false : _ref2$heightfixed,
82
- _ref2$linearDir = _ref2.linearDir,
83
- linearDir = _ref2$linearDir === void 0 ? LinearDir.VERTICAL : _ref2$linearDir;
84
-
57
+ _ref2$opacity = _ref2.opacity,
58
+ opacity = _ref2$opacity === void 0 ? 1 : _ref2$opacity,
59
+ _ref2$vertexHeightSca = _ref2.vertexHeightScale,
60
+ vertexHeightScale = _ref2$vertexHeightSca === void 0 ? 20.0 : _ref2$vertexHeightSca,
61
+ _ref2$raisingHeight = _ref2.raisingHeight,
62
+ raisingHeight = _ref2$raisingHeight === void 0 ? 0 : _ref2$raisingHeight,
63
+ _ref2$heightfixed = _ref2.heightfixed,
64
+ heightfixed = _ref2$heightfixed === void 0 ? false : _ref2$heightfixed,
65
+ _ref2$linearDir = _ref2.linearDir,
66
+ linearDir = _ref2$linearDir === void 0 ? LinearDir.VERTICAL : _ref2$linearDir;
85
67
  if (this.rendererService.getDirty()) {
86
68
  this.colorTexture.bind();
87
69
  }
88
-
89
70
  return {
90
71
  u_linearDir: linearDir === LinearDir.VERTICAL ? 1.0 : 0.0,
91
72
  u_opacity: isNumber(opacity) ? opacity : 1,
92
73
  // 纹理支持参数
93
74
  u_texture: this.colorTexture,
94
75
  // 贴图
76
+
95
77
  // 是否固定高度
96
78
  u_heightfixed: Number(heightfixed),
97
79
  // 顶点高度 scale
@@ -104,31 +86,25 @@ var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
104
86
  value: function () {
105
87
  var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
106
88
  return _regeneratorRuntime.wrap(function _callee$(_context) {
107
- while (1) {
108
- switch (_context.prev = _context.next) {
109
- case 0:
110
- this.updateTexture();
111
- return _context.abrupt("return", this.buildModels());
112
-
113
- case 2:
114
- case "end":
115
- return _context.stop();
116
- }
89
+ while (1) switch (_context.prev = _context.next) {
90
+ case 0:
91
+ this.updateTexture();
92
+ return _context.abrupt("return", this.buildModels());
93
+ case 2:
94
+ case "end":
95
+ return _context.stop();
117
96
  }
118
97
  }, _callee, this);
119
98
  }));
120
-
121
99
  function initModels() {
122
100
  return _initModels.apply(this, arguments);
123
101
  }
124
-
125
102
  return initModels;
126
103
  }()
127
104
  }, {
128
105
  key: "clearModels",
129
106
  value: function clearModels() {
130
107
  var _this$colorTexture;
131
-
132
108
  (_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0 ? void 0 : _this$colorTexture.destroy();
133
109
  }
134
110
  }, {
@@ -136,40 +112,33 @@ var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
136
112
  value: function () {
137
113
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
138
114
  var _ref3, _ref3$depth, depth, model;
139
-
140
115
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
141
- while (1) {
142
- switch (_context2.prev = _context2.next) {
143
- case 0:
144
- _ref3 = this.layer.getLayerConfig(), _ref3$depth = _ref3.depth, depth = _ref3$depth === void 0 ? false : _ref3$depth;
145
- this.layer.triangulation = LineTriangulation;
146
- _context2.next = 4;
147
- return this.layer.buildLayerModel({
148
- moduleName: 'lineRampColors',
149
- vertexShader: linear_line_vert,
150
- fragmentShader: linear_line_frag,
151
- triangulation: LineTriangulation,
152
- depth: {
153
- enable: depth
154
- }
155
- });
156
-
157
- case 4:
158
- model = _context2.sent;
159
- return _context2.abrupt("return", [model]);
160
-
161
- case 6:
162
- case "end":
163
- return _context2.stop();
164
- }
116
+ while (1) switch (_context2.prev = _context2.next) {
117
+ case 0:
118
+ _ref3 = this.layer.getLayerConfig(), _ref3$depth = _ref3.depth, depth = _ref3$depth === void 0 ? false : _ref3$depth;
119
+ this.layer.triangulation = LineTriangulation;
120
+ _context2.next = 4;
121
+ return this.layer.buildLayerModel({
122
+ moduleName: 'lineRampColors',
123
+ vertexShader: linear_line_vert,
124
+ fragmentShader: linear_line_frag,
125
+ triangulation: LineTriangulation,
126
+ depth: {
127
+ enable: depth
128
+ }
129
+ });
130
+ case 4:
131
+ model = _context2.sent;
132
+ return _context2.abrupt("return", [model]);
133
+ case 6:
134
+ case "end":
135
+ return _context2.stop();
165
136
  }
166
137
  }, _callee2, this);
167
138
  }));
168
-
169
139
  function buildModels() {
170
140
  return _buildModels.apply(this, arguments);
171
141
  }
172
-
173
142
  return buildModels;
174
143
  }()
175
144
  }, {
@@ -223,12 +192,13 @@ var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
223
192
  size: 2,
224
193
  update: function update(feature) {
225
194
  var _feature$size = feature.size,
226
- size = _feature$size === void 0 ? 1 : _feature$size;
195
+ size = _feature$size === void 0 ? 1 : _feature$size;
227
196
  return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
228
197
  }
229
198
  }
230
- }); // point layer size;
199
+ });
231
200
 
201
+ // point layer size;
232
202
  this.styleAttributeService.registerStyleAttribute({
233
203
  name: 'normal',
234
204
  type: AttributeType.Attribute,
@@ -265,8 +235,6 @@ var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
265
235
  });
266
236
  }
267
237
  }]);
268
-
269
238
  return LinearLineModel;
270
239
  }(BaseModel);
271
-
272
240
  export { LinearLineModel as default };
@@ -5,60 +5,46 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
7
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
8
-
9
8
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
-
11
9
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
-
13
10
  import { AttributeType, gl } from '@antv/l7-core';
14
11
  import { rgb2arr } from '@antv/l7-utils';
15
12
  import { isNumber } from 'lodash';
16
13
  import BaseModel from "../../core/BaseModel";
17
14
  import { SimpleLineTriangulation } from "../../core/triangulation";
18
-
19
15
  /* babel-plugin-inline-import '../shaders/simple/simpleline_frag.glsl' */
20
16
  var simple_line_frag = "\nvarying vec4 v_color;\nvoid main() {\n gl_FragColor = v_color;\n\n}\n"; // linear simple line shader
21
-
22
17
  /* babel-plugin-inline-import '../shaders/simple/simpleline_linear_frag.glsl' */
23
18
  var simle_linear_frag = "uniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float opacity;\nvoid main() {\n gl_FragColor = mix(u_sourceColor, u_targetColor, v_distanceScale);\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n}\n";
24
-
25
19
  /* babel-plugin-inline-import '../shaders/simple/simpleline_vert.glsl' */
26
20
  var simple_line_vert = "attribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Position;\n\nattribute float a_Total_Distance;\nattribute float a_Distance;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_opacity: 1.0;\nuniform float u_vertexScale: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n\n\n#pragma include \"projection\"\n\nvarying vec4 v_color;\nvarying float v_distanceScale;\n\nvoid main() {\n\n v_color = a_Color; \n v_distanceScale = a_Distance / a_Total_Distance;\n v_color = vec4(a_Color.xyz, a_Color.w * u_opacity); \n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, project_pixel(a_Size.y) + h * 0.2, 1.0));\n } else {\n float lineHeight = a_Size.y;\n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n h *= 2.0/pow(2.0, 20.0 - u_Zoom);\n }\n\n // #define COORDINATE_SYSTEM_P20 5.0\n // #define COORDINATE_SYSTEM_P20_OFFSET 6.0\n // amap1.x\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, lineHeight + h, 1.0));\n gl_PointSize = 10.0;\n }\n}\n";
27
-
28
21
  var SimpleLineModel = /*#__PURE__*/function (_BaseModel) {
29
22
  _inherits(SimpleLineModel, _BaseModel);
30
-
31
23
  var _super = _createSuper(SimpleLineModel);
32
-
33
24
  function SimpleLineModel() {
34
25
  _classCallCheck(this, SimpleLineModel);
35
-
36
26
  return _super.apply(this, arguments);
37
27
  }
38
-
39
28
  _createClass(SimpleLineModel, [{
40
29
  key: "getUninforms",
41
30
  value: function getUninforms() {
42
31
  var _ref = this.layer.getLayerConfig(),
43
- _ref$opacity = _ref.opacity,
44
- opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
45
- sourceColor = _ref.sourceColor,
46
- targetColor = _ref.targetColor,
47
- _ref$vertexHeightScal = _ref.vertexHeightScale,
48
- vertexHeightScale = _ref$vertexHeightScal === void 0 ? 20.0 : _ref$vertexHeightScal; // 转化渐变色
49
-
50
-
32
+ _ref$opacity = _ref.opacity,
33
+ opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
34
+ sourceColor = _ref.sourceColor,
35
+ targetColor = _ref.targetColor,
36
+ _ref$vertexHeightScal = _ref.vertexHeightScale,
37
+ vertexHeightScale = _ref$vertexHeightScal === void 0 ? 20.0 : _ref$vertexHeightScal;
38
+
39
+ // 转化渐变色
51
40
  var useLinearColor = 0; // 默认不生效
52
-
53
41
  var sourceColorArr = [0, 0, 0, 0];
54
42
  var targetColorArr = [0, 0, 0, 0];
55
-
56
43
  if (sourceColor && targetColor) {
57
44
  sourceColorArr = rgb2arr(sourceColor);
58
45
  targetColorArr = rgb2arr(targetColor);
59
46
  useLinearColor = 1;
60
47
  }
61
-
62
48
  return {
63
49
  u_opacity: isNumber(opacity) ? opacity : 1,
64
50
  // 渐变色支持参数
@@ -74,32 +60,26 @@ var SimpleLineModel = /*#__PURE__*/function (_BaseModel) {
74
60
  value: function () {
75
61
  var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
76
62
  return _regeneratorRuntime.wrap(function _callee$(_context) {
77
- while (1) {
78
- switch (_context.prev = _context.next) {
79
- case 0:
80
- return _context.abrupt("return", this.buildModels());
81
-
82
- case 1:
83
- case "end":
84
- return _context.stop();
85
- }
63
+ while (1) switch (_context.prev = _context.next) {
64
+ case 0:
65
+ return _context.abrupt("return", this.buildModels());
66
+ case 1:
67
+ case "end":
68
+ return _context.stop();
86
69
  }
87
70
  }, _callee, this);
88
71
  }));
89
-
90
72
  function initModels() {
91
73
  return _initModels.apply(this, arguments);
92
74
  }
93
-
94
75
  return initModels;
95
76
  }()
96
77
  }, {
97
78
  key: "getShaders",
98
79
  value: function getShaders() {
99
80
  var _ref2 = this.layer.getLayerConfig(),
100
- sourceColor = _ref2.sourceColor,
101
- targetColor = _ref2.targetColor;
102
-
81
+ sourceColor = _ref2.sourceColor,
82
+ targetColor = _ref2.targetColor;
103
83
  if (sourceColor && targetColor) {
104
84
  // 分离 linear 功能
105
85
  return {
@@ -120,41 +100,34 @@ var SimpleLineModel = /*#__PURE__*/function (_BaseModel) {
120
100
  value: function () {
121
101
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
122
102
  var _this$getShaders, frag, vert, type, model;
123
-
124
103
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
125
- while (1) {
126
- switch (_context2.prev = _context2.next) {
127
- case 0:
128
- _this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
129
- _context2.next = 3;
130
- return this.layer.buildLayerModel({
131
- moduleName: type,
132
- vertexShader: vert,
133
- fragmentShader: frag,
134
- triangulation: SimpleLineTriangulation,
135
- primitive: gl.LINES,
136
- depth: {
137
- enable: false
138
- },
139
- pick: false
140
- });
141
-
142
- case 3:
143
- model = _context2.sent;
144
- return _context2.abrupt("return", [model]);
145
-
146
- case 5:
147
- case "end":
148
- return _context2.stop();
149
- }
104
+ while (1) switch (_context2.prev = _context2.next) {
105
+ case 0:
106
+ _this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
107
+ _context2.next = 3;
108
+ return this.layer.buildLayerModel({
109
+ moduleName: type,
110
+ vertexShader: vert,
111
+ fragmentShader: frag,
112
+ triangulation: SimpleLineTriangulation,
113
+ primitive: gl.LINES,
114
+ depth: {
115
+ enable: false
116
+ },
117
+ pick: false
118
+ });
119
+ case 3:
120
+ model = _context2.sent;
121
+ return _context2.abrupt("return", [model]);
122
+ case 5:
123
+ case "end":
124
+ return _context2.stop();
150
125
  }
151
126
  }, _callee2, this);
152
127
  }));
153
-
154
128
  function buildModels() {
155
129
  return _buildModels.apply(this, arguments);
156
130
  }
157
-
158
131
  return buildModels;
159
132
  }()
160
133
  }, {
@@ -208,15 +181,13 @@ var SimpleLineModel = /*#__PURE__*/function (_BaseModel) {
208
181
  size: 2,
209
182
  update: function update(feature) {
210
183
  var _feature$size = feature.size,
211
- size = _feature$size === void 0 ? 1 : _feature$size;
184
+ size = _feature$size === void 0 ? 1 : _feature$size;
212
185
  return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
213
186
  }
214
187
  }
215
188
  });
216
189
  }
217
190
  }]);
218
-
219
191
  return SimpleLineModel;
220
192
  }(BaseModel);
221
-
222
193
  export { SimpleLineModel as default };