@antv/l7-layers 2.9.25-alpha.0 → 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 (125) hide show
  1. package/es/heatmap/models/heatmap.js +1 -1
  2. package/es/tile/utils.js +1 -1
  3. package/lib/Geometry/index.js +114 -77
  4. package/lib/Geometry/models/billboard.js +232 -181
  5. package/lib/Geometry/models/index.js +18 -34
  6. package/lib/Geometry/models/plane.js +407 -278
  7. package/lib/Geometry/models/sprite.js +291 -189
  8. package/lib/canvas/index.js +101 -66
  9. package/lib/canvas/models/canvas.js +207 -140
  10. package/lib/canvas/models/index.js +12 -30
  11. package/lib/citybuliding/building.js +98 -63
  12. package/lib/citybuliding/models/build.js +192 -146
  13. package/lib/core/BaseLayer.js +1331 -814
  14. package/lib/core/BaseModel.js +457 -279
  15. package/lib/core/interface.js +40 -53
  16. package/lib/core/schema.js +21 -39
  17. package/lib/core/shape/Path.js +67 -79
  18. package/lib/core/shape/extrude.js +132 -91
  19. package/lib/core/triangulation.js +378 -196
  20. package/lib/earth/index.js +100 -62
  21. package/lib/earth/models/atmosphere.js +146 -112
  22. package/lib/earth/models/base.js +210 -150
  23. package/lib/earth/models/bloomsphere.js +146 -112
  24. package/lib/earth/utils.js +111 -91
  25. package/lib/heatmap/index.js +149 -92
  26. package/lib/heatmap/models/grid.js +118 -91
  27. package/lib/heatmap/models/grid3d.js +155 -123
  28. package/lib/heatmap/models/heatmap.js +475 -338
  29. package/lib/heatmap/models/hexagon.js +121 -92
  30. package/lib/heatmap/models/index.js +22 -37
  31. package/lib/heatmap/triangulation.js +31 -47
  32. package/lib/image/index.js +111 -74
  33. package/lib/image/models/dataImage.js +232 -174
  34. package/lib/image/models/image.js +175 -128
  35. package/lib/image/models/index.js +15 -32
  36. package/lib/index.js +263 -97
  37. package/lib/line/index.js +131 -85
  38. package/lib/line/models/arc.js +352 -237
  39. package/lib/line/models/arc_3d.js +334 -228
  40. package/lib/line/models/earthArc_3d.js +336 -228
  41. package/lib/line/models/great_circle.js +291 -200
  42. package/lib/line/models/half.js +286 -201
  43. package/lib/line/models/index.js +42 -50
  44. package/lib/line/models/line.js +428 -299
  45. package/lib/line/models/linearline.js +277 -203
  46. package/lib/line/models/simpleLine.js +239 -175
  47. package/lib/line/models/tile.js +348 -237
  48. package/lib/line/models/wall.js +327 -235
  49. package/lib/mask/index.js +92 -59
  50. package/lib/mask/models/fill.js +134 -82
  51. package/lib/mask/models/index.js +12 -30
  52. package/lib/plugins/DataMappingPlugin.js +342 -224
  53. package/lib/plugins/DataSourcePlugin.js +102 -87
  54. package/lib/plugins/FeatureScalePlugin.js +330 -240
  55. package/lib/plugins/LayerAnimateStylePlugin.js +61 -55
  56. package/lib/plugins/LayerModelPlugin.js +80 -73
  57. package/lib/plugins/LayerStylePlugin.js +48 -51
  58. package/lib/plugins/LightingPlugin.js +80 -68
  59. package/lib/plugins/MultiPassRendererPlugin.js +91 -65
  60. package/lib/plugins/PixelPickingPlugin.js +150 -109
  61. package/lib/plugins/RegisterStyleAttributePlugin.js +110 -110
  62. package/lib/plugins/ShaderUniformPlugin.js +118 -99
  63. package/lib/plugins/UpdateModelPlugin.js +40 -47
  64. package/lib/plugins/UpdateStyleAttributePlugin.js +93 -75
  65. package/lib/point/index.js +226 -150
  66. package/lib/point/models/earthExtrude.js +279 -201
  67. package/lib/point/models/earthFill.js +287 -202
  68. package/lib/point/models/extrude.js +299 -203
  69. package/lib/point/models/fill.js +406 -275
  70. package/lib/point/models/fillmage.js +365 -256
  71. package/lib/point/models/image.js +241 -168
  72. package/lib/point/models/index.js +46 -52
  73. package/lib/point/models/normal.js +183 -134
  74. package/lib/point/models/radar.js +304 -211
  75. package/lib/point/models/simplePoint.js +194 -142
  76. package/lib/point/models/text.js +608 -385
  77. package/lib/point/models/tile.js +314 -223
  78. package/lib/point/shape/extrude.js +56 -52
  79. package/lib/polygon/index.js +154 -102
  80. package/lib/polygon/models/extrude.js +311 -223
  81. package/lib/polygon/models/fill.js +215 -153
  82. package/lib/polygon/models/index.js +46 -52
  83. package/lib/polygon/models/ocean.js +244 -173
  84. package/lib/polygon/models/tile.js +144 -100
  85. package/lib/polygon/models/water.js +222 -153
  86. package/lib/raster/buffers/triangulation.js +27 -40
  87. package/lib/raster/index.js +115 -75
  88. package/lib/raster/models/index.js +16 -33
  89. package/lib/raster/models/raster.js +178 -135
  90. package/lib/raster/raster.js +187 -132
  91. package/lib/tile/interface.js +4 -16
  92. package/lib/tile/manager/tileConfigManager.js +125 -86
  93. package/lib/tile/manager/tileLayerManager.js +313 -229
  94. package/lib/tile/manager/tilePickerManager.js +192 -123
  95. package/lib/tile/models/tileModel.js +71 -52
  96. package/lib/tile/tileFactory/base.js +432 -309
  97. package/lib/tile/tileFactory/index.js +51 -49
  98. package/lib/tile/tileFactory/line.js +65 -50
  99. package/lib/tile/tileFactory/point.js +65 -50
  100. package/lib/tile/tileFactory/polygon.js +65 -50
  101. package/lib/tile/tileFactory/raster.js +66 -54
  102. package/lib/tile/tileFactory/rasterData.js +88 -76
  103. package/lib/tile/tileFactory/rasterDataLayer.js +97 -62
  104. package/lib/tile/tileFactory/vectorLayer.js +168 -109
  105. package/lib/tile/tileLayer/baseTileLayer.js +420 -221
  106. package/lib/tile/tmsTileLayer.js +110 -67
  107. package/lib/tile/utils.js +110 -92
  108. package/lib/utils/blend.js +59 -79
  109. package/lib/utils/collision-index.js +107 -64
  110. package/lib/utils/dataMappingStyle.js +105 -60
  111. package/lib/utils/extrude_polyline.js +600 -398
  112. package/lib/utils/grid-index.js +163 -111
  113. package/lib/utils/layerData.js +130 -99
  114. package/lib/utils/multiPassRender.js +49 -41
  115. package/lib/utils/polylineNormal.js +148 -96
  116. package/lib/utils/simpleLine.js +100 -85
  117. package/lib/utils/symbol-layout.js +219 -116
  118. package/lib/utils/updateShape.js +15 -41
  119. package/lib/wind/index.js +109 -71
  120. package/lib/wind/models/index.js +12 -30
  121. package/lib/wind/models/utils.js +144 -105
  122. package/lib/wind/models/wind.js +333 -224
  123. package/lib/wind/models/windRender.js +329 -218
  124. package/lib/wind/models/windShader.js +23 -181
  125. package/package.json +6 -6
@@ -1,164 +1,226 @@
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/polygon/models/fill.ts
23
- var fill_exports = {};
24
- __export(fill_exports, {
25
- default: () => FillModel
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(fill_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_polygon_frag = __toESM(require("../shaders/polygon_frag.glsl"));
34
- var import_polygon_linear_frag = __toESM(require("../shaders/polygon_linear_frag.glsl"));
35
- var import_polygon_linear_vert = __toESM(require("../shaders/polygon_linear_vert.glsl"));
36
- var import_polygon_vert = __toESM(require("../shaders/polygon_vert.glsl"));
37
- var FillModel = class extends import_BaseModel.default {
38
- getUninforms() {
39
- const {
40
- raisingHeight = 0,
41
- opacity = 1,
42
- opacityLinear = {
8
+ exports.default = void 0;
9
+
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
14
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
+
16
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
17
+
18
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
19
+
20
+ var _l7Core = require("@antv/l7-core");
21
+
22
+ var _l7Utils = require("@antv/l7-utils");
23
+
24
+ var _lodash = require("lodash");
25
+
26
+ var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
27
+
28
+ var _triangulation = require("../../core/triangulation");
29
+
30
+ 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); }; }
31
+
32
+ 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; } }
33
+
34
+ /* babel-plugin-inline-import '../shaders/polygon_frag.glsl' */
35
+ var polygon_frag = "uniform float u_opacity: 1.0;\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n gl_FragColor = v_Color;\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
36
+
37
+ /* babel-plugin-inline-import '../shaders/polygon_linear_frag.glsl' */
38
+ var polygon_linear_frag = "uniform float u_opacity: 1.0;\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"picking\"\nuniform float u_opacitylinear: 0.0;\nuniform float u_dir: 1.0;\nvarying vec3 v_linear;\nvarying vec2 v_pos;\n\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n gl_FragColor = v_Color;\n \n if(u_opacitylinear > 0.0) {\n gl_FragColor.a *= u_dir == 1.0 ? 1.0 - length(v_pos - v_linear.xy)/v_linear.z : length(v_pos - v_linear.xy)/v_linear.z;\n }\n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
39
+
40
+ /* babel-plugin-inline-import '../shaders/polygon_linear_vert.glsl' */
41
+ var polygon_linear_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_opacity: 1.0;\nuniform float u_raisingHeight: 0.0;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nuniform float u_opacitylinear: 0.0;\n\nattribute vec3 a_linear;\nvarying vec3 v_linear;\nvarying vec2 v_pos;\n\nvoid main() {\n if(u_opacitylinear > 0.0) {\n v_linear = a_linear;\n v_pos = a_Position.xy;\n }\n \n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\nstyleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_Color = a_Color;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}";
42
+
43
+ /* babel-plugin-inline-import '../shaders/polygon_vert.glsl' */
44
+ var polygon_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_opacity: 1.0;\nuniform float u_raisingHeight: 0.0;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\nstyleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_Color = a_Color;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n\n";
45
+
46
+ var FillModel = /*#__PURE__*/function (_BaseModel) {
47
+ (0, _inherits2.default)(FillModel, _BaseModel);
48
+
49
+ var _super = _createSuper(FillModel);
50
+
51
+ function FillModel() {
52
+ (0, _classCallCheck2.default)(this, FillModel);
53
+ return _super.apply(this, arguments);
54
+ }
55
+
56
+ (0, _createClass2.default)(FillModel, [{
57
+ key: "getUninforms",
58
+ value: function getUninforms() {
59
+ var _ref = this.layer.getLayerConfig(),
60
+ _ref$raisingHeight = _ref.raisingHeight,
61
+ raisingHeight = _ref$raisingHeight === void 0 ? 0 : _ref$raisingHeight,
62
+ _ref$opacity = _ref.opacity,
63
+ opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
64
+ _ref$opacityLinear = _ref.opacityLinear,
65
+ opacityLinear = _ref$opacityLinear === void 0 ? {
43
66
  enable: false,
44
- dir: "in"
67
+ dir: 'in'
68
+ } : _ref$opacityLinear;
69
+
70
+ if (this.dataTextureTest && this.dataTextureNeedUpdate({
71
+ opacity: opacity
72
+ })) {
73
+ this.judgeStyleAttributes({
74
+ opacity: opacity
75
+ });
76
+ var encodeData = this.layer.getEncodedData();
77
+
78
+ var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
79
+ data = _this$calDataFrame.data,
80
+ width = _this$calDataFrame.width,
81
+ height = _this$calDataFrame.height;
82
+
83
+ this.rowCount = height; // 当前数据纹理有多少行
84
+
85
+ this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
86
+ flipY: true,
87
+ data: data,
88
+ format: _l7Core.gl.LUMINANCE,
89
+ type: _l7Core.gl.FLOAT,
90
+ width: width,
91
+ height: height
92
+ }) : this.createTexture2D({
93
+ flipY: true,
94
+ data: [1],
95
+ format: _l7Core.gl.LUMINANCE,
96
+ type: _l7Core.gl.FLOAT,
97
+ width: 1,
98
+ height: 1
99
+ });
45
100
  }
46
- } = this.layer.getLayerConfig();
47
- if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {
48
- this.judgeStyleAttributes({ opacity });
49
- const encodeData = this.layer.getEncodedData();
50
- const { data, width, height } = this.calDataFrame(this.cellLength, encodeData, this.cellProperties);
51
- this.rowCount = height;
52
- this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
53
- flipY: true,
54
- data,
55
- format: import_l7_core.gl.LUMINANCE,
56
- type: import_l7_core.gl.FLOAT,
57
- width,
58
- height
59
- }) : this.createTexture2D({
60
- flipY: true,
61
- data: [1],
62
- format: import_l7_core.gl.LUMINANCE,
63
- type: import_l7_core.gl.FLOAT,
64
- width: 1,
65
- height: 1
101
+
102
+ return {
103
+ u_dataTexture: this.dataTexture,
104
+ // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
105
+ u_cellTypeLayout: this.getCellTypeLayout(),
106
+ u_raisingHeight: Number(raisingHeight),
107
+ u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1.0,
108
+ u_opacitylinear: Number(opacityLinear.enable),
109
+ u_dir: opacityLinear.dir === 'in' ? 1.0 : 0.0
110
+ };
111
+ }
112
+ }, {
113
+ key: "initModels",
114
+ value: function initModels(callbackModel) {
115
+ this.buildModels(callbackModel);
116
+ }
117
+ }, {
118
+ key: "buildModels",
119
+ value: function buildModels(callbackModel) {
120
+ var _this$getModelParams = this.getModelParams(),
121
+ frag = _this$getModelParams.frag,
122
+ vert = _this$getModelParams.vert,
123
+ triangulation = _this$getModelParams.triangulation,
124
+ type = _this$getModelParams.type;
125
+
126
+ var _ref2 = this.layer.getLayerConfig(),
127
+ _ref2$mask = _ref2.mask,
128
+ mask = _ref2$mask === void 0 ? false : _ref2$mask,
129
+ _ref2$maskInside = _ref2.maskInside,
130
+ maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside,
131
+ _ref2$workerEnabled = _ref2.workerEnabled,
132
+ workerEnabled = _ref2$workerEnabled === void 0 ? false : _ref2$workerEnabled,
133
+ enablePicking = _ref2.enablePicking;
134
+
135
+ this.layer.triangulation = triangulation;
136
+ this.layer.buildLayerModel({
137
+ moduleName: type,
138
+ vertexShader: vert,
139
+ fragmentShader: frag,
140
+ triangulation: triangulation,
141
+ primitive: _l7Core.gl.TRIANGLES,
142
+ depth: {
143
+ enable: false
144
+ },
145
+ blend: this.getBlend(),
146
+ stencil: (0, _l7Utils.getMask)(mask, maskInside),
147
+ workerEnabled: workerEnabled,
148
+ workerOptions: {
149
+ modelType: type,
150
+ enablePicking: enablePicking
151
+ }
152
+ }).then(function (model) {
153
+ callbackModel([model]);
154
+ }).catch(function (err) {
155
+ console.warn(err);
156
+ callbackModel([]);
66
157
  });
67
158
  }
68
- return {
69
- u_dataTexture: this.dataTexture,
70
- u_cellTypeLayout: this.getCellTypeLayout(),
71
- u_raisingHeight: Number(raisingHeight),
72
- u_opacity: (0, import_lodash.isNumber)(opacity) ? opacity : 1,
73
- u_opacitylinear: Number(opacityLinear.enable),
74
- u_dir: opacityLinear.dir === "in" ? 1 : 0
75
- };
76
- }
77
- initModels(callbackModel) {
78
- this.buildModels(callbackModel);
79
- }
80
- buildModels(callbackModel) {
81
- const { frag, vert, triangulation, type } = this.getModelParams();
82
- const {
83
- mask = false,
84
- maskInside = true,
85
- workerEnabled = false,
86
- enablePicking
87
- } = this.layer.getLayerConfig();
88
- this.layer.triangulation = triangulation;
89
- this.layer.buildLayerModel({
90
- moduleName: type,
91
- vertexShader: vert,
92
- fragmentShader: frag,
93
- triangulation,
94
- primitive: import_l7_core.gl.TRIANGLES,
95
- depth: { enable: false },
96
- blend: this.getBlend(),
97
- stencil: (0, import_l7_utils.getMask)(mask, maskInside),
98
- workerEnabled,
99
- workerOptions: {
100
- modelType: type,
101
- enablePicking
102
- }
103
- }).then((model) => {
104
- callbackModel([model]);
105
- }).catch((err) => {
106
- console.warn(err);
107
- callbackModel([]);
108
- });
109
- }
110
- clearModels() {
111
- var _a;
112
- (_a = this.dataTexture) == null ? void 0 : _a.destroy();
113
- }
114
- registerBuiltinAttributes() {
115
- const {
116
- opacityLinear = {
159
+ }, {
160
+ key: "clearModels",
161
+ value: function clearModels() {
162
+ var _this$dataTexture;
163
+
164
+ (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
165
+ }
166
+ }, {
167
+ key: "registerBuiltinAttributes",
168
+ value: function registerBuiltinAttributes() {
169
+ var _ref3 = this.layer.getLayerConfig(),
170
+ _ref3$opacityLinear = _ref3.opacityLinear,
171
+ opacityLinear = _ref3$opacityLinear === void 0 ? {
117
172
  enable: false,
118
- dir: "in"
119
- }
120
- } = this.layer.getLayerConfig();
121
- if (opacityLinear.enable) {
122
- this.styleAttributeService.registerStyleAttribute({
123
- name: "linear",
124
- type: import_l7_core.AttributeType.Attribute,
125
- descriptor: {
126
- name: "a_linear",
127
- buffer: {
128
- usage: import_l7_core.gl.STATIC_DRAW,
129
- data: [],
130
- type: import_l7_core.gl.FLOAT
131
- },
132
- size: 3,
133
- update: (feature, featureIdx, vertex, attributeIdx, normal) => {
134
- return [vertex[3], vertex[4], vertex[5]];
173
+ dir: 'in'
174
+ } : _ref3$opacityLinear;
175
+
176
+ if (opacityLinear.enable) {
177
+ this.styleAttributeService.registerStyleAttribute({
178
+ name: 'linear',
179
+ type: _l7Core.AttributeType.Attribute,
180
+ descriptor: {
181
+ name: 'a_linear',
182
+ buffer: {
183
+ // give the WebGL driver a hint that this buffer may change
184
+ usage: _l7Core.gl.STATIC_DRAW,
185
+ data: [],
186
+ type: _l7Core.gl.FLOAT
187
+ },
188
+ size: 3,
189
+ update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
190
+ // center[0] center[1] radius
191
+ return [vertex[3], vertex[4], vertex[5]];
192
+ }
135
193
  }
136
- }
137
- });
194
+ });
195
+ }
138
196
  }
139
- }
140
- getModelParams() {
141
- const {
142
- opacityLinear = {
197
+ }, {
198
+ key: "getModelParams",
199
+ value: function getModelParams() {
200
+ var _ref4 = this.layer.getLayerConfig(),
201
+ _ref4$opacityLinear = _ref4.opacityLinear,
202
+ opacityLinear = _ref4$opacityLinear === void 0 ? {
143
203
  enable: false
204
+ } : _ref4$opacityLinear;
205
+
206
+ if (opacityLinear.enable) {
207
+ return {
208
+ frag: polygon_linear_frag,
209
+ vert: polygon_linear_vert,
210
+ type: 'polygonLinear',
211
+ triangulation: _triangulation.polygonTriangulationWithCenter
212
+ };
213
+ } else {
214
+ return {
215
+ frag: polygon_frag,
216
+ vert: polygon_vert,
217
+ type: 'polygonFill',
218
+ triangulation: _l7Utils.polygonFillTriangulation
219
+ };
144
220
  }
145
- } = this.layer.getLayerConfig();
146
- if (opacityLinear.enable) {
147
- return {
148
- frag: import_polygon_linear_frag.default,
149
- vert: import_polygon_linear_vert.default,
150
- type: "polygonLinear",
151
- triangulation: import_triangulation.polygonTriangulationWithCenter
152
- };
153
- } else {
154
- return {
155
- frag: import_polygon_frag.default,
156
- vert: import_polygon_vert.default,
157
- type: "polygonFill",
158
- triangulation: import_l7_utils.polygonFillTriangulation
159
- };
160
221
  }
161
- }
162
- };
163
- // Annotate the CommonJS export names for ESM import in node:
164
- 0 && (module.exports = {});
222
+ }]);
223
+ return FillModel;
224
+ }(_BaseModel2.default);
225
+
226
+ exports.default = FillModel;
@@ -1,56 +1,50 @@
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);
1
+ "use strict";
21
2
 
22
- // src/polygon/models/index.ts
23
- var models_exports = {};
24
- __export(models_exports, {
25
- default: () => models_default
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
26
7
  });
27
- module.exports = __toCommonJS(models_exports);
28
- var import_line = __toESM(require("../../line/models/line"));
29
- var import_extrude = __toESM(require("../../point/models/extrude"));
30
- var import_fill = __toESM(require("../../point/models/fill"));
31
- var import_image = __toESM(require("../../point/models/image"));
32
- var import_normal = __toESM(require("../../point/models/normal"));
33
- var import_text = __toESM(require("../../point/models/text"));
34
- var import_tileModel = __toESM(require("../../tile/models/tileModel"));
35
- var import_extrude2 = __toESM(require("./extrude"));
36
- var import_fill2 = __toESM(require("./fill"));
37
- var import_ocean = __toESM(require("./ocean"));
38
- var import_tile = __toESM(require("./tile"));
39
- var import_water = __toESM(require("./water"));
8
+ exports.default = void 0;
9
+
10
+ var _line = _interopRequireDefault(require("../../line/models/line"));
11
+
12
+ var _extrude = _interopRequireDefault(require("../../point/models/extrude"));
13
+
14
+ var _fill = _interopRequireDefault(require("../../point/models/fill"));
15
+
16
+ var _image = _interopRequireDefault(require("../../point/models/image"));
17
+
18
+ var _normal = _interopRequireDefault(require("../../point/models/normal"));
19
+
20
+ var _text = _interopRequireDefault(require("../../point/models/text"));
21
+
22
+ var _tileModel = _interopRequireDefault(require("../../tile/models/tileModel"));
23
+
24
+ var _extrude2 = _interopRequireDefault(require("./extrude"));
25
+
26
+ var _fill2 = _interopRequireDefault(require("./fill"));
27
+
28
+ var _ocean = _interopRequireDefault(require("./ocean"));
29
+
30
+ var _tile = _interopRequireDefault(require("./tile"));
31
+
32
+ var _water = _interopRequireDefault(require("./water"));
33
+
40
34
  var PolygonModels = {
41
- fill: import_fill2.default,
42
- line: import_line.default,
43
- extrude: import_extrude2.default,
44
- text: import_text.default,
45
- point_fill: import_fill.default,
46
- point_image: import_image.default,
47
- point_normal: import_normal.default,
48
- point_extrude: import_extrude.default,
49
- water: import_water.default,
50
- ocean: import_ocean.default,
51
- vectorpolygon: import_tileModel.default,
52
- tile: import_tile.default
35
+ fill: _fill2.default,
36
+ line: _line.default,
37
+ extrude: _extrude2.default,
38
+ text: _text.default,
39
+ point_fill: _fill.default,
40
+ point_image: _image.default,
41
+ point_normal: _normal.default,
42
+ point_extrude: _extrude.default,
43
+ water: _water.default,
44
+ ocean: _ocean.default,
45
+ // point_fill: PointModels.fill,
46
+ vectorpolygon: _tileModel.default,
47
+ tile: _tile.default
53
48
  };
54
- var models_default = PolygonModels;
55
- // Annotate the CommonJS export names for ESM import in node:
56
- 0 && (module.exports = {});
49
+ var _default = PolygonModels;
50
+ exports.default = _default;