@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
|
@@ -1,86 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
9
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
13
|
-
|
|
14
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
-
|
|
16
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
-
|
|
18
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
-
|
|
20
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
-
|
|
22
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
-
|
|
24
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
-
|
|
26
16
|
var _raster = _interopRequireDefault(require("../../raster"));
|
|
27
|
-
|
|
28
17
|
var _Tile2 = _interopRequireDefault(require("./Tile"));
|
|
29
|
-
|
|
30
18
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
31
|
-
|
|
32
19
|
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; } }
|
|
33
|
-
|
|
34
20
|
var RasterTerrainRGBTile = /*#__PURE__*/function (_Tile) {
|
|
35
21
|
(0, _inherits2.default)(RasterTerrainRGBTile, _Tile);
|
|
36
|
-
|
|
37
22
|
var _super = _createSuper(RasterTerrainRGBTile);
|
|
38
|
-
|
|
39
23
|
function RasterTerrainRGBTile() {
|
|
40
24
|
(0, _classCallCheck2.default)(this, RasterTerrainRGBTile);
|
|
41
25
|
return _super.apply(this, arguments);
|
|
42
26
|
}
|
|
43
|
-
|
|
44
27
|
(0, _createClass2.default)(RasterTerrainRGBTile, [{
|
|
45
28
|
key: "initTileLayer",
|
|
46
29
|
value: function () {
|
|
47
30
|
var _initTileLayer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
48
31
|
var attributes, layerOptions, sourceOptions, layer;
|
|
49
32
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
50
|
-
while (1) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
this.isLoaded = true;
|
|
71
|
-
|
|
72
|
-
case 8:
|
|
73
|
-
case "end":
|
|
74
|
-
return _context.stop();
|
|
75
|
-
}
|
|
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
|
+
layer = new _raster.default((0, _objectSpread2.default)({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
|
|
39
|
+
// tslint:disable-next-line: no-unused-expression
|
|
40
|
+
attributes && 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 = 7;
|
|
47
|
+
return this.addLayer(layer);
|
|
48
|
+
case 7:
|
|
49
|
+
this.isLoaded = true;
|
|
50
|
+
case 8:
|
|
51
|
+
case "end":
|
|
52
|
+
return _context.stop();
|
|
76
53
|
}
|
|
77
54
|
}, _callee, this);
|
|
78
55
|
}));
|
|
79
|
-
|
|
80
56
|
function initTileLayer() {
|
|
81
57
|
return _initTileLayer.apply(this, arguments);
|
|
82
58
|
}
|
|
83
|
-
|
|
84
59
|
return initTileLayer;
|
|
85
60
|
}()
|
|
86
61
|
}, {
|
|
@@ -101,5 +76,4 @@ var RasterTerrainRGBTile = /*#__PURE__*/function (_Tile) {
|
|
|
101
76
|
}]);
|
|
102
77
|
return RasterTerrainRGBTile;
|
|
103
78
|
}(_Tile2.default);
|
|
104
|
-
|
|
105
79
|
exports.default = RasterTerrainRGBTile;
|
|
@@ -1,102 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
-
|
|
12
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
-
|
|
14
10
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
15
|
-
|
|
16
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
17
|
-
|
|
18
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
19
|
-
|
|
20
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
21
|
-
|
|
22
14
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
23
|
-
|
|
24
15
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
25
|
-
|
|
26
16
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
27
|
-
|
|
28
17
|
var _l7Utils = require("@antv/l7-utils");
|
|
29
|
-
|
|
30
18
|
var _raster = _interopRequireDefault(require("../../raster"));
|
|
31
|
-
|
|
32
19
|
var _Tile2 = _interopRequireDefault(require("./Tile"));
|
|
33
|
-
|
|
34
20
|
var _excluded = ["rasterData"];
|
|
35
|
-
|
|
36
21
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
37
|
-
|
|
38
22
|
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; } }
|
|
39
|
-
|
|
40
23
|
var DEFAULT_COLOR_TEXTURE_OPTION = {
|
|
41
24
|
positions: [0, 1],
|
|
42
25
|
colors: ['#000', '#fff']
|
|
43
26
|
};
|
|
44
|
-
|
|
45
27
|
var RasterTile = /*#__PURE__*/function (_Tile) {
|
|
46
28
|
(0, _inherits2.default)(RasterTile, _Tile);
|
|
47
|
-
|
|
48
29
|
var _super = _createSuper(RasterTile);
|
|
49
|
-
|
|
50
30
|
function RasterTile() {
|
|
51
31
|
(0, _classCallCheck2.default)(this, RasterTile);
|
|
52
32
|
return _super.apply(this, arguments);
|
|
53
33
|
}
|
|
54
|
-
|
|
55
34
|
(0, _createClass2.default)(RasterTile, [{
|
|
56
35
|
key: "initTileLayer",
|
|
57
36
|
value: function () {
|
|
58
37
|
var _initTileLayer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
59
38
|
var attributes, layerOptions, sourceOptions, _ref, rampColors, domain, layer;
|
|
60
|
-
|
|
61
39
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
62
|
-
while (1) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
this.isLoaded = true;
|
|
87
|
-
|
|
88
|
-
case 10:
|
|
89
|
-
case "end":
|
|
90
|
-
return _context.stop();
|
|
91
|
-
}
|
|
40
|
+
while (1) switch (_context.prev = _context.next) {
|
|
41
|
+
case 0:
|
|
42
|
+
attributes = this.parent.getLayerAttributeConfig();
|
|
43
|
+
layerOptions = this.getLayerOptions();
|
|
44
|
+
sourceOptions = this.getSourceOption();
|
|
45
|
+
_ref = this.getLayerOptions(), rampColors = _ref.rampColors, domain = _ref.domain;
|
|
46
|
+
this.colorTexture = this.parent.textureService.getColorTexture(rampColors, domain);
|
|
47
|
+
layer = new _raster.default((0, _objectSpread2.default)((0, _objectSpread2.default)({}, layerOptions), {}, {
|
|
48
|
+
colorTexture: this.colorTexture
|
|
49
|
+
})).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
|
|
50
|
+
// tslint:disable-next-line: no-unused-expression
|
|
51
|
+
attributes && Object.keys(attributes).forEach(function (type) {
|
|
52
|
+
var _attributes$attr, _attributes$attr2;
|
|
53
|
+
var attr = type;
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
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);
|
|
56
|
+
});
|
|
57
|
+
_context.next = 9;
|
|
58
|
+
return this.addLayer(layer);
|
|
59
|
+
case 9:
|
|
60
|
+
this.isLoaded = true;
|
|
61
|
+
case 10:
|
|
62
|
+
case "end":
|
|
63
|
+
return _context.stop();
|
|
92
64
|
}
|
|
93
65
|
}, _callee, this);
|
|
94
66
|
}));
|
|
95
|
-
|
|
96
67
|
function initTileLayer() {
|
|
97
68
|
return _initTileLayer.apply(this, arguments);
|
|
98
69
|
}
|
|
99
|
-
|
|
100
70
|
return initTileLayer;
|
|
101
71
|
}()
|
|
102
72
|
}, {
|
|
@@ -104,8 +74,8 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
|
|
|
104
74
|
value: function getSourceOption() {
|
|
105
75
|
var rawSource = this.parent.getSource();
|
|
106
76
|
var _this$sourceTile$data = this.sourceTile.data.data,
|
|
107
|
-
|
|
108
|
-
|
|
77
|
+
rasterData = _this$sourceTile$data.rasterData,
|
|
78
|
+
res = (0, _objectWithoutProperties2.default)(_this$sourceTile$data, _excluded);
|
|
109
79
|
return {
|
|
110
80
|
data: rasterData,
|
|
111
81
|
options: {
|
|
@@ -117,24 +87,22 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
|
|
|
117
87
|
}
|
|
118
88
|
};
|
|
119
89
|
}
|
|
90
|
+
|
|
120
91
|
/**
|
|
121
92
|
* 用于 style 更新 colorTexture 的优化
|
|
122
93
|
* @param arg
|
|
123
94
|
*/
|
|
124
|
-
|
|
125
95
|
}, {
|
|
126
96
|
key: "styleUpdate",
|
|
127
97
|
value: function styleUpdate() {
|
|
128
98
|
var _this = this;
|
|
129
|
-
|
|
130
99
|
for (var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
131
100
|
arg[_key] = arguments[_key];
|
|
132
101
|
}
|
|
133
|
-
|
|
134
102
|
var _ref2 = arg,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
103
|
+
_ref2$rampColors = _ref2.rampColors,
|
|
104
|
+
rampColors = _ref2$rampColors === void 0 ? DEFAULT_COLOR_TEXTURE_OPTION : _ref2$rampColors,
|
|
105
|
+
domain = _ref2.domain;
|
|
138
106
|
this.colorTexture = this.parent.textureService.getColorTexture(rampColors, domain || (0, _l7Utils.getDefaultDomain)(rampColors));
|
|
139
107
|
this.layers.forEach(function (layer) {
|
|
140
108
|
return layer.style({
|
|
@@ -152,5 +120,4 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
|
|
|
152
120
|
}]);
|
|
153
121
|
return RasterTile;
|
|
154
122
|
}(_Tile2.default);
|
|
155
|
-
|
|
156
123
|
exports.default = RasterTile;
|
|
@@ -1,32 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
10
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
15
|
-
|
|
16
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
-
|
|
18
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
19
|
-
|
|
20
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
21
|
-
|
|
22
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
-
|
|
24
15
|
var _l7Core = require("@antv/l7-core");
|
|
25
|
-
|
|
26
16
|
var _polygon = _interopRequireDefault(require("../../polygon"));
|
|
27
|
-
|
|
28
17
|
var _util = require("./util");
|
|
29
|
-
|
|
30
18
|
var Tile = /*#__PURE__*/function () {
|
|
31
19
|
function Tile(sourceTile, parent) {
|
|
32
20
|
(0, _classCallCheck2.default)(this, Tile);
|
|
@@ -41,13 +29,13 @@ var Tile = /*#__PURE__*/function () {
|
|
|
41
29
|
this.z = sourceTile.z;
|
|
42
30
|
this.key = "".concat(this.x, "_").concat(this.y, "_").concat(this.z);
|
|
43
31
|
}
|
|
44
|
-
|
|
45
32
|
(0, _createClass2.default)(Tile, [{
|
|
46
33
|
key: "getLayers",
|
|
47
34
|
value: function getLayers() {
|
|
48
35
|
return this.layers;
|
|
49
|
-
}
|
|
36
|
+
}
|
|
50
37
|
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
51
39
|
}, {
|
|
52
40
|
key: "styleUpdate",
|
|
53
41
|
value: function styleUpdate() {
|
|
@@ -57,20 +45,18 @@ var Tile = /*#__PURE__*/function () {
|
|
|
57
45
|
key: "lnglatInBounds",
|
|
58
46
|
value: function lnglatInBounds(lnglat) {
|
|
59
47
|
var _this$sourceTile$boun = (0, _slicedToArray2.default)(this.sourceTile.bounds, 4),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
48
|
+
minLng = _this$sourceTile$boun[0],
|
|
49
|
+
minLat = _this$sourceTile$boun[1],
|
|
50
|
+
maxLng = _this$sourceTile$boun[2],
|
|
51
|
+
maxLat = _this$sourceTile$boun[3];
|
|
65
52
|
var lng = lnglat.lng,
|
|
66
|
-
|
|
53
|
+
lat = lnglat.lat;
|
|
67
54
|
return lng >= minLng && lng <= maxLng && lat >= minLat && lat <= maxLat;
|
|
68
55
|
}
|
|
69
56
|
}, {
|
|
70
57
|
key: "getLayerOptions",
|
|
71
58
|
value: function getLayerOptions() {
|
|
72
59
|
var _options$maskLayers;
|
|
73
|
-
|
|
74
60
|
var options = this.parent.getLayerConfig();
|
|
75
61
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, options), {}, {
|
|
76
62
|
autoFit: false,
|
|
@@ -78,16 +64,14 @@ var Tile = /*#__PURE__*/function () {
|
|
|
78
64
|
tileMask: (0, _util.isNeedMask)(this.parent.type),
|
|
79
65
|
mask: options.mask || ((_options$maskLayers = options.maskLayers) === null || _options$maskLayers === void 0 ? void 0 : _options$maskLayers.length) !== 0 && options.enableMask
|
|
80
66
|
});
|
|
81
|
-
}
|
|
82
|
-
|
|
67
|
+
}
|
|
68
|
+
// 获取Mask 图层
|
|
83
69
|
}, {
|
|
84
70
|
key: "getMaskLayer",
|
|
85
71
|
value: function getMaskLayer() {
|
|
86
72
|
var _this = this;
|
|
87
|
-
|
|
88
73
|
var _this$parent$getLayer = this.parent.getLayerConfig(),
|
|
89
|
-
|
|
90
|
-
|
|
74
|
+
maskLayers = _this$parent$getLayer.maskLayers;
|
|
91
75
|
var layers = [];
|
|
92
76
|
maskLayers === null || maskLayers === void 0 ? void 0 : maskLayers.forEach(function (layer) {
|
|
93
77
|
if (!layer.tileLayer) {
|
|
@@ -95,11 +79,9 @@ var Tile = /*#__PURE__*/function () {
|
|
|
95
79
|
layers.push(layer);
|
|
96
80
|
return layer;
|
|
97
81
|
}
|
|
98
|
-
|
|
99
82
|
var tileLayer = layer.tileLayer;
|
|
100
83
|
var tile = tileLayer.getTile(_this.sourceTile.key);
|
|
101
84
|
var l = tile === null || tile === void 0 ? void 0 : tile.getLayers()[0];
|
|
102
|
-
|
|
103
85
|
if (l) {
|
|
104
86
|
layers.push(l);
|
|
105
87
|
}
|
|
@@ -112,48 +94,40 @@ var Tile = /*#__PURE__*/function () {
|
|
|
112
94
|
var _addTileMask = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
113
95
|
var mask, container, mainLayer;
|
|
114
96
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
115
|
-
while (1) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
featureId: 'id'
|
|
128
|
-
}
|
|
129
|
-
}).shape('fill');
|
|
130
|
-
container = (0, _l7Core.createLayerContainer)(this.parent.sceneContainer);
|
|
131
|
-
mask.setContainer(container, this.parent.sceneContainer);
|
|
132
|
-
_context.next = 5;
|
|
133
|
-
return mask.init();
|
|
134
|
-
|
|
135
|
-
case 5:
|
|
136
|
-
this.tileMask = mask;
|
|
137
|
-
mainLayer = this.getMainLayer();
|
|
138
|
-
|
|
139
|
-
if (mainLayer !== undefined) {
|
|
140
|
-
mainLayer.tileMask = mask;
|
|
97
|
+
while (1) switch (_context.prev = _context.next) {
|
|
98
|
+
case 0:
|
|
99
|
+
mask = new _polygon.default({
|
|
100
|
+
visible: false,
|
|
101
|
+
enablePicking: false
|
|
102
|
+
}).source({
|
|
103
|
+
type: 'FeatureCollection',
|
|
104
|
+
features: [this.sourceTile.bboxPolygon]
|
|
105
|
+
}, {
|
|
106
|
+
parser: {
|
|
107
|
+
type: 'geojson',
|
|
108
|
+
featureId: 'id'
|
|
141
109
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
110
|
+
}).shape('fill');
|
|
111
|
+
container = (0, _l7Core.createLayerContainer)(this.parent.sceneContainer);
|
|
112
|
+
mask.setContainer(container, this.parent.sceneContainer);
|
|
113
|
+
_context.next = 5;
|
|
114
|
+
return mask.init();
|
|
115
|
+
case 5:
|
|
116
|
+
this.tileMask = mask;
|
|
117
|
+
mainLayer = this.getMainLayer();
|
|
118
|
+
if (mainLayer !== undefined) {
|
|
119
|
+
mainLayer.tileMask = mask;
|
|
120
|
+
}
|
|
121
|
+
return _context.abrupt("return", mask);
|
|
122
|
+
case 9:
|
|
123
|
+
case "end":
|
|
124
|
+
return _context.stop();
|
|
149
125
|
}
|
|
150
126
|
}, _callee, this);
|
|
151
127
|
}));
|
|
152
|
-
|
|
153
128
|
function addTileMask() {
|
|
154
129
|
return _addTileMask.apply(this, arguments);
|
|
155
130
|
}
|
|
156
|
-
|
|
157
131
|
return addTileMask;
|
|
158
132
|
}()
|
|
159
133
|
}, {
|
|
@@ -162,30 +136,24 @@ var Tile = /*#__PURE__*/function () {
|
|
|
162
136
|
var _addMask = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(layer, mask) {
|
|
163
137
|
var container;
|
|
164
138
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
165
|
-
while (1) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
case 6:
|
|
178
|
-
case "end":
|
|
179
|
-
return _context2.stop();
|
|
180
|
-
}
|
|
139
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
140
|
+
case 0:
|
|
141
|
+
container = (0, _l7Core.createLayerContainer)(this.parent.sceneContainer);
|
|
142
|
+
mask.setContainer(container, this.parent.sceneContainer);
|
|
143
|
+
_context2.next = 4;
|
|
144
|
+
return mask.init();
|
|
145
|
+
case 4:
|
|
146
|
+
layer.addMask(mask);
|
|
147
|
+
this.tileMaskLayers.push(mask);
|
|
148
|
+
case 6:
|
|
149
|
+
case "end":
|
|
150
|
+
return _context2.stop();
|
|
181
151
|
}
|
|
182
152
|
}, _callee2, this);
|
|
183
153
|
}));
|
|
184
|
-
|
|
185
154
|
function addMask(_x, _x2) {
|
|
186
155
|
return _addMask.apply(this, arguments);
|
|
187
156
|
}
|
|
188
|
-
|
|
189
157
|
return addMask;
|
|
190
158
|
}()
|
|
191
159
|
}, {
|
|
@@ -194,29 +162,24 @@ var Tile = /*#__PURE__*/function () {
|
|
|
194
162
|
var _addLayer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(layer) {
|
|
195
163
|
var container;
|
|
196
164
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
197
|
-
while (1) {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
case "end":
|
|
210
|
-
return _context3.stop();
|
|
211
|
-
}
|
|
165
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
166
|
+
case 0:
|
|
167
|
+
// set flag
|
|
168
|
+
layer.isTileLayer = true;
|
|
169
|
+
container = (0, _l7Core.createLayerContainer)(this.parent.sceneContainer);
|
|
170
|
+
layer.setContainer(container, this.parent.sceneContainer);
|
|
171
|
+
this.layers.push(layer);
|
|
172
|
+
_context3.next = 6;
|
|
173
|
+
return layer.init();
|
|
174
|
+
case 6:
|
|
175
|
+
case "end":
|
|
176
|
+
return _context3.stop();
|
|
212
177
|
}
|
|
213
178
|
}, _callee3, this);
|
|
214
179
|
}));
|
|
215
|
-
|
|
216
180
|
function addLayer(_x3) {
|
|
217
181
|
return _addLayer.apply(this, arguments);
|
|
218
182
|
}
|
|
219
|
-
|
|
220
183
|
return addLayer;
|
|
221
184
|
}()
|
|
222
185
|
}, {
|
|
@@ -232,10 +195,10 @@ var Tile = /*#__PURE__*/function () {
|
|
|
232
195
|
l.updateLayerConfig((0, _defineProperty2.default)({}, key, value));
|
|
233
196
|
});
|
|
234
197
|
}
|
|
198
|
+
|
|
235
199
|
/**
|
|
236
200
|
* 一个 Tile 可能有多个 layer,但是在发生拾取、点击事件的时候只有一个生效
|
|
237
201
|
*/
|
|
238
|
-
|
|
239
202
|
}, {
|
|
240
203
|
key: "getMainLayer",
|
|
241
204
|
value: function getMainLayer() {
|
|
@@ -246,12 +209,12 @@ var Tile = /*#__PURE__*/function () {
|
|
|
246
209
|
value: function getFeatures(sourceLayer) {
|
|
247
210
|
return [];
|
|
248
211
|
}
|
|
212
|
+
|
|
249
213
|
/**
|
|
250
214
|
* 在一个 Tile 中可能存在一个相同 ID 的 feature
|
|
251
215
|
* @param id
|
|
252
216
|
* @returns
|
|
253
217
|
*/
|
|
254
|
-
|
|
255
218
|
}, {
|
|
256
219
|
key: "getFeatureById",
|
|
257
220
|
value: function getFeatureById(id) {
|
|
@@ -261,7 +224,6 @@ var Tile = /*#__PURE__*/function () {
|
|
|
261
224
|
key: "destroy",
|
|
262
225
|
value: function destroy() {
|
|
263
226
|
var _this$tileMask;
|
|
264
|
-
|
|
265
227
|
(_this$tileMask = this.tileMask) === null || _this$tileMask === void 0 ? void 0 : _this$tileMask.destroy();
|
|
266
228
|
this.layers.forEach(function (layer) {
|
|
267
229
|
return layer.destroy();
|
|
@@ -270,5 +232,4 @@ var Tile = /*#__PURE__*/function () {
|
|
|
270
232
|
}]);
|
|
271
233
|
return Tile;
|
|
272
234
|
}();
|
|
273
|
-
|
|
274
235
|
exports.default = Tile;
|