@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,153 +1,205 @@
|
|
|
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/simplePoint.ts
|
|
23
|
-
var simplePoint_exports = {};
|
|
24
|
-
__export(simplePoint_exports, {
|
|
25
|
-
PointTriangulation: () => PointTriangulation,
|
|
26
|
-
default: () => SimplePointModel
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
27
7
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
|
|
8
|
+
exports.PointTriangulation = PointTriangulation;
|
|
9
|
+
exports.default = void 0;
|
|
10
|
+
|
|
11
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
+
|
|
13
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
14
|
+
|
|
15
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
16
|
+
|
|
17
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
18
|
+
|
|
19
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
20
|
+
|
|
21
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
22
|
+
|
|
23
|
+
var _l7Core = require("@antv/l7-core");
|
|
24
|
+
|
|
25
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
26
|
+
|
|
27
|
+
var _lodash = require("lodash");
|
|
28
|
+
|
|
29
|
+
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
30
|
+
|
|
31
|
+
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); }; }
|
|
32
|
+
|
|
33
|
+
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; } }
|
|
34
|
+
|
|
35
|
+
/* babel-plugin-inline-import '../shaders/simplePoint_frag.glsl' */
|
|
36
|
+
var simplePointFrag = "\nuniform float u_opacity : 1;\nuniform vec2 u_offsets;\nuniform float u_additive;\n\nuniform float u_stroke_opacity : 1;\n\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\n\nvarying vec4 v_color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\nvarying float v_blur;\nvarying float v_innerRadius;\n\n#pragma include \"picking\"\nvoid main() {\n vec2 center = vec2(0.5);\n\n float opacity = styleMappingMat[0][0];\n // Tip: \u7247\u5143\u5230\u4E2D\u5FC3\u70B9\u7684\u8DDD\u79BB 0 - 1\n float fragmengTocenter = distance(center, gl_PointCoord) * 2.0;\n // Tip: \u7247\u5143\u7684\u526A\u5207\u6210\u5706\u5F62\n float circleClipOpacity = 1.0 - smoothstep(v_blur, 1.0, fragmengTocenter);\n\n\n if(v_innerRadius < 0.99) {\n // \u5F53\u5B58\u5728 stroke \u4E14 stroke > 0.01\n float blurWidth = (1.0 - v_blur)/2.0;\n vec4 stroke = vec4(u_stroke_color.rgb, u_stroke_opacity);\n if(fragmengTocenter > v_innerRadius + blurWidth) {\n gl_FragColor = stroke;\n } else if(fragmengTocenter > v_innerRadius - blurWidth){\n float mixR = (fragmengTocenter - (v_innerRadius - blurWidth)) / (blurWidth * 2.0);\n gl_FragColor = mix(v_color, stroke, mixR);\n } else {\n gl_FragColor = v_color;\n }\n } else {\n // \u5F53\u4E0D\u5B58\u5728 stroke \u6216 stroke <= 0.01\n gl_FragColor = v_color;\n }\n\n gl_FragColor.a *= opacity;\n\n gl_FragColor = filterColor(gl_FragColor);\n \n if(u_additive > 0.0) {\n gl_FragColor *= circleClipOpacity;\n } else {\n gl_FragColor.a *= circleClipOpacity;\n }\n\n}\n";
|
|
37
|
+
|
|
38
|
+
/* babel-plugin-inline-import '../shaders/simplePoint_vert.glsl' */
|
|
39
|
+
var simplePointVert = "\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nattribute float a_Size;\nattribute vec4 a_Color;\nvarying vec4 v_color;\n\nuniform float u_opacity : 1;\nuniform vec2 u_offsets;\nuniform float u_stroke_width;\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\nvarying float v_blur;\nvarying float v_innerRadius;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n#pragma include \"project\"\nvoid main() {\n v_color = a_Color;\n v_blur = 1.0 - max(2.0/a_Size, 0.05);\n v_innerRadius = max((a_Size - u_stroke_width) / a_Size, 0.0);\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\nstyleMappingMat = 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 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 vec2 offset = project_pixel(textrueOffsets);\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(a_Position.xy + offset, a_Position.z, 1.0);\n } else { // else\n vec4 project_pos = project_position(vec4(a_Position, 1.0)) + vec4(a_Size / 2.,-a_Size /2.,0.,0.);\n gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy+offset),project_pos.z,project_pos.w));\n }\n\n gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;\n setPickingColor(a_PickingColor);\n}\n";
|
|
40
|
+
|
|
35
41
|
function PointTriangulation(feature) {
|
|
36
|
-
|
|
42
|
+
var coordinates = feature.coordinates;
|
|
37
43
|
return {
|
|
38
|
-
vertices:
|
|
44
|
+
vertices: (0, _toConsumableArray2.default)(coordinates),
|
|
39
45
|
indices: [0],
|
|
40
46
|
size: coordinates.length
|
|
41
47
|
};
|
|
42
48
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
|
|
50
|
+
var SimplePointModel = /*#__PURE__*/function (_BaseModel) {
|
|
51
|
+
(0, _inherits2.default)(SimplePointModel, _BaseModel);
|
|
52
|
+
|
|
53
|
+
var _super = _createSuper(SimplePointModel);
|
|
54
|
+
|
|
55
|
+
function SimplePointModel() {
|
|
56
|
+
(0, _classCallCheck2.default)(this, SimplePointModel);
|
|
57
|
+
return _super.apply(this, arguments);
|
|
48
58
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
stroke = "#fff"
|
|
57
|
-
} = this.layer.getLayerConfig();
|
|
58
|
-
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
59
|
-
opacity,
|
|
60
|
-
offsets
|
|
61
|
-
})) {
|
|
62
|
-
this.judgeStyleAttributes({
|
|
63
|
-
opacity,
|
|
64
|
-
offsets
|
|
65
|
-
});
|
|
66
|
-
const encodeData = this.layer.getEncodedData();
|
|
67
|
-
const { data, width, height } = this.calDataFrame(this.cellLength, encodeData, this.cellProperties);
|
|
68
|
-
this.rowCount = height;
|
|
69
|
-
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
70
|
-
flipY: true,
|
|
71
|
-
data,
|
|
72
|
-
format: import_l7_core.gl.LUMINANCE,
|
|
73
|
-
type: import_l7_core.gl.FLOAT,
|
|
74
|
-
width,
|
|
75
|
-
height
|
|
76
|
-
}) : this.createTexture2D({
|
|
77
|
-
flipY: true,
|
|
78
|
-
data: [1],
|
|
79
|
-
format: import_l7_core.gl.LUMINANCE,
|
|
80
|
-
type: import_l7_core.gl.FLOAT,
|
|
81
|
-
width: 1,
|
|
82
|
-
height: 1
|
|
83
|
-
});
|
|
59
|
+
|
|
60
|
+
(0, _createClass2.default)(SimplePointModel, [{
|
|
61
|
+
key: "getDefaultStyle",
|
|
62
|
+
value: function getDefaultStyle() {
|
|
63
|
+
return {
|
|
64
|
+
blend: 'additive'
|
|
65
|
+
};
|
|
84
66
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
67
|
+
}, {
|
|
68
|
+
key: "getUninforms",
|
|
69
|
+
value: function getUninforms() {
|
|
70
|
+
var _ref = this.layer.getLayerConfig(),
|
|
71
|
+
_ref$opacity = _ref.opacity,
|
|
72
|
+
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
73
|
+
_ref$offsets = _ref.offsets,
|
|
74
|
+
offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets,
|
|
75
|
+
blend = _ref.blend,
|
|
76
|
+
_ref$strokeOpacity = _ref.strokeOpacity,
|
|
77
|
+
strokeOpacity = _ref$strokeOpacity === void 0 ? 1 : _ref$strokeOpacity,
|
|
78
|
+
_ref$strokeWidth = _ref.strokeWidth,
|
|
79
|
+
strokeWidth = _ref$strokeWidth === void 0 ? 0 : _ref$strokeWidth,
|
|
80
|
+
_ref$stroke = _ref.stroke,
|
|
81
|
+
stroke = _ref$stroke === void 0 ? '#fff' : _ref$stroke;
|
|
82
|
+
|
|
83
|
+
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
84
|
+
opacity: opacity,
|
|
85
|
+
offsets: offsets
|
|
86
|
+
})) {
|
|
87
|
+
// 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量
|
|
88
|
+
this.judgeStyleAttributes({
|
|
89
|
+
opacity: opacity,
|
|
90
|
+
offsets: offsets
|
|
91
|
+
});
|
|
92
|
+
var encodeData = this.layer.getEncodedData();
|
|
93
|
+
|
|
94
|
+
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
95
|
+
data = _this$calDataFrame.data,
|
|
96
|
+
width = _this$calDataFrame.width,
|
|
97
|
+
height = _this$calDataFrame.height;
|
|
98
|
+
|
|
99
|
+
this.rowCount = height; // 当前数据纹理有多少行
|
|
100
|
+
|
|
101
|
+
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
102
|
+
flipY: true,
|
|
103
|
+
data: data,
|
|
104
|
+
format: _l7Core.gl.LUMINANCE,
|
|
105
|
+
type: _l7Core.gl.FLOAT,
|
|
106
|
+
width: width,
|
|
107
|
+
height: height
|
|
108
|
+
}) : this.createTexture2D({
|
|
109
|
+
flipY: true,
|
|
110
|
+
data: [1],
|
|
111
|
+
format: _l7Core.gl.LUMINANCE,
|
|
112
|
+
type: _l7Core.gl.FLOAT,
|
|
113
|
+
width: 1,
|
|
114
|
+
height: 1
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
u_additive: blend === 'additive' ? 1.0 : 0.0,
|
|
120
|
+
u_dataTexture: this.dataTexture,
|
|
121
|
+
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
122
|
+
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
123
|
+
u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1.0,
|
|
124
|
+
u_offsets: this.isOffsetStatic(offsets) ? offsets : [0, 0],
|
|
125
|
+
u_stroke_opacity: (0, _lodash.isNumber)(strokeOpacity) ? strokeOpacity : 1.0,
|
|
126
|
+
u_stroke_width: (0, _lodash.isNumber)(strokeWidth) ? strokeWidth : 1.0,
|
|
127
|
+
u_stroke_color: this.getStrokeColor(stroke)
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}, {
|
|
131
|
+
key: "initModels",
|
|
132
|
+
value: function initModels(callbackModel) {
|
|
133
|
+
this.buildModels(callbackModel);
|
|
134
|
+
}
|
|
135
|
+
}, {
|
|
136
|
+
key: "buildModels",
|
|
137
|
+
value: function buildModels(callbackModel) {
|
|
138
|
+
var _ref2 = this.layer.getLayerConfig(),
|
|
139
|
+
_ref2$mask = _ref2.mask,
|
|
140
|
+
mask = _ref2$mask === void 0 ? false : _ref2$mask,
|
|
141
|
+
_ref2$maskInside = _ref2.maskInside,
|
|
142
|
+
maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside;
|
|
143
|
+
|
|
144
|
+
this.layer.triangulation = PointTriangulation;
|
|
145
|
+
this.layer.buildLayerModel({
|
|
146
|
+
moduleName: 'pointSimple',
|
|
147
|
+
vertexShader: simplePointVert,
|
|
148
|
+
fragmentShader: simplePointFrag,
|
|
149
|
+
triangulation: PointTriangulation,
|
|
150
|
+
depth: {
|
|
151
|
+
enable: false
|
|
135
152
|
},
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
153
|
+
primitive: _l7Core.gl.POINTS,
|
|
154
|
+
blend: this.getBlend(),
|
|
155
|
+
stencil: (0, _l7Utils.getMask)(mask, maskInside)
|
|
156
|
+
}).then(function (model) {
|
|
157
|
+
callbackModel([model]);
|
|
158
|
+
}).catch(function (err) {
|
|
159
|
+
console.warn(err);
|
|
160
|
+
callbackModel([]);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}, {
|
|
164
|
+
key: "clearModels",
|
|
165
|
+
value: function clearModels() {
|
|
166
|
+
var _this$dataTexture;
|
|
167
|
+
|
|
168
|
+
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
169
|
+
}
|
|
170
|
+
}, {
|
|
171
|
+
key: "registerBuiltinAttributes",
|
|
172
|
+
value: function registerBuiltinAttributes() {
|
|
173
|
+
// point layer size;
|
|
174
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
175
|
+
name: 'size',
|
|
176
|
+
type: _l7Core.AttributeType.Attribute,
|
|
177
|
+
descriptor: {
|
|
178
|
+
name: 'a_Size',
|
|
179
|
+
buffer: {
|
|
180
|
+
// give the WebGL driver a hint that this buffer may change
|
|
181
|
+
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
182
|
+
data: [],
|
|
183
|
+
type: _l7Core.gl.FLOAT
|
|
184
|
+
},
|
|
185
|
+
size: 1,
|
|
186
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
187
|
+
var _feature$size = feature.size,
|
|
188
|
+
size = _feature$size === void 0 ? 1 : _feature$size;
|
|
189
|
+
return Array.isArray(size) ? [size[0]] : [size];
|
|
190
|
+
}
|
|
140
191
|
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}, {
|
|
195
|
+
key: "defaultStyleOptions",
|
|
196
|
+
value: function defaultStyleOptions() {
|
|
197
|
+
return {
|
|
198
|
+
blend: _l7Core.BlendType.additive
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
}]);
|
|
202
|
+
return SimplePointModel;
|
|
203
|
+
}(_BaseModel2.default);
|
|
204
|
+
|
|
205
|
+
exports.default = SimplePointModel;
|