@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,101 +1,120 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var __decorateClass = (decorators, target, key, kind) => {
19
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
20
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
21
- if (decorator = decorators[i])
22
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
23
- if (kind && result)
24
- __defProp(target, key, result);
25
- return result;
26
- };
27
-
28
- // src/plugins/ShaderUniformPlugin.ts
29
- var ShaderUniformPlugin_exports = {};
30
- __export(ShaderUniformPlugin_exports, {
31
- default: () => ShaderUniformPlugin
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
32
7
  });
33
- module.exports = __toCommonJS(ShaderUniformPlugin_exports);
34
- var import_l7_core = require("@antv/l7-core");
35
- var import_l7_utils = require("@antv/l7-utils");
36
- var import_inversify = require("inversify");
37
- var import_reflect_metadata = require("reflect-metadata");
38
- var ShaderUniformPlugin = class {
39
- apply(layer) {
40
- const version = this.mapService.version;
41
- let mvp = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
42
- let sceneCenterMKT = [0, 0];
43
- layer.hooks.beforeRender.tap("ShaderUniformPlugin", () => {
44
- const offset = layer.getLayerConfig().tileOrigin;
45
- this.coordinateSystemService.refresh(offset);
46
- if (version === "GAODE2.x") {
47
- const layerCenter = this.getLayerCenter(layer);
48
- this.mapService.map.customCoords.setCenter(layerCenter);
49
- this.mapService.setCustomCoordCenter(layerCenter);
50
- mvp = this.mapService.map.customCoords.getMVPMatrix();
51
- sceneCenterMKT = this.mapService.getCustomCoordCenter();
52
- }
53
- const { width, height } = this.rendererService.getViewportSize();
54
- layer.models.forEach((model) => {
55
- model.addUniforms({
56
- [import_l7_core.CameraUniform.ProjectionMatrix]: this.cameraService.getProjectionMatrix(),
57
- [import_l7_core.CameraUniform.ViewMatrix]: this.cameraService.getViewMatrix(),
58
- [import_l7_core.CameraUniform.ViewProjectionMatrix]: this.cameraService.getViewProjectionMatrix(),
59
- [import_l7_core.CameraUniform.Zoom]: this.cameraService.getZoom(),
60
- [import_l7_core.CameraUniform.ZoomScale]: this.cameraService.getZoomScale(),
61
- [import_l7_core.CameraUniform.FocalDistance]: this.cameraService.getFocalDistance(),
62
- [import_l7_core.CameraUniform.CameraPosition]: this.cameraService.getCameraPosition(),
63
- [import_l7_core.CoordinateUniform.CoordinateSystem]: this.coordinateSystemService.getCoordinateSystem(),
64
- [import_l7_core.CoordinateUniform.ViewportCenter]: this.coordinateSystemService.getViewportCenter(),
65
- [import_l7_core.CoordinateUniform.ViewportCenterProjection]: this.coordinateSystemService.getViewportCenterProjection(),
66
- [import_l7_core.CoordinateUniform.PixelsPerDegree]: this.coordinateSystemService.getPixelsPerDegree(),
67
- [import_l7_core.CoordinateUniform.PixelsPerDegree2]: this.coordinateSystemService.getPixelsPerDegree2(),
68
- [import_l7_core.CoordinateUniform.PixelsPerMeter]: this.coordinateSystemService.getPixelsPerMeter(),
69
- [import_l7_core.CoordinateUniform.Mvp]: mvp,
70
- u_SceneCenterMKT: sceneCenterMKT,
71
- u_ViewportSize: [width, height],
72
- u_ModelMatrix: this.cameraService.getModelMatrix(),
73
- u_DevicePixelRatio: import_l7_utils.$window.devicePixelRatio,
74
- u_PickingBuffer: layer.getLayerConfig().pickingBuffer || 0,
75
- u_shaderPick: Number(layer.getShaderPickStat())
76
- });
77
- });
78
- });
79
- }
80
- getLayerCenter(layer) {
81
- const source = layer.getSource();
82
- return source.center;
8
+ exports.default = void 0;
9
+
10
+ var _initializerDefineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/initializerDefineProperty"));
11
+
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
+
14
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
+
16
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
+
18
+ var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime/helpers/applyDecoratedDescriptor"));
19
+
20
+ var _initializerWarningHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/initializerWarningHelper"));
21
+
22
+ var _l7Core = require("@antv/l7-core");
23
+
24
+ var _l7Utils = require("@antv/l7-utils");
25
+
26
+ var _inversify = require("inversify");
27
+
28
+ require("reflect-metadata");
29
+
30
+ var _dec, _dec2, _dec3, _dec4, _dec5, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4;
31
+
32
+ var ShaderUniformPlugin = (
33
+ /**
34
+ * 在渲染之前需要获取当前 Shader 所需 Uniform,例如:
35
+ * 1. 从相机服务中获取 View & ProjectionMatrix,当前缩放等级等等
36
+ * 2. 从坐标系服务中获取当前坐标系,例如是否是偏移坐标系
37
+ * @see https://yuque.antfin-inc.com/yuqi.pyq/fgetpa/doml91
38
+ * 3. 当前 Layer 本身的样式属性
39
+ */
40
+ _dec = (0, _inversify.injectable)(), _dec2 = (0, _inversify.inject)(_l7Core.TYPES.ICameraService), _dec3 = (0, _inversify.inject)(_l7Core.TYPES.ICoordinateSystemService), _dec4 = (0, _inversify.inject)(_l7Core.TYPES.IRendererService), _dec5 = (0, _inversify.inject)(_l7Core.TYPES.IMapService), _dec(_class = (_class2 = /*#__PURE__*/function () {
41
+ function ShaderUniformPlugin() {
42
+ (0, _classCallCheck2.default)(this, ShaderUniformPlugin);
43
+ (0, _initializerDefineProperty2.default)(this, "cameraService", _descriptor, this);
44
+ (0, _initializerDefineProperty2.default)(this, "coordinateSystemService", _descriptor2, this);
45
+ (0, _initializerDefineProperty2.default)(this, "rendererService", _descriptor3, this);
46
+ (0, _initializerDefineProperty2.default)(this, "mapService", _descriptor4, this);
83
47
  }
84
- };
85
- __decorateClass([
86
- (0, import_inversify.inject)(import_l7_core.TYPES.ICameraService)
87
- ], ShaderUniformPlugin.prototype, "cameraService", 2);
88
- __decorateClass([
89
- (0, import_inversify.inject)(import_l7_core.TYPES.ICoordinateSystemService)
90
- ], ShaderUniformPlugin.prototype, "coordinateSystemService", 2);
91
- __decorateClass([
92
- (0, import_inversify.inject)(import_l7_core.TYPES.IRendererService)
93
- ], ShaderUniformPlugin.prototype, "rendererService", 2);
94
- __decorateClass([
95
- (0, import_inversify.inject)(import_l7_core.TYPES.IMapService)
96
- ], ShaderUniformPlugin.prototype, "mapService", 2);
97
- ShaderUniformPlugin = __decorateClass([
98
- (0, import_inversify.injectable)()
99
- ], ShaderUniformPlugin);
100
- // Annotate the CommonJS export names for ESM import in node:
101
- 0 && (module.exports = {});
48
+
49
+ (0, _createClass2.default)(ShaderUniformPlugin, [{
50
+ key: "apply",
51
+ value: function apply(layer) {
52
+ var _this = this;
53
+
54
+ var version = this.mapService.version;
55
+ var mvp = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; // default matrix (for gaode2.x)
56
+
57
+ var sceneCenterMKT = [0, 0];
58
+ layer.hooks.beforeRender.tap('ShaderUniformPlugin', function () {
59
+ // @ts-ignore
60
+ var offset = layer.getLayerConfig().tileOrigin; // 重新计算坐标系参数
61
+
62
+ _this.coordinateSystemService.refresh(offset);
63
+
64
+ if (version === 'GAODE2.x') {
65
+ var layerCenter = _this.getLayerCenter(layer); // @ts-ignore
66
+
67
+
68
+ _this.mapService.map.customCoords.setCenter(layerCenter); // @ts-ignore
69
+
70
+
71
+ _this.mapService.setCustomCoordCenter(layerCenter); // @ts-ignore
72
+
73
+
74
+ mvp = _this.mapService.map.customCoords.getMVPMatrix(); // mvp = amapCustomCoords.getMVPMatrix()
75
+ // @ts-ignore
76
+
77
+ sceneCenterMKT = _this.mapService.getCustomCoordCenter();
78
+ }
79
+
80
+ var _this$rendererService = _this.rendererService.getViewportSize(),
81
+ width = _this$rendererService.width,
82
+ height = _this$rendererService.height;
83
+
84
+ layer.models.forEach(function (model) {
85
+ var _model$addUniforms;
86
+
87
+ model.addUniforms((_model$addUniforms = {}, (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.ProjectionMatrix, _this.cameraService.getProjectionMatrix()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.ViewMatrix, _this.cameraService.getViewMatrix()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.ViewProjectionMatrix, _this.cameraService.getViewProjectionMatrix()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.Zoom, _this.cameraService.getZoom()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.ZoomScale, _this.cameraService.getZoomScale()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.FocalDistance, _this.cameraService.getFocalDistance()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.CameraPosition, _this.cameraService.getCameraPosition()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.CoordinateSystem, _this.coordinateSystemService.getCoordinateSystem()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.ViewportCenter, _this.coordinateSystemService.getViewportCenter()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.ViewportCenterProjection, _this.coordinateSystemService.getViewportCenterProjection()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.PixelsPerDegree, _this.coordinateSystemService.getPixelsPerDegree()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.PixelsPerDegree2, _this.coordinateSystemService.getPixelsPerDegree2()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.PixelsPerMeter, _this.coordinateSystemService.getPixelsPerMeter()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.Mvp, mvp), (0, _defineProperty2.default)(_model$addUniforms, "u_SceneCenterMKT", sceneCenterMKT), (0, _defineProperty2.default)(_model$addUniforms, "u_ViewportSize", [width, height]), (0, _defineProperty2.default)(_model$addUniforms, "u_ModelMatrix", _this.cameraService.getModelMatrix()), (0, _defineProperty2.default)(_model$addUniforms, "u_DevicePixelRatio", _l7Utils.$window.devicePixelRatio), (0, _defineProperty2.default)(_model$addUniforms, "u_PickingBuffer", layer.getLayerConfig().pickingBuffer || 0), (0, _defineProperty2.default)(_model$addUniforms, "u_shaderPick", Number(layer.getShaderPickStat())), _model$addUniforms));
88
+ }); // TODO:脏检查,决定是否需要渲染
89
+ });
90
+ }
91
+ }, {
92
+ key: "getLayerCenter",
93
+ value: function getLayerCenter(layer) {
94
+ var source = layer.getSource();
95
+ return source.center;
96
+ }
97
+ }]);
98
+ return ShaderUniformPlugin;
99
+ }(), (_descriptor = (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "cameraService", [_dec2], {
100
+ configurable: true,
101
+ enumerable: true,
102
+ writable: true,
103
+ initializer: null
104
+ }), _descriptor2 = (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "coordinateSystemService", [_dec3], {
105
+ configurable: true,
106
+ enumerable: true,
107
+ writable: true,
108
+ initializer: null
109
+ }), _descriptor3 = (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "rendererService", [_dec4], {
110
+ configurable: true,
111
+ enumerable: true,
112
+ writable: true,
113
+ initializer: null
114
+ }), _descriptor4 = (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "mapService", [_dec5], {
115
+ configurable: true,
116
+ enumerable: true,
117
+ writable: true,
118
+ initializer: null
119
+ })), _class2)) || _class);
120
+ exports.default = ShaderUniformPlugin;
@@ -1,49 +1,42 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var __decorateClass = (decorators, target, key, kind) => {
19
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
20
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
21
- if (decorator = decorators[i])
22
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
23
- if (kind && result)
24
- __defProp(target, key, result);
25
- return result;
26
- };
27
-
28
- // src/plugins/UpdateModelPlugin.ts
29
- var UpdateModelPlugin_exports = {};
30
- __export(UpdateModelPlugin_exports, {
31
- default: () => UpdateModelPlugin
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
32
7
  });
33
- module.exports = __toCommonJS(UpdateModelPlugin_exports);
34
- var import_inversify = require("inversify");
35
- var import_reflect_metadata = require("reflect-metadata");
36
- var UpdateModelPlugin = class {
37
- apply(layer) {
38
- layer.hooks.beforeRender.tap("UpdateModelPlugin", () => {
39
- if (layer.layerModel) {
40
- layer.layerModel.needUpdate();
41
- }
42
- });
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 _inversify = require("inversify");
15
+
16
+ require("reflect-metadata");
17
+
18
+ var _dec, _class;
19
+
20
+ var UpdateModelPlugin = (
21
+ /**
22
+ * Model 更新
23
+ */
24
+ _dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
25
+ function UpdateModelPlugin() {
26
+ (0, _classCallCheck2.default)(this, UpdateModelPlugin);
43
27
  }
44
- };
45
- UpdateModelPlugin = __decorateClass([
46
- (0, import_inversify.injectable)()
47
- ], UpdateModelPlugin);
48
- // Annotate the CommonJS export names for ESM import in node:
49
- 0 && (module.exports = {});
28
+
29
+ (0, _createClass2.default)(UpdateModelPlugin, [{
30
+ key: "apply",
31
+ value: function apply(layer) {
32
+ layer.hooks.beforeRender.tap('UpdateModelPlugin', function () {
33
+ // 处理文本更新
34
+ if (layer.layerModel) {
35
+ layer.layerModel.needUpdate();
36
+ }
37
+ });
38
+ }
39
+ }]);
40
+ return UpdateModelPlugin;
41
+ }()) || _class);
42
+ exports.default = UpdateModelPlugin;
@@ -1,80 +1,98 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var __decorateClass = (decorators, target, key, kind) => {
19
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
20
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
21
- if (decorator = decorators[i])
22
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
23
- if (kind && result)
24
- __defProp(target, key, result);
25
- return result;
26
- };
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
27
4
 
28
- // src/plugins/UpdateStyleAttributePlugin.ts
29
- var UpdateStyleAttributePlugin_exports = {};
30
- __export(UpdateStyleAttributePlugin_exports, {
31
- default: () => UpdateStyleAttributePlugin
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
32
7
  });
33
- module.exports = __toCommonJS(UpdateStyleAttributePlugin_exports);
34
- var import_inversify = require("inversify");
35
- var import_reflect_metadata = require("reflect-metadata");
36
- var UpdateStyleAttributePlugin = class {
37
- apply(layer, {
38
- styleAttributeService
39
- }) {
40
- layer.hooks.init.tap("UpdateStyleAttributePlugin", () => {
41
- this.initStyleAttribute(layer, { styleAttributeService });
42
- });
43
- layer.hooks.beforeRender.tap("UpdateStyleAttributePlugin", () => {
44
- if (layer.layerModelNeedUpdate) {
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 _inversify = require("inversify");
15
+
16
+ require("reflect-metadata");
17
+
18
+ var _dec, _class;
19
+
20
+ var UpdateStyleAttributePlugin = (
21
+ /**
22
+ * 在初始化阶段完成属性的注册,以及首次根据 Layer 指定的三角化方法完成 indices 和 attribute 的创建
23
+ */
24
+ _dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
25
+ function UpdateStyleAttributePlugin() {
26
+ (0, _classCallCheck2.default)(this, UpdateStyleAttributePlugin);
27
+ }
28
+
29
+ (0, _createClass2.default)(UpdateStyleAttributePlugin, [{
30
+ key: "apply",
31
+ value: function apply(layer, _ref) {
32
+ var _this = this;
33
+
34
+ var styleAttributeService = _ref.styleAttributeService;
35
+ layer.hooks.init.tap('UpdateStyleAttributePlugin', function () {
36
+ _this.initStyleAttribute(layer, {
37
+ styleAttributeService: styleAttributeService
38
+ });
39
+ }); // layer.hooks.beforeRenderData.tap('styleAttributeService', () => {
40
+ // // layer.layerModelNeedUpdate = true;
41
+ // return true;
42
+ // });
43
+
44
+ layer.hooks.beforeRender.tap('UpdateStyleAttributePlugin', function () {
45
+ if (layer.layerModelNeedUpdate) {
46
+ return;
47
+ }
48
+
49
+ _this.updateStyleAtrribute(layer, {
50
+ styleAttributeService: styleAttributeService
51
+ });
52
+ });
53
+ }
54
+ }, {
55
+ key: "updateStyleAtrribute",
56
+ value: function updateStyleAtrribute(layer, _ref2) {
57
+ var styleAttributeService = _ref2.styleAttributeService;
58
+ var attributes = styleAttributeService.getLayerStyleAttributes() || [];
59
+ var filter = styleAttributeService.getLayerStyleAttribute('filter');
60
+ var shape = styleAttributeService.getLayerStyleAttribute('shape');
61
+
62
+ if (filter && filter.needRegenerateVertices // ||
63
+ // (shape && shape.needRegenerateVertices) // TODO:Shape 更新重新build
64
+ ) {
65
+ layer.layerModelNeedUpdate = true;
66
+ attributes.forEach(function (attr) {
67
+ return attr.needRegenerateVertices = false;
68
+ });
45
69
  return;
46
70
  }
47
- this.updateStyleAtrribute(layer, { styleAttributeService });
48
- });
49
- }
50
- updateStyleAtrribute(layer, {
51
- styleAttributeService
52
- }) {
53
- const attributes = styleAttributeService.getLayerStyleAttributes() || [];
54
- const filter = styleAttributeService.getLayerStyleAttribute("filter");
55
- const shape = styleAttributeService.getLayerStyleAttribute("shape");
56
- if (filter && filter.needRegenerateVertices) {
57
- layer.layerModelNeedUpdate = true;
58
- attributes.forEach((attr) => attr.needRegenerateVertices = false);
59
- return;
71
+
72
+ attributes.filter(function (attribute) {
73
+ return attribute.needRegenerateVertices;
74
+ }).forEach(function (attribute) {
75
+ // 精确更新某个/某些 feature(s),需要传入 featureIdx d
76
+ styleAttributeService.updateAttributeByFeatureRange(attribute.name, layer.getEncodedData(), // 获取经过 mapping 最新的数据
77
+ attribute.featureRange.startIndex, attribute.featureRange.endIndex);
78
+ attribute.needRegenerateVertices = false;
79
+ });
60
80
  }
61
- attributes.filter((attribute) => attribute.needRegenerateVertices).forEach((attribute) => {
62
- styleAttributeService.updateAttributeByFeatureRange(attribute.name, layer.getEncodedData(), attribute.featureRange.startIndex, attribute.featureRange.endIndex);
63
- attribute.needRegenerateVertices = false;
64
- });
65
- }
66
- initStyleAttribute(layer, {
67
- styleAttributeService
68
- }) {
69
- const attributes = styleAttributeService.getLayerStyleAttributes() || [];
70
- attributes.filter((attribute) => attribute.needRegenerateVertices).forEach((attribute) => {
71
- styleAttributeService.updateAttributeByFeatureRange(attribute.name, layer.getEncodedData(), attribute.featureRange.startIndex, attribute.featureRange.endIndex);
72
- attribute.needRegenerateVertices = false;
73
- });
74
- }
75
- };
76
- UpdateStyleAttributePlugin = __decorateClass([
77
- (0, import_inversify.injectable)()
78
- ], UpdateStyleAttributePlugin);
79
- // Annotate the CommonJS export names for ESM import in node:
80
- 0 && (module.exports = {});
81
+ }, {
82
+ key: "initStyleAttribute",
83
+ value: function initStyleAttribute(layer, _ref3) {
84
+ var styleAttributeService = _ref3.styleAttributeService;
85
+ var attributes = styleAttributeService.getLayerStyleAttributes() || [];
86
+ attributes.filter(function (attribute) {
87
+ return attribute.needRegenerateVertices;
88
+ }).forEach(function (attribute) {
89
+ // 精确更新某个/某些 feature(s),需要传入 featureIdx d
90
+ styleAttributeService.updateAttributeByFeatureRange(attribute.name, layer.getEncodedData(), // 获取经过 mapping 最新的数据
91
+ attribute.featureRange.startIndex, attribute.featureRange.endIndex);
92
+ attribute.needRegenerateVertices = false;
93
+ });
94
+ }
95
+ }]);
96
+ return UpdateStyleAttributePlugin;
97
+ }()) || _class);
98
+ exports.default = UpdateStyleAttributePlugin;