@antv/l7-layers 2.9.15 → 2.9.16

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 +4 -2
  3. package/es/core/BaseLayer.js +47 -21
  4. package/es/core/BaseLayer.js.map +1 -1
  5. package/es/core/BaseModel.d.ts +2 -1
  6. package/es/core/BaseModel.js +3 -0
  7. package/es/core/BaseModel.js.map +1 -1
  8. package/es/core/interface.d.ts +14 -1
  9. package/es/core/interface.js.map +1 -1
  10. package/es/image/models/image.js.map +1 -1
  11. package/es/line/index.d.ts +1 -1
  12. package/es/line/index.js +13 -1
  13. package/es/line/index.js.map +1 -1
  14. package/es/line/models/earthArc_3d.d.ts +17 -0
  15. package/es/line/models/earthArc_3d.js +311 -0
  16. package/es/line/models/earthArc_3d.js.map +1 -0
  17. package/es/line/models/half.d.ts +18 -0
  18. package/es/line/models/half.js +244 -0
  19. package/es/line/models/half.js.map +1 -0
  20. package/es/line/models/index.d.ts +1 -1
  21. package/es/line/models/index.js +9 -1
  22. package/es/line/models/index.js.map +1 -1
  23. package/es/line/models/tile.d.ts +20 -0
  24. package/es/line/models/tile.js +327 -0
  25. package/es/line/models/tile.js.map +1 -0
  26. package/es/plugins/DataMappingPlugin.js +1 -1
  27. package/es/plugins/DataMappingPlugin.js.map +1 -1
  28. package/es/plugins/DataSourcePlugin.js +7 -6
  29. package/es/plugins/DataSourcePlugin.js.map +1 -1
  30. package/es/plugins/FeatureScalePlugin.js +35 -9
  31. package/es/plugins/FeatureScalePlugin.js.map +1 -1
  32. package/es/plugins/ShaderUniformPlugin.js +3 -1
  33. package/es/plugins/ShaderUniformPlugin.js.map +1 -1
  34. package/es/point/index.d.ts +1 -1
  35. package/es/point/index.js +10 -2
  36. package/es/point/index.js.map +1 -1
  37. package/es/point/models/earthExtrude.d.ts +24 -0
  38. package/es/point/models/earthExtrude.js +259 -0
  39. package/es/point/models/earthExtrude.js.map +1 -0
  40. package/es/point/models/earthFill.d.ts +20 -0
  41. package/es/point/models/earthFill.js +255 -0
  42. package/es/point/models/earthFill.js.map +1 -0
  43. package/es/point/models/extrude.d.ts +0 -1
  44. package/es/point/models/extrude.js +2 -10
  45. package/es/point/models/extrude.js.map +1 -1
  46. package/es/point/models/fill.d.ts +8 -1
  47. package/es/point/models/fill.js +55 -75
  48. package/es/point/models/fill.js.map +1 -1
  49. package/es/point/models/index.d.ts +1 -1
  50. package/es/point/models/index.js +9 -1
  51. package/es/point/models/index.js.map +1 -1
  52. package/es/point/models/radar.js +2 -6
  53. package/es/point/models/radar.js.map +1 -1
  54. package/es/point/models/tile.d.ts +31 -0
  55. package/es/point/models/tile.js +291 -0
  56. package/es/point/models/tile.js.map +1 -0
  57. package/es/polygon/index.js +6 -0
  58. package/es/polygon/index.js.map +1 -1
  59. package/es/polygon/models/index.d.ts +1 -1
  60. package/es/polygon/models/index.js +5 -1
  61. package/es/polygon/models/index.js.map +1 -1
  62. package/es/polygon/models/tile.d.ts +16 -0
  63. package/es/polygon/models/tile.js +137 -0
  64. package/es/polygon/models/tile.js.map +1 -0
  65. package/es/raster/index.d.ts +2 -2
  66. package/es/raster/index.js +4 -4
  67. package/es/raster/index.js.map +1 -1
  68. package/es/raster/models/index.js +1 -1
  69. package/es/raster/models/index.js.map +1 -1
  70. package/es/raster/models/raster.d.ts +2 -0
  71. package/es/raster/models/raster.js +24 -12
  72. package/es/raster/models/raster.js.map +1 -1
  73. package/es/tile/interface.d.ts +28 -0
  74. package/es/tile/interface.js +2 -0
  75. package/es/tile/interface.js.map +1 -0
  76. package/es/tile/manager/tileConfigManager.d.ts +17 -0
  77. package/es/tile/manager/tileConfigManager.js +123 -0
  78. package/es/tile/manager/tileConfigManager.js.map +1 -0
  79. package/es/tile/manager/tileLayerManager.d.ts +35 -0
  80. package/es/tile/manager/tileLayerManager.js +297 -0
  81. package/es/tile/manager/tileLayerManager.js.map +1 -0
  82. package/es/tile/manager/tilePickerManager.d.ts +21 -0
  83. package/es/tile/manager/tilePickerManager.js +189 -0
  84. package/es/tile/manager/tilePickerManager.js.map +1 -0
  85. package/es/tile/models/tileModel.d.ts +8 -0
  86. package/es/tile/models/tileModel.js +61 -0
  87. package/es/tile/models/tileModel.js.map +1 -0
  88. package/es/tile/tileFactory/base.d.ts +44 -0
  89. package/es/tile/tileFactory/base.js +423 -0
  90. package/es/tile/tileFactory/base.js.map +1 -0
  91. package/es/tile/tileFactory/index.d.ts +5 -0
  92. package/es/tile/tileFactory/index.js +30 -0
  93. package/es/tile/tileFactory/index.js.map +1 -0
  94. package/es/tile/tileFactory/line.d.ts +12 -0
  95. package/es/tile/tileFactory/line.js +65 -0
  96. package/es/tile/tileFactory/line.js.map +1 -0
  97. package/es/tile/tileFactory/point.d.ts +12 -0
  98. package/es/tile/tileFactory/point.js +65 -0
  99. package/es/tile/tileFactory/point.js.map +1 -0
  100. package/es/tile/tileFactory/polygon.d.ts +12 -0
  101. package/es/tile/tileFactory/polygon.js +65 -0
  102. package/es/tile/tileFactory/polygon.js.map +1 -0
  103. package/es/tile/tileFactory/raster.d.ts +12 -0
  104. package/es/tile/tileFactory/raster.js +61 -0
  105. package/es/tile/tileFactory/raster.js.map +1 -0
  106. package/es/tile/tileFactory/rasterData.d.ts +12 -0
  107. package/es/tile/tileFactory/rasterData.js +86 -0
  108. package/es/tile/tileFactory/rasterData.js.map +1 -0
  109. package/es/tile/tileFactory/rasterDataLayer.d.ts +19 -0
  110. package/es/{core/LayerGroup.js → tile/tileFactory/rasterDataLayer.js} +39 -32
  111. package/es/tile/tileFactory/rasterDataLayer.js.map +1 -0
  112. package/es/tile/tileFactory/vectorLayer.d.ts +27 -0
  113. package/es/tile/tileFactory/vectorLayer.js +131 -0
  114. package/es/tile/tileFactory/vectorLayer.js.map +1 -0
  115. package/es/tile/tileLayer/baseTileLayer.d.ts +47 -0
  116. package/es/tile/tileLayer/baseTileLayer.js +409 -0
  117. package/es/tile/tileLayer/baseTileLayer.js.map +1 -0
  118. package/es/tile/tmsTileLayer.d.ts +7 -0
  119. package/es/tile/tmsTileLayer.js +100 -0
  120. package/es/tile/tmsTileLayer.js.map +1 -0
  121. package/es/tile/utils.d.ts +11 -0
  122. package/es/tile/utils.js +125 -0
  123. package/es/tile/utils.js.map +1 -0
  124. package/lib/core/BaseLayer.js +45 -20
  125. package/lib/core/BaseLayer.js.map +1 -1
  126. package/lib/core/BaseModel.js +2 -0
  127. package/lib/core/BaseModel.js.map +1 -1
  128. package/lib/core/interface.js.map +1 -1
  129. package/lib/image/models/image.js.map +1 -1
  130. package/lib/line/index.js +13 -1
  131. package/lib/line/index.js.map +1 -1
  132. package/lib/line/models/earthArc_3d.js +328 -0
  133. package/lib/line/models/earthArc_3d.js.map +1 -0
  134. package/lib/line/models/half.js +260 -0
  135. package/lib/line/models/half.js.map +1 -0
  136. package/lib/line/models/index.js +13 -1
  137. package/lib/line/models/index.js.map +1 -1
  138. package/lib/line/models/tile.js +342 -0
  139. package/lib/line/models/tile.js.map +1 -0
  140. package/lib/plugins/DataMappingPlugin.js +1 -1
  141. package/lib/plugins/DataMappingPlugin.js.map +1 -1
  142. package/lib/plugins/DataSourcePlugin.js +7 -6
  143. package/lib/plugins/DataSourcePlugin.js.map +1 -1
  144. package/lib/plugins/FeatureScalePlugin.js +35 -9
  145. package/lib/plugins/FeatureScalePlugin.js.map +1 -1
  146. package/lib/plugins/ShaderUniformPlugin.js +3 -1
  147. package/lib/plugins/ShaderUniformPlugin.js.map +1 -1
  148. package/lib/point/index.js +10 -2
  149. package/lib/point/index.js.map +1 -1
  150. package/lib/point/models/earthExtrude.js +277 -0
  151. package/lib/point/models/earthExtrude.js.map +1 -0
  152. package/lib/point/models/earthFill.js +291 -0
  153. package/lib/point/models/earthFill.js.map +1 -0
  154. package/lib/point/models/extrude.js +2 -11
  155. package/lib/point/models/extrude.js.map +1 -1
  156. package/lib/point/models/fill.js +51 -93
  157. package/lib/point/models/fill.js.map +1 -1
  158. package/lib/point/models/index.js +13 -1
  159. package/lib/point/models/index.js.map +1 -1
  160. package/lib/point/models/radar.js +1 -5
  161. package/lib/point/models/radar.js.map +1 -1
  162. package/lib/point/models/tile.js +308 -0
  163. package/lib/point/models/tile.js.map +1 -0
  164. package/lib/polygon/index.js +6 -0
  165. package/lib/polygon/index.js.map +1 -1
  166. package/lib/polygon/models/index.js +7 -1
  167. package/lib/polygon/models/index.js.map +1 -1
  168. package/lib/polygon/models/tile.js +152 -0
  169. package/lib/polygon/models/tile.js.map +1 -0
  170. package/lib/raster/index.js +4 -4
  171. package/lib/raster/index.js.map +1 -1
  172. package/lib/raster/models/index.js +2 -2
  173. package/lib/raster/models/index.js.map +1 -1
  174. package/lib/raster/models/raster.js +24 -12
  175. package/lib/raster/models/raster.js.map +1 -1
  176. package/lib/tile/interface.js +2 -0
  177. package/lib/tile/interface.js.map +1 -0
  178. package/lib/tile/manager/tileConfigManager.js +134 -0
  179. package/lib/tile/manager/tileConfigManager.js.map +1 -0
  180. package/lib/tile/manager/tileLayerManager.js +305 -0
  181. package/lib/tile/manager/tileLayerManager.js.map +1 -0
  182. package/lib/tile/manager/tilePickerManager.js +195 -0
  183. package/lib/tile/manager/tilePickerManager.js.map +1 -0
  184. package/lib/tile/models/tileModel.js +73 -0
  185. package/lib/tile/models/tileModel.js.map +1 -0
  186. package/lib/tile/tileFactory/base.js +436 -0
  187. package/lib/tile/tileFactory/base.js.map +1 -0
  188. package/lib/tile/tileFactory/index.js +60 -0
  189. package/lib/tile/tileFactory/index.js.map +1 -0
  190. package/lib/tile/tileFactory/line.js +76 -0
  191. package/lib/tile/tileFactory/line.js.map +1 -0
  192. package/lib/tile/tileFactory/point.js +76 -0
  193. package/lib/tile/tileFactory/point.js.map +1 -0
  194. package/lib/tile/tileFactory/polygon.js +76 -0
  195. package/lib/tile/tileFactory/polygon.js.map +1 -0
  196. package/lib/tile/tileFactory/raster.js +74 -0
  197. package/lib/tile/tileFactory/raster.js.map +1 -0
  198. package/lib/tile/tileFactory/rasterData.js +99 -0
  199. package/lib/tile/tileFactory/rasterData.js.map +1 -0
  200. package/lib/{core/LayerGroup.js → tile/tileFactory/rasterDataLayer.js} +40 -32
  201. package/lib/tile/tileFactory/rasterDataLayer.js.map +1 -0
  202. package/lib/tile/tileFactory/vectorLayer.js +145 -0
  203. package/lib/tile/tileFactory/vectorLayer.js.map +1 -0
  204. package/lib/tile/tileLayer/baseTileLayer.js +407 -0
  205. package/lib/tile/tileLayer/baseTileLayer.js.map +1 -0
  206. package/lib/tile/tmsTileLayer.js +116 -0
  207. package/lib/tile/tmsTileLayer.js.map +1 -0
  208. package/lib/tile/utils.js +147 -0
  209. package/lib/tile/utils.js.map +1 -0
  210. package/package.json +8 -6
  211. package/es/core/LayerGroup.d.ts +0 -9
  212. package/es/core/LayerGroup.js.map +0 -1
  213. package/es/raster/models/raste-tile.d.ts +0 -23
  214. package/es/raster/models/raste-tile.js +0 -285
  215. package/es/raster/models/raste-tile.js.map +0 -1
  216. package/lib/core/LayerGroup.js.map +0 -1
  217. package/lib/raster/models/raste-tile.js +0 -294
  218. package/lib/raster/models/raste-tile.js.map +0 -1
@@ -0,0 +1,244 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _inherits from "@babel/runtime/helpers/inherits";
4
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
+ import _isNumber from "lodash/isNumber";
7
+
8
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
+
10
+ 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; } }
11
+
12
+ import { AttributeType, gl } from '@antv/l7-core';
13
+ import { getMask, rgb2arr } from '@antv/l7-utils';
14
+ import BaseModel from '../../core/BaseModel';
15
+ import { LineTriangulation } from '../../core/triangulation';
16
+ var line_half_frag = "#define COORDINATE_SYSTEM_LNGLAT 1.0 // mapbox\n#define COORDINATE_SYSTEM_LNGLAT_OFFSET 2.0 // mapbox offset\n#define COORDINATE_SYSTEM_VECTOR_TILE 3.0\n#define COORDINATE_SYSTEM_IDENTITY 4.0\n#define COORDINATE_SYSTEM_P20 5.0 // amap\n#define COORDINATE_SYSTEM_P20_OFFSET 6.0 // amap offset\n#define COORDINATE_SYSTEM_METER_OFFSET 7.0\n\n#define COORDINATE_SYSTEM_P20_2 8.0 // amap2.0\nuniform float u_CoordinateSystem;\nvarying vec4 v_color;\nuniform float u_arrow: 0.0;\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n#pragma include \"picking\"\n\nvarying mat4 styleMappingMat;\nvoid main() {\n float distanceAndIndex = styleMappingMat[0][3];\n float miter = styleMappingMat[0][2];\n\n float opacity = styleMappingMat[0][0];\n float d_distance_ratio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n\n\n if(u_arrow > 0.0 && distanceAndIndex < 2.0) { // arrow\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) { \n if(cross(vec3(styleMappingMat[1].rg, 0.0), vec3(styleMappingMat[1].ba, 0.0)).z < 0.0) { // amap\n discard;\n }\n } else { // amap2 mapbox map\n if(cross(vec3(styleMappingMat[1].rg, 0.0), vec3(styleMappingMat[1].ba, 0.0)).z > 0.0) { \n discard;\n }\n }\n } else { // line body\n if(miter < 0.0) {\n discard;\n }\n }\n\n\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, d_distance_ratio);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n gl_FragColor = v_color;\n }\n\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
17
+ var line_half_vert = "attribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\n// dash line\nattribute vec4 a_dirPoints;\nattribute vec3 a_DistanceAndIndex;\n\nuniform vec4 u_lineDir;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\n\nuniform float u_linearColor: 0;\nuniform float u_arrow: 0.0;\nuniform float u_arrowHeight: 3.0;\nuniform float u_arrowWidth: 2.0;\nuniform float u_tailWidth: 1.0;\n\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\nvec2 calculateArrow(vec2 offset) {\n /*\n * \u5728\u652F\u6301\u7BAD\u5934\u7684\u65F6\u5019\uFF0C\u7B2C\u4E8C\u3001\u7B2C\u4E09\u7EC4\u9876\u70B9\u662F\u989D\u5916\u63D2\u5165\u7528\u4E8E\u6784\u5EFA\u9876\u70B9\u7684\n */\n float arrowFlag = -1.0;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n // \u9AD8\u5FB7 2.0 \u7684\u65CB\u8F6C\u89D2\u5EA6\u4E0D\u540C\n arrowFlag = 1.0;\n }\n float pi = arrowFlag * 3.1415926/2.;\n if(a_Miter < 0.) {\n // \u6839\u636E\u7EBF\u7684\u4E24\u4FA7\u504F\u79FB\u4E0D\u540C\u3001\u65CB\u8F6C\u7684\u65B9\u5411\u76F8\u53CD\n pi = -pi;\n }\n highp float angle_sin = sin(pi);\n highp float angle_cos = cos(pi);\n // \u8BA1\u7B97\u5782\u76F4\u4E0E\u7EBF\u65B9\u5411\u7684\u65CB\u8F6C\u77E9\u9635\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n float arrowWidth = u_arrowWidth;\n float arrowHeight = u_arrowHeight;\n\n vec2 arrowOffset = vec2(0.0);\n /*\n * a_DistanceAndIndex.y \u7528\u4E8E\u6807\u8BB0\u5F53\u524D\u9876\u70B9\u5C5E\u4E8E\u54EA\u4E00\u7EC4\uFF08\u4E24\u4E2A\u9876\u70B9\u4E00\u7EC4\uFF0C\u6784\u6210\u7EBF\u7684\u5176\u5B9E\u662F\u77E9\u5F62\uFF0C\u6700\u7B80\u9700\u8981\u56DB\u4E2A\u9876\u70B9\u3001\u4E24\u7EC4\u9876\u70B9\u6784\u6210\uFF09\n */\n if(a_DistanceAndIndex.y == 0.0) {\n // \u7BAD\u5934\u5C16\u90E8\n offset = vec2(0.0);\n } else if(a_DistanceAndIndex.y == 1.0) {\n // \u7BAD\u5934\u4E24\u4FA7\n arrowOffset = rotation_matrix*(offset * arrowHeight);\n offset += arrowOffset; // \u6CBF\u7EBF\u504F\u79FB\n offset = offset * arrowWidth; // \u5782\u76F4\u7EBF\u5411\u5916\u504F\u79FB\uFF08\u662F\u6784\u5EFA\u7BAD\u5934\u4E24\u4FA7\u7684\u9876\u70B9\uFF09\n } else if(a_DistanceAndIndex.y == 2.0 || a_DistanceAndIndex.y == 3.0 || a_DistanceAndIndex.y == 4.0) {\n // \u504F\u79FB\u5176\u4F59\u7684\u70B9\u4F4D\uFF08\u5C06\u957F\u5EA6\u8BA9\u4F4D\u7ED9\u7BAD\u5934\uFF09\n arrowOffset = rotation_matrix*(offset * arrowHeight) * arrowWidth;\n offset += arrowOffset;// \u6CBF\u7EBF\u504F\u79FB\n }\n\n return offset;\n}\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - a_Miter - a_DistanceAndIndex\n 0.0, 0.0, 0.0, 0.0, // originX - originY - vectorX - vectorY\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV\n );\n styleMappingMat[0][3] = a_DistanceAndIndex.y;\n styleMappingMat[0][2] = a_Miter;\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\n v_color = a_Color;\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n // styleMappingMat[1].rg = a_Position.xy + offset;\n\n vec2 copyOffset = vec2(offset.x, offset.y);\n\n float lineDistance = a_DistanceAndIndex.x;\n float total_Distance = a_DistanceAndIndex.z;\n float currentLinePointRatio = lineDistance / total_Distance;\n \n if(u_arrow > 0.0) {\n // \u8BA1\u7B97\u7BAD\u5934\n offset = calculateArrow(offset);\n\n if(a_DistanceAndIndex.y > 4.0) {\n offset *= mix(1.0, u_tailWidth, currentLinePointRatio);\n }\n }\n\n float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\uFF08\u5411\u4E24\u4FA7\u504F\u79FB\u7684\u548C\uFF09\n float linePixelSize = project_pixel(a_Size.x) * 2.0; // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB \u5355\u4FA7 * 2\n\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = currentLinePointRatio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n styleMappingMat[3][1] = lineDistance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n float h = float(a_Position.z); // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5 vertex height\n float lineHeight = a_Size.y; // size \u7B2C\u4E8C\u4E2A\u53C2\u6570\u4EE3\u8868\u7684\u9AD8\u5EA6 [linewidth, lineheight]\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n lineHeight *= 0.2; // \u4FDD\u6301\u548C amap/mapbox \u4E00\u81F4\u7684\u6548\u679C\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight, 1.0));\n }\n \n if(u_arrow > 0.0 && a_DistanceAndIndex.y < 2.0) {\n vec2 startPoint = a_dirPoints.rg;\n vec2 endPoint = a_dirPoints.ba;\n vec4 t1 = project_position(vec4(startPoint, 0, 1.0));\n vec4 t2 = project_position(vec4(endPoint, 0, 1.0));\n // TODO\uFF1A \u540E\u7EED\u4F18\u5316\u53EF\u4EE5\u628A\u4F4D\u7F6E\u8BA1\u7B97\u653E\u5728 cpu \u4E2D\u5B8C\u6210\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n vec2 p1 = (u_Mvp * vec4(t1.xy, 0.0, 1.0)).xy;\n vec2 p2 = (u_Mvp * vec4(t2.xy, 0.0, 1.0)).xy;\n styleMappingMat[1].rg = normalize(p1 - p2);\n styleMappingMat[1].ba = normalize(gl_Position.xy - p2);\n } else {\n vec2 p1 = project_common_position_to_clipspace(vec4(t1.xy, 0.0, 1.0)).xy;\n vec2 p2 = project_common_position_to_clipspace(vec4(t2.xy, 0.0, 1.0)).xy;\n styleMappingMat[1].rg = normalize(p1 - p2);\n styleMappingMat[1].ba = normalize(gl_Position.xy - p2);\n }\n }\n\n setPickingColor(a_PickingColor);\n}\n";
18
+
19
+ var LineModel = function (_BaseModel) {
20
+ _inherits(LineModel, _BaseModel);
21
+
22
+ var _super = _createSuper(LineModel);
23
+
24
+ function LineModel() {
25
+ _classCallCheck(this, LineModel);
26
+
27
+ return _super.apply(this, arguments);
28
+ }
29
+
30
+ _createClass(LineModel, [{
31
+ key: "getUninforms",
32
+ value: function getUninforms() {
33
+ var _ref = this.layer.getLayerConfig(),
34
+ _ref$opacity = _ref.opacity,
35
+ opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
36
+ sourceColor = _ref.sourceColor,
37
+ targetColor = _ref.targetColor,
38
+ _ref$arrow = _ref.arrow,
39
+ arrow = _ref$arrow === void 0 ? {
40
+ enable: false,
41
+ arrowWidth: 2,
42
+ arrowHeight: 3,
43
+ tailWidth: 1
44
+ } : _ref$arrow;
45
+
46
+ var useLinearColor = 0;
47
+ var sourceColorArr = [0, 0, 0, 0];
48
+ var targetColorArr = [0, 0, 0, 0];
49
+
50
+ if (sourceColor && targetColor) {
51
+ sourceColorArr = rgb2arr(sourceColor);
52
+ targetColorArr = rgb2arr(targetColor);
53
+ useLinearColor = 1;
54
+ }
55
+
56
+ if (this.dataTextureTest && this.dataTextureNeedUpdate({
57
+ opacity: opacity
58
+ })) {
59
+ this.judgeStyleAttributes({
60
+ opacity: opacity
61
+ });
62
+ var encodeData = this.layer.getEncodedData();
63
+
64
+ var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
65
+ data = _this$calDataFrame.data,
66
+ width = _this$calDataFrame.width,
67
+ height = _this$calDataFrame.height;
68
+
69
+ this.rowCount = height;
70
+ this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
71
+ flipY: true,
72
+ data: data,
73
+ format: gl.LUMINANCE,
74
+ type: gl.FLOAT,
75
+ width: width,
76
+ height: height
77
+ }) : this.createTexture2D({
78
+ flipY: true,
79
+ data: [1],
80
+ format: gl.LUMINANCE,
81
+ type: gl.FLOAT,
82
+ width: 1,
83
+ height: 1
84
+ });
85
+ }
86
+
87
+ return {
88
+ u_dataTexture: this.dataTexture,
89
+ u_cellTypeLayout: this.getCellTypeLayout(),
90
+ u_opacity: _isNumber(opacity) ? opacity : 1.0,
91
+ u_linearColor: useLinearColor,
92
+ u_sourceColor: sourceColorArr,
93
+ u_targetColor: targetColorArr,
94
+ u_arrow: Number(arrow.enable),
95
+ u_arrowHeight: arrow.arrowHeight || 3,
96
+ u_arrowWidth: arrow.arrowWidth || 2,
97
+ u_tailWidth: arrow.tailWidth === undefined ? 1 : arrow.tailWidth
98
+ };
99
+ }
100
+ }, {
101
+ key: "initModels",
102
+ value: function initModels() {
103
+ return this.buildModels();
104
+ }
105
+ }, {
106
+ key: "clearModels",
107
+ value: function clearModels() {
108
+ var _this$dataTexture;
109
+
110
+ (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
111
+ }
112
+ }, {
113
+ key: "buildModels",
114
+ value: function buildModels() {
115
+ var _ref2 = this.layer.getLayerConfig(),
116
+ _ref2$mask = _ref2.mask,
117
+ mask = _ref2$mask === void 0 ? false : _ref2$mask,
118
+ _ref2$maskInside = _ref2.maskInside,
119
+ maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside,
120
+ _ref2$depth = _ref2.depth,
121
+ depth = _ref2$depth === void 0 ? false : _ref2$depth;
122
+
123
+ var _this$getShaders = this.getShaders(),
124
+ frag = _this$getShaders.frag,
125
+ vert = _this$getShaders.vert;
126
+
127
+ this.layer.triangulation = LineTriangulation;
128
+ return [this.layer.buildLayerModel({
129
+ moduleName: 'line_half',
130
+ vertexShader: vert,
131
+ fragmentShader: frag,
132
+ triangulation: LineTriangulation,
133
+ primitive: gl.TRIANGLES,
134
+ blend: this.getBlend(),
135
+ depth: {
136
+ enable: depth
137
+ },
138
+ stencil: getMask(mask, maskInside)
139
+ })];
140
+ }
141
+ }, {
142
+ key: "getShaders",
143
+ value: function getShaders() {
144
+ return {
145
+ frag: line_half_frag,
146
+ vert: line_half_vert,
147
+ type: 'normal'
148
+ };
149
+ }
150
+ }, {
151
+ key: "registerBuiltinAttributes",
152
+ value: function registerBuiltinAttributes() {
153
+ this.styleAttributeService.registerStyleAttribute({
154
+ name: 'distanceAndIndex',
155
+ type: AttributeType.Attribute,
156
+ descriptor: {
157
+ name: 'a_DistanceAndIndex',
158
+ buffer: {
159
+ usage: gl.STATIC_DRAW,
160
+ data: [],
161
+ type: gl.FLOAT
162
+ },
163
+ size: 3,
164
+ update: function update(feature, featureIdx, vertex, attributeIdx, normal, vertexIndex) {
165
+ return vertexIndex === undefined ? [vertex[3], 10, vertex[5]] : [vertex[3], vertexIndex, vertex[5]];
166
+ }
167
+ }
168
+ });
169
+ this.styleAttributeService.registerStyleAttribute({
170
+ name: 'dirPoints',
171
+ type: AttributeType.Attribute,
172
+ descriptor: {
173
+ name: 'a_dirPoints',
174
+ buffer: {
175
+ usage: gl.STATIC_DRAW,
176
+ data: [],
177
+ type: gl.FLOAT
178
+ },
179
+ size: 4,
180
+ update: function update(feature, featureIdx, vertex, attributeIdx) {
181
+ var startPoint = feature.coordinates[0] || [0, 0];
182
+ var endPoint = feature.coordinates[3] || [0, 0];
183
+ return [startPoint[0], startPoint[1], endPoint[0], endPoint[1]];
184
+ }
185
+ }
186
+ });
187
+ this.styleAttributeService.registerStyleAttribute({
188
+ name: 'size',
189
+ type: AttributeType.Attribute,
190
+ descriptor: {
191
+ name: 'a_Size',
192
+ buffer: {
193
+ usage: gl.DYNAMIC_DRAW,
194
+ data: [],
195
+ type: gl.FLOAT
196
+ },
197
+ size: 2,
198
+ update: function update(feature, featureIdx, vertex, attributeIdx) {
199
+ var _feature$size = feature.size,
200
+ size = _feature$size === void 0 ? 1 : _feature$size;
201
+ return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
202
+ }
203
+ }
204
+ });
205
+ this.styleAttributeService.registerStyleAttribute({
206
+ name: 'normal',
207
+ type: AttributeType.Attribute,
208
+ descriptor: {
209
+ name: 'a_Normal',
210
+ buffer: {
211
+ usage: gl.STATIC_DRAW,
212
+ data: [],
213
+ type: gl.FLOAT
214
+ },
215
+ size: 3,
216
+ update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
217
+ return normal;
218
+ }
219
+ }
220
+ });
221
+ this.styleAttributeService.registerStyleAttribute({
222
+ name: 'miter',
223
+ type: AttributeType.Attribute,
224
+ descriptor: {
225
+ name: 'a_Miter',
226
+ buffer: {
227
+ usage: gl.STATIC_DRAW,
228
+ data: [],
229
+ type: gl.FLOAT
230
+ },
231
+ size: 1,
232
+ update: function update(feature, featureIdx, vertex, attributeIdx) {
233
+ return [vertex[4]];
234
+ }
235
+ }
236
+ });
237
+ }
238
+ }]);
239
+
240
+ return LineModel;
241
+ }(BaseModel);
242
+
243
+ export { LineModel as default };
244
+ //# sourceMappingURL=half.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/line/models/half.ts"],"names":["AttributeType","gl","getMask","rgb2arr","BaseModel","LineTriangulation","LineModel","layer","getLayerConfig","opacity","sourceColor","targetColor","arrow","enable","arrowWidth","arrowHeight","tailWidth","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","data","width","height","rowCount","dataTexture","length","createTexture2D","flipY","format","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_linearColor","u_sourceColor","u_targetColor","u_arrow","Number","u_arrowHeight","u_arrowWidth","u_tailWidth","undefined","buildModels","destroy","mask","maskInside","depth","getShaders","frag","vert","triangulation","buildLayerModel","moduleName","vertexShader","fragmentShader","primitive","TRIANGLES","blend","getBlend","stencil","line_half_frag","line_half_vert","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","normal","vertexIndex","startPoint","co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IAAI,EAAEtC,aAAa,CAAC4E,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,UADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAE9E,EAAE,CAAC+E,WAFJ;AAGNpD,YAAAA,IAAI,EAAE,EAHA;AAINU,YAAAA,IAAI,EAAErC,EAAE,CAACsC;AAJH,WAFE;AAQV0C,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKNC,MALM,EAMH;AACH,mBAAOA,MAAP;AACD;AAjBS;AAHoC,OAAlD;AAwBA,WAAKd,qBAAL,CAA2BC,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,OAD0C;AAEhDrC,QAAAA,IAAI,EAAEtC,aAAa,CAAC4E,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,SADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAE9E,EAAE,CAAC+E,WAFJ;AAGNpD,YAAAA,IAAI,EAAE,EAHA;AAINU,YAAAA,IAAI,EAAErC,EAAE,CAACsC;AAJH,WAFE;AAQV0C,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,mBAAO,CAACD,MAAM,CAAC,CAAD,CAAP,CAAP;AACD;AAhBS;AAHoC,OAAlD;AAsBD;;;;EA9OoCjF,S;;SAAlBE,S","sourcesContent":["import {\n AttributeType,\n gl,\n IEncodeFeature,\n IModel,\n IModelUniform,\n} from '@antv/l7-core';\nimport { getMask, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\nimport line_half_frag from '../shaders/half/line_half_frag.glsl';\nimport line_half_vert from '../shaders/half/line_half_vert.glsl';\n\nexport default class LineModel extends BaseModel {\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n arrow = {\n enable: false,\n arrowWidth: 2,\n arrowHeight: 3,\n tailWidth: 1,\n },\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n\n // arrow\n u_arrow: Number(arrow.enable),\n u_arrowHeight: arrow.arrowHeight || 3,\n u_arrowWidth: arrow.arrowWidth || 2,\n u_tailWidth: arrow.tailWidth === undefined ? 1 : arrow.tailWidth,\n };\n }\n\n public initModels(): IModel[] {\n return this.buildModels();\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n depth = false,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const { frag, vert } = this.getShaders();\n this.layer.triangulation = LineTriangulation;\n return [\n this.layer.buildLayerModel({\n moduleName: 'line_half',\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: LineTriangulation,\n primitive: gl.TRIANGLES,\n blend: this.getBlend(),\n depth: { enable: depth },\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n\n /**\n * 根据参数获取不同的 shader 代码\n * @returns\n */\n public getShaders(): { frag: string; vert: string; type: string } {\n return {\n frag: line_half_frag,\n vert: line_half_vert,\n type: 'normal',\n };\n }\n\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distanceAndIndex',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_DistanceAndIndex',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n vertexIndex?: number,\n ) => {\n return vertexIndex === undefined\n ? [vertex[3], 10, vertex[5]]\n : [vertex[3], vertexIndex, vertex[5]];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'dirPoints',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_dirPoints',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 4,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n // console.log(feature)\n const startPoint = (feature.coordinates[0] || [0, 0]) as number[];\n const endPoint = (feature.coordinates[3] || [0, 0]) as number[];\n\n return [startPoint[0], startPoint[1], endPoint[0], endPoint[1]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'normal',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Normal',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n ) => {\n return normal;\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'miter',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Miter',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[4]];\n },\n },\n });\n }\n}\n"],"file":"half.js"}
@@ -1,4 +1,4 @@
1
- export declare type LineModelType = 'arc' | 'arcmini' | 'arc3d' | 'greatcircle' | 'wall' | 'simple' | 'line' | 'linearline';
1
+ export declare type LineModelType = 'arc' | 'arcmini' | 'arc3d' | 'greatcircle' | 'wall' | 'simple' | 'line' | 'halfLine' | 'linearline' | 'vectorline' | 'tileLine' | 'earthArc3d';
2
2
  declare const LineModels: {
3
3
  [key in LineModelType]: any;
4
4
  };
@@ -1,10 +1,14 @@
1
+ import LineTileModel from '../../tile/models/tileModel';
1
2
  import ArcModel from './arc';
2
3
  import Arc3DModel from './arc_3d';
3
4
  import ArcMiniModel from './arcmini';
5
+ import EarthArc3DModel from './earthArc_3d';
4
6
  import GreatCircleModel from './great_circle';
7
+ import LineHalfModel from './half';
5
8
  import LineModel from './line';
6
9
  import LinearLine from './linearline';
7
10
  import SimpleLineModel from './simpleLine';
11
+ import TileLineModel from './tile';
8
12
  import LineWallModel from './wall';
9
13
  var LineModels = {
10
14
  arc: ArcModel,
@@ -13,8 +17,12 @@ var LineModels = {
13
17
  greatcircle: GreatCircleModel,
14
18
  wall: LineWallModel,
15
19
  line: LineModel,
20
+ halfLine: LineHalfModel,
16
21
  simple: SimpleLineModel,
17
- linearline: LinearLine
22
+ linearline: LinearLine,
23
+ vectorline: LineTileModel,
24
+ tileLine: TileLineModel,
25
+ earthArc3d: EarthArc3DModel
18
26
  };
19
27
  export default LineModels;
20
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/line/models/index.ts"],"names":["ArcModel","Arc3DModel","ArcMiniModel","GreatCircleModel","LineModel","LinearLine","SimpleLineModel","LineWallModel","LineModels","arc","arcmini","arc3d","greatcircle","wall","line","simple","linearline"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,OAArB;AACA,OAAOC,UAAP,MAAuB,UAAvB;AACA,OAAOC,YAAP,MAAyB,WAAzB;AACA,OAAOC,gBAAP,MAA6B,gBAA7B;AACA,OAAOC,SAAP,MAAsB,QAAtB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,eAAP,MAA4B,cAA5B;AACA,OAAOC,aAAP,MAA0B,QAA1B;AAYA,IAAMC,UAA2C,GAAG;AAClDC,EAAAA,GAAG,EAAET,QAD6C;AAElDU,EAAAA,OAAO,EAAER,YAFyC;AAGlDS,EAAAA,KAAK,EAAEV,UAH2C;AAIlDW,EAAAA,WAAW,EAAET,gBAJqC;AAKlDU,EAAAA,IAAI,EAAEN,aAL4C;AAMlDO,EAAAA,IAAI,EAAEV,SAN4C;AAOlDW,EAAAA,MAAM,EAAET,eAP0C;AAQlDU,EAAAA,UAAU,EAAEX;AARsC,CAApD;AAWA,eAAeG,UAAf","sourcesContent":["import ArcModel from './arc';\nimport Arc3DModel from './arc_3d';\nimport ArcMiniModel from './arcmini';\nimport GreatCircleModel from './great_circle';\nimport LineModel from './line';\nimport LinearLine from './linearline';\nimport SimpleLineModel from './simpleLine';\nimport LineWallModel from './wall';\n\nexport type LineModelType =\n | 'arc'\n | 'arcmini'\n | 'arc3d'\n | 'greatcircle'\n | 'wall'\n | 'simple'\n | 'line'\n | 'linearline';\n\nconst LineModels: { [key in LineModelType]: any } = {\n arc: ArcModel,\n arcmini: ArcMiniModel,\n arc3d: Arc3DModel,\n greatcircle: GreatCircleModel,\n wall: LineWallModel,\n line: LineModel,\n simple: SimpleLineModel,\n linearline: LinearLine,\n};\n\nexport default LineModels;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../src/line/models/index.ts"],"names":["LineTileModel","ArcModel","Arc3DModel","ArcMiniModel","EarthArc3DModel","GreatCircleModel","LineHalfModel","LineModel","LinearLine","SimpleLineModel","TileLineModel","LineWallModel","LineModels","arc","arcmini","arc3d","greatcircle","wall","line","halfLine","simple","linearline","vectorline","tileLine","earthArc3d"],"mappings":"AAAA,OAAOA,aAAP,MAA0B,6BAA1B;AACA,OAAOC,QAAP,MAAqB,OAArB;AACA,OAAOC,UAAP,MAAuB,UAAvB;AACA,OAAOC,YAAP,MAAyB,WAAzB;AACA,OAAOC,eAAP,MAA4B,eAA5B;AACA,OAAOC,gBAAP,MAA6B,gBAA7B;AACA,OAAOC,aAAP,MAA0B,QAA1B;AACA,OAAOC,SAAP,MAAsB,QAAtB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,eAAP,MAA4B,cAA5B;AACA,OAAOC,aAAP,MAA0B,QAA1B;AACA,OAAOC,aAAP,MAA0B,QAA1B;AAgBA,IAAMC,UAA2C,GAAG;AAClDC,EAAAA,GAAG,EAAEZ,QAD6C;AAElDa,EAAAA,OAAO,EAAEX,YAFyC;AAGlDY,EAAAA,KAAK,EAAEb,UAH2C;AAIlDc,EAAAA,WAAW,EAAEX,gBAJqC;AAKlDY,EAAAA,IAAI,EAAEN,aAL4C;AAMlDO,EAAAA,IAAI,EAAEX,SAN4C;AAOlDY,EAAAA,QAAQ,EAAEb,aAPwC;AAQlDc,EAAAA,MAAM,EAAEX,eAR0C;AASlDY,EAAAA,UAAU,EAAEb,UATsC;AAUlDc,EAAAA,UAAU,EAAEtB,aAVsC;AAWlDuB,EAAAA,QAAQ,EAAEb,aAXwC;AAYlDc,EAAAA,UAAU,EAAEpB;AAZsC,CAApD;AAeA,eAAeQ,UAAf","sourcesContent":["import LineTileModel from '../../tile/models/tileModel';\nimport ArcModel from './arc';\nimport Arc3DModel from './arc_3d';\nimport ArcMiniModel from './arcmini';\nimport EarthArc3DModel from './earthArc_3d';\nimport GreatCircleModel from './great_circle';\nimport LineHalfModel from './half';\nimport LineModel from './line';\nimport LinearLine from './linearline';\nimport SimpleLineModel from './simpleLine';\nimport TileLineModel from './tile';\nimport LineWallModel from './wall';\n\nexport type LineModelType =\n | 'arc'\n | 'arcmini'\n | 'arc3d'\n | 'greatcircle'\n | 'wall'\n | 'simple'\n | 'line'\n | 'halfLine'\n | 'linearline'\n | 'vectorline'\n | 'tileLine'\n | 'earthArc3d';\n\nconst LineModels: { [key in LineModelType]: any } = {\n arc: ArcModel,\n arcmini: ArcMiniModel,\n arc3d: Arc3DModel,\n greatcircle: GreatCircleModel,\n wall: LineWallModel,\n line: LineModel,\n halfLine: LineHalfModel,\n simple: SimpleLineModel,\n linearline: LinearLine,\n vectorline: LineTileModel,\n tileLine: TileLineModel,\n earthArc3d: EarthArc3DModel,\n};\n\nexport default LineModels;\n"],"file":"index.js"}
@@ -0,0 +1,20 @@
1
+ import { IModel, IModelUniform, ITexture2D } from '@antv/l7-core';
2
+ import BaseModel from '../../core/BaseModel';
3
+ export default class LineModel extends BaseModel {
4
+ protected texture: ITexture2D;
5
+ getUninforms(): IModelUniform;
6
+ initModels(): IModel[];
7
+ clearModels(): void;
8
+ buildModels(): IModel[];
9
+ /**
10
+ * 根据参数获取不同的 shader 代码
11
+ * @returns
12
+ */
13
+ getShaders(): {
14
+ frag: string;
15
+ vert: string;
16
+ type: string;
17
+ };
18
+ protected registerBuiltinAttributes(): void;
19
+ private updateTexture;
20
+ }