@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,219 +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/line/models/linearline.ts
|
|
23
|
-
var linearline_exports = {};
|
|
24
|
-
__export(linearline_exports, {
|
|
25
|
-
default: () => LinearLineModel
|
|
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
|
-
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
+
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
|
|
18
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
+
|
|
20
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
+
|
|
22
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
+
|
|
24
|
+
var _l7Core = require("@antv/l7-core");
|
|
25
|
+
|
|
26
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
27
|
+
|
|
28
|
+
var _lodash = require("lodash");
|
|
29
|
+
|
|
30
|
+
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
31
|
+
|
|
32
|
+
var _interface = require("../../core/interface");
|
|
33
|
+
|
|
34
|
+
var _triangulation = require("../../core/triangulation");
|
|
35
|
+
|
|
36
|
+
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); }; }
|
|
37
|
+
|
|
38
|
+
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; } }
|
|
39
|
+
|
|
40
|
+
/* babel-plugin-inline-import '../shaders/linearLine/line_linear_frag.glsl' */
|
|
41
|
+
var linear_line_frag = "uniform float u_opacity : 1.0;\nuniform sampler2D u_texture;\nuniform float u_linearDir: 1.0;\n\n#pragma include \"picking\"\n\nvarying mat4 styleMappingMat;\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float linearRadio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n if(u_linearDir < 1.0) {\n linearRadio = styleMappingMat[3][3];\n }\n\n gl_FragColor = texture2D(u_texture, vec2(linearRadio, 0.5));\n\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
42
|
+
|
|
43
|
+
/* babel-plugin-inline-import '../shaders/linearLine/line_linear_vert.glsl' */
|
|
44
|
+
var linear_line_vert = "\nattribute float a_Miter;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\n// dash line\nattribute float a_Total_Distance;\nattribute vec2 a_DistanceAndIndex;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_heightfixed: 0.0;\nuniform float u_vertexScale: 1.0;\nuniform float u_raisingHeight: 0.0;\n\nuniform float u_opacity: 1.0;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\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\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\nvoid main() {\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 // distance_ratio/distance/pixelLen/texV\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 // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\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 // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = currentLinePointRatio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n styleMappingMat[3][3] = texV; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\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";
|
|
45
|
+
|
|
46
|
+
var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
47
|
+
(0, _inherits2.default)(LinearLineModel, _BaseModel);
|
|
48
|
+
|
|
49
|
+
var _super = _createSuper(LinearLineModel);
|
|
50
|
+
|
|
51
|
+
function LinearLineModel() {
|
|
52
|
+
var _this;
|
|
53
|
+
|
|
54
|
+
(0, _classCallCheck2.default)(this, LinearLineModel);
|
|
55
|
+
|
|
56
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
57
|
+
args[_key] = arguments[_key];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
61
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateTexture", function () {
|
|
62
|
+
var createTexture2D = _this.rendererService.createTexture2D;
|
|
63
|
+
|
|
64
|
+
if (_this.colorTexture) {
|
|
65
|
+
_this.colorTexture.destroy();
|
|
43
66
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
67
|
+
|
|
68
|
+
var _ref = _this.layer.getLayerConfig(),
|
|
69
|
+
rampColors = _ref.rampColors;
|
|
70
|
+
|
|
71
|
+
var imageData = (0, _l7Utils.generateColorRamp)(rampColors);
|
|
72
|
+
_this.colorTexture = createTexture2D({
|
|
49
73
|
data: new Uint8Array(imageData.data),
|
|
50
74
|
width: imageData.width,
|
|
51
75
|
height: imageData.height,
|
|
52
|
-
wrapS:
|
|
53
|
-
wrapT:
|
|
54
|
-
min:
|
|
55
|
-
mag:
|
|
76
|
+
wrapS: _l7Core.gl.CLAMP_TO_EDGE,
|
|
77
|
+
wrapT: _l7Core.gl.CLAMP_TO_EDGE,
|
|
78
|
+
min: _l7Core.gl.NEAREST,
|
|
79
|
+
mag: _l7Core.gl.NEAREST,
|
|
56
80
|
flipY: false
|
|
57
81
|
});
|
|
58
|
-
};
|
|
82
|
+
});
|
|
83
|
+
return _this;
|
|
59
84
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
85
|
+
|
|
86
|
+
(0, _createClass2.default)(LinearLineModel, [{
|
|
87
|
+
key: "getUninforms",
|
|
88
|
+
value: function getUninforms() {
|
|
89
|
+
var _ref2 = this.layer.getLayerConfig(),
|
|
90
|
+
_ref2$opacity = _ref2.opacity,
|
|
91
|
+
opacity = _ref2$opacity === void 0 ? 1 : _ref2$opacity,
|
|
92
|
+
_ref2$vertexHeightSca = _ref2.vertexHeightScale,
|
|
93
|
+
vertexHeightScale = _ref2$vertexHeightSca === void 0 ? 20.0 : _ref2$vertexHeightSca,
|
|
94
|
+
_ref2$raisingHeight = _ref2.raisingHeight,
|
|
95
|
+
raisingHeight = _ref2$raisingHeight === void 0 ? 0 : _ref2$raisingHeight,
|
|
96
|
+
_ref2$heightfixed = _ref2.heightfixed,
|
|
97
|
+
heightfixed = _ref2$heightfixed === void 0 ? false : _ref2$heightfixed,
|
|
98
|
+
_ref2$linearDir = _ref2.linearDir,
|
|
99
|
+
linearDir = _ref2$linearDir === void 0 ? _interface.LinearDir.VERTICAL : _ref2$linearDir;
|
|
100
|
+
|
|
101
|
+
if (this.rendererService.getDirty()) {
|
|
102
|
+
this.colorTexture.bind();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
106
|
+
opacity: opacity
|
|
107
|
+
})) {
|
|
108
|
+
this.judgeStyleAttributes({
|
|
109
|
+
opacity: opacity
|
|
110
|
+
});
|
|
111
|
+
var encodeData = this.layer.getEncodedData();
|
|
112
|
+
|
|
113
|
+
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
114
|
+
data = _this$calDataFrame.data,
|
|
115
|
+
width = _this$calDataFrame.width,
|
|
116
|
+
height = _this$calDataFrame.height;
|
|
117
|
+
|
|
118
|
+
this.rowCount = height; // 当前数据纹理有多少行
|
|
119
|
+
|
|
120
|
+
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
121
|
+
flipY: true,
|
|
122
|
+
data: data,
|
|
123
|
+
format: _l7Core.gl.LUMINANCE,
|
|
124
|
+
type: _l7Core.gl.FLOAT,
|
|
125
|
+
width: width,
|
|
126
|
+
height: height
|
|
127
|
+
}) : this.createTexture2D({
|
|
128
|
+
flipY: true,
|
|
129
|
+
data: [1],
|
|
130
|
+
format: _l7Core.gl.LUMINANCE,
|
|
131
|
+
type: _l7Core.gl.FLOAT,
|
|
132
|
+
width: 1,
|
|
133
|
+
height: 1
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return {
|
|
138
|
+
u_dataTexture: this.dataTexture,
|
|
139
|
+
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
140
|
+
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
141
|
+
u_linearDir: linearDir === _interface.LinearDir.VERTICAL ? 1.0 : 0.0,
|
|
142
|
+
u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1.0,
|
|
143
|
+
// 纹理支持参数
|
|
144
|
+
u_texture: this.colorTexture,
|
|
145
|
+
// 贴图
|
|
146
|
+
// 是否固定高度
|
|
147
|
+
u_heightfixed: Number(heightfixed),
|
|
148
|
+
// 顶点高度 scale
|
|
149
|
+
u_vertexScale: vertexHeightScale,
|
|
150
|
+
u_raisingHeight: Number(raisingHeight)
|
|
151
|
+
};
|
|
70
152
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
this.
|
|
76
|
-
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
77
|
-
flipY: true,
|
|
78
|
-
data,
|
|
79
|
-
format: import_l7_core.gl.LUMINANCE,
|
|
80
|
-
type: import_l7_core.gl.FLOAT,
|
|
81
|
-
width,
|
|
82
|
-
height
|
|
83
|
-
}) : this.createTexture2D({
|
|
84
|
-
flipY: true,
|
|
85
|
-
data: [1],
|
|
86
|
-
format: import_l7_core.gl.LUMINANCE,
|
|
87
|
-
type: import_l7_core.gl.FLOAT,
|
|
88
|
-
width: 1,
|
|
89
|
-
height: 1
|
|
90
|
-
});
|
|
153
|
+
}, {
|
|
154
|
+
key: "initModels",
|
|
155
|
+
value: function initModels(callbackModel) {
|
|
156
|
+
this.updateTexture();
|
|
157
|
+
this.buildModels(callbackModel);
|
|
91
158
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
this.layer.buildLayerModel({
|
|
120
|
-
moduleName: "lineRampColors",
|
|
121
|
-
vertexShader: import_line_linear_vert.default,
|
|
122
|
-
fragmentShader: import_line_linear_frag.default,
|
|
123
|
-
triangulation: import_triangulation.LineTriangulation,
|
|
124
|
-
depth: { enable: depth },
|
|
125
|
-
blend: this.getBlend(),
|
|
126
|
-
stencil: (0, import_l7_utils.getMask)(mask, maskInside)
|
|
127
|
-
}).then((model) => {
|
|
128
|
-
callbackModel([model]);
|
|
129
|
-
}).catch((err) => {
|
|
130
|
-
console.warn(err);
|
|
131
|
-
callbackModel([]);
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
registerBuiltinAttributes() {
|
|
135
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
136
|
-
name: "distanceAndIndex",
|
|
137
|
-
type: import_l7_core.AttributeType.Attribute,
|
|
138
|
-
descriptor: {
|
|
139
|
-
name: "a_DistanceAndIndex",
|
|
140
|
-
buffer: {
|
|
141
|
-
usage: import_l7_core.gl.STATIC_DRAW,
|
|
142
|
-
data: [],
|
|
143
|
-
type: import_l7_core.gl.FLOAT
|
|
159
|
+
}, {
|
|
160
|
+
key: "clearModels",
|
|
161
|
+
value: function clearModels() {
|
|
162
|
+
var _this$colorTexture, _this$dataTexture;
|
|
163
|
+
|
|
164
|
+
(_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0 ? void 0 : _this$colorTexture.destroy();
|
|
165
|
+
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
166
|
+
}
|
|
167
|
+
}, {
|
|
168
|
+
key: "buildModels",
|
|
169
|
+
value: function buildModels(callbackModel) {
|
|
170
|
+
var _ref3 = this.layer.getLayerConfig(),
|
|
171
|
+
_ref3$mask = _ref3.mask,
|
|
172
|
+
mask = _ref3$mask === void 0 ? false : _ref3$mask,
|
|
173
|
+
_ref3$maskInside = _ref3.maskInside,
|
|
174
|
+
maskInside = _ref3$maskInside === void 0 ? true : _ref3$maskInside,
|
|
175
|
+
_ref3$depth = _ref3.depth,
|
|
176
|
+
depth = _ref3$depth === void 0 ? false : _ref3$depth;
|
|
177
|
+
|
|
178
|
+
this.layer.triangulation = _triangulation.LineTriangulation;
|
|
179
|
+
this.layer.buildLayerModel({
|
|
180
|
+
moduleName: 'lineRampColors',
|
|
181
|
+
vertexShader: linear_line_vert,
|
|
182
|
+
fragmentShader: linear_line_frag,
|
|
183
|
+
triangulation: _triangulation.LineTriangulation,
|
|
184
|
+
depth: {
|
|
185
|
+
enable: depth
|
|
144
186
|
},
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
187
|
+
blend: this.getBlend(),
|
|
188
|
+
stencil: (0, _l7Utils.getMask)(mask, maskInside)
|
|
189
|
+
}).then(function (model) {
|
|
190
|
+
callbackModel([model]);
|
|
191
|
+
}).catch(function (err) {
|
|
192
|
+
console.warn(err);
|
|
193
|
+
callbackModel([]);
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}, {
|
|
197
|
+
key: "registerBuiltinAttributes",
|
|
198
|
+
value: function registerBuiltinAttributes() {
|
|
199
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
200
|
+
name: 'distanceAndIndex',
|
|
201
|
+
type: _l7Core.AttributeType.Attribute,
|
|
202
|
+
descriptor: {
|
|
203
|
+
name: 'a_DistanceAndIndex',
|
|
204
|
+
buffer: {
|
|
205
|
+
// give the WebGL driver a hint that this buffer may change
|
|
206
|
+
usage: _l7Core.gl.STATIC_DRAW,
|
|
207
|
+
data: [],
|
|
208
|
+
type: _l7Core.gl.FLOAT
|
|
209
|
+
},
|
|
210
|
+
size: 2,
|
|
211
|
+
update: function update(feature, featureIdx, vertex, attributeIdx, normal, vertexIndex) {
|
|
212
|
+
return vertexIndex === undefined ? [vertex[3], 10] : [vertex[3], vertexIndex];
|
|
213
|
+
}
|
|
148
214
|
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
215
|
+
});
|
|
216
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
217
|
+
name: 'total_distance',
|
|
218
|
+
type: _l7Core.AttributeType.Attribute,
|
|
219
|
+
descriptor: {
|
|
220
|
+
name: 'a_Total_Distance',
|
|
221
|
+
buffer: {
|
|
222
|
+
// give the WebGL driver a hint that this buffer may change
|
|
223
|
+
usage: _l7Core.gl.STATIC_DRAW,
|
|
224
|
+
data: [],
|
|
225
|
+
type: _l7Core.gl.FLOAT
|
|
226
|
+
},
|
|
227
|
+
size: 1,
|
|
228
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
229
|
+
return [vertex[5]];
|
|
230
|
+
}
|
|
164
231
|
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
232
|
+
});
|
|
233
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
234
|
+
name: 'size',
|
|
235
|
+
type: _l7Core.AttributeType.Attribute,
|
|
236
|
+
descriptor: {
|
|
237
|
+
name: 'a_Size',
|
|
238
|
+
buffer: {
|
|
239
|
+
// give the WebGL driver a hint that this buffer may change
|
|
240
|
+
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
241
|
+
data: [],
|
|
242
|
+
type: _l7Core.gl.FLOAT
|
|
243
|
+
},
|
|
244
|
+
size: 2,
|
|
245
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
246
|
+
var _feature$size = feature.size,
|
|
247
|
+
size = _feature$size === void 0 ? 1 : _feature$size;
|
|
248
|
+
return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
|
|
249
|
+
}
|
|
181
250
|
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
251
|
+
}); // point layer size;
|
|
252
|
+
|
|
253
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
254
|
+
name: 'normal',
|
|
255
|
+
type: _l7Core.AttributeType.Attribute,
|
|
256
|
+
descriptor: {
|
|
257
|
+
name: 'a_Normal',
|
|
258
|
+
buffer: {
|
|
259
|
+
// give the WebGL driver a hint that this buffer may change
|
|
260
|
+
usage: _l7Core.gl.STATIC_DRAW,
|
|
261
|
+
data: [],
|
|
262
|
+
type: _l7Core.gl.FLOAT
|
|
263
|
+
},
|
|
264
|
+
size: 3,
|
|
265
|
+
// @ts-ignore
|
|
266
|
+
update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
|
|
267
|
+
return normal;
|
|
268
|
+
}
|
|
197
269
|
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
270
|
+
});
|
|
271
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
272
|
+
name: 'miter',
|
|
273
|
+
type: _l7Core.AttributeType.Attribute,
|
|
274
|
+
descriptor: {
|
|
275
|
+
name: 'a_Miter',
|
|
276
|
+
buffer: {
|
|
277
|
+
// give the WebGL driver a hint that this buffer may change
|
|
278
|
+
usage: _l7Core.gl.STATIC_DRAW,
|
|
279
|
+
data: [],
|
|
280
|
+
type: _l7Core.gl.FLOAT
|
|
281
|
+
},
|
|
282
|
+
size: 1,
|
|
283
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
284
|
+
return [vertex[4]];
|
|
285
|
+
}
|
|
213
286
|
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
}]);
|
|
290
|
+
return LinearLineModel;
|
|
291
|
+
}(_BaseModel2.default);
|
|
292
|
+
|
|
293
|
+
exports.default = LinearLineModel;
|