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