@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,246 +1,330 @@
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/tile/manager/tileLayerManager.ts
23
- var tileLayerManager_exports = {};
24
- __export(tileLayerManager_exports, {
25
- TileLayerManager: () => TileLayerManager
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(tileLayerManager_exports);
28
- var import_l7_utils = require("@antv/l7-utils");
29
- var import_tileFactory = require("../tileFactory");
30
- var import_utils = require("../utils");
31
- var import_tileConfigManager = __toESM(require("./tileConfigManager"));
32
- var import_tilePickerManager = __toESM(require("./tilePickerManager"));
33
- var TileLayerManager = class {
34
- constructor(parent, mapService, rendererService, pickingService, layerService, transforms) {
8
+ exports.TileLayerManager = void 0;
9
+
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
+
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+
14
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
+
16
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
+
18
+ var _l7Utils = require("@antv/l7-utils");
19
+
20
+ var _tileFactory = require("../tileFactory");
21
+
22
+ var _utils = require("../utils");
23
+
24
+ var _tileConfigManager = _interopRequireDefault(require("./tileConfigManager"));
25
+
26
+ var _tilePickerManager = _interopRequireDefault(require("./tilePickerManager"));
27
+
28
+ var TileLayerManager = /*#__PURE__*/function () {
29
+ function TileLayerManager(parent, mapService, rendererService, pickingService, layerService, transforms) {
30
+ (0, _classCallCheck2.default)(this, TileLayerManager);
35
31
  this.parent = parent;
36
32
  this.children = parent.layerChildren;
37
33
  this.mapService = mapService;
38
34
  this.rendererService = rendererService;
39
35
  this.transforms = transforms;
40
- this.tilePickManager = new import_tilePickerManager.default(parent, rendererService, pickingService, this.children, layerService);
41
- this.tileConfigManager = new import_tileConfigManager.default();
36
+ this.tilePickManager = new _tilePickerManager.default(parent, rendererService, pickingService, this.children, layerService);
37
+ this.tileConfigManager = new _tileConfigManager.default();
42
38
  this.setSubLayerInitOptipn();
43
39
  this.setConfigListener();
44
40
  this.initTileFactory();
45
41
  }
46
- createTile(tile) {
47
- return this.tileFactory.createTile(tile, this.initOptions);
48
- }
49
- updateLayersConfig(layers, key, value) {
50
- layers.map((layer) => {
51
- if (key === "mask") {
52
- layer.style({
53
- mask: value
54
- });
55
- } else {
56
- layer.updateLayerConfig({
57
- [key]: value
58
- });
59
- }
60
- });
61
- }
62
- addChild(layer) {
63
- this.children.push(layer);
64
- }
65
- addChilds(layers) {
66
- this.children.push(...layers);
67
- }
68
- removeChilds(layerIDList, refresh = true) {
69
- const remveLayerList = [];
70
- const cacheLayerList = [];
71
- this.children.filter((child) => {
72
- layerIDList.includes(child.id) ? remveLayerList.push(child) : cacheLayerList.push(child);
73
- });
74
- remveLayerList.map((layer) => layer.destroy(refresh));
75
- this.children = cacheLayerList;
76
- }
77
- removeChild(layer) {
78
- const layerIndex = this.children.indexOf(layer);
79
- if (layerIndex > -1) {
80
- this.children.splice(layerIndex, 1);
42
+
43
+ (0, _createClass2.default)(TileLayerManager, [{
44
+ key: "createTile",
45
+ value: function createTile(tile) {
46
+ return this.tileFactory.createTile(tile, this.initOptions);
81
47
  }
82
- layer.destroy();
83
- }
84
- getChilds(layerIDList) {
85
- return this.children.filter((child) => layerIDList.includes(child.id));
86
- }
87
- getChild(layerID) {
88
- return this.children.filter((child) => child.id === layerID)[0];
89
- }
90
- clearChild() {
91
- this.children.forEach((layer) => {
92
- layer.destroy();
93
- });
94
- this.children.slice(0, this.children.length);
95
- }
96
- hasChild(layer) {
97
- return this.children.includes(layer);
98
- }
99
- render() {
100
- var _a, _b;
101
- (_a = this.tileConfigManager) == null ? void 0 : _a.checkConfig(this.parent);
102
- (_b = this.tilePickManager) == null ? void 0 : _b.normalRender(this.children);
103
- }
104
- pickLayers(target) {
105
- var _a;
106
- return (_a = this.tilePickManager) == null ? void 0 : _a.pickRender(this.children, target);
107
- }
108
- setSubLayerInitOptipn() {
109
- var _a;
110
- const {
111
- zIndex = 0,
112
- opacity = 1,
113
- mask = false,
114
- stroke = "#fff",
115
- strokeWidth = 0,
116
- strokeOpacity = 1,
117
- clampLow = true,
118
- clampHigh = true,
119
- domain = [0, 1],
120
- rampColors = {
121
- colors: [
122
- "rgb(166,97,26)",
123
- "rgb(223,194,125)",
124
- "rgb(245,245,245)",
125
- "rgb(128,205,193)",
126
- "rgb(1,133,113)"
127
- ],
128
- positions: [0, 0.25, 0.5, 0.75, 1]
129
- },
130
- featureId = "id",
131
- workerEnabled = false,
132
- sourceLayer,
133
- pixelConstant = 0,
134
- pixelConstantR = 256 * 256,
135
- pixelConstantG = 256,
136
- pixelConstantB = 1,
137
- pixelConstantRGB = 0.1
138
- } = this.parent.getLayerConfig();
139
- const colorValue = this.tileConfigManager.getAttributeScale(this.parent, "color");
140
- const sizeValue = this.tileConfigManager.getAttributeScale(this.parent, "size");
141
- const source = this.parent.getSource();
142
- const { coords } = ((_a = source == null ? void 0 : source.data) == null ? void 0 : _a.tilesetOptions) || {};
143
- const parentParserType = source.getParserType();
144
- const layerShape = (0, import_utils.getLayerShape)(this.parent.type, this.parent);
145
- if (rampColors) {
146
- this.rampColorsData = (0, import_l7_utils.generateColorRamp)(rampColors);
147
- }
148
- this.initOptions = {
149
- layerType: this.parent.type,
150
- transforms: this.transforms,
151
- shape: layerShape,
152
- zIndex,
153
- opacity,
154
- sourceLayer: parentParserType === "geojsonvt" ? "geojsonvt" : sourceLayer,
155
- coords,
156
- featureId,
157
- color: colorValue,
158
- size: sizeValue,
159
- mask: (0, import_utils.getMaskValue)(this.parent.type, mask),
160
- stroke,
161
- strokeWidth,
162
- strokeOpacity,
163
- clampLow,
164
- clampHigh,
165
- domain,
166
- rampColors,
167
- rampColorsData: this.rampColorsData,
168
- workerEnabled,
169
- pixelConstant,
170
- pixelConstantR,
171
- pixelConstantG,
172
- pixelConstantB,
173
- pixelConstantRGB
174
- };
175
- }
176
- setConfigListener() {
177
- var _a, _b, _c;
178
- this.tileConfigManager.setConfig("opacity", this.initOptions.opacity);
179
- this.tileConfigManager.setConfig("zIndex", this.initOptions.zIndex);
180
- this.tileConfigManager.setConfig("mask", this.initOptions.mask);
181
- if (this.parent.type === "RasterLayer") {
182
- this.tileConfigManager.setConfig("rampColors", this.initOptions.rampColors);
183
- this.tileConfigManager.setConfig("domain", this.initOptions.domain);
184
- this.tileConfigManager.setConfig("clampHigh", this.initOptions.clampHigh);
185
- this.tileConfigManager.setConfig("clampLow", this.initOptions.clampLow);
186
- this.tileConfigManager.setConfig("pixelConstant", this.initOptions.pixelConstant);
187
- this.tileConfigManager.setConfig("pixelConstantR", this.initOptions.pixelConstantR);
188
- this.tileConfigManager.setConfig("pixelConstantG", this.initOptions.pixelConstantG);
189
- this.tileConfigManager.setConfig("pixelConstantB", this.initOptions.pixelConstantB);
190
- this.tileConfigManager.setConfig("pixelConstantRGB", this.initOptions.pixelConstantRGB);
191
- } else {
192
- this.tileConfigManager.setConfig("stroke", this.initOptions.stroke);
193
- this.tileConfigManager.setConfig("strokeWidth", this.initOptions.strokeWidth);
194
- this.tileConfigManager.setConfig("strokeOpacity", this.initOptions.strokeOpacity);
195
- this.tileConfigManager.setConfig("color", (_a = this.parent.getAttribute("color")) == null ? void 0 : _a.scale);
196
- this.tileConfigManager.setConfig("shape", (_b = this.parent.getAttribute("shape")) == null ? void 0 : _b.scale);
197
- this.tileConfigManager.setConfig("size", (_c = this.parent.getAttribute("size")) == null ? void 0 : _c.scale);
198
- }
199
- this.tileConfigManager.on("updateConfig", (updateConfigs) => {
200
- updateConfigs.map((key) => {
201
- this.updateStyle(key);
202
- return "";
48
+ }, {
49
+ key: "updateLayersConfig",
50
+ value: function updateLayersConfig(layers, key, value) {
51
+ layers.map(function (layer) {
52
+ if (key === 'mask') {
53
+ // Tip: 栅格瓦片生效、设置全局的 mask、瓦片被全局的 mask 影响
54
+ layer.style({
55
+ mask: value
56
+ });
57
+ } else {
58
+ layer.updateLayerConfig((0, _defineProperty2.default)({}, key, value));
59
+ }
203
60
  });
204
- });
205
- }
206
- updateStyle(style) {
207
- var _a;
208
- let updateValue = null;
209
- if (["size", "color", "shape"].includes(style)) {
210
- const scaleValue = (_a = this.parent.getAttribute(style)) == null ? void 0 : _a.scale;
211
- if (!scaleValue) {
212
- return;
61
+ }
62
+ }, {
63
+ key: "addChild",
64
+ value: function addChild(layer) {
65
+ this.children.push(layer);
66
+ }
67
+ }, {
68
+ key: "addChilds",
69
+ value: function addChilds(layers) {
70
+ var _this$children;
71
+
72
+ (_this$children = this.children).push.apply(_this$children, (0, _toConsumableArray2.default)(layers));
73
+ }
74
+ }, {
75
+ key: "removeChilds",
76
+ value: function removeChilds(layerIDList) {
77
+ var refresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
78
+ var remveLayerList = [];
79
+ var cacheLayerList = [];
80
+ this.children.filter(function (child) {
81
+ layerIDList.includes(child.id) ? remveLayerList.push(child) : cacheLayerList.push(child);
82
+ });
83
+ remveLayerList.map(function (layer) {
84
+ return layer.destroy(refresh);
85
+ });
86
+ this.children = cacheLayerList;
87
+ }
88
+ }, {
89
+ key: "removeChild",
90
+ value: function removeChild(layer) {
91
+ var layerIndex = this.children.indexOf(layer);
92
+
93
+ if (layerIndex > -1) {
94
+ this.children.splice(layerIndex, 1);
213
95
  }
214
- updateValue = scaleValue;
215
- this.children.map((child) => {
216
- this.tileFactory.setStyleAttributeField(child, style, scaleValue);
217
- return "";
96
+
97
+ layer.destroy();
98
+ }
99
+ }, {
100
+ key: "getChilds",
101
+ value: function getChilds(layerIDList) {
102
+ return this.children.filter(function (child) {
103
+ return layerIDList.includes(child.id);
218
104
  });
219
- } else {
220
- const layerConfig = this.parent.getLayerConfig();
221
- if (!(style in layerConfig)) {
222
- return;
105
+ }
106
+ }, {
107
+ key: "getChild",
108
+ value: function getChild(layerID) {
109
+ return this.children.filter(function (child) {
110
+ return child.id === layerID;
111
+ })[0];
112
+ }
113
+ }, {
114
+ key: "clearChild",
115
+ value: function clearChild() {
116
+ this.children.forEach(function (layer) {
117
+ layer.destroy();
118
+ });
119
+ this.children.slice(0, this.children.length);
120
+ }
121
+ }, {
122
+ key: "hasChild",
123
+ value: function hasChild(layer) {
124
+ return this.children.includes(layer);
125
+ }
126
+ }, {
127
+ key: "render",
128
+ value: function render() {
129
+ var _this$tileConfigManag, _this$tilePickManager;
130
+
131
+ (_this$tileConfigManag = this.tileConfigManager) === null || _this$tileConfigManag === void 0 ? void 0 : _this$tileConfigManag.checkConfig(this.parent);
132
+ (_this$tilePickManager = this.tilePickManager) === null || _this$tilePickManager === void 0 ? void 0 : _this$tilePickManager.normalRender(this.children);
133
+ }
134
+ }, {
135
+ key: "pickLayers",
136
+ value: function pickLayers(target) {
137
+ var _this$tilePickManager2;
138
+
139
+ return (_this$tilePickManager2 = this.tilePickManager) === null || _this$tilePickManager2 === void 0 ? void 0 : _this$tilePickManager2.pickRender(this.children, target);
140
+ }
141
+ }, {
142
+ key: "setSubLayerInitOptipn",
143
+ value: function setSubLayerInitOptipn() {
144
+ var _source$data;
145
+
146
+ var _ref = this.parent.getLayerConfig(),
147
+ _ref$zIndex = _ref.zIndex,
148
+ zIndex = _ref$zIndex === void 0 ? 0 : _ref$zIndex,
149
+ _ref$opacity = _ref.opacity,
150
+ opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
151
+ _ref$mask = _ref.mask,
152
+ mask = _ref$mask === void 0 ? false : _ref$mask,
153
+ _ref$stroke = _ref.stroke,
154
+ stroke = _ref$stroke === void 0 ? '#fff' : _ref$stroke,
155
+ _ref$strokeWidth = _ref.strokeWidth,
156
+ strokeWidth = _ref$strokeWidth === void 0 ? 0 : _ref$strokeWidth,
157
+ _ref$strokeOpacity = _ref.strokeOpacity,
158
+ strokeOpacity = _ref$strokeOpacity === void 0 ? 1 : _ref$strokeOpacity,
159
+ _ref$clampLow = _ref.clampLow,
160
+ clampLow = _ref$clampLow === void 0 ? true : _ref$clampLow,
161
+ _ref$clampHigh = _ref.clampHigh,
162
+ clampHigh = _ref$clampHigh === void 0 ? true : _ref$clampHigh,
163
+ _ref$domain = _ref.domain,
164
+ domain = _ref$domain === void 0 ? [0, 1] : _ref$domain,
165
+ _ref$rampColors = _ref.rampColors,
166
+ rampColors = _ref$rampColors === void 0 ? {
167
+ colors: ['rgb(166,97,26)', 'rgb(223,194,125)', 'rgb(245,245,245)', 'rgb(128,205,193)', 'rgb(1,133,113)'],
168
+ positions: [0, 0.25, 0.5, 0.75, 1.0]
169
+ } : _ref$rampColors,
170
+ _ref$featureId = _ref.featureId,
171
+ featureId = _ref$featureId === void 0 ? 'id' : _ref$featureId,
172
+ _ref$workerEnabled = _ref.workerEnabled,
173
+ workerEnabled = _ref$workerEnabled === void 0 ? false : _ref$workerEnabled,
174
+ sourceLayer = _ref.sourceLayer,
175
+ _ref$pixelConstant = _ref.pixelConstant,
176
+ pixelConstant = _ref$pixelConstant === void 0 ? 0 : _ref$pixelConstant,
177
+ _ref$pixelConstantR = _ref.pixelConstantR,
178
+ pixelConstantR = _ref$pixelConstantR === void 0 ? 256 * 256 : _ref$pixelConstantR,
179
+ _ref$pixelConstantG = _ref.pixelConstantG,
180
+ pixelConstantG = _ref$pixelConstantG === void 0 ? 256 : _ref$pixelConstantG,
181
+ _ref$pixelConstantB = _ref.pixelConstantB,
182
+ pixelConstantB = _ref$pixelConstantB === void 0 ? 1 : _ref$pixelConstantB,
183
+ _ref$pixelConstantRGB = _ref.pixelConstantRGB,
184
+ pixelConstantRGB = _ref$pixelConstantRGB === void 0 ? 0.1 : _ref$pixelConstantRGB;
185
+
186
+ var colorValue = this.tileConfigManager.getAttributeScale(this.parent, 'color');
187
+ var sizeValue = this.tileConfigManager.getAttributeScale(this.parent, 'size');
188
+ var source = this.parent.getSource();
189
+
190
+ var _ref2 = (source === null || source === void 0 ? void 0 : (_source$data = source.data) === null || _source$data === void 0 ? void 0 : _source$data.tilesetOptions) || {},
191
+ coords = _ref2.coords;
192
+
193
+ var parentParserType = source.getParserType();
194
+ var layerShape = (0, _utils.getLayerShape)(this.parent.type, this.parent);
195
+
196
+ if (rampColors) {
197
+ // 构建统一的色带贴图
198
+ this.rampColorsData = (0, _l7Utils.generateColorRamp)(rampColors);
223
199
  }
224
- const config = layerConfig[style];
225
- updateValue = config;
226
- this.updateLayersConfig(this.children, style, config);
227
- if (style === "rampColors" && config) {
228
- this.rampColorsData = (0, import_l7_utils.generateColorRamp)(config);
200
+
201
+ this.initOptions = {
202
+ layerType: this.parent.type,
203
+ transforms: this.transforms,
204
+ shape: layerShape,
205
+ zIndex: zIndex,
206
+ opacity: opacity,
207
+ sourceLayer: parentParserType === 'geojsonvt' ? 'geojsonvt' : sourceLayer,
208
+ coords: coords,
209
+ featureId: featureId,
210
+ color: colorValue,
211
+ size: sizeValue,
212
+ mask: (0, _utils.getMaskValue)(this.parent.type, mask),
213
+ stroke: stroke,
214
+ strokeWidth: strokeWidth,
215
+ strokeOpacity: strokeOpacity,
216
+ // raster tiff
217
+ clampLow: clampLow,
218
+ clampHigh: clampHigh,
219
+ domain: domain,
220
+ rampColors: rampColors,
221
+ rampColorsData: this.rampColorsData,
222
+ // worker
223
+ workerEnabled: workerEnabled,
224
+ pixelConstant: pixelConstant,
225
+ pixelConstantR: pixelConstantR,
226
+ pixelConstantG: pixelConstantG,
227
+ pixelConstantB: pixelConstantB,
228
+ pixelConstantRGB: pixelConstantRGB
229
+ };
230
+ }
231
+ }, {
232
+ key: "setConfigListener",
233
+ value: function setConfigListener() {
234
+ var _this = this;
235
+
236
+ // RasterLayer PolygonLayer LineLayer PointLayer
237
+ // All Tile Layer Need Listen
238
+ this.tileConfigManager.setConfig('opacity', this.initOptions.opacity);
239
+ this.tileConfigManager.setConfig('zIndex', this.initOptions.zIndex);
240
+ this.tileConfigManager.setConfig('mask', this.initOptions.mask);
241
+
242
+ if (this.parent.type === 'RasterLayer') {
243
+ // Raster Tile Layer Need Listen
244
+ this.tileConfigManager.setConfig('rampColors', this.initOptions.rampColors);
245
+ this.tileConfigManager.setConfig('domain', this.initOptions.domain);
246
+ this.tileConfigManager.setConfig('clampHigh', this.initOptions.clampHigh);
247
+ this.tileConfigManager.setConfig('clampLow', this.initOptions.clampLow);
248
+ this.tileConfigManager.setConfig('pixelConstant', this.initOptions.pixelConstant);
249
+ this.tileConfigManager.setConfig('pixelConstantR', this.initOptions.pixelConstantR);
250
+ this.tileConfigManager.setConfig('pixelConstantG', this.initOptions.pixelConstantG);
251
+ this.tileConfigManager.setConfig('pixelConstantB', this.initOptions.pixelConstantB);
252
+ this.tileConfigManager.setConfig('pixelConstantRGB', this.initOptions.pixelConstantRGB);
253
+ } else {
254
+ var _this$parent$getAttri, _this$parent$getAttri2, _this$parent$getAttri3;
255
+
256
+ // Vector Tile Layer Need Listen
257
+ this.tileConfigManager.setConfig('stroke', this.initOptions.stroke);
258
+ this.tileConfigManager.setConfig('strokeWidth', this.initOptions.strokeWidth);
259
+ this.tileConfigManager.setConfig('strokeOpacity', this.initOptions.strokeOpacity);
260
+ this.tileConfigManager.setConfig('color', (_this$parent$getAttri = this.parent.getAttribute('color')) === null || _this$parent$getAttri === void 0 ? void 0 : _this$parent$getAttri.scale);
261
+ this.tileConfigManager.setConfig('shape', (_this$parent$getAttri2 = this.parent.getAttribute('shape')) === null || _this$parent$getAttri2 === void 0 ? void 0 : _this$parent$getAttri2.scale);
262
+ this.tileConfigManager.setConfig('size', (_this$parent$getAttri3 = this.parent.getAttribute('size')) === null || _this$parent$getAttri3 === void 0 ? void 0 : _this$parent$getAttri3.scale);
229
263
  }
264
+
265
+ this.tileConfigManager.on('updateConfig', function (updateConfigs) {
266
+ updateConfigs.map(function (key) {
267
+ _this.updateStyle(key);
268
+
269
+ return '';
270
+ });
271
+ });
230
272
  }
231
- this.initOptions[style] = updateValue;
232
- }
233
- initTileFactory() {
234
- const source = this.parent.getSource();
235
- const TileFactory = (0, import_tileFactory.getTileFactory)(this.parent.type, source.parser);
236
- this.tileFactory = new TileFactory({
237
- parent: this.parent,
238
- mapService: this.mapService,
239
- rendererService: this.rendererService
240
- });
241
- }
242
- };
243
- // Annotate the CommonJS export names for ESM import in node:
244
- 0 && (module.exports = {
245
- TileLayerManager
246
- });
273
+ }, {
274
+ key: "updateStyle",
275
+ value: function updateStyle(style) {
276
+ var _this2 = this;
277
+
278
+ var updateValue = null;
279
+
280
+ if (['size', 'color', 'shape'].includes(style)) {
281
+ var _this$parent$getAttri4;
282
+
283
+ var scaleValue = (_this$parent$getAttri4 = this.parent.getAttribute(style)) === null || _this$parent$getAttri4 === void 0 ? void 0 : _this$parent$getAttri4.scale;
284
+
285
+ if (!scaleValue) {
286
+ return;
287
+ }
288
+
289
+ updateValue = scaleValue;
290
+ this.children.map(function (child) {
291
+ _this2.tileFactory.setStyleAttributeField(child, style, scaleValue);
292
+
293
+ return '';
294
+ });
295
+ } else {
296
+ var layerConfig = this.parent.getLayerConfig();
297
+
298
+ if (!(style in layerConfig)) {
299
+ return;
300
+ } // @ts-ignore
301
+
302
+
303
+ var config = layerConfig[style];
304
+ updateValue = config;
305
+ this.updateLayersConfig(this.children, style, config);
306
+
307
+ if (style === 'rampColors' && config) {
308
+ this.rampColorsData = (0, _l7Utils.generateColorRamp)(config);
309
+ }
310
+ } // @ts-ignore
311
+
312
+
313
+ this.initOptions[style] = updateValue;
314
+ }
315
+ }, {
316
+ key: "initTileFactory",
317
+ value: function initTileFactory() {
318
+ var source = this.parent.getSource();
319
+ var TileFactory = (0, _tileFactory.getTileFactory)(this.parent.type, source.parser);
320
+ this.tileFactory = new TileFactory({
321
+ parent: this.parent,
322
+ mapService: this.mapService,
323
+ rendererService: this.rendererService
324
+ });
325
+ }
326
+ }]);
327
+ return TileLayerManager;
328
+ }();
329
+
330
+ exports.TileLayerManager = TileLayerManager;