@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,308 +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 _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
-
12
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
-
18
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
24
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
-
26
- var _l7Core = require("@antv/l7-core");
27
-
28
- var _l7Utils = require("@antv/l7-utils");
29
-
30
- var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
31
-
32
- var _triangulation = require("../../core/triangulation");
33
-
34
- var _l7Maps = require("@antv/l7-maps");
35
-
36
- 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); }; }
37
-
38
- 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; } }
39
-
40
- var point_tile_frag = "uniform float u_additive;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n float opacity = styleMappingMat[0][0];\n float stroke_opacity = styleMappingMat[0][1];\n float strokeWidth = styleMappingMat[0][2];\n vec4 strokeColor = textrueStroke == vec4(0) ? v_color : textrueStroke;\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius + strokeWidth);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n } else if (shape == 1) {\n outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n } else if (shape == 2) {\n outer_df = sdBox(v_data.xy, vec2(1.));\n inner_df = sdBox(v_data.xy, vec2(r));\n } else if (shape == 3) {\n outer_df = sdPentagon(v_data.xy, 0.8);\n inner_df = sdPentagon(v_data.xy, r * 0.8);\n } else if (shape == 4) {\n outer_df = sdHexagon(v_data.xy, 0.8);\n inner_df = sdHexagon(v_data.xy, r * 0.8);\n } else if (shape == 5) {\n outer_df = sdOctogon(v_data.xy, 1.0);\n inner_df = sdOctogon(v_data.xy, r);\n } else if (shape == 6) {\n outer_df = sdHexagram(v_data.xy, 0.52);\n inner_df = sdHexagram(v_data.xy, r * 0.52);\n } else if (shape == 7) {\n outer_df = sdRhombus(v_data.xy, vec2(1.0));\n inner_df = sdRhombus(v_data.xy, vec2(r));\n } else if (shape == 8) {\n outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n }\n\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = strokeWidth < 0.01 ? 0.0 : smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n\n if(strokeWidth < 0.01) {\n gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);\n } else {\n gl_FragColor = mix(vec4(v_color.rgb, v_color.a * opacity), strokeColor * stroke_opacity, color_t);\n }\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n gl_FragColor = filterColorAlpha(gl_FragColor, gl_FragColor.a);\n } else {\n gl_FragColor.a *= opacity_t;\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
41
- var point_tile_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\n\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\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_isMeter;\n\nuniform vec2 u_tileOrigin;\nuniform float u_coord;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\nuniform float u_opacity : 1;\nuniform float u_stroke_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\nuniform vec2 u_offsets;\n\nuniform float u_blur : 0.0;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalStrokeOpacity\"\n#pragma include \"styleMappingCalStrokeWidth\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n float newSize = setPickingSize(a_Size);\n\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\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\n vec2 strokeOpacityAndOffset = calStrokeOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = strokeOpacityAndOffset.r;\n textureOffset = strokeOpacityAndOffset.g;\n\n vec2 strokeWidthAndOffset = calStrokeWidthAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][2] = strokeWidthAndOffset.r;\n textureOffset = strokeWidthAndOffset.g;\n\n vec4 textrueStroke = vec4(-1.0, -1.0, -1.0, -1.0);\n if(hasStroke()) {\n vec2 valueRPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][0] = pos2value(valueRPos, columnWidth, rowHeight); // R\n textureOffset += 1.0;\n\n vec2 valueGPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][1] = pos2value(valueGPos, columnWidth, rowHeight); // G\n textureOffset += 1.0;\n\n vec2 valueBPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][2] = pos2value(valueBPos, columnWidth, rowHeight); // B\n textureOffset += 1.0;\n\n vec2 valueAPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][3] = pos2value(valueAPos, columnWidth, rowHeight); // A\n textureOffset += 1.0;\n } else {\n if(u_stroke_color == vec4(0.0)) {\n styleMappingMat[1][0] = v_color.r;\n styleMappingMat[1][1] = v_color.g;\n styleMappingMat[1][2] = v_color.b;\n styleMappingMat[1][3] = v_color.a;\n } else {\n styleMappingMat[1][0] = u_stroke_color.r;\n styleMappingMat[1][1] = u_stroke_color.g;\n styleMappingMat[1][2] = u_stroke_color.b;\n styleMappingMat[1][3] = u_stroke_color.a;\n }\n }\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n v_color = a_Color;\n v_radius = newSize;\n\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, u_blur);\n\n vec2 offset = (extrude.xy * (newSize + u_stroke_width) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n antialiasblur *= pow(19.0 - u_Zoom, 2.0);\n antialiasblur = max(antialiasblur, -0.01);\n // offset *= 0.5;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.xy += offset;\n offset.x = 0.0;\n offset.y = 0.0;\n }\n }\n\n v_data = vec4(extrude.x, extrude.y, antialiasblur,shape_type);\n\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n }\n\nif(u_coord > 0.0) {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, 0.0, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n }\n} else {\n gl_PointSize = 24.0;\n vec2 pointPos = a_Position.xy;\n vec4 world = 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 world.xy += offset;\n world.xy += pointOffset;\n\n if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // Needs to be divided with project_uCommonUnitsPerMeter\n world.w *= u_PixelsPerMeter.z;\n }\n\n gl_Position = u_ViewProjectionMatrix * world + u_ViewportCenterProjection;\n}\n\n \n setPickingColor(a_PickingColor);\n\n\n}\n";
42
-
43
- var FillModel = function (_BaseModel) {
44
- (0, _inherits2.default)(FillModel, _BaseModel);
45
-
46
- var _super = _createSuper(FillModel);
47
-
48
- function FillModel() {
49
- var _this;
50
-
51
- (0, _classCallCheck2.default)(this, FillModel);
52
-
53
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
54
- args[_key] = arguments[_key];
55
- }
56
-
57
- _this = _super.call.apply(_super, [this].concat(args));
58
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meter2coord", 1);
59
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isMeter", false);
60
- return _this;
61
- }
62
-
63
- (0, _createClass2.default)(FillModel, [{
64
- key: "getUninforms",
65
- value: function getUninforms() {
66
- var _ref = this.layer.getLayerConfig(),
67
- _ref$opacity = _ref.opacity,
68
- opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
69
- _ref$strokeOpacity = _ref.strokeOpacity,
70
- strokeOpacity = _ref$strokeOpacity === void 0 ? 1 : _ref$strokeOpacity,
71
- _ref$strokeWidth = _ref.strokeWidth,
72
- strokeWidth = _ref$strokeWidth === void 0 ? 0 : _ref$strokeWidth,
73
- _ref$stroke = _ref.stroke,
74
- stroke = _ref$stroke === void 0 ? 'rgba(0,0,0,0)' : _ref$stroke,
75
- _ref$offsets = _ref.offsets,
76
- offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets,
77
- blend = _ref.blend,
78
- _ref$blur = _ref.blur,
79
- blur = _ref$blur === void 0 ? 0 : _ref$blur,
80
- _ref$coord = _ref.coord,
81
- coord = _ref$coord === void 0 ? 'lnglat' : _ref$coord,
82
- tileOrigin = _ref.tileOrigin;
83
-
84
- if (this.dataTextureTest && this.dataTextureNeedUpdate({
85
- opacity: opacity,
86
- strokeOpacity: strokeOpacity,
87
- strokeWidth: strokeWidth,
88
- stroke: stroke,
89
- offsets: offsets
90
- })) {
91
- this.judgeStyleAttributes({
92
- opacity: opacity,
93
- strokeOpacity: strokeOpacity,
94
- strokeWidth: strokeWidth,
95
- stroke: stroke,
96
- offsets: offsets
97
- });
98
- var encodeData = this.layer.getEncodedData();
99
-
100
- var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
101
- data = _this$calDataFrame.data,
102
- width = _this$calDataFrame.width,
103
- height = _this$calDataFrame.height;
104
-
105
- this.rowCount = height;
106
- this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
107
- flipY: true,
108
- data: data,
109
- format: _l7Core.gl.LUMINANCE,
110
- type: _l7Core.gl.FLOAT,
111
- width: width,
112
- height: height
113
- }) : this.createTexture2D({
114
- flipY: true,
115
- data: [1],
116
- format: _l7Core.gl.LUMINANCE,
117
- type: _l7Core.gl.FLOAT,
118
- width: 1,
119
- height: 1
120
- });
121
- }
122
-
123
- return {
124
- u_tileOrigin: tileOrigin || [0, 0],
125
- u_coord: coord === 'lnglat' ? 1.0 : 0.0,
126
- u_isMeter: Number(this.isMeter),
127
- u_blur: blur,
128
- u_additive: blend === 'additive' ? 1.0 : 0.0,
129
- u_dataTexture: this.dataTexture,
130
- u_cellTypeLayout: this.getCellTypeLayout(),
131
- u_opacity: Number(opacity),
132
- u_stroke_opacity: Number(strokeOpacity),
133
- u_stroke_width: Number(strokeWidth),
134
- u_stroke_color: this.getStrokeColor(stroke),
135
- u_offsets: this.isOffsetStatic(offsets) ? offsets : [0, 0]
136
- };
137
- }
138
- }, {
139
- key: "getAttribute",
140
- value: function getAttribute() {
141
- return this.styleAttributeService.createAttributesAndIndices(this.layer.getEncodedData(), _triangulation.PointFillTriangulation);
142
- }
143
- }, {
144
- key: "initModels",
145
- value: function initModels() {
146
- var _ref2 = this.layer.getLayerConfig(),
147
- _ref2$unit = _ref2.unit,
148
- unit = _ref2$unit === void 0 ? 'l7size' : _ref2$unit;
149
-
150
- var version = this.mapService.version;
151
-
152
- if (unit === 'meter' && version !== _l7Maps.Version.L7MAP && version !== _l7Maps.Version.GLOBEL) {
153
- this.isMeter = true;
154
- this.calMeter2Coord();
155
- }
156
-
157
- return this.buildModels();
158
- }
159
- }, {
160
- key: "calMeter2Coord",
161
- value: function calMeter2Coord() {
162
- var _this$layer$getSource = (0, _slicedToArray2.default)(this.layer.getSource().extent, 4),
163
- minLng = _this$layer$getSource[0],
164
- minLat = _this$layer$getSource[1],
165
- maxLng = _this$layer$getSource[2],
166
- maxLat = _this$layer$getSource[3];
167
-
168
- var center = [(minLng + maxLng) / 2, (minLat + maxLat) / 2];
169
- var version = this.mapService.version;
170
-
171
- if (version === _l7Maps.Version.MAPBOX && window.mapboxgl.MercatorCoordinate) {
172
- var coord = window.mapboxgl.MercatorCoordinate.fromLngLat({
173
- lng: center[0],
174
- lat: center[1]
175
- }, 0);
176
- var offsetInMeters = 1;
177
- var offsetInMercatorCoordinateUnits = offsetInMeters * coord.meterInMercatorCoordinateUnits();
178
- var westCoord = new window.mapboxgl.MercatorCoordinate(coord.x - offsetInMercatorCoordinateUnits, coord.y, coord.z);
179
- var westLnglat = westCoord.toLngLat();
180
- this.meter2coord = center[0] - westLnglat.lng;
181
- return;
182
- }
183
-
184
- var m1 = this.mapService.meterToCoord(center, [minLng, minLat]);
185
- var m2 = this.mapService.meterToCoord(center, [maxLng === minLng ? maxLng + 0.1 : maxLng, maxLat === minLat ? minLat + 0.1 : maxLat]);
186
- this.meter2coord = (m1 + m2) / 2;
187
-
188
- if (!Boolean(this.meter2coord)) {
189
- this.meter2coord = 7.70681090738883;
190
- }
191
- }
192
- }, {
193
- key: "buildModels",
194
- value: function buildModels() {
195
- var _ref3 = this.layer.getLayerConfig(),
196
- _ref3$mask = _ref3.mask,
197
- mask = _ref3$mask === void 0 ? false : _ref3$mask,
198
- _ref3$maskInside = _ref3.maskInside,
199
- maskInside = _ref3$maskInside === void 0 ? true : _ref3$maskInside;
200
-
201
- var _this$getShaders = this.getShaders(),
202
- frag = _this$getShaders.frag,
203
- vert = _this$getShaders.vert,
204
- type = _this$getShaders.type;
205
-
206
- this.layer.triangulation = _triangulation.PointFillTriangulation;
207
- return [this.layer.buildLayerModel({
208
- moduleName: type,
209
- vertexShader: vert,
210
- fragmentShader: frag,
211
- triangulation: _triangulation.PointFillTriangulation,
212
- depth: {
213
- enable: false
214
- },
215
- blend: this.getBlend(),
216
- stencil: (0, _l7Utils.getMask)(mask, maskInside),
217
- cull: {
218
- enable: true,
219
- face: (0, _l7Utils.getCullFace)(this.mapService.version)
220
- }
221
- })];
222
- }
223
- }, {
224
- key: "getShaders",
225
- value: function getShaders() {
226
- return {
227
- frag: point_tile_frag,
228
- vert: point_tile_vert,
229
- type: 'point_fill_tile'
230
- };
231
- }
232
- }, {
233
- key: "clearModels",
234
- value: function clearModels() {
235
- var _this$dataTexture;
236
-
237
- (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
238
- }
239
- }, {
240
- key: "registerBuiltinAttributes",
241
- value: function registerBuiltinAttributes() {
242
- var _this2 = this;
243
-
244
- this.styleAttributeService.registerStyleAttribute({
245
- name: 'extrude',
246
- type: _l7Core.AttributeType.Attribute,
247
- descriptor: {
248
- name: 'a_Extrude',
249
- buffer: {
250
- usage: _l7Core.gl.DYNAMIC_DRAW,
251
- data: [],
252
- type: _l7Core.gl.FLOAT
253
- },
254
- size: 3,
255
- update: function update(feature, featureIdx, vertex, attributeIdx) {
256
- var extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];
257
- var extrudeIndex = attributeIdx % 4 * 3;
258
- return [extrude[extrudeIndex], extrude[extrudeIndex + 1], extrude[extrudeIndex + 2]];
259
- }
260
- }
261
- });
262
- this.styleAttributeService.registerStyleAttribute({
263
- name: 'size',
264
- type: _l7Core.AttributeType.Attribute,
265
- descriptor: {
266
- name: 'a_Size',
267
- buffer: {
268
- usage: _l7Core.gl.DYNAMIC_DRAW,
269
- data: [],
270
- type: _l7Core.gl.FLOAT
271
- },
272
- size: 1,
273
- update: function update(feature, featureIdx, vertex, attributeIdx) {
274
- var _feature$size = feature.size,
275
- size = _feature$size === void 0 ? 5 : _feature$size;
276
- return Array.isArray(size) ? [size[0] * _this2.meter2coord] : [size * _this2.meter2coord];
277
- }
278
- }
279
- });
280
- this.styleAttributeService.registerStyleAttribute({
281
- name: 'shape',
282
- type: _l7Core.AttributeType.Attribute,
283
- descriptor: {
284
- name: 'a_Shape',
285
- buffer: {
286
- usage: _l7Core.gl.DYNAMIC_DRAW,
287
- data: [],
288
- type: _l7Core.gl.FLOAT
289
- },
290
- size: 1,
291
- update: function update(feature, featureIdx, vertex, attributeIdx) {
292
- var _feature$shape = feature.shape,
293
- shape = _feature$shape === void 0 ? 2 : _feature$shape;
294
-
295
- var shape2d = _this2.layer.getLayerConfig().shape2d;
296
-
297
- var shapeIndex = shape2d.indexOf(shape);
298
- return [shapeIndex];
299
- }
300
- }
301
- });
302
- }
303
- }]);
304
- return FillModel;
305
- }(_BaseModel2.default);
306
-
307
- exports.default = FillModel;
308
- //# sourceMappingURL=tile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/point/models/tile.ts"],"names":["FillModel","layer","getLayerConfig","opacity","strokeOpacity","strokeWidth","stroke","offsets","blend","blur","coord","tileOrigin","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","data","width","height","rowCount","dataTexture","length","createTexture2D","flipY","format","gl","LUMINANCE","type","FLOAT","u_tileOrigin","u_coord","u_isMeter","Number","isMeter","u_blur","u_additive","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_stroke_opacity","u_stroke_width","u_stroke_color","getStrokeColor","u_offsets","isOffsetStatic","styleAttributeService","createAttributesAndIndices","PointFillTriangulation","unit","version","mapService","Version","L7MAP","GLOBEL","calMeter2Coord","buildModels","getSource","extent","minLng","minLat","maxLng","maxLat","center","MAPBOX","window","mapboxgl","MercatorCoordinate","fromLngLat","lng","lat","offsetInMeters","offsetInMercatorCoordinateUnits","meterInMercatorCoordinateUnits","westCoord","x","y","z","westLnglat","toLngLat","meter2coord","m1","meterToCoord","m2","Boolean","mask","maskInside","getShaders","frag","vert","triangulation","buildLayerModel","moduleName","vertexShader","fragmentShader","depth","enable","getBlend","stencil","cull","face","point_tile_frag","point_tile_vert","destroy","registerStyleAttribute","name","AttributeType","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","extrude","extrudeIndex","Array","isArray","shape","shape2d","shapeIndex","indexOf","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAUA;;AACA;;AAEA;;AAKA;;;;;;;;;IACqBA,S;;;;;;;;;;;;;;;8FACU,C;0FACF,K;;;;;;WAC3B,wBAAqC;AACnC,iBAUI,KAAKC,KAAL,CAAWC,cAAX,EAVJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,oCAEEC,aAFF;AAAA,UAEEA,aAFF,mCAEkB,CAFlB;AAAA,kCAGEC,WAHF;AAAA,UAGEA,WAHF,iCAGgB,CAHhB;AAAA,6BAIEC,MAJF;AAAA,UAIEA,MAJF,4BAIW,eAJX;AAAA,8BAKEC,OALF;AAAA,UAKEA,OALF,6BAKY,CAAC,CAAD,EAAI,CAAJ,CALZ;AAAA,UAMEC,KANF,QAMEA,KANF;AAAA,2BAOEC,IAPF;AAAA,UAOEA,IAPF,0BAOS,CAPT;AAAA,4BAQEC,KARF;AAAA,UAQEA,KARF,2BAQU,QARV;AAAA,UASEC,UATF,QASEA,UATF;;AAYA,UACE,KAAKC,eAAL,IACA,KAAKC,qBAAL,CAA2B;AACzBV,QAAAA,OAAO,EAAPA,OADyB;AAEzBC,QAAAA,aAAa,EAAbA,aAFyB;AAGzBC,QAAAA,WAAW,EAAXA,WAHyB;AAIzBC,QAAAA,MAAM,EAANA,MAJyB;AAKzBC,QAAAA,OAAO,EAAPA;AALyB,OAA3B,CAFF,EASE;AAEA,aAAKO,oBAAL,CAA0B;AACxBX,UAAAA,OAAO,EAAPA,OADwB;AAExBC,UAAAA,aAAa,EAAbA,aAFwB;AAGxB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el,\n IModelUniform,\n} from '@antv/l7-core';\nimport { getCullFace, getMask } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { IPointLayerStyleOptions } from '../../core/interface';\nimport { PointFillTriangulation } from '../../core/triangulation';\n\nimport point_tile_frag from '../shaders/tile/fill_tile_frag.glsl';\nimport point_tile_vert from '../shaders/tile/fill_tile_vert.glsl';\n\nimport { Version } from '@antv/l7-maps';\nexport default class FillModel extends BaseModel {\n public meter2coord: number = 1;\n private isMeter: boolean = false;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n strokeOpacity = 1,\n strokeWidth = 0,\n stroke = 'rgba(0,0,0,0)',\n offsets = [0, 0],\n blend,\n blur = 0,\n coord = 'lnglat',\n tileOrigin,\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n\n if (\n this.dataTextureTest &&\n this.dataTextureNeedUpdate({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n })\n ) {\n // 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量\n this.judgeStyleAttributes({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n });\n\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\n u_isMeter: Number(this.isMeter),\n u_blur: blur,\n\n u_additive: blend === 'additive' ? 1.0 : 0.0,\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_opacity: Number(opacity),\n u_stroke_opacity: Number(strokeOpacity),\n u_stroke_width: Number(strokeWidth),\n u_stroke_color: this.getStrokeColor(stroke),\n u_offsets: this.isOffsetStatic(offsets)\n ? (offsets as [number, number])\n : [0, 0],\n };\n }\n\n public getAttribute(): {\n attributes: {\n [attributeName: string]: IAttribute;\n };\n elements: IElements;\n } {\n return this.styleAttributeService.createAttributesAndIndices(\n this.layer.getEncodedData(),\n PointFillTriangulation,\n );\n }\n\n public initModels(): IModel[] {\n const {\n unit = 'l7size',\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n const { version } = this.mapService;\n if (\n unit === 'meter' &&\n version !== Version.L7MAP &&\n version !== Version.GLOBEL\n ) {\n this.isMeter = true;\n this.calMeter2Coord();\n }\n\n return this.buildModels();\n }\n\n /**\n * 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例\n * @returns\n */\n public calMeter2Coord() {\n const [minLng, minLat, maxLng, maxLat] = this.layer.getSource().extent;\n const center = [(minLng + maxLng) / 2, (minLat + maxLat) / 2];\n\n const { version } = this.mapService;\n if (version === Version.MAPBOX && window.mapboxgl.MercatorCoordinate) {\n const coord = window.mapboxgl.MercatorCoordinate.fromLngLat(\n { lng: center[0], lat: center[1] },\n 0,\n );\n const offsetInMeters = 1;\n const offsetInMercatorCoordinateUnits =\n offsetInMeters * coord.meterInMercatorCoordinateUnits();\n const westCoord = new window.mapboxgl.MercatorCoordinate(\n coord.x - offsetInMercatorCoordinateUnits,\n coord.y,\n coord.z,\n );\n const westLnglat = westCoord.toLngLat();\n\n this.meter2coord = center[0] - westLnglat.lng;\n return;\n }\n\n // @ts-ignore\n const m1 = this.mapService.meterToCoord(center, [minLng, minLat]);\n // @ts-ignore\n const m2 = this.mapService.meterToCoord(center, [\n maxLng === minLng ? maxLng + 0.1 : maxLng,\n maxLat === minLat ? minLat + 0.1 : maxLat,\n ]);\n this.meter2coord = (m1 + m2) / 2;\n if (!Boolean(this.meter2coord)) {\n // Tip: 兼容单个数据导致的 m1、m2 为 NaN\n this.meter2coord = 7.70681090738883;\n }\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as Partial<\n ILayerConfig & IPointLayerStyleOptions\n >;\n const { frag, vert, type } = this.getShaders();\n\n this.layer.triangulation = PointFillTriangulation;\n return [\n this.layer.buildLayerModel({\n // primitive: gl.POINTS,\n moduleName: type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: PointFillTriangulation,\n depth: { enable: false },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n cull: {\n enable: true,\n face: getCullFace(this.mapService.version),\n },\n }),\n ];\n }\n\n /**\n * 根据 animateOption 的值返回对应的 shader 代码\n * @returns\n */\n public getShaders(): { frag: string; vert: string; type: string } {\n return {\n frag: point_tile_frag,\n vert: point_tile_vert,\n type: 'point_fill_tile',\n };\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n }\n\n // overwrite baseModel func\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'extrude',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Extrude',\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: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];\n\n const extrudeIndex = (attributeIdx % 4) * 3;\n return [\n extrude[extrudeIndex],\n extrude[extrudeIndex + 1],\n extrude[extrudeIndex + 2],\n ];\n },\n },\n });\n\n // point layer size;\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: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 5 } = feature;\n // console.log('featureIdx', featureIdx, feature)\n return Array.isArray(size)\n ? [size[0] * this.meter2coord]\n : [(size as number) * this.meter2coord];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'shape',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Shape',\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: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { shape = 2 } = feature;\n const shape2d = this.layer.getLayerConfig().shape2d as string[];\n const shapeIndex = shape2d.indexOf(shape as string);\n return [shapeIndex];\n },\n },\n });\n }\n}\n"],"file":"tile.js"}
@@ -1,152 +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 _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
-
16
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
17
-
18
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
19
-
20
- var _l7Core = require("@antv/l7-core");
21
-
22
- var _l7Utils = require("@antv/l7-utils");
23
-
24
- var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
25
-
26
- var _triangulation = require("../../core/triangulation");
27
-
28
- 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); }; }
29
-
30
- 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; } }
31
-
32
- var polygon_tile_frag = "uniform float u_opacity: 1.0;\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n gl_FragColor = v_Color;\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
33
- var polygon_tile_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_opacity: 1.0;\n\nuniform vec2 u_tileOrigin;\nuniform float u_coord;\n\nvarying vec4 v_Color;\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\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\nstyleMappingMat = 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\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 v_Color = a_Color;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n }\n\nif(u_coord > 0.0) {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n} else {\n vec2 pointPos = a_Position.xy;\n vec4 world = 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 world.xy += pointOffset;\n\n if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // Needs to be divided with project_uCommonUnitsPerMeter\n world.w *= u_PixelsPerMeter.z;\n }\n\n gl_Position = u_ViewProjectionMatrix * world + u_ViewportCenterProjection;\n}\n\n\n setPickingColor(a_PickingColor);\n}\n\n";
34
-
35
- var FillModel = function (_BaseModel) {
36
- (0, _inherits2.default)(FillModel, _BaseModel);
37
-
38
- var _super = _createSuper(FillModel);
39
-
40
- function FillModel() {
41
- (0, _classCallCheck2.default)(this, FillModel);
42
- return _super.apply(this, arguments);
43
- }
44
-
45
- (0, _createClass2.default)(FillModel, [{
46
- key: "getUninforms",
47
- value: function getUninforms() {
48
- var _ref = this.layer.getLayerConfig(),
49
- _ref$opacity = _ref.opacity,
50
- opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
51
- tileOrigin = _ref.tileOrigin,
52
- _ref$coord = _ref.coord,
53
- coord = _ref$coord === void 0 ? 'lnglat' : _ref$coord;
54
-
55
- if (this.dataTextureTest && this.dataTextureNeedUpdate({
56
- opacity: opacity
57
- })) {
58
- this.judgeStyleAttributes({
59
- opacity: opacity
60
- });
61
- var encodeData = this.layer.getEncodedData();
62
-
63
- var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
64
- data = _this$calDataFrame.data,
65
- width = _this$calDataFrame.width,
66
- height = _this$calDataFrame.height;
67
-
68
- this.rowCount = height;
69
- this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
70
- flipY: true,
71
- data: data,
72
- format: _l7Core.gl.LUMINANCE,
73
- type: _l7Core.gl.FLOAT,
74
- width: width,
75
- height: height
76
- }) : this.createTexture2D({
77
- flipY: true,
78
- data: [1],
79
- format: _l7Core.gl.LUMINANCE,
80
- type: _l7Core.gl.FLOAT,
81
- width: 1,
82
- height: 1
83
- });
84
- }
85
-
86
- return {
87
- u_tileOrigin: tileOrigin || [0, 0],
88
- u_coord: coord === 'lnglat' ? 1.0 : 0.0,
89
- u_dataTexture: this.dataTexture,
90
- u_cellTypeLayout: this.getCellTypeLayout(),
91
- u_opacity: opacity
92
- };
93
- }
94
- }, {
95
- key: "initModels",
96
- value: function initModels() {
97
- return this.buildModels();
98
- }
99
- }, {
100
- key: "buildModels",
101
- value: function buildModels() {
102
- var _this$getModelParams = this.getModelParams(),
103
- frag = _this$getModelParams.frag,
104
- vert = _this$getModelParams.vert,
105
- triangulation = _this$getModelParams.triangulation,
106
- type = _this$getModelParams.type;
107
-
108
- var _ref2 = this.layer.getLayerConfig(),
109
- _ref2$mask = _ref2.mask,
110
- mask = _ref2$mask === void 0 ? false : _ref2$mask,
111
- _ref2$maskInside = _ref2.maskInside,
112
- maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside;
113
-
114
- this.layer.triangulation = triangulation;
115
- return [this.layer.buildLayerModel({
116
- moduleName: type,
117
- vertexShader: vert,
118
- fragmentShader: frag,
119
- triangulation: triangulation,
120
- blend: this.getBlend(),
121
- depth: {
122
- enable: false
123
- },
124
- stencil: (0, _l7Utils.getMask)(mask, maskInside)
125
- })];
126
- }
127
- }, {
128
- key: "clearModels",
129
- value: function clearModels() {
130
- var _this$dataTexture;
131
-
132
- (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
133
- }
134
- }, {
135
- key: "registerBuiltinAttributes",
136
- value: function registerBuiltinAttributes() {}
137
- }, {
138
- key: "getModelParams",
139
- value: function getModelParams() {
140
- return {
141
- frag: polygon_tile_frag,
142
- vert: polygon_tile_vert,
143
- type: 'polygon_tile',
144
- triangulation: _triangulation.polygonTriangulation
145
- };
146
- }
147
- }]);
148
- return FillModel;
149
- }(_BaseModel2.default);
150
-
151
- exports.default = FillModel;
152
- //# sourceMappingURL=tile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/polygon/models/tile.ts"],"names":["FillModel","layer","getLayerConfig","opacity","tileOrigin","coord","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","data","width","height","rowCount","dataTexture","length","createTexture2D","flipY","format","gl","LUMINANCE","type","FLOAT","u_tileOrigin","u_coord","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","buildModels","getModelParams","frag","vert","triangulation","mask","maskInside","buildLayerModel","moduleName","vertexShader","fragmentShader","blend","getBlend","depth","enable","stencil","destroy","polygon_tile_frag","polygon_tile_vert","polygonTriangulation","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;;;;;;;;IAIqBA,S;;;;;;;;;;;;WACnB,wBAAsB;AACpB,iBAII,KAAKC,KAAL,CAAWC,cAAX,EAJJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,UAEEC,UAFF,QAEEA,UAFF;AAAA,4BAGEC,KAHF;AAAA,UAGEA,KAHF,2BAGU,QAHV;;AAKA,UAAI,KAAKC,eAAL,IAAwB,KAAKC,qBAAL,CAA2B;AAAEJ,QAAAA,OAAO,EAAPA;AAAF,OAA3B,CAA5B,EAAqE;AACnE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,SAAS,EAAE7B;AAPN,OAAP;AASD;;;WAED,sBAA8B;AAC5B,aAAO,KAAK8B,WAAL,EAAP;AACD;;;WAED,uBAA+B;AAC7B,iCAA4C,KAAKC,cAAL,EAA5C;AAAA,UAAQC,IAAR,wBAAQA,IAAR;AAAA,UAAcC,IAAd,wBAAcA,IAAd;AAAA,UAAoBC,aAApB,wBAAoBA,aAApB;AAAA,UAAmCZ,IAAnC,wBAAmCA,IAAnC;;AACA,kBAGI,KAAKxB,KAAL,CAAWC,cAAX,EAHJ;AAAA,6BACEoC,IADF;AAAA,UACEA,IADF,2BACS,KADT;AAAA,mCAEEC,UAFF;AAAA,UAEEA,UAFF,iCAEe,IAFf;;AAIA,WAAKtC,KAAL,CAAWoC,aAAX,GAA2BA,aAA3B;AACA,aAAO,CACL,KAAKpC,KAAL,CAAWuC,eAAX,CAA2B;AACzBC,QAAAA,UAAU,EAAEhB,IADa;AAEzBiB,QAAAA,YAAY,EAAEN,IAFW;AAGzBO,QAAAA,cAAc,EAAER,IAHS;AAIzBE,QAAAA,aAAa,EAAbA,aAJyB;AAKzBO,QAAAA,KAAK,EAAE,KAAKC,QAAL,EALkB;AAMzBC,QAAAA,KAAK,EAAE;AAAEC,UAAAA,MAAM,EAAE;AAAV,SANkB;AAOzBC,QAAAA,OAAO,EAAE,sBAAQV,IAAR,EAAcC,UAAd;AAPgB,OAA3B,CADK,CAAP;AAWD;;;WAED,uBAAqB;AAAA;;AACnB,gCAAKrB,WAAL,wEAAkB+B,OAAlB;AACD;;;WAED,qCAAsC,CAErC;;;WAED,0BAKE;AACA,aAAO;AACLd,QAAAA,IAAI,EAAEe,iBADD;AAELd,QAAAA,IAAI,EAAEe,iBAFD;AAGL1B,QAAAA,IAAI,EAAE,cAHD;AAILY,QAAAA,aAAa,EAAEe;AAJV,OAAP;AAMD;;;EA3FoCC,mB","sourcesContent":["import { gl, IModel, Triangulation } from '@antv/l7-core';\nimport { getMask } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { IPolygonLayerStyleOptions } from '../../core/interface';\nimport { polygonTriangulation } from '../../core/triangulation';\n\nimport polygon_tile_frag from '../shaders/tile/polygon_tile_frag.glsl';\nimport polygon_tile_vert from '../shaders/tile/polygon_tile_vert.glsl';\nexport default class FillModel extends BaseModel {\n public getUninforms() {\n const {\n opacity = 1,\n tileOrigin,\n coord = 'lnglat',\n } = this.layer.getLayerConfig() as IPolygonLayerStyleOptions;\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\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_opacity: opacity,\n };\n }\n\n public initModels(): IModel[] {\n return this.buildModels();\n }\n\n public buildModels(): IModel[] {\n const { frag, vert, triangulation, type } = this.getModelParams();\n const {\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as IPolygonLayerStyleOptions;\n this.layer.triangulation = triangulation;\n return [\n this.layer.buildLayerModel({\n moduleName: type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation,\n blend: this.getBlend(),\n depth: { enable: false },\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n }\n\n protected registerBuiltinAttributes() {\n //\n }\n\n private getModelParams(): {\n frag: string;\n vert: string;\n type: string;\n triangulation: Triangulation;\n } {\n return {\n frag: polygon_tile_frag,\n vert: polygon_tile_vert,\n type: 'polygon_tile',\n triangulation: polygonTriangulation,\n };\n }\n}\n"],"file":"tile.js"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"interface.js"}