@antv/l7-layers 2.9.14 → 2.9.15

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/LICENSE.md +1 -1
  2. package/es/core/BaseLayer.d.ts +2 -4
  3. package/es/core/BaseLayer.js +21 -47
  4. package/es/core/BaseLayer.js.map +1 -1
  5. package/es/core/BaseModel.d.ts +1 -2
  6. package/es/core/BaseModel.js +0 -3
  7. package/es/core/BaseModel.js.map +1 -1
  8. package/es/core/LayerGroup.d.ts +9 -0
  9. package/es/{tile/tileFactory/rasterDataLayer.js → core/LayerGroup.js} +32 -39
  10. package/es/core/LayerGroup.js.map +1 -0
  11. package/es/core/interface.d.ts +1 -14
  12. package/es/core/interface.js.map +1 -1
  13. package/es/image/models/image.js.map +1 -1
  14. package/es/line/index.d.ts +1 -1
  15. package/es/line/index.js +1 -13
  16. package/es/line/index.js.map +1 -1
  17. package/es/line/models/index.d.ts +1 -1
  18. package/es/line/models/index.js +1 -9
  19. package/es/line/models/index.js.map +1 -1
  20. package/es/plugins/DataMappingPlugin.js +1 -1
  21. package/es/plugins/DataMappingPlugin.js.map +1 -1
  22. package/es/plugins/DataSourcePlugin.js +6 -7
  23. package/es/plugins/DataSourcePlugin.js.map +1 -1
  24. package/es/plugins/FeatureScalePlugin.js +9 -35
  25. package/es/plugins/FeatureScalePlugin.js.map +1 -1
  26. package/es/plugins/ShaderUniformPlugin.js +1 -3
  27. package/es/plugins/ShaderUniformPlugin.js.map +1 -1
  28. package/es/point/index.d.ts +1 -1
  29. package/es/point/index.js +2 -10
  30. package/es/point/index.js.map +1 -1
  31. package/es/point/models/extrude.d.ts +1 -0
  32. package/es/point/models/extrude.js +10 -2
  33. package/es/point/models/extrude.js.map +1 -1
  34. package/es/point/models/fill.d.ts +1 -8
  35. package/es/point/models/fill.js +75 -55
  36. package/es/point/models/fill.js.map +1 -1
  37. package/es/point/models/index.d.ts +1 -1
  38. package/es/point/models/index.js +1 -9
  39. package/es/point/models/index.js.map +1 -1
  40. package/es/point/models/radar.js +6 -2
  41. package/es/point/models/radar.js.map +1 -1
  42. package/es/polygon/index.js +0 -6
  43. package/es/polygon/index.js.map +1 -1
  44. package/es/polygon/models/index.d.ts +1 -1
  45. package/es/polygon/models/index.js +1 -5
  46. package/es/polygon/models/index.js.map +1 -1
  47. package/es/raster/index.d.ts +2 -2
  48. package/es/raster/index.js +4 -4
  49. package/es/raster/index.js.map +1 -1
  50. package/es/raster/models/index.js +1 -1
  51. package/es/raster/models/index.js.map +1 -1
  52. package/es/raster/models/raste-tile.d.ts +23 -0
  53. package/es/raster/models/raste-tile.js +285 -0
  54. package/es/raster/models/raste-tile.js.map +1 -0
  55. package/es/raster/models/raster.d.ts +0 -2
  56. package/es/raster/models/raster.js +12 -24
  57. package/es/raster/models/raster.js.map +1 -1
  58. package/lib/core/BaseLayer.js +20 -45
  59. package/lib/core/BaseLayer.js.map +1 -1
  60. package/lib/core/BaseModel.js +0 -2
  61. package/lib/core/BaseModel.js.map +1 -1
  62. package/lib/{tile/tileFactory/rasterDataLayer.js → core/LayerGroup.js} +32 -40
  63. package/lib/core/LayerGroup.js.map +1 -0
  64. package/lib/core/interface.js.map +1 -1
  65. package/lib/image/models/image.js.map +1 -1
  66. package/lib/line/index.js +1 -13
  67. package/lib/line/index.js.map +1 -1
  68. package/lib/line/models/index.js +1 -13
  69. package/lib/line/models/index.js.map +1 -1
  70. package/lib/plugins/DataMappingPlugin.js +1 -1
  71. package/lib/plugins/DataMappingPlugin.js.map +1 -1
  72. package/lib/plugins/DataSourcePlugin.js +6 -7
  73. package/lib/plugins/DataSourcePlugin.js.map +1 -1
  74. package/lib/plugins/FeatureScalePlugin.js +9 -35
  75. package/lib/plugins/FeatureScalePlugin.js.map +1 -1
  76. package/lib/plugins/ShaderUniformPlugin.js +1 -3
  77. package/lib/plugins/ShaderUniformPlugin.js.map +1 -1
  78. package/lib/point/index.js +2 -10
  79. package/lib/point/index.js.map +1 -1
  80. package/lib/point/models/extrude.js +11 -2
  81. package/lib/point/models/extrude.js.map +1 -1
  82. package/lib/point/models/fill.js +93 -51
  83. package/lib/point/models/fill.js.map +1 -1
  84. package/lib/point/models/index.js +1 -13
  85. package/lib/point/models/index.js.map +1 -1
  86. package/lib/point/models/radar.js +5 -1
  87. package/lib/point/models/radar.js.map +1 -1
  88. package/lib/polygon/index.js +0 -6
  89. package/lib/polygon/index.js.map +1 -1
  90. package/lib/polygon/models/index.js +1 -7
  91. package/lib/polygon/models/index.js.map +1 -1
  92. package/lib/raster/index.js +4 -4
  93. package/lib/raster/index.js.map +1 -1
  94. package/lib/raster/models/index.js +2 -2
  95. package/lib/raster/models/index.js.map +1 -1
  96. package/lib/raster/models/raste-tile.js +294 -0
  97. package/lib/raster/models/raste-tile.js.map +1 -0
  98. package/lib/raster/models/raster.js +12 -24
  99. package/lib/raster/models/raster.js.map +1 -1
  100. package/package.json +7 -9
  101. package/es/line/models/earthArc_3d.d.ts +0 -17
  102. package/es/line/models/earthArc_3d.js +0 -311
  103. package/es/line/models/earthArc_3d.js.map +0 -1
  104. package/es/line/models/half.d.ts +0 -18
  105. package/es/line/models/half.js +0 -244
  106. package/es/line/models/half.js.map +0 -1
  107. package/es/line/models/tile.d.ts +0 -20
  108. package/es/line/models/tile.js +0 -327
  109. package/es/line/models/tile.js.map +0 -1
  110. package/es/point/models/earthExtrude.d.ts +0 -24
  111. package/es/point/models/earthExtrude.js +0 -259
  112. package/es/point/models/earthExtrude.js.map +0 -1
  113. package/es/point/models/earthFill.d.ts +0 -20
  114. package/es/point/models/earthFill.js +0 -255
  115. package/es/point/models/earthFill.js.map +0 -1
  116. package/es/point/models/tile.d.ts +0 -31
  117. package/es/point/models/tile.js +0 -291
  118. package/es/point/models/tile.js.map +0 -1
  119. package/es/polygon/models/tile.d.ts +0 -16
  120. package/es/polygon/models/tile.js +0 -137
  121. package/es/polygon/models/tile.js.map +0 -1
  122. package/es/tile/interface.d.ts +0 -28
  123. package/es/tile/interface.js +0 -2
  124. package/es/tile/interface.js.map +0 -1
  125. package/es/tile/manager/tileConfigManager.d.ts +0 -17
  126. package/es/tile/manager/tileConfigManager.js +0 -123
  127. package/es/tile/manager/tileConfigManager.js.map +0 -1
  128. package/es/tile/manager/tileLayerManager.d.ts +0 -35
  129. package/es/tile/manager/tileLayerManager.js +0 -297
  130. package/es/tile/manager/tileLayerManager.js.map +0 -1
  131. package/es/tile/manager/tilePickerManager.d.ts +0 -21
  132. package/es/tile/manager/tilePickerManager.js +0 -189
  133. package/es/tile/manager/tilePickerManager.js.map +0 -1
  134. package/es/tile/models/tileModel.d.ts +0 -8
  135. package/es/tile/models/tileModel.js +0 -61
  136. package/es/tile/models/tileModel.js.map +0 -1
  137. package/es/tile/tileFactory/base.d.ts +0 -44
  138. package/es/tile/tileFactory/base.js +0 -423
  139. package/es/tile/tileFactory/base.js.map +0 -1
  140. package/es/tile/tileFactory/index.d.ts +0 -5
  141. package/es/tile/tileFactory/index.js +0 -30
  142. package/es/tile/tileFactory/index.js.map +0 -1
  143. package/es/tile/tileFactory/line.d.ts +0 -12
  144. package/es/tile/tileFactory/line.js +0 -65
  145. package/es/tile/tileFactory/line.js.map +0 -1
  146. package/es/tile/tileFactory/point.d.ts +0 -12
  147. package/es/tile/tileFactory/point.js +0 -65
  148. package/es/tile/tileFactory/point.js.map +0 -1
  149. package/es/tile/tileFactory/polygon.d.ts +0 -12
  150. package/es/tile/tileFactory/polygon.js +0 -65
  151. package/es/tile/tileFactory/polygon.js.map +0 -1
  152. package/es/tile/tileFactory/raster.d.ts +0 -12
  153. package/es/tile/tileFactory/raster.js +0 -61
  154. package/es/tile/tileFactory/raster.js.map +0 -1
  155. package/es/tile/tileFactory/rasterData.d.ts +0 -12
  156. package/es/tile/tileFactory/rasterData.js +0 -86
  157. package/es/tile/tileFactory/rasterData.js.map +0 -1
  158. package/es/tile/tileFactory/rasterDataLayer.d.ts +0 -19
  159. package/es/tile/tileFactory/rasterDataLayer.js.map +0 -1
  160. package/es/tile/tileFactory/vectorLayer.d.ts +0 -27
  161. package/es/tile/tileFactory/vectorLayer.js +0 -131
  162. package/es/tile/tileFactory/vectorLayer.js.map +0 -1
  163. package/es/tile/tileLayer/baseTileLayer.d.ts +0 -47
  164. package/es/tile/tileLayer/baseTileLayer.js +0 -409
  165. package/es/tile/tileLayer/baseTileLayer.js.map +0 -1
  166. package/es/tile/tmsTileLayer.d.ts +0 -7
  167. package/es/tile/tmsTileLayer.js +0 -100
  168. package/es/tile/tmsTileLayer.js.map +0 -1
  169. package/es/tile/utils.d.ts +0 -11
  170. package/es/tile/utils.js +0 -125
  171. package/es/tile/utils.js.map +0 -1
  172. package/lib/line/models/earthArc_3d.js +0 -328
  173. package/lib/line/models/earthArc_3d.js.map +0 -1
  174. package/lib/line/models/half.js +0 -260
  175. package/lib/line/models/half.js.map +0 -1
  176. package/lib/line/models/tile.js +0 -342
  177. package/lib/line/models/tile.js.map +0 -1
  178. package/lib/point/models/earthExtrude.js +0 -277
  179. package/lib/point/models/earthExtrude.js.map +0 -1
  180. package/lib/point/models/earthFill.js +0 -291
  181. package/lib/point/models/earthFill.js.map +0 -1
  182. package/lib/point/models/tile.js +0 -308
  183. package/lib/point/models/tile.js.map +0 -1
  184. package/lib/polygon/models/tile.js +0 -152
  185. package/lib/polygon/models/tile.js.map +0 -1
  186. package/lib/tile/interface.js +0 -2
  187. package/lib/tile/interface.js.map +0 -1
  188. package/lib/tile/manager/tileConfigManager.js +0 -134
  189. package/lib/tile/manager/tileConfigManager.js.map +0 -1
  190. package/lib/tile/manager/tileLayerManager.js +0 -305
  191. package/lib/tile/manager/tileLayerManager.js.map +0 -1
  192. package/lib/tile/manager/tilePickerManager.js +0 -195
  193. package/lib/tile/manager/tilePickerManager.js.map +0 -1
  194. package/lib/tile/models/tileModel.js +0 -73
  195. package/lib/tile/models/tileModel.js.map +0 -1
  196. package/lib/tile/tileFactory/base.js +0 -436
  197. package/lib/tile/tileFactory/base.js.map +0 -1
  198. package/lib/tile/tileFactory/index.js +0 -60
  199. package/lib/tile/tileFactory/index.js.map +0 -1
  200. package/lib/tile/tileFactory/line.js +0 -76
  201. package/lib/tile/tileFactory/line.js.map +0 -1
  202. package/lib/tile/tileFactory/point.js +0 -76
  203. package/lib/tile/tileFactory/point.js.map +0 -1
  204. package/lib/tile/tileFactory/polygon.js +0 -76
  205. package/lib/tile/tileFactory/polygon.js.map +0 -1
  206. package/lib/tile/tileFactory/raster.js +0 -74
  207. package/lib/tile/tileFactory/raster.js.map +0 -1
  208. package/lib/tile/tileFactory/rasterData.js +0 -99
  209. package/lib/tile/tileFactory/rasterData.js.map +0 -1
  210. package/lib/tile/tileFactory/rasterDataLayer.js.map +0 -1
  211. package/lib/tile/tileFactory/vectorLayer.js +0 -145
  212. package/lib/tile/tileFactory/vectorLayer.js.map +0 -1
  213. package/lib/tile/tileLayer/baseTileLayer.js +0 -407
  214. package/lib/tile/tileLayer/baseTileLayer.js.map +0 -1
  215. package/lib/tile/tmsTileLayer.js +0 -116
  216. package/lib/tile/tmsTileLayer.js.map +0 -1
  217. package/lib/tile/utils.js +0 -147
  218. package/lib/tile/utils.js.map +0 -1
@@ -1,342 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
15
-
16
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
-
18
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
-
20
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
-
22
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
-
24
- var _l7Core = require("@antv/l7-core");
25
-
26
- var _l7Utils = require("@antv/l7-utils");
27
-
28
- var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
29
-
30
- var _triangulation = require("../../core/triangulation");
31
-
32
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
33
-
34
- 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; } }
35
-
36
- var line_tile_frag = "#define LineTexture 1.0\nuniform float u_blur : 0.99;\nuniform float u_opacity : 1.0;\nuniform float u_textureBlend;\n\nuniform float u_borderWidth: 0.0;\nuniform vec4 u_borderColor;\nvarying vec4 v_color;\n\n// line texture\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nvarying vec2 v_iconMapUV;\n\n#pragma include \"picking\"\n\nvarying mat4 styleMappingMat;\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float d_distance_ratio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n gl_FragColor = v_color;\n // anti-alias\n // float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = styleMappingMat[3].g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = styleMappingMat[3].b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen);\n float v = styleMappingMat[3].a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // v = max(smoothstep(0.95, 1.0, v), v);\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n \n // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, vec2(u, v)));\n // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, uv));\n vec4 pattern = texture2D(u_texture, uv);\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n gl_FragColor += pattern;\n } else { // replace\n pattern.a *= opacity;\n if(gl_FragColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n gl_FragColor = pattern;\n }\n } \n\n float v = styleMappingMat[3].a;\n float borderWidth = min(0.5, u_borderWidth);\n // \u7ED8\u5236 border\n if(borderWidth > 0.01) {\n float borderOuterWidth = borderWidth/2.0;\n\n if(v >= 1.0 - borderWidth || v <= borderWidth) {\n if(v > borderWidth) {\n float linear = smoothstep(0.0, 1.0, (v - (1.0 - borderWidth))/borderWidth);\n gl_FragColor.rgb = mix(gl_FragColor.rgb, u_borderColor.rgb, linear);\n } else if(v <= borderWidth) {\n float linear = smoothstep(0.0, 1.0, v/borderWidth);\n gl_FragColor.rgb = mix(u_borderColor.rgb, gl_FragColor.rgb, linear);\n }\n }\n\n if(v < borderOuterWidth) {\n gl_FragColor.a = mix(0.0, gl_FragColor.a, v/borderOuterWidth);\n } else if(v > 1.0 - borderOuterWidth) {\n gl_FragColor.a = mix(gl_FragColor.a, 0.0, (v - (1.0 - borderOuterWidth))/borderOuterWidth);\n }\n }\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
37
- var line_tile_vert = "\nattribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\nattribute vec2 a_iconMapUV;\n\n// dash line\nattribute float a_Total_Distance;\nattribute vec2 a_DistanceAndIndex;\n\nuniform vec2 u_tileOrigin;\nuniform float u_coord;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_icon_step: 100;\n\nuniform float u_heightfixed: 0.0;\nuniform float u_vertexScale: 1.0;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\n\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nvarying vec2 v_iconMapUV;\n\n\nuniform float u_linearColor: 0;\nuniform float u_arrow: 0.0;\nuniform float u_arrowHeight: 3.0;\nuniform float u_arrowWidth: 2.0;\nuniform float u_tailWidth: 1.0;\n\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\nvec2 calculateArrow(vec2 offset) {\n /*\n * \u5728\u652F\u6301\u7BAD\u5934\u7684\u65F6\u5019\uFF0C\u7B2C\u4E8C\u3001\u7B2C\u4E09\u7EC4\u9876\u70B9\u662F\u989D\u5916\u63D2\u5165\u7528\u4E8E\u6784\u5EFA\u9876\u70B9\u7684\n */\n float arrowFlag = -1.0;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n // \u9AD8\u5FB7 2.0 \u7684\u65CB\u8F6C\u89D2\u5EA6\u4E0D\u540C\n arrowFlag = 1.0;\n }\n float pi = arrowFlag * 3.1415926/2.;\n if(a_Miter < 0.) {\n // \u6839\u636E\u7EBF\u7684\u4E24\u4FA7\u504F\u79FB\u4E0D\u540C\u3001\u65CB\u8F6C\u7684\u65B9\u5411\u76F8\u53CD\n pi = -pi;\n }\n highp float angle_sin = sin(pi);\n highp float angle_cos = cos(pi);\n // \u8BA1\u7B97\u5782\u76F4\u4E0E\u7EBF\u65B9\u5411\u7684\u65CB\u8F6C\u77E9\u9635\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n float arrowWidth = u_arrowWidth;\n float arrowHeight = u_arrowHeight;\n\n vec2 arrowOffset = vec2(0.0);\n /*\n * a_DistanceAndIndex.y \u7528\u4E8E\u6807\u8BB0\u5F53\u524D\u9876\u70B9\u5C5E\u4E8E\u54EA\u4E00\u7EC4\uFF08\u4E24\u4E2A\u9876\u70B9\u4E00\u7EC4\uFF0C\u6784\u6210\u7EBF\u7684\u5176\u5B9E\u662F\u77E9\u5F62\uFF0C\u6700\u7B80\u9700\u8981\u56DB\u4E2A\u9876\u70B9\u3001\u4E24\u7EC4\u9876\u70B9\u6784\u6210\uFF09\n */\n if(a_DistanceAndIndex.y == 0.0) {\n // \u7BAD\u5934\u5C16\u90E8\n offset = vec2(0.0);\n } else if(a_DistanceAndIndex.y == 1.0) {\n // \u7BAD\u5934\u4E24\u4FA7\n arrowOffset = rotation_matrix*(offset * arrowHeight);\n offset += arrowOffset; // \u6CBF\u7EBF\u504F\u79FB\n offset = offset * arrowWidth; // \u5782\u76F4\u7EBF\u5411\u5916\u504F\u79FB\uFF08\u662F\u6784\u5EFA\u7BAD\u5934\u4E24\u4FA7\u7684\u9876\u70B9\uFF09\n } else if(a_DistanceAndIndex.y == 2.0 || a_DistanceAndIndex.y == 3.0 || a_DistanceAndIndex.y == 4.0) {\n // \u504F\u79FB\u5176\u4F59\u7684\u70B9\u4F4D\uFF08\u5C06\u957F\u5EA6\u8BA9\u4F4D\u7ED9\u7BAD\u5934\uFF09\n arrowOffset = rotation_matrix*(offset * arrowHeight) * arrowWidth;\n offset += arrowOffset;// \u6CBF\u7EBF\u504F\u79FB\n }\n\n return offset;\n}\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n\n v_iconMapUV = a_iconMapUV;\n d_texPixelLen = project_float_pixel(u_icon_step);\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n v_color = a_Color;\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 if(u_arrow > 0.0) {\n // \u8BA1\u7B97\u7BAD\u5934\n offset = calculateArrow(offset);\n\n if(a_DistanceAndIndex.y > 4.0) {\n offset *= mix(1.0, u_tailWidth, currentLinePointRatio);\n }\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 // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = currentLinePointRatio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n styleMappingMat[3][1] = lineDistance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n styleMappingMat[3][2] = d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n styleMappingMat[3][3] = texV; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\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\nif(u_coord > 0.0) {\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, 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 if(u_heightfixed > 0.0) {\n lineHeight *= mapboxZoomScale;\n }\n \n } else {\n // amap\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} else {\n vec2 pointPos = a_Position.xy;\n vec4 tileWorld = vec4(project_mvt_offset_position(vec4(u_tileOrigin, 0.0, 1.0)).xyz, 1.0); // \u74E6\u7247\u8D77\u59CB\u70B9\u7684\u4E16\u754C\u5750\u6807\n\n vec2 pointOffset = pointPos * pow(2.0, u_Zoom); // \u74E6\u7247\u5185\u7684\u70B9\u7684\u504F\u79FB\u5750\u6807\n \n tileWorld.xy += pointOffset;\n\n tileWorld.xy += offset;\n\n if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // Needs to be divided with project_uCommonUnitsPerMeter\n tileWorld.w *= u_PixelsPerMeter.z;\n }\n\n gl_Position = u_ViewProjectionMatrix * tileWorld + u_ViewportCenterProjection;\n}\n\n\n setPickingColor(a_PickingColor);\n\n\n}\n";
38
-
39
- var LineModel = function (_BaseModel) {
40
- (0, _inherits2.default)(LineModel, _BaseModel);
41
-
42
- var _super = _createSuper(LineModel);
43
-
44
- function LineModel() {
45
- var _this;
46
-
47
- (0, _classCallCheck2.default)(this, LineModel);
48
-
49
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
50
- args[_key] = arguments[_key];
51
- }
52
-
53
- _this = _super.call.apply(_super, [this].concat(args));
54
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "texture", void 0);
55
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateTexture", function () {
56
- var createTexture2D = _this.rendererService.createTexture2D;
57
-
58
- if (_this.texture) {
59
- _this.texture.update({
60
- data: _this.iconService.getCanvas()
61
- });
62
-
63
- _this.layer.render();
64
-
65
- return;
66
- }
67
-
68
- _this.texture = createTexture2D({
69
- data: _this.iconService.getCanvas(),
70
- mag: _l7Core.gl.NEAREST,
71
- min: _l7Core.gl.NEAREST,
72
- premultiplyAlpha: false,
73
- width: 1024,
74
- height: _this.iconService.canvasHeight || 128
75
- });
76
- });
77
- return _this;
78
- }
79
-
80
- (0, _createClass2.default)(LineModel, [{
81
- key: "getUninforms",
82
- value: function getUninforms() {
83
- var _ref = this.layer.getLayerConfig(),
84
- _ref$opacity = _ref.opacity,
85
- opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
86
- _ref$textureBlend = _ref.textureBlend,
87
- textureBlend = _ref$textureBlend === void 0 ? 'normal' : _ref$textureBlend,
88
- _ref$lineTexture = _ref.lineTexture,
89
- lineTexture = _ref$lineTexture === void 0 ? false : _ref$lineTexture,
90
- _ref$iconStep = _ref.iconStep,
91
- iconStep = _ref$iconStep === void 0 ? 100 : _ref$iconStep,
92
- _ref$vertexHeightScal = _ref.vertexHeightScale,
93
- vertexHeightScale = _ref$vertexHeightScal === void 0 ? 20.0 : _ref$vertexHeightScal,
94
- _ref$borderWidth = _ref.borderWidth,
95
- borderWidth = _ref$borderWidth === void 0 ? 0.0 : _ref$borderWidth,
96
- _ref$borderColor = _ref.borderColor,
97
- borderColor = _ref$borderColor === void 0 ? '#ccc' : _ref$borderColor,
98
- _ref$heightfixed = _ref.heightfixed,
99
- heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
100
- _ref$arrow = _ref.arrow,
101
- arrow = _ref$arrow === void 0 ? {
102
- enable: false,
103
- arrowWidth: 2,
104
- arrowHeight: 3,
105
- tailWidth: 1
106
- } : _ref$arrow,
107
- _ref$coord = _ref.coord,
108
- coord = _ref$coord === void 0 ? 'lnglat' : _ref$coord,
109
- tileOrigin = _ref.tileOrigin;
110
-
111
- if (this.rendererService.getDirty()) {
112
- this.texture.bind();
113
- }
114
-
115
- if (this.dataTextureTest && this.dataTextureNeedUpdate({
116
- opacity: opacity
117
- })) {
118
- this.judgeStyleAttributes({
119
- opacity: opacity
120
- });
121
- var encodeData = this.layer.getEncodedData();
122
-
123
- var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
124
- data = _this$calDataFrame.data,
125
- width = _this$calDataFrame.width,
126
- height = _this$calDataFrame.height;
127
-
128
- this.rowCount = height;
129
- this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
130
- flipY: true,
131
- data: data,
132
- format: _l7Core.gl.LUMINANCE,
133
- type: _l7Core.gl.FLOAT,
134
- width: width,
135
- height: height
136
- }) : this.createTexture2D({
137
- flipY: true,
138
- data: [1],
139
- format: _l7Core.gl.LUMINANCE,
140
- type: _l7Core.gl.FLOAT,
141
- width: 1,
142
- height: 1
143
- });
144
- }
145
-
146
- return {
147
- u_tileOrigin: tileOrigin || [0, 0],
148
- u_coord: coord === 'lnglat' ? 1.0 : 0.0,
149
- u_dataTexture: this.dataTexture,
150
- u_cellTypeLayout: this.getCellTypeLayout(),
151
- u_opacity: Number(opacity),
152
- u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,
153
- u_texture: this.texture,
154
- u_line_texture: lineTexture ? 1.0 : 0.0,
155
- u_icon_step: iconStep,
156
- u_textSize: [1024, this.iconService.canvasHeight || 128],
157
- u_borderWidth: borderWidth,
158
- u_borderColor: (0, _l7Utils.rgb2arr)(borderColor),
159
- u_heightfixed: Number(heightfixed),
160
- u_vertexScale: vertexHeightScale,
161
- u_arrow: Number(arrow.enable),
162
- u_arrowHeight: arrow.arrowHeight || 3,
163
- u_arrowWidth: arrow.arrowWidth || 2,
164
- u_tailWidth: arrow.tailWidth === undefined ? 1 : arrow.tailWidth
165
- };
166
- }
167
- }, {
168
- key: "initModels",
169
- value: function initModels() {
170
- this.updateTexture();
171
- this.iconService.on('imageUpdate', this.updateTexture);
172
- return this.buildModels();
173
- }
174
- }, {
175
- key: "clearModels",
176
- value: function clearModels() {
177
- var _this$texture, _this$dataTexture;
178
-
179
- (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
180
- (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
181
- this.iconService.off('imageUpdate', this.updateTexture);
182
- }
183
- }, {
184
- key: "buildModels",
185
- value: function buildModels() {
186
- var _ref2 = this.layer.getLayerConfig(),
187
- _ref2$mask = _ref2.mask,
188
- mask = _ref2$mask === void 0 ? false : _ref2$mask,
189
- _ref2$maskInside = _ref2.maskInside,
190
- maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside,
191
- _ref2$depth = _ref2.depth,
192
- depth = _ref2$depth === void 0 ? false : _ref2$depth;
193
-
194
- var _this$getShaders = this.getShaders(),
195
- frag = _this$getShaders.frag,
196
- vert = _this$getShaders.vert,
197
- type = _this$getShaders.type;
198
-
199
- this.layer.triangulation = _triangulation.LineTriangulation;
200
- return [this.layer.buildLayerModel({
201
- moduleName: type,
202
- vertexShader: vert,
203
- fragmentShader: frag,
204
- triangulation: _triangulation.LineTriangulation,
205
- primitive: _l7Core.gl.TRIANGLES,
206
- blend: this.getBlend(),
207
- depth: {
208
- enable: depth
209
- },
210
- stencil: (0, _l7Utils.getMask)(mask, maskInside)
211
- })];
212
- }
213
- }, {
214
- key: "getShaders",
215
- value: function getShaders() {
216
- return {
217
- frag: line_tile_frag,
218
- vert: line_tile_vert,
219
- type: 'line_tile'
220
- };
221
- }
222
- }, {
223
- key: "registerBuiltinAttributes",
224
- value: function registerBuiltinAttributes() {
225
- var _this2 = this;
226
-
227
- this.styleAttributeService.registerStyleAttribute({
228
- name: 'distanceAndIndex',
229
- type: _l7Core.AttributeType.Attribute,
230
- descriptor: {
231
- name: 'a_DistanceAndIndex',
232
- buffer: {
233
- usage: _l7Core.gl.STATIC_DRAW,
234
- data: [],
235
- type: _l7Core.gl.FLOAT
236
- },
237
- size: 2,
238
- update: function update(feature, featureIdx, vertex, attributeIdx, normal, vertexIndex) {
239
- return vertexIndex === undefined ? [vertex[3], 10] : [vertex[3], vertexIndex];
240
- }
241
- }
242
- });
243
- this.styleAttributeService.registerStyleAttribute({
244
- name: 'total_distance',
245
- type: _l7Core.AttributeType.Attribute,
246
- descriptor: {
247
- name: 'a_Total_Distance',
248
- buffer: {
249
- usage: _l7Core.gl.STATIC_DRAW,
250
- data: [],
251
- type: _l7Core.gl.FLOAT
252
- },
253
- size: 1,
254
- update: function update(feature, featureIdx, vertex, attributeIdx) {
255
- return [vertex[5]];
256
- }
257
- }
258
- });
259
- this.styleAttributeService.registerStyleAttribute({
260
- name: 'size',
261
- type: _l7Core.AttributeType.Attribute,
262
- descriptor: {
263
- name: 'a_Size',
264
- buffer: {
265
- usage: _l7Core.gl.DYNAMIC_DRAW,
266
- data: [],
267
- type: _l7Core.gl.FLOAT
268
- },
269
- size: 2,
270
- update: function update(feature, featureIdx, vertex, attributeIdx) {
271
- var _feature$size = feature.size,
272
- size = _feature$size === void 0 ? 1 : _feature$size;
273
- return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
274
- }
275
- }
276
- });
277
- this.styleAttributeService.registerStyleAttribute({
278
- name: 'normal',
279
- type: _l7Core.AttributeType.Attribute,
280
- descriptor: {
281
- name: 'a_Normal',
282
- buffer: {
283
- usage: _l7Core.gl.STATIC_DRAW,
284
- data: [],
285
- type: _l7Core.gl.FLOAT
286
- },
287
- size: 3,
288
- update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
289
- return normal;
290
- }
291
- }
292
- });
293
- this.styleAttributeService.registerStyleAttribute({
294
- name: 'miter',
295
- type: _l7Core.AttributeType.Attribute,
296
- descriptor: {
297
- name: 'a_Miter',
298
- buffer: {
299
- usage: _l7Core.gl.STATIC_DRAW,
300
- data: [],
301
- type: _l7Core.gl.FLOAT
302
- },
303
- size: 1,
304
- update: function update(feature, featureIdx, vertex, attributeIdx) {
305
- return [vertex[4]];
306
- }
307
- }
308
- });
309
- this.styleAttributeService.registerStyleAttribute({
310
- name: 'uv',
311
- type: _l7Core.AttributeType.Attribute,
312
- descriptor: {
313
- name: 'a_iconMapUV',
314
- buffer: {
315
- usage: _l7Core.gl.DYNAMIC_DRAW,
316
- data: [],
317
- type: _l7Core.gl.FLOAT
318
- },
319
- size: 2,
320
- update: function update(feature, featureIdx, vertex, attributeIdx) {
321
- var iconMap = _this2.iconService.getIconMap();
322
-
323
- var texture = feature.texture;
324
-
325
- var _ref3 = iconMap[texture] || {
326
- x: 0,
327
- y: 0
328
- },
329
- x = _ref3.x,
330
- y = _ref3.y;
331
-
332
- return [x, y];
333
- }
334
- }
335
- });
336
- }
337
- }]);
338
- return LineModel;
339
- }(_BaseModel2.default);
340
-
341
- exports.default = LineModel;
342
- //# sourceMappingURL=tile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/line/models/tile.ts"],"names":["LineModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","gl","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","textureBlend","lineTexture","iconStep","vertexHeightScale","borderWidth","borderColor","heightfixed","arrow","enable","arrowWidth","arrowHeight","tailWidth","coord","tileOrigin","getDirty","bind","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","length","flipY","format","LUMINANCE","type","FLOAT","u_tileOrigin","u_coord","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","Number","u_textureBlend","u_texture","u_line_texture","u_icon_step","u_textSize","u_borderWidth","u_borderColor","u_heightfixed","u_vertexScale","u_arrow","u_arrowHeight","u_arrowWidth","u_tailWidth","undefined","updateTexture","on","buildModels","destroy","off","mask","maskInside","depth","getShaders","frag","vert","triangulation","LineTriangulation","buildLayerModel","moduleName","vertexShader","fragmentShader","primitive","TRIANGLES","blend","getBlend","stencil","line_tile_frag","line_tile_vert","styleAttributeService","registerStyleAttribute","name","AttributeType","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","normal","vertexIndex","DYNAMIC_DRAW","Array","isArray","iconMap","getIconMap","x","y","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAUA;;AACA;;AAEA;;;;;;;;;IAKqBA,S;;;;;;;;;;;;;;;;gGA4RK,YAAM;AAC5B,UAAQC,eAAR,GAA4B,MAAKC,eAAjC,CAAQD,eAAR;;AACA,UAAI,MAAKE,OAAT,EAAkB;AAChB,cAAKA,OAAL,CAAaC,MAAb,CAAoB;AAClBC,UAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB;AADY,SAApB;;AAGA,cAAKC,KAAL,CAAWC,MAAX;;AACA;AACD;;AACD,YAAKN,OAAL,GAAeF,eAAe,CAAC;AAC7BI,QAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB,EADuB;AAE7BG,QAAAA,GAAG,EAAEC,WAAGC,OAFqB;AAG7BC,QAAAA,GAAG,EAAEF,WAAGC,OAHqB;AAI7BE,QAAAA,gBAAgB,EAAE,KAJW;AAK7BC,QAAAA,KAAK,EAAE,IALsB;AAM7BC,QAAAA,MAAM,EAAE,MAAKV,WAAL,CAAiBW,YAAjB,IAAiC;AANZ,OAAD,CAA9B;AAQD,K;;;;;;WA3SD,wBAAqC;AACnC,iBAiBI,KAAKT,KAAL,CAAWU,cAAX,EAjBJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,mCAEEC,YAFF;AAAA,UAEEA,YAFF,kCAEiB,QAFjB;AAAA,kCAGEC,WAHF;AAAA,UAGEA,WAHF,iCAGgB,KAHhB;AAAA,+BAIEC,QAJF;AAAA,UAIEA,QAJF,8BAIa,GAJb;AAAA,uCAKEC,iBALF;AAAA,UAKEA,iBALF,sCAKsB,IALtB;AAAA,kCAMEC,WANF;AAAA,UAMEA,WANF,iCAMgB,GANhB;AAAA,kCAOEC,WAPF;AAAA,UAOEA,W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OAAO,GAAG,MAAI,CAAC9G,WAAL,CAAiB+G,UAAjB,EAAhB;;AACA,gBAAQlH,OAAR,GAAoBwG,OAApB,CAAQxG,OAAR;;AACA,wBAAiBiH,OAAO,CAACjH,OAAD,CAAP,IAA8B;AAAEmH,cAAAA,CAAC,EAAE,CAAL;AAAQC,cAAAA,CAAC,EAAE;AAAX,aAA/C;AAAA,gBAAQD,CAAR,SAAQA,CAAR;AAAA,gBAAWC,CAAX,SAAWA,CAAX;;AACA,mBAAO,CAACD,CAAD,EAAIC,CAAJ,CAAP;AACD;AAnBS;AAHoC,OAAlD;AAyBD;;;EA1RoCC,mB","sourcesContent":["import {\n AttributeType,\n gl,\n IEncodeFeature,\n ILayerConfig,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\n\nimport { getMask, rgb2arr } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\n\nimport line_tile_frag from '../shaders/tile/line_tile_frag.glsl';\nimport line_tile_vert from '../shaders/tile/line_tile_vert.glsl';\n\nexport default class LineModel extends BaseModel {\n protected texture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n textureBlend = 'normal',\n lineTexture = false,\n iconStep = 100,\n vertexHeightScale = 20.0,\n borderWidth = 0.0,\n borderColor = '#ccc',\n heightfixed = false,\n arrow = {\n enable: false,\n arrowWidth: 2,\n arrowHeight: 3,\n tailWidth: 1,\n },\n coord = 'lnglat',\n tileOrigin,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (this.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_tileOrigin: tileOrigin || [0, 0],\n u_coord: coord === 'lnglat' ? 1.0 : 0.0,\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n u_opacity: Number(opacity),\n u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,\n\n // 纹理支持参数\n u_texture: this.texture, // 贴图\n u_line_texture: lineTexture ? 1.0 : 0.0, // 传入线的标识\n u_icon_step: iconStep,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n // line border 参数\n u_borderWidth: borderWidth,\n u_borderColor: rgb2arr(borderColor),\n\n // 是否固定高度\n u_heightfixed: Number(heightfixed),\n\n // 顶点高度 scale\n u_vertexScale: vertexHeightScale,\n\n // arrow\n u_arrow: Number(arrow.enable),\n u_arrowHeight: arrow.arrowHeight || 3,\n u_arrowWidth: arrow.arrowWidth || 2,\n u_tailWidth: arrow.tailWidth === undefined ? 1 : arrow.tailWidth,\n };\n }\n\n public initModels(): IModel[] {\n this.updateTexture();\n this.iconService.on('imageUpdate', this.updateTexture);\n\n return this.buildModels();\n }\n\n public clearModels() {\n this.texture?.destroy();\n this.dataTexture?.destroy();\n this.iconService.off('imageUpdate', this.updateTexture);\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n depth = false,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const { frag, vert, type } = this.getShaders();\n this.layer.triangulation = LineTriangulation;\n return [\n this.layer.buildLayerModel({\n moduleName: type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: LineTriangulation,\n primitive: gl.TRIANGLES,\n blend: this.getBlend(),\n depth: { enable: depth },\n // depth: { enable: true },\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n\n /**\n * 根据参数获取不同的 shader 代码\n * @returns\n */\n public getShaders(): { frag: string; vert: string; type: string } {\n return {\n frag: line_tile_frag,\n vert: line_tile_vert,\n type: 'line_tile',\n };\n }\n\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distanceAndIndex',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_DistanceAndIndex',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n vertexIndex?: number,\n ) => {\n return vertexIndex === undefined\n ? [vertex[3], 10]\n : [vertex[3], vertexIndex];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'total_distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Total_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[5]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'normal',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Normal',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n ) => {\n return normal;\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'miter',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Miter',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[4]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_iconMapUV',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const iconMap = this.iconService.getIconMap();\n const { texture } = feature;\n const { x, y } = iconMap[texture as string] || { x: 0, y: 0 };\n return [x, y];\n },\n },\n });\n }\n\n private updateTexture = () => {\n const { createTexture2D } = this.rendererService;\n if (this.texture) {\n this.texture.update({\n data: this.iconService.getCanvas(),\n });\n this.layer.render();\n return;\n }\n this.texture = createTexture2D({\n data: this.iconService.getCanvas(),\n mag: gl.NEAREST,\n min: gl.NEAREST,\n premultiplyAlpha: false,\n width: 1024,\n height: this.iconService.canvasHeight || 128,\n });\n };\n}\n"],"file":"tile.js"}