@antv/l7-layers 2.9.24 → 2.9.25-alpha.0
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/line/index.js +4 -1
- package/es/plugins/FeatureScalePlugin.js +0 -1
- package/es/point/index.js +3 -1
- package/es/polygon/index.js +4 -1
- package/es/raster/index.js +3 -1
- package/es/tile/manager/tileLayerManager.js +2 -1
- package/es/tile/utils.d.ts +2 -0
- package/es/tile/utils.js +4 -0
- package/lib/line/index.js +3 -1
- package/lib/plugins/FeatureScalePlugin.js +0 -1
- package/lib/point/index.js +3 -1
- package/lib/polygon/index.js +3 -1
- package/lib/raster/index.js +2 -1
- package/lib/tile/manager/tileLayerManager.js +2 -1
- package/lib/tile/utils.js +10 -2
- package/package.json +6 -6
package/es/line/index.js
CHANGED
|
@@ -12,6 +12,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
12
12
|
|
|
13
13
|
import BaseLayer from "../core/BaseLayer";
|
|
14
14
|
import LineModels from "./models";
|
|
15
|
+
import { isVectorTile } from "../tile/utils";
|
|
15
16
|
|
|
16
17
|
var LineLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
17
18
|
_inherits(LineLayer, _BaseLayer);
|
|
@@ -103,7 +104,9 @@ var LineLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
103
104
|
return this.layerType;
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
|
|
107
|
+
var parserType = this.layerSource.getParserType();
|
|
108
|
+
|
|
109
|
+
if (isVectorTile(parserType)) {
|
|
107
110
|
return 'vectorline';
|
|
108
111
|
}
|
|
109
112
|
|
|
@@ -100,7 +100,6 @@ var FeatureScalePlugin = (_dec = injectable(), _dec2 = inject(TYPES.IGlobalConfi
|
|
|
100
100
|
if (attribute.scale) {
|
|
101
101
|
// 创建Scale
|
|
102
102
|
var attributeScale = attribute.scale;
|
|
103
|
-
var type = attribute.name;
|
|
104
103
|
attributeScale.names = _this2.parseFields(attribute.scale.field || []);
|
|
105
104
|
var scales = []; // 为每个字段创建 Scale
|
|
106
105
|
|
package/es/point/index.js
CHANGED
|
@@ -18,6 +18,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
18
18
|
|
|
19
19
|
import BaseLayer from "../core/BaseLayer";
|
|
20
20
|
import PointModels from "./models/index";
|
|
21
|
+
import { isVectorTile } from "../tile/utils";
|
|
21
22
|
|
|
22
23
|
var PointLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
23
24
|
_inherits(PointLayer, _BaseLayer);
|
|
@@ -152,8 +153,9 @@ var PointLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
152
153
|
key: "getModelType",
|
|
153
154
|
value: function getModelType() {
|
|
154
155
|
var PointTypes = ['fillImage', 'fill', 'radar', 'image', 'normal', 'simplePoint', 'extrude', 'text', 'vectorpoint', 'tile', 'earthFill', 'earthExtrude'];
|
|
156
|
+
var parserType = this.layerSource.getParserType();
|
|
155
157
|
|
|
156
|
-
if (
|
|
158
|
+
if (isVectorTile(parserType)) {
|
|
157
159
|
return 'vectorpoint';
|
|
158
160
|
} // pointlayer
|
|
159
161
|
// 2D、 3d、 shape、image、text、normal、
|
package/es/polygon/index.js
CHANGED
|
@@ -12,6 +12,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
12
12
|
|
|
13
13
|
import BaseLayer from "../core/BaseLayer";
|
|
14
14
|
import PolygonModels from "./models/";
|
|
15
|
+
import { isVectorTile } from "../tile/utils";
|
|
15
16
|
|
|
16
17
|
var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
17
18
|
_inherits(PolygonLayer, _BaseLayer);
|
|
@@ -74,7 +75,9 @@ var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
74
75
|
value: function getModelType() {
|
|
75
76
|
var _shapeAttribute$scale;
|
|
76
77
|
|
|
77
|
-
|
|
78
|
+
var parserType = this.layerSource.getParserType();
|
|
79
|
+
|
|
80
|
+
if (isVectorTile(parserType)) {
|
|
78
81
|
return 'vectorpolygon';
|
|
79
82
|
}
|
|
80
83
|
|
package/es/raster/index.js
CHANGED
|
@@ -84,7 +84,9 @@ var RaterLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
84
84
|
key: "getModelType",
|
|
85
85
|
value: function getModelType() {
|
|
86
86
|
// 根据 source 的类型判断 model type
|
|
87
|
-
|
|
87
|
+
var parserType = this.layerSource.getParserType();
|
|
88
|
+
|
|
89
|
+
switch (parserType) {
|
|
88
90
|
case 'raster':
|
|
89
91
|
return 'raster';
|
|
90
92
|
|
|
@@ -173,6 +173,7 @@ export var TileLayerManager = /*#__PURE__*/function () {
|
|
|
173
173
|
var _ref2 = (source === null || source === void 0 ? void 0 : (_source$data = source.data) === null || _source$data === void 0 ? void 0 : _source$data.tilesetOptions) || {},
|
|
174
174
|
coords = _ref2.coords;
|
|
175
175
|
|
|
176
|
+
var parentParserType = source.getParserType();
|
|
176
177
|
var layerShape = getLayerShape(this.parent.type, this.parent);
|
|
177
178
|
|
|
178
179
|
if (rampColors) {
|
|
@@ -186,7 +187,7 @@ export var TileLayerManager = /*#__PURE__*/function () {
|
|
|
186
187
|
shape: layerShape,
|
|
187
188
|
zIndex: zIndex,
|
|
188
189
|
opacity: opacity,
|
|
189
|
-
sourceLayer: sourceLayer,
|
|
190
|
+
sourceLayer: parentParserType === 'geojsonvt' ? 'geojsonvt' : sourceLayer,
|
|
190
191
|
coords: coords,
|
|
191
192
|
featureId: featureId,
|
|
192
193
|
color: colorValue,
|
package/es/tile/utils.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ILayer, IMapService, IRendererService } from '@antv/l7-core';
|
|
2
2
|
import { Tile } from '@antv/l7-utils';
|
|
3
|
+
export declare const tileVectorParser: string[];
|
|
4
|
+
export declare function isVectorTile(parserType: string): boolean;
|
|
3
5
|
export declare function registerLayers(parentLayer: ILayer, layers: ILayer[]): void;
|
|
4
6
|
export declare function getLayerShape(layerType: string, layer: ILayer): string | string[];
|
|
5
7
|
export declare function getMaskValue(layerType: string, mask: boolean): boolean;
|
package/es/tile/utils.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { createLayerContainer } from '@antv/l7-core';
|
|
3
3
|
import { DOM } from '@antv/l7-utils';
|
|
4
|
+
export var tileVectorParser = ['mvt', 'geojsonvt'];
|
|
5
|
+
export function isVectorTile(parserType) {
|
|
6
|
+
return tileVectorParser.indexOf(parserType) > 0;
|
|
7
|
+
}
|
|
4
8
|
export function registerLayers(parentLayer, layers) {
|
|
5
9
|
layers.map(function (layer) {
|
|
6
10
|
var container = createLayerContainer(parentLayer.sceneContainer);
|
package/lib/line/index.js
CHANGED
|
@@ -27,6 +27,7 @@ __export(line_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(line_exports);
|
|
28
28
|
var import_BaseLayer = __toESM(require("../core/BaseLayer"));
|
|
29
29
|
var import_models = __toESM(require("./models"));
|
|
30
|
+
var import_utils = require("../tile/utils");
|
|
30
31
|
var LineLayer = class extends import_BaseLayer.default {
|
|
31
32
|
constructor() {
|
|
32
33
|
super(...arguments);
|
|
@@ -76,7 +77,8 @@ var LineLayer = class extends import_BaseLayer.default {
|
|
|
76
77
|
if (this.layerType) {
|
|
77
78
|
return this.layerType;
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
+
const parserType = this.layerSource.getParserType();
|
|
81
|
+
if ((0, import_utils.isVectorTile)(parserType)) {
|
|
80
82
|
return "vectorline";
|
|
81
83
|
}
|
|
82
84
|
const shapeAttribute = this.styleAttributeService.getLayerStyleAttribute("shape");
|
|
@@ -106,7 +106,6 @@ var FeatureScalePlugin = class {
|
|
|
106
106
|
attributes.forEach((attribute) => {
|
|
107
107
|
if (attribute.scale) {
|
|
108
108
|
const attributeScale = attribute.scale;
|
|
109
|
-
const type = attribute.name;
|
|
110
109
|
attributeScale.names = this.parseFields(attribute.scale.field || []);
|
|
111
110
|
const scales = [];
|
|
112
111
|
attributeScale.names.forEach((field) => {
|
package/lib/point/index.js
CHANGED
|
@@ -27,6 +27,7 @@ __export(point_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(point_exports);
|
|
28
28
|
var import_BaseLayer = __toESM(require("../core/BaseLayer"));
|
|
29
29
|
var import_models = __toESM(require("./models/index"));
|
|
30
|
+
var import_utils = require("../tile/utils");
|
|
30
31
|
var PointLayer = class extends import_BaseLayer.default {
|
|
31
32
|
constructor() {
|
|
32
33
|
super(...arguments);
|
|
@@ -110,7 +111,8 @@ var PointLayer = class extends import_BaseLayer.default {
|
|
|
110
111
|
"earthFill",
|
|
111
112
|
"earthExtrude"
|
|
112
113
|
];
|
|
113
|
-
|
|
114
|
+
const parserType = this.layerSource.getParserType();
|
|
115
|
+
if ((0, import_utils.isVectorTile)(parserType)) {
|
|
114
116
|
return "vectorpoint";
|
|
115
117
|
}
|
|
116
118
|
const layerData = this.getEncodedData();
|
package/lib/polygon/index.js
CHANGED
|
@@ -27,6 +27,7 @@ __export(polygon_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(polygon_exports);
|
|
28
28
|
var import_BaseLayer = __toESM(require("../core/BaseLayer"));
|
|
29
29
|
var import_models = __toESM(require("./models/"));
|
|
30
|
+
var import_utils = require("../tile/utils");
|
|
30
31
|
var PolygonLayer = class extends import_BaseLayer.default {
|
|
31
32
|
constructor() {
|
|
32
33
|
super(...arguments);
|
|
@@ -56,7 +57,8 @@ var PolygonLayer = class extends import_BaseLayer.default {
|
|
|
56
57
|
}
|
|
57
58
|
getModelType() {
|
|
58
59
|
var _a;
|
|
59
|
-
|
|
60
|
+
const parserType = this.layerSource.getParserType();
|
|
61
|
+
if ((0, import_utils.isVectorTile)(parserType)) {
|
|
60
62
|
return "vectorpolygon";
|
|
61
63
|
}
|
|
62
64
|
const shapeAttribute = this.styleAttributeService.getLayerStyleAttribute("shape");
|
package/lib/raster/index.js
CHANGED
|
@@ -64,7 +64,8 @@ var RaterLayer = class extends import_BaseLayer.default {
|
|
|
64
64
|
return defaultConfig[type];
|
|
65
65
|
}
|
|
66
66
|
getModelType() {
|
|
67
|
-
|
|
67
|
+
const parserType = this.layerSource.getParserType();
|
|
68
|
+
switch (parserType) {
|
|
68
69
|
case "raster":
|
|
69
70
|
return "raster";
|
|
70
71
|
case "rasterTile":
|
|
@@ -140,6 +140,7 @@ var TileLayerManager = class {
|
|
|
140
140
|
const sizeValue = this.tileConfigManager.getAttributeScale(this.parent, "size");
|
|
141
141
|
const source = this.parent.getSource();
|
|
142
142
|
const { coords } = ((_a = source == null ? void 0 : source.data) == null ? void 0 : _a.tilesetOptions) || {};
|
|
143
|
+
const parentParserType = source.getParserType();
|
|
143
144
|
const layerShape = (0, import_utils.getLayerShape)(this.parent.type, this.parent);
|
|
144
145
|
if (rampColors) {
|
|
145
146
|
this.rampColorsData = (0, import_l7_utils.generateColorRamp)(rampColors);
|
|
@@ -150,7 +151,7 @@ var TileLayerManager = class {
|
|
|
150
151
|
shape: layerShape,
|
|
151
152
|
zIndex,
|
|
152
153
|
opacity,
|
|
153
|
-
sourceLayer,
|
|
154
|
+
sourceLayer: parentParserType === "geojsonvt" ? "geojsonvt" : sourceLayer,
|
|
154
155
|
coords,
|
|
155
156
|
featureId,
|
|
156
157
|
color: colorValue,
|
package/lib/tile/utils.js
CHANGED
|
@@ -22,13 +22,19 @@ __export(utils_exports, {
|
|
|
22
22
|
getContainerSize: () => getContainerSize,
|
|
23
23
|
getLayerShape: () => getLayerShape,
|
|
24
24
|
getMaskValue: () => getMaskValue,
|
|
25
|
+
isVectorTile: () => isVectorTile,
|
|
25
26
|
readPixel: () => readPixel,
|
|
26
27
|
readRasterValue: () => readRasterValue,
|
|
27
|
-
registerLayers: () => registerLayers
|
|
28
|
+
registerLayers: () => registerLayers,
|
|
29
|
+
tileVectorParser: () => tileVectorParser
|
|
28
30
|
});
|
|
29
31
|
module.exports = __toCommonJS(utils_exports);
|
|
30
32
|
var import_l7_core = require("@antv/l7-core");
|
|
31
33
|
var import_l7_utils = require("@antv/l7-utils");
|
|
34
|
+
var tileVectorParser = ["mvt", "geojsonvt"];
|
|
35
|
+
function isVectorTile(parserType) {
|
|
36
|
+
return tileVectorParser.indexOf(parserType) > 0;
|
|
37
|
+
}
|
|
32
38
|
function registerLayers(parentLayer, layers) {
|
|
33
39
|
layers.map((layer) => {
|
|
34
40
|
const container = (0, import_l7_core.createLayerContainer)(parentLayer.sceneContainer);
|
|
@@ -126,7 +132,9 @@ function readPixel(x, y, rendererService) {
|
|
|
126
132
|
getContainerSize,
|
|
127
133
|
getLayerShape,
|
|
128
134
|
getMaskValue,
|
|
135
|
+
isVectorTile,
|
|
129
136
|
readPixel,
|
|
130
137
|
readRasterValue,
|
|
131
|
-
registerLayers
|
|
138
|
+
registerLayers,
|
|
139
|
+
tileVectorParser
|
|
132
140
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-layers",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.25-alpha.0",
|
|
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.1.0",
|
|
30
|
-
"@antv/l7-core": "2.9.
|
|
31
|
-
"@antv/l7-maps": "2.9.
|
|
32
|
-
"@antv/l7-source": "2.9.
|
|
33
|
-
"@antv/l7-utils": "2.9.
|
|
30
|
+
"@antv/l7-core": "2.9.25-alpha.0",
|
|
31
|
+
"@antv/l7-maps": "2.9.25-alpha.0",
|
|
32
|
+
"@antv/l7-source": "2.9.25-alpha.0",
|
|
33
|
+
"@antv/l7-utils": "2.9.25-alpha.0",
|
|
34
34
|
"@babel/runtime": "^7.7.7",
|
|
35
35
|
"@mapbox/martini": "^0.2.0",
|
|
36
36
|
"@turf/helpers": "^6.1.4",
|
|
@@ -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": "5216ad73535dbd3c4188dd9717952db3dfcb4f71",
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
67
67
|
}
|