@antv/l7-layers 2.15.1 → 2.15.3
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 +320 -484
- package/es/core/BaseModel.js +97 -126
- 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 +10 -31
- package/es/core/triangulation.js +54 -114
- 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 +91 -146
- 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 -34
- package/es/line/models/arc.js +66 -118
- package/es/line/models/arc_3d.js +60 -108
- package/es/line/models/earthArc_3d.js +63 -111
- package/es/line/models/great_circle.js +56 -100
- package/es/line/models/half.js +46 -77
- package/es/line/models/line.js +94 -148
- package/es/line/models/linearline.js +45 -80
- package/es/line/models/simpleLine.js +41 -74
- package/es/line/models/wall.js +52 -92
- package/es/mask/index.js +9 -28
- package/es/mask/models/fill.js +29 -54
- package/es/plugins/DataMappingPlugin.js +80 -117
- 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 +67 -104
- package/es/plugins/LayerStylePlugin.js +3 -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 -77
- package/es/point/models/earthExtrude.js +61 -102
- package/es/point/models/earthFill.js +57 -87
- package/es/point/models/extrude.js +60 -101
- package/es/point/models/fill.js +70 -100
- package/es/point/models/fillmage.js +63 -107
- package/es/point/models/image.js +48 -88
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +30 -54
- package/es/point/models/radar.js +40 -64
- package/es/point/models/simplePoint.js +41 -69
- package/es/point/models/text.d.ts +2 -0
- package/es/point/models/text.js +214 -295
- package/es/point/shape/extrude.js +4 -13
- package/es/polygon/index.js +11 -40
- package/es/polygon/models/extrude.js +48 -92
- package/es/polygon/models/fill.js +54 -88
- 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 +30 -52
- package/es/tile/service/TilePickService.js +26 -40
- package/es/tile/service/TileSourceService.js +3 -7
- package/es/tile/tileFactory/DebugTile.js +28 -45
- 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/dataMappingStyle.js +8 -18
- 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 +320 -478
- package/lib/core/BaseModel.js +97 -139
- 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 +10 -54
- package/lib/core/triangulation.js +53 -153
- 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 +91 -162
- 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 +64 -128
- package/lib/line/models/arc_3d.js +58 -119
- package/lib/line/models/earthArc_3d.js +61 -122
- package/lib/line/models/great_circle.js +56 -111
- package/lib/line/models/half.js +46 -87
- package/lib/line/models/index.js +0 -11
- package/lib/line/models/line.js +92 -156
- package/lib/line/models/linearline.js +45 -92
- package/lib/line/models/simpleLine.js +41 -84
- package/lib/line/models/wall.js +52 -103
- 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 +80 -128
- 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 +68 -113
- package/lib/plugins/LayerStylePlugin.js +4 -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 +61 -113
- package/lib/point/models/earthFill.js +57 -117
- package/lib/point/models/extrude.js +60 -111
- package/lib/point/models/fill.js +68 -109
- package/lib/point/models/fillmage.js +61 -115
- package/lib/point/models/image.js +48 -98
- package/lib/point/models/index.js +1 -12
- package/lib/point/models/normal.js +30 -64
- package/lib/point/models/radar.js +40 -74
- package/lib/point/models/simplePoint.js +41 -79
- package/lib/point/models/text.js +214 -303
- package/lib/point/shape/extrude.js +4 -20
- package/lib/polygon/index.js +11 -48
- package/lib/polygon/models/extrude.js +48 -103
- package/lib/polygon/models/fill.js +54 -98
- 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 +30 -57
- 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 +28 -53
- 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/dataMappingStyle.js +8 -19
- 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
|
@@ -4,13 +4,12 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
5
|
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
|
|
6
6
|
import _initializerWarningHelper from "@babel/runtime/helpers/esm/initializerWarningHelper";
|
|
7
|
-
|
|
8
7
|
var _dec, _dec2, _dec3, _dec4, _dec5, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4;
|
|
9
|
-
|
|
10
8
|
import { CameraUniform, CoordinateUniform, TYPES } from '@antv/l7-core';
|
|
11
9
|
import { $window } from '@antv/l7-utils';
|
|
12
10
|
import { inject, injectable } from 'inversify';
|
|
13
11
|
import 'reflect-metadata';
|
|
12
|
+
|
|
14
13
|
/**
|
|
15
14
|
* 在渲染之前需要获取当前 Shader 所需 Uniform,例如:
|
|
16
15
|
* 1. 从相机服务中获取 View & ProjectionMatrix,当前缩放等级等等
|
|
@@ -18,74 +17,61 @@ import 'reflect-metadata';
|
|
|
18
17
|
* @see https://yuque.antfin-inc.com/yuqi.pyq/fgetpa/doml91
|
|
19
18
|
* 3. 当前 Layer 本身的样式属性
|
|
20
19
|
*/
|
|
21
|
-
|
|
22
20
|
var ShaderUniformPlugin = (_dec = injectable(), _dec2 = inject(TYPES.ICameraService), _dec3 = inject(TYPES.ICoordinateSystemService), _dec4 = inject(TYPES.IRendererService), _dec5 = inject(TYPES.IMapService), _dec(_class = (_class2 = /*#__PURE__*/function () {
|
|
23
21
|
function ShaderUniformPlugin() {
|
|
24
22
|
_classCallCheck(this, ShaderUniformPlugin);
|
|
25
|
-
|
|
26
23
|
_initializerDefineProperty(this, "cameraService", _descriptor, this);
|
|
27
|
-
|
|
28
24
|
_initializerDefineProperty(this, "coordinateSystemService", _descriptor2, this);
|
|
29
|
-
|
|
30
25
|
_initializerDefineProperty(this, "rendererService", _descriptor3, this);
|
|
31
|
-
|
|
32
26
|
_initializerDefineProperty(this, "mapService", _descriptor4, this);
|
|
33
27
|
}
|
|
34
|
-
|
|
35
28
|
_createClass(ShaderUniformPlugin, [{
|
|
36
29
|
key: "apply",
|
|
37
30
|
value: function apply(layer) {
|
|
38
31
|
var _this = this;
|
|
39
|
-
|
|
40
32
|
var version = this.mapService.version;
|
|
41
33
|
var mvp = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; // default matrix (for gaode2.x)
|
|
42
|
-
|
|
43
34
|
var sceneCenterMKT = [0, 0];
|
|
44
35
|
layer.hooks.beforeRender.tap('ShaderUniformPlugin', function () {
|
|
45
36
|
// @ts-ignore
|
|
46
|
-
var offset = layer.getLayerConfig().tileOrigin;
|
|
47
|
-
|
|
37
|
+
var offset = layer.getLayerConfig().tileOrigin;
|
|
38
|
+
// 重新计算坐标系参数
|
|
48
39
|
_this.coordinateSystemService.refresh(offset);
|
|
49
|
-
|
|
50
40
|
if (version === 'GAODE2.x') {
|
|
51
|
-
_this.setLayerCenter(layer);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
41
|
+
_this.setLayerCenter(layer);
|
|
42
|
+
// @ts-ignore
|
|
43
|
+
mvp = _this.mapService.map.customCoords.getMVPMatrix();
|
|
44
|
+
// mvp = amapCustomCoords.getMVPMatrix()
|
|
55
45
|
// @ts-ignore
|
|
56
|
-
|
|
57
46
|
sceneCenterMKT = _this.mapService.getCustomCoordCenter();
|
|
58
47
|
}
|
|
59
|
-
|
|
60
48
|
var _this$rendererService = _this.rendererService.getViewportSize(),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
49
|
+
width = _this$rendererService.width,
|
|
50
|
+
height = _this$rendererService.height;
|
|
64
51
|
layer.models.forEach(function (model) {
|
|
65
52
|
var _model$addUniforms;
|
|
66
|
-
|
|
67
53
|
model.addUniforms((_model$addUniforms = {}, _defineProperty(_model$addUniforms, CameraUniform.ProjectionMatrix, _this.cameraService.getProjectionMatrix()), _defineProperty(_model$addUniforms, CameraUniform.ViewMatrix, _this.cameraService.getViewMatrix()), _defineProperty(_model$addUniforms, CameraUniform.ViewProjectionMatrix, _this.cameraService.getViewProjectionMatrix()), _defineProperty(_model$addUniforms, CameraUniform.Zoom, _this.cameraService.getZoom()), _defineProperty(_model$addUniforms, CameraUniform.ZoomScale, _this.cameraService.getZoomScale()), _defineProperty(_model$addUniforms, CameraUniform.FocalDistance, _this.cameraService.getFocalDistance()), _defineProperty(_model$addUniforms, CameraUniform.CameraPosition, _this.cameraService.getCameraPosition()), _defineProperty(_model$addUniforms, CoordinateUniform.CoordinateSystem, _this.coordinateSystemService.getCoordinateSystem()), _defineProperty(_model$addUniforms, CoordinateUniform.ViewportCenter, _this.coordinateSystemService.getViewportCenter()), _defineProperty(_model$addUniforms, CoordinateUniform.ViewportCenterProjection, _this.coordinateSystemService.getViewportCenterProjection()), _defineProperty(_model$addUniforms, CoordinateUniform.PixelsPerDegree, _this.coordinateSystemService.getPixelsPerDegree()), _defineProperty(_model$addUniforms, CoordinateUniform.PixelsPerDegree2, _this.coordinateSystemService.getPixelsPerDegree2()), _defineProperty(_model$addUniforms, CoordinateUniform.PixelsPerMeter, _this.coordinateSystemService.getPixelsPerMeter()), _defineProperty(_model$addUniforms, CoordinateUniform.Mvp, mvp), _defineProperty(_model$addUniforms, "u_SceneCenterMKT", sceneCenterMKT), _defineProperty(_model$addUniforms, "u_ViewportSize", [width, height]), _defineProperty(_model$addUniforms, "u_ModelMatrix", _this.cameraService.getModelMatrix()), _defineProperty(_model$addUniforms, "u_DevicePixelRatio", $window.devicePixelRatio), _defineProperty(_model$addUniforms, "u_PickingBuffer", layer.getLayerConfig().pickingBuffer || 0), _defineProperty(_model$addUniforms, "u_shaderPick", Number(layer.getShaderPickStat())), _model$addUniforms));
|
|
68
|
-
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// TODO:脏检查,决定是否需要渲染
|
|
69
57
|
});
|
|
70
58
|
}
|
|
59
|
+
|
|
71
60
|
/**
|
|
72
61
|
* 对于每个 layer 都有不同的几何中心点,因此在绘制每个 layer 的时候都需要重新设置
|
|
73
62
|
* @param layer
|
|
74
63
|
*/
|
|
75
|
-
|
|
76
64
|
}, {
|
|
77
65
|
key: "setLayerCenter",
|
|
78
66
|
value: function setLayerCenter(layer) {
|
|
79
67
|
if (layer.coordCenter === undefined) {
|
|
80
68
|
layer.coordCenter = layer.getSource().center;
|
|
81
69
|
}
|
|
82
|
-
|
|
83
70
|
if (this.mapService.setCoordCenter) {
|
|
84
71
|
this.mapService.setCoordCenter(layer.coordCenter);
|
|
85
72
|
}
|
|
86
73
|
}
|
|
87
74
|
}]);
|
|
88
|
-
|
|
89
75
|
return ShaderUniformPlugin;
|
|
90
76
|
}(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "cameraService", [_dec2], {
|
|
91
77
|
configurable: true,
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
|
|
4
3
|
var _dec, _class;
|
|
5
|
-
|
|
6
4
|
import { injectable } from 'inversify';
|
|
7
5
|
import 'reflect-metadata';
|
|
8
6
|
/**
|
|
9
7
|
* Model 更新
|
|
10
8
|
*/
|
|
11
|
-
|
|
12
9
|
var UpdateModelPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function () {
|
|
13
10
|
function UpdateModelPlugin() {
|
|
14
11
|
_classCallCheck(this, UpdateModelPlugin);
|
|
15
12
|
}
|
|
16
|
-
|
|
17
13
|
_createClass(UpdateModelPlugin, [{
|
|
18
14
|
key: "apply",
|
|
19
15
|
value: function apply(layer) {
|
|
@@ -32,7 +28,6 @@ var UpdateModelPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functio
|
|
|
32
28
|
});
|
|
33
29
|
}
|
|
34
30
|
}]);
|
|
35
|
-
|
|
36
31
|
return UpdateModelPlugin;
|
|
37
32
|
}()) || _class);
|
|
38
33
|
export { UpdateModelPlugin as default };
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
|
|
4
3
|
var _dec, _class;
|
|
5
|
-
|
|
6
4
|
import { injectable } from 'inversify';
|
|
7
5
|
import 'reflect-metadata';
|
|
6
|
+
|
|
8
7
|
/**
|
|
9
8
|
* 在初始化阶段完成属性的注册,以及首次根据 Layer 指定的三角化方法完成 indices 和 attribute 的创建
|
|
10
9
|
*/
|
|
11
|
-
|
|
12
10
|
var UpdateStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function () {
|
|
13
11
|
function UpdateStyleAttributePlugin() {
|
|
14
12
|
_classCallCheck(this, UpdateStyleAttributePlugin);
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
_createClass(UpdateStyleAttributePlugin, [{
|
|
18
15
|
key: "apply",
|
|
19
16
|
value: function apply(layer, _ref) {
|
|
20
17
|
var _this = this;
|
|
21
|
-
|
|
22
18
|
var styleAttributeService = _ref.styleAttributeService;
|
|
23
19
|
layer.hooks.init.tapPromise('UpdateStyleAttributePlugin', function () {
|
|
24
20
|
_this.initStyleAttribute(layer, {
|
|
@@ -29,7 +25,6 @@ var UpdateStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__
|
|
|
29
25
|
if (layer.layerModelNeedUpdate) {
|
|
30
26
|
return;
|
|
31
27
|
}
|
|
32
|
-
|
|
33
28
|
if (layer.inited) {
|
|
34
29
|
_this.updateStyleAttribute(layer, {
|
|
35
30
|
styleAttributeService: styleAttributeService
|
|
@@ -43,7 +38,6 @@ var UpdateStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__
|
|
|
43
38
|
var styleAttributeService = _ref2.styleAttributeService;
|
|
44
39
|
var attributes = styleAttributeService.getLayerStyleAttributes() || [];
|
|
45
40
|
var filter = styleAttributeService.getLayerStyleAttribute('filter');
|
|
46
|
-
|
|
47
41
|
if (filter && filter.needRegenerateVertices) {
|
|
48
42
|
layer.layerModelNeedUpdate = true;
|
|
49
43
|
attributes.forEach(function (attr) {
|
|
@@ -51,12 +45,12 @@ var UpdateStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__
|
|
|
51
45
|
});
|
|
52
46
|
return;
|
|
53
47
|
}
|
|
54
|
-
|
|
55
48
|
attributes.filter(function (attribute) {
|
|
56
49
|
return attribute.needRegenerateVertices;
|
|
57
50
|
}).forEach(function (attribute) {
|
|
58
51
|
// 精确更新某个/某些 feature(s),需要传入 featureIdx d
|
|
59
|
-
styleAttributeService.updateAttributeByFeatureRange(attribute.name, layer.getEncodedData(),
|
|
52
|
+
styleAttributeService.updateAttributeByFeatureRange(attribute.name, layer.getEncodedData(),
|
|
53
|
+
// 获取经过 mapping 最新的数据
|
|
60
54
|
attribute.featureRange.startIndex, attribute.featureRange.endIndex, layer);
|
|
61
55
|
attribute.needRegenerateVertices = false;
|
|
62
56
|
});
|
|
@@ -70,13 +64,13 @@ var UpdateStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__
|
|
|
70
64
|
return attribute.needRegenerateVertices;
|
|
71
65
|
}).forEach(function (attribute) {
|
|
72
66
|
// 精确更新某个/某些 feature(s),需要传入 featureIdx d
|
|
73
|
-
styleAttributeService.updateAttributeByFeatureRange(attribute.name, layer.getEncodedData(),
|
|
67
|
+
styleAttributeService.updateAttributeByFeatureRange(attribute.name, layer.getEncodedData(),
|
|
68
|
+
// 获取经过 mapping 最新的数据
|
|
74
69
|
attribute.featureRange.startIndex, attribute.featureRange.endIndex);
|
|
75
70
|
attribute.needRegenerateVertices = false;
|
|
76
71
|
});
|
|
77
72
|
}
|
|
78
73
|
}]);
|
|
79
|
-
|
|
80
74
|
return UpdateStyleAttributePlugin;
|
|
81
75
|
}()) || _class);
|
|
82
76
|
export { UpdateStyleAttributePlugin as default };
|
package/es/point/index.js
CHANGED
|
@@ -6,40 +6,25 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
6
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
|
-
|
|
10
9
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
11
|
-
|
|
12
10
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
-
|
|
14
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
15
|
-
|
|
11
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
16
12
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
17
|
-
|
|
18
13
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
19
|
-
|
|
20
14
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
21
|
-
|
|
22
15
|
import BaseLayer from "../core/BaseLayer";
|
|
23
16
|
import PointModels from "./models/index";
|
|
24
|
-
|
|
25
17
|
var PointLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
26
18
|
_inherits(PointLayer, _BaseLayer);
|
|
27
|
-
|
|
28
19
|
var _super = _createSuper(PointLayer);
|
|
29
|
-
|
|
30
20
|
function PointLayer() {
|
|
31
21
|
var _this;
|
|
32
|
-
|
|
33
22
|
_classCallCheck(this, PointLayer);
|
|
34
|
-
|
|
35
23
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
36
24
|
args[_key] = arguments[_key];
|
|
37
25
|
}
|
|
38
|
-
|
|
39
26
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
40
|
-
|
|
41
27
|
_defineProperty(_assertThisInitialized(_this), "type", 'PointLayer');
|
|
42
|
-
|
|
43
28
|
_defineProperty(_assertThisInitialized(_this), "defaultSourceConfig", {
|
|
44
29
|
data: [],
|
|
45
30
|
options: {
|
|
@@ -50,41 +35,32 @@ var PointLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
50
35
|
}
|
|
51
36
|
}
|
|
52
37
|
});
|
|
53
|
-
|
|
54
38
|
return _this;
|
|
55
39
|
}
|
|
56
|
-
|
|
57
40
|
_createClass(PointLayer, [{
|
|
58
41
|
key: "buildModels",
|
|
59
42
|
value: function () {
|
|
60
43
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
61
44
|
var modelType;
|
|
62
45
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
63
|
-
while (1) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
case 5:
|
|
77
|
-
case "end":
|
|
78
|
-
return _context.stop();
|
|
79
|
-
}
|
|
46
|
+
while (1) switch (_context.prev = _context.next) {
|
|
47
|
+
case 0:
|
|
48
|
+
modelType = this.getModelType();
|
|
49
|
+
if (this.layerModel) {
|
|
50
|
+
this.layerModel.clearModels();
|
|
51
|
+
}
|
|
52
|
+
this.layerModel = new PointModels[modelType](this);
|
|
53
|
+
_context.next = 5;
|
|
54
|
+
return this.initLayerModels();
|
|
55
|
+
case 5:
|
|
56
|
+
case "end":
|
|
57
|
+
return _context.stop();
|
|
80
58
|
}
|
|
81
59
|
}, _callee, this);
|
|
82
60
|
}));
|
|
83
|
-
|
|
84
61
|
function buildModels() {
|
|
85
62
|
return _buildModels.apply(this, arguments);
|
|
86
63
|
}
|
|
87
|
-
|
|
88
64
|
return buildModels;
|
|
89
65
|
}()
|
|
90
66
|
}, {
|
|
@@ -92,60 +68,47 @@ var PointLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
92
68
|
value: function () {
|
|
93
69
|
var _rebuildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
94
70
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
95
|
-
while (1) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
case "end":
|
|
103
|
-
return _context2.stop();
|
|
104
|
-
}
|
|
71
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
72
|
+
case 0:
|
|
73
|
+
_context2.next = 2;
|
|
74
|
+
return this.buildModels();
|
|
75
|
+
case 2:
|
|
76
|
+
case "end":
|
|
77
|
+
return _context2.stop();
|
|
105
78
|
}
|
|
106
79
|
}, _callee2, this);
|
|
107
80
|
}));
|
|
108
|
-
|
|
109
81
|
function rebuildModels() {
|
|
110
82
|
return _rebuildModels.apply(this, arguments);
|
|
111
83
|
}
|
|
112
|
-
|
|
113
84
|
return rebuildModels;
|
|
114
85
|
}()
|
|
115
86
|
/**
|
|
116
87
|
* 在未传入数据的时候判断点图层的 shape 类型
|
|
117
88
|
* @returns
|
|
118
89
|
*/
|
|
119
|
-
|
|
120
90
|
}, {
|
|
121
91
|
key: "getModelTypeWillEmptyData",
|
|
122
92
|
value: function getModelTypeWillEmptyData() {
|
|
123
93
|
if (this.shapeOption) {
|
|
124
94
|
var _this$shapeOption = this.shapeOption,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
95
|
+
field = _this$shapeOption.field,
|
|
96
|
+
values = _this$shapeOption.values;
|
|
128
97
|
var _this$getLayerConfig = this.getLayerConfig(),
|
|
129
|
-
|
|
130
|
-
|
|
98
|
+
shape2d = _this$getLayerConfig.shape2d;
|
|
131
99
|
var iconMap = this.iconService.getIconMap();
|
|
132
|
-
|
|
133
100
|
if (field && (shape2d === null || shape2d === void 0 ? void 0 : shape2d.indexOf(field)) !== -1) {
|
|
134
101
|
return 'fill';
|
|
135
102
|
}
|
|
136
|
-
|
|
137
103
|
if (values === 'text') {
|
|
138
104
|
return 'text';
|
|
139
105
|
}
|
|
140
|
-
|
|
141
106
|
if (values && values instanceof Array) {
|
|
142
107
|
var _iterator = _createForOfIteratorHelper(values),
|
|
143
|
-
|
|
144
|
-
|
|
108
|
+
_step;
|
|
145
109
|
try {
|
|
146
110
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
147
111
|
var v = _step.value;
|
|
148
|
-
|
|
149
112
|
if (typeof v === 'string' && iconMap.hasOwnProperty(v)) {
|
|
150
113
|
return 'image';
|
|
151
114
|
}
|
|
@@ -157,7 +120,6 @@ var PointLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
157
120
|
}
|
|
158
121
|
}
|
|
159
122
|
}
|
|
160
|
-
|
|
161
123
|
return 'normal';
|
|
162
124
|
}
|
|
163
125
|
}, {
|
|
@@ -191,37 +153,29 @@ var PointLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
191
153
|
value: function getModelType() {
|
|
192
154
|
// 2D、 3d、 shape、image、text、normal、
|
|
193
155
|
var layerData = this.getEncodedData();
|
|
194
|
-
|
|
195
156
|
var _this$getLayerConfig2 = this.getLayerConfig(),
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
157
|
+
shape2d = _this$getLayerConfig2.shape2d,
|
|
158
|
+
shape3d = _this$getLayerConfig2.shape3d;
|
|
199
159
|
var iconMap = this.iconService.getIconMap();
|
|
200
160
|
var item = layerData.find(function (fe) {
|
|
201
161
|
return fe.hasOwnProperty('shape');
|
|
202
162
|
});
|
|
203
|
-
|
|
204
163
|
if (!item) {
|
|
205
164
|
return this.getModelTypeWillEmptyData();
|
|
206
165
|
} else {
|
|
207
166
|
var shape = item.shape;
|
|
208
|
-
|
|
209
167
|
if (shape === 'dot') {
|
|
210
168
|
return 'normal';
|
|
211
169
|
}
|
|
212
|
-
|
|
213
170
|
if (shape === 'simple') {
|
|
214
171
|
return 'simplePoint';
|
|
215
172
|
}
|
|
216
|
-
|
|
217
173
|
if (shape === 'radar') {
|
|
218
174
|
return 'radar';
|
|
219
175
|
}
|
|
220
|
-
|
|
221
176
|
if (this.layerType === 'fillImage') {
|
|
222
177
|
return 'fillImage';
|
|
223
178
|
}
|
|
224
|
-
|
|
225
179
|
if ((shape2d === null || shape2d === void 0 ? void 0 : shape2d.indexOf(shape)) !== -1) {
|
|
226
180
|
if (this.mapService.version === 'GLOBEL') {
|
|
227
181
|
return 'earthFill';
|
|
@@ -229,7 +183,6 @@ var PointLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
229
183
|
return 'fill';
|
|
230
184
|
}
|
|
231
185
|
}
|
|
232
|
-
|
|
233
186
|
if ((shape3d === null || shape3d === void 0 ? void 0 : shape3d.indexOf(shape)) !== -1) {
|
|
234
187
|
if (this.mapService.version === 'GLOBEL') {
|
|
235
188
|
return 'earthExtrude';
|
|
@@ -237,17 +190,13 @@ var PointLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
237
190
|
return 'extrude';
|
|
238
191
|
}
|
|
239
192
|
}
|
|
240
|
-
|
|
241
193
|
if (iconMap.hasOwnProperty(shape)) {
|
|
242
194
|
return 'image';
|
|
243
195
|
}
|
|
244
|
-
|
|
245
196
|
return 'text';
|
|
246
197
|
}
|
|
247
198
|
}
|
|
248
199
|
}]);
|
|
249
|
-
|
|
250
200
|
return PointLayer;
|
|
251
201
|
}(BaseLayer);
|
|
252
|
-
|
|
253
202
|
export { PointLayer as default };
|