@antv/l7-layers 2.9.25-alpha.0 → 2.9.26-alpha.1
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/tileFactory/base.d.ts +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,221 +1,314 @@
|
|
|
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/radar.ts
|
|
23
|
-
var radar_exports = {};
|
|
24
|
-
__export(radar_exports, {
|
|
25
|
-
default: () => RadarModel
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
+
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
+
|
|
16
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
+
|
|
26
|
+
var _l7Core = require("@antv/l7-core");
|
|
27
|
+
|
|
28
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
29
|
+
|
|
30
|
+
var _lodash = require("lodash");
|
|
31
|
+
|
|
32
|
+
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
33
|
+
|
|
34
|
+
var _triangulation = require("../../core/triangulation");
|
|
35
|
+
|
|
36
|
+
var _l7Maps = require("@antv/l7-maps");
|
|
37
|
+
|
|
38
|
+
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); }; }
|
|
39
|
+
|
|
40
|
+
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; } }
|
|
41
|
+
|
|
42
|
+
/* babel-plugin-inline-import '../shaders/radar/radar_frag.glsl' */
|
|
43
|
+
var pointFillFrag = "\nuniform 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\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\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius);\n\n float outer_df = sdCircle(v_data.xy, 1.0);\n float inner_df = sdCircle(v_data.xy, r);\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n } else {\n gl_FragColor.a *= opacity_t;\n }\n\n if(gl_FragColor.a > 0.0) {\n gl_FragColor = filterColor(gl_FragColor);\n }\n\n vec2 extrude = styleMappingMat[2].ba;\n vec2 dir = normalize(extrude);\n vec2 baseDir = vec2(1.0, 0.0);\n float pi = 3.14159265359;\n // full circle\n // float rades = dot(dir, baseDir);\n // float flag = sign(dir.y);\n // float radar_v = (flag - 1.0) * -0.5 + flag * acos(rades)/pi/2.0;\n \n // half circle\n float flag = sign(dir.y);\n float rades = dot(dir, baseDir);\n float radar_v = (flag - 1.0) * -0.5 * acos(rades)/pi;\n // simple AA\n if(radar_v > 0.99) {\n radar_v = 1.0 - (radar_v - 0.99)/0.01;\n }\n\n gl_FragColor.a *= radar_v;\n}\n";
|
|
44
|
+
|
|
45
|
+
/* babel-plugin-inline-import '../shaders/radar/radar_vert.glsl' */
|
|
46
|
+
var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\nuniform float u_speed: 1.0;\nuniform float u_time;\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;\nuniform float u_isMeter;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\nuniform float u_opacity : 1;\nuniform vec2 u_offsets;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n float newSize = setPickingSize(a_Size);\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 - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // empty - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1] - a_Extrude.x - a_Extrude.y\n 0.0, 0.0, 0.0, 0.0 // \n );\n\n float time = u_time * u_speed;\n mat2 rotateMatrix = mat2( \n cos(time), sin(time), \n -sin(time), cos(time)\n );\n styleMappingMat[2].ba = rotateMatrix * a_Extrude.xy;\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 -> empty -> empty ... \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\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\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 // anti-alias\n float blur = 0.0;\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, blur);\n\n vec2 offset = (extrude.xy * (newSize) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n antialiasblur *= pow(19.0 - u_Zoom, 2.0);\n antialiasblur = max(antialiasblur, -0.01);\n // offset *= 0.5;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.xy += offset;\n offset.x = 0.0;\n offset.y = 0.0;\n }\n }\n\n v_data = vec4(extrude.x, extrude.y, antialiasblur,shape_type);\n\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, 0.0, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
47
|
+
|
|
48
|
+
var RadarModel = /*#__PURE__*/function (_BaseModel) {
|
|
49
|
+
(0, _inherits2.default)(RadarModel, _BaseModel);
|
|
50
|
+
|
|
51
|
+
var _super = _createSuper(RadarModel);
|
|
52
|
+
|
|
53
|
+
function RadarModel() {
|
|
54
|
+
var _this;
|
|
55
|
+
|
|
56
|
+
(0, _classCallCheck2.default)(this, RadarModel);
|
|
57
|
+
|
|
58
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
59
|
+
args[_key] = arguments[_key];
|
|
75
60
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
82
|
-
u_opacity: (0, import_lodash.isNumber)(opacity) ? opacity : 1,
|
|
83
|
-
u_offsets: this.isOffsetStatic(offsets) ? offsets : [0, 0]
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
getAnimateUniforms() {
|
|
87
|
-
const {
|
|
88
|
-
animateOption = { enable: false }
|
|
89
|
-
} = this.layer.getLayerConfig();
|
|
90
|
-
return {
|
|
91
|
-
u_aimate: this.animateOption2Array(animateOption),
|
|
92
|
-
u_time: this.layer.getLayerAnimateTime()
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
getAttribute() {
|
|
96
|
-
return this.styleAttributeService.createAttributesAndIndices(this.layer.getEncodedData(), import_triangulation.PointFillTriangulation);
|
|
61
|
+
|
|
62
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
63
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meter2coord", 1);
|
|
64
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isMeter", false);
|
|
65
|
+
return _this;
|
|
97
66
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
67
|
+
|
|
68
|
+
(0, _createClass2.default)(RadarModel, [{
|
|
69
|
+
key: "getUninforms",
|
|
70
|
+
value: function getUninforms() {
|
|
71
|
+
var _ref = this.layer.getLayerConfig(),
|
|
72
|
+
_ref$opacity = _ref.opacity,
|
|
73
|
+
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
74
|
+
_ref$offsets = _ref.offsets,
|
|
75
|
+
offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets,
|
|
76
|
+
blend = _ref.blend,
|
|
77
|
+
_ref$speed = _ref.speed,
|
|
78
|
+
speed = _ref$speed === void 0 ? 1 : _ref$speed;
|
|
79
|
+
|
|
80
|
+
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
81
|
+
opacity: opacity,
|
|
82
|
+
offsets: offsets
|
|
83
|
+
})) {
|
|
84
|
+
// 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量
|
|
85
|
+
this.judgeStyleAttributes({
|
|
86
|
+
opacity: opacity,
|
|
87
|
+
offsets: offsets
|
|
88
|
+
});
|
|
89
|
+
var encodeData = this.layer.getEncodedData();
|
|
90
|
+
|
|
91
|
+
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
92
|
+
data = _this$calDataFrame.data,
|
|
93
|
+
width = _this$calDataFrame.width,
|
|
94
|
+
height = _this$calDataFrame.height;
|
|
95
|
+
|
|
96
|
+
this.rowCount = height; // 当前数据纹理有多少行
|
|
97
|
+
|
|
98
|
+
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
99
|
+
flipY: true,
|
|
100
|
+
data: data,
|
|
101
|
+
format: _l7Core.gl.LUMINANCE,
|
|
102
|
+
type: _l7Core.gl.FLOAT,
|
|
103
|
+
width: width,
|
|
104
|
+
height: height
|
|
105
|
+
}) : this.createTexture2D({
|
|
106
|
+
flipY: true,
|
|
107
|
+
data: [1],
|
|
108
|
+
format: _l7Core.gl.LUMINANCE,
|
|
109
|
+
type: _l7Core.gl.FLOAT,
|
|
110
|
+
width: 1,
|
|
111
|
+
height: 1
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
u_isMeter: Number(this.isMeter),
|
|
117
|
+
u_speed: speed,
|
|
118
|
+
u_additive: blend === 'additive' ? 1.0 : 0.0,
|
|
119
|
+
u_dataTexture: this.dataTexture,
|
|
120
|
+
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
121
|
+
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
122
|
+
u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1.0,
|
|
123
|
+
u_offsets: this.isOffsetStatic(offsets) ? offsets : [0, 0]
|
|
124
|
+
};
|
|
106
125
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return;
|
|
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
|
+
};
|
|
121
139
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
]);
|
|
127
|
-
this.meter2coord = (m1 + m2) / 2;
|
|
128
|
-
if (!this.meter2coord) {
|
|
129
|
-
this.meter2coord = 7.70681090738883;
|
|
140
|
+
}, {
|
|
141
|
+
key: "getAttribute",
|
|
142
|
+
value: function getAttribute() {
|
|
143
|
+
return this.styleAttributeService.createAttributesAndIndices(this.layer.getEncodedData(), _triangulation.PointFillTriangulation);
|
|
130
144
|
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
blend: this.getBlend(),
|
|
144
|
-
stencil: (0, import_l7_utils.getMask)(mask, maskInside)
|
|
145
|
-
}).then((model) => {
|
|
146
|
-
callbackModel([model]);
|
|
147
|
-
}).catch((err) => {
|
|
148
|
-
console.warn(err);
|
|
149
|
-
callbackModel([]);
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
clearModels() {
|
|
153
|
-
var _a;
|
|
154
|
-
(_a = this.dataTexture) == null ? void 0 : _a.destroy();
|
|
155
|
-
}
|
|
156
|
-
animateOption2Array(option) {
|
|
157
|
-
return [option.enable ? 0 : 1, option.speed || 1, option.rings || 3, 0];
|
|
158
|
-
}
|
|
159
|
-
registerBuiltinAttributes() {
|
|
160
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
161
|
-
name: "extrude",
|
|
162
|
-
type: import_l7_core.AttributeType.Attribute,
|
|
163
|
-
descriptor: {
|
|
164
|
-
name: "a_Extrude",
|
|
165
|
-
buffer: {
|
|
166
|
-
usage: import_l7_core.gl.DYNAMIC_DRAW,
|
|
167
|
-
data: [],
|
|
168
|
-
type: import_l7_core.gl.FLOAT
|
|
169
|
-
},
|
|
170
|
-
size: 3,
|
|
171
|
-
update: (feature, featureIdx, vertex, attributeIdx) => {
|
|
172
|
-
const extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];
|
|
173
|
-
const extrudeIndex = attributeIdx % 4 * 3;
|
|
174
|
-
return [
|
|
175
|
-
extrude[extrudeIndex],
|
|
176
|
-
extrude[extrudeIndex + 1],
|
|
177
|
-
extrude[extrudeIndex + 2]
|
|
178
|
-
];
|
|
179
|
-
}
|
|
145
|
+
}, {
|
|
146
|
+
key: "initModels",
|
|
147
|
+
value: function initModels(callbackModel) {
|
|
148
|
+
var _ref3 = this.layer.getLayerConfig(),
|
|
149
|
+
_ref3$unit = _ref3.unit,
|
|
150
|
+
unit = _ref3$unit === void 0 ? 'l7size' : _ref3$unit;
|
|
151
|
+
|
|
152
|
+
var version = this.mapService.version;
|
|
153
|
+
|
|
154
|
+
if (unit === 'meter' && version !== _l7Maps.Version.L7MAP && version !== _l7Maps.Version.GLOBEL) {
|
|
155
|
+
this.isMeter = true;
|
|
156
|
+
this.calMeter2Coord();
|
|
180
157
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
158
|
+
|
|
159
|
+
this.buildModels(callbackModel);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例
|
|
163
|
+
* @returns
|
|
164
|
+
*/
|
|
165
|
+
|
|
166
|
+
}, {
|
|
167
|
+
key: "calMeter2Coord",
|
|
168
|
+
value: function calMeter2Coord() {
|
|
169
|
+
var _this$layer$getSource = (0, _slicedToArray2.default)(this.layer.getSource().extent, 4),
|
|
170
|
+
minLng = _this$layer$getSource[0],
|
|
171
|
+
minLat = _this$layer$getSource[1],
|
|
172
|
+
maxLng = _this$layer$getSource[2],
|
|
173
|
+
maxLat = _this$layer$getSource[3];
|
|
174
|
+
|
|
175
|
+
var center = [(minLng + maxLng) / 2, (minLat + maxLat) / 2];
|
|
176
|
+
var version = this.mapService.version;
|
|
177
|
+
|
|
178
|
+
if (version === _l7Maps.Version.MAPBOX && window.mapboxgl.MercatorCoordinate) {
|
|
179
|
+
var coord = window.mapboxgl.MercatorCoordinate.fromLngLat({
|
|
180
|
+
lng: center[0],
|
|
181
|
+
lat: center[1]
|
|
182
|
+
}, 0);
|
|
183
|
+
var offsetInMeters = 1;
|
|
184
|
+
var offsetInMercatorCoordinateUnits = offsetInMeters * coord.meterInMercatorCoordinateUnits();
|
|
185
|
+
var westCoord = new window.mapboxgl.MercatorCoordinate(coord.x - offsetInMercatorCoordinateUnits, coord.y, coord.z);
|
|
186
|
+
var westLnglat = westCoord.toLngLat();
|
|
187
|
+
this.meter2coord = center[0] - westLnglat.lng;
|
|
188
|
+
return;
|
|
189
|
+
} // @ts-ignore
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
var m1 = this.mapService.meterToCoord(center, [minLng, minLat]); // @ts-ignore
|
|
193
|
+
|
|
194
|
+
var m2 = this.mapService.meterToCoord(center, [maxLng === minLng ? maxLng + 0.1 : maxLng, maxLat === minLat ? minLat + 0.1 : maxLat]);
|
|
195
|
+
this.meter2coord = (m1 + m2) / 2;
|
|
196
|
+
|
|
197
|
+
if (!this.meter2coord) {
|
|
198
|
+
// Tip: 兼容单个数据导致的 m1、m2 为 NaN
|
|
199
|
+
this.meter2coord = 7.70681090738883;
|
|
197
200
|
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
201
|
+
}
|
|
202
|
+
}, {
|
|
203
|
+
key: "buildModels",
|
|
204
|
+
value: function buildModels(callbackModel) {
|
|
205
|
+
var _ref4 = this.layer.getLayerConfig(),
|
|
206
|
+
_ref4$mask = _ref4.mask,
|
|
207
|
+
mask = _ref4$mask === void 0 ? false : _ref4$mask,
|
|
208
|
+
_ref4$maskInside = _ref4.maskInside,
|
|
209
|
+
maskInside = _ref4$maskInside === void 0 ? true : _ref4$maskInside;
|
|
210
|
+
|
|
211
|
+
this.layer.buildLayerModel({
|
|
212
|
+
moduleName: 'pointRadar',
|
|
213
|
+
vertexShader: pointFillVert,
|
|
214
|
+
fragmentShader: pointFillFrag,
|
|
215
|
+
triangulation: _triangulation.PointFillTriangulation,
|
|
216
|
+
depth: {
|
|
217
|
+
enable: false
|
|
208
218
|
},
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
219
|
+
blend: this.getBlend(),
|
|
220
|
+
stencil: (0, _l7Utils.getMask)(mask, maskInside)
|
|
221
|
+
}).then(function (model) {
|
|
222
|
+
callbackModel([model]);
|
|
223
|
+
}).catch(function (err) {
|
|
224
|
+
console.warn(err);
|
|
225
|
+
callbackModel([]);
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}, {
|
|
229
|
+
key: "clearModels",
|
|
230
|
+
value: function clearModels() {
|
|
231
|
+
var _this$dataTexture;
|
|
232
|
+
|
|
233
|
+
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
234
|
+
} // overwrite baseModel func
|
|
235
|
+
|
|
236
|
+
}, {
|
|
237
|
+
key: "animateOption2Array",
|
|
238
|
+
value: function animateOption2Array(option) {
|
|
239
|
+
return [option.enable ? 0 : 1.0, option.speed || 1, option.rings || 3, 0];
|
|
240
|
+
}
|
|
241
|
+
}, {
|
|
242
|
+
key: "registerBuiltinAttributes",
|
|
243
|
+
value: function registerBuiltinAttributes() {
|
|
244
|
+
var _this2 = this;
|
|
245
|
+
|
|
246
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
247
|
+
name: 'extrude',
|
|
248
|
+
type: _l7Core.AttributeType.Attribute,
|
|
249
|
+
descriptor: {
|
|
250
|
+
name: 'a_Extrude',
|
|
251
|
+
buffer: {
|
|
252
|
+
// give the WebGL driver a hint that this buffer may change
|
|
253
|
+
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
254
|
+
data: [],
|
|
255
|
+
type: _l7Core.gl.FLOAT
|
|
256
|
+
},
|
|
257
|
+
size: 3,
|
|
258
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
259
|
+
var extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];
|
|
260
|
+
var extrudeIndex = attributeIdx % 4 * 3;
|
|
261
|
+
return [extrude[extrudeIndex], extrude[extrudeIndex + 1], extrude[extrudeIndex + 2]];
|
|
262
|
+
}
|
|
215
263
|
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
264
|
+
}); // point layer size;
|
|
265
|
+
|
|
266
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
267
|
+
name: 'size',
|
|
268
|
+
type: _l7Core.AttributeType.Attribute,
|
|
269
|
+
descriptor: {
|
|
270
|
+
name: 'a_Size',
|
|
271
|
+
buffer: {
|
|
272
|
+
// give the WebGL driver a hint that this buffer may change
|
|
273
|
+
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
274
|
+
data: [],
|
|
275
|
+
type: _l7Core.gl.FLOAT
|
|
276
|
+
},
|
|
277
|
+
size: 1,
|
|
278
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
279
|
+
var _feature$size = feature.size,
|
|
280
|
+
size = _feature$size === void 0 ? 5 : _feature$size;
|
|
281
|
+
return Array.isArray(size) ? [size[0] * _this2.meter2coord] : [size * _this2.meter2coord];
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}); // point layer size;
|
|
285
|
+
|
|
286
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
287
|
+
name: 'shape',
|
|
288
|
+
type: _l7Core.AttributeType.Attribute,
|
|
289
|
+
descriptor: {
|
|
290
|
+
name: 'a_Shape',
|
|
291
|
+
buffer: {
|
|
292
|
+
// give the WebGL driver a hint that this buffer may change
|
|
293
|
+
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
294
|
+
data: [],
|
|
295
|
+
type: _l7Core.gl.FLOAT
|
|
296
|
+
},
|
|
297
|
+
size: 1,
|
|
298
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
299
|
+
var _feature$shape = feature.shape,
|
|
300
|
+
shape = _feature$shape === void 0 ? 2 : _feature$shape;
|
|
301
|
+
|
|
302
|
+
var shape2d = _this2.layer.getLayerConfig().shape2d;
|
|
303
|
+
|
|
304
|
+
var shapeIndex = shape2d.indexOf(shape);
|
|
305
|
+
return [shapeIndex];
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}]);
|
|
311
|
+
return RadarModel;
|
|
312
|
+
}(_BaseModel2.default);
|
|
313
|
+
|
|
314
|
+
exports.default = RadarModel;
|