@antv/l7-layers 2.15.2 → 2.15.3
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/Geometry/index.js +9 -31
- package/es/Geometry/models/billboard.js +51 -89
- package/es/Geometry/models/plane.js +81 -143
- package/es/Geometry/models/sprite.js +60 -118
- package/es/canvas/index.js +10 -33
- package/es/canvas/models/canvas.js +41 -97
- package/es/citybuliding/building.js +8 -27
- package/es/citybuliding/models/build.js +57 -82
- package/es/core/BaseLayer.js +320 -484
- package/es/core/BaseModel.js +97 -126
- package/es/core/LayerPickService.js +21 -32
- package/es/core/TextureService.js +0 -13
- package/es/core/interface.js +17 -24
- package/es/core/shape/Path.js +13 -20
- package/es/core/shape/extrude.js +10 -31
- package/es/core/triangulation.js +54 -114
- package/es/earth/index.js +9 -33
- package/es/earth/models/atmosphere.js +30 -54
- package/es/earth/models/base.js +47 -85
- package/es/earth/models/bloomsphere.js +30 -54
- package/es/earth/utils.js +9 -13
- package/es/heatmap/index.js +10 -40
- package/es/heatmap/models/grid.js +28 -52
- package/es/heatmap/models/grid3d.js +28 -52
- package/es/heatmap/models/heatmap.js +91 -146
- package/es/heatmap/models/hexagon.js +28 -52
- package/es/heatmap/triangulation.js +0 -4
- package/es/image/index.js +9 -28
- package/es/image/models/image.js +66 -100
- package/es/index.js +9 -17
- package/es/line/index.js +9 -34
- package/es/line/models/arc.js +66 -118
- package/es/line/models/arc_3d.js +60 -108
- package/es/line/models/earthArc_3d.js +63 -111
- package/es/line/models/great_circle.js +56 -100
- package/es/line/models/half.js +46 -77
- package/es/line/models/line.js +94 -148
- package/es/line/models/linearline.js +45 -80
- package/es/line/models/simpleLine.js +41 -74
- package/es/line/models/wall.js +52 -92
- package/es/mask/index.js +9 -28
- package/es/mask/models/fill.js +29 -54
- package/es/plugins/DataMappingPlugin.js +80 -117
- package/es/plugins/DataSourcePlugin.js +45 -68
- package/es/plugins/FeatureScalePlugin.js +67 -122
- package/es/plugins/LayerAnimateStylePlugin.js +0 -5
- package/es/plugins/LayerMaskPlugin.js +3 -11
- package/es/plugins/LayerModelPlugin.js +67 -104
- package/es/plugins/LayerStylePlugin.js +3 -9
- package/es/plugins/LightingPlugin.js +12 -18
- package/es/plugins/MultiPassRendererPlugin.js +11 -16
- package/es/plugins/PixelPickingPlugin.js +12 -21
- package/es/plugins/RegisterStyleAttributePlugin.js +5 -12
- package/es/plugins/ShaderUniformPlugin.js +13 -27
- package/es/plugins/UpdateModelPlugin.js +0 -5
- package/es/plugins/UpdateStyleAttributePlugin.js +5 -11
- package/es/point/index.js +26 -77
- package/es/point/models/earthExtrude.js +61 -102
- package/es/point/models/earthFill.js +57 -87
- package/es/point/models/extrude.js +60 -101
- package/es/point/models/fill.js +70 -100
- package/es/point/models/fillmage.js +63 -107
- package/es/point/models/image.js +48 -88
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +30 -54
- package/es/point/models/radar.js +40 -64
- package/es/point/models/simplePoint.js +41 -69
- package/es/point/models/text.js +197 -299
- package/es/point/shape/extrude.js +4 -13
- package/es/polygon/index.js +11 -40
- package/es/polygon/models/extrude.js +48 -92
- package/es/polygon/models/fill.js +54 -88
- package/es/polygon/models/index.js +3 -2
- package/es/polygon/models/ocean.js +42 -76
- package/es/polygon/models/water.js +37 -71
- package/es/raster/buffers/triangulation.js +2 -4
- package/es/raster/index.js +9 -32
- package/es/raster/models/raster.js +80 -116
- package/es/raster/models/rasterRgb.js +84 -127
- package/es/raster/models/rasterTerrainRgb.js +56 -84
- package/es/tile/interaction/getRasterData.js +14 -20
- package/es/tile/interaction/utils.js +7 -9
- package/es/tile/manager/base.js +63 -96
- package/es/tile/service/TileLayerService.js +30 -52
- package/es/tile/service/TilePickService.js +26 -40
- package/es/tile/service/TileSourceService.js +3 -7
- package/es/tile/tileFactory/DebugTile.js +28 -45
- package/es/tile/tileFactory/ImageTile.js +20 -38
- package/es/tile/tileFactory/MaskTile.js +22 -43
- package/es/tile/tileFactory/RasterRGBTile.js +22 -42
- package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
- package/es/tile/tileFactory/RasterTile.js +30 -53
- package/es/tile/tileFactory/Tile.js +63 -97
- package/es/tile/tileFactory/VectorTile.js +41 -68
- package/es/tile/tileFactory/index.js +0 -11
- package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
- package/es/tile/tileFactory/util.js +0 -3
- package/es/tile/tileLayer/BaseLayer.js +105 -146
- package/es/tile/utils.js +1 -1
- package/es/utils/blend.js +0 -2
- package/es/utils/collision-index.js +9 -16
- package/es/utils/dataMappingStyle.js +8 -18
- package/es/utils/extrude_polyline.js +101 -149
- package/es/utils/grid-index.js +2 -27
- package/es/utils/identityScale.js +0 -8
- package/es/utils/layerData.js +30 -44
- package/es/utils/multiPassRender.js +11 -13
- package/es/utils/polylineNormal.js +31 -37
- package/es/utils/simpleLine.js +2 -16
- package/es/utils/stencil.js +2 -3
- package/es/utils/symbol-layout.js +27 -53
- package/es/wind/index.js +9 -29
- package/es/wind/models/utils.js +26 -51
- package/es/wind/models/wind.js +101 -147
- package/es/wind/models/windRender.js +53 -66
- package/lib/Geometry/index.js +9 -38
- package/lib/Geometry/models/billboard.js +51 -97
- package/lib/Geometry/models/index.js +0 -5
- package/lib/Geometry/models/plane.js +79 -151
- package/lib/Geometry/models/sprite.js +60 -127
- package/lib/canvas/index.js +10 -40
- package/lib/canvas/models/canvas.js +41 -101
- package/lib/canvas/models/index.js +0 -3
- package/lib/citybuliding/building.js +8 -35
- package/lib/citybuliding/models/build.js +57 -92
- package/lib/core/BaseLayer.js +320 -478
- package/lib/core/BaseModel.js +97 -139
- package/lib/core/LayerPickService.js +21 -37
- package/lib/core/TextureService.js +0 -16
- package/lib/core/interface.js +21 -31
- package/lib/core/schema.js +0 -1
- package/lib/core/shape/Path.js +14 -31
- package/lib/core/shape/extrude.js +10 -54
- package/lib/core/triangulation.js +53 -153
- package/lib/earth/index.js +9 -43
- package/lib/earth/models/atmosphere.js +30 -63
- package/lib/earth/models/base.js +47 -90
- package/lib/earth/models/bloomsphere.js +30 -63
- package/lib/earth/utils.js +7 -31
- package/lib/heatmap/index.js +10 -48
- package/lib/heatmap/models/grid.js +28 -60
- package/lib/heatmap/models/grid3d.js +28 -60
- package/lib/heatmap/models/heatmap.js +91 -162
- package/lib/heatmap/models/hexagon.js +28 -60
- package/lib/heatmap/models/index.js +0 -6
- package/lib/heatmap/triangulation.js +0 -5
- package/lib/image/index.js +9 -36
- package/lib/image/models/image.js +66 -109
- package/lib/image/models/index.js +0 -3
- package/lib/index.js +7 -61
- package/lib/line/index.js +9 -40
- package/lib/line/models/arc.js +64 -128
- package/lib/line/models/arc_3d.js +58 -119
- package/lib/line/models/earthArc_3d.js +61 -122
- package/lib/line/models/great_circle.js +56 -111
- package/lib/line/models/half.js +46 -87
- package/lib/line/models/index.js +0 -11
- package/lib/line/models/line.js +92 -156
- package/lib/line/models/linearline.js +45 -92
- package/lib/line/models/simpleLine.js +41 -84
- package/lib/line/models/wall.js +52 -103
- package/lib/mask/index.js +9 -36
- package/lib/mask/models/fill.js +29 -63
- package/lib/mask/models/index.js +0 -3
- package/lib/plugins/DataMappingPlugin.js +80 -128
- package/lib/plugins/DataSourcePlugin.js +45 -76
- package/lib/plugins/FeatureScalePlugin.js +67 -138
- package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
- package/lib/plugins/LayerMaskPlugin.js +4 -17
- package/lib/plugins/LayerModelPlugin.js +68 -113
- package/lib/plugins/LayerStylePlugin.js +4 -14
- package/lib/plugins/LightingPlugin.js +12 -25
- package/lib/plugins/MultiPassRendererPlugin.js +11 -22
- package/lib/plugins/PixelPickingPlugin.js +12 -27
- package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
- package/lib/plugins/ShaderUniformPlugin.js +13 -34
- package/lib/plugins/UpdateModelPlugin.js +1 -10
- package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
- package/lib/point/index.js +26 -83
- package/lib/point/models/earthExtrude.js +61 -113
- package/lib/point/models/earthFill.js +57 -117
- package/lib/point/models/extrude.js +60 -111
- package/lib/point/models/fill.js +68 -109
- package/lib/point/models/fillmage.js +61 -115
- package/lib/point/models/image.js +48 -98
- package/lib/point/models/index.js +1 -12
- package/lib/point/models/normal.js +30 -64
- package/lib/point/models/radar.js +40 -74
- package/lib/point/models/simplePoint.js +41 -79
- package/lib/point/models/text.js +197 -307
- package/lib/point/shape/extrude.js +4 -20
- package/lib/polygon/index.js +11 -48
- package/lib/polygon/models/extrude.js +48 -103
- package/lib/polygon/models/fill.js +54 -98
- package/lib/polygon/models/index.js +2 -14
- package/lib/polygon/models/ocean.js +42 -88
- package/lib/polygon/models/water.js +37 -82
- package/lib/raster/buffers/triangulation.js +3 -7
- package/lib/raster/index.js +9 -40
- package/lib/raster/models/index.js +0 -5
- package/lib/raster/models/raster.js +80 -125
- package/lib/raster/models/rasterRgb.js +84 -139
- package/lib/raster/models/rasterTerrainRgb.js +56 -93
- package/lib/tile/interaction/getRasterData.js +14 -25
- package/lib/tile/interaction/utils.js +7 -19
- package/lib/tile/manager/base.js +63 -104
- package/lib/tile/service/TileLayerService.js +30 -57
- package/lib/tile/service/TilePickService.js +26 -48
- package/lib/tile/service/TileSourceService.js +2 -16
- package/lib/tile/style/utils.js +0 -3
- package/lib/tile/tileFactory/DebugTile.js +28 -53
- package/lib/tile/tileFactory/ImageTile.js +20 -46
- package/lib/tile/tileFactory/MaskTile.js +22 -51
- package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
- package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
- package/lib/tile/tileFactory/RasterTile.js +30 -63
- package/lib/tile/tileFactory/Tile.js +63 -102
- package/lib/tile/tileFactory/VectorTile.js +41 -76
- package/lib/tile/tileFactory/index.js +0 -25
- package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
- package/lib/tile/tileFactory/util.js +0 -9
- package/lib/tile/tileLayer/BaseLayer.js +105 -153
- package/lib/tile/utils.js +1 -5
- package/lib/utils/blend.js +0 -5
- package/lib/utils/collision-index.js +9 -25
- package/lib/utils/dataMappingStyle.js +8 -19
- package/lib/utils/extrude_polyline.js +101 -181
- package/lib/utils/grid-index.js +2 -28
- package/lib/utils/identityScale.js +0 -9
- package/lib/utils/layerData.js +30 -49
- package/lib/utils/multiPassRender.js +11 -16
- package/lib/utils/polylineNormal.js +31 -66
- package/lib/utils/simpleLine.js +2 -21
- package/lib/utils/stencil.js +0 -4
- package/lib/utils/symbol-layout.js +27 -55
- package/lib/wind/index.js +9 -37
- package/lib/wind/models/index.js +0 -3
- package/lib/wind/models/utils.js +26 -62
- package/lib/wind/models/wind.js +101 -157
- package/lib/wind/models/windRender.js +53 -71
- package/lib/wind/models/windShader.js +0 -1
- package/package.json +7 -7
|
@@ -8,11 +8,8 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
|
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
9
9
|
var _excluded = ["rasterData"];
|
|
10
10
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
11
|
-
|
|
12
11
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
13
|
-
|
|
14
12
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
15
|
-
|
|
16
13
|
import { getDefaultDomain } from '@antv/l7-utils';
|
|
17
14
|
import RasterLayer from "../../raster";
|
|
18
15
|
import Tile from "./Tile";
|
|
@@ -20,74 +17,58 @@ var DEFAULT_COLOR_TEXTURE_OPTION = {
|
|
|
20
17
|
positions: [0, 1],
|
|
21
18
|
colors: ['#000', '#fff']
|
|
22
19
|
};
|
|
23
|
-
|
|
24
20
|
var RasterTile = /*#__PURE__*/function (_Tile) {
|
|
25
21
|
_inherits(RasterTile, _Tile);
|
|
26
|
-
|
|
27
22
|
var _super = _createSuper(RasterTile);
|
|
28
|
-
|
|
29
23
|
function RasterTile() {
|
|
30
24
|
_classCallCheck(this, RasterTile);
|
|
31
|
-
|
|
32
25
|
return _super.apply(this, arguments);
|
|
33
26
|
}
|
|
34
|
-
|
|
35
27
|
_createClass(RasterTile, [{
|
|
36
28
|
key: "initTileLayer",
|
|
37
29
|
value: function () {
|
|
38
30
|
var _initTileLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
39
31
|
var attributes, layerOptions, sourceOptions, _ref, rampColors, domain, layer;
|
|
40
|
-
|
|
41
32
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
42
|
-
while (1) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
this.isLoaded = true;
|
|
67
|
-
|
|
68
|
-
case 10:
|
|
69
|
-
case "end":
|
|
70
|
-
return _context.stop();
|
|
71
|
-
}
|
|
33
|
+
while (1) switch (_context.prev = _context.next) {
|
|
34
|
+
case 0:
|
|
35
|
+
attributes = this.parent.getLayerAttributeConfig();
|
|
36
|
+
layerOptions = this.getLayerOptions();
|
|
37
|
+
sourceOptions = this.getSourceOption();
|
|
38
|
+
_ref = this.getLayerOptions(), rampColors = _ref.rampColors, domain = _ref.domain;
|
|
39
|
+
this.colorTexture = this.parent.textureService.getColorTexture(rampColors, domain);
|
|
40
|
+
layer = new RasterLayer(_objectSpread(_objectSpread({}, layerOptions), {}, {
|
|
41
|
+
colorTexture: this.colorTexture
|
|
42
|
+
})).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
|
|
43
|
+
// tslint:disable-next-line: no-unused-expression
|
|
44
|
+
attributes && Object.keys(attributes).forEach(function (type) {
|
|
45
|
+
var _attributes$attr, _attributes$attr2;
|
|
46
|
+
var attr = type;
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
layer[attr]((_attributes$attr = attributes[attr]) === null || _attributes$attr === void 0 ? void 0 : _attributes$attr.field, (_attributes$attr2 = attributes[attr]) === null || _attributes$attr2 === void 0 ? void 0 : _attributes$attr2.values);
|
|
49
|
+
});
|
|
50
|
+
_context.next = 9;
|
|
51
|
+
return this.addLayer(layer);
|
|
52
|
+
case 9:
|
|
53
|
+
this.isLoaded = true;
|
|
54
|
+
case 10:
|
|
55
|
+
case "end":
|
|
56
|
+
return _context.stop();
|
|
72
57
|
}
|
|
73
58
|
}, _callee, this);
|
|
74
59
|
}));
|
|
75
|
-
|
|
76
60
|
function initTileLayer() {
|
|
77
61
|
return _initTileLayer.apply(this, arguments);
|
|
78
62
|
}
|
|
79
|
-
|
|
80
63
|
return initTileLayer;
|
|
81
64
|
}()
|
|
82
65
|
}, {
|
|
83
66
|
key: "getSourceOption",
|
|
84
67
|
value: function getSourceOption() {
|
|
85
68
|
var rawSource = this.parent.getSource();
|
|
86
|
-
|
|
87
69
|
var _this$sourceTile$data = this.sourceTile.data.data,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
70
|
+
rasterData = _this$sourceTile$data.rasterData,
|
|
71
|
+
res = _objectWithoutProperties(_this$sourceTile$data, _excluded);
|
|
91
72
|
return {
|
|
92
73
|
data: rasterData,
|
|
93
74
|
options: {
|
|
@@ -99,24 +80,22 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
|
|
|
99
80
|
}
|
|
100
81
|
};
|
|
101
82
|
}
|
|
83
|
+
|
|
102
84
|
/**
|
|
103
85
|
* 用于 style 更新 colorTexture 的优化
|
|
104
86
|
* @param arg
|
|
105
87
|
*/
|
|
106
|
-
|
|
107
88
|
}, {
|
|
108
89
|
key: "styleUpdate",
|
|
109
90
|
value: function styleUpdate() {
|
|
110
91
|
var _this = this;
|
|
111
|
-
|
|
112
92
|
for (var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
113
93
|
arg[_key] = arguments[_key];
|
|
114
94
|
}
|
|
115
|
-
|
|
116
95
|
var _ref2 = arg,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
96
|
+
_ref2$rampColors = _ref2.rampColors,
|
|
97
|
+
rampColors = _ref2$rampColors === void 0 ? DEFAULT_COLOR_TEXTURE_OPTION : _ref2$rampColors,
|
|
98
|
+
domain = _ref2.domain;
|
|
120
99
|
this.colorTexture = this.parent.textureService.getColorTexture(rampColors, domain || getDefaultDomain(rampColors));
|
|
121
100
|
this.layers.forEach(function (layer) {
|
|
122
101
|
return layer.style({
|
|
@@ -132,8 +111,6 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
|
|
|
132
111
|
});
|
|
133
112
|
}
|
|
134
113
|
}]);
|
|
135
|
-
|
|
136
114
|
return RasterTile;
|
|
137
115
|
}(Tile);
|
|
138
|
-
|
|
139
116
|
export { RasterTile as default };
|
|
@@ -8,19 +8,13 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
8
8
|
import { createLayerContainer } from '@antv/l7-core';
|
|
9
9
|
import PolygonLayer from "../../polygon";
|
|
10
10
|
import { isNeedMask } from "./util";
|
|
11
|
-
|
|
12
11
|
var Tile = /*#__PURE__*/function () {
|
|
13
12
|
function Tile(sourceTile, parent) {
|
|
14
13
|
_classCallCheck(this, Tile);
|
|
15
|
-
|
|
16
14
|
_defineProperty(this, "visible", true);
|
|
17
|
-
|
|
18
15
|
_defineProperty(this, "layers", []);
|
|
19
|
-
|
|
20
16
|
_defineProperty(this, "isLoaded", false);
|
|
21
|
-
|
|
22
17
|
_defineProperty(this, "tileMaskLayers", []);
|
|
23
|
-
|
|
24
18
|
this.parent = parent;
|
|
25
19
|
this.sourceTile = sourceTile;
|
|
26
20
|
this.x = sourceTile.x;
|
|
@@ -28,13 +22,13 @@ var Tile = /*#__PURE__*/function () {
|
|
|
28
22
|
this.z = sourceTile.z;
|
|
29
23
|
this.key = "".concat(this.x, "_").concat(this.y, "_").concat(this.z);
|
|
30
24
|
}
|
|
31
|
-
|
|
32
25
|
_createClass(Tile, [{
|
|
33
26
|
key: "getLayers",
|
|
34
27
|
value: function getLayers() {
|
|
35
28
|
return this.layers;
|
|
36
|
-
}
|
|
29
|
+
}
|
|
37
30
|
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
38
32
|
}, {
|
|
39
33
|
key: "styleUpdate",
|
|
40
34
|
value: function styleUpdate() {
|
|
@@ -44,20 +38,18 @@ var Tile = /*#__PURE__*/function () {
|
|
|
44
38
|
key: "lnglatInBounds",
|
|
45
39
|
value: function lnglatInBounds(lnglat) {
|
|
46
40
|
var _this$sourceTile$boun = _slicedToArray(this.sourceTile.bounds, 4),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
minLng = _this$sourceTile$boun[0],
|
|
42
|
+
minLat = _this$sourceTile$boun[1],
|
|
43
|
+
maxLng = _this$sourceTile$boun[2],
|
|
44
|
+
maxLat = _this$sourceTile$boun[3];
|
|
52
45
|
var lng = lnglat.lng,
|
|
53
|
-
|
|
46
|
+
lat = lnglat.lat;
|
|
54
47
|
return lng >= minLng && lng <= maxLng && lat >= minLat && lat <= maxLat;
|
|
55
48
|
}
|
|
56
49
|
}, {
|
|
57
50
|
key: "getLayerOptions",
|
|
58
51
|
value: function getLayerOptions() {
|
|
59
52
|
var _options$maskLayers;
|
|
60
|
-
|
|
61
53
|
var options = this.parent.getLayerConfig();
|
|
62
54
|
return _objectSpread(_objectSpread({}, options), {}, {
|
|
63
55
|
autoFit: false,
|
|
@@ -65,16 +57,14 @@ var Tile = /*#__PURE__*/function () {
|
|
|
65
57
|
tileMask: isNeedMask(this.parent.type),
|
|
66
58
|
mask: options.mask || ((_options$maskLayers = options.maskLayers) === null || _options$maskLayers === void 0 ? void 0 : _options$maskLayers.length) !== 0 && options.enableMask
|
|
67
59
|
});
|
|
68
|
-
}
|
|
69
|
-
|
|
60
|
+
}
|
|
61
|
+
// 获取Mask 图层
|
|
70
62
|
}, {
|
|
71
63
|
key: "getMaskLayer",
|
|
72
64
|
value: function getMaskLayer() {
|
|
73
65
|
var _this = this;
|
|
74
|
-
|
|
75
66
|
var _this$parent$getLayer = this.parent.getLayerConfig(),
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
maskLayers = _this$parent$getLayer.maskLayers;
|
|
78
68
|
var layers = [];
|
|
79
69
|
maskLayers === null || maskLayers === void 0 ? void 0 : maskLayers.forEach(function (layer) {
|
|
80
70
|
if (!layer.tileLayer) {
|
|
@@ -82,11 +72,9 @@ var Tile = /*#__PURE__*/function () {
|
|
|
82
72
|
layers.push(layer);
|
|
83
73
|
return layer;
|
|
84
74
|
}
|
|
85
|
-
|
|
86
75
|
var tileLayer = layer.tileLayer;
|
|
87
76
|
var tile = tileLayer.getTile(_this.sourceTile.key);
|
|
88
77
|
var l = tile === null || tile === void 0 ? void 0 : tile.getLayers()[0];
|
|
89
|
-
|
|
90
78
|
if (l) {
|
|
91
79
|
layers.push(l);
|
|
92
80
|
}
|
|
@@ -99,48 +87,40 @@ var Tile = /*#__PURE__*/function () {
|
|
|
99
87
|
var _addTileMask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
100
88
|
var mask, container, mainLayer;
|
|
101
89
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
102
|
-
while (1) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
featureId: 'id'
|
|
115
|
-
}
|
|
116
|
-
}).shape('fill');
|
|
117
|
-
container = createLayerContainer(this.parent.sceneContainer);
|
|
118
|
-
mask.setContainer(container, this.parent.sceneContainer);
|
|
119
|
-
_context.next = 5;
|
|
120
|
-
return mask.init();
|
|
121
|
-
|
|
122
|
-
case 5:
|
|
123
|
-
this.tileMask = mask;
|
|
124
|
-
mainLayer = this.getMainLayer();
|
|
125
|
-
|
|
126
|
-
if (mainLayer !== undefined) {
|
|
127
|
-
mainLayer.tileMask = mask;
|
|
90
|
+
while (1) switch (_context.prev = _context.next) {
|
|
91
|
+
case 0:
|
|
92
|
+
mask = new PolygonLayer({
|
|
93
|
+
visible: false,
|
|
94
|
+
enablePicking: false
|
|
95
|
+
}).source({
|
|
96
|
+
type: 'FeatureCollection',
|
|
97
|
+
features: [this.sourceTile.bboxPolygon]
|
|
98
|
+
}, {
|
|
99
|
+
parser: {
|
|
100
|
+
type: 'geojson',
|
|
101
|
+
featureId: 'id'
|
|
128
102
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
103
|
+
}).shape('fill');
|
|
104
|
+
container = createLayerContainer(this.parent.sceneContainer);
|
|
105
|
+
mask.setContainer(container, this.parent.sceneContainer);
|
|
106
|
+
_context.next = 5;
|
|
107
|
+
return mask.init();
|
|
108
|
+
case 5:
|
|
109
|
+
this.tileMask = mask;
|
|
110
|
+
mainLayer = this.getMainLayer();
|
|
111
|
+
if (mainLayer !== undefined) {
|
|
112
|
+
mainLayer.tileMask = mask;
|
|
113
|
+
}
|
|
114
|
+
return _context.abrupt("return", mask);
|
|
115
|
+
case 9:
|
|
116
|
+
case "end":
|
|
117
|
+
return _context.stop();
|
|
136
118
|
}
|
|
137
119
|
}, _callee, this);
|
|
138
120
|
}));
|
|
139
|
-
|
|
140
121
|
function addTileMask() {
|
|
141
122
|
return _addTileMask.apply(this, arguments);
|
|
142
123
|
}
|
|
143
|
-
|
|
144
124
|
return addTileMask;
|
|
145
125
|
}()
|
|
146
126
|
}, {
|
|
@@ -149,30 +129,24 @@ var Tile = /*#__PURE__*/function () {
|
|
|
149
129
|
var _addMask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(layer, mask) {
|
|
150
130
|
var container;
|
|
151
131
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
152
|
-
while (1) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
case 6:
|
|
165
|
-
case "end":
|
|
166
|
-
return _context2.stop();
|
|
167
|
-
}
|
|
132
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
133
|
+
case 0:
|
|
134
|
+
container = createLayerContainer(this.parent.sceneContainer);
|
|
135
|
+
mask.setContainer(container, this.parent.sceneContainer);
|
|
136
|
+
_context2.next = 4;
|
|
137
|
+
return mask.init();
|
|
138
|
+
case 4:
|
|
139
|
+
layer.addMask(mask);
|
|
140
|
+
this.tileMaskLayers.push(mask);
|
|
141
|
+
case 6:
|
|
142
|
+
case "end":
|
|
143
|
+
return _context2.stop();
|
|
168
144
|
}
|
|
169
145
|
}, _callee2, this);
|
|
170
146
|
}));
|
|
171
|
-
|
|
172
147
|
function addMask(_x, _x2) {
|
|
173
148
|
return _addMask.apply(this, arguments);
|
|
174
149
|
}
|
|
175
|
-
|
|
176
150
|
return addMask;
|
|
177
151
|
}()
|
|
178
152
|
}, {
|
|
@@ -181,29 +155,24 @@ var Tile = /*#__PURE__*/function () {
|
|
|
181
155
|
var _addLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(layer) {
|
|
182
156
|
var container;
|
|
183
157
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
184
|
-
while (1) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
case "end":
|
|
197
|
-
return _context3.stop();
|
|
198
|
-
}
|
|
158
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
159
|
+
case 0:
|
|
160
|
+
// set flag
|
|
161
|
+
layer.isTileLayer = true;
|
|
162
|
+
container = createLayerContainer(this.parent.sceneContainer);
|
|
163
|
+
layer.setContainer(container, this.parent.sceneContainer);
|
|
164
|
+
this.layers.push(layer);
|
|
165
|
+
_context3.next = 6;
|
|
166
|
+
return layer.init();
|
|
167
|
+
case 6:
|
|
168
|
+
case "end":
|
|
169
|
+
return _context3.stop();
|
|
199
170
|
}
|
|
200
171
|
}, _callee3, this);
|
|
201
172
|
}));
|
|
202
|
-
|
|
203
173
|
function addLayer(_x3) {
|
|
204
174
|
return _addLayer.apply(this, arguments);
|
|
205
175
|
}
|
|
206
|
-
|
|
207
176
|
return addLayer;
|
|
208
177
|
}()
|
|
209
178
|
}, {
|
|
@@ -219,10 +188,10 @@ var Tile = /*#__PURE__*/function () {
|
|
|
219
188
|
l.updateLayerConfig(_defineProperty({}, key, value));
|
|
220
189
|
});
|
|
221
190
|
}
|
|
191
|
+
|
|
222
192
|
/**
|
|
223
193
|
* 一个 Tile 可能有多个 layer,但是在发生拾取、点击事件的时候只有一个生效
|
|
224
194
|
*/
|
|
225
|
-
|
|
226
195
|
}, {
|
|
227
196
|
key: "getMainLayer",
|
|
228
197
|
value: function getMainLayer() {
|
|
@@ -233,12 +202,12 @@ var Tile = /*#__PURE__*/function () {
|
|
|
233
202
|
value: function getFeatures(sourceLayer) {
|
|
234
203
|
return [];
|
|
235
204
|
}
|
|
205
|
+
|
|
236
206
|
/**
|
|
237
207
|
* 在一个 Tile 中可能存在一个相同 ID 的 feature
|
|
238
208
|
* @param id
|
|
239
209
|
* @returns
|
|
240
210
|
*/
|
|
241
|
-
|
|
242
211
|
}, {
|
|
243
212
|
key: "getFeatureById",
|
|
244
213
|
value: function getFeatureById(id) {
|
|
@@ -248,15 +217,12 @@ var Tile = /*#__PURE__*/function () {
|
|
|
248
217
|
key: "destroy",
|
|
249
218
|
value: function destroy() {
|
|
250
219
|
var _this$tileMask;
|
|
251
|
-
|
|
252
220
|
(_this$tileMask = this.tileMask) === null || _this$tileMask === void 0 ? void 0 : _this$tileMask.destroy();
|
|
253
221
|
this.layers.forEach(function (layer) {
|
|
254
222
|
return layer.destroy();
|
|
255
223
|
});
|
|
256
224
|
}
|
|
257
225
|
}]);
|
|
258
|
-
|
|
259
226
|
return Tile;
|
|
260
227
|
}();
|
|
261
|
-
|
|
262
228
|
export { Tile as default };
|
|
@@ -6,98 +6,75 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
6
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
8
8
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
|
-
|
|
10
9
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
|
-
|
|
12
10
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
|
-
|
|
14
11
|
import Tile from "./Tile";
|
|
15
12
|
import { getTileLayer } from "./util";
|
|
16
|
-
|
|
17
13
|
var VectorTile = /*#__PURE__*/function (_Tile) {
|
|
18
14
|
_inherits(VectorTile, _Tile);
|
|
19
|
-
|
|
20
15
|
var _super = _createSuper(VectorTile);
|
|
21
|
-
|
|
22
16
|
function VectorTile() {
|
|
23
17
|
_classCallCheck(this, VectorTile);
|
|
24
|
-
|
|
25
18
|
return _super.apply(this, arguments);
|
|
26
19
|
}
|
|
27
|
-
|
|
28
20
|
_createClass(VectorTile, [{
|
|
29
21
|
key: "initTileLayer",
|
|
30
22
|
value: function () {
|
|
31
23
|
var _initTileLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
32
24
|
var attributes, layerOptions, vectorLayer, sourceOptions, layer;
|
|
33
25
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
34
|
-
while (1) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
layer[attr]((_attributes$attr = attributes[attr]) === null || _attributes$attr === void 0 ? void 0 : _attributes$attr.field, (_attributes$attr2 = attributes[attr]) === null || _attributes$attr2 === void 0 ? void 0 : _attributes$attr2.values);
|
|
59
|
-
});
|
|
60
|
-
_context.next = 11;
|
|
61
|
-
return this.addLayer(layer);
|
|
62
|
-
|
|
63
|
-
case 11:
|
|
64
|
-
if (!layerOptions.tileMask) {
|
|
65
|
-
_context.next = 14;
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
|
|
26
|
+
while (1) switch (_context.prev = _context.next) {
|
|
27
|
+
case 0:
|
|
28
|
+
attributes = this.parent.getLayerAttributeConfig();
|
|
29
|
+
layerOptions = this.getLayerOptions();
|
|
30
|
+
vectorLayer = getTileLayer(this.parent.type);
|
|
31
|
+
sourceOptions = this.getSourceOption();
|
|
32
|
+
if (sourceOptions) {
|
|
33
|
+
_context.next = 7;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
this.isLoaded = true;
|
|
37
|
+
return _context.abrupt("return");
|
|
38
|
+
case 7:
|
|
39
|
+
layer = new vectorLayer(_objectSpread({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
|
|
40
|
+
Object.keys(attributes).forEach(function (type) {
|
|
41
|
+
var _attributes$attr, _attributes$attr2;
|
|
42
|
+
var attr = type;
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
layer[attr]((_attributes$attr = attributes[attr]) === null || _attributes$attr === void 0 ? void 0 : _attributes$attr.field, (_attributes$attr2 = attributes[attr]) === null || _attributes$attr2 === void 0 ? void 0 : _attributes$attr2.values);
|
|
45
|
+
});
|
|
46
|
+
_context.next = 11;
|
|
47
|
+
return this.addLayer(layer);
|
|
48
|
+
case 11:
|
|
49
|
+
if (!layerOptions.tileMask) {
|
|
69
50
|
_context.next = 14;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
_context.next = 14;
|
|
54
|
+
return this.addTileMask();
|
|
55
|
+
case 14:
|
|
56
|
+
this.setLayerMinMaxZoom(layer);
|
|
57
|
+
this.isLoaded = true;
|
|
58
|
+
case 16:
|
|
59
|
+
case "end":
|
|
60
|
+
return _context.stop();
|
|
80
61
|
}
|
|
81
62
|
}, _callee, this);
|
|
82
63
|
}));
|
|
83
|
-
|
|
84
64
|
function initTileLayer() {
|
|
85
65
|
return _initTileLayer.apply(this, arguments);
|
|
86
66
|
}
|
|
87
|
-
|
|
88
67
|
return initTileLayer;
|
|
89
68
|
}()
|
|
90
69
|
}, {
|
|
91
70
|
key: "getSourceOption",
|
|
92
71
|
value: function getSourceOption() {
|
|
93
72
|
var rawSource = this.parent.getSource();
|
|
94
|
-
|
|
95
73
|
var _this$parent$getLayer = this.parent.getLayerConfig(),
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
74
|
+
_this$parent$getLayer2 = _this$parent$getLayer.sourceLayer,
|
|
75
|
+
sourceLayer = _this$parent$getLayer2 === void 0 ? 'defaultLayer' : _this$parent$getLayer2,
|
|
76
|
+
_this$parent$getLayer3 = _this$parent$getLayer.featureId,
|
|
77
|
+
featureId = _this$parent$getLayer3 === void 0 ? 'id' : _this$parent$getLayer3;
|
|
101
78
|
var features = this.getFeatures(sourceLayer);
|
|
102
79
|
return {
|
|
103
80
|
data: {
|
|
@@ -123,37 +100,33 @@ var VectorTile = /*#__PURE__*/function (_Tile) {
|
|
|
123
100
|
minZoom: this.z - 1
|
|
124
101
|
});
|
|
125
102
|
}
|
|
126
|
-
}
|
|
127
|
-
|
|
103
|
+
}
|
|
104
|
+
// 获取瓦片数据
|
|
128
105
|
}, {
|
|
129
106
|
key: "getFeatures",
|
|
130
107
|
value: function getFeatures(sourceLayer) {
|
|
131
108
|
var source = this.sourceTile.data;
|
|
132
109
|
return source.getTileData(sourceLayer);
|
|
133
110
|
}
|
|
111
|
+
|
|
134
112
|
/**
|
|
135
113
|
* 在一个 Tile 中可能存在一个相同 ID 的 feature
|
|
136
114
|
* @param id
|
|
137
115
|
* @returns
|
|
138
116
|
*/
|
|
139
|
-
|
|
140
117
|
}, {
|
|
141
118
|
key: "getFeatureById",
|
|
142
119
|
value: function getFeatureById(id) {
|
|
143
120
|
var layer = this.getMainLayer();
|
|
144
|
-
|
|
145
121
|
if (!layer) {
|
|
146
122
|
return [];
|
|
147
123
|
}
|
|
148
|
-
|
|
149
124
|
var res = layer.getSource().data.dataArray.filter(function (d) {
|
|
150
125
|
return d._id === id;
|
|
151
126
|
});
|
|
152
127
|
return res;
|
|
153
128
|
}
|
|
154
129
|
}]);
|
|
155
|
-
|
|
156
130
|
return VectorTile;
|
|
157
131
|
}(Tile);
|
|
158
|
-
|
|
159
132
|
export { VectorTile as default };
|
|
@@ -8,43 +8,32 @@ import RasterTile from "./RasterTile";
|
|
|
8
8
|
import VectorTile from "./VectorTile";
|
|
9
9
|
export function getTileFactory(layer) {
|
|
10
10
|
var tileType = layer.type;
|
|
11
|
-
|
|
12
11
|
switch (tileType) {
|
|
13
12
|
case 'PolygonLayer':
|
|
14
13
|
return VectorTile;
|
|
15
|
-
|
|
16
14
|
case 'LineLayer':
|
|
17
15
|
return VectorTile;
|
|
18
|
-
|
|
19
16
|
case 'PointLayer':
|
|
20
17
|
return VectorTile;
|
|
21
|
-
|
|
22
18
|
case 'TileDebugLayer':
|
|
23
19
|
return DebugTile;
|
|
24
|
-
|
|
25
20
|
case 'MaskLayer':
|
|
26
21
|
return MaskLayer;
|
|
27
|
-
|
|
28
22
|
case 'RasterLayer':
|
|
29
23
|
var dataType = layer.getSource().parser.dataType;
|
|
30
|
-
|
|
31
24
|
switch (dataType) {
|
|
32
25
|
case RasterTileType.RGB:
|
|
33
26
|
case RasterTileType.CUSTOMRGB:
|
|
34
27
|
return RasterRGBTile;
|
|
35
|
-
|
|
36
28
|
case RasterTileType.ARRAYBUFFER:
|
|
37
29
|
case RasterTileType.CUSTOMARRAYBUFFER:
|
|
38
30
|
return RasterTile;
|
|
39
|
-
|
|
40
31
|
case RasterTileType.TERRAINRGB:
|
|
41
32
|
case RasterTileType.CUSTOMTERRAINRGB:
|
|
42
33
|
return RasterTerrainRGBTile;
|
|
43
|
-
|
|
44
34
|
default:
|
|
45
35
|
return ImageTile;
|
|
46
36
|
}
|
|
47
|
-
|
|
48
37
|
default:
|
|
49
38
|
return VectorTile;
|
|
50
39
|
}
|