@antv/l7-layers 2.17.4 → 2.17.6
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 +325 -483
- package/es/core/BaseModel.js +51 -80
- package/es/core/CommonStyleAttribute.js +2 -5
- 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 +27 -39
- package/es/core/triangulation.js +99 -136
- 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 +92 -149
- 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 -35
- package/es/line/models/arc.js +63 -112
- package/es/line/models/arc_3d.js +58 -102
- package/es/line/models/earthArc_3d.js +60 -105
- package/es/line/models/flow.js +36 -60
- package/es/line/models/great_circle.js +53 -94
- package/es/line/models/line.js +92 -144
- package/es/line/models/linearline.js +42 -74
- package/es/line/models/simpleLine.js +38 -67
- package/es/line/models/wall.js +52 -92
- package/es/line/shaders/dash/line_dash_vert.glsl +1 -2
- package/es/line/shaders/line_frag.glsl +1 -3
- package/es/line/shaders/line_vert.glsl +2 -0
- package/es/line/shaders/linear/line_linear_frag.glsl +1 -1
- package/es/mask/index.js +9 -28
- package/es/mask/models/fill.js +29 -54
- package/es/plugins/DataMappingPlugin.js +78 -114
- 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 +69 -118
- package/es/plugins/LayerStylePlugin.js +4 -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 -78
- package/es/point/models/earthExtrude.js +58 -95
- package/es/point/models/earthFill.js +52 -80
- package/es/point/models/extrude.js +57 -94
- package/es/point/models/fill.js +56 -81
- package/es/point/models/fillmage.js +60 -100
- package/es/point/models/image.js +47 -83
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +30 -54
- package/es/point/models/radar.js +38 -63
- package/es/point/models/simplePoint.js +38 -62
- package/es/point/models/text.js +199 -296
- package/es/point/shape/extrude.js +4 -13
- package/es/polygon/index.js +11 -41
- package/es/polygon/models/extrude.js +87 -135
- package/es/polygon/models/fill.js +50 -79
- 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 +33 -55
- package/es/tile/service/TilePickService.js +26 -40
- package/es/tile/service/TileSourceService.js +3 -7
- package/es/tile/tileFactory/DebugTile.js +29 -46
- 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/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 +325 -474
- package/lib/core/BaseModel.js +51 -90
- package/lib/core/CommonStyleAttribute.js +2 -7
- 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 +27 -62
- package/lib/core/triangulation.js +98 -177
- 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 +92 -166
- 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 +61 -122
- package/lib/line/models/arc_3d.js +56 -113
- package/lib/line/models/earthArc_3d.js +58 -115
- package/lib/line/models/flow.js +36 -70
- package/lib/line/models/great_circle.js +53 -104
- package/lib/line/models/index.js +0 -11
- package/lib/line/models/line.js +90 -152
- package/lib/line/models/linearline.js +42 -86
- package/lib/line/models/simpleLine.js +38 -77
- package/lib/line/models/wall.js +52 -103
- package/lib/line/shaders/dash/line_dash_vert.glsl +1 -2
- package/lib/line/shaders/line_frag.glsl +1 -3
- package/lib/line/shaders/line_vert.glsl +2 -0
- package/lib/line/shaders/linear/line_linear_frag.glsl +1 -1
- 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 +78 -125
- 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 +70 -127
- package/lib/plugins/LayerStylePlugin.js +5 -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 +58 -106
- package/lib/point/models/earthFill.js +52 -110
- package/lib/point/models/extrude.js +57 -103
- package/lib/point/models/fill.js +54 -90
- package/lib/point/models/fillmage.js +58 -107
- package/lib/point/models/image.js +47 -92
- package/lib/point/models/index.js +1 -12
- package/lib/point/models/normal.js +30 -64
- package/lib/point/models/radar.js +38 -72
- package/lib/point/models/simplePoint.js +38 -72
- package/lib/point/models/text.js +199 -305
- package/lib/point/shape/extrude.js +4 -20
- package/lib/polygon/index.js +11 -48
- package/lib/polygon/models/extrude.js +87 -146
- package/lib/polygon/models/fill.js +50 -89
- 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 +33 -60
- 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 +29 -54
- 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/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
|
textAllowOverlap: true,
|
|
@@ -67,16 +59,14 @@ var Tile = /*#__PURE__*/function () {
|
|
|
67
59
|
tileMask: isNeedMask(this.parent.type),
|
|
68
60
|
mask: options.mask || ((_options$maskLayers = options.maskLayers) === null || _options$maskLayers === void 0 ? void 0 : _options$maskLayers.length) !== 0 && options.enableMask
|
|
69
61
|
});
|
|
70
|
-
}
|
|
71
|
-
|
|
62
|
+
}
|
|
63
|
+
// 获取Mask 图层
|
|
72
64
|
}, {
|
|
73
65
|
key: "getMaskLayer",
|
|
74
66
|
value: function getMaskLayer() {
|
|
75
67
|
var _this = this;
|
|
76
|
-
|
|
77
68
|
var _this$parent$getLayer = this.parent.getLayerConfig(),
|
|
78
|
-
|
|
79
|
-
|
|
69
|
+
maskLayers = _this$parent$getLayer.maskLayers;
|
|
80
70
|
var layers = [];
|
|
81
71
|
maskLayers === null || maskLayers === void 0 ? void 0 : maskLayers.forEach(function (layer) {
|
|
82
72
|
if (!layer.tileLayer) {
|
|
@@ -84,11 +74,9 @@ var Tile = /*#__PURE__*/function () {
|
|
|
84
74
|
layers.push(layer);
|
|
85
75
|
return layer;
|
|
86
76
|
}
|
|
87
|
-
|
|
88
77
|
var tileLayer = layer.tileLayer;
|
|
89
78
|
var tile = tileLayer.getTile(_this.sourceTile.key);
|
|
90
79
|
var l = tile === null || tile === void 0 ? void 0 : tile.getLayers()[0];
|
|
91
|
-
|
|
92
80
|
if (l) {
|
|
93
81
|
layers.push(l);
|
|
94
82
|
}
|
|
@@ -101,48 +89,40 @@ var Tile = /*#__PURE__*/function () {
|
|
|
101
89
|
var _addTileMask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
102
90
|
var mask, container, mainLayer;
|
|
103
91
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
104
|
-
while (1) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
featureId: 'id'
|
|
117
|
-
}
|
|
118
|
-
}).shape('fill');
|
|
119
|
-
container = createLayerContainer(this.parent.sceneContainer);
|
|
120
|
-
mask.setContainer(container, this.parent.sceneContainer);
|
|
121
|
-
_context.next = 5;
|
|
122
|
-
return mask.init();
|
|
123
|
-
|
|
124
|
-
case 5:
|
|
125
|
-
this.tileMask = mask;
|
|
126
|
-
mainLayer = this.getMainLayer();
|
|
127
|
-
|
|
128
|
-
if (mainLayer !== undefined) {
|
|
129
|
-
mainLayer.tileMask = mask;
|
|
92
|
+
while (1) switch (_context.prev = _context.next) {
|
|
93
|
+
case 0:
|
|
94
|
+
mask = new PolygonLayer({
|
|
95
|
+
visible: false,
|
|
96
|
+
enablePicking: false
|
|
97
|
+
}).source({
|
|
98
|
+
type: 'FeatureCollection',
|
|
99
|
+
features: [this.sourceTile.bboxPolygon]
|
|
100
|
+
}, {
|
|
101
|
+
parser: {
|
|
102
|
+
type: 'geojson',
|
|
103
|
+
featureId: 'id'
|
|
130
104
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
105
|
+
}).shape('fill');
|
|
106
|
+
container = createLayerContainer(this.parent.sceneContainer);
|
|
107
|
+
mask.setContainer(container, this.parent.sceneContainer);
|
|
108
|
+
_context.next = 5;
|
|
109
|
+
return mask.init();
|
|
110
|
+
case 5:
|
|
111
|
+
this.tileMask = mask;
|
|
112
|
+
mainLayer = this.getMainLayer();
|
|
113
|
+
if (mainLayer !== undefined) {
|
|
114
|
+
mainLayer.tileMask = mask;
|
|
115
|
+
}
|
|
116
|
+
return _context.abrupt("return", mask);
|
|
117
|
+
case 9:
|
|
118
|
+
case "end":
|
|
119
|
+
return _context.stop();
|
|
138
120
|
}
|
|
139
121
|
}, _callee, this);
|
|
140
122
|
}));
|
|
141
|
-
|
|
142
123
|
function addTileMask() {
|
|
143
124
|
return _addTileMask.apply(this, arguments);
|
|
144
125
|
}
|
|
145
|
-
|
|
146
126
|
return addTileMask;
|
|
147
127
|
}()
|
|
148
128
|
}, {
|
|
@@ -151,30 +131,24 @@ var Tile = /*#__PURE__*/function () {
|
|
|
151
131
|
var _addMask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(layer, mask) {
|
|
152
132
|
var container;
|
|
153
133
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
154
|
-
while (1) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
case 6:
|
|
167
|
-
case "end":
|
|
168
|
-
return _context2.stop();
|
|
169
|
-
}
|
|
134
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
135
|
+
case 0:
|
|
136
|
+
container = createLayerContainer(this.parent.sceneContainer);
|
|
137
|
+
mask.setContainer(container, this.parent.sceneContainer);
|
|
138
|
+
_context2.next = 4;
|
|
139
|
+
return mask.init();
|
|
140
|
+
case 4:
|
|
141
|
+
layer.addMask(mask);
|
|
142
|
+
this.tileMaskLayers.push(mask);
|
|
143
|
+
case 6:
|
|
144
|
+
case "end":
|
|
145
|
+
return _context2.stop();
|
|
170
146
|
}
|
|
171
147
|
}, _callee2, this);
|
|
172
148
|
}));
|
|
173
|
-
|
|
174
149
|
function addMask(_x, _x2) {
|
|
175
150
|
return _addMask.apply(this, arguments);
|
|
176
151
|
}
|
|
177
|
-
|
|
178
152
|
return addMask;
|
|
179
153
|
}()
|
|
180
154
|
}, {
|
|
@@ -183,29 +157,24 @@ var Tile = /*#__PURE__*/function () {
|
|
|
183
157
|
var _addLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(layer) {
|
|
184
158
|
var container;
|
|
185
159
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
186
|
-
while (1) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
case "end":
|
|
199
|
-
return _context3.stop();
|
|
200
|
-
}
|
|
160
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
161
|
+
case 0:
|
|
162
|
+
// set flag
|
|
163
|
+
layer.isTileLayer = true;
|
|
164
|
+
container = createLayerContainer(this.parent.sceneContainer);
|
|
165
|
+
layer.setContainer(container, this.parent.sceneContainer);
|
|
166
|
+
this.layers.push(layer);
|
|
167
|
+
_context3.next = 6;
|
|
168
|
+
return layer.init();
|
|
169
|
+
case 6:
|
|
170
|
+
case "end":
|
|
171
|
+
return _context3.stop();
|
|
201
172
|
}
|
|
202
173
|
}, _callee3, this);
|
|
203
174
|
}));
|
|
204
|
-
|
|
205
175
|
function addLayer(_x3) {
|
|
206
176
|
return _addLayer.apply(this, arguments);
|
|
207
177
|
}
|
|
208
|
-
|
|
209
178
|
return addLayer;
|
|
210
179
|
}()
|
|
211
180
|
}, {
|
|
@@ -221,10 +190,10 @@ var Tile = /*#__PURE__*/function () {
|
|
|
221
190
|
l.updateLayerConfig(_defineProperty({}, key, value));
|
|
222
191
|
});
|
|
223
192
|
}
|
|
193
|
+
|
|
224
194
|
/**
|
|
225
195
|
* 一个 Tile 可能有多个 layer,但是在发生拾取、点击事件的时候只有一个生效
|
|
226
196
|
*/
|
|
227
|
-
|
|
228
197
|
}, {
|
|
229
198
|
key: "getMainLayer",
|
|
230
199
|
value: function getMainLayer() {
|
|
@@ -235,12 +204,12 @@ var Tile = /*#__PURE__*/function () {
|
|
|
235
204
|
value: function getFeatures(sourceLayer) {
|
|
236
205
|
return [];
|
|
237
206
|
}
|
|
207
|
+
|
|
238
208
|
/**
|
|
239
209
|
* 在一个 Tile 中可能存在一个相同 ID 的 feature
|
|
240
210
|
* @param id
|
|
241
211
|
* @returns
|
|
242
212
|
*/
|
|
243
|
-
|
|
244
213
|
}, {
|
|
245
214
|
key: "getFeatureById",
|
|
246
215
|
value: function getFeatureById(id) {
|
|
@@ -250,15 +219,12 @@ var Tile = /*#__PURE__*/function () {
|
|
|
250
219
|
key: "destroy",
|
|
251
220
|
value: function destroy() {
|
|
252
221
|
var _this$tileMask;
|
|
253
|
-
|
|
254
222
|
(_this$tileMask = this.tileMask) === null || _this$tileMask === void 0 ? void 0 : _this$tileMask.destroy();
|
|
255
223
|
this.layers.forEach(function (layer) {
|
|
256
224
|
return layer.destroy();
|
|
257
225
|
});
|
|
258
226
|
}
|
|
259
227
|
}]);
|
|
260
|
-
|
|
261
228
|
return Tile;
|
|
262
229
|
}();
|
|
263
|
-
|
|
264
230
|
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
|
}
|