@antv/l7-layers 2.10.1 → 2.10.2
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.d.ts +2 -3
- package/es/Geometry/index.js +27 -17
- package/es/Geometry/models/billboard.d.ts +2 -2
- package/es/Geometry/models/billboard.js +77 -37
- package/es/Geometry/models/plane.d.ts +2 -2
- package/es/Geometry/models/plane.js +80 -40
- package/es/Geometry/models/sprite.d.ts +2 -2
- package/es/Geometry/models/sprite.js +83 -45
- package/es/canvas/index.d.ts +3 -4
- package/es/canvas/index.js +35 -24
- package/es/canvas/models/canvas.d.ts +2 -2
- package/es/canvas/models/canvas.js +54 -15
- package/es/citybuliding/building.d.ts +2 -3
- package/es/citybuliding/building.js +26 -17
- package/es/citybuliding/models/build.d.ts +2 -2
- package/es/citybuliding/models/build.js +70 -25
- package/es/core/BaseLayer.d.ts +21 -18
- package/es/core/BaseLayer.js +391 -261
- package/es/core/BaseModel.d.ts +2 -2
- package/es/core/BaseModel.js +47 -6
- package/es/core/LayerPickService.d.ts +9 -0
- package/es/core/LayerPickService.js +85 -0
- package/es/core/triangulation.js +8 -1
- package/es/earth/index.d.ts +3 -3
- package/es/earth/index.js +28 -9
- package/es/earth/models/atmosphere.d.ts +2 -2
- package/es/earth/models/atmosphere.js +67 -22
- package/es/earth/models/base.d.ts +2 -2
- package/es/earth/models/base.js +89 -43
- package/es/earth/models/bloomsphere.d.ts +2 -2
- package/es/earth/models/bloomsphere.js +67 -22
- package/es/heatmap/index.d.ts +2 -3
- package/es/heatmap/index.js +33 -22
- package/es/heatmap/models/grid.d.ts +2 -2
- package/es/heatmap/models/grid.js +68 -27
- package/es/heatmap/models/grid3d.d.ts +2 -2
- package/es/heatmap/models/grid3d.js +69 -28
- package/es/heatmap/models/heatmap.d.ts +2 -2
- package/es/heatmap/models/heatmap.js +40 -14
- package/es/heatmap/models/hexagon.d.ts +2 -2
- package/es/heatmap/models/hexagon.js +69 -28
- package/es/image/index.d.ts +2 -3
- package/es/image/index.js +27 -17
- package/es/image/models/dataImage.d.ts +2 -2
- package/es/image/models/dataImage.js +93 -54
- package/es/image/models/image.d.ts +2 -2
- package/es/image/models/image.js +108 -67
- package/es/image/models/tileDataImage.d.ts +2 -2
- package/es/image/models/tileDataImage.js +84 -43
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/line/index.d.ts +5 -4
- package/es/line/index.js +51 -25
- package/es/line/models/arc.d.ts +2 -2
- package/es/line/models/arc.js +73 -38
- package/es/line/models/arc_3d.d.ts +2 -2
- package/es/line/models/arc_3d.js +69 -34
- package/es/line/models/earthArc_3d.d.ts +2 -2
- package/es/line/models/earthArc_3d.js +72 -37
- package/es/line/models/great_circle.d.ts +2 -2
- package/es/line/models/great_circle.js +70 -29
- package/es/line/models/half.d.ts +2 -2
- package/es/line/models/half.js +40 -17
- package/es/line/models/index.d.ts +1 -1
- package/es/line/models/index.js +0 -2
- package/es/line/models/line.d.ts +2 -2
- package/es/line/models/line.js +79 -47
- package/es/line/models/linearline.d.ts +2 -2
- package/es/line/models/linearline.js +70 -31
- package/es/line/models/simpleLine.d.ts +2 -2
- package/es/line/models/simpleLine.js +71 -34
- package/es/line/models/simpleTileLine.d.ts +2 -2
- package/es/line/models/simpleTileLine.js +70 -30
- package/es/line/models/tile.d.ts +2 -2
- package/es/line/models/tile.js +40 -17
- package/es/line/models/wall.d.ts +2 -2
- package/es/line/models/wall.js +67 -22
- package/es/mask/index.d.ts +2 -4
- package/es/mask/index.js +27 -97
- package/es/mask/models/fill.d.ts +2 -2
- package/es/mask/models/fill.js +40 -16
- package/es/mask/models/index.d.ts +1 -1
- package/es/mask/models/index.js +1 -3
- package/es/plugins/DataMappingPlugin.js +80 -66
- package/es/plugins/DataSourcePlugin.js +64 -25
- package/es/plugins/FeatureScalePlugin.js +84 -44
- package/es/plugins/LayerAnimateStylePlugin.js +6 -3
- package/es/plugins/LayerModelPlugin.d.ts +2 -2
- package/es/plugins/LayerModelPlugin.js +124 -37
- package/es/plugins/LayerStylePlugin.js +1 -6
- package/es/plugins/MultiPassRendererPlugin.js +1 -1
- package/es/plugins/PixelPickingPlugin.js +1 -1
- package/es/plugins/RegisterStyleAttributePlugin.js +4 -17
- package/es/plugins/ShaderUniformPlugin.js +7 -2
- package/es/plugins/UpdateStyleAttributePlugin.js +8 -5
- package/es/point/index.d.ts +4 -4
- package/es/point/index.js +55 -23
- package/es/point/models/earthExtrude.d.ts +2 -2
- package/es/point/models/earthExtrude.js +73 -30
- package/es/point/models/earthFill.d.ts +2 -2
- package/es/point/models/earthFill.js +66 -21
- package/es/point/models/extrude.d.ts +2 -2
- package/es/point/models/extrude.js +40 -17
- package/es/point/models/fill.d.ts +2 -2
- package/es/point/models/fill.js +43 -20
- package/es/point/models/fillmage.d.ts +2 -2
- package/es/point/models/fillmage.js +82 -43
- package/es/point/models/image.d.ts +2 -2
- package/es/point/models/image.js +72 -31
- package/es/point/models/index.d.ts +1 -1
- package/es/point/models/index.js +0 -2
- package/es/point/models/normal.d.ts +2 -2
- package/es/point/models/normal.js +71 -30
- package/es/point/models/radar.d.ts +2 -2
- package/es/point/models/radar.js +75 -35
- package/es/point/models/simplePoint.d.ts +2 -2
- package/es/point/models/simplePoint.js +70 -29
- package/es/point/models/text.d.ts +3 -2
- package/es/point/models/text.js +164 -107
- package/es/point/models/tile.d.ts +2 -2
- package/es/point/models/tile.js +77 -35
- package/es/point/models/tileText.d.ts +2 -2
- package/es/point/models/tileText.js +151 -116
- package/es/polygon/index.d.ts +2 -3
- package/es/polygon/index.js +27 -24
- package/es/polygon/models/extrude.d.ts +2 -2
- package/es/polygon/models/extrude.js +66 -29
- package/es/polygon/models/fill.d.ts +2 -2
- package/es/polygon/models/fill.js +76 -43
- package/es/polygon/models/index.d.ts +1 -1
- package/es/polygon/models/index.js +0 -2
- package/es/polygon/models/ocean.d.ts +2 -2
- package/es/polygon/models/ocean.js +69 -28
- package/es/polygon/models/tile.d.ts +2 -2
- package/es/polygon/models/tile.js +70 -30
- package/es/polygon/models/water.d.ts +2 -2
- package/es/polygon/models/water.js +69 -28
- package/es/raster/index.d.ts +3 -4
- package/es/raster/index.js +28 -22
- package/es/raster/models/index.d.ts +1 -1
- package/es/raster/models/index.js +1 -3
- package/es/raster/models/raster.d.ts +2 -2
- package/es/raster/models/raster.js +36 -13
- package/es/raster/models/rasterRgb.d.ts +2 -2
- package/es/raster/models/rasterRgb.js +36 -13
- package/es/raster/models/rasterTile.d.ts +2 -2
- package/es/raster/models/rasterTile.js +77 -36
- package/es/raster/raster.d.ts +1 -1
- package/es/raster/raster.js +42 -22
- package/es/tile/interaction/getRasterData.d.ts +2 -2
- package/es/tile/interaction/utils.js +3 -11
- package/es/tile/interface.d.ts +5 -4
- package/es/tile/manager/base.d.ts +17 -12
- package/es/tile/manager/base.js +212 -47
- package/es/tile/service/TileLayerService.d.ts +33 -0
- package/es/tile/service/TileLayerService.js +172 -0
- package/es/tile/service/TilePickService.d.ts +22 -0
- package/es/tile/service/TilePickService.js +124 -0
- package/es/tile/style/constants.d.ts +1 -13
- package/es/tile/style/constants.js +6 -15
- package/es/tile/style/utils.d.ts +1 -8
- package/es/tile/style/utils.js +0 -126
- package/es/tile/tileFactory/DebugTile.d.ts +16 -0
- package/es/tile/tileFactory/DebugTile.js +100 -0
- package/es/tile/tileFactory/ImageTile.d.ts +14 -0
- package/es/tile/tileFactory/ImageTile.js +89 -0
- package/es/tile/tileFactory/MaskTile.d.ts +17 -0
- package/es/tile/tileFactory/MaskTile.js +98 -0
- package/es/tile/tileFactory/RasterRGBTile.d.ts +16 -0
- package/es/tile/tileFactory/RasterRGBTile.js +91 -0
- package/es/tile/tileFactory/RasterTile.d.ts +27 -0
- package/es/tile/tileFactory/RasterTile.js +186 -0
- package/es/tile/tileFactory/Tile.d.ts +23 -0
- package/es/tile/tileFactory/Tile.js +136 -0
- package/es/tile/tileFactory/VectorTile.d.ts +20 -0
- package/es/tile/tileFactory/VectorTile.js +158 -0
- package/es/tile/tileFactory/index.d.ts +10 -4
- package/es/tile/tileFactory/index.js +30 -23
- package/es/tile/tileFactory/layers/{rasterDataLayer.d.ts → RasterDataLayer.d.ts} +3 -3
- package/es/tile/tileFactory/layers/{rasterDataLayer.js → RasterDataLayer.js} +33 -21
- package/es/tile/tileFactory/layers/{tileTest.d.ts → TileDebugLayer.d.ts} +2 -2
- package/es/tile/tileFactory/layers/{tileTest.js → TileDebugLayer.js} +23 -10
- package/es/tile/tileFactory/util.d.ts +6 -0
- package/es/tile/tileFactory/util.js +33 -0
- package/es/tile/tileLayer/BaseLayer.d.ts +46 -0
- package/es/tile/tileLayer/BaseLayer.js +358 -0
- package/es/tile/utils.d.ts +1 -11
- package/es/tile/utils.js +0 -127
- package/es/utils/dataMappingStyle.d.ts +4 -4
- package/es/utils/dataMappingStyle.js +19 -19
- package/es/utils/layerData.js +5 -11
- package/es/wind/index.d.ts +2 -3
- package/es/wind/index.js +27 -17
- package/es/wind/models/wind.d.ts +2 -2
- package/es/wind/models/wind.js +120 -104
- package/lib/Geometry/index.js +29 -17
- package/lib/Geometry/models/billboard.js +79 -37
- package/lib/Geometry/models/plane.js +82 -40
- package/lib/Geometry/models/sprite.js +85 -45
- package/lib/canvas/index.js +37 -24
- package/lib/canvas/models/canvas.js +56 -15
- package/lib/citybuliding/building.js +28 -17
- package/lib/citybuliding/models/build.js +72 -25
- package/lib/core/BaseLayer.js +391 -256
- package/lib/core/BaseModel.js +48 -6
- package/lib/core/LayerPickService.js +96 -0
- package/lib/core/triangulation.js +8 -1
- package/lib/earth/index.js +30 -9
- package/lib/earth/models/atmosphere.js +69 -22
- package/lib/earth/models/base.js +90 -42
- package/lib/earth/models/bloomsphere.js +69 -22
- package/lib/heatmap/index.js +35 -22
- package/lib/heatmap/models/grid.js +70 -27
- package/lib/heatmap/models/grid3d.js +71 -28
- package/lib/heatmap/models/heatmap.js +40 -14
- package/lib/heatmap/models/hexagon.js +71 -28
- package/lib/image/index.js +29 -17
- package/lib/image/models/dataImage.js +95 -54
- package/lib/image/models/image.js +110 -67
- package/lib/image/models/tileDataImage.js +86 -43
- package/lib/index.js +5 -5
- package/lib/line/index.js +53 -26
- package/lib/line/models/arc.js +75 -38
- package/lib/line/models/arc_3d.js +71 -34
- package/lib/line/models/earthArc_3d.js +74 -37
- package/lib/line/models/great_circle.js +72 -29
- package/lib/line/models/half.js +40 -17
- package/lib/line/models/index.js +0 -3
- package/lib/line/models/line.js +81 -47
- package/lib/line/models/linearline.js +72 -31
- package/lib/line/models/simpleLine.js +73 -34
- package/lib/line/models/simpleTileLine.js +72 -30
- package/lib/line/models/tile.js +40 -17
- package/lib/line/models/wall.js +69 -22
- package/lib/mask/index.js +28 -99
- package/lib/mask/models/fill.js +40 -16
- package/lib/mask/models/index.js +1 -4
- package/lib/plugins/DataMappingPlugin.js +81 -65
- package/lib/plugins/DataSourcePlugin.js +71 -30
- package/lib/plugins/FeatureScalePlugin.js +86 -44
- package/lib/plugins/LayerAnimateStylePlugin.js +6 -3
- package/lib/plugins/LayerModelPlugin.js +131 -41
- package/lib/plugins/LayerStylePlugin.js +1 -6
- package/lib/plugins/MultiPassRendererPlugin.js +1 -1
- package/lib/plugins/PixelPickingPlugin.js +1 -1
- package/lib/plugins/RegisterStyleAttributePlugin.js +4 -17
- package/lib/plugins/ShaderUniformPlugin.js +7 -2
- package/lib/plugins/UpdateStyleAttributePlugin.js +8 -5
- package/lib/point/index.js +56 -24
- package/lib/point/models/earthExtrude.js +75 -30
- package/lib/point/models/earthFill.js +68 -21
- package/lib/point/models/extrude.js +40 -17
- package/lib/point/models/fill.js +44 -21
- package/lib/point/models/fillmage.js +84 -43
- package/lib/point/models/image.js +74 -31
- package/lib/point/models/index.js +0 -3
- package/lib/point/models/normal.js +73 -30
- package/lib/point/models/radar.js +77 -35
- package/lib/point/models/simplePoint.js +72 -29
- package/lib/point/models/text.js +164 -106
- package/lib/point/models/tile.js +79 -35
- package/lib/point/models/tileText.js +151 -115
- package/lib/polygon/index.js +29 -25
- package/lib/polygon/models/extrude.js +68 -29
- package/lib/polygon/models/fill.js +78 -43
- package/lib/polygon/models/index.js +0 -3
- package/lib/polygon/models/ocean.js +71 -28
- package/lib/polygon/models/tile.js +72 -30
- package/lib/polygon/models/water.js +71 -28
- package/lib/raster/index.js +30 -22
- package/lib/raster/models/index.js +1 -4
- package/lib/raster/models/raster.js +36 -13
- package/lib/raster/models/rasterRgb.js +36 -13
- package/lib/raster/models/rasterTile.js +79 -36
- package/lib/raster/raster.js +44 -22
- package/lib/tile/interaction/utils.js +3 -11
- package/lib/tile/manager/base.js +213 -47
- package/lib/tile/service/TileLayerService.js +185 -0
- package/lib/tile/service/TilePickService.js +136 -0
- package/lib/tile/style/constants.js +8 -19
- package/lib/tile/style/utils.js +0 -140
- package/lib/tile/tileFactory/DebugTile.js +115 -0
- package/lib/tile/tileFactory/ImageTile.js +104 -0
- package/lib/tile/tileFactory/MaskTile.js +113 -0
- package/lib/tile/tileFactory/RasterRGBTile.js +106 -0
- package/lib/tile/tileFactory/RasterTile.js +205 -0
- package/lib/tile/tileFactory/Tile.js +146 -0
- package/lib/tile/tileFactory/VectorTile.js +173 -0
- package/lib/tile/tileFactory/index.js +42 -24
- package/lib/tile/tileFactory/layers/{rasterDataLayer.js → RasterDataLayer.js} +35 -21
- package/lib/tile/tileFactory/layers/{tileTest.js → TileDebugLayer.js} +24 -11
- package/lib/tile/tileFactory/util.js +48 -0
- package/lib/tile/tileLayer/BaseLayer.js +373 -0
- package/lib/tile/utils.js +0 -146
- package/lib/utils/dataMappingStyle.js +21 -21
- package/lib/utils/layerData.js +4 -10
- package/lib/wind/index.js +29 -17
- package/lib/wind/models/wind.js +122 -104
- package/package.json +7 -7
- package/es/tile/interaction/TilePickService.d.ts +0 -16
- package/es/tile/interaction/TilePickService.js +0 -129
- package/es/tile/manager/layerManager.d.ts +0 -19
- package/es/tile/manager/layerManager.js +0 -254
- package/es/tile/manager/mapLayerManager.d.ts +0 -7
- package/es/tile/manager/mapLayerManager.js +0 -119
- package/es/tile/models/tileModel.d.ts +0 -10
- package/es/tile/models/tileModel.js +0 -81
- package/es/tile/render/TileRenderService.d.ts +0 -10
- package/es/tile/render/TileRenderService.js +0 -68
- package/es/tile/style/TileStyleService.d.ts +0 -17
- package/es/tile/style/TileStyleService.js +0 -118
- package/es/tile/tileFactory/base.d.ts +0 -45
- package/es/tile/tileFactory/base.js +0 -403
- package/es/tile/tileFactory/layers/vectorLayer.d.ts +0 -30
- package/es/tile/tileFactory/layers/vectorLayer.js +0 -253
- package/es/tile/tileFactory/line.d.ts +0 -12
- package/es/tile/tileFactory/line.js +0 -59
- package/es/tile/tileFactory/mask.d.ts +0 -12
- package/es/tile/tileFactory/mask.js +0 -60
- package/es/tile/tileFactory/point.d.ts +0 -12
- package/es/tile/tileFactory/point.js +0 -60
- package/es/tile/tileFactory/polygon.d.ts +0 -12
- package/es/tile/tileFactory/polygon.js +0 -59
- package/es/tile/tileFactory/raster.d.ts +0 -12
- package/es/tile/tileFactory/raster.js +0 -55
- package/es/tile/tileFactory/rasterData.d.ts +0 -12
- package/es/tile/tileFactory/rasterData.js +0 -81
- package/es/tile/tileFactory/test.d.ts +0 -12
- package/es/tile/tileFactory/test.js +0 -94
- package/es/tile/tileLayer/MapTileLayer.d.ts +0 -6
- package/es/tile/tileLayer/MapTileLayer.js +0 -48
- package/es/tile/tileLayer/TileLayer.d.ts +0 -22
- package/es/tile/tileLayer/TileLayer.js +0 -198
- package/es/tile/tileLayer/base.d.ts +0 -33
- package/es/tile/tileLayer/base.js +0 -212
- package/lib/tile/interaction/TilePickService.js +0 -143
- package/lib/tile/manager/layerManager.js +0 -275
- package/lib/tile/manager/mapLayerManager.js +0 -134
- package/lib/tile/models/tileModel.js +0 -94
- package/lib/tile/render/TileRenderService.js +0 -78
- package/lib/tile/style/TileStyleService.js +0 -133
- package/lib/tile/tileFactory/base.js +0 -427
- package/lib/tile/tileFactory/layers/vectorLayer.js +0 -268
- package/lib/tile/tileFactory/line.js +0 -70
- package/lib/tile/tileFactory/mask.js +0 -71
- package/lib/tile/tileFactory/point.js +0 -71
- package/lib/tile/tileFactory/polygon.js +0 -70
- package/lib/tile/tileFactory/raster.js +0 -68
- package/lib/tile/tileFactory/rasterData.js +0 -93
- package/lib/tile/tileFactory/test.js +0 -106
- package/lib/tile/tileLayer/MapTileLayer.js +0 -63
- package/lib/tile/tileLayer/TileLayer.js +0 -215
- package/lib/tile/tileLayer/base.js +0 -225
package/es/tile/manager/base.js
CHANGED
|
@@ -1,55 +1,143 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
5
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
6
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
+
import { createLayerContainer } from '@antv/l7-core';
|
|
8
|
+
import { updateLayersConfig } from "../style/utils";
|
|
7
9
|
export var Base = /*#__PURE__*/function () {
|
|
8
10
|
function Base() {
|
|
9
11
|
_classCallCheck(this, Base);
|
|
10
12
|
|
|
11
13
|
_defineProperty(this, "tileCache", new Map());
|
|
14
|
+
|
|
15
|
+
_defineProperty(this, "tileLayerCache", new Map());
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
_createClass(Base, [{
|
|
19
|
+
key: "initTileLayers",
|
|
20
|
+
value: function () {
|
|
21
|
+
var _initTileLayers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(layers, tile) {
|
|
22
|
+
var _this = this;
|
|
23
|
+
|
|
24
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
25
|
+
while (1) {
|
|
26
|
+
switch (_context2.prev = _context2.next) {
|
|
27
|
+
case 0:
|
|
28
|
+
return _context2.abrupt("return", Promise.all(layers.map( /*#__PURE__*/function () {
|
|
29
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(layer) {
|
|
30
|
+
var container;
|
|
31
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
32
|
+
while (1) {
|
|
33
|
+
switch (_context.prev = _context.next) {
|
|
34
|
+
case 0:
|
|
35
|
+
container = createLayerContainer(_this.parent.sceneContainer);
|
|
36
|
+
layer.setContainer(container, _this.parent.sceneContainer);
|
|
37
|
+
_context.next = 4;
|
|
38
|
+
return layer.init();
|
|
39
|
+
|
|
40
|
+
case 4:
|
|
41
|
+
_this.addChild(layer);
|
|
42
|
+
|
|
43
|
+
tile.layerLoad();
|
|
44
|
+
|
|
45
|
+
_this.render();
|
|
46
|
+
|
|
47
|
+
case 7:
|
|
48
|
+
case "end":
|
|
49
|
+
return _context.stop();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}, _callee);
|
|
53
|
+
}));
|
|
54
|
+
|
|
55
|
+
return function (_x3) {
|
|
56
|
+
return _ref.apply(this, arguments);
|
|
57
|
+
};
|
|
58
|
+
}())));
|
|
59
|
+
|
|
60
|
+
case 1:
|
|
61
|
+
case "end":
|
|
62
|
+
return _context2.stop();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, _callee2);
|
|
66
|
+
}));
|
|
67
|
+
|
|
68
|
+
function initTileLayers(_x, _x2) {
|
|
69
|
+
return _initTileLayers.apply(this, arguments);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return initTileLayers;
|
|
73
|
+
}()
|
|
74
|
+
}, {
|
|
75
|
+
key: "render",
|
|
76
|
+
value: function render() {
|
|
77
|
+
this.parent.renderLayers();
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
15
80
|
key: "hasTile",
|
|
16
81
|
value: function hasTile(tile) {
|
|
17
|
-
return
|
|
18
|
-
}
|
|
82
|
+
return this.tileCache.has(tile.key);
|
|
83
|
+
} // 添加图层
|
|
84
|
+
|
|
19
85
|
}, {
|
|
20
86
|
key: "addTile",
|
|
21
|
-
value: function
|
|
22
|
-
var
|
|
87
|
+
value: function () {
|
|
88
|
+
var _addTile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(tile) {
|
|
89
|
+
var layerCollections;
|
|
90
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
91
|
+
while (1) {
|
|
92
|
+
switch (_context3.prev = _context3.next) {
|
|
93
|
+
case 0:
|
|
94
|
+
if (!this.hasTile(tile)) {
|
|
95
|
+
_context3.next = 2;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
23
98
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
layers: [],
|
|
28
|
-
layerIDList: []
|
|
29
|
-
}; // 存储当前 tile
|
|
99
|
+
return _context3.abrupt("return", {
|
|
100
|
+
layers: []
|
|
101
|
+
});
|
|
30
102
|
|
|
31
|
-
|
|
103
|
+
case 2:
|
|
104
|
+
// 存储当前 tile
|
|
105
|
+
this.tileCache.set(tile.key, tile); // 创建 tile 对应的 layers
|
|
32
106
|
|
|
33
|
-
|
|
107
|
+
layerCollections = this.tileFactory.createTile(tile, this.initOptions); // // 初始化图层
|
|
34
108
|
|
|
35
|
-
|
|
109
|
+
_context3.next = 6;
|
|
110
|
+
return this.initTileLayers(layerCollections.layers, tile);
|
|
36
111
|
|
|
37
|
-
|
|
112
|
+
case 6:
|
|
113
|
+
this.tileLayerCache.set(tile.key, layerCollections.layers); // const visible = tile.parent ? tile.parent.children.every(t=>this.tileLayerCache.has(t.key)) : true
|
|
114
|
+
// tile.parent?.children.forEach((t)=>{
|
|
115
|
+
// updateLayersConfig(this.getLayers(t),'visible',visible)
|
|
116
|
+
// })
|
|
38
117
|
|
|
118
|
+
return _context3.abrupt("return", layerCollections);
|
|
39
119
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
120
|
+
case 8:
|
|
121
|
+
case "end":
|
|
122
|
+
return _context3.stop();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}, _callee3, this);
|
|
126
|
+
}));
|
|
127
|
+
|
|
128
|
+
function addTile(_x4) {
|
|
129
|
+
return _addTile.apply(this, arguments);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return addTile;
|
|
133
|
+
}()
|
|
48
134
|
}, {
|
|
49
135
|
key: "removeTile",
|
|
50
136
|
value: function removeTile(tile) {
|
|
51
137
|
this.tileCache.delete(tile.key);
|
|
52
|
-
this.
|
|
138
|
+
var layers = this.tileLayerCache.get(tile.key);
|
|
139
|
+
this.tileLayerCache.delete(tile.key);
|
|
140
|
+
this.removeLayers(layers, false);
|
|
53
141
|
}
|
|
54
142
|
}, {
|
|
55
143
|
key: "addChild",
|
|
@@ -64,18 +152,16 @@ export var Base = /*#__PURE__*/function () {
|
|
|
64
152
|
(_this$children = this.children).push.apply(_this$children, _toConsumableArray(layers));
|
|
65
153
|
}
|
|
66
154
|
}, {
|
|
67
|
-
key: "
|
|
68
|
-
value: function
|
|
155
|
+
key: "removeLayers",
|
|
156
|
+
value: function removeLayers() {
|
|
157
|
+
var layers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
69
158
|
var refresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
this.children.filter(function (child) {
|
|
73
|
-
layerIDList.includes(child.id) ? remveLayerList.push(child) : cacheLayerList.push(child);
|
|
159
|
+
this.children = this.children.filter(function (child) {
|
|
160
|
+
return !layers.includes(child);
|
|
74
161
|
});
|
|
75
|
-
|
|
162
|
+
layers.map(function (layer) {
|
|
76
163
|
return layer.destroy(refresh);
|
|
77
164
|
});
|
|
78
|
-
this.children = cacheLayerList;
|
|
79
165
|
}
|
|
80
166
|
}, {
|
|
81
167
|
key: "removeChild",
|
|
@@ -89,11 +175,10 @@ export var Base = /*#__PURE__*/function () {
|
|
|
89
175
|
layer.destroy();
|
|
90
176
|
}
|
|
91
177
|
}, {
|
|
92
|
-
key: "
|
|
93
|
-
value: function
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
});
|
|
178
|
+
key: "getLayers",
|
|
179
|
+
value: function getLayers(tile) {
|
|
180
|
+
if (!tile) return [];
|
|
181
|
+
return this.tileLayerCache.get(tile.key) || [];
|
|
97
182
|
}
|
|
98
183
|
}, {
|
|
99
184
|
key: "getChild",
|
|
@@ -117,14 +202,11 @@ export var Base = /*#__PURE__*/function () {
|
|
|
117
202
|
}
|
|
118
203
|
}, {
|
|
119
204
|
key: "initTileFactory",
|
|
120
|
-
value: function initTileFactory() {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
this.
|
|
124
|
-
|
|
125
|
-
mapService: this.mapService,
|
|
126
|
-
rendererService: this.rendererService
|
|
127
|
-
});
|
|
205
|
+
value: function initTileFactory() {// this.tileFactory = new TileFactory({
|
|
206
|
+
// parent: this.parent,
|
|
207
|
+
// mapService: this.mapService,
|
|
208
|
+
// rendererService: this.rendererService,
|
|
209
|
+
// });
|
|
128
210
|
}
|
|
129
211
|
}, {
|
|
130
212
|
key: "getSourceLayer",
|
|
@@ -137,9 +219,92 @@ export var Base = /*#__PURE__*/function () {
|
|
|
137
219
|
return sourceLayer;
|
|
138
220
|
}
|
|
139
221
|
}
|
|
222
|
+
}, {
|
|
223
|
+
key: "updateTileVisible",
|
|
224
|
+
value: function updateTileVisible(tile, layerService) {
|
|
225
|
+
var layers = this.getLayers(tile);
|
|
226
|
+
if (layers.length === 0) return;
|
|
227
|
+
|
|
228
|
+
if (tile.isVisible) {
|
|
229
|
+
// 如果可见直接进行渲染,父级发
|
|
230
|
+
updateLayersConfig(layers, 'visible', tile.isVisible);
|
|
231
|
+
} else {
|
|
232
|
+
// 如果不可见,放大,等到子瓦片渲染完成,缩小:父级渲染成功
|
|
233
|
+
// console.log('updateTileVisible',`${tile.x}_${tile.y}_${tile.z}`,tile.isVisible)
|
|
234
|
+
// console.log(tile);
|
|
235
|
+
// console.log(`子瓦片${tile.x}/${tile.y}/${tile.z}`,tile.children.length)
|
|
236
|
+
// tile.children.forEach((t)=>{
|
|
237
|
+
// console.log(`${t.x}/${t.y}/${t.z}`)
|
|
238
|
+
// })
|
|
239
|
+
updateLayersConfig(layers, 'visible', tile.isVisible);
|
|
240
|
+
} // this.listenLoad(tile, () => {
|
|
241
|
+
// this.isTileAllLoad(tile) && updateLayersConfig(layers, 'visible', tile.isVisible);
|
|
242
|
+
// })
|
|
243
|
+
|
|
244
|
+
}
|
|
245
|
+
}, {
|
|
246
|
+
key: "listenLoad",
|
|
247
|
+
value: function listenLoad(tile, callback) {
|
|
248
|
+
var _tile$parent;
|
|
249
|
+
|
|
250
|
+
tile.once('layerLoaded', function () {
|
|
251
|
+
callback();
|
|
252
|
+
});
|
|
253
|
+
tile.children.map(function (childTile) {
|
|
254
|
+
childTile.once('layerLoaded', function () {
|
|
255
|
+
callback();
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
(_tile$parent = tile.parent) === null || _tile$parent === void 0 ? void 0 : _tile$parent.once('layerLoaded', function () {
|
|
259
|
+
callback();
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}, {
|
|
263
|
+
key: "isTileLoaded",
|
|
264
|
+
value: function isTileLoaded(tile) {
|
|
265
|
+
if (tile.isLoad) return true;
|
|
266
|
+
var isLoad = this.getLayers(tile).length === tile.loadedLayers;
|
|
267
|
+
tile.isLoad = isLoad;
|
|
268
|
+
return isLoad;
|
|
269
|
+
}
|
|
270
|
+
}, {
|
|
271
|
+
key: "isTileChildLoaded",
|
|
272
|
+
value: function isTileChildLoaded(tile) {
|
|
273
|
+
var _this2 = this;
|
|
274
|
+
|
|
275
|
+
if (tile.isChildLoad) return true;
|
|
276
|
+
var children = tile.children;
|
|
277
|
+
var isLoad = children.filter(function (child) {
|
|
278
|
+
return _this2.isTileLoaded(child);
|
|
279
|
+
}).length === children.length;
|
|
280
|
+
tile.isChildLoad = isLoad;
|
|
281
|
+
return isLoad;
|
|
282
|
+
}
|
|
283
|
+
}, {
|
|
284
|
+
key: "isTileParentLoaded",
|
|
285
|
+
value: function isTileParentLoaded(tile) {
|
|
286
|
+
var parent = tile.parent;
|
|
287
|
+
|
|
288
|
+
if (!parent) {
|
|
289
|
+
return true;
|
|
290
|
+
} else {
|
|
291
|
+
return this.isTileLoaded(parent);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}, {
|
|
295
|
+
key: "isTileAllLoad",
|
|
296
|
+
value: function isTileAllLoad(tile) {
|
|
297
|
+
var tileLoaded = this.isTileLoaded(tile);
|
|
298
|
+
var tileChildLoaded = this.isTileChildLoaded(tile);
|
|
299
|
+
var tileParentLoaded = this.isTileParentLoaded(tile);
|
|
300
|
+
return tileLoaded && tileChildLoaded && tileParentLoaded;
|
|
301
|
+
}
|
|
140
302
|
}, {
|
|
141
303
|
key: "destroy",
|
|
142
|
-
value: function destroy() {
|
|
304
|
+
value: function destroy() {
|
|
305
|
+
this.tileCache.clear();
|
|
306
|
+
this.tileLayerCache.clear();
|
|
307
|
+
}
|
|
143
308
|
}]);
|
|
144
309
|
|
|
145
310
|
return Base;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ILayer, ILayerService, ILngLat, IRendererService, ITile } from '@antv/l7-core';
|
|
2
|
+
import { SourceTile } from '@antv/l7-utils';
|
|
3
|
+
import 'reflect-metadata';
|
|
4
|
+
interface TileLayerServiceOptions {
|
|
5
|
+
rendererService: IRendererService;
|
|
6
|
+
layerService: ILayerService;
|
|
7
|
+
parent: ILayer;
|
|
8
|
+
}
|
|
9
|
+
export declare class TileLayerService {
|
|
10
|
+
/**
|
|
11
|
+
* tileResource 用于存储瓦片的全局资源
|
|
12
|
+
*/
|
|
13
|
+
tileResource: Map<any, any>;
|
|
14
|
+
private rendererService;
|
|
15
|
+
private layerService;
|
|
16
|
+
private parent;
|
|
17
|
+
private _tiles;
|
|
18
|
+
constructor({ rendererService, layerService, parent }: TileLayerServiceOptions);
|
|
19
|
+
get tiles(): ITile[];
|
|
20
|
+
hasTile(tileKey: string): boolean;
|
|
21
|
+
addTile(tile: ITile): void;
|
|
22
|
+
getTile(tileKey: string): ITile | undefined;
|
|
23
|
+
getVisibleTileBylngLat(lngLat: ILngLat): ITile | undefined;
|
|
24
|
+
removeTile(tileKey: string): void;
|
|
25
|
+
updateTileVisible(sourceTile: SourceTile): void;
|
|
26
|
+
beforeRender(): void;
|
|
27
|
+
render(): Promise<void>;
|
|
28
|
+
getRenderLayers(): ILayer[];
|
|
29
|
+
getLayers(): ILayer[];
|
|
30
|
+
getTiles(): ITile[];
|
|
31
|
+
destroy(): void;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
+
import 'reflect-metadata';
|
|
8
|
+
export var TileLayerService = /*#__PURE__*/function () {
|
|
9
|
+
/**
|
|
10
|
+
* tileResource 用于存储瓦片的全局资源
|
|
11
|
+
*/
|
|
12
|
+
function TileLayerService(_ref) {
|
|
13
|
+
var rendererService = _ref.rendererService,
|
|
14
|
+
layerService = _ref.layerService,
|
|
15
|
+
parent = _ref.parent;
|
|
16
|
+
|
|
17
|
+
_classCallCheck(this, TileLayerService);
|
|
18
|
+
|
|
19
|
+
_defineProperty(this, "tileResource", new Map());
|
|
20
|
+
|
|
21
|
+
_defineProperty(this, "_tiles", []);
|
|
22
|
+
|
|
23
|
+
this.rendererService = rendererService;
|
|
24
|
+
this.layerService = layerService;
|
|
25
|
+
this.parent = parent;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
_createClass(TileLayerService, [{
|
|
29
|
+
key: "tiles",
|
|
30
|
+
get: function get() {
|
|
31
|
+
return this._tiles;
|
|
32
|
+
}
|
|
33
|
+
}, {
|
|
34
|
+
key: "hasTile",
|
|
35
|
+
value: function hasTile(tileKey) {
|
|
36
|
+
return this._tiles.some(function (tile) {
|
|
37
|
+
return tile.key === tileKey;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
key: "addTile",
|
|
42
|
+
value: function addTile(tile) {
|
|
43
|
+
this._tiles.push(tile);
|
|
44
|
+
}
|
|
45
|
+
}, {
|
|
46
|
+
key: "getTile",
|
|
47
|
+
value: function getTile(tileKey) {
|
|
48
|
+
return this._tiles.find(function (tile) {
|
|
49
|
+
return tile.key === tileKey;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
key: "getVisibleTileBylngLat",
|
|
54
|
+
value: function getVisibleTileBylngLat(lngLat) {
|
|
55
|
+
// 加载完成 & 可见 & 鼠标选中
|
|
56
|
+
return this._tiles.find(function (tile) {
|
|
57
|
+
return tile.isLoaded && tile.visible && tile.lnglatInBounds(lngLat);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "removeTile",
|
|
62
|
+
value: function removeTile(tileKey) {
|
|
63
|
+
var index = this._tiles.findIndex(function (tile) {
|
|
64
|
+
return tile.key === tileKey;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
var tile = this._tiles.splice(index, 1);
|
|
68
|
+
|
|
69
|
+
tile[0] && tile[0].destroy();
|
|
70
|
+
}
|
|
71
|
+
}, {
|
|
72
|
+
key: "updateTileVisible",
|
|
73
|
+
value: function updateTileVisible(sourceTile) {
|
|
74
|
+
var tile = this.getTile(sourceTile.key);
|
|
75
|
+
tile === null || tile === void 0 ? void 0 : tile.updateVisible(sourceTile.isVisible);
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
key: "beforeRender",
|
|
79
|
+
value: function beforeRender() {// TODO 统一处理状态更新 attribute style
|
|
80
|
+
}
|
|
81
|
+
}, {
|
|
82
|
+
key: "render",
|
|
83
|
+
value: function () {
|
|
84
|
+
var _render = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
85
|
+
var _this = this;
|
|
86
|
+
|
|
87
|
+
var layers;
|
|
88
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
89
|
+
while (1) {
|
|
90
|
+
switch (_context2.prev = _context2.next) {
|
|
91
|
+
case 0:
|
|
92
|
+
layers = this.getRenderLayers();
|
|
93
|
+
layers.map( /*#__PURE__*/function () {
|
|
94
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(layer) {
|
|
95
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
96
|
+
while (1) {
|
|
97
|
+
switch (_context.prev = _context.next) {
|
|
98
|
+
case 0:
|
|
99
|
+
_context.next = 2;
|
|
100
|
+
return _this.layerService.renderLayer(layer);
|
|
101
|
+
|
|
102
|
+
case 2:
|
|
103
|
+
case "end":
|
|
104
|
+
return _context.stop();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}, _callee);
|
|
108
|
+
}));
|
|
109
|
+
|
|
110
|
+
return function (_x) {
|
|
111
|
+
return _ref2.apply(this, arguments);
|
|
112
|
+
};
|
|
113
|
+
}());
|
|
114
|
+
|
|
115
|
+
case 2:
|
|
116
|
+
case "end":
|
|
117
|
+
return _context2.stop();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}, _callee2, this);
|
|
121
|
+
}));
|
|
122
|
+
|
|
123
|
+
function render() {
|
|
124
|
+
return _render.apply(this, arguments);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return render;
|
|
128
|
+
}()
|
|
129
|
+
}, {
|
|
130
|
+
key: "getRenderLayers",
|
|
131
|
+
value: function getRenderLayers() {
|
|
132
|
+
var tileList = this._tiles.filter(function (t) {
|
|
133
|
+
return t.visible && t.isLoaded;
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
var layers = [];
|
|
137
|
+
tileList.map(function (tile) {
|
|
138
|
+
return layers.push.apply(layers, _toConsumableArray(tile.getLayers()));
|
|
139
|
+
});
|
|
140
|
+
return layers;
|
|
141
|
+
}
|
|
142
|
+
}, {
|
|
143
|
+
key: "getLayers",
|
|
144
|
+
value: function getLayers() {
|
|
145
|
+
var tileList = this._tiles.filter(function (t) {
|
|
146
|
+
return t.isLoaded;
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
var layers = [];
|
|
150
|
+
tileList.map(function (tile) {
|
|
151
|
+
return layers.push.apply(layers, _toConsumableArray(tile.getLayers()));
|
|
152
|
+
});
|
|
153
|
+
return layers;
|
|
154
|
+
}
|
|
155
|
+
}, {
|
|
156
|
+
key: "getTiles",
|
|
157
|
+
value: function getTiles() {
|
|
158
|
+
return this._tiles;
|
|
159
|
+
}
|
|
160
|
+
}, {
|
|
161
|
+
key: "destroy",
|
|
162
|
+
value: function destroy() {
|
|
163
|
+
this._tiles.forEach(function (t) {
|
|
164
|
+
return t.destroy();
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
this.tileResource.clear();
|
|
168
|
+
}
|
|
169
|
+
}]);
|
|
170
|
+
|
|
171
|
+
return TileLayerService;
|
|
172
|
+
}();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ILayerService, ITilePickService } from '@antv/l7-core';
|
|
2
|
+
import { TileLayerService } from './TileLayerService';
|
|
3
|
+
import { IInteractionTarget } from '@antv/l7-core';
|
|
4
|
+
export interface ITilePickServiceOptions {
|
|
5
|
+
layerService: ILayerService;
|
|
6
|
+
tileLayerService: TileLayerService;
|
|
7
|
+
}
|
|
8
|
+
export declare class TilePickService implements ITilePickService {
|
|
9
|
+
private layerService;
|
|
10
|
+
private tileLayerService;
|
|
11
|
+
private tilePickID;
|
|
12
|
+
constructor({ layerService, tileLayerService }: ITilePickServiceOptions);
|
|
13
|
+
pickRender(target: IInteractionTarget): void;
|
|
14
|
+
selectFeature(pickedColors: Uint8Array | undefined): void;
|
|
15
|
+
highlightPickedFeature(pickedColors: Uint8Array | undefined): void;
|
|
16
|
+
updateHighLight(r: number, g: number, b: number, type: string): void;
|
|
17
|
+
setPickState(): void;
|
|
18
|
+
private clor2PickId;
|
|
19
|
+
private pickId2Color;
|
|
20
|
+
/** 从瓦片中根据数据 */
|
|
21
|
+
getFeatureById(): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
+
var SELECT = 'select';
|
|
6
|
+
var ACTIVE = 'active';
|
|
7
|
+
export var TilePickService = /*#__PURE__*/function () {
|
|
8
|
+
function TilePickService(_ref) {
|
|
9
|
+
var layerService = _ref.layerService,
|
|
10
|
+
tileLayerService = _ref.tileLayerService;
|
|
11
|
+
|
|
12
|
+
_classCallCheck(this, TilePickService);
|
|
13
|
+
|
|
14
|
+
_defineProperty(this, "tilePickID", new Map());
|
|
15
|
+
|
|
16
|
+
this.layerService = layerService;
|
|
17
|
+
this.tileLayerService = tileLayerService;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
_createClass(TilePickService, [{
|
|
21
|
+
key: "pickRender",
|
|
22
|
+
value: function pickRender(target) {
|
|
23
|
+
// 一个 TileLayer 有多个 Tile,但是会同时触发事件的只有一个 Tile
|
|
24
|
+
var tile = this.tileLayerService.getVisibleTileBylngLat(target.lngLat);
|
|
25
|
+
|
|
26
|
+
if (tile) {
|
|
27
|
+
// TODO 多图层拾取
|
|
28
|
+
var pickLayer = tile.getLayers()[0];
|
|
29
|
+
pickLayer.layerPickService.pickRender(target);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}, {
|
|
33
|
+
key: "selectFeature",
|
|
34
|
+
value: function selectFeature(pickedColors) {
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
var _pickedColors = _slicedToArray(pickedColors, 3),
|
|
37
|
+
r = _pickedColors[0],
|
|
38
|
+
g = _pickedColors[1],
|
|
39
|
+
b = _pickedColors[2];
|
|
40
|
+
|
|
41
|
+
var id = this.clor2PickId(r, g, b);
|
|
42
|
+
this.tilePickID.set(SELECT, id);
|
|
43
|
+
this.updateHighLight(r, g, b, SELECT);
|
|
44
|
+
}
|
|
45
|
+
}, {
|
|
46
|
+
key: "highlightPickedFeature",
|
|
47
|
+
value: function highlightPickedFeature(pickedColors) {
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
var _pickedColors2 = _slicedToArray(pickedColors, 3),
|
|
50
|
+
r = _pickedColors2[0],
|
|
51
|
+
g = _pickedColors2[1],
|
|
52
|
+
b = _pickedColors2[2];
|
|
53
|
+
|
|
54
|
+
var id = this.clor2PickId(r, g, b);
|
|
55
|
+
this.tilePickID.set(ACTIVE, id);
|
|
56
|
+
this.updateHighLight(r, g, b, ACTIVE);
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
key: "updateHighLight",
|
|
60
|
+
value: function updateHighLight(r, g, b, type) {
|
|
61
|
+
this.tileLayerService.tiles.map(function (tile) {
|
|
62
|
+
var layers = tile.getLayers();
|
|
63
|
+
layers.forEach(function (layer) {
|
|
64
|
+
switch (type) {
|
|
65
|
+
case SELECT:
|
|
66
|
+
layer.hooks.beforeSelect.call([r, g, b]);
|
|
67
|
+
break;
|
|
68
|
+
|
|
69
|
+
case ACTIVE:
|
|
70
|
+
layer.hooks.beforeHighlight.call([r, g, b]);
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}, {
|
|
77
|
+
key: "setPickState",
|
|
78
|
+
value: function setPickState() {
|
|
79
|
+
var selectColor = this.tilePickID.get(SELECT);
|
|
80
|
+
var activeColor = this.tilePickID.get(ACTIVE);
|
|
81
|
+
|
|
82
|
+
if (selectColor) {
|
|
83
|
+
var _this$pickId2Color = this.pickId2Color(selectColor),
|
|
84
|
+
_this$pickId2Color2 = _slicedToArray(_this$pickId2Color, 3),
|
|
85
|
+
r = _this$pickId2Color2[0],
|
|
86
|
+
g = _this$pickId2Color2[1],
|
|
87
|
+
b = _this$pickId2Color2[2];
|
|
88
|
+
|
|
89
|
+
this.updateHighLight(r, g, b, SELECT);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (activeColor) {
|
|
94
|
+
var _this$pickId2Color3 = this.pickId2Color(activeColor),
|
|
95
|
+
_this$pickId2Color4 = _slicedToArray(_this$pickId2Color3, 3),
|
|
96
|
+
_r = _this$pickId2Color4[0],
|
|
97
|
+
_g = _this$pickId2Color4[1],
|
|
98
|
+
_b = _this$pickId2Color4[2];
|
|
99
|
+
|
|
100
|
+
this.updateHighLight(_r, _g, _b, ACTIVE);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}, {
|
|
105
|
+
key: "clor2PickId",
|
|
106
|
+
value: function clor2PickId(r, g, b) {
|
|
107
|
+
return r + '-' + g + '-' + b;
|
|
108
|
+
}
|
|
109
|
+
}, {
|
|
110
|
+
key: "pickId2Color",
|
|
111
|
+
value: function pickId2Color(str) {
|
|
112
|
+
return str.split('-').map(function (n) {
|
|
113
|
+
return +n;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/** 从瓦片中根据数据 */
|
|
117
|
+
|
|
118
|
+
}, {
|
|
119
|
+
key: "getFeatureById",
|
|
120
|
+
value: function getFeatureById() {}
|
|
121
|
+
}]);
|
|
122
|
+
|
|
123
|
+
return TilePickService;
|
|
124
|
+
}();
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 瓦片图层的样式
|
|
3
|
-
*/
|
|
4
|
-
export declare const Attributes: string[];
|
|
5
|
-
export declare type IStyles = 'PointLayer' | 'LineLayer' | 'PolygonLayer' | 'RasterLayer' | 'MaskLayer' | 'TileDebugLayer';
|
|
6
|
-
export declare const styles: {
|
|
7
|
-
PointLayer: string[];
|
|
8
|
-
LineLayer: string[];
|
|
9
|
-
PolygonLayer: string[];
|
|
10
|
-
RasterLayer: string[];
|
|
11
|
-
MaskLayer: never[];
|
|
12
|
-
TileDebugLayer: never[];
|
|
13
|
-
};
|
|
1
|
+
export declare const ProxyFuncs: string[];
|