@antv/l7-layers 2.9.25-alpha.0 → 2.9.26-alpha.1

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 (126) hide show
  1. package/es/heatmap/models/heatmap.js +1 -1
  2. package/es/tile/tileFactory/base.d.ts +1 -1
  3. package/es/tile/utils.js +1 -1
  4. package/lib/Geometry/index.js +114 -77
  5. package/lib/Geometry/models/billboard.js +232 -181
  6. package/lib/Geometry/models/index.js +18 -34
  7. package/lib/Geometry/models/plane.js +407 -278
  8. package/lib/Geometry/models/sprite.js +291 -189
  9. package/lib/canvas/index.js +101 -66
  10. package/lib/canvas/models/canvas.js +207 -140
  11. package/lib/canvas/models/index.js +12 -30
  12. package/lib/citybuliding/building.js +98 -63
  13. package/lib/citybuliding/models/build.js +192 -146
  14. package/lib/core/BaseLayer.js +1331 -814
  15. package/lib/core/BaseModel.js +457 -279
  16. package/lib/core/interface.js +40 -53
  17. package/lib/core/schema.js +21 -39
  18. package/lib/core/shape/Path.js +67 -79
  19. package/lib/core/shape/extrude.js +132 -91
  20. package/lib/core/triangulation.js +378 -196
  21. package/lib/earth/index.js +100 -62
  22. package/lib/earth/models/atmosphere.js +146 -112
  23. package/lib/earth/models/base.js +210 -150
  24. package/lib/earth/models/bloomsphere.js +146 -112
  25. package/lib/earth/utils.js +111 -91
  26. package/lib/heatmap/index.js +149 -92
  27. package/lib/heatmap/models/grid.js +118 -91
  28. package/lib/heatmap/models/grid3d.js +155 -123
  29. package/lib/heatmap/models/heatmap.js +475 -338
  30. package/lib/heatmap/models/hexagon.js +121 -92
  31. package/lib/heatmap/models/index.js +22 -37
  32. package/lib/heatmap/triangulation.js +31 -47
  33. package/lib/image/index.js +111 -74
  34. package/lib/image/models/dataImage.js +232 -174
  35. package/lib/image/models/image.js +175 -128
  36. package/lib/image/models/index.js +15 -32
  37. package/lib/index.js +263 -97
  38. package/lib/line/index.js +131 -85
  39. package/lib/line/models/arc.js +352 -237
  40. package/lib/line/models/arc_3d.js +334 -228
  41. package/lib/line/models/earthArc_3d.js +336 -228
  42. package/lib/line/models/great_circle.js +291 -200
  43. package/lib/line/models/half.js +286 -201
  44. package/lib/line/models/index.js +42 -50
  45. package/lib/line/models/line.js +428 -299
  46. package/lib/line/models/linearline.js +277 -203
  47. package/lib/line/models/simpleLine.js +239 -175
  48. package/lib/line/models/tile.js +348 -237
  49. package/lib/line/models/wall.js +327 -235
  50. package/lib/mask/index.js +92 -59
  51. package/lib/mask/models/fill.js +134 -82
  52. package/lib/mask/models/index.js +12 -30
  53. package/lib/plugins/DataMappingPlugin.js +342 -224
  54. package/lib/plugins/DataSourcePlugin.js +102 -87
  55. package/lib/plugins/FeatureScalePlugin.js +330 -240
  56. package/lib/plugins/LayerAnimateStylePlugin.js +61 -55
  57. package/lib/plugins/LayerModelPlugin.js +80 -73
  58. package/lib/plugins/LayerStylePlugin.js +48 -51
  59. package/lib/plugins/LightingPlugin.js +80 -68
  60. package/lib/plugins/MultiPassRendererPlugin.js +91 -65
  61. package/lib/plugins/PixelPickingPlugin.js +150 -109
  62. package/lib/plugins/RegisterStyleAttributePlugin.js +110 -110
  63. package/lib/plugins/ShaderUniformPlugin.js +118 -99
  64. package/lib/plugins/UpdateModelPlugin.js +40 -47
  65. package/lib/plugins/UpdateStyleAttributePlugin.js +93 -75
  66. package/lib/point/index.js +226 -150
  67. package/lib/point/models/earthExtrude.js +279 -201
  68. package/lib/point/models/earthFill.js +287 -202
  69. package/lib/point/models/extrude.js +299 -203
  70. package/lib/point/models/fill.js +406 -275
  71. package/lib/point/models/fillmage.js +365 -256
  72. package/lib/point/models/image.js +241 -168
  73. package/lib/point/models/index.js +46 -52
  74. package/lib/point/models/normal.js +183 -134
  75. package/lib/point/models/radar.js +304 -211
  76. package/lib/point/models/simplePoint.js +194 -142
  77. package/lib/point/models/text.js +608 -385
  78. package/lib/point/models/tile.js +314 -223
  79. package/lib/point/shape/extrude.js +56 -52
  80. package/lib/polygon/index.js +154 -102
  81. package/lib/polygon/models/extrude.js +311 -223
  82. package/lib/polygon/models/fill.js +215 -153
  83. package/lib/polygon/models/index.js +46 -52
  84. package/lib/polygon/models/ocean.js +244 -173
  85. package/lib/polygon/models/tile.js +144 -100
  86. package/lib/polygon/models/water.js +222 -153
  87. package/lib/raster/buffers/triangulation.js +27 -40
  88. package/lib/raster/index.js +115 -75
  89. package/lib/raster/models/index.js +16 -33
  90. package/lib/raster/models/raster.js +178 -135
  91. package/lib/raster/raster.js +187 -132
  92. package/lib/tile/interface.js +4 -16
  93. package/lib/tile/manager/tileConfigManager.js +125 -86
  94. package/lib/tile/manager/tileLayerManager.js +313 -229
  95. package/lib/tile/manager/tilePickerManager.js +192 -123
  96. package/lib/tile/models/tileModel.js +71 -52
  97. package/lib/tile/tileFactory/base.js +432 -309
  98. package/lib/tile/tileFactory/index.js +51 -49
  99. package/lib/tile/tileFactory/line.js +65 -50
  100. package/lib/tile/tileFactory/point.js +65 -50
  101. package/lib/tile/tileFactory/polygon.js +65 -50
  102. package/lib/tile/tileFactory/raster.js +66 -54
  103. package/lib/tile/tileFactory/rasterData.js +88 -76
  104. package/lib/tile/tileFactory/rasterDataLayer.js +97 -62
  105. package/lib/tile/tileFactory/vectorLayer.js +168 -109
  106. package/lib/tile/tileLayer/baseTileLayer.js +420 -221
  107. package/lib/tile/tmsTileLayer.js +110 -67
  108. package/lib/tile/utils.js +110 -92
  109. package/lib/utils/blend.js +59 -79
  110. package/lib/utils/collision-index.js +107 -64
  111. package/lib/utils/dataMappingStyle.js +105 -60
  112. package/lib/utils/extrude_polyline.js +600 -398
  113. package/lib/utils/grid-index.js +163 -111
  114. package/lib/utils/layerData.js +130 -99
  115. package/lib/utils/multiPassRender.js +49 -41
  116. package/lib/utils/polylineNormal.js +148 -96
  117. package/lib/utils/simpleLine.js +100 -85
  118. package/lib/utils/symbol-layout.js +219 -116
  119. package/lib/utils/updateShape.js +15 -41
  120. package/lib/wind/index.js +109 -71
  121. package/lib/wind/models/index.js +12 -30
  122. package/lib/wind/models/utils.js +144 -105
  123. package/lib/wind/models/wind.js +333 -224
  124. package/lib/wind/models/windRender.js +329 -218
  125. package/lib/wind/models/windShader.js +23 -181
  126. package/package.json +6 -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;