@antv/l7-layers 2.17.4 → 2.17.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Geometry/index.js +9 -31
- package/es/Geometry/models/billboard.js +51 -89
- package/es/Geometry/models/plane.js +81 -143
- package/es/Geometry/models/sprite.js +60 -118
- package/es/canvas/index.js +10 -33
- package/es/canvas/models/canvas.js +41 -97
- package/es/citybuliding/building.js +8 -27
- package/es/citybuliding/models/build.js +57 -82
- package/es/core/BaseLayer.js +325 -483
- package/es/core/BaseModel.js +51 -80
- package/es/core/CommonStyleAttribute.js +2 -5
- package/es/core/LayerPickService.js +21 -32
- package/es/core/TextureService.js +0 -13
- package/es/core/interface.js +17 -24
- package/es/core/shape/Path.js +13 -20
- package/es/core/shape/extrude.js +27 -39
- package/es/core/triangulation.js +99 -136
- package/es/earth/index.js +9 -33
- package/es/earth/models/atmosphere.js +30 -54
- package/es/earth/models/base.js +47 -85
- package/es/earth/models/bloomsphere.js +30 -54
- package/es/earth/utils.js +9 -13
- package/es/heatmap/index.js +10 -40
- package/es/heatmap/models/grid.js +28 -52
- package/es/heatmap/models/grid3d.js +28 -52
- package/es/heatmap/models/heatmap.js +92 -149
- package/es/heatmap/models/hexagon.js +28 -52
- package/es/heatmap/triangulation.js +0 -4
- package/es/image/index.js +9 -28
- package/es/image/models/image.js +66 -100
- package/es/index.js +9 -17
- package/es/line/index.js +9 -35
- package/es/line/models/arc.js +63 -112
- package/es/line/models/arc_3d.js +58 -102
- package/es/line/models/earthArc_3d.js +60 -105
- package/es/line/models/flow.js +36 -60
- package/es/line/models/great_circle.js +53 -94
- package/es/line/models/line.js +92 -144
- package/es/line/models/linearline.js +42 -74
- package/es/line/models/simpleLine.js +38 -67
- package/es/line/models/wall.js +52 -92
- package/es/line/shaders/dash/line_dash_vert.glsl +1 -2
- package/es/line/shaders/line_frag.glsl +1 -3
- package/es/line/shaders/line_vert.glsl +2 -0
- package/es/line/shaders/linear/line_linear_frag.glsl +1 -1
- package/es/mask/index.js +9 -28
- package/es/mask/models/fill.js +29 -54
- package/es/plugins/DataMappingPlugin.js +78 -114
- package/es/plugins/DataSourcePlugin.js +45 -68
- package/es/plugins/FeatureScalePlugin.js +67 -122
- package/es/plugins/LayerAnimateStylePlugin.js +0 -5
- package/es/plugins/LayerMaskPlugin.js +3 -11
- package/es/plugins/LayerModelPlugin.js +69 -118
- package/es/plugins/LayerStylePlugin.js +4 -9
- package/es/plugins/LightingPlugin.js +12 -18
- package/es/plugins/MultiPassRendererPlugin.js +11 -16
- package/es/plugins/PixelPickingPlugin.js +12 -21
- package/es/plugins/RegisterStyleAttributePlugin.js +5 -12
- package/es/plugins/ShaderUniformPlugin.js +13 -27
- package/es/plugins/UpdateModelPlugin.js +0 -5
- package/es/plugins/UpdateStyleAttributePlugin.js +5 -11
- package/es/point/index.js +26 -78
- package/es/point/models/earthExtrude.js +58 -95
- package/es/point/models/earthFill.js +52 -80
- package/es/point/models/extrude.js +57 -94
- package/es/point/models/fill.js +56 -81
- package/es/point/models/fillmage.js +60 -100
- package/es/point/models/image.js +47 -83
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +30 -54
- package/es/point/models/radar.js +38 -63
- package/es/point/models/simplePoint.js +38 -62
- package/es/point/models/text.js +199 -296
- package/es/point/shape/extrude.js +4 -13
- package/es/polygon/index.js +11 -41
- package/es/polygon/models/extrude.js +87 -135
- package/es/polygon/models/fill.js +50 -79
- package/es/polygon/models/index.js +3 -2
- package/es/polygon/models/ocean.js +42 -76
- package/es/polygon/models/water.js +37 -71
- package/es/raster/buffers/triangulation.js +2 -4
- package/es/raster/index.js +9 -32
- package/es/raster/models/raster.js +80 -116
- package/es/raster/models/rasterRgb.js +84 -127
- package/es/raster/models/rasterTerrainRgb.js +56 -84
- package/es/tile/interaction/getRasterData.js +14 -20
- package/es/tile/interaction/utils.js +7 -9
- package/es/tile/manager/base.js +63 -96
- package/es/tile/service/TileLayerService.js +33 -55
- package/es/tile/service/TilePickService.js +26 -40
- package/es/tile/service/TileSourceService.js +3 -7
- package/es/tile/tileFactory/DebugTile.js +29 -46
- package/es/tile/tileFactory/ImageTile.js +20 -38
- package/es/tile/tileFactory/MaskTile.js +22 -43
- package/es/tile/tileFactory/RasterRGBTile.js +22 -42
- package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
- package/es/tile/tileFactory/RasterTile.js +30 -53
- package/es/tile/tileFactory/Tile.js +63 -97
- package/es/tile/tileFactory/VectorTile.js +41 -68
- package/es/tile/tileFactory/index.js +0 -11
- package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
- package/es/tile/tileFactory/util.js +0 -3
- package/es/tile/tileLayer/BaseLayer.js +105 -146
- package/es/tile/utils.js +1 -1
- package/es/utils/blend.js +0 -2
- package/es/utils/collision-index.js +9 -16
- package/es/utils/extrude_polyline.js +101 -149
- package/es/utils/grid-index.js +2 -27
- package/es/utils/identityScale.js +0 -8
- package/es/utils/layerData.js +30 -44
- package/es/utils/multiPassRender.js +11 -13
- package/es/utils/polylineNormal.js +31 -37
- package/es/utils/simpleLine.js +2 -16
- package/es/utils/stencil.js +2 -3
- package/es/utils/symbol-layout.js +27 -53
- package/es/wind/index.js +9 -29
- package/es/wind/models/utils.js +26 -51
- package/es/wind/models/wind.js +101 -147
- package/es/wind/models/windRender.js +53 -66
- package/lib/Geometry/index.js +9 -38
- package/lib/Geometry/models/billboard.js +51 -97
- package/lib/Geometry/models/index.js +0 -5
- package/lib/Geometry/models/plane.js +79 -151
- package/lib/Geometry/models/sprite.js +60 -127
- package/lib/canvas/index.js +10 -40
- package/lib/canvas/models/canvas.js +41 -101
- package/lib/canvas/models/index.js +0 -3
- package/lib/citybuliding/building.js +8 -35
- package/lib/citybuliding/models/build.js +57 -92
- package/lib/core/BaseLayer.js +325 -474
- package/lib/core/BaseModel.js +51 -90
- package/lib/core/CommonStyleAttribute.js +2 -7
- package/lib/core/LayerPickService.js +21 -37
- package/lib/core/TextureService.js +0 -16
- package/lib/core/interface.js +21 -31
- package/lib/core/schema.js +0 -1
- package/lib/core/shape/Path.js +14 -31
- package/lib/core/shape/extrude.js +27 -62
- package/lib/core/triangulation.js +98 -177
- package/lib/earth/index.js +9 -43
- package/lib/earth/models/atmosphere.js +30 -63
- package/lib/earth/models/base.js +47 -90
- package/lib/earth/models/bloomsphere.js +30 -63
- package/lib/earth/utils.js +7 -31
- package/lib/heatmap/index.js +10 -48
- package/lib/heatmap/models/grid.js +28 -60
- package/lib/heatmap/models/grid3d.js +28 -60
- package/lib/heatmap/models/heatmap.js +92 -166
- package/lib/heatmap/models/hexagon.js +28 -60
- package/lib/heatmap/models/index.js +0 -6
- package/lib/heatmap/triangulation.js +0 -5
- package/lib/image/index.js +9 -36
- package/lib/image/models/image.js +66 -109
- package/lib/image/models/index.js +0 -3
- package/lib/index.js +7 -61
- package/lib/line/index.js +9 -40
- package/lib/line/models/arc.js +61 -122
- package/lib/line/models/arc_3d.js +56 -113
- package/lib/line/models/earthArc_3d.js +58 -115
- package/lib/line/models/flow.js +36 -70
- package/lib/line/models/great_circle.js +53 -104
- package/lib/line/models/index.js +0 -11
- package/lib/line/models/line.js +90 -152
- package/lib/line/models/linearline.js +42 -86
- package/lib/line/models/simpleLine.js +38 -77
- package/lib/line/models/wall.js +52 -103
- package/lib/line/shaders/dash/line_dash_vert.glsl +1 -2
- package/lib/line/shaders/line_frag.glsl +1 -3
- package/lib/line/shaders/line_vert.glsl +2 -0
- package/lib/line/shaders/linear/line_linear_frag.glsl +1 -1
- package/lib/mask/index.js +9 -36
- package/lib/mask/models/fill.js +29 -63
- package/lib/mask/models/index.js +0 -3
- package/lib/plugins/DataMappingPlugin.js +78 -125
- package/lib/plugins/DataSourcePlugin.js +45 -76
- package/lib/plugins/FeatureScalePlugin.js +67 -138
- package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
- package/lib/plugins/LayerMaskPlugin.js +4 -17
- package/lib/plugins/LayerModelPlugin.js +70 -127
- package/lib/plugins/LayerStylePlugin.js +5 -14
- package/lib/plugins/LightingPlugin.js +12 -25
- package/lib/plugins/MultiPassRendererPlugin.js +11 -22
- package/lib/plugins/PixelPickingPlugin.js +12 -27
- package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
- package/lib/plugins/ShaderUniformPlugin.js +13 -34
- package/lib/plugins/UpdateModelPlugin.js +1 -10
- package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
- package/lib/point/index.js +26 -83
- package/lib/point/models/earthExtrude.js +58 -106
- package/lib/point/models/earthFill.js +52 -110
- package/lib/point/models/extrude.js +57 -103
- package/lib/point/models/fill.js +54 -90
- package/lib/point/models/fillmage.js +58 -107
- package/lib/point/models/image.js +47 -92
- package/lib/point/models/index.js +1 -12
- package/lib/point/models/normal.js +30 -64
- package/lib/point/models/radar.js +38 -72
- package/lib/point/models/simplePoint.js +38 -72
- package/lib/point/models/text.js +199 -305
- package/lib/point/shape/extrude.js +4 -20
- package/lib/polygon/index.js +11 -48
- package/lib/polygon/models/extrude.js +87 -146
- package/lib/polygon/models/fill.js +50 -89
- package/lib/polygon/models/index.js +2 -14
- package/lib/polygon/models/ocean.js +42 -88
- package/lib/polygon/models/water.js +37 -82
- package/lib/raster/buffers/triangulation.js +3 -7
- package/lib/raster/index.js +9 -40
- package/lib/raster/models/index.js +0 -5
- package/lib/raster/models/raster.js +80 -125
- package/lib/raster/models/rasterRgb.js +84 -139
- package/lib/raster/models/rasterTerrainRgb.js +56 -93
- package/lib/tile/interaction/getRasterData.js +14 -25
- package/lib/tile/interaction/utils.js +7 -19
- package/lib/tile/manager/base.js +63 -104
- package/lib/tile/service/TileLayerService.js +33 -60
- package/lib/tile/service/TilePickService.js +26 -48
- package/lib/tile/service/TileSourceService.js +2 -16
- package/lib/tile/style/utils.js +0 -3
- package/lib/tile/tileFactory/DebugTile.js +29 -54
- package/lib/tile/tileFactory/ImageTile.js +20 -46
- package/lib/tile/tileFactory/MaskTile.js +22 -51
- package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
- package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
- package/lib/tile/tileFactory/RasterTile.js +30 -63
- package/lib/tile/tileFactory/Tile.js +63 -102
- package/lib/tile/tileFactory/VectorTile.js +41 -76
- package/lib/tile/tileFactory/index.js +0 -25
- package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
- package/lib/tile/tileFactory/util.js +0 -9
- package/lib/tile/tileLayer/BaseLayer.js +105 -153
- package/lib/tile/utils.js +1 -5
- package/lib/utils/blend.js +0 -5
- package/lib/utils/collision-index.js +9 -25
- package/lib/utils/extrude_polyline.js +101 -181
- package/lib/utils/grid-index.js +2 -28
- package/lib/utils/identityScale.js +0 -9
- package/lib/utils/layerData.js +30 -49
- package/lib/utils/multiPassRender.js +11 -16
- package/lib/utils/polylineNormal.js +31 -66
- package/lib/utils/simpleLine.js +2 -21
- package/lib/utils/stencil.js +0 -4
- package/lib/utils/symbol-layout.js +27 -55
- package/lib/wind/index.js +9 -37
- package/lib/wind/models/index.js +0 -3
- package/lib/wind/models/utils.js +26 -62
- package/lib/wind/models/wind.js +101 -157
- package/lib/wind/models/windRender.js +53 -71
- package/lib/wind/models/windShader.js +0 -1
- package/package.json +7 -7
package/lib/core/BaseModel.js
CHANGED
|
@@ -1,46 +1,31 @@
|
|
|
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 _initializerDefineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/initializerDefineProperty"));
|
|
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 _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime/helpers/applyDecoratedDescriptor"));
|
|
25
|
-
|
|
26
16
|
var _initializerWarningHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/initializerWarningHelper"));
|
|
27
|
-
|
|
28
17
|
var _l7Core = require("@antv/l7-core");
|
|
29
|
-
|
|
30
18
|
var _l7Utils = require("@antv/l7-utils");
|
|
31
|
-
|
|
32
19
|
var _blend = require("../utils/blend");
|
|
33
|
-
|
|
34
20
|
var _stencil = require("../utils/stencil");
|
|
35
|
-
|
|
36
21
|
var _CommonStyleAttribute = require("./CommonStyleAttribute");
|
|
37
|
-
|
|
38
22
|
var _dec, _class, _descriptor;
|
|
39
|
-
|
|
40
23
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
41
24
|
var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function () {
|
|
42
25
|
// style texture data mapping
|
|
26
|
+
|
|
43
27
|
// style texture data mapping
|
|
28
|
+
|
|
44
29
|
function BaseModel(layer) {
|
|
45
30
|
(0, _classCallCheck2.default)(this, BaseModel);
|
|
46
31
|
(0, _defineProperty2.default)(this, "preStyleAttribute", {});
|
|
@@ -55,40 +40,39 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
55
40
|
this.iconService = layer.getContainer().get(_l7Core.TYPES.IIconService);
|
|
56
41
|
this.fontService = layer.getContainer().get(_l7Core.TYPES.IFontService);
|
|
57
42
|
this.cameraService = layer.getContainer().get(_l7Core.TYPES.ICameraService);
|
|
58
|
-
this.layerService = layer.getContainer().get(_l7Core.TYPES.ILayerService);
|
|
59
|
-
|
|
60
|
-
this.registerStyleAttribute(); // 注册 Attribute
|
|
61
|
-
|
|
62
|
-
this.registerBuiltinAttributes(); // 开启动画
|
|
43
|
+
this.layerService = layer.getContainer().get(_l7Core.TYPES.ILayerService);
|
|
44
|
+
// 初始化支持数据映射的 Style 属性
|
|
63
45
|
|
|
46
|
+
this.registerStyleAttribute();
|
|
47
|
+
// 注册 Attribute
|
|
48
|
+
this.registerBuiltinAttributes();
|
|
49
|
+
// 开启动画
|
|
64
50
|
this.startModelAnimate();
|
|
65
51
|
var createTexture2D = this.rendererService.createTexture2D;
|
|
66
52
|
this.createTexture2D = createTexture2D;
|
|
67
|
-
}
|
|
68
|
-
|
|
53
|
+
}
|
|
69
54
|
|
|
55
|
+
// style datatexture mapping
|
|
70
56
|
(0, _createClass2.default)(BaseModel, [{
|
|
71
57
|
key: "getBlend",
|
|
72
58
|
value: function getBlend() {
|
|
73
59
|
var _this$layer$getLayerC = this.layer.getLayerConfig(),
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
60
|
+
_this$layer$getLayerC2 = _this$layer$getLayerC.blend,
|
|
61
|
+
blend = _this$layer$getLayerC2 === void 0 ? 'normal' : _this$layer$getLayerC2;
|
|
77
62
|
return _blend.BlendTypes[_l7Core.BlendType[blend]];
|
|
78
63
|
}
|
|
79
64
|
}, {
|
|
80
65
|
key: "getStencil",
|
|
81
66
|
value: function getStencil(option) {
|
|
82
67
|
var _this$layer$getLayerC3 = this.layer.getLayerConfig(),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
68
|
+
_this$layer$getLayerC4 = _this$layer$getLayerC3.mask,
|
|
69
|
+
mask = _this$layer$getLayerC4 === void 0 ? false : _this$layer$getLayerC4,
|
|
70
|
+
_this$layer$getLayerC5 = _this$layer$getLayerC3.maskInside,
|
|
71
|
+
maskInside = _this$layer$getLayerC5 === void 0 ? true : _this$layer$getLayerC5,
|
|
72
|
+
enableMask = _this$layer$getLayerC3.enableMask,
|
|
73
|
+
_this$layer$getLayerC6 = _this$layer$getLayerC3.maskOperation,
|
|
74
|
+
maskOperation = _this$layer$getLayerC6 === void 0 ? _l7Core.MaskOperation.AND : _this$layer$getLayerC6;
|
|
75
|
+
// TODO 临时处理,后期移除MaskLayer
|
|
92
76
|
if (this.layer.type === 'MaskLayer') {
|
|
93
77
|
return (0, _stencil.getStencilMask)({
|
|
94
78
|
isStencil: true,
|
|
@@ -102,11 +86,12 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
102
86
|
})); // 用于遮罩的stencil 参数
|
|
103
87
|
}
|
|
104
88
|
|
|
105
|
-
var maskflag = mask ||
|
|
106
|
-
|
|
89
|
+
var maskflag = mask ||
|
|
90
|
+
// mask 兼容历史写法
|
|
91
|
+
enableMask && this.layer.masks.length !== 0 ||
|
|
92
|
+
// 外部图层的mask
|
|
107
93
|
this.layer.tileMask !== undefined; // 瓦片图层
|
|
108
94
|
// !!(mask || enableMask || this.layer.tileMask);
|
|
109
|
-
|
|
110
95
|
return (0, _stencil.getStencil)(maskflag, maskInside);
|
|
111
96
|
}
|
|
112
97
|
}, {
|
|
@@ -129,76 +114,58 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
129
114
|
value: function () {
|
|
130
115
|
var _needUpdate = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
131
116
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
132
|
-
while (1) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
case "end":
|
|
139
|
-
return _context.stop();
|
|
140
|
-
}
|
|
117
|
+
while (1) switch (_context.prev = _context.next) {
|
|
118
|
+
case 0:
|
|
119
|
+
return _context.abrupt("return", false);
|
|
120
|
+
case 1:
|
|
121
|
+
case "end":
|
|
122
|
+
return _context.stop();
|
|
141
123
|
}
|
|
142
124
|
}, _callee);
|
|
143
125
|
}));
|
|
144
|
-
|
|
145
126
|
function needUpdate() {
|
|
146
127
|
return _needUpdate.apply(this, arguments);
|
|
147
128
|
}
|
|
148
|
-
|
|
149
129
|
return needUpdate;
|
|
150
130
|
}() // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
151
|
-
|
|
152
131
|
}, {
|
|
153
132
|
key: "buildModels",
|
|
154
133
|
value: function () {
|
|
155
134
|
var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
156
135
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
157
|
-
while (1) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
case "end":
|
|
164
|
-
return _context2.stop();
|
|
165
|
-
}
|
|
136
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
137
|
+
case 0:
|
|
138
|
+
throw new Error('Method not implemented.');
|
|
139
|
+
case 1:
|
|
140
|
+
case "end":
|
|
141
|
+
return _context2.stop();
|
|
166
142
|
}
|
|
167
143
|
}, _callee2);
|
|
168
144
|
}));
|
|
169
|
-
|
|
170
145
|
function buildModels() {
|
|
171
146
|
return _buildModels.apply(this, arguments);
|
|
172
147
|
}
|
|
173
|
-
|
|
174
148
|
return buildModels;
|
|
175
149
|
}() // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
176
|
-
|
|
177
150
|
}, {
|
|
178
151
|
key: "initModels",
|
|
179
152
|
value: function () {
|
|
180
153
|
var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
181
154
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
182
|
-
while (1) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
case "end":
|
|
189
|
-
return _context3.stop();
|
|
190
|
-
}
|
|
155
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
156
|
+
case 0:
|
|
157
|
+
throw new Error('Method not implemented.');
|
|
158
|
+
case 1:
|
|
159
|
+
case "end":
|
|
160
|
+
return _context3.stop();
|
|
191
161
|
}
|
|
192
162
|
}, _callee3);
|
|
193
163
|
}));
|
|
194
|
-
|
|
195
164
|
function initModels() {
|
|
196
165
|
return _initModels.apply(this, arguments);
|
|
197
166
|
}
|
|
198
|
-
|
|
199
167
|
return initModels;
|
|
200
168
|
}() // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
201
|
-
|
|
202
169
|
}, {
|
|
203
170
|
key: "clearModels",
|
|
204
171
|
value: function clearModels() {
|
|
@@ -209,8 +176,8 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
209
176
|
key: "getAttribute",
|
|
210
177
|
value: function getAttribute() {
|
|
211
178
|
throw new Error('Method not implemented.');
|
|
212
|
-
}
|
|
213
|
-
|
|
179
|
+
}
|
|
180
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
214
181
|
}, {
|
|
215
182
|
key: "render",
|
|
216
183
|
value: function render(renderOptions) {
|
|
@@ -230,8 +197,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
230
197
|
key: "startModelAnimate",
|
|
231
198
|
value: function startModelAnimate() {
|
|
232
199
|
var _ref = this.layer.getLayerConfig(),
|
|
233
|
-
|
|
234
|
-
|
|
200
|
+
animateOption = _ref.animateOption;
|
|
235
201
|
if (animateOption.enable) {
|
|
236
202
|
this.layer.setAnimateStartTime();
|
|
237
203
|
}
|
|
@@ -251,7 +217,6 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
251
217
|
if (encodeStyleAttribute[key]) {
|
|
252
218
|
str += "#define USE_ATTRIBUTE_".concat(key.toUpperCase(), " 0.0; \n\n");
|
|
253
219
|
}
|
|
254
|
-
|
|
255
220
|
str += "\n #ifdef USE_ATTRIBUTE_".concat(key.toUpperCase(), "\n attribute ").concat(attrType[key], " a_").concat(key.charAt(0).toUpperCase() + key.slice(1), ";\n#else\n uniform ").concat(attrType[key], " u_").concat(key, ";\n#endif\n\n");
|
|
256
221
|
});
|
|
257
222
|
var innerStr = '';
|
|
@@ -262,14 +227,15 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
262
227
|
'vs:#decl': str,
|
|
263
228
|
'vs:#main-start': innerStr
|
|
264
229
|
};
|
|
265
|
-
}
|
|
230
|
+
}
|
|
266
231
|
|
|
232
|
+
// 获取数据映射样式
|
|
267
233
|
}, {
|
|
268
234
|
key: "getStyleAttribute",
|
|
269
235
|
value: function getStyleAttribute() {
|
|
270
236
|
var _this = this;
|
|
271
|
-
|
|
272
|
-
|
|
237
|
+
var options = {};
|
|
238
|
+
// TODO: 优化
|
|
273
239
|
|
|
274
240
|
var defualtValue = {
|
|
275
241
|
opacity: 1,
|
|
@@ -280,27 +246,22 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
280
246
|
if (!_this.layer.encodeStyleAttribute[key]) {
|
|
281
247
|
// @ts-ignore
|
|
282
248
|
var keyValue = _this.layer.getLayerConfig()[key];
|
|
283
|
-
|
|
284
249
|
var value = typeof keyValue === 'undefined' ? defualtValue[key] : keyValue;
|
|
285
|
-
|
|
286
250
|
if (key === 'stroke') {
|
|
287
251
|
value = (0, _l7Utils.rgb2arr)(value);
|
|
288
252
|
}
|
|
289
|
-
|
|
290
253
|
options['u_' + key] = value;
|
|
291
254
|
}
|
|
292
255
|
});
|
|
293
256
|
return options;
|
|
294
|
-
}
|
|
295
|
-
|
|
257
|
+
}
|
|
258
|
+
// 注册数据映射样式
|
|
296
259
|
}, {
|
|
297
260
|
key: "registerStyleAttribute",
|
|
298
261
|
value: function registerStyleAttribute() {
|
|
299
262
|
var _this2 = this;
|
|
300
|
-
|
|
301
263
|
Object.keys(this.layer.encodeStyleAttribute).forEach(function (key) {
|
|
302
264
|
var options = (0, _CommonStyleAttribute.getCommonStyleAttributeOptions)(key);
|
|
303
|
-
|
|
304
265
|
if (options) {
|
|
305
266
|
_this2.styleAttributeService.registerStyleAttribute(options);
|
|
306
267
|
}
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getCommonStyleAttributeOptions = getCommonStyleAttributeOptions;
|
|
7
|
-
|
|
8
7
|
var _l7Core = require("@antv/l7-core");
|
|
9
|
-
|
|
10
8
|
function getCommonStyleAttributeOptions(name) {
|
|
11
9
|
switch (name) {
|
|
12
10
|
case 'stroke':
|
|
@@ -24,12 +22,11 @@ function getCommonStyleAttributeOptions(name) {
|
|
|
24
22
|
size: 4,
|
|
25
23
|
update: function update(feature) {
|
|
26
24
|
var _feature$stroke = feature.stroke,
|
|
27
|
-
|
|
25
|
+
stroke = _feature$stroke === void 0 ? [1, 1, 1, 1] : _feature$stroke;
|
|
28
26
|
return stroke;
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
29
|
};
|
|
32
|
-
|
|
33
30
|
case 'opacity':
|
|
34
31
|
return {
|
|
35
32
|
name: 'opacity',
|
|
@@ -45,12 +42,11 @@ function getCommonStyleAttributeOptions(name) {
|
|
|
45
42
|
size: 1,
|
|
46
43
|
update: function update(feature) {
|
|
47
44
|
var _feature$opacity = feature.opacity,
|
|
48
|
-
|
|
45
|
+
op = _feature$opacity === void 0 ? 1 : _feature$opacity;
|
|
49
46
|
return [op];
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
49
|
};
|
|
53
|
-
|
|
54
50
|
case 'offsets':
|
|
55
51
|
return {
|
|
56
52
|
name: 'offsets',
|
|
@@ -70,7 +66,6 @@ function getCommonStyleAttributeOptions(name) {
|
|
|
70
66
|
}
|
|
71
67
|
}
|
|
72
68
|
};
|
|
73
|
-
|
|
74
69
|
default:
|
|
75
70
|
return undefined;
|
|
76
71
|
}
|
|
@@ -1,41 +1,31 @@
|
|
|
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 _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
|
|
12
9
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
13
|
-
|
|
14
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
12
|
var _l7Core = require("@antv/l7-core");
|
|
19
|
-
|
|
20
13
|
var _l7Utils = require("@antv/l7-utils");
|
|
21
|
-
|
|
22
14
|
var BaseLayerPickService = /*#__PURE__*/function () {
|
|
23
15
|
function BaseLayerPickService(layer) {
|
|
24
16
|
(0, _classCallCheck2.default)(this, BaseLayerPickService);
|
|
25
17
|
this.layer = layer;
|
|
26
18
|
}
|
|
27
|
-
|
|
28
19
|
(0, _createClass2.default)(BaseLayerPickService, [{
|
|
29
20
|
key: "pickRender",
|
|
30
21
|
value: function pickRender(target) {
|
|
31
22
|
var container = this.layer.getContainer();
|
|
32
23
|
var layerService = container.get(_l7Core.TYPES.ILayerService);
|
|
33
|
-
var layer = this.layer;
|
|
34
|
-
|
|
24
|
+
var layer = this.layer;
|
|
25
|
+
// 瓦片图层的拾取绘制
|
|
35
26
|
if (layer.tileLayer) {
|
|
36
27
|
return layer.tileLayer.pickRender(target);
|
|
37
28
|
}
|
|
38
|
-
|
|
39
29
|
layer.hooks.beforePickingEncode.call();
|
|
40
30
|
layerService.renderTileLayerMask(layer);
|
|
41
31
|
layer.renderModels({
|
|
@@ -48,11 +38,9 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
48
38
|
value: function pick(layer, target) {
|
|
49
39
|
var container = this.layer.getContainer();
|
|
50
40
|
var pickingService = container.get(_l7Core.TYPES.IPickingService);
|
|
51
|
-
|
|
52
41
|
if (layer.type === 'RasterLayer') {
|
|
53
42
|
return this.pickRasterLayer(layer, target);
|
|
54
43
|
}
|
|
55
|
-
|
|
56
44
|
this.pickRender(target);
|
|
57
45
|
return pickingService.pickFromPickingFBO(layer, target);
|
|
58
46
|
}
|
|
@@ -73,7 +61,6 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
73
61
|
rasterValue: null
|
|
74
62
|
};
|
|
75
63
|
var adviceTarget = parent ? parent : layer;
|
|
76
|
-
|
|
77
64
|
if (isPick) {
|
|
78
65
|
var rasterValue = this.readRasterValue(layer, extent, mapService, target.x, target.y);
|
|
79
66
|
layerTarget.rasterValue = rasterValue;
|
|
@@ -92,24 +79,24 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
92
79
|
key: "readRasterValue",
|
|
93
80
|
value: function readRasterValue(layer, bbox, mapService, x, y) {
|
|
94
81
|
var rasterData = layer.getSource().data.dataArray[0];
|
|
95
|
-
|
|
96
82
|
var _bbox = (0, _slicedToArray2.default)(bbox, 4),
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
83
|
+
_bbox$ = _bbox[0],
|
|
84
|
+
minLng = _bbox$ === void 0 ? 0 : _bbox$,
|
|
85
|
+
_bbox$2 = _bbox[1],
|
|
86
|
+
minLat = _bbox$2 === void 0 ? 0 : _bbox$2,
|
|
87
|
+
_bbox$3 = _bbox[2],
|
|
88
|
+
maxLng = _bbox$3 === void 0 ? 10 : _bbox$3,
|
|
89
|
+
_bbox$4 = _bbox[3],
|
|
90
|
+
maxLat = _bbox$4 === void 0 ? -10 : _bbox$4;
|
|
106
91
|
var tileXY = mapService.lngLatToContainer([minLng, minLat]);
|
|
107
92
|
var tileMaxXY = mapService.lngLatToContainer([maxLng, maxLat]);
|
|
108
93
|
var tilePixelWidth = tileMaxXY.x - tileXY.x;
|
|
109
94
|
var tilePixelHeight = tileXY.y - tileMaxXY.y;
|
|
110
|
-
var pos = [(x - tileXY.x) / tilePixelWidth,
|
|
95
|
+
var pos = [(x - tileXY.x) / tilePixelWidth,
|
|
96
|
+
// x
|
|
111
97
|
(y - tileMaxXY.y) / tilePixelHeight // y
|
|
112
98
|
];
|
|
99
|
+
|
|
113
100
|
var tileWidth = rasterData.width || 1;
|
|
114
101
|
var tileHeight = rasterData.height || 1;
|
|
115
102
|
var indexX = Math.floor(pos[0] * tileWidth);
|
|
@@ -121,13 +108,12 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
121
108
|
}, {
|
|
122
109
|
key: "selectFeature",
|
|
123
110
|
value: function selectFeature(pickedColors) {
|
|
124
|
-
var layer = this.layer;
|
|
125
|
-
|
|
111
|
+
var layer = this.layer;
|
|
112
|
+
// @ts-ignore
|
|
126
113
|
var _pickedColors = (0, _slicedToArray2.default)(pickedColors, 3),
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
114
|
+
r = _pickedColors[0],
|
|
115
|
+
g = _pickedColors[1],
|
|
116
|
+
b = _pickedColors[2];
|
|
131
117
|
layer.hooks.beforeSelect.call([r, g, b]);
|
|
132
118
|
}
|
|
133
119
|
}, {
|
|
@@ -135,10 +121,9 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
135
121
|
value: function highlightPickedFeature(pickedColors) {
|
|
136
122
|
// @ts-ignore
|
|
137
123
|
var _pickedColors2 = (0, _slicedToArray2.default)(pickedColors, 3),
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
124
|
+
r = _pickedColors2[0],
|
|
125
|
+
g = _pickedColors2[1],
|
|
126
|
+
b = _pickedColors2[2];
|
|
142
127
|
this.layer.hooks.beforeHighlight.call([r, g, b]);
|
|
143
128
|
}
|
|
144
129
|
}, {
|
|
@@ -149,5 +134,4 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
149
134
|
}]);
|
|
150
135
|
return BaseLayerPickService;
|
|
151
136
|
}();
|
|
152
|
-
|
|
153
137
|
exports.default = BaseLayerPickService;
|
|
@@ -1,20 +1,14 @@
|
|
|
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 _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
10
|
var _l7Core = require("@antv/l7-core");
|
|
15
|
-
|
|
16
11
|
var _l7Utils = require("@antv/l7-utils");
|
|
17
|
-
|
|
18
12
|
var TextureService = /*#__PURE__*/function () {
|
|
19
13
|
function TextureService(layer) {
|
|
20
14
|
(0, _classCallCheck2.default)(this, TextureService);
|
|
@@ -22,19 +16,16 @@ var TextureService = /*#__PURE__*/function () {
|
|
|
22
16
|
var container = this.layer.getContainer();
|
|
23
17
|
this.rendererService = container.get(_l7Core.TYPES.IRendererService);
|
|
24
18
|
}
|
|
25
|
-
|
|
26
19
|
(0, _createClass2.default)(TextureService, [{
|
|
27
20
|
key: "getColorTexture",
|
|
28
21
|
value: function getColorTexture(colorRamp, domain) {
|
|
29
22
|
// TODO 支持传入图片
|
|
30
23
|
var currentkey = this.getTextureKey(colorRamp, domain);
|
|
31
|
-
|
|
32
24
|
if (this.key === currentkey) {
|
|
33
25
|
return this.colorTexture;
|
|
34
26
|
} else {
|
|
35
27
|
this.createColorTexture(colorRamp, domain);
|
|
36
28
|
}
|
|
37
|
-
|
|
38
29
|
this.key = currentkey;
|
|
39
30
|
return this.colorTexture;
|
|
40
31
|
}
|
|
@@ -62,7 +53,6 @@ var TextureService = /*#__PURE__*/function () {
|
|
|
62
53
|
key: "destroy",
|
|
63
54
|
value: function destroy() {
|
|
64
55
|
var _this$colorTexture;
|
|
65
|
-
|
|
66
56
|
(_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0 ? void 0 : _this$colorTexture.destroy();
|
|
67
57
|
}
|
|
68
58
|
}, {
|
|
@@ -71,16 +61,12 @@ var TextureService = /*#__PURE__*/function () {
|
|
|
71
61
|
switch (colorRamp.type) {
|
|
72
62
|
case 'cat':
|
|
73
63
|
return (0, _l7Utils.generateCatRamp)(colorRamp);
|
|
74
|
-
|
|
75
64
|
case 'quantize':
|
|
76
65
|
return (0, _l7Utils.generateQuantizeRamp)(colorRamp);
|
|
77
|
-
|
|
78
66
|
case 'custom':
|
|
79
67
|
return (0, _l7Utils.generateCustomRamp)(colorRamp, domain);
|
|
80
|
-
|
|
81
68
|
case 'linear':
|
|
82
69
|
return (0, _l7Utils.generateLinearRamp)(colorRamp, domain);
|
|
83
|
-
|
|
84
70
|
default:
|
|
85
71
|
return (0, _l7Utils.generateColorRamp)(colorRamp);
|
|
86
72
|
}
|
|
@@ -89,11 +75,9 @@ var TextureService = /*#__PURE__*/function () {
|
|
|
89
75
|
key: "getTextureKey",
|
|
90
76
|
value: function getTextureKey(colorRamp, domain) {
|
|
91
77
|
var _colorRamp$positions;
|
|
92
|
-
|
|
93
78
|
return "".concat(colorRamp.colors.join('_'), "_").concat(colorRamp === null || colorRamp === void 0 ? void 0 : (_colorRamp$positions = colorRamp.positions) === null || _colorRamp$positions === void 0 ? void 0 : _colorRamp$positions.join('_'), "_").concat(colorRamp.type, "_").concat(domain === null || domain === void 0 ? void 0 : domain.join('_'));
|
|
94
79
|
}
|
|
95
80
|
}]);
|
|
96
81
|
return TextureService;
|
|
97
82
|
}();
|
|
98
|
-
|
|
99
83
|
exports.default = TextureService;
|
package/lib/core/interface.js
CHANGED
|
@@ -4,46 +4,36 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.lineStyleType = exports.TextureBlend = exports.SizeUnitType = exports.LinearDir = exports.CanvasUpdateType = void 0;
|
|
7
|
-
var lineStyleType
|
|
8
|
-
exports.lineStyleType = lineStyleType;
|
|
9
|
-
|
|
10
|
-
(function (lineStyleType) {
|
|
7
|
+
var lineStyleType = /*#__PURE__*/function (lineStyleType) {
|
|
11
8
|
lineStyleType[lineStyleType["solid"] = 0] = "solid";
|
|
12
9
|
lineStyleType[lineStyleType["dash"] = 1] = "dash";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
(function (LinearDir) {
|
|
10
|
+
return lineStyleType;
|
|
11
|
+
}({});
|
|
12
|
+
exports.lineStyleType = lineStyleType;
|
|
13
|
+
var LinearDir = /*#__PURE__*/function (LinearDir) {
|
|
19
14
|
LinearDir["VERTICAL"] = "vertical";
|
|
20
15
|
LinearDir["HORIZONTAL"] = "horizontal";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
return LinearDir;
|
|
17
|
+
}({});
|
|
18
|
+
exports.LinearDir = LinearDir;
|
|
19
|
+
var TextureBlend = /*#__PURE__*/function (TextureBlend) {
|
|
20
|
+
TextureBlend["NORMAL"] = "normal";
|
|
21
|
+
TextureBlend["REPLACE"] = "replace";
|
|
22
|
+
return TextureBlend;
|
|
23
|
+
}({});
|
|
24
24
|
/**
|
|
25
25
|
* 基础图层类型定义
|
|
26
26
|
*/
|
|
27
|
-
|
|
28
27
|
exports.TextureBlend = TextureBlend;
|
|
29
|
-
|
|
30
|
-
(function (TextureBlend) {
|
|
31
|
-
TextureBlend["NORMAL"] = "normal";
|
|
32
|
-
TextureBlend["REPLACE"] = "replace";
|
|
33
|
-
})(TextureBlend || (exports.TextureBlend = TextureBlend = {}));
|
|
34
|
-
|
|
35
|
-
var SizeUnitType;
|
|
36
|
-
exports.SizeUnitType = SizeUnitType;
|
|
37
|
-
|
|
38
|
-
(function (SizeUnitType) {
|
|
28
|
+
var SizeUnitType = /*#__PURE__*/function (SizeUnitType) {
|
|
39
29
|
SizeUnitType[SizeUnitType["pixel"] = 0] = "pixel";
|
|
40
30
|
SizeUnitType[SizeUnitType["meter"] = 1] = "meter";
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
(function (CanvasUpdateType) {
|
|
31
|
+
return SizeUnitType;
|
|
32
|
+
}({});
|
|
33
|
+
exports.SizeUnitType = SizeUnitType;
|
|
34
|
+
var CanvasUpdateType = /*#__PURE__*/function (CanvasUpdateType) {
|
|
47
35
|
CanvasUpdateType["ALWAYS"] = "always";
|
|
48
36
|
CanvasUpdateType["DRAGEND"] = "dragend";
|
|
49
|
-
|
|
37
|
+
return CanvasUpdateType;
|
|
38
|
+
}({});
|
|
39
|
+
exports.CanvasUpdateType = CanvasUpdateType;
|