@antv/l7-layers 2.12.0 → 2.12.2
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.
- package/es/core/BaseLayer.js +5 -12
- package/es/plugins/DataMappingPlugin.js +10 -13
- package/es/plugins/RegisterStyleAttributePlugin.js +2 -2
- package/es/tile/tileFactory/Tile.d.ts +1 -0
- package/lib/core/BaseLayer.js +5 -13
- package/lib/plugins/DataMappingPlugin.js +10 -13
- package/lib/plugins/RegisterStyleAttributePlugin.js +2 -2
- package/package.json +6 -6
- package/es/utils/updateShape.d.ts +0 -2
- package/es/utils/updateShape.js +0 -20
- package/lib/utils/updateShape.js +0 -27
package/es/core/BaseLayer.js
CHANGED
|
@@ -39,7 +39,6 @@ import { BlendTypes } from "../utils/blend";
|
|
|
39
39
|
import { styleDataMapping } from "../utils/dataMappingStyle";
|
|
40
40
|
import { calculateData } from "../utils/layerData";
|
|
41
41
|
import { createMultiPassRenderer, normalizePasses } from "../utils/multiPassRender";
|
|
42
|
-
import { updateShape } from "../utils/updateShape";
|
|
43
42
|
import LayerPickService from "./LayerPickService";
|
|
44
43
|
import TextureService from "./TextureService";
|
|
45
44
|
/**
|
|
@@ -471,24 +470,18 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
471
470
|
key: "filter",
|
|
472
471
|
value: function filter(field, values, updateOptions) {
|
|
473
472
|
this.updateStyleAttribute('filter', field, values, updateOptions);
|
|
473
|
+
this.dataState.dataSourceNeedUpdate = true;
|
|
474
474
|
return this;
|
|
475
475
|
}
|
|
476
476
|
}, {
|
|
477
477
|
key: "shape",
|
|
478
478
|
value: function shape(field, values, updateOptions) {
|
|
479
|
-
var _this$styleAttributeS, _this$styleAttributeS2, _this$styleAttributeS3;
|
|
480
|
-
|
|
481
|
-
var lastShape = (_this$styleAttributeS = this.styleAttributeService) === null || _this$styleAttributeS === void 0 ? void 0 : (_this$styleAttributeS2 = _this$styleAttributeS.getLayerStyleAttribute('shape')) === null || _this$styleAttributeS2 === void 0 ? void 0 : (_this$styleAttributeS3 = _this$styleAttributeS2.scale) === null || _this$styleAttributeS3 === void 0 ? void 0 : _this$styleAttributeS3.field;
|
|
482
|
-
var currentShape = field;
|
|
483
479
|
this.shapeOption = {
|
|
484
480
|
field: field,
|
|
485
481
|
values: values
|
|
486
482
|
};
|
|
487
|
-
this.updateStyleAttribute('shape', field, values, updateOptions);
|
|
488
|
-
|
|
489
|
-
if (!this.tileLayer) {
|
|
490
|
-
updateShape(this, lastShape, currentShape);
|
|
491
|
-
}
|
|
483
|
+
this.updateStyleAttribute('shape', field, values, updateOptions);
|
|
484
|
+
this.dataState.dataSourceNeedUpdate = true; // 通过数据更新驱动shape 更新
|
|
492
485
|
|
|
493
486
|
return this;
|
|
494
487
|
}
|
|
@@ -1294,8 +1287,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1294
1287
|
value: function createAttributes(options) {
|
|
1295
1288
|
var triangulation = options.triangulation; // @ts-ignore
|
|
1296
1289
|
|
|
1297
|
-
var _this$
|
|
1298
|
-
attributes = _this$
|
|
1290
|
+
var _this$styleAttributeS = this.styleAttributeService.createAttributes(this.encodedData, triangulation),
|
|
1291
|
+
attributes = _this$styleAttributeS.attributes;
|
|
1299
1292
|
|
|
1300
1293
|
return attributes;
|
|
1301
1294
|
}
|
|
@@ -112,19 +112,12 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IMapService),
|
|
|
112
112
|
|
|
113
113
|
if (attributesToRemapping.length) {
|
|
114
114
|
// 过滤数据
|
|
115
|
-
|
|
116
|
-
var encodeData = _this.mapping(layer, attributes, filterData, undefined);
|
|
115
|
+
var encodeData = _this.mapping(layer, attributesToRemapping, filterData, layer.getEncodedData());
|
|
117
116
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
var _encodeData = _this.mapping(layer, attributesToRemapping, filterData, layer.getEncodedData());
|
|
117
|
+
layer.setEncodedData(encodeData);
|
|
118
|
+
} // 处理文本更新,更新文字形状
|
|
119
|
+
// layer.emit('remapping', null);
|
|
122
120
|
|
|
123
|
-
layer.setEncodedData(_encodeData);
|
|
124
|
-
} // 处理文本更新,更新文字形状
|
|
125
|
-
// layer.emit('remapping', null);
|
|
126
|
-
|
|
127
|
-
}
|
|
128
121
|
});
|
|
129
122
|
}
|
|
130
123
|
}, {
|
|
@@ -166,6 +159,8 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IMapService),
|
|
|
166
159
|
|
|
167
160
|
var usedAttributes = attributes.filter(function (attribute) {
|
|
168
161
|
return attribute.scale !== undefined;
|
|
162
|
+
}).filter(function (attribute) {
|
|
163
|
+
return attribute.name !== 'filter';
|
|
169
164
|
});
|
|
170
165
|
var mappedData = data.map(function (record, i) {
|
|
171
166
|
var preRecord = predata ? predata[i] : {};
|
|
@@ -176,9 +171,8 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IMapService),
|
|
|
176
171
|
}, preRecord);
|
|
177
172
|
|
|
178
173
|
usedAttributes.forEach(function (attribute) {
|
|
179
|
-
var values = _this3.applyAttributeMapping(attribute, record);
|
|
174
|
+
var values = _this3.applyAttributeMapping(attribute, record); // TODO: 支持每个属性配置 postprocess
|
|
180
175
|
|
|
181
|
-
attribute.needRemapping = false; // TODO: 支持每个属性配置 postprocess
|
|
182
176
|
|
|
183
177
|
if (attribute.name === 'color') {
|
|
184
178
|
values = values.map(function (c) {
|
|
@@ -209,6 +203,9 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IMapService),
|
|
|
209
203
|
}
|
|
210
204
|
|
|
211
205
|
return encodeRecord;
|
|
206
|
+
});
|
|
207
|
+
attributes.forEach(function (attribute) {
|
|
208
|
+
attribute.needRemapping = false;
|
|
212
209
|
}); // 调整数据兼容 Amap2.0
|
|
213
210
|
|
|
214
211
|
this.adjustData2Amap2Coordinates(mappedData, layer); // 调整数据兼容 SimpleCoordinates
|
|
@@ -41,8 +41,8 @@ var RegisterStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE
|
|
|
41
41
|
} // Tip: normal render layer
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
this.registerPositionAttribute(styleAttributeService);
|
|
45
|
-
|
|
44
|
+
this.registerPositionAttribute(styleAttributeService); // this.registerFilterAttribute(styleAttributeService);//数据层数据过滤
|
|
45
|
+
|
|
46
46
|
this.registerColorAttribute(styleAttributeService);
|
|
47
47
|
this.registerVertexIdAttribute(styleAttributeService);
|
|
48
48
|
}
|
|
@@ -76,6 +76,7 @@ export default abstract class Tile implements ITile {
|
|
|
76
76
|
map?: import("@antv/l7-core").IMapWrapper | undefined;
|
|
77
77
|
logoPosition?: import("@antv/l7-core").PositionName | undefined;
|
|
78
78
|
logoVisible?: boolean | undefined;
|
|
79
|
+
isMini?: boolean | undefined;
|
|
79
80
|
animate?: boolean | undefined;
|
|
80
81
|
pickBufferScale?: number | undefined;
|
|
81
82
|
stencil?: boolean | undefined;
|
package/lib/core/BaseLayer.js
CHANGED
|
@@ -55,8 +55,6 @@ var _layerData = require("../utils/layerData");
|
|
|
55
55
|
|
|
56
56
|
var _multiPassRender = require("../utils/multiPassRender");
|
|
57
57
|
|
|
58
|
-
var _updateShape = require("../utils/updateShape");
|
|
59
|
-
|
|
60
58
|
var _LayerPickService = _interopRequireDefault(require("./LayerPickService"));
|
|
61
59
|
|
|
62
60
|
var _TextureService = _interopRequireDefault(require("./TextureService"));
|
|
@@ -474,24 +472,18 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
474
472
|
key: "filter",
|
|
475
473
|
value: function filter(field, values, updateOptions) {
|
|
476
474
|
this.updateStyleAttribute('filter', field, values, updateOptions);
|
|
475
|
+
this.dataState.dataSourceNeedUpdate = true;
|
|
477
476
|
return this;
|
|
478
477
|
}
|
|
479
478
|
}, {
|
|
480
479
|
key: "shape",
|
|
481
480
|
value: function shape(field, values, updateOptions) {
|
|
482
|
-
var _this$styleAttributeS, _this$styleAttributeS2, _this$styleAttributeS3;
|
|
483
|
-
|
|
484
|
-
var lastShape = (_this$styleAttributeS = this.styleAttributeService) === null || _this$styleAttributeS === void 0 ? void 0 : (_this$styleAttributeS2 = _this$styleAttributeS.getLayerStyleAttribute('shape')) === null || _this$styleAttributeS2 === void 0 ? void 0 : (_this$styleAttributeS3 = _this$styleAttributeS2.scale) === null || _this$styleAttributeS3 === void 0 ? void 0 : _this$styleAttributeS3.field;
|
|
485
|
-
var currentShape = field;
|
|
486
481
|
this.shapeOption = {
|
|
487
482
|
field: field,
|
|
488
483
|
values: values
|
|
489
484
|
};
|
|
490
|
-
this.updateStyleAttribute('shape', field, values, updateOptions);
|
|
491
|
-
|
|
492
|
-
if (!this.tileLayer) {
|
|
493
|
-
(0, _updateShape.updateShape)(this, lastShape, currentShape);
|
|
494
|
-
}
|
|
485
|
+
this.updateStyleAttribute('shape', field, values, updateOptions);
|
|
486
|
+
this.dataState.dataSourceNeedUpdate = true; // 通过数据更新驱动shape 更新
|
|
495
487
|
|
|
496
488
|
return this;
|
|
497
489
|
}
|
|
@@ -1296,8 +1288,8 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1296
1288
|
value: function createAttributes(options) {
|
|
1297
1289
|
var triangulation = options.triangulation; // @ts-ignore
|
|
1298
1290
|
|
|
1299
|
-
var _this$
|
|
1300
|
-
attributes = _this$
|
|
1291
|
+
var _this$styleAttributeS = this.styleAttributeService.createAttributes(this.encodedData, triangulation),
|
|
1292
|
+
attributes = _this$styleAttributeS.attributes;
|
|
1301
1293
|
|
|
1302
1294
|
return attributes;
|
|
1303
1295
|
}
|
|
@@ -133,19 +133,12 @@ var DataMappingPlugin = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inver
|
|
|
133
133
|
|
|
134
134
|
if (attributesToRemapping.length) {
|
|
135
135
|
// 过滤数据
|
|
136
|
-
|
|
137
|
-
var encodeData = _this.mapping(layer, attributes, filterData, undefined);
|
|
136
|
+
var encodeData = _this.mapping(layer, attributesToRemapping, filterData, layer.getEncodedData());
|
|
138
137
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
var _encodeData = _this.mapping(layer, attributesToRemapping, filterData, layer.getEncodedData());
|
|
138
|
+
layer.setEncodedData(encodeData);
|
|
139
|
+
} // 处理文本更新,更新文字形状
|
|
140
|
+
// layer.emit('remapping', null);
|
|
143
141
|
|
|
144
|
-
layer.setEncodedData(_encodeData);
|
|
145
|
-
} // 处理文本更新,更新文字形状
|
|
146
|
-
// layer.emit('remapping', null);
|
|
147
|
-
|
|
148
|
-
}
|
|
149
142
|
});
|
|
150
143
|
}
|
|
151
144
|
}, {
|
|
@@ -187,6 +180,8 @@ var DataMappingPlugin = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inver
|
|
|
187
180
|
|
|
188
181
|
var usedAttributes = attributes.filter(function (attribute) {
|
|
189
182
|
return attribute.scale !== undefined;
|
|
183
|
+
}).filter(function (attribute) {
|
|
184
|
+
return attribute.name !== 'filter';
|
|
190
185
|
});
|
|
191
186
|
var mappedData = data.map(function (record, i) {
|
|
192
187
|
var preRecord = predata ? predata[i] : {};
|
|
@@ -195,9 +190,8 @@ var DataMappingPlugin = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inver
|
|
|
195
190
|
coordinates: record.coordinates
|
|
196
191
|
}, preRecord);
|
|
197
192
|
usedAttributes.forEach(function (attribute) {
|
|
198
|
-
var values = _this3.applyAttributeMapping(attribute, record);
|
|
193
|
+
var values = _this3.applyAttributeMapping(attribute, record); // TODO: 支持每个属性配置 postprocess
|
|
199
194
|
|
|
200
|
-
attribute.needRemapping = false; // TODO: 支持每个属性配置 postprocess
|
|
201
195
|
|
|
202
196
|
if (attribute.name === 'color') {
|
|
203
197
|
values = values.map(function (c) {
|
|
@@ -228,6 +222,9 @@ var DataMappingPlugin = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inver
|
|
|
228
222
|
}
|
|
229
223
|
|
|
230
224
|
return encodeRecord;
|
|
225
|
+
});
|
|
226
|
+
attributes.forEach(function (attribute) {
|
|
227
|
+
attribute.needRemapping = false;
|
|
231
228
|
}); // 调整数据兼容 Amap2.0
|
|
232
229
|
|
|
233
230
|
this.adjustData2Amap2Coordinates(mappedData, layer); // 调整数据兼容 SimpleCoordinates
|
|
@@ -55,8 +55,8 @@ _dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
|
55
55
|
} // Tip: normal render layer
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
this.registerPositionAttribute(styleAttributeService);
|
|
59
|
-
|
|
58
|
+
this.registerPositionAttribute(styleAttributeService); // this.registerFilterAttribute(styleAttributeService);//数据层数据过滤
|
|
59
|
+
|
|
60
60
|
this.registerColorAttribute(styleAttributeService);
|
|
61
61
|
this.registerVertexIdAttribute(styleAttributeService);
|
|
62
62
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-layers",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.2",
|
|
4
4
|
"description": "L7's collection of built-in layers",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"license": "ISC",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@antv/async-hook": "^2.2.9",
|
|
30
|
-
"@antv/l7-core": "2.12.
|
|
31
|
-
"@antv/l7-maps": "2.12.
|
|
32
|
-
"@antv/l7-source": "2.12.
|
|
33
|
-
"@antv/l7-utils": "2.12.
|
|
30
|
+
"@antv/l7-core": "2.12.2",
|
|
31
|
+
"@antv/l7-maps": "2.12.2",
|
|
32
|
+
"@antv/l7-source": "2.12.2",
|
|
33
|
+
"@antv/l7-utils": "2.12.2",
|
|
34
34
|
"@babel/runtime": "^7.7.7",
|
|
35
35
|
"@mapbox/martini": "^0.2.0",
|
|
36
36
|
"@turf/clone": "^6.5.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@types/gl-matrix": "^2.4.5",
|
|
62
62
|
"@types/lodash": "^4.14.138"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "1aa51493b0899f6b28f0477dcd6c56db19ce0669",
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
67
67
|
}
|
package/es/utils/updateShape.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// shapeUpdateList 存储一系列的 shape 类型
|
|
2
|
-
// 当这一系列的 shape 相互切换的时候需要重构 layer 的 model (顶点数据集)
|
|
3
|
-
var shapeUpdateList = [// PointLayer
|
|
4
|
-
['circle', 'cylinder'], ['square', 'cylinder'], ['triangle', 'cylinder'], ['pentagon', 'cylinder'], ['hexagon', 'cylinder'], ['octogon', 'cylinder'], ['hexagram', 'cylinder'], ['rhombus', 'cylinder'], ['vesica', 'cylinder']];
|
|
5
|
-
export function updateShape(layer, lastShape, currentShape) {
|
|
6
|
-
if (typeof lastShape === 'string' && typeof currentShape === 'string' && lastShape !== currentShape) {
|
|
7
|
-
if (layer.type === 'PointLayer') {
|
|
8
|
-
layer.dataState.dataSourceNeedUpdate = true;
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
shapeUpdateList.map(function (shapes) {
|
|
13
|
-
if (shapes.includes(lastShape) && shapes.includes(currentShape)) {
|
|
14
|
-
// dataSourceNeedUpdate 借用数据更新时更新 layer model 的工作流
|
|
15
|
-
layer.dataState.dataSourceNeedUpdate = true;
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
package/lib/utils/updateShape.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.updateShape = updateShape;
|
|
7
|
-
// shapeUpdateList 存储一系列的 shape 类型
|
|
8
|
-
// 当这一系列的 shape 相互切换的时候需要重构 layer 的 model (顶点数据集)
|
|
9
|
-
var shapeUpdateList = [// PointLayer
|
|
10
|
-
['circle', 'cylinder'], ['square', 'cylinder'], ['triangle', 'cylinder'], ['pentagon', 'cylinder'], ['hexagon', 'cylinder'], ['octogon', 'cylinder'], ['hexagram', 'cylinder'], ['rhombus', 'cylinder'], ['vesica', 'cylinder']];
|
|
11
|
-
|
|
12
|
-
function updateShape(layer, lastShape, currentShape) {
|
|
13
|
-
if (typeof lastShape === 'string' && typeof currentShape === 'string' && lastShape !== currentShape) {
|
|
14
|
-
if (layer.type === 'PointLayer') {
|
|
15
|
-
layer.dataState.dataSourceNeedUpdate = true;
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
shapeUpdateList.map(function (shapes) {
|
|
20
|
-
if (shapes.includes(lastShape) && shapes.includes(currentShape)) {
|
|
21
|
-
// dataSourceNeedUpdate 借用数据更新时更新 layer model 的工作流
|
|
22
|
-
layer.dataState.dataSourceNeedUpdate = true;
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|