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