@antv/l7-layers 2.17.4 → 2.17.5
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/es/core/BaseModel.js
CHANGED
|
@@ -6,9 +6,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
6
6
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
7
|
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
|
|
8
8
|
import _initializerWarningHelper from "@babel/runtime/helpers/esm/initializerWarningHelper";
|
|
9
|
-
|
|
10
9
|
var _dec, _class, _descriptor;
|
|
11
|
-
|
|
12
10
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
13
11
|
import { BlendType, lazyInject, MaskOperation, StencilType, TYPES } from '@antv/l7-core';
|
|
14
12
|
import { rgb2arr } from '@antv/l7-utils';
|
|
@@ -18,16 +16,14 @@ import { getCommonStyleAttributeOptions } from "./CommonStyleAttribute";
|
|
|
18
16
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
19
17
|
var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function () {
|
|
20
18
|
// style texture data mapping
|
|
19
|
+
|
|
21
20
|
// style texture data mapping
|
|
21
|
+
|
|
22
22
|
function BaseModel(layer) {
|
|
23
23
|
_classCallCheck(this, BaseModel);
|
|
24
|
-
|
|
25
24
|
_defineProperty(this, "preStyleAttribute", {});
|
|
26
|
-
|
|
27
25
|
_defineProperty(this, "encodeStyleAttribute", {});
|
|
28
|
-
|
|
29
26
|
_initializerDefineProperty(this, "configService", _descriptor, this);
|
|
30
|
-
|
|
31
27
|
this.layer = layer;
|
|
32
28
|
this.rendererService = layer.getContainer().get(TYPES.IRendererService);
|
|
33
29
|
this.pickingService = layer.getContainer().get(TYPES.IPickingService);
|
|
@@ -37,40 +33,39 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
37
33
|
this.iconService = layer.getContainer().get(TYPES.IIconService);
|
|
38
34
|
this.fontService = layer.getContainer().get(TYPES.IFontService);
|
|
39
35
|
this.cameraService = layer.getContainer().get(TYPES.ICameraService);
|
|
40
|
-
this.layerService = layer.getContainer().get(TYPES.ILayerService);
|
|
41
|
-
|
|
42
|
-
this.registerStyleAttribute(); // 注册 Attribute
|
|
43
|
-
|
|
44
|
-
this.registerBuiltinAttributes(); // 开启动画
|
|
36
|
+
this.layerService = layer.getContainer().get(TYPES.ILayerService);
|
|
37
|
+
// 初始化支持数据映射的 Style 属性
|
|
45
38
|
|
|
39
|
+
this.registerStyleAttribute();
|
|
40
|
+
// 注册 Attribute
|
|
41
|
+
this.registerBuiltinAttributes();
|
|
42
|
+
// 开启动画
|
|
46
43
|
this.startModelAnimate();
|
|
47
44
|
var createTexture2D = this.rendererService.createTexture2D;
|
|
48
45
|
this.createTexture2D = createTexture2D;
|
|
49
|
-
}
|
|
50
|
-
|
|
46
|
+
}
|
|
51
47
|
|
|
48
|
+
// style datatexture mapping
|
|
52
49
|
_createClass(BaseModel, [{
|
|
53
50
|
key: "getBlend",
|
|
54
51
|
value: function getBlend() {
|
|
55
52
|
var _this$layer$getLayerC = this.layer.getLayerConfig(),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
_this$layer$getLayerC2 = _this$layer$getLayerC.blend,
|
|
54
|
+
blend = _this$layer$getLayerC2 === void 0 ? 'normal' : _this$layer$getLayerC2;
|
|
59
55
|
return BlendTypes[BlendType[blend]];
|
|
60
56
|
}
|
|
61
57
|
}, {
|
|
62
58
|
key: "getStencil",
|
|
63
59
|
value: function getStencil(option) {
|
|
64
60
|
var _this$layer$getLayerC3 = this.layer.getLayerConfig(),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
61
|
+
_this$layer$getLayerC4 = _this$layer$getLayerC3.mask,
|
|
62
|
+
mask = _this$layer$getLayerC4 === void 0 ? false : _this$layer$getLayerC4,
|
|
63
|
+
_this$layer$getLayerC5 = _this$layer$getLayerC3.maskInside,
|
|
64
|
+
maskInside = _this$layer$getLayerC5 === void 0 ? true : _this$layer$getLayerC5,
|
|
65
|
+
enableMask = _this$layer$getLayerC3.enableMask,
|
|
66
|
+
_this$layer$getLayerC6 = _this$layer$getLayerC3.maskOperation,
|
|
67
|
+
maskOperation = _this$layer$getLayerC6 === void 0 ? MaskOperation.AND : _this$layer$getLayerC6;
|
|
68
|
+
// TODO 临时处理,后期移除MaskLayer
|
|
74
69
|
if (this.layer.type === 'MaskLayer') {
|
|
75
70
|
return getStencilMask({
|
|
76
71
|
isStencil: true,
|
|
@@ -84,11 +79,12 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
84
79
|
})); // 用于遮罩的stencil 参数
|
|
85
80
|
}
|
|
86
81
|
|
|
87
|
-
var maskflag = mask ||
|
|
88
|
-
|
|
82
|
+
var maskflag = mask ||
|
|
83
|
+
// mask 兼容历史写法
|
|
84
|
+
enableMask && this.layer.masks.length !== 0 ||
|
|
85
|
+
// 外部图层的mask
|
|
89
86
|
this.layer.tileMask !== undefined; // 瓦片图层
|
|
90
87
|
// !!(mask || enableMask || this.layer.tileMask);
|
|
91
|
-
|
|
92
88
|
return _getStencil(maskflag, maskInside);
|
|
93
89
|
}
|
|
94
90
|
}, {
|
|
@@ -111,76 +107,58 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
111
107
|
value: function () {
|
|
112
108
|
var _needUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
113
109
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
114
|
-
while (1) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
case "end":
|
|
121
|
-
return _context.stop();
|
|
122
|
-
}
|
|
110
|
+
while (1) switch (_context.prev = _context.next) {
|
|
111
|
+
case 0:
|
|
112
|
+
return _context.abrupt("return", false);
|
|
113
|
+
case 1:
|
|
114
|
+
case "end":
|
|
115
|
+
return _context.stop();
|
|
123
116
|
}
|
|
124
117
|
}, _callee);
|
|
125
118
|
}));
|
|
126
|
-
|
|
127
119
|
function needUpdate() {
|
|
128
120
|
return _needUpdate.apply(this, arguments);
|
|
129
121
|
}
|
|
130
|
-
|
|
131
122
|
return needUpdate;
|
|
132
123
|
}() // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
133
|
-
|
|
134
124
|
}, {
|
|
135
125
|
key: "buildModels",
|
|
136
126
|
value: function () {
|
|
137
127
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
138
128
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
139
|
-
while (1) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
case "end":
|
|
146
|
-
return _context2.stop();
|
|
147
|
-
}
|
|
129
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
130
|
+
case 0:
|
|
131
|
+
throw new Error('Method not implemented.');
|
|
132
|
+
case 1:
|
|
133
|
+
case "end":
|
|
134
|
+
return _context2.stop();
|
|
148
135
|
}
|
|
149
136
|
}, _callee2);
|
|
150
137
|
}));
|
|
151
|
-
|
|
152
138
|
function buildModels() {
|
|
153
139
|
return _buildModels.apply(this, arguments);
|
|
154
140
|
}
|
|
155
|
-
|
|
156
141
|
return buildModels;
|
|
157
142
|
}() // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
158
|
-
|
|
159
143
|
}, {
|
|
160
144
|
key: "initModels",
|
|
161
145
|
value: function () {
|
|
162
146
|
var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
163
147
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
164
|
-
while (1) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
case "end":
|
|
171
|
-
return _context3.stop();
|
|
172
|
-
}
|
|
148
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
149
|
+
case 0:
|
|
150
|
+
throw new Error('Method not implemented.');
|
|
151
|
+
case 1:
|
|
152
|
+
case "end":
|
|
153
|
+
return _context3.stop();
|
|
173
154
|
}
|
|
174
155
|
}, _callee3);
|
|
175
156
|
}));
|
|
176
|
-
|
|
177
157
|
function initModels() {
|
|
178
158
|
return _initModels.apply(this, arguments);
|
|
179
159
|
}
|
|
180
|
-
|
|
181
160
|
return initModels;
|
|
182
161
|
}() // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
183
|
-
|
|
184
162
|
}, {
|
|
185
163
|
key: "clearModels",
|
|
186
164
|
value: function clearModels() {
|
|
@@ -191,8 +169,8 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
191
169
|
key: "getAttribute",
|
|
192
170
|
value: function getAttribute() {
|
|
193
171
|
throw new Error('Method not implemented.');
|
|
194
|
-
}
|
|
195
|
-
|
|
172
|
+
}
|
|
173
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
196
174
|
}, {
|
|
197
175
|
key: "render",
|
|
198
176
|
value: function render(renderOptions) {
|
|
@@ -212,8 +190,7 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
212
190
|
key: "startModelAnimate",
|
|
213
191
|
value: function startModelAnimate() {
|
|
214
192
|
var _ref = this.layer.getLayerConfig(),
|
|
215
|
-
|
|
216
|
-
|
|
193
|
+
animateOption = _ref.animateOption;
|
|
217
194
|
if (animateOption.enable) {
|
|
218
195
|
this.layer.setAnimateStartTime();
|
|
219
196
|
}
|
|
@@ -233,7 +210,6 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
233
210
|
if (encodeStyleAttribute[key]) {
|
|
234
211
|
str += "#define USE_ATTRIBUTE_".concat(key.toUpperCase(), " 0.0; \n\n");
|
|
235
212
|
}
|
|
236
|
-
|
|
237
213
|
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");
|
|
238
214
|
});
|
|
239
215
|
var innerStr = '';
|
|
@@ -244,14 +220,15 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
244
220
|
'vs:#decl': str,
|
|
245
221
|
'vs:#main-start': innerStr
|
|
246
222
|
};
|
|
247
|
-
}
|
|
223
|
+
}
|
|
248
224
|
|
|
225
|
+
// 获取数据映射样式
|
|
249
226
|
}, {
|
|
250
227
|
key: "getStyleAttribute",
|
|
251
228
|
value: function getStyleAttribute() {
|
|
252
229
|
var _this = this;
|
|
253
|
-
|
|
254
|
-
|
|
230
|
+
var options = {};
|
|
231
|
+
// TODO: 优化
|
|
255
232
|
|
|
256
233
|
var defualtValue = {
|
|
257
234
|
opacity: 1,
|
|
@@ -262,27 +239,22 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
262
239
|
if (!_this.layer.encodeStyleAttribute[key]) {
|
|
263
240
|
// @ts-ignore
|
|
264
241
|
var keyValue = _this.layer.getLayerConfig()[key];
|
|
265
|
-
|
|
266
242
|
var value = typeof keyValue === 'undefined' ? defualtValue[key] : keyValue;
|
|
267
|
-
|
|
268
243
|
if (key === 'stroke') {
|
|
269
244
|
value = rgb2arr(value);
|
|
270
245
|
}
|
|
271
|
-
|
|
272
246
|
options['u_' + key] = value;
|
|
273
247
|
}
|
|
274
248
|
});
|
|
275
249
|
return options;
|
|
276
|
-
}
|
|
277
|
-
|
|
250
|
+
}
|
|
251
|
+
// 注册数据映射样式
|
|
278
252
|
}, {
|
|
279
253
|
key: "registerStyleAttribute",
|
|
280
254
|
value: function registerStyleAttribute() {
|
|
281
255
|
var _this2 = this;
|
|
282
|
-
|
|
283
256
|
Object.keys(this.layer.encodeStyleAttribute).forEach(function (key) {
|
|
284
257
|
var options = getCommonStyleAttributeOptions(key);
|
|
285
|
-
|
|
286
258
|
if (options) {
|
|
287
259
|
_this2.styleAttributeService.registerStyleAttribute(options);
|
|
288
260
|
}
|
|
@@ -294,7 +266,6 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
294
266
|
this.encodeStyleAttribute[type] = flag;
|
|
295
267
|
}
|
|
296
268
|
}]);
|
|
297
|
-
|
|
298
269
|
return BaseModel;
|
|
299
270
|
}(), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "configService", [_dec], {
|
|
300
271
|
configurable: true,
|
|
@@ -16,12 +16,11 @@ export function getCommonStyleAttributeOptions(name) {
|
|
|
16
16
|
size: 4,
|
|
17
17
|
update: function update(feature) {
|
|
18
18
|
var _feature$stroke = feature.stroke,
|
|
19
|
-
|
|
19
|
+
stroke = _feature$stroke === void 0 ? [1, 1, 1, 1] : _feature$stroke;
|
|
20
20
|
return stroke;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
|
|
25
24
|
case 'opacity':
|
|
26
25
|
return {
|
|
27
26
|
name: 'opacity',
|
|
@@ -37,12 +36,11 @@ export function getCommonStyleAttributeOptions(name) {
|
|
|
37
36
|
size: 1,
|
|
38
37
|
update: function update(feature) {
|
|
39
38
|
var _feature$opacity = feature.opacity,
|
|
40
|
-
|
|
39
|
+
op = _feature$opacity === void 0 ? 1 : _feature$opacity;
|
|
41
40
|
return [op];
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
43
|
};
|
|
45
|
-
|
|
46
44
|
case 'offsets':
|
|
47
45
|
return {
|
|
48
46
|
name: 'offsets',
|
|
@@ -62,7 +60,6 @@ export function getCommonStyleAttributeOptions(name) {
|
|
|
62
60
|
}
|
|
63
61
|
}
|
|
64
62
|
};
|
|
65
|
-
|
|
66
63
|
default:
|
|
67
64
|
return undefined;
|
|
68
65
|
}
|
|
@@ -4,25 +4,21 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
5
|
import { TYPES } from '@antv/l7-core';
|
|
6
6
|
import { lngLatInExtent } from '@antv/l7-utils';
|
|
7
|
-
|
|
8
7
|
var BaseLayerPickService = /*#__PURE__*/function () {
|
|
9
8
|
function BaseLayerPickService(layer) {
|
|
10
9
|
_classCallCheck(this, BaseLayerPickService);
|
|
11
|
-
|
|
12
10
|
this.layer = layer;
|
|
13
11
|
}
|
|
14
|
-
|
|
15
12
|
_createClass(BaseLayerPickService, [{
|
|
16
13
|
key: "pickRender",
|
|
17
14
|
value: function pickRender(target) {
|
|
18
15
|
var container = this.layer.getContainer();
|
|
19
16
|
var layerService = container.get(TYPES.ILayerService);
|
|
20
|
-
var layer = this.layer;
|
|
21
|
-
|
|
17
|
+
var layer = this.layer;
|
|
18
|
+
// 瓦片图层的拾取绘制
|
|
22
19
|
if (layer.tileLayer) {
|
|
23
20
|
return layer.tileLayer.pickRender(target);
|
|
24
21
|
}
|
|
25
|
-
|
|
26
22
|
layer.hooks.beforePickingEncode.call();
|
|
27
23
|
layerService.renderTileLayerMask(layer);
|
|
28
24
|
layer.renderModels({
|
|
@@ -35,11 +31,9 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
35
31
|
value: function pick(layer, target) {
|
|
36
32
|
var container = this.layer.getContainer();
|
|
37
33
|
var pickingService = container.get(TYPES.IPickingService);
|
|
38
|
-
|
|
39
34
|
if (layer.type === 'RasterLayer') {
|
|
40
35
|
return this.pickRasterLayer(layer, target);
|
|
41
36
|
}
|
|
42
|
-
|
|
43
37
|
this.pickRender(target);
|
|
44
38
|
return pickingService.pickFromPickingFBO(layer, target);
|
|
45
39
|
}
|
|
@@ -60,7 +54,6 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
60
54
|
rasterValue: null
|
|
61
55
|
};
|
|
62
56
|
var adviceTarget = parent ? parent : layer;
|
|
63
|
-
|
|
64
57
|
if (isPick) {
|
|
65
58
|
var rasterValue = this.readRasterValue(layer, extent, mapService, target.x, target.y);
|
|
66
59
|
layerTarget.rasterValue = rasterValue;
|
|
@@ -79,24 +72,24 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
79
72
|
key: "readRasterValue",
|
|
80
73
|
value: function readRasterValue(layer, bbox, mapService, x, y) {
|
|
81
74
|
var rasterData = layer.getSource().data.dataArray[0];
|
|
82
|
-
|
|
83
75
|
var _bbox = _slicedToArray(bbox, 4),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
76
|
+
_bbox$ = _bbox[0],
|
|
77
|
+
minLng = _bbox$ === void 0 ? 0 : _bbox$,
|
|
78
|
+
_bbox$2 = _bbox[1],
|
|
79
|
+
minLat = _bbox$2 === void 0 ? 0 : _bbox$2,
|
|
80
|
+
_bbox$3 = _bbox[2],
|
|
81
|
+
maxLng = _bbox$3 === void 0 ? 10 : _bbox$3,
|
|
82
|
+
_bbox$4 = _bbox[3],
|
|
83
|
+
maxLat = _bbox$4 === void 0 ? -10 : _bbox$4;
|
|
93
84
|
var tileXY = mapService.lngLatToContainer([minLng, minLat]);
|
|
94
85
|
var tileMaxXY = mapService.lngLatToContainer([maxLng, maxLat]);
|
|
95
86
|
var tilePixelWidth = tileMaxXY.x - tileXY.x;
|
|
96
87
|
var tilePixelHeight = tileXY.y - tileMaxXY.y;
|
|
97
|
-
var pos = [(x - tileXY.x) / tilePixelWidth,
|
|
88
|
+
var pos = [(x - tileXY.x) / tilePixelWidth,
|
|
89
|
+
// x
|
|
98
90
|
(y - tileMaxXY.y) / tilePixelHeight // y
|
|
99
91
|
];
|
|
92
|
+
|
|
100
93
|
var tileWidth = rasterData.width || 1;
|
|
101
94
|
var tileHeight = rasterData.height || 1;
|
|
102
95
|
var indexX = Math.floor(pos[0] * tileWidth);
|
|
@@ -108,13 +101,12 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
108
101
|
}, {
|
|
109
102
|
key: "selectFeature",
|
|
110
103
|
value: function selectFeature(pickedColors) {
|
|
111
|
-
var layer = this.layer;
|
|
112
|
-
|
|
104
|
+
var layer = this.layer;
|
|
105
|
+
// @ts-ignore
|
|
113
106
|
var _pickedColors = _slicedToArray(pickedColors, 3),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
107
|
+
r = _pickedColors[0],
|
|
108
|
+
g = _pickedColors[1],
|
|
109
|
+
b = _pickedColors[2];
|
|
118
110
|
layer.hooks.beforeSelect.call([r, g, b]);
|
|
119
111
|
}
|
|
120
112
|
}, {
|
|
@@ -122,10 +114,9 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
122
114
|
value: function highlightPickedFeature(pickedColors) {
|
|
123
115
|
// @ts-ignore
|
|
124
116
|
var _pickedColors2 = _slicedToArray(pickedColors, 3),
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
117
|
+
r = _pickedColors2[0],
|
|
118
|
+
g = _pickedColors2[1],
|
|
119
|
+
b = _pickedColors2[2];
|
|
129
120
|
this.layer.hooks.beforeHighlight.call([r, g, b]);
|
|
130
121
|
}
|
|
131
122
|
}, {
|
|
@@ -134,8 +125,6 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
134
125
|
return this.layer.getSource().getFeatureById(pickedFeatureIdx);
|
|
135
126
|
}
|
|
136
127
|
}]);
|
|
137
|
-
|
|
138
128
|
return BaseLayerPickService;
|
|
139
129
|
}();
|
|
140
|
-
|
|
141
130
|
export { BaseLayerPickService as default };
|
|
@@ -2,28 +2,23 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
3
|
import { TYPES } from '@antv/l7-core';
|
|
4
4
|
import { generateCatRamp, generateColorRamp, generateCustomRamp, generateLinearRamp, generateQuantizeRamp } from '@antv/l7-utils';
|
|
5
|
-
|
|
6
5
|
var TextureService = /*#__PURE__*/function () {
|
|
7
6
|
function TextureService(layer) {
|
|
8
7
|
_classCallCheck(this, TextureService);
|
|
9
|
-
|
|
10
8
|
this.layer = layer;
|
|
11
9
|
var container = this.layer.getContainer();
|
|
12
10
|
this.rendererService = container.get(TYPES.IRendererService);
|
|
13
11
|
}
|
|
14
|
-
|
|
15
12
|
_createClass(TextureService, [{
|
|
16
13
|
key: "getColorTexture",
|
|
17
14
|
value: function getColorTexture(colorRamp, domain) {
|
|
18
15
|
// TODO 支持传入图片
|
|
19
16
|
var currentkey = this.getTextureKey(colorRamp, domain);
|
|
20
|
-
|
|
21
17
|
if (this.key === currentkey) {
|
|
22
18
|
return this.colorTexture;
|
|
23
19
|
} else {
|
|
24
20
|
this.createColorTexture(colorRamp, domain);
|
|
25
21
|
}
|
|
26
|
-
|
|
27
22
|
this.key = currentkey;
|
|
28
23
|
return this.colorTexture;
|
|
29
24
|
}
|
|
@@ -51,7 +46,6 @@ var TextureService = /*#__PURE__*/function () {
|
|
|
51
46
|
key: "destroy",
|
|
52
47
|
value: function destroy() {
|
|
53
48
|
var _this$colorTexture;
|
|
54
|
-
|
|
55
49
|
(_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0 ? void 0 : _this$colorTexture.destroy();
|
|
56
50
|
}
|
|
57
51
|
}, {
|
|
@@ -60,16 +54,12 @@ var TextureService = /*#__PURE__*/function () {
|
|
|
60
54
|
switch (colorRamp.type) {
|
|
61
55
|
case 'cat':
|
|
62
56
|
return generateCatRamp(colorRamp);
|
|
63
|
-
|
|
64
57
|
case 'quantize':
|
|
65
58
|
return generateQuantizeRamp(colorRamp);
|
|
66
|
-
|
|
67
59
|
case 'custom':
|
|
68
60
|
return generateCustomRamp(colorRamp, domain);
|
|
69
|
-
|
|
70
61
|
case 'linear':
|
|
71
62
|
return generateLinearRamp(colorRamp, domain);
|
|
72
|
-
|
|
73
63
|
default:
|
|
74
64
|
return generateColorRamp(colorRamp);
|
|
75
65
|
}
|
|
@@ -78,12 +68,9 @@ var TextureService = /*#__PURE__*/function () {
|
|
|
78
68
|
key: "getTextureKey",
|
|
79
69
|
value: function getTextureKey(colorRamp, domain) {
|
|
80
70
|
var _colorRamp$positions;
|
|
81
|
-
|
|
82
71
|
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('_'));
|
|
83
72
|
}
|
|
84
73
|
}]);
|
|
85
|
-
|
|
86
74
|
return TextureService;
|
|
87
75
|
}();
|
|
88
|
-
|
|
89
76
|
export { TextureService as default };
|
package/es/core/interface.js
CHANGED
|
@@ -1,37 +1,30 @@
|
|
|
1
|
-
export var lineStyleType
|
|
2
|
-
|
|
3
|
-
(function (lineStyleType) {
|
|
1
|
+
export var lineStyleType = /*#__PURE__*/function (lineStyleType) {
|
|
4
2
|
lineStyleType[lineStyleType["solid"] = 0] = "solid";
|
|
5
3
|
lineStyleType[lineStyleType["dash"] = 1] = "dash";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export var LinearDir
|
|
9
|
-
|
|
10
|
-
(function (LinearDir) {
|
|
4
|
+
return lineStyleType;
|
|
5
|
+
}({});
|
|
6
|
+
export var LinearDir = /*#__PURE__*/function (LinearDir) {
|
|
11
7
|
LinearDir["VERTICAL"] = "vertical";
|
|
12
8
|
LinearDir["HORIZONTAL"] = "horizontal";
|
|
13
|
-
|
|
9
|
+
return LinearDir;
|
|
10
|
+
}({});
|
|
11
|
+
export var TextureBlend = /*#__PURE__*/function (TextureBlend) {
|
|
12
|
+
TextureBlend["NORMAL"] = "normal";
|
|
13
|
+
TextureBlend["REPLACE"] = "replace";
|
|
14
|
+
return TextureBlend;
|
|
15
|
+
}({});
|
|
14
16
|
|
|
15
|
-
export var TextureBlend;
|
|
16
17
|
/**
|
|
17
18
|
* 基础图层类型定义
|
|
18
19
|
*/
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
TextureBlend["NORMAL"] = "normal";
|
|
22
|
-
TextureBlend["REPLACE"] = "replace";
|
|
23
|
-
})(TextureBlend || (TextureBlend = {}));
|
|
24
|
-
|
|
25
|
-
export var SizeUnitType;
|
|
26
|
-
|
|
27
|
-
(function (SizeUnitType) {
|
|
21
|
+
export var SizeUnitType = /*#__PURE__*/function (SizeUnitType) {
|
|
28
22
|
SizeUnitType[SizeUnitType["pixel"] = 0] = "pixel";
|
|
29
23
|
SizeUnitType[SizeUnitType["meter"] = 1] = "meter";
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export var CanvasUpdateType
|
|
33
|
-
|
|
34
|
-
(function (CanvasUpdateType) {
|
|
24
|
+
return SizeUnitType;
|
|
25
|
+
}({});
|
|
26
|
+
export var CanvasUpdateType = /*#__PURE__*/function (CanvasUpdateType) {
|
|
35
27
|
CanvasUpdateType["ALWAYS"] = "always";
|
|
36
28
|
CanvasUpdateType["DRAGEND"] = "dragend";
|
|
37
|
-
|
|
29
|
+
return CanvasUpdateType;
|
|
30
|
+
}({});
|
package/es/core/shape/Path.js
CHANGED
|
@@ -1,47 +1,40 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
|
|
3
2
|
var _geometryShape;
|
|
4
|
-
|
|
5
|
-
export var ShapeType3D;
|
|
6
|
-
|
|
7
|
-
(function (ShapeType3D) {
|
|
3
|
+
export var ShapeType3D = /*#__PURE__*/function (ShapeType3D) {
|
|
8
4
|
ShapeType3D["CYLINDER"] = "cylinder";
|
|
9
5
|
ShapeType3D["SQUARECOLUMN"] = "squareColumn";
|
|
10
6
|
ShapeType3D["TRIANGLECOLUMN"] = "triangleColumn";
|
|
11
7
|
ShapeType3D["HEXAGONCOLUMN"] = "hexagonColumn";
|
|
12
8
|
ShapeType3D["PENTAGONCOLUMN"] = "pentagonColumn";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export var ShapeType2D
|
|
16
|
-
/**
|
|
17
|
-
* 生成规则多边形顶点个数
|
|
18
|
-
* @param pointCount 顶点个数 3 => 三角形
|
|
19
|
-
* @param start 顶点起始角度 调整图形的方向
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
(function (ShapeType2D) {
|
|
9
|
+
return ShapeType3D;
|
|
10
|
+
}({});
|
|
11
|
+
export var ShapeType2D = /*#__PURE__*/function (ShapeType2D) {
|
|
23
12
|
ShapeType2D["CIRCLE"] = "circle";
|
|
24
13
|
ShapeType2D["SQUARE"] = "square";
|
|
25
14
|
ShapeType2D["TRIANGLE"] = "triangle";
|
|
26
15
|
ShapeType2D["HEXAGON"] = "hexagon";
|
|
27
16
|
ShapeType2D["PENTAGON"] = "pentagon";
|
|
28
|
-
|
|
17
|
+
return ShapeType2D;
|
|
18
|
+
}({});
|
|
29
19
|
|
|
20
|
+
/**
|
|
21
|
+
* 生成规则多边形顶点个数
|
|
22
|
+
* @param pointCount 顶点个数 3 => 三角形
|
|
23
|
+
* @param start 顶点起始角度 调整图形的方向
|
|
24
|
+
*/
|
|
30
25
|
export function polygonPath(pointCount) {
|
|
31
26
|
var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
32
27
|
var step = Math.PI * 2 / pointCount;
|
|
33
28
|
var line = [];
|
|
34
|
-
|
|
35
29
|
for (var i = 0; i < pointCount; i++) {
|
|
36
30
|
line.push(step * i + start * Math.PI / 12);
|
|
37
31
|
}
|
|
38
|
-
|
|
39
32
|
var path = line.map(function (t) {
|
|
40
33
|
var x = Math.sin(t + Math.PI / 4);
|
|
41
34
|
var y = Math.cos(t + Math.PI / 4);
|
|
42
35
|
return [x, y, 0];
|
|
43
|
-
});
|
|
44
|
-
|
|
36
|
+
});
|
|
37
|
+
// path.push(path[0]);
|
|
45
38
|
return path;
|
|
46
39
|
}
|
|
47
40
|
export function circle() {
|