@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,255 +0,0 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
- import _createClass from "@babel/runtime/helpers/createClass";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _isNumber from "lodash/isNumber";
9
-
10
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
-
12
- 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; } }
13
-
14
- import { AttributeType, gl } from '@antv/l7-core';
15
- import BaseModel from '../../core/BaseModel';
16
- import { GlobelPointFillTriangulation } from '../../core/triangulation';
17
- var pointFillFrag = "uniform float u_additive;\n\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\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 if(outer_df > antialiasblur + 0.018) discard;\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";
18
- var pointFillVert = "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;\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\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n /*\n * setPickingSize \u8BBE\u7F6E\u62FE\u53D6\u5927\u5C0F\n */\n float newSize = setPickingSize(a_Size);\n // float newSize = setPickingSize(a_Size) * 0.00001038445708445579;\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 // cal style mapping\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // radius(16-bit)\n v_radius = newSize;\n\n // TODO: billboard\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur);\n\n // TODP: /abs(extrude.x) \u662F\u4E3A\u4E86\u517C\u5BB9\u5730\u7403\u6A21\u5F0F\n v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);\n\n\n gl_Position = u_ViewProjectionMatrix * vec4(a_Position + extrude * newSize * 0.1, 1.0);\n\n setPickingColor(a_PickingColor);\n}\n";
19
- import { mat4, vec3 } from 'gl-matrix';
20
-
21
- var FillModel = function (_BaseModel) {
22
- _inherits(FillModel, _BaseModel);
23
-
24
- var _super = _createSuper(FillModel);
25
-
26
- function FillModel() {
27
- _classCallCheck(this, FillModel);
28
-
29
- return _super.apply(this, arguments);
30
- }
31
-
32
- _createClass(FillModel, [{
33
- key: "getUninforms",
34
- value: function getUninforms() {
35
- var _ref = this.layer.getLayerConfig(),
36
- _ref$opacity = _ref.opacity,
37
- opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
38
- _ref$strokeOpacity = _ref.strokeOpacity,
39
- strokeOpacity = _ref$strokeOpacity === void 0 ? 1 : _ref$strokeOpacity,
40
- _ref$strokeWidth = _ref.strokeWidth,
41
- strokeWidth = _ref$strokeWidth === void 0 ? 0 : _ref$strokeWidth,
42
- _ref$stroke = _ref.stroke,
43
- stroke = _ref$stroke === void 0 ? 'rgba(0,0,0,0)' : _ref$stroke,
44
- _ref$offsets = _ref.offsets,
45
- offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets,
46
- blend = _ref.blend,
47
- _ref$blur = _ref.blur,
48
- blur = _ref$blur === void 0 ? 0 : _ref$blur;
49
-
50
- if (this.dataTextureTest && this.dataTextureNeedUpdate({
51
- opacity: opacity,
52
- strokeOpacity: strokeOpacity,
53
- strokeWidth: strokeWidth,
54
- stroke: stroke,
55
- offsets: offsets
56
- })) {
57
- this.judgeStyleAttributes({
58
- opacity: opacity,
59
- strokeOpacity: strokeOpacity,
60
- strokeWidth: strokeWidth,
61
- stroke: stroke,
62
- offsets: offsets
63
- });
64
- var encodeData = this.layer.getEncodedData();
65
-
66
- var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
67
- data = _this$calDataFrame.data,
68
- width = _this$calDataFrame.width,
69
- height = _this$calDataFrame.height;
70
-
71
- this.rowCount = height;
72
- this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
73
- flipY: true,
74
- data: data,
75
- format: gl.LUMINANCE,
76
- type: gl.FLOAT,
77
- width: width,
78
- height: height
79
- }) : this.createTexture2D({
80
- flipY: true,
81
- data: [1],
82
- format: gl.LUMINANCE,
83
- type: gl.FLOAT,
84
- width: 1,
85
- height: 1
86
- });
87
- }
88
-
89
- return {
90
- u_blur: blur,
91
- u_additive: blend === 'additive' ? 1.0 : 0.0,
92
- u_dataTexture: this.dataTexture,
93
- u_cellTypeLayout: this.getCellTypeLayout(),
94
- u_opacity: _isNumber(opacity) ? opacity : 1.0,
95
- u_stroke_opacity: _isNumber(strokeOpacity) ? strokeOpacity : 1.0,
96
- u_stroke_width: _isNumber(strokeWidth) ? strokeWidth : 1.0,
97
- u_stroke_color: this.getStrokeColor(stroke),
98
- u_offsets: this.isOffsetStatic(offsets) ? offsets : [0, 0]
99
- };
100
- }
101
- }, {
102
- key: "getAnimateUniforms",
103
- value: function getAnimateUniforms() {
104
- var _ref2 = this.layer.getLayerConfig(),
105
- _ref2$animateOption = _ref2.animateOption,
106
- animateOption = _ref2$animateOption === void 0 ? {
107
- enable: false
108
- } : _ref2$animateOption;
109
-
110
- return {
111
- u_aimate: this.animateOption2Array(animateOption),
112
- u_time: this.layer.getLayerAnimateTime()
113
- };
114
- }
115
- }, {
116
- key: "initModels",
117
- value: function initModels() {
118
- return this.buildModels();
119
- }
120
- }, {
121
- key: "buildModels",
122
- value: function buildModels() {
123
- var _this$getShaders = this.getShaders(),
124
- frag = _this$getShaders.frag,
125
- vert = _this$getShaders.vert,
126
- type = _this$getShaders.type;
127
-
128
- this.layer.triangulation = GlobelPointFillTriangulation;
129
- return [this.layer.buildLayerModel({
130
- moduleName: 'pointfill_' + type,
131
- vertexShader: vert,
132
- fragmentShader: frag,
133
- triangulation: GlobelPointFillTriangulation,
134
- depth: {
135
- enable: true
136
- },
137
- blend: this.getBlend()
138
- })];
139
- }
140
- }, {
141
- key: "getShaders",
142
- value: function getShaders() {
143
- return {
144
- frag: pointFillFrag,
145
- vert: pointFillVert,
146
- type: 'point_earth_fill'
147
- };
148
- }
149
- }, {
150
- key: "clearModels",
151
- value: function clearModels() {
152
- var _this$dataTexture;
153
-
154
- (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
155
- }
156
- }, {
157
- key: "animateOption2Array",
158
- value: function animateOption2Array(option) {
159
- return [option.enable ? 0 : 1.0, option.speed || 1, option.rings || 3, 0];
160
- }
161
- }, {
162
- key: "registerBuiltinAttributes",
163
- value: function registerBuiltinAttributes() {
164
- var _this = this;
165
-
166
- this.styleAttributeService.registerStyleAttribute({
167
- name: 'extrude',
168
- type: AttributeType.Attribute,
169
- descriptor: {
170
- name: 'a_Extrude',
171
- buffer: {
172
- usage: gl.DYNAMIC_DRAW,
173
- data: [],
174
- type: gl.FLOAT
175
- },
176
- size: 3,
177
- update: function update(feature, featureIdx, vertex, attributeIdx) {
178
- var _vertex = _slicedToArray(vertex, 3),
179
- x = _vertex[0],
180
- y = _vertex[1],
181
- z = _vertex[2];
182
-
183
- var n1 = vec3.fromValues(0, 0, 1);
184
- var n2 = vec3.fromValues(x, 0, z);
185
- var xzReg = x >= 0 ? vec3.angle(n1, n2) : Math.PI * 2 - vec3.angle(n1, n2);
186
- var yReg = Math.PI * 2 - Math.asin(y / 100);
187
- var m = mat4.create();
188
- mat4.rotateY(m, m, xzReg);
189
- mat4.rotateX(m, m, yReg);
190
- var v1 = vec3.fromValues(1, 1, 0);
191
- vec3.transformMat4(v1, v1, m);
192
- vec3.normalize(v1, v1);
193
- var v2 = vec3.fromValues(-1, 1, 0);
194
- vec3.transformMat4(v2, v2, m);
195
- vec3.normalize(v2, v2);
196
- var v3 = vec3.fromValues(-1, -1, 0);
197
- vec3.transformMat4(v3, v3, m);
198
- vec3.normalize(v3, v3);
199
- var v4 = vec3.fromValues(1, -1, 0);
200
- vec3.transformMat4(v4, v4, m);
201
- vec3.normalize(v4, v4);
202
- var extrude = [].concat(_toConsumableArray(v1), _toConsumableArray(v2), _toConsumableArray(v3), _toConsumableArray(v4));
203
- var extrudeIndex = attributeIdx % 4 * 3;
204
- return [extrude[extrudeIndex], extrude[extrudeIndex + 1], extrude[extrudeIndex + 2]];
205
- }
206
- }
207
- });
208
- this.styleAttributeService.registerStyleAttribute({
209
- name: 'size',
210
- type: AttributeType.Attribute,
211
- descriptor: {
212
- name: 'a_Size',
213
- buffer: {
214
- usage: gl.DYNAMIC_DRAW,
215
- data: [],
216
- type: gl.FLOAT
217
- },
218
- size: 1,
219
- update: function update(feature, featureIdx, vertex, attributeIdx) {
220
- var _feature$size = feature.size,
221
- size = _feature$size === void 0 ? 5 : _feature$size;
222
- return Array.isArray(size) ? [size[0]] : [size];
223
- }
224
- }
225
- });
226
- this.styleAttributeService.registerStyleAttribute({
227
- name: 'shape',
228
- type: AttributeType.Attribute,
229
- descriptor: {
230
- name: 'a_Shape',
231
- buffer: {
232
- usage: gl.DYNAMIC_DRAW,
233
- data: [],
234
- type: gl.FLOAT
235
- },
236
- size: 1,
237
- update: function update(feature, featureIdx, vertex, attributeIdx) {
238
- var _feature$shape = feature.shape,
239
- shape = _feature$shape === void 0 ? 2 : _feature$shape;
240
-
241
- var shape2d = _this.layer.getLayerConfig().shape2d;
242
-
243
- var shapeIndex = shape2d.indexOf(shape);
244
- return [shapeIndex];
245
- }
246
- }
247
- });
248
- }
249
- }]);
250
-
251
- return FillModel;
252
- }(BaseModel);
253
-
254
- export { FillModel as default };
255
- //# sourceMappingURL=earthFill.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/point/models/earthFill.ts"],"names":["AttributeType","gl","BaseModel","GlobelPointFillTriangulation","mat4","vec3","FillModel","layer","getLayerConfig","opacity","strokeOpacity","strokeWidth","stroke","offsets","blend","blur","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","data","width","height","rowCount","dataTexture","length","createTexture2D","flipY","format","LUMINANCE","type","FLOAT","u_blur","u_additive","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_stroke_opacity","u_stroke_width","u_stroke_color","getStrokeColor","u_offsets","isOffsetStatic","animateOption","enable","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","buildModels","getShaders","frag","vert","triangulation","buildLayerModel","moduleName","vertexShader","fragmentShader","depth","getBlend","pointFillFrag","pointFillVert","destroy","option","speed","rings","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","x","y","z","n1","fromValues","n2","xzReg","angle","Math","PI","yReg","asin","m","create","rotateY","rotateX","v1","transformMat4","normalize","v2","v3","v4","extrude","extrudeIndex","Array","isArray","shape","shape2d","shapeIndex","indexOf"],"mappings":";;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAQO,eARP;AAUA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,4BAAT,QAA6C,0BAA7C;;;AAKA,SAASC,IAAT,EAA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V4C,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,iCAAsBH,OAAtB,CAAQ8B,KAAR;AAAA,gBAAQA,KAAR,+BAAgB,CAAhB;;AACA,gBAAMC,OAAO,GAAG,KAAI,CAACzG,KAAL,CAAWC,cAAX,GAA4BwG,OAA5C;;AACA,gBAAMC,UAAU,GAAGD,OAAO,CAACE,OAAR,CAAgBH,KAAhB,CAAnB;AACA,mBAAO,CAACE,UAAD,CAAP;AACD;AAnBS;AAHoC,OAAlD;AAyBD;;;;EAxOoC/G,S;;SAAlBI,S","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IEncodeFeature,\n ILayerConfig,\n IModel,\n IModelUniform,\n} from '@antv/l7-core';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { IPointLayerStyleOptions } from '../../core/interface';\nimport { GlobelPointFillTriangulation } from '../../core/triangulation';\n\nimport pointFillFrag from '../shaders/earth/fill_frag.glsl';\nimport pointFillVert from '../shaders/earth/fill_vert.glsl';\n\nimport { mat4, vec3 } from 'gl-matrix';\nexport default class FillModel extends BaseModel {\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 } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\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_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: isNumber(opacity) ? opacity : 1.0,\n u_stroke_opacity: isNumber(strokeOpacity) ? strokeOpacity : 1.0,\n u_stroke_width: isNumber(strokeWidth) ? strokeWidth : 1.0,\n u_stroke_color: this.getStrokeColor(stroke),\n u_offsets: this.isOffsetStatic(offsets)\n ? (offsets as [number, number])\n : [0, 0],\n };\n }\n public getAnimateUniforms(): IModelUniform {\n const {\n animateOption = { enable: false },\n } = this.layer.getLayerConfig() as ILayerConfig;\n return {\n u_aimate: this.animateOption2Array(animateOption),\n u_time: this.layer.getLayerAnimateTime(),\n };\n }\n\n public initModels(): IModel[] {\n return this.buildModels();\n }\n\n public buildModels(): IModel[] {\n const { frag, vert, type } = this.getShaders();\n this.layer.triangulation = GlobelPointFillTriangulation;\n return [\n this.layer.buildLayerModel({\n moduleName: 'pointfill_' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: GlobelPointFillTriangulation,\n depth: { enable: true },\n blend: this.getBlend(),\n }),\n ];\n }\n\n /**\n * 根据 animateOption 的值返回对应的 shader 代码\n * @returns\n */\n public getShaders(): { frag: string; vert: string; type: string } {\n return {\n frag: pointFillFrag,\n vert: pointFillVert,\n type: 'point_earth_fill',\n };\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n }\n\n // overwrite baseModel func\n protected animateOption2Array(option: Partial<IAnimateOption>): number[] {\n return [option.enable ? 0 : 1.0, option.speed || 1, option.rings || 3, 0];\n }\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 [x, y, z] = vertex;\n const n1 = vec3.fromValues(0, 0, 1);\n const n2 = vec3.fromValues(x, 0, z);\n\n const xzReg =\n x >= 0 ? vec3.angle(n1, n2) : Math.PI * 2 - vec3.angle(n1, n2);\n\n const yReg = Math.PI * 2 - Math.asin(y / 100);\n\n const m = mat4.create();\n mat4.rotateY(m, m, xzReg);\n mat4.rotateX(m, m, yReg);\n\n const v1 = vec3.fromValues(1, 1, 0);\n vec3.transformMat4(v1, v1, m);\n vec3.normalize(v1, v1);\n\n const v2 = vec3.fromValues(-1, 1, 0);\n vec3.transformMat4(v2, v2, m);\n vec3.normalize(v2, v2);\n\n const v3 = vec3.fromValues(-1, -1, 0);\n vec3.transformMat4(v3, v3, m);\n vec3.normalize(v3, v3);\n\n const v4 = vec3.fromValues(1, -1, 0);\n vec3.transformMat4(v4, v4, m);\n vec3.normalize(v4, v4);\n\n const extrude = [...v1, ...v2, ...v3, ...v4];\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 return Array.isArray(size) ? [size[0]] : [size as number];\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":"earthFill.js"}
@@ -1,31 +0,0 @@
1
- import { IAttribute, IElements, IModel, IModelUniform } from '@antv/l7-core';
2
- import BaseModel from '../../core/BaseModel';
3
- export default class FillModel extends BaseModel {
4
- meter2coord: number;
5
- private isMeter;
6
- getUninforms(): IModelUniform;
7
- getAttribute(): {
8
- attributes: {
9
- [attributeName: string]: IAttribute;
10
- };
11
- elements: IElements;
12
- };
13
- initModels(): IModel[];
14
- /**
15
- * 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例
16
- * @returns
17
- */
18
- calMeter2Coord(): void;
19
- buildModels(): IModel[];
20
- /**
21
- * 根据 animateOption 的值返回对应的 shader 代码
22
- * @returns
23
- */
24
- getShaders(): {
25
- frag: string;
26
- vert: string;
27
- type: string;
28
- };
29
- clearModels(): void;
30
- protected registerBuiltinAttributes(): void;
31
- }
@@ -1,291 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
-
10
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
-
12
- 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; } }
13
-
14
- import { AttributeType, gl } from '@antv/l7-core';
15
- import { getCullFace, getMask } from '@antv/l7-utils';
16
- import BaseModel from '../../core/BaseModel';
17
- import { PointFillTriangulation } from '../../core/triangulation';
18
- 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";
19
- 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";
20
- import { Version } from '@antv/l7-maps';
21
-
22
- var FillModel = function (_BaseModel) {
23
- _inherits(FillModel, _BaseModel);
24
-
25
- var _super = _createSuper(FillModel);
26
-
27
- function FillModel() {
28
- var _this;
29
-
30
- _classCallCheck(this, FillModel);
31
-
32
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
33
- args[_key] = arguments[_key];
34
- }
35
-
36
- _this = _super.call.apply(_super, [this].concat(args));
37
-
38
- _defineProperty(_assertThisInitialized(_this), "meter2coord", 1);
39
-
40
- _defineProperty(_assertThisInitialized(_this), "isMeter", false);
41
-
42
- return _this;
43
- }
44
-
45
- _createClass(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
- _ref$strokeOpacity = _ref.strokeOpacity,
52
- strokeOpacity = _ref$strokeOpacity === void 0 ? 1 : _ref$strokeOpacity,
53
- _ref$strokeWidth = _ref.strokeWidth,
54
- strokeWidth = _ref$strokeWidth === void 0 ? 0 : _ref$strokeWidth,
55
- _ref$stroke = _ref.stroke,
56
- stroke = _ref$stroke === void 0 ? 'rgba(0,0,0,0)' : _ref$stroke,
57
- _ref$offsets = _ref.offsets,
58
- offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets,
59
- blend = _ref.blend,
60
- _ref$blur = _ref.blur,
61
- blur = _ref$blur === void 0 ? 0 : _ref$blur,
62
- _ref$coord = _ref.coord,
63
- coord = _ref$coord === void 0 ? 'lnglat' : _ref$coord,
64
- tileOrigin = _ref.tileOrigin;
65
-
66
- if (this.dataTextureTest && this.dataTextureNeedUpdate({
67
- opacity: opacity,
68
- strokeOpacity: strokeOpacity,
69
- strokeWidth: strokeWidth,
70
- stroke: stroke,
71
- offsets: offsets
72
- })) {
73
- this.judgeStyleAttributes({
74
- opacity: opacity,
75
- strokeOpacity: strokeOpacity,
76
- strokeWidth: strokeWidth,
77
- stroke: stroke,
78
- offsets: offsets
79
- });
80
- var encodeData = this.layer.getEncodedData();
81
-
82
- var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
83
- data = _this$calDataFrame.data,
84
- width = _this$calDataFrame.width,
85
- height = _this$calDataFrame.height;
86
-
87
- this.rowCount = height;
88
- this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
89
- flipY: true,
90
- data: data,
91
- format: gl.LUMINANCE,
92
- type: gl.FLOAT,
93
- width: width,
94
- height: height
95
- }) : this.createTexture2D({
96
- flipY: true,
97
- data: [1],
98
- format: gl.LUMINANCE,
99
- type: gl.FLOAT,
100
- width: 1,
101
- height: 1
102
- });
103
- }
104
-
105
- return {
106
- u_tileOrigin: tileOrigin || [0, 0],
107
- u_coord: coord === 'lnglat' ? 1.0 : 0.0,
108
- u_isMeter: Number(this.isMeter),
109
- u_blur: blur,
110
- u_additive: blend === 'additive' ? 1.0 : 0.0,
111
- u_dataTexture: this.dataTexture,
112
- u_cellTypeLayout: this.getCellTypeLayout(),
113
- u_opacity: Number(opacity),
114
- u_stroke_opacity: Number(strokeOpacity),
115
- u_stroke_width: Number(strokeWidth),
116
- u_stroke_color: this.getStrokeColor(stroke),
117
- u_offsets: this.isOffsetStatic(offsets) ? offsets : [0, 0]
118
- };
119
- }
120
- }, {
121
- key: "getAttribute",
122
- value: function getAttribute() {
123
- return this.styleAttributeService.createAttributesAndIndices(this.layer.getEncodedData(), PointFillTriangulation);
124
- }
125
- }, {
126
- key: "initModels",
127
- value: function initModels() {
128
- var _ref2 = this.layer.getLayerConfig(),
129
- _ref2$unit = _ref2.unit,
130
- unit = _ref2$unit === void 0 ? 'l7size' : _ref2$unit;
131
-
132
- var version = this.mapService.version;
133
-
134
- if (unit === 'meter' && version !== Version.L7MAP && version !== Version.GLOBEL) {
135
- this.isMeter = true;
136
- this.calMeter2Coord();
137
- }
138
-
139
- return this.buildModels();
140
- }
141
- }, {
142
- key: "calMeter2Coord",
143
- value: function calMeter2Coord() {
144
- var _this$layer$getSource = _slicedToArray(this.layer.getSource().extent, 4),
145
- minLng = _this$layer$getSource[0],
146
- minLat = _this$layer$getSource[1],
147
- maxLng = _this$layer$getSource[2],
148
- maxLat = _this$layer$getSource[3];
149
-
150
- var center = [(minLng + maxLng) / 2, (minLat + maxLat) / 2];
151
- var version = this.mapService.version;
152
-
153
- if (version === Version.MAPBOX && window.mapboxgl.MercatorCoordinate) {
154
- var coord = window.mapboxgl.MercatorCoordinate.fromLngLat({
155
- lng: center[0],
156
- lat: center[1]
157
- }, 0);
158
- var offsetInMeters = 1;
159
- var offsetInMercatorCoordinateUnits = offsetInMeters * coord.meterInMercatorCoordinateUnits();
160
- var westCoord = new window.mapboxgl.MercatorCoordinate(coord.x - offsetInMercatorCoordinateUnits, coord.y, coord.z);
161
- var westLnglat = westCoord.toLngLat();
162
- this.meter2coord = center[0] - westLnglat.lng;
163
- return;
164
- }
165
-
166
- var m1 = this.mapService.meterToCoord(center, [minLng, minLat]);
167
- var m2 = this.mapService.meterToCoord(center, [maxLng === minLng ? maxLng + 0.1 : maxLng, maxLat === minLat ? minLat + 0.1 : maxLat]);
168
- this.meter2coord = (m1 + m2) / 2;
169
-
170
- if (!Boolean(this.meter2coord)) {
171
- this.meter2coord = 7.70681090738883;
172
- }
173
- }
174
- }, {
175
- key: "buildModels",
176
- value: function buildModels() {
177
- var _ref3 = this.layer.getLayerConfig(),
178
- _ref3$mask = _ref3.mask,
179
- mask = _ref3$mask === void 0 ? false : _ref3$mask,
180
- _ref3$maskInside = _ref3.maskInside,
181
- maskInside = _ref3$maskInside === void 0 ? true : _ref3$maskInside;
182
-
183
- var _this$getShaders = this.getShaders(),
184
- frag = _this$getShaders.frag,
185
- vert = _this$getShaders.vert,
186
- type = _this$getShaders.type;
187
-
188
- this.layer.triangulation = PointFillTriangulation;
189
- return [this.layer.buildLayerModel({
190
- moduleName: type,
191
- vertexShader: vert,
192
- fragmentShader: frag,
193
- triangulation: PointFillTriangulation,
194
- depth: {
195
- enable: false
196
- },
197
- blend: this.getBlend(),
198
- stencil: getMask(mask, maskInside),
199
- cull: {
200
- enable: true,
201
- face: getCullFace(this.mapService.version)
202
- }
203
- })];
204
- }
205
- }, {
206
- key: "getShaders",
207
- value: function getShaders() {
208
- return {
209
- frag: point_tile_frag,
210
- vert: point_tile_vert,
211
- type: 'point_fill_tile'
212
- };
213
- }
214
- }, {
215
- key: "clearModels",
216
- value: function clearModels() {
217
- var _this$dataTexture;
218
-
219
- (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
220
- }
221
- }, {
222
- key: "registerBuiltinAttributes",
223
- value: function registerBuiltinAttributes() {
224
- var _this2 = this;
225
-
226
- this.styleAttributeService.registerStyleAttribute({
227
- name: 'extrude',
228
- type: AttributeType.Attribute,
229
- descriptor: {
230
- name: 'a_Extrude',
231
- buffer: {
232
- usage: gl.DYNAMIC_DRAW,
233
- data: [],
234
- type: gl.FLOAT
235
- },
236
- size: 3,
237
- update: function update(feature, featureIdx, vertex, attributeIdx) {
238
- var extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];
239
- var extrudeIndex = attributeIdx % 4 * 3;
240
- return [extrude[extrudeIndex], extrude[extrudeIndex + 1], extrude[extrudeIndex + 2]];
241
- }
242
- }
243
- });
244
- this.styleAttributeService.registerStyleAttribute({
245
- name: 'size',
246
- type: AttributeType.Attribute,
247
- descriptor: {
248
- name: 'a_Size',
249
- buffer: {
250
- usage: gl.DYNAMIC_DRAW,
251
- data: [],
252
- type: gl.FLOAT
253
- },
254
- size: 1,
255
- update: function update(feature, featureIdx, vertex, attributeIdx) {
256
- var _feature$size = feature.size,
257
- size = _feature$size === void 0 ? 5 : _feature$size;
258
- return Array.isArray(size) ? [size[0] * _this2.meter2coord] : [size * _this2.meter2coord];
259
- }
260
- }
261
- });
262
- this.styleAttributeService.registerStyleAttribute({
263
- name: 'shape',
264
- type: AttributeType.Attribute,
265
- descriptor: {
266
- name: 'a_Shape',
267
- buffer: {
268
- usage: gl.DYNAMIC_DRAW,
269
- data: [],
270
- type: gl.FLOAT
271
- },
272
- size: 1,
273
- update: function update(feature, featureIdx, vertex, attributeIdx) {
274
- var _feature$shape = feature.shape,
275
- shape = _feature$shape === void 0 ? 2 : _feature$shape;
276
-
277
- var shape2d = _this2.layer.getLayerConfig().shape2d;
278
-
279
- var shapeIndex = shape2d.indexOf(shape);
280
- return [shapeIndex];
281
- }
282
- }
283
- });
284
- }
285
- }]);
286
-
287
- return FillModel;
288
- }(BaseModel);
289
-
290
- export { FillModel as default };
291
- //# sourceMappingURL=tile.js.map