@antv/l7-layers 2.20.19 → 2.21.0
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/canvas/index.d.ts +13 -8
- package/es/canvas/index.js +63 -36
- package/es/canvas/models/canvas.d.ts +19 -14
- package/es/canvas/models/canvas.js +125 -139
- package/es/canvas/models/constants.d.ts +2 -0
- package/es/canvas/models/constants.js +6 -0
- package/es/canvas/models/index.d.ts +2 -5
- package/es/canvas/models/index.js +2 -5
- package/es/core/BaseLayer.d.ts +17 -19
- package/es/core/BaseLayer.js +88 -62
- package/es/core/BaseModel.js +15 -29
- package/es/core/LayerPickService.js +4 -5
- package/es/core/TextureService.js +1 -2
- package/es/core/interface.d.ts +31 -4
- package/es/core/shape/arrow.js +2 -6
- package/es/heatmap/models/heatmap.d.ts +0 -1
- package/es/heatmap/models/heatmap.js +2 -5
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -89
- package/es/line/models/arc.js +5 -5
- package/es/line/models/arc_3d.js +4 -3
- package/es/line/models/great_circle.js +4 -4
- package/es/line/models/line.js +5 -8
- package/es/line/models/simple_line.js +1 -2
- package/es/line/models/wall.js +4 -3
- package/es/plugins/DataMappingPlugin.d.ts +4 -7
- package/es/plugins/DataMappingPlugin.js +8 -23
- package/es/plugins/DataSourcePlugin.d.ts +0 -1
- package/es/plugins/DataSourcePlugin.js +4 -7
- package/es/plugins/FeatureScalePlugin.d.ts +2 -5
- package/es/plugins/FeatureScalePlugin.js +4 -6
- package/es/plugins/LayerAnimateStylePlugin.d.ts +0 -1
- package/es/plugins/LayerAnimateStylePlugin.js +2 -5
- package/es/plugins/LayerMaskPlugin.d.ts +0 -1
- package/es/plugins/LayerMaskPlugin.js +2 -8
- package/es/plugins/LayerModelPlugin.d.ts +0 -1
- package/es/plugins/LayerModelPlugin.js +13 -18
- package/es/plugins/LayerStylePlugin.d.ts +0 -1
- package/es/plugins/LayerStylePlugin.js +2 -5
- package/es/plugins/LightingPlugin.d.ts +0 -1
- package/es/plugins/LightingPlugin.js +2 -5
- package/es/plugins/MultiPassRendererPlugin.d.ts +0 -1
- package/es/plugins/MultiPassRendererPlugin.js +2 -5
- package/es/plugins/PixelPickingPlugin.d.ts +2 -6
- package/es/plugins/PixelPickingPlugin.js +4 -9
- package/es/plugins/RegisterStyleAttributePlugin.d.ts +2 -5
- package/es/plugins/RegisterStyleAttributePlugin.js +2 -5
- package/es/plugins/ShaderUniformPlugin.d.ts +7 -8
- package/es/plugins/ShaderUniformPlugin.js +16 -42
- package/es/plugins/UpdateModelPlugin.d.ts +0 -1
- package/es/plugins/UpdateModelPlugin.js +2 -5
- package/es/plugins/UpdateStyleAttributePlugin.d.ts +2 -5
- package/es/plugins/UpdateStyleAttributePlugin.js +2 -6
- package/es/plugins/index.d.ts +15 -0
- package/es/plugins/index.js +18 -0
- package/es/point/models/fill.d.ts +1 -1
- package/es/point/models/fill.js +6 -9
- package/es/point/models/fillImage.js +4 -3
- package/es/point/models/image.js +4 -3
- package/es/polygon/models/extrude.js +0 -1
- package/es/polygon/models/ocean.js +1 -2
- package/es/polygon/models/water.js +0 -2
- package/es/tile/core/BaseLayer.js +4 -5
- package/es/tile/interaction/getRasterData.js +4 -16
- package/es/tile/service/TileLayerService.d.ts +0 -1
- package/es/tile/service/TileLayerService.js +0 -1
- package/es/tile/service/TilePickService.d.ts +1 -1
- package/es/tile/service/TilePickService.js +2 -3
- package/es/tile/tile/Tile.js +8 -6
- package/es/tile/utils/utils.d.ts +0 -4
- package/es/tile/utils/utils.js +0 -11
- package/lib/canvas/index.js +63 -37
- package/lib/canvas/models/canvas.js +125 -138
- package/lib/canvas/models/constants.js +12 -0
- package/lib/canvas/models/index.js +22 -7
- package/lib/core/BaseLayer.js +88 -62
- package/lib/core/BaseModel.js +14 -28
- package/lib/core/LayerPickService.js +4 -5
- package/lib/core/TextureService.js +1 -2
- package/lib/core/shape/arrow.js +2 -6
- package/lib/heatmap/models/heatmap.js +2 -5
- package/lib/index.js +9 -90
- package/lib/line/models/arc.js +4 -4
- package/lib/line/models/arc_3d.js +4 -3
- package/lib/line/models/great_circle.js +4 -4
- package/lib/line/models/line.js +5 -8
- package/lib/line/models/simple_line.js +0 -1
- package/lib/line/models/wall.js +4 -3
- package/lib/plugins/DataMappingPlugin.js +7 -22
- package/lib/plugins/DataSourcePlugin.js +3 -6
- package/lib/plugins/FeatureScalePlugin.js +4 -6
- package/lib/plugins/LayerAnimateStylePlugin.js +2 -5
- package/lib/plugins/LayerMaskPlugin.js +2 -8
- package/lib/plugins/LayerModelPlugin.js +13 -18
- package/lib/plugins/LayerStylePlugin.js +2 -5
- package/lib/plugins/LightingPlugin.js +2 -5
- package/lib/plugins/MultiPassRendererPlugin.js +2 -5
- package/lib/plugins/PixelPickingPlugin.js +4 -9
- package/lib/plugins/RegisterStyleAttributePlugin.js +2 -5
- package/lib/plugins/ShaderUniformPlugin.js +15 -41
- package/lib/plugins/UpdateModelPlugin.js +2 -5
- package/lib/plugins/UpdateStyleAttributePlugin.js +2 -5
- package/lib/plugins/index.js +26 -0
- package/lib/point/models/fill.js +6 -9
- package/lib/point/models/fillImage.js +4 -3
- package/lib/point/models/image.js +4 -3
- package/lib/polygon/models/extrude.js +0 -1
- package/lib/polygon/models/ocean.js +0 -1
- package/lib/polygon/models/water.js +0 -2
- package/lib/tile/core/BaseLayer.js +4 -5
- package/lib/tile/interaction/getRasterData.js +4 -16
- package/lib/tile/service/TileLayerService.js +0 -1
- package/lib/tile/service/TilePickService.js +2 -3
- package/lib/tile/tile/Tile.js +8 -6
- package/lib/tile/utils/utils.js +0 -12
- package/package.json +18 -20
package/es/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { container, TYPES } from '@antv/l7-core';
|
|
2
1
|
import CanvasLayer from "./canvas";
|
|
3
2
|
import CityBuildingLayer from "./citybuliding/building";
|
|
4
3
|
import BaseLayer from "./core/BaseLayer";
|
|
@@ -10,96 +9,10 @@ import LineLayer from "./line/index";
|
|
|
10
9
|
import PointLayer from "./point";
|
|
11
10
|
import PolygonLayer from "./polygon";
|
|
12
11
|
import RasterLayer from "./raster";
|
|
12
|
+
import TileLayer from "./tile/core/BaseLayer";
|
|
13
13
|
import TileDebugLayer from "./tile/core/TileDebugLayer";
|
|
14
14
|
import EarthLayer from "./earth";
|
|
15
15
|
import MaskLayer from "./mask";
|
|
16
16
|
import WindLayer from "./wind";
|
|
17
|
-
|
|
18
|
-
// import ConfigSchemaValidationPlugin from './plugins/ConfigSchemaValidationPlugin';
|
|
19
|
-
import DataMappingPlugin from "./plugins/DataMappingPlugin";
|
|
20
|
-
import DataSourcePlugin from "./plugins/DataSourcePlugin";
|
|
21
|
-
import FeatureScalePlugin from "./plugins/FeatureScalePlugin";
|
|
22
|
-
import LayerAnimateStylePlugin from "./plugins/LayerAnimateStylePlugin";
|
|
23
|
-
import LayerMaskPlugin from "./plugins/LayerMaskPlugin";
|
|
24
|
-
import LayerModelPlugin from "./plugins/LayerModelPlugin";
|
|
25
|
-
import LayerStylePlugin from "./plugins/LayerStylePlugin";
|
|
26
|
-
import LightingPlugin from "./plugins/LightingPlugin";
|
|
27
|
-
import MultiPassRendererPlugin from "./plugins/MultiPassRendererPlugin";
|
|
28
|
-
import PixelPickingPlugin from "./plugins/PixelPickingPlugin";
|
|
29
|
-
import RegisterStyleAttributePlugin from "./plugins/RegisterStyleAttributePlugin";
|
|
30
|
-
import ShaderUniformPlugin from "./plugins/ShaderUniformPlugin";
|
|
31
|
-
import UpdateModelPlugin from "./plugins/UpdateModelPlugin";
|
|
32
|
-
import UpdateStyleAttributePlugin from "./plugins/UpdateStyleAttributePlugin";
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* 校验传入参数配置项的正确性
|
|
36
|
-
* @see /dev-docs/ConfigSchemaValidation.md
|
|
37
|
-
*/
|
|
38
|
-
// container
|
|
39
|
-
// .bind<ILayerPlugin>(TYPES.ILayerPlugin)
|
|
40
|
-
// .to(ConfigSchemaValidationPlugin)
|
|
41
|
-
// .inRequestScope();
|
|
42
|
-
/**
|
|
43
|
-
* 获取 Source
|
|
44
|
-
*/
|
|
45
|
-
container.bind(TYPES.ILayerPlugin).to(DataSourcePlugin).inRequestScope();
|
|
46
|
-
/**
|
|
47
|
-
* 根据 StyleAttribute 创建 VertexAttribute
|
|
48
|
-
*/
|
|
49
|
-
container.bind(TYPES.ILayerPlugin).to(RegisterStyleAttributePlugin).inRequestScope();
|
|
50
|
-
/**
|
|
51
|
-
* 根据 Source 创建 Scale
|
|
52
|
-
*/
|
|
53
|
-
container.bind(TYPES.ILayerPlugin).to(FeatureScalePlugin).inRequestScope();
|
|
54
|
-
/**
|
|
55
|
-
* 使用 Scale 进行数据映射
|
|
56
|
-
*/
|
|
57
|
-
container.bind(TYPES.ILayerPlugin).to(DataMappingPlugin).inRequestScope();
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* 更新地图样式配置项 如active, show, hide
|
|
61
|
-
*/
|
|
62
|
-
container.bind(TYPES.ILayerPlugin).to(LayerStylePlugin).inRequestScope();
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* 初始化地图 Mask
|
|
66
|
-
*/
|
|
67
|
-
container.bind(TYPES.ILayerPlugin).to(LayerMaskPlugin).inRequestScope();
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* 负责属性更新
|
|
71
|
-
*/
|
|
72
|
-
container.bind(TYPES.ILayerPlugin).to(UpdateStyleAttributePlugin).inRequestScope();
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* 负责Model更新
|
|
76
|
-
*/
|
|
77
|
-
container.bind(TYPES.ILayerPlugin).to(UpdateModelPlugin).inRequestScope();
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Multi Pass 自定义渲染管线
|
|
81
|
-
*/
|
|
82
|
-
container.bind(TYPES.ILayerPlugin).to(MultiPassRendererPlugin).inRequestScope();
|
|
83
|
-
/**
|
|
84
|
-
* 传入相机坐标系参数
|
|
85
|
-
*/
|
|
86
|
-
container.bind(TYPES.ILayerPlugin).to(ShaderUniformPlugin).inRequestScope();
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* 传入动画参数
|
|
90
|
-
*/
|
|
91
|
-
container.bind(TYPES.ILayerPlugin).to(LayerAnimateStylePlugin).inRequestScope();
|
|
92
|
-
/**
|
|
93
|
-
* 传入光照相关参数
|
|
94
|
-
*/
|
|
95
|
-
container.bind(TYPES.ILayerPlugin).to(LightingPlugin).inRequestScope();
|
|
96
|
-
/**
|
|
97
|
-
* 负责拾取过程中 Encode 以及 Highlight 阶段及结束后恢复
|
|
98
|
-
*/
|
|
99
|
-
container.bind(TYPES.ILayerPlugin).to(PixelPickingPlugin).inRequestScope();
|
|
100
|
-
/**
|
|
101
|
-
* 初始化Model
|
|
102
|
-
*/
|
|
103
|
-
container.bind(TYPES.ILayerPlugin).to(LayerModelPlugin).inRequestScope();
|
|
104
17
|
export * from "./core/interface";
|
|
105
|
-
export { BaseLayer, BaseModel,
|
|
18
|
+
export { BaseLayer, BaseModel, CanvasLayer, CityBuildingLayer, EarthLayer, GeometryLayer, HeatmapLayer, ImageLayer, LineLayer, MaskLayer, PointLayer, PolygonLayer, RasterLayer, TileDebugLayer, TileLayer, WindLayer };
|
package/es/line/models/arc.js
CHANGED
|
@@ -10,7 +10,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
10
10
|
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); }; }
|
|
11
11
|
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; } }
|
|
12
12
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
13
|
-
import {
|
|
13
|
+
import { rgb2arr } from '@antv/l7-utils';
|
|
14
14
|
import BaseModel from "../../core/BaseModel";
|
|
15
15
|
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
16
16
|
import { LineArcTriangulation } from "../../core/triangulation";
|
|
@@ -22,7 +22,6 @@ var lineStyleObj = {
|
|
|
22
22
|
solid: 0.0,
|
|
23
23
|
dash: 1.0
|
|
24
24
|
};
|
|
25
|
-
var isNumber = lodashUtil.isNumber;
|
|
26
25
|
var ArcModel = /*#__PURE__*/function (_BaseModel) {
|
|
27
26
|
_inherits(ArcModel, _BaseModel);
|
|
28
27
|
var _super = _createSuper(ArcModel);
|
|
@@ -94,7 +93,8 @@ var ArcModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
94
93
|
useLinearColor = 1;
|
|
95
94
|
}
|
|
96
95
|
if (this.rendererService.getDirty()) {
|
|
97
|
-
|
|
96
|
+
var _this$texture;
|
|
97
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.bind();
|
|
98
98
|
}
|
|
99
99
|
var commonOptions = {
|
|
100
100
|
u_animate: this.animateOption2Array(animateOption),
|
|
@@ -151,8 +151,8 @@ var ArcModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
151
151
|
}, {
|
|
152
152
|
key: "clearModels",
|
|
153
153
|
value: function clearModels() {
|
|
154
|
-
var _this$
|
|
155
|
-
(_this$
|
|
154
|
+
var _this$texture2;
|
|
155
|
+
(_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
|
|
156
156
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
157
157
|
}
|
|
158
158
|
}, {
|
package/es/line/models/arc_3d.js
CHANGED
|
@@ -92,7 +92,8 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
92
92
|
useLinearColor = 1;
|
|
93
93
|
}
|
|
94
94
|
if (this.rendererService.getDirty()) {
|
|
95
|
-
|
|
95
|
+
var _this$texture;
|
|
96
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.bind();
|
|
96
97
|
}
|
|
97
98
|
var commonOptions = {
|
|
98
99
|
u_animate: this.animateOption2Array(animateOption),
|
|
@@ -150,8 +151,8 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
150
151
|
}, {
|
|
151
152
|
key: "clearModels",
|
|
152
153
|
value: function clearModels() {
|
|
153
|
-
var _this$
|
|
154
|
-
(_this$
|
|
154
|
+
var _this$texture2;
|
|
155
|
+
(_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
|
|
155
156
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
156
157
|
}
|
|
157
158
|
}, {
|
|
@@ -77,7 +77,8 @@ var GreatCircleModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
77
77
|
dashArray.push(0, 0);
|
|
78
78
|
}
|
|
79
79
|
if (this.rendererService.getDirty()) {
|
|
80
|
-
|
|
80
|
+
var _this$texture;
|
|
81
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.bind();
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
// 转化渐变色
|
|
@@ -146,8 +147,8 @@ var GreatCircleModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
146
147
|
}, {
|
|
147
148
|
key: "clearModels",
|
|
148
149
|
value: function clearModels() {
|
|
149
|
-
var _this$
|
|
150
|
-
(_this$
|
|
150
|
+
var _this$texture2;
|
|
151
|
+
(_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
|
|
151
152
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
152
153
|
}
|
|
153
154
|
}, {
|
|
@@ -245,7 +246,6 @@ var GreatCircleModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
245
246
|
update: function update(feature) {
|
|
246
247
|
var iconMap = _this2.iconService.getIconMap();
|
|
247
248
|
var texture = feature.texture;
|
|
248
|
-
// console.log('icon feature', feature)
|
|
249
249
|
var _ref4 = iconMap[texture] || {
|
|
250
250
|
x: 0,
|
|
251
251
|
y: 0
|
package/es/line/models/line.js
CHANGED
|
@@ -21,10 +21,6 @@ import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
|
21
21
|
var line_frag = "// #extension GL_OES_standard_derivatives : enable\n#define Animate 0.0\n#define LineTexture 1.0\n\nuniform sampler2D u_texture;\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array;\n vec4 u_blur;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed: 0.0;\n float u_vertexScale: 1.0;\n float u_raisingHeight: 0.0;\n float u_strokeWidth: 0.0;\n float u_textureBlend;\n float u_line_texture;\n float u_linearDir: 1.0;\n float u_linearColor: 0;\n float u_time;\n};\n\nin vec4 v_color;\nin vec4 v_stroke;\n// dash\nin vec4 v_dash_array;\nin float v_d_distance_ratio;\nin vec2 v_iconMapUV;\nin vec4 v_texture_data;\n\nout vec4 outputColor;\n#pragma include \"picking\"\n\n// [animate, duration, interval, trailLength],\nvoid main() {\n if(u_dash_array!=vec4(0.0)){\n float dashLength = mod(v_d_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(!(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z))) {\n // \u865A\u7EBF\u90E8\u5206\n discard;\n };\n }\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = v_texture_data.r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n if(u_linearDir < 1.0) {\n d_distance_ratio = v_texture_data.a;\n }\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n outputColor = mix(u_sourceColor, u_targetColor, d_distance_ratio);\n outputColor.a *= v_color.a;\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n outputColor = v_color;\n }\n // anti-alias\n // float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));\n if(u_animate.x == Animate) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n alpha = smoothstep(0., 1., alpha);\n outputColor.a *= alpha;\n }\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = v_texture_data.g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = v_texture_data.b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);\n float v = v_texture_data.a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // v = max(smoothstep(0.95, 1.0, v), v);\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture(SAMPLER_2D(u_texture), uv);\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n outputColor += pattern;\n } else { // replace\n pattern.a *= v_color.a;\n if(outputColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n outputColor = pattern;\n }\n } \n\n float v = v_texture_data.a;\n float strokeWidth = min(0.5, u_strokeWidth);\n // \u7ED8\u5236 border\n if(strokeWidth > 0.01) {\n float borderOuterWidth = strokeWidth / 2.0;\n\n\n if(v >= 1.0 - strokeWidth || v <= strokeWidth) {\n if(v > strokeWidth) { // \u5916\u4FA7\n float linear = smoothstep(0.0, 1.0, (v - (1.0 - strokeWidth))/strokeWidth);\n // float linear = step(0.0, (v - (1.0 - borderWidth))/borderWidth);\n outputColor.rgb = mix(outputColor.rgb, v_stroke.rgb, linear);\n } else if(v <= strokeWidth) {\n float linear = smoothstep(0.0, 1.0, v/strokeWidth);\n outputColor.rgb = mix(v_stroke.rgb, outputColor.rgb, linear);\n }\n }\n\n if(v < borderOuterWidth) {\n outputColor.a = mix(0.0, outputColor.a, v/borderOuterWidth);\n } else if(v > 1.0 - borderOuterWidth) {\n outputColor.a = mix(outputColor.a, 0.0, (v - (1.0 - borderOuterWidth))/borderOuterWidth);\n }\n }\n\n // blur\n float blurV = v_texture_data.a;\n if(blurV < 0.5) {\n outputColor.a *= mix(u_blur.r, u_blur.g, blurV/0.5);\n } else {\n outputColor.a *= mix(u_blur.g, u_blur.b, (blurV - 0.5)/0.5);\n }\n \n outputColor = filterColor(outputColor);\n}\n";
|
|
22
22
|
/* babel-plugin-inline-import '../shaders/line/line_vert.glsl' */
|
|
23
23
|
var line_vert = "\n#define Animate 0.0\n\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in vec2 a_Size;\nlayout(location = 10) in vec3 a_DistanceAndIndexAndMiter;\nlayout(location = 13) in vec4 a_Normal_Total_Distance;\nlayout(location = 14) in vec2 a_iconMapUV;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array;\n vec4 u_blur;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed: 0.0;\n float u_vertexScale: 1.0;\n float u_raisingHeight: 0.0;\n float u_strokeWidth: 0.0;\n float u_textureBlend;\n float u_line_texture;\n float u_linearDir: 1.0;\n float u_linearColor: 0;\n float u_time;\n};\n\n\nout vec4 v_color;\nout vec4 v_stroke;\n//dash\nout vec4 v_dash_array;\nout float v_d_distance_ratio;\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nout vec2 v_iconMapUV;\nout vec4 v_texture_data;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec2 a_DistanceAndIndex = a_DistanceAndIndexAndMiter.xy;\n float a_Miter = a_DistanceAndIndexAndMiter.z;\n vec3 a_Normal = a_Normal_Total_Distance.xyz;\n float a_Total_Distance = a_Normal_Total_Distance.w;\n //dash\u8F93\u51FA\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_Total_Distance;\n v_d_distance_ratio = a_DistanceAndIndex.x / a_Total_Distance;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n v_iconMapUV = a_iconMapUV;\n d_texPixelLen = project_float_pixel(u_icon_step);\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n v_color = a_Color;\n v_color.a *= opacity;\n v_stroke = stroke;\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n float lineDistance = a_DistanceAndIndex.x;\n float currentLinePointRatio = lineDistance / a_Total_Distance;\n \n\n float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\uFF08\u5411\u4E24\u4FA7\u504F\u79FB\u7684\u548C\uFF09\n float linePixelSize = project_pixel(a_Size.x) * 2.0; // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB \u5355\u4FA7 * 2\n float texV = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n \n v_texture_data = vec4(currentLinePointRatio, lineDistance, d_texPixelLen, texV);\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5 vertex height\n float lineHeight = a_Size.y; // size \u7B2C\u4E8C\u4E2A\u53C2\u6570\u4EE3\u8868\u7684\u9AD8\u5EA6 [linewidth, lineheight]\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n lineHeight *= 0.2; // \u4FDD\u6301\u548C amap/mapbox \u4E00\u81F4\u7684\u6548\u679C\n h *= 0.2;\n if(u_heightfixed < 1.0) {\n lineHeight = project_pixel(a_Size.y);\n }\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h + u_raisingHeight, 1.0));\n } else {\n // mapbox - amap\n \n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // mapbox\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n h *= mapboxZoomScale;\n h += u_raisingHeight * mapboxZoomScale;\n if(u_heightfixed > 0.0) {\n lineHeight *= mapboxZoomScale;\n }\n \n } else {\n // amap\n h += u_raisingHeight;\n // lineHeight \u9876\u70B9\u504F\u79FB\u9AD8\u5EA6\n if(u_heightfixed < 1.0) {\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
24
|
-
var lineStyleObj = {
|
|
25
|
-
solid: 0.0,
|
|
26
|
-
dash: 1.0
|
|
27
|
-
};
|
|
28
24
|
var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
29
25
|
_inherits(LineModel, _BaseModel);
|
|
30
26
|
var _super = _createSuper(LineModel);
|
|
@@ -100,7 +96,8 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
100
96
|
u_dash_array.push(0, 0);
|
|
101
97
|
}
|
|
102
98
|
if (this.rendererService.getDirty() && this.texture) {
|
|
103
|
-
|
|
99
|
+
var _this$texture;
|
|
100
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.bind();
|
|
104
101
|
}
|
|
105
102
|
var _ref2 = this.layer.getLayerConfig(),
|
|
106
103
|
animateOption = _ref2.animateOption;
|
|
@@ -175,8 +172,8 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
175
172
|
}, {
|
|
176
173
|
key: "clearModels",
|
|
177
174
|
value: function clearModels() {
|
|
178
|
-
var _this$
|
|
179
|
-
(_this$
|
|
175
|
+
var _this$texture2;
|
|
176
|
+
(_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
|
|
180
177
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
181
178
|
}
|
|
182
179
|
}, {
|
|
@@ -188,7 +185,7 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
188
185
|
while (1) switch (_context2.prev = _context2.next) {
|
|
189
186
|
case 0:
|
|
190
187
|
_ref3 = this.layer.getLayerConfig(), _ref3$depth = _ref3.depth, depth = _ref3$depth === void 0 ? false : _ref3$depth;
|
|
191
|
-
_this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
|
|
188
|
+
_this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
|
|
192
189
|
this.layer.triangulation = LineTriangulation;
|
|
193
190
|
_context2.next = 5;
|
|
194
191
|
return this.layer.buildLayerModel({
|
|
@@ -8,7 +8,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
8
8
|
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); }; }
|
|
9
9
|
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; } }
|
|
10
10
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
11
|
-
import {
|
|
11
|
+
import { rgb2arr } from '@antv/l7-utils';
|
|
12
12
|
import BaseModel from "../../core/BaseModel";
|
|
13
13
|
import { SimpleLineTriangulation } from "../../core/triangulation";
|
|
14
14
|
/* babel-plugin-inline-import '../shaders/simple/simpleline_frag.glsl' */
|
|
@@ -16,7 +16,6 @@ var simple_line_frag = "\nlayout(std140) uniform commonUniorm {\n vec4 u_source
|
|
|
16
16
|
/* babel-plugin-inline-import '../shaders/simple/simpleline_vert.glsl' */
|
|
17
17
|
var simple_line_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in vec4 a_SizeDistanceAndTotalDistance;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec4 u_dash_array;\n float u_vertexScale: 1.0;\n float u_linearColor: 0;\n};\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nout vec4 v_color;\nout float v_distanceScale;\nout vec4 v_dash_array;\n\nvoid main() {\n //dash\u8F93\u51FA\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_SizeDistanceAndTotalDistance.a;\n\n v_color = a_Color; \n v_distanceScale = a_SizeDistanceAndTotalDistance.b / a_SizeDistanceAndTotalDistance.a;\n v_color.a = v_color.a * opacity;\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, project_pixel(a_SizeDistanceAndTotalDistance.y) + h * 0.2, 1.0));\n } else {\n float lineHeight = a_SizeDistanceAndTotalDistance.y;\n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n h *= 2.0/pow(2.0, 20.0 - u_Zoom);\n }\n\n // amap1.x\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, lineHeight + h, 1.0));\n gl_PointSize = 10.0;\n }\n}\n";
|
|
18
18
|
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
19
|
-
var isNumber = lodashUtil.isNumber;
|
|
20
19
|
var SimpleLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
21
20
|
_inherits(SimpleLineModel, _BaseModel);
|
|
22
21
|
var _super = _createSuper(SimpleLineModel);
|
package/es/line/models/wall.js
CHANGED
|
@@ -68,7 +68,8 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
68
68
|
var _ref2 = this.layer.getLayerConfig(),
|
|
69
69
|
animateOption = _ref2.animateOption;
|
|
70
70
|
if (this.rendererService.getDirty()) {
|
|
71
|
-
|
|
71
|
+
var _this$texture;
|
|
72
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.bind();
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
// 转化渐变色
|
|
@@ -130,8 +131,8 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
130
131
|
}, {
|
|
131
132
|
key: "clearModels",
|
|
132
133
|
value: function clearModels() {
|
|
133
|
-
var _this$
|
|
134
|
-
(_this$
|
|
134
|
+
var _this$texture2;
|
|
135
|
+
(_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
|
|
135
136
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
136
137
|
}
|
|
137
138
|
}, {
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import type { ILayer, ILayerPlugin,
|
|
2
|
-
import 'reflect-metadata';
|
|
1
|
+
import type { ILayer, ILayerPlugin, L7Container } from '@antv/l7-core';
|
|
3
2
|
export default class DataMappingPlugin implements ILayerPlugin {
|
|
4
|
-
private
|
|
5
|
-
private
|
|
6
|
-
apply(layer: ILayer, { styleAttributeService, }:
|
|
7
|
-
styleAttributeService: IStyleAttributeService;
|
|
8
|
-
}): void;
|
|
3
|
+
private mapService;
|
|
4
|
+
private fontService;
|
|
5
|
+
apply(layer: ILayer, { styleAttributeService, mapService, fontService }: L7Container): void;
|
|
9
6
|
private generateMaping;
|
|
10
7
|
private mapping;
|
|
11
8
|
private adjustData2Amap2Coordinates;
|
|
@@ -1,29 +1,24 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
-
import _initializerDefineProperty from "@babel/runtime/helpers/esm/initializerDefineProperty";
|
|
4
3
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
5
4
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
6
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
|
-
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
|
|
8
|
-
import _initializerWarningHelper from "@babel/runtime/helpers/esm/initializerWarningHelper";
|
|
9
|
-
var _dec, _dec2, _dec3, _class, _class2, _descriptor, _descriptor2;
|
|
10
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
11
|
-
import { IDebugLog, ILayerStage
|
|
6
|
+
import { IDebugLog, ILayerStage } from '@antv/l7-core';
|
|
12
7
|
import { lodashUtil, normalize, rgb2arr } from '@antv/l7-utils';
|
|
13
|
-
import { inject, injectable } from 'inversify';
|
|
14
|
-
import 'reflect-metadata';
|
|
15
8
|
var cloneDeep = lodashUtil.cloneDeep;
|
|
16
|
-
var DataMappingPlugin =
|
|
9
|
+
var DataMappingPlugin = /*#__PURE__*/function () {
|
|
17
10
|
function DataMappingPlugin() {
|
|
18
11
|
_classCallCheck(this, DataMappingPlugin);
|
|
19
|
-
_initializerDefineProperty(this, "mapService", _descriptor, this);
|
|
20
|
-
_initializerDefineProperty(this, "fontService", _descriptor2, this);
|
|
21
12
|
}
|
|
22
13
|
_createClass(DataMappingPlugin, [{
|
|
23
14
|
key: "apply",
|
|
24
15
|
value: function apply(layer, _ref) {
|
|
25
16
|
var _this = this;
|
|
26
|
-
var styleAttributeService = _ref.styleAttributeService
|
|
17
|
+
var styleAttributeService = _ref.styleAttributeService,
|
|
18
|
+
mapService = _ref.mapService,
|
|
19
|
+
fontService = _ref.fontService;
|
|
20
|
+
this.mapService = mapService;
|
|
21
|
+
this.fontService = fontService;
|
|
27
22
|
layer.hooks.init.tapPromise('DataMappingPlugin', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
28
23
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
29
24
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -276,15 +271,5 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IMapService),
|
|
|
276
271
|
}
|
|
277
272
|
}]);
|
|
278
273
|
return DataMappingPlugin;
|
|
279
|
-
}()
|
|
280
|
-
configurable: true,
|
|
281
|
-
enumerable: true,
|
|
282
|
-
writable: true,
|
|
283
|
-
initializer: null
|
|
284
|
-
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "fontService", [_dec3], {
|
|
285
|
-
configurable: true,
|
|
286
|
-
enumerable: true,
|
|
287
|
-
writable: true,
|
|
288
|
-
initializer: null
|
|
289
|
-
})), _class2)) || _class);
|
|
274
|
+
}();
|
|
290
275
|
export { DataMappingPlugin as default };
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
var _dec, _class;
|
|
5
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
|
-
import { IDebugLog, ILayerStage
|
|
5
|
+
import { IDebugLog, ILayerStage } from '@antv/l7-core';
|
|
7
6
|
import Source from '@antv/l7-source';
|
|
8
|
-
|
|
9
|
-
import 'reflect-metadata';
|
|
10
|
-
var DataSourcePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function () {
|
|
7
|
+
var DataSourcePlugin = /*#__PURE__*/function () {
|
|
11
8
|
function DataSourcePlugin() {
|
|
12
9
|
_classCallCheck(this, DataSourcePlugin);
|
|
13
10
|
}
|
|
@@ -15,7 +12,7 @@ var DataSourcePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
|
|
|
15
12
|
key: "apply",
|
|
16
13
|
value: function apply(layer) {
|
|
17
14
|
var _this = this;
|
|
18
|
-
this.mapService = layer.getContainer().
|
|
15
|
+
this.mapService = layer.getContainer().mapService;
|
|
19
16
|
layer.hooks.init.tapPromise('DataSourcePlugin', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
20
17
|
var source, _ref2, data, options;
|
|
21
18
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -102,5 +99,5 @@ var DataSourcePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
|
|
|
102
99
|
}
|
|
103
100
|
}]);
|
|
104
101
|
return DataSourcePlugin;
|
|
105
|
-
}()
|
|
102
|
+
}();
|
|
106
103
|
export { DataSourcePlugin as default };
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import type { ILayer, ILayerPlugin,
|
|
2
|
-
import 'reflect-metadata';
|
|
1
|
+
import type { ILayer, ILayerPlugin, L7Container } from '@antv/l7-core';
|
|
3
2
|
/**
|
|
4
3
|
* 根据 Source 原始数据为指定字段创建 Scale,保存在 StyleAttribute 上,供下游插件使用
|
|
5
4
|
*/
|
|
6
5
|
export default class FeatureScalePlugin implements ILayerPlugin {
|
|
7
6
|
private scaleOptions;
|
|
8
|
-
apply(layer: ILayer, { styleAttributeService
|
|
9
|
-
styleAttributeService: IStyleAttributeService;
|
|
10
|
-
}): void;
|
|
7
|
+
apply(layer: ILayer, { styleAttributeService }: L7Container): void;
|
|
11
8
|
private isNumber;
|
|
12
9
|
private caculateScalesForAttributes;
|
|
13
10
|
/**
|
|
@@ -3,15 +3,13 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
3
3
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
|
-
var _scaleMap
|
|
6
|
+
var _scaleMap;
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
import { IDebugLog, ILayerStage, ScaleTypes, StyleScaleType } from '@antv/l7-core';
|
|
9
9
|
import { lodashUtil } from '@antv/l7-utils';
|
|
10
10
|
import { extent } from 'd3-array';
|
|
11
11
|
import * as d3interpolate from 'd3-interpolate';
|
|
12
12
|
import * as d3 from 'd3-scale';
|
|
13
|
-
import { injectable } from 'inversify';
|
|
14
|
-
import 'reflect-metadata';
|
|
15
13
|
import identity from "../utils/identityScale";
|
|
16
14
|
var isNil = lodashUtil.isNil,
|
|
17
15
|
isString = lodashUtil.isString,
|
|
@@ -21,7 +19,7 @@ var scaleMap = (_scaleMap = {}, _defineProperty(_scaleMap, ScaleTypes.LINEAR, d3
|
|
|
21
19
|
/**
|
|
22
20
|
* 根据 Source 原始数据为指定字段创建 Scale,保存在 StyleAttribute 上,供下游插件使用
|
|
23
21
|
*/
|
|
24
|
-
var FeatureScalePlugin =
|
|
22
|
+
var FeatureScalePlugin = /*#__PURE__*/function () {
|
|
25
23
|
function FeatureScalePlugin() {
|
|
26
24
|
_classCallCheck(this, FeatureScalePlugin);
|
|
27
25
|
_defineProperty(this, "scaleOptions", {});
|
|
@@ -280,7 +278,7 @@ var FeatureScalePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
|
|
|
280
278
|
// quantile domain 需要根据ID 进行去重
|
|
281
279
|
var values = [];
|
|
282
280
|
if (type === ScaleTypes.QUANTILE) {
|
|
283
|
-
// 根据 obejct 属性 _id 进行去重
|
|
281
|
+
// 根据 obejct 属性 _id 进行去重
|
|
284
282
|
var idMap = new Map();
|
|
285
283
|
data === null || data === void 0 || data.forEach(function (obj) {
|
|
286
284
|
idMap.set(obj._id, obj[field]);
|
|
@@ -336,5 +334,5 @@ var FeatureScalePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
|
|
|
336
334
|
}
|
|
337
335
|
}]);
|
|
338
336
|
return FeatureScalePlugin;
|
|
339
|
-
}()
|
|
337
|
+
}();
|
|
340
338
|
export { FeatureScalePlugin as default };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
var
|
|
5
|
-
import { injectable } from 'inversify';
|
|
6
|
-
import 'reflect-metadata';
|
|
7
|
-
var LayerAnimateStylePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function () {
|
|
4
|
+
var LayerAnimateStylePlugin = /*#__PURE__*/function () {
|
|
8
5
|
function LayerAnimateStylePlugin() {
|
|
9
6
|
_classCallCheck(this, LayerAnimateStylePlugin);
|
|
10
7
|
}
|
|
@@ -23,5 +20,5 @@ var LayerAnimateStylePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/f
|
|
|
23
20
|
}
|
|
24
21
|
}]);
|
|
25
22
|
return LayerAnimateStylePlugin;
|
|
26
|
-
}()
|
|
23
|
+
}();
|
|
27
24
|
export { LayerAnimateStylePlugin as default };
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
1
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
var _dec, _class;
|
|
5
|
-
import { injectable } from 'inversify';
|
|
6
|
-
import 'reflect-metadata';
|
|
7
3
|
/**
|
|
8
4
|
* 更新图层样式,初始图层相关配置
|
|
9
5
|
*/
|
|
10
|
-
var LayerStylePlugin =
|
|
6
|
+
var LayerStylePlugin = /*#__PURE__*/function () {
|
|
11
7
|
function LayerStylePlugin() {
|
|
12
8
|
_classCallCheck(this, LayerStylePlugin);
|
|
13
9
|
}
|
|
@@ -20,8 +16,6 @@ var LayerStylePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
|
|
|
20
16
|
enableMask = _layer$getLayerConfig.enableMask;
|
|
21
17
|
// mask 初始化
|
|
22
18
|
if (!layer.tileLayer && maskLayers && maskLayers.length > 0) {
|
|
23
|
-
var _layer$masks;
|
|
24
|
-
(_layer$masks = layer.masks).push.apply(_layer$masks, _toConsumableArray(maskLayers));
|
|
25
19
|
layer.updateLayerConfig({
|
|
26
20
|
mask: true && enableMask
|
|
27
21
|
});
|
|
@@ -30,5 +24,5 @@ var LayerStylePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
|
|
|
30
24
|
}
|
|
31
25
|
}]);
|
|
32
26
|
return LayerStylePlugin;
|
|
33
|
-
}()
|
|
27
|
+
}();
|
|
34
28
|
export { LayerStylePlugin as default };
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
var _dec, _class;
|
|
5
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
5
|
import { IDebugLog, ILayerStage } from '@antv/l7-core';
|
|
7
|
-
import
|
|
8
|
-
import 'reflect-metadata';
|
|
9
|
-
import TileLayer from "../tile/core/BaseLayer";
|
|
6
|
+
// import TileLayer from '../tile/core/BaseLayer';
|
|
10
7
|
/**
|
|
11
8
|
* Layer Model 初始化,更新,销毁
|
|
12
9
|
*/
|
|
13
|
-
var LayerModelPlugin =
|
|
10
|
+
var LayerModelPlugin = /*#__PURE__*/function () {
|
|
14
11
|
function LayerModelPlugin() {
|
|
15
12
|
_classCallCheck(this, LayerModelPlugin);
|
|
16
13
|
}
|
|
@@ -90,19 +87,18 @@ var LayerModelPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
|
|
|
90
87
|
while (1) switch (_context4.prev = _context4.next) {
|
|
91
88
|
case 0:
|
|
92
89
|
if (!layer.getSource().isTile) {
|
|
93
|
-
_context4.next =
|
|
90
|
+
_context4.next = 3;
|
|
94
91
|
break;
|
|
95
92
|
}
|
|
96
93
|
layer.prepareBuildModel();
|
|
97
|
-
layer.tileLayer = new TileLayer(layer);
|
|
98
94
|
return _context4.abrupt("return");
|
|
99
|
-
case
|
|
95
|
+
case 3:
|
|
100
96
|
layer.log(IDebugLog.BuildModelStart, ILayerStage.INIT);
|
|
101
|
-
_context4.next =
|
|
97
|
+
_context4.next = 6;
|
|
102
98
|
return _this.initLayerModel(layer);
|
|
103
|
-
case
|
|
99
|
+
case 6:
|
|
104
100
|
layer.log(IDebugLog.BuildModelEnd, ILayerStage.INIT);
|
|
105
|
-
case
|
|
101
|
+
case 7:
|
|
106
102
|
case "end":
|
|
107
103
|
return _context4.stop();
|
|
108
104
|
}
|
|
@@ -120,19 +116,18 @@ var LayerModelPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
|
|
|
120
116
|
return _context5.abrupt("return", false);
|
|
121
117
|
case 2:
|
|
122
118
|
if (!layer.getSource().isTile) {
|
|
123
|
-
_context5.next =
|
|
119
|
+
_context5.next = 4;
|
|
124
120
|
break;
|
|
125
121
|
}
|
|
126
|
-
layer.tileLayer = new TileLayer(layer);
|
|
127
122
|
return _context5.abrupt("return", false);
|
|
128
|
-
case
|
|
123
|
+
case 4:
|
|
129
124
|
layer.log(IDebugLog.BuildModelStart, ILayerStage.UPDATE);
|
|
130
|
-
_context5.next =
|
|
125
|
+
_context5.next = 7;
|
|
131
126
|
return _this.prepareLayerModel(layer);
|
|
132
|
-
case
|
|
127
|
+
case 7:
|
|
133
128
|
layer.log(IDebugLog.BuildModelEnd, ILayerStage.UPDATE);
|
|
134
129
|
return _context5.abrupt("return", true);
|
|
135
|
-
case
|
|
130
|
+
case 9:
|
|
136
131
|
case "end":
|
|
137
132
|
return _context5.stop();
|
|
138
133
|
}
|
|
@@ -145,5 +140,5 @@ var LayerModelPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
|
|
|
145
140
|
}
|
|
146
141
|
}]);
|
|
147
142
|
return LayerModelPlugin;
|
|
148
|
-
}()
|
|
143
|
+
}();
|
|
149
144
|
export { LayerModelPlugin as default };
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
var _dec, _class;
|
|
4
|
-
import { injectable } from 'inversify';
|
|
5
|
-
import 'reflect-metadata';
|
|
6
3
|
/**
|
|
7
4
|
* 更新图层样式,初始图层相关配置
|
|
8
5
|
*/
|
|
9
|
-
var LayerStylePlugin =
|
|
6
|
+
var LayerStylePlugin = /*#__PURE__*/function () {
|
|
10
7
|
function LayerStylePlugin() {
|
|
11
8
|
_classCallCheck(this, LayerStylePlugin);
|
|
12
9
|
}
|
|
@@ -26,5 +23,5 @@ var LayerStylePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
|
|
|
26
23
|
}
|
|
27
24
|
}]);
|
|
28
25
|
return LayerStylePlugin;
|
|
29
|
-
}()
|
|
26
|
+
}();
|
|
30
27
|
export { LayerStylePlugin as default };
|