@antv/l7-layers 2.9.23 → 2.9.25

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 (166) hide show
  1. package/es/Geometry/models/plane.d.ts +1 -0
  2. package/es/citybuliding/building.js +1 -1
  3. package/es/core/BaseLayer.js +10 -3
  4. package/es/core/interface.d.ts +26 -48
  5. package/es/core/interface.js +3 -0
  6. package/es/core/schema.d.ts +3 -3
  7. package/es/core/triangulation.d.ts +4 -3
  8. package/es/core/triangulation.js +54 -39
  9. package/es/heatmap/models/heatmap.js +1 -1
  10. package/es/image/models/image.js +7 -1
  11. package/es/line/index.js +4 -1
  12. package/es/line/models/arc.js +1 -1
  13. package/es/line/models/simpleLine.js +1 -1
  14. package/es/line/shaders/line_arc_vert.glsl +5 -3
  15. package/es/line/shaders/simple/simpleline_vert.glsl +1 -0
  16. package/es/plugins/FeatureScalePlugin.js +0 -1
  17. package/es/point/index.js +3 -1
  18. package/es/point/models/fill.js +5 -2
  19. package/es/point/models/fillmage.js +9 -3
  20. package/es/point/models/image.js +8 -2
  21. package/es/point/models/radar.js +2 -3
  22. package/es/point/models/tile.js +1 -1
  23. package/es/point/shaders/fill_vert.glsl +13 -6
  24. package/es/point/shaders/image/fillImage_vert.glsl +13 -5
  25. package/es/point/shaders/image_vert.glsl +17 -8
  26. package/es/polygon/index.js +4 -1
  27. package/es/raster/index.js +3 -1
  28. package/es/tile/manager/tileLayerManager.d.ts +3 -2
  29. package/es/tile/manager/tileLayerManager.js +5 -2
  30. package/es/tile/models/tileModel.js +4 -3
  31. package/es/tile/tileFactory/base.d.ts +1 -1
  32. package/es/tile/tileFactory/base.js +32 -5
  33. package/es/tile/tileFactory/vectorLayer.d.ts +3 -1
  34. package/es/tile/tileFactory/vectorLayer.js +22 -1
  35. package/es/tile/tileLayer/baseTileLayer.d.ts +1 -1
  36. package/es/tile/tileLayer/baseTileLayer.js +3 -2
  37. package/es/tile/utils.d.ts +2 -0
  38. package/es/tile/utils.js +5 -1
  39. package/lib/Geometry/index.js +114 -77
  40. package/lib/Geometry/models/billboard.js +232 -181
  41. package/lib/Geometry/models/index.js +18 -34
  42. package/lib/Geometry/models/plane.js +407 -278
  43. package/lib/Geometry/models/sprite.js +291 -189
  44. package/lib/canvas/index.js +101 -66
  45. package/lib/canvas/models/canvas.js +207 -140
  46. package/lib/canvas/models/index.js +12 -30
  47. package/lib/citybuliding/building.js +98 -63
  48. package/lib/citybuliding/models/build.js +192 -146
  49. package/lib/core/BaseLayer.js +1331 -809
  50. package/lib/core/BaseModel.js +457 -279
  51. package/lib/core/interface.js +40 -53
  52. package/lib/core/schema.js +21 -39
  53. package/lib/core/shape/Path.js +67 -79
  54. package/lib/core/shape/extrude.js +132 -91
  55. package/lib/core/triangulation.js +412 -213
  56. package/lib/earth/index.js +100 -62
  57. package/lib/earth/models/atmosphere.js +146 -112
  58. package/lib/earth/models/base.js +210 -150
  59. package/lib/earth/models/bloomsphere.js +146 -112
  60. package/lib/earth/utils.js +111 -91
  61. package/lib/heatmap/index.js +149 -92
  62. package/lib/heatmap/models/grid.js +118 -91
  63. package/lib/heatmap/models/grid3d.js +155 -123
  64. package/lib/heatmap/models/heatmap.js +475 -338
  65. package/lib/heatmap/models/hexagon.js +121 -92
  66. package/lib/heatmap/models/index.js +22 -37
  67. package/lib/heatmap/triangulation.js +31 -47
  68. package/lib/image/index.js +111 -74
  69. package/lib/image/models/dataImage.js +232 -174
  70. package/lib/image/models/image.js +175 -123
  71. package/lib/image/models/index.js +15 -32
  72. package/lib/index.js +263 -97
  73. package/lib/line/index.js +131 -83
  74. package/lib/line/models/arc.js +352 -237
  75. package/lib/line/models/arc_3d.js +334 -228
  76. package/lib/line/models/earthArc_3d.js +336 -228
  77. package/lib/line/models/great_circle.js +291 -200
  78. package/lib/line/models/half.js +286 -201
  79. package/lib/line/models/index.js +42 -50
  80. package/lib/line/models/line.js +428 -299
  81. package/lib/line/models/linearline.js +277 -203
  82. package/lib/line/models/simpleLine.js +239 -175
  83. package/lib/line/models/tile.js +348 -237
  84. package/lib/line/models/wall.js +327 -235
  85. package/lib/line/shaders/line_arc_vert.glsl +5 -3
  86. package/lib/line/shaders/simple/simpleline_vert.glsl +1 -0
  87. package/lib/mask/index.js +92 -59
  88. package/lib/mask/models/fill.js +134 -82
  89. package/lib/mask/models/index.js +12 -30
  90. package/lib/plugins/DataMappingPlugin.js +342 -224
  91. package/lib/plugins/DataSourcePlugin.js +102 -87
  92. package/lib/plugins/FeatureScalePlugin.js +330 -241
  93. package/lib/plugins/LayerAnimateStylePlugin.js +61 -55
  94. package/lib/plugins/LayerModelPlugin.js +80 -73
  95. package/lib/plugins/LayerStylePlugin.js +48 -51
  96. package/lib/plugins/LightingPlugin.js +80 -68
  97. package/lib/plugins/MultiPassRendererPlugin.js +91 -65
  98. package/lib/plugins/PixelPickingPlugin.js +150 -109
  99. package/lib/plugins/RegisterStyleAttributePlugin.js +110 -110
  100. package/lib/plugins/ShaderUniformPlugin.js +118 -99
  101. package/lib/plugins/UpdateModelPlugin.js +40 -47
  102. package/lib/plugins/UpdateStyleAttributePlugin.js +93 -75
  103. package/lib/point/index.js +226 -148
  104. package/lib/point/models/earthExtrude.js +279 -201
  105. package/lib/point/models/earthFill.js +287 -202
  106. package/lib/point/models/extrude.js +299 -203
  107. package/lib/point/models/fill.js +406 -273
  108. package/lib/point/models/fillmage.js +365 -252
  109. package/lib/point/models/image.js +241 -164
  110. package/lib/point/models/index.js +46 -52
  111. package/lib/point/models/normal.js +183 -134
  112. package/lib/point/models/radar.js +304 -212
  113. package/lib/point/models/simplePoint.js +194 -142
  114. package/lib/point/models/text.js +608 -385
  115. package/lib/point/models/tile.js +314 -223
  116. package/lib/point/shaders/fill_vert.glsl +13 -6
  117. package/lib/point/shaders/image/fillImage_vert.glsl +13 -5
  118. package/lib/point/shaders/image_vert.glsl +17 -8
  119. package/lib/point/shape/extrude.js +56 -52
  120. package/lib/polygon/index.js +154 -100
  121. package/lib/polygon/models/extrude.js +311 -223
  122. package/lib/polygon/models/fill.js +215 -153
  123. package/lib/polygon/models/index.js +46 -52
  124. package/lib/polygon/models/ocean.js +244 -173
  125. package/lib/polygon/models/tile.js +144 -100
  126. package/lib/polygon/models/water.js +222 -153
  127. package/lib/raster/buffers/triangulation.js +27 -40
  128. package/lib/raster/index.js +115 -74
  129. package/lib/raster/models/index.js +16 -33
  130. package/lib/raster/models/raster.js +178 -135
  131. package/lib/raster/raster.js +187 -132
  132. package/lib/tile/interface.js +4 -16
  133. package/lib/tile/manager/tileConfigManager.js +125 -86
  134. package/lib/tile/manager/tileLayerManager.js +314 -227
  135. package/lib/tile/manager/tilePickerManager.js +192 -123
  136. package/lib/tile/models/tileModel.js +71 -51
  137. package/lib/tile/tileFactory/base.js +433 -292
  138. package/lib/tile/tileFactory/index.js +51 -49
  139. package/lib/tile/tileFactory/line.js +65 -50
  140. package/lib/tile/tileFactory/point.js +65 -50
  141. package/lib/tile/tileFactory/polygon.js +65 -50
  142. package/lib/tile/tileFactory/raster.js +66 -54
  143. package/lib/tile/tileFactory/rasterData.js +88 -76
  144. package/lib/tile/tileFactory/rasterDataLayer.js +97 -62
  145. package/lib/tile/tileFactory/vectorLayer.js +169 -95
  146. package/lib/tile/tileLayer/baseTileLayer.js +420 -220
  147. package/lib/tile/tmsTileLayer.js +110 -67
  148. package/lib/tile/utils.js +113 -87
  149. package/lib/utils/blend.js +59 -79
  150. package/lib/utils/collision-index.js +107 -64
  151. package/lib/utils/dataMappingStyle.js +105 -60
  152. package/lib/utils/extrude_polyline.js +600 -398
  153. package/lib/utils/grid-index.js +163 -111
  154. package/lib/utils/layerData.js +130 -99
  155. package/lib/utils/multiPassRender.js +49 -41
  156. package/lib/utils/polylineNormal.js +148 -96
  157. package/lib/utils/simpleLine.js +100 -85
  158. package/lib/utils/symbol-layout.js +219 -116
  159. package/lib/utils/updateShape.js +15 -41
  160. package/lib/wind/index.js +109 -71
  161. package/lib/wind/models/index.js +12 -30
  162. package/lib/wind/models/utils.js +144 -105
  163. package/lib/wind/models/wind.js +333 -224
  164. package/lib/wind/models/windRender.js +329 -218
  165. package/lib/wind/models/windShader.js +23 -181
  166. package/package.json +7 -6
@@ -1,219 +1,315 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
-
22
- // src/point/models/extrude.ts
23
- var extrude_exports = {};
24
- __export(extrude_exports, {
25
- default: () => ExtrudeModel
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
26
7
  });
27
- module.exports = __toCommonJS(extrude_exports);
28
- var import_l7_core = require("@antv/l7-core");
29
- var import_l7_utils = require("@antv/l7-utils");
30
- var import_lodash = require("lodash");
31
- var import_BaseModel = __toESM(require("../../core/BaseModel"));
32
- var import_triangulation = require("../../core/triangulation");
33
- var import_extrude_frag = __toESM(require("../shaders/extrude/extrude_frag.glsl"));
34
- var import_extrude_vert = __toESM(require("../shaders/extrude/extrude_vert.glsl"));
35
- var ExtrudeModel = class extends import_BaseModel.default {
36
- constructor() {
37
- super(...arguments);
38
- this.raiseCount = 0;
39
- this.raiserepeat = 0;
8
+ exports.default = void 0;
9
+
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+
14
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
+
16
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
+
18
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
19
+
20
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
21
+
22
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
23
+
24
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
25
+
26
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
27
+
28
+ var _l7Core = require("@antv/l7-core");
29
+
30
+ var _l7Utils = require("@antv/l7-utils");
31
+
32
+ var _lodash = require("lodash");
33
+
34
+ var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
35
+
36
+ var _triangulation = require("../../core/triangulation");
37
+
38
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
39
+
40
+ 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; } }
41
+
42
+ /* babel-plugin-inline-import '../shaders/extrude/extrude_frag.glsl' */
43
+ var pointExtrudeFrag = "varying vec4 v_color;\nuniform float u_opacity: 1.0;\n\nuniform float u_pickLight: 0.0;\n\n#pragma include \"picking\"\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\nuniform float u_opacitylinear: 0.0;\nuniform float u_opacitylinear_dir: 1.0;\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float lightWeight = styleMappingMat[1][3];\n float barLinearZ = styleMappingMat[2][3];\n\n // \u8BBE\u7F6E\u5706\u67F1\u7684\u5E95\u8272\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, barLinearZ);\n gl_FragColor.rgb *= lightWeight;\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n gl_FragColor = v_color;\n }\n\n // \u5E94\u7528\u900F\u660E\u5EA6\n gl_FragColor.a *= opacity;\n\n // \u5F00\u542F\u900F\u660E\u5EA6\u6E10\u53D8\n if(u_opacitylinear > 0.0) {\n gl_FragColor.a *= u_opacitylinear_dir > 0.0 ? (1.0 - barLinearZ): barLinearZ;\n }\n\n // picking\n if(u_pickLight > 0.0) {\n gl_FragColor = filterColorAlpha(gl_FragColor, lightWeight);\n } else {\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
44
+
45
+ /* babel-plugin-inline-import '../shaders/extrude/extrude_vert.glsl' */
46
+ var pointExtrudeVert = "precision highp float;\n\n#define pi 3.1415926535\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec3 a_Position;\nattribute vec3 a_Pos;\nattribute vec4 a_Color;\nattribute vec3 a_Size;\nattribute vec3 a_Normal;\n\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_r;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nvarying vec4 v_color;\n\nuniform float u_opacity : 1;\nuniform float u_lightEnable: 1;\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\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nfloat getYRadian(float x, float z) {\n if(x > 0.0 && z > 0.0) {\n return atan(x/z);\n } else if(x > 0.0 && z <= 0.0){\n return atan(-z/x) + pi/2.0;\n } else if(x <= 0.0 && z <= 0.0) {\n return pi + atan(x/z); //atan(x/z) + \n } else {\n return atan(z/-x) + pi*3.0/2.0;\n }\n}\n\nfloat getXRadian(float y, float r) {\n return atan(y/r);\n}\n\nvoid main() {\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 - lightWeight\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1] - linearZ(\u5782\u76F4\u65B9\u5411 0 - 1 \u7684\u503C)\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n vec3 size = a_Size * a_Position;\n\n // a_Position.z \u662F\u5728\u6784\u5EFA\u7F51\u683C\u7684\u65F6\u5019\u4F20\u5165\u7684\u6807\u51C6\u503C 0 - 1\uFF0C\u5728\u63D2\u503C\u5668\u63D2\u503C\u53EF\u4EE5\u83B7\u53D6 0\uFF5E1 \u7EBF\u6027\u6E10\u53D8\u7684\u503C\n styleMappingMat[2][3] = a_Position.z;\n\n vec3 offset = size; // \u63A7\u5236\u5706\u67F1\u4F53\u7684\u5927\u5C0F - \u4ECE\u6807\u51C6\u5355\u4F4D\u5706\u67F1\u4F53\u8FDB\u884C\u504F\u79FB\n if(u_heightfixed < 1.0) { // \u5706\u67F1\u4F53\u4E0D\u56FA\u5B9A\u9AD8\u5EA6\n \n if (u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {\n // P20 \u5750\u6807\u7CFB\u4E0B\uFF0C\u4E3A\u4E86\u548C Web \u58A8\u5361\u6258\u5750\u6807\u7CFB\u7EDF\u4E00\uFF0Czoom \u9ED8\u8BA4\u51CF1\n offset = offset * pow(2.0, (19.0 - u_Zoom));\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n // P20_2 \u5750\u6807\u7CFB\u4E0B\uFF0C\u4E3A\u4E86\u548C Web \u58A8\u5361\u6258\u5750\u6807\u7CFB\u7EDF\u4E00\uFF0Czoom \u9ED8\u8BA4\u51CF3\n offset = offset * pow(2.0, (19.0 - 3.0 - u_Zoom));\n }\n } else {// \u5706\u67F1\u4F53\u56FA\u5B9A\u9AD8\u5EA6 \uFF08 \u5904\u7406 mapbox \uFF09\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n offset *= 4.0/pow(2.0, 21.0 - u_Zoom);\n }\n }\n\n\n vec4 project_pos = project_position(vec4(a_Pos.xy, 0., 1.0));\n\n // u_r \u63A7\u5236\u5706\u67F1\u7684\u751F\u957F\n vec4 pos = vec4(project_pos.xy + offset.xy, offset.z * u_r, 1.0);\n\n // \u5706\u67F1\u5149\u7167\u6548\u679C\n float lightWeight = 1.0;\n if(u_lightEnable > 0.0) { // \u53D6\u6D88\u4E09\u5143\u8868\u8FBE\u5F0F\uFF0C\u589E\u5F3A\u5065\u58EE\u6027\n lightWeight = calc_lighting(pos);\n }\n styleMappingMat[1][3] = lightWeight;\n\n v_color =vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n // gl_Position = project_common_position_to_clipspace(pos);\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * pos;\n } else {\n gl_Position = project_common_position_to_clipspace(pos);\n }\n\n setPickingColor(a_PickingColor);\n}\n";
47
+
48
+ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
49
+ (0, _inherits2.default)(ExtrudeModel, _BaseModel);
50
+
51
+ var _super = _createSuper(ExtrudeModel);
52
+
53
+ function ExtrudeModel() {
54
+ var _this;
55
+
56
+ (0, _classCallCheck2.default)(this, ExtrudeModel);
57
+
58
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
59
+ args[_key] = arguments[_key];
60
+ }
61
+
62
+ _this = _super.call.apply(_super, [this].concat(args));
63
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "raiseCount", 0);
64
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "raiserepeat", 0);
65
+ return _this;
40
66
  }
41
- getUninforms() {
42
- const {
43
- animateOption = {
67
+
68
+ (0, _createClass2.default)(ExtrudeModel, [{
69
+ key: "getUninforms",
70
+ value: function getUninforms() {
71
+ var _ref = this.layer.getLayerConfig(),
72
+ _ref$animateOption = _ref.animateOption,
73
+ animateOption = _ref$animateOption === void 0 ? {
44
74
  enable: false,
45
75
  speed: 0.01,
46
76
  repeat: false
47
- },
48
- opacity = 1,
49
- sourceColor,
50
- targetColor,
51
- pickLight = false,
52
- heightfixed = false,
53
- opacityLinear = {
77
+ } : _ref$animateOption,
78
+ _ref$opacity = _ref.opacity,
79
+ opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
80
+ sourceColor = _ref.sourceColor,
81
+ targetColor = _ref.targetColor,
82
+ _ref$pickLight = _ref.pickLight,
83
+ pickLight = _ref$pickLight === void 0 ? false : _ref$pickLight,
84
+ _ref$heightfixed = _ref.heightfixed,
85
+ heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
86
+ _ref$opacityLinear = _ref.opacityLinear,
87
+ opacityLinear = _ref$opacityLinear === void 0 ? {
54
88
  enable: false,
55
- dir: "up"
56
- },
57
- lightEnable = true
58
- } = this.layer.getLayerConfig();
59
- if (this.dataTextureTest && this.dataTextureNeedUpdate({
60
- opacity
61
- })) {
62
- this.judgeStyleAttributes({
63
- opacity
64
- });
65
- const encodeData = this.layer.getEncodedData();
66
- const { data, width, height } = this.calDataFrame(this.cellLength, encodeData, this.cellProperties);
67
- this.rowCount = height;
68
- this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
69
- flipY: true,
70
- data,
71
- format: import_l7_core.gl.LUMINANCE,
72
- type: import_l7_core.gl.FLOAT,
73
- width,
74
- height
75
- }) : this.createTexture2D({
76
- flipY: true,
77
- data: [1],
78
- format: import_l7_core.gl.LUMINANCE,
79
- type: import_l7_core.gl.FLOAT,
80
- width: 1,
81
- height: 1
82
- });
83
- }
84
- let useLinearColor = 0;
85
- let sourceColorArr = [0, 0, 0, 0];
86
- let targetColorArr = [0, 0, 0, 0];
87
- if (sourceColor && targetColor) {
88
- sourceColorArr = (0, import_l7_utils.rgb2arr)(sourceColor);
89
- targetColorArr = (0, import_l7_utils.rgb2arr)(targetColor);
90
- useLinearColor = 1;
91
- }
92
- if (this.raiseCount < 1 && this.raiserepeat > 0) {
93
- if (animateOption.enable) {
94
- const { speed = 0.01, repeat = false } = animateOption;
95
- this.raiseCount += speed;
96
- if (this.raiseCount >= 1) {
97
- if (this.raiserepeat > 1) {
98
- this.raiseCount = 0;
99
- this.raiserepeat--;
100
- } else {
101
- this.raiseCount = 1;
89
+ dir: 'up'
90
+ } : _ref$opacityLinear,
91
+ _ref$lightEnable = _ref.lightEnable,
92
+ lightEnable = _ref$lightEnable === void 0 ? true : _ref$lightEnable;
93
+
94
+ if (this.dataTextureTest && this.dataTextureNeedUpdate({
95
+ opacity: opacity
96
+ })) {
97
+ this.judgeStyleAttributes({
98
+ opacity: opacity
99
+ });
100
+ var encodeData = this.layer.getEncodedData();
101
+
102
+ var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
103
+ data = _this$calDataFrame.data,
104
+ width = _this$calDataFrame.width,
105
+ height = _this$calDataFrame.height;
106
+
107
+ this.rowCount = height; // 当前数据纹理有多少行
108
+
109
+ this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
110
+ flipY: true,
111
+ data: data,
112
+ format: _l7Core.gl.LUMINANCE,
113
+ type: _l7Core.gl.FLOAT,
114
+ width: width,
115
+ height: height
116
+ }) : this.createTexture2D({
117
+ flipY: true,
118
+ data: [1],
119
+ format: _l7Core.gl.LUMINANCE,
120
+ type: _l7Core.gl.FLOAT,
121
+ width: 1,
122
+ height: 1
123
+ });
124
+ } // 转化渐变色
125
+
126
+
127
+ var useLinearColor = 0; // 默认不生效
128
+
129
+ var sourceColorArr = [0, 0, 0, 0];
130
+ var targetColorArr = [0, 0, 0, 0];
131
+
132
+ if (sourceColor && targetColor) {
133
+ sourceColorArr = (0, _l7Utils.rgb2arr)(sourceColor);
134
+ targetColorArr = (0, _l7Utils.rgb2arr)(targetColor);
135
+ useLinearColor = 1;
136
+ }
137
+
138
+ if (this.raiseCount < 1 && this.raiserepeat > 0) {
139
+ if (animateOption.enable) {
140
+ var _animateOption$speed = animateOption.speed,
141
+ speed = _animateOption$speed === void 0 ? 0.01 : _animateOption$speed,
142
+ _animateOption$repeat = animateOption.repeat,
143
+ repeat = _animateOption$repeat === void 0 ? false : _animateOption$repeat;
144
+ this.raiseCount += speed;
145
+
146
+ if (this.raiseCount >= 1) {
147
+ if (this.raiserepeat > 1) {
148
+ this.raiseCount = 0;
149
+ this.raiserepeat--;
150
+ } else {
151
+ this.raiseCount = 1;
152
+ }
102
153
  }
103
154
  }
104
155
  }
156
+
157
+ return {
158
+ // 圆柱体的拾取高亮是否要计算光照
159
+ u_pickLight: Number(pickLight),
160
+ // 圆柱体是否固定高度
161
+ u_heightfixed: Number(heightfixed),
162
+ u_r: animateOption.enable && this.raiserepeat > 0 ? this.raiseCount : 1.0,
163
+ u_dataTexture: this.dataTexture,
164
+ // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
165
+ u_cellTypeLayout: this.getCellTypeLayout(),
166
+ u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1.0,
167
+ // 渐变色支持参数
168
+ u_linearColor: useLinearColor,
169
+ u_sourceColor: sourceColorArr,
170
+ u_targetColor: targetColorArr,
171
+ // 透明度渐变
172
+ u_opacitylinear: Number(opacityLinear.enable),
173
+ u_opacitylinear_dir: opacityLinear.dir === 'up' ? 1.0 : 0.0,
174
+ // 光照计算开关
175
+ u_lightEnable: Number(lightEnable)
176
+ };
105
177
  }
106
- return {
107
- u_pickLight: Number(pickLight),
108
- u_heightfixed: Number(heightfixed),
109
- u_r: animateOption.enable && this.raiserepeat > 0 ? this.raiseCount : 1,
110
- u_dataTexture: this.dataTexture,
111
- u_cellTypeLayout: this.getCellTypeLayout(),
112
- u_opacity: (0, import_lodash.isNumber)(opacity) ? opacity : 1,
113
- u_linearColor: useLinearColor,
114
- u_sourceColor: sourceColorArr,
115
- u_targetColor: targetColorArr,
116
- u_opacitylinear: Number(opacityLinear.enable),
117
- u_opacitylinear_dir: opacityLinear.dir === "up" ? 1 : 0,
118
- u_lightEnable: Number(lightEnable)
119
- };
120
- }
121
- initModels(callbackModel) {
122
- this.buildModels(callbackModel);
123
- }
124
- async buildModels(callbackModel) {
125
- const {
126
- depth = true,
127
- animateOption: { repeat = 1 }
128
- } = this.layer.getLayerConfig();
129
- this.raiserepeat = repeat;
130
- this.layer.buildLayerModel({
131
- moduleName: "pointExtrude",
132
- vertexShader: import_extrude_vert.default,
133
- fragmentShader: import_extrude_frag.default,
134
- triangulation: import_triangulation.PointExtrudeTriangulation,
135
- blend: this.getBlend(),
136
- cull: {
137
- enable: true,
138
- face: (0, import_l7_utils.getCullFace)(this.mapService.version)
139
- },
140
- depth: {
141
- enable: depth
142
- }
143
- }).then((model) => {
144
- callbackModel([model]);
145
- }).catch((err) => {
146
- console.warn(err);
147
- callbackModel([]);
148
- });
149
- }
150
- clearModels() {
151
- var _a;
152
- (_a = this.dataTexture) == null ? void 0 : _a.destroy();
153
- }
154
- registerBuiltinAttributes() {
155
- this.styleAttributeService.registerStyleAttribute({
156
- name: "size",
157
- type: import_l7_core.AttributeType.Attribute,
158
- descriptor: {
159
- name: "a_Size",
160
- buffer: {
161
- usage: import_l7_core.gl.DYNAMIC_DRAW,
162
- data: [],
163
- type: import_l7_core.gl.FLOAT
164
- },
165
- size: 3,
166
- update: (feature, featureIdx, vertex, attributeIdx) => {
167
- const { size } = feature;
168
- if (size) {
169
- let buffersize = [];
170
- if (Array.isArray(size)) {
171
- buffersize = size.length === 2 ? [size[0], size[0], size[1]] : size;
178
+ }, {
179
+ key: "initModels",
180
+ value: function initModels(callbackModel) {
181
+ this.buildModels(callbackModel);
182
+ }
183
+ }, {
184
+ key: "buildModels",
185
+ value: function () {
186
+ var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(callbackModel) {
187
+ var _ref2, _ref2$depth, depth, _ref2$animateOption$r, repeat;
188
+
189
+ return _regenerator.default.wrap(function _callee$(_context) {
190
+ while (1) {
191
+ switch (_context.prev = _context.next) {
192
+ case 0:
193
+ // GAODE1.x GAODE2.x MAPBOX
194
+ _ref2 = this.layer.getLayerConfig(), _ref2$depth = _ref2.depth, depth = _ref2$depth === void 0 ? true : _ref2$depth, _ref2$animateOption$r = _ref2.animateOption.repeat, repeat = _ref2$animateOption$r === void 0 ? 1 : _ref2$animateOption$r;
195
+ this.raiserepeat = repeat;
196
+ this.layer.buildLayerModel({
197
+ moduleName: 'pointExtrude',
198
+ vertexShader: pointExtrudeVert,
199
+ fragmentShader: pointExtrudeFrag,
200
+ triangulation: _triangulation.PointExtrudeTriangulation,
201
+ blend: this.getBlend(),
202
+ cull: {
203
+ enable: true,
204
+ face: (0, _l7Utils.getCullFace)(this.mapService.version)
205
+ },
206
+ depth: {
207
+ enable: depth
208
+ }
209
+ }).then(function (model) {
210
+ callbackModel([model]);
211
+ }).catch(function (err) {
212
+ console.warn(err);
213
+ callbackModel([]);
214
+ });
215
+
216
+ case 3:
217
+ case "end":
218
+ return _context.stop();
172
219
  }
173
- if (!Array.isArray(size)) {
174
- buffersize = [size, size, size];
220
+ }
221
+ }, _callee, this);
222
+ }));
223
+
224
+ function buildModels(_x) {
225
+ return _buildModels.apply(this, arguments);
226
+ }
227
+
228
+ return buildModels;
229
+ }()
230
+ }, {
231
+ key: "clearModels",
232
+ value: function clearModels() {
233
+ var _this$dataTexture;
234
+
235
+ (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
236
+ }
237
+ }, {
238
+ key: "registerBuiltinAttributes",
239
+ value: function registerBuiltinAttributes() {
240
+ // point layer size;
241
+ this.styleAttributeService.registerStyleAttribute({
242
+ name: 'size',
243
+ type: _l7Core.AttributeType.Attribute,
244
+ descriptor: {
245
+ name: 'a_Size',
246
+ buffer: {
247
+ // give the WebGL driver a hint that this buffer may change
248
+ usage: _l7Core.gl.DYNAMIC_DRAW,
249
+ data: [],
250
+ type: _l7Core.gl.FLOAT
251
+ },
252
+ size: 3,
253
+ update: function update(feature, featureIdx, vertex, attributeIdx) {
254
+ var size = feature.size;
255
+
256
+ if (size) {
257
+ var buffersize = [];
258
+
259
+ if (Array.isArray(size)) {
260
+ buffersize = size.length === 2 ? [size[0], size[0], size[1]] : size;
261
+ }
262
+
263
+ if (!Array.isArray(size)) {
264
+ buffersize = [size, size, size];
265
+ }
266
+
267
+ return buffersize;
268
+ } else {
269
+ return [2, 2, 2];
175
270
  }
176
- return buffersize;
177
- } else {
178
- return [2, 2, 2];
179
271
  }
180
272
  }
181
- }
182
- });
183
- this.styleAttributeService.registerStyleAttribute({
184
- name: "normal",
185
- type: import_l7_core.AttributeType.Attribute,
186
- descriptor: {
187
- name: "a_Normal",
188
- buffer: {
189
- usage: import_l7_core.gl.STATIC_DRAW,
190
- data: [],
191
- type: import_l7_core.gl.FLOAT
192
- },
193
- size: 3,
194
- update: (feature, featureIdx, vertex, attributeIdx, normal) => {
195
- return normal;
273
+ }); // point layer size;
274
+
275
+ this.styleAttributeService.registerStyleAttribute({
276
+ name: 'normal',
277
+ type: _l7Core.AttributeType.Attribute,
278
+ descriptor: {
279
+ name: 'a_Normal',
280
+ buffer: {
281
+ // give the WebGL driver a hint that this buffer may change
282
+ usage: _l7Core.gl.STATIC_DRAW,
283
+ data: [],
284
+ type: _l7Core.gl.FLOAT
285
+ },
286
+ size: 3,
287
+ update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
288
+ return normal;
289
+ }
196
290
  }
197
- }
198
- });
199
- this.styleAttributeService.registerStyleAttribute({
200
- name: "pos",
201
- type: import_l7_core.AttributeType.Attribute,
202
- descriptor: {
203
- name: "a_Pos",
204
- buffer: {
205
- usage: import_l7_core.gl.DYNAMIC_DRAW,
206
- data: [],
207
- type: import_l7_core.gl.FLOAT
208
- },
209
- size: 3,
210
- update: (feature, featureIdx) => {
211
- const coordinates = (0, import_l7_utils.calculateCentroid)(feature.coordinates);
212
- return [coordinates[0], coordinates[1], 0];
291
+ });
292
+ this.styleAttributeService.registerStyleAttribute({
293
+ name: 'pos',
294
+ type: _l7Core.AttributeType.Attribute,
295
+ descriptor: {
296
+ name: 'a_Pos',
297
+ buffer: {
298
+ // give the WebGL driver a hint that this buffer may change
299
+ usage: _l7Core.gl.DYNAMIC_DRAW,
300
+ data: [],
301
+ type: _l7Core.gl.FLOAT
302
+ },
303
+ size: 3,
304
+ update: function update(feature, featureIdx) {
305
+ var coordinates = (0, _l7Utils.calculateCentroid)(feature.coordinates);
306
+ return [coordinates[0], coordinates[1], 0];
307
+ }
213
308
  }
214
- }
215
- });
216
- }
217
- };
218
- // Annotate the CommonJS export names for ESM import in node:
219
- 0 && (module.exports = {});
309
+ });
310
+ }
311
+ }]);
312
+ return ExtrudeModel;
313
+ }(_BaseModel2.default);
314
+
315
+ exports.default = ExtrudeModel;