@antv/l7-layers 2.9.25-alpha.0 → 2.9.25
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/heatmap/models/heatmap.js +1 -1
- package/es/tile/utils.js +1 -1
- package/lib/Geometry/index.js +114 -77
- package/lib/Geometry/models/billboard.js +232 -181
- package/lib/Geometry/models/index.js +18 -34
- package/lib/Geometry/models/plane.js +407 -278
- package/lib/Geometry/models/sprite.js +291 -189
- package/lib/canvas/index.js +101 -66
- package/lib/canvas/models/canvas.js +207 -140
- package/lib/canvas/models/index.js +12 -30
- package/lib/citybuliding/building.js +98 -63
- package/lib/citybuliding/models/build.js +192 -146
- package/lib/core/BaseLayer.js +1331 -814
- package/lib/core/BaseModel.js +457 -279
- package/lib/core/interface.js +40 -53
- package/lib/core/schema.js +21 -39
- package/lib/core/shape/Path.js +67 -79
- package/lib/core/shape/extrude.js +132 -91
- package/lib/core/triangulation.js +378 -196
- package/lib/earth/index.js +100 -62
- package/lib/earth/models/atmosphere.js +146 -112
- package/lib/earth/models/base.js +210 -150
- package/lib/earth/models/bloomsphere.js +146 -112
- package/lib/earth/utils.js +111 -91
- package/lib/heatmap/index.js +149 -92
- package/lib/heatmap/models/grid.js +118 -91
- package/lib/heatmap/models/grid3d.js +155 -123
- package/lib/heatmap/models/heatmap.js +475 -338
- package/lib/heatmap/models/hexagon.js +121 -92
- package/lib/heatmap/models/index.js +22 -37
- package/lib/heatmap/triangulation.js +31 -47
- package/lib/image/index.js +111 -74
- package/lib/image/models/dataImage.js +232 -174
- package/lib/image/models/image.js +175 -128
- package/lib/image/models/index.js +15 -32
- package/lib/index.js +263 -97
- package/lib/line/index.js +131 -85
- package/lib/line/models/arc.js +352 -237
- package/lib/line/models/arc_3d.js +334 -228
- package/lib/line/models/earthArc_3d.js +336 -228
- package/lib/line/models/great_circle.js +291 -200
- package/lib/line/models/half.js +286 -201
- package/lib/line/models/index.js +42 -50
- package/lib/line/models/line.js +428 -299
- package/lib/line/models/linearline.js +277 -203
- package/lib/line/models/simpleLine.js +239 -175
- package/lib/line/models/tile.js +348 -237
- package/lib/line/models/wall.js +327 -235
- package/lib/mask/index.js +92 -59
- package/lib/mask/models/fill.js +134 -82
- package/lib/mask/models/index.js +12 -30
- package/lib/plugins/DataMappingPlugin.js +342 -224
- package/lib/plugins/DataSourcePlugin.js +102 -87
- package/lib/plugins/FeatureScalePlugin.js +330 -240
- package/lib/plugins/LayerAnimateStylePlugin.js +61 -55
- package/lib/plugins/LayerModelPlugin.js +80 -73
- package/lib/plugins/LayerStylePlugin.js +48 -51
- package/lib/plugins/LightingPlugin.js +80 -68
- package/lib/plugins/MultiPassRendererPlugin.js +91 -65
- package/lib/plugins/PixelPickingPlugin.js +150 -109
- package/lib/plugins/RegisterStyleAttributePlugin.js +110 -110
- package/lib/plugins/ShaderUniformPlugin.js +118 -99
- package/lib/plugins/UpdateModelPlugin.js +40 -47
- package/lib/plugins/UpdateStyleAttributePlugin.js +93 -75
- package/lib/point/index.js +226 -150
- package/lib/point/models/earthExtrude.js +279 -201
- package/lib/point/models/earthFill.js +287 -202
- package/lib/point/models/extrude.js +299 -203
- package/lib/point/models/fill.js +406 -275
- package/lib/point/models/fillmage.js +365 -256
- package/lib/point/models/image.js +241 -168
- package/lib/point/models/index.js +46 -52
- package/lib/point/models/normal.js +183 -134
- package/lib/point/models/radar.js +304 -211
- package/lib/point/models/simplePoint.js +194 -142
- package/lib/point/models/text.js +608 -385
- package/lib/point/models/tile.js +314 -223
- package/lib/point/shape/extrude.js +56 -52
- package/lib/polygon/index.js +154 -102
- package/lib/polygon/models/extrude.js +311 -223
- package/lib/polygon/models/fill.js +215 -153
- package/lib/polygon/models/index.js +46 -52
- package/lib/polygon/models/ocean.js +244 -173
- package/lib/polygon/models/tile.js +144 -100
- package/lib/polygon/models/water.js +222 -153
- package/lib/raster/buffers/triangulation.js +27 -40
- package/lib/raster/index.js +115 -75
- package/lib/raster/models/index.js +16 -33
- package/lib/raster/models/raster.js +178 -135
- package/lib/raster/raster.js +187 -132
- package/lib/tile/interface.js +4 -16
- package/lib/tile/manager/tileConfigManager.js +125 -86
- package/lib/tile/manager/tileLayerManager.js +313 -229
- package/lib/tile/manager/tilePickerManager.js +192 -123
- package/lib/tile/models/tileModel.js +71 -52
- package/lib/tile/tileFactory/base.js +432 -309
- package/lib/tile/tileFactory/index.js +51 -49
- package/lib/tile/tileFactory/line.js +65 -50
- package/lib/tile/tileFactory/point.js +65 -50
- package/lib/tile/tileFactory/polygon.js +65 -50
- package/lib/tile/tileFactory/raster.js +66 -54
- package/lib/tile/tileFactory/rasterData.js +88 -76
- package/lib/tile/tileFactory/rasterDataLayer.js +97 -62
- package/lib/tile/tileFactory/vectorLayer.js +168 -109
- package/lib/tile/tileLayer/baseTileLayer.js +420 -221
- package/lib/tile/tmsTileLayer.js +110 -67
- package/lib/tile/utils.js +110 -92
- package/lib/utils/blend.js +59 -79
- package/lib/utils/collision-index.js +107 -64
- package/lib/utils/dataMappingStyle.js +105 -60
- package/lib/utils/extrude_polyline.js +600 -398
- package/lib/utils/grid-index.js +163 -111
- package/lib/utils/layerData.js +130 -99
- package/lib/utils/multiPassRender.js +49 -41
- package/lib/utils/polylineNormal.js +148 -96
- package/lib/utils/simpleLine.js +100 -85
- package/lib/utils/symbol-layout.js +219 -116
- package/lib/utils/updateShape.js +15 -41
- package/lib/wind/index.js +109 -71
- package/lib/wind/models/index.js +12 -30
- package/lib/wind/models/utils.js +144 -105
- package/lib/wind/models/wind.js +333 -224
- package/lib/wind/models/windRender.js +329 -218
- package/lib/wind/models/windShader.js +23 -181
- package/package.json +6 -6
|
@@ -1,208 +1,293 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
-
|
|
22
|
-
// src/point/models/earthFill.ts
|
|
23
|
-
var earthFill_exports = {};
|
|
24
|
-
__export(earthFill_exports, {
|
|
25
|
-
default: () => FillModel
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
26
7
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
flipY: true,
|
|
72
|
-
data: [1],
|
|
73
|
-
format: import_l7_core.gl.LUMINANCE,
|
|
74
|
-
type: import_l7_core.gl.FLOAT,
|
|
75
|
-
width: 1,
|
|
76
|
-
height: 1
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
|
-
u_blur: blur,
|
|
81
|
-
u_additive: blend === "additive" ? 1 : 0,
|
|
82
|
-
u_dataTexture: this.dataTexture,
|
|
83
|
-
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
84
|
-
u_opacity: (0, import_lodash.isNumber)(opacity) ? opacity : 1,
|
|
85
|
-
u_stroke_opacity: (0, import_lodash.isNumber)(strokeOpacity) ? strokeOpacity : 1,
|
|
86
|
-
u_stroke_width: (0, import_lodash.isNumber)(strokeWidth) ? strokeWidth : 1,
|
|
87
|
-
u_stroke_color: this.getStrokeColor(stroke),
|
|
88
|
-
u_offsets: this.isOffsetStatic(offsets) ? offsets : [0, 0]
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
getAnimateUniforms() {
|
|
92
|
-
const {
|
|
93
|
-
animateOption = { enable: false }
|
|
94
|
-
} = this.layer.getLayerConfig();
|
|
95
|
-
return {
|
|
96
|
-
u_aimate: this.animateOption2Array(animateOption),
|
|
97
|
-
u_time: this.layer.getLayerAnimateTime()
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
initModels(callbackModel) {
|
|
101
|
-
this.buildModels(callbackModel);
|
|
102
|
-
}
|
|
103
|
-
buildModels(callbackModel) {
|
|
104
|
-
this.layer.triangulation = import_triangulation.GlobelPointFillTriangulation;
|
|
105
|
-
this.layer.buildLayerModel({
|
|
106
|
-
moduleName: "pointEarthFill",
|
|
107
|
-
vertexShader: import_fill_vert.default,
|
|
108
|
-
fragmentShader: import_fill_frag.default,
|
|
109
|
-
triangulation: import_triangulation.GlobelPointFillTriangulation,
|
|
110
|
-
depth: { enable: true },
|
|
111
|
-
blend: this.getBlend()
|
|
112
|
-
}).then((model) => {
|
|
113
|
-
callbackModel([model]);
|
|
114
|
-
}).catch((err) => {
|
|
115
|
-
console.warn(err);
|
|
116
|
-
callbackModel([]);
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
clearModels() {
|
|
120
|
-
var _a;
|
|
121
|
-
(_a = this.dataTexture) == null ? void 0 : _a.destroy();
|
|
122
|
-
}
|
|
123
|
-
animateOption2Array(option) {
|
|
124
|
-
return [option.enable ? 0 : 1, option.speed || 1, option.rings || 3, 0];
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
+
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
+
|
|
16
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
+
|
|
18
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
+
|
|
20
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
+
|
|
22
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
+
|
|
24
|
+
var _l7Core = require("@antv/l7-core");
|
|
25
|
+
|
|
26
|
+
var _lodash = require("lodash");
|
|
27
|
+
|
|
28
|
+
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
29
|
+
|
|
30
|
+
var _triangulation = require("../../core/triangulation");
|
|
31
|
+
|
|
32
|
+
var _glMatrix = require("gl-matrix");
|
|
33
|
+
|
|
34
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
35
|
+
|
|
36
|
+
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; } }
|
|
37
|
+
|
|
38
|
+
/* babel-plugin-inline-import '../shaders/earth/fill_frag.glsl' */
|
|
39
|
+
var pointFillFrag = "uniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n float opacity = styleMappingMat[0][0];\n float stroke_opacity = styleMappingMat[0][1];\n float strokeWidth = styleMappingMat[0][2];\n vec4 strokeColor = textrueStroke == vec4(0) ? v_color : textrueStroke;\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius + strokeWidth);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n } else if (shape == 1) {\n outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n } else if (shape == 2) {\n outer_df = sdBox(v_data.xy, vec2(1.));\n inner_df = sdBox(v_data.xy, vec2(r));\n } else if (shape == 3) {\n outer_df = sdPentagon(v_data.xy, 0.8);\n inner_df = sdPentagon(v_data.xy, r * 0.8);\n } else if (shape == 4) {\n outer_df = sdHexagon(v_data.xy, 0.8);\n inner_df = sdHexagon(v_data.xy, r * 0.8);\n } else if (shape == 5) {\n outer_df = sdOctogon(v_data.xy, 1.0);\n inner_df = sdOctogon(v_data.xy, r);\n } else if (shape == 6) {\n outer_df = sdHexagram(v_data.xy, 0.52);\n inner_df = sdHexagram(v_data.xy, r * 0.52);\n } else if (shape == 7) {\n outer_df = sdRhombus(v_data.xy, vec2(1.0));\n inner_df = sdRhombus(v_data.xy, vec2(r));\n } else if (shape == 8) {\n outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n }\n\n if(outer_df > antialiasblur + 0.018) discard;\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = strokeWidth < 0.01 ? 0.0 : smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n\n if(strokeWidth < 0.01) {\n gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);\n } else {\n gl_FragColor = mix(vec4(v_color.rgb, v_color.a * opacity), strokeColor * stroke_opacity, color_t);\n }\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n gl_FragColor = filterColorAlpha(gl_FragColor, gl_FragColor.a);\n } else {\n gl_FragColor.a *= opacity_t;\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
|
|
40
|
+
|
|
41
|
+
/* babel-plugin-inline-import '../shaders/earth/fill_vert.glsl' */
|
|
42
|
+
var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\nuniform float u_opacity : 1;\nuniform float u_stroke_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\nuniform vec2 u_offsets;\n\nuniform float u_blur : 0.0;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalStrokeOpacity\"\n#pragma include \"styleMappingCalStrokeWidth\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n /*\n * setPickingSize \u8BBE\u7F6E\u62FE\u53D6\u5927\u5C0F\n */\n float newSize = setPickingSize(a_Size);\n // float newSize = setPickingSize(a_Size) * 0.00001038445708445579;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 strokeOpacityAndOffset = calStrokeOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = strokeOpacityAndOffset.r;\n textureOffset = strokeOpacityAndOffset.g;\n\n vec2 strokeWidthAndOffset = calStrokeWidthAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][2] = strokeWidthAndOffset.r;\n textureOffset = strokeWidthAndOffset.g;\n\n vec4 textrueStroke = vec4(-1.0, -1.0, -1.0, -1.0);\n if(hasStroke()) {\n vec2 valueRPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][0] = pos2value(valueRPos, columnWidth, rowHeight); // R\n textureOffset += 1.0;\n\n vec2 valueGPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][1] = pos2value(valueGPos, columnWidth, rowHeight); // G\n textureOffset += 1.0;\n\n vec2 valueBPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][2] = pos2value(valueBPos, columnWidth, rowHeight); // B\n textureOffset += 1.0;\n\n vec2 valueAPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][3] = pos2value(valueAPos, columnWidth, rowHeight); // A\n textureOffset += 1.0;\n } else {\n if(u_stroke_color == vec4(0.0)) {\n styleMappingMat[1][0] = v_color.r;\n styleMappingMat[1][1] = v_color.g;\n styleMappingMat[1][2] = v_color.b;\n styleMappingMat[1][3] = v_color.a;\n } else {\n styleMappingMat[1][0] = u_stroke_color.r;\n styleMappingMat[1][1] = u_stroke_color.g;\n styleMappingMat[1][2] = u_stroke_color.b;\n styleMappingMat[1][3] = u_stroke_color.a;\n }\n }\n\n // cal style mapping\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // radius(16-bit)\n v_radius = newSize;\n\n // TODO: billboard\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur);\n\n // TODP: /abs(extrude.x) \u662F\u4E3A\u4E86\u517C\u5BB9\u5730\u7403\u6A21\u5F0F\n v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);\n\n\n gl_Position = u_ViewProjectionMatrix * vec4(a_Position + extrude * newSize * 0.1, 1.0);\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
43
|
+
|
|
44
|
+
var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
45
|
+
(0, _inherits2.default)(FillModel, _BaseModel);
|
|
46
|
+
|
|
47
|
+
var _super = _createSuper(FillModel);
|
|
48
|
+
|
|
49
|
+
function FillModel() {
|
|
50
|
+
(0, _classCallCheck2.default)(this, FillModel);
|
|
51
|
+
return _super.apply(this, arguments);
|
|
125
52
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
53
|
+
|
|
54
|
+
(0, _createClass2.default)(FillModel, [{
|
|
55
|
+
key: "getUninforms",
|
|
56
|
+
value: function getUninforms() {
|
|
57
|
+
var _ref = this.layer.getLayerConfig(),
|
|
58
|
+
_ref$opacity = _ref.opacity,
|
|
59
|
+
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
60
|
+
_ref$strokeOpacity = _ref.strokeOpacity,
|
|
61
|
+
strokeOpacity = _ref$strokeOpacity === void 0 ? 1 : _ref$strokeOpacity,
|
|
62
|
+
_ref$strokeWidth = _ref.strokeWidth,
|
|
63
|
+
strokeWidth = _ref$strokeWidth === void 0 ? 0 : _ref$strokeWidth,
|
|
64
|
+
_ref$stroke = _ref.stroke,
|
|
65
|
+
stroke = _ref$stroke === void 0 ? 'rgba(0,0,0,0)' : _ref$stroke,
|
|
66
|
+
_ref$offsets = _ref.offsets,
|
|
67
|
+
offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets,
|
|
68
|
+
blend = _ref.blend,
|
|
69
|
+
_ref$blur = _ref.blur,
|
|
70
|
+
blur = _ref$blur === void 0 ? 0 : _ref$blur;
|
|
71
|
+
|
|
72
|
+
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
73
|
+
opacity: opacity,
|
|
74
|
+
strokeOpacity: strokeOpacity,
|
|
75
|
+
strokeWidth: strokeWidth,
|
|
76
|
+
stroke: stroke,
|
|
77
|
+
offsets: offsets
|
|
78
|
+
})) {
|
|
79
|
+
// 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量
|
|
80
|
+
this.judgeStyleAttributes({
|
|
81
|
+
opacity: opacity,
|
|
82
|
+
strokeOpacity: strokeOpacity,
|
|
83
|
+
strokeWidth: strokeWidth,
|
|
84
|
+
stroke: stroke,
|
|
85
|
+
offsets: offsets
|
|
86
|
+
});
|
|
87
|
+
var encodeData = this.layer.getEncodedData();
|
|
88
|
+
|
|
89
|
+
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
90
|
+
data = _this$calDataFrame.data,
|
|
91
|
+
width = _this$calDataFrame.width,
|
|
92
|
+
height = _this$calDataFrame.height;
|
|
93
|
+
|
|
94
|
+
this.rowCount = height; // 当前数据纹理有多少行
|
|
95
|
+
|
|
96
|
+
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
97
|
+
flipY: true,
|
|
98
|
+
data: data,
|
|
99
|
+
format: _l7Core.gl.LUMINANCE,
|
|
100
|
+
type: _l7Core.gl.FLOAT,
|
|
101
|
+
width: width,
|
|
102
|
+
height: height
|
|
103
|
+
}) : this.createTexture2D({
|
|
104
|
+
flipY: true,
|
|
105
|
+
data: [1],
|
|
106
|
+
format: _l7Core.gl.LUMINANCE,
|
|
107
|
+
type: _l7Core.gl.FLOAT,
|
|
108
|
+
width: 1,
|
|
109
|
+
height: 1
|
|
110
|
+
});
|
|
167
111
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
112
|
+
|
|
113
|
+
return {
|
|
114
|
+
u_blur: blur,
|
|
115
|
+
u_additive: blend === 'additive' ? 1.0 : 0.0,
|
|
116
|
+
u_dataTexture: this.dataTexture,
|
|
117
|
+
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
118
|
+
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
119
|
+
u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1.0,
|
|
120
|
+
u_stroke_opacity: (0, _lodash.isNumber)(strokeOpacity) ? strokeOpacity : 1.0,
|
|
121
|
+
u_stroke_width: (0, _lodash.isNumber)(strokeWidth) ? strokeWidth : 1.0,
|
|
122
|
+
u_stroke_color: this.getStrokeColor(stroke),
|
|
123
|
+
u_offsets: this.isOffsetStatic(offsets) ? offsets : [0, 0]
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}, {
|
|
127
|
+
key: "getAnimateUniforms",
|
|
128
|
+
value: function getAnimateUniforms() {
|
|
129
|
+
var _ref2 = this.layer.getLayerConfig(),
|
|
130
|
+
_ref2$animateOption = _ref2.animateOption,
|
|
131
|
+
animateOption = _ref2$animateOption === void 0 ? {
|
|
132
|
+
enable: false
|
|
133
|
+
} : _ref2$animateOption;
|
|
134
|
+
|
|
135
|
+
return {
|
|
136
|
+
u_aimate: this.animateOption2Array(animateOption),
|
|
137
|
+
u_time: this.layer.getLayerAnimateTime()
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}, {
|
|
141
|
+
key: "initModels",
|
|
142
|
+
value: function initModels(callbackModel) {
|
|
143
|
+
this.buildModels(callbackModel);
|
|
144
|
+
}
|
|
145
|
+
}, {
|
|
146
|
+
key: "buildModels",
|
|
147
|
+
value: function buildModels(callbackModel) {
|
|
148
|
+
this.layer.triangulation = _triangulation.GlobelPointFillTriangulation;
|
|
149
|
+
this.layer.buildLayerModel({
|
|
150
|
+
moduleName: 'pointEarthFill',
|
|
151
|
+
vertexShader: pointFillVert,
|
|
152
|
+
fragmentShader: pointFillFrag,
|
|
153
|
+
triangulation: _triangulation.GlobelPointFillTriangulation,
|
|
154
|
+
depth: {
|
|
155
|
+
enable: true
|
|
178
156
|
},
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
157
|
+
blend: this.getBlend()
|
|
158
|
+
}).then(function (model) {
|
|
159
|
+
callbackModel([model]);
|
|
160
|
+
}).catch(function (err) {
|
|
161
|
+
console.warn(err);
|
|
162
|
+
callbackModel([]);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}, {
|
|
166
|
+
key: "clearModels",
|
|
167
|
+
value: function clearModels() {
|
|
168
|
+
var _this$dataTexture;
|
|
169
|
+
|
|
170
|
+
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
171
|
+
} // overwrite baseModel func
|
|
172
|
+
|
|
173
|
+
}, {
|
|
174
|
+
key: "animateOption2Array",
|
|
175
|
+
value: function animateOption2Array(option) {
|
|
176
|
+
return [option.enable ? 0 : 1.0, option.speed || 1, option.rings || 3, 0];
|
|
177
|
+
}
|
|
178
|
+
}, {
|
|
179
|
+
key: "registerBuiltinAttributes",
|
|
180
|
+
value: function registerBuiltinAttributes() {
|
|
181
|
+
var _this = this;
|
|
182
|
+
|
|
183
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
184
|
+
name: 'extrude',
|
|
185
|
+
type: _l7Core.AttributeType.Attribute,
|
|
186
|
+
descriptor: {
|
|
187
|
+
name: 'a_Extrude',
|
|
188
|
+
buffer: {
|
|
189
|
+
// give the WebGL driver a hint that this buffer may change
|
|
190
|
+
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
191
|
+
data: [],
|
|
192
|
+
type: _l7Core.gl.FLOAT
|
|
193
|
+
},
|
|
194
|
+
size: 3,
|
|
195
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
196
|
+
var _vertex = (0, _slicedToArray2.default)(vertex, 3),
|
|
197
|
+
x = _vertex[0],
|
|
198
|
+
y = _vertex[1],
|
|
199
|
+
z = _vertex[2];
|
|
200
|
+
|
|
201
|
+
var n1 = _glMatrix.vec3.fromValues(0, 0, 1);
|
|
202
|
+
|
|
203
|
+
var n2 = _glMatrix.vec3.fromValues(x, 0, z);
|
|
204
|
+
|
|
205
|
+
var xzReg = x >= 0 ? _glMatrix.vec3.angle(n1, n2) : Math.PI * 2 - _glMatrix.vec3.angle(n1, n2);
|
|
206
|
+
var yReg = Math.PI * 2 - Math.asin(y / 100);
|
|
207
|
+
|
|
208
|
+
var m = _glMatrix.mat4.create();
|
|
209
|
+
|
|
210
|
+
_glMatrix.mat4.rotateY(m, m, xzReg);
|
|
211
|
+
|
|
212
|
+
_glMatrix.mat4.rotateX(m, m, yReg);
|
|
213
|
+
|
|
214
|
+
var v1 = _glMatrix.vec3.fromValues(1, 1, 0);
|
|
215
|
+
|
|
216
|
+
_glMatrix.vec3.transformMat4(v1, v1, m);
|
|
217
|
+
|
|
218
|
+
_glMatrix.vec3.normalize(v1, v1);
|
|
219
|
+
|
|
220
|
+
var v2 = _glMatrix.vec3.fromValues(-1, 1, 0);
|
|
221
|
+
|
|
222
|
+
_glMatrix.vec3.transformMat4(v2, v2, m);
|
|
223
|
+
|
|
224
|
+
_glMatrix.vec3.normalize(v2, v2);
|
|
225
|
+
|
|
226
|
+
var v3 = _glMatrix.vec3.fromValues(-1, -1, 0);
|
|
227
|
+
|
|
228
|
+
_glMatrix.vec3.transformMat4(v3, v3, m);
|
|
229
|
+
|
|
230
|
+
_glMatrix.vec3.normalize(v3, v3);
|
|
231
|
+
|
|
232
|
+
var v4 = _glMatrix.vec3.fromValues(1, -1, 0);
|
|
233
|
+
|
|
234
|
+
_glMatrix.vec3.transformMat4(v4, v4, m);
|
|
235
|
+
|
|
236
|
+
_glMatrix.vec3.normalize(v4, v4);
|
|
237
|
+
|
|
238
|
+
var extrude = [].concat((0, _toConsumableArray2.default)(v1), (0, _toConsumableArray2.default)(v2), (0, _toConsumableArray2.default)(v3), (0, _toConsumableArray2.default)(v4));
|
|
239
|
+
var extrudeIndex = attributeIdx % 4 * 3;
|
|
240
|
+
return [extrude[extrudeIndex], extrude[extrudeIndex + 1], extrude[extrudeIndex + 2]];
|
|
241
|
+
}
|
|
183
242
|
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
243
|
+
}); // point layer size;
|
|
244
|
+
|
|
245
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
246
|
+
name: 'size',
|
|
247
|
+
type: _l7Core.AttributeType.Attribute,
|
|
248
|
+
descriptor: {
|
|
249
|
+
name: 'a_Size',
|
|
250
|
+
buffer: {
|
|
251
|
+
// give the WebGL driver a hint that this buffer may change
|
|
252
|
+
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
253
|
+
data: [],
|
|
254
|
+
type: _l7Core.gl.FLOAT
|
|
255
|
+
},
|
|
256
|
+
size: 1,
|
|
257
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
258
|
+
var _feature$size = feature.size,
|
|
259
|
+
size = _feature$size === void 0 ? 5 : _feature$size;
|
|
260
|
+
return Array.isArray(size) ? [size[0]] : [size];
|
|
261
|
+
}
|
|
202
262
|
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
263
|
+
}); // point layer size;
|
|
264
|
+
|
|
265
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
266
|
+
name: 'shape',
|
|
267
|
+
type: _l7Core.AttributeType.Attribute,
|
|
268
|
+
descriptor: {
|
|
269
|
+
name: 'a_Shape',
|
|
270
|
+
buffer: {
|
|
271
|
+
// give the WebGL driver a hint that this buffer may change
|
|
272
|
+
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
273
|
+
data: [],
|
|
274
|
+
type: _l7Core.gl.FLOAT
|
|
275
|
+
},
|
|
276
|
+
size: 1,
|
|
277
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
278
|
+
var _feature$shape = feature.shape,
|
|
279
|
+
shape = _feature$shape === void 0 ? 2 : _feature$shape;
|
|
280
|
+
|
|
281
|
+
var shape2d = _this.layer.getLayerConfig().shape2d;
|
|
282
|
+
|
|
283
|
+
var shapeIndex = shape2d.indexOf(shape);
|
|
284
|
+
return [shapeIndex];
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
}]);
|
|
290
|
+
return FillModel;
|
|
291
|
+
}(_BaseModel2.default);
|
|
292
|
+
|
|
293
|
+
exports.default = FillModel;
|