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