@antv/l7-layers 2.15.1 → 2.15.3
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/Geometry/index.js +9 -31
- package/es/Geometry/models/billboard.js +51 -89
- package/es/Geometry/models/plane.js +81 -143
- package/es/Geometry/models/sprite.js +60 -118
- package/es/canvas/index.js +10 -33
- package/es/canvas/models/canvas.js +41 -97
- package/es/citybuliding/building.js +8 -27
- package/es/citybuliding/models/build.js +57 -82
- package/es/core/BaseLayer.js +320 -484
- package/es/core/BaseModel.js +97 -126
- package/es/core/LayerPickService.js +21 -32
- package/es/core/TextureService.js +0 -13
- package/es/core/interface.js +17 -24
- package/es/core/shape/Path.js +13 -20
- package/es/core/shape/extrude.js +10 -31
- package/es/core/triangulation.js +54 -114
- package/es/earth/index.js +9 -33
- package/es/earth/models/atmosphere.js +30 -54
- package/es/earth/models/base.js +47 -85
- package/es/earth/models/bloomsphere.js +30 -54
- package/es/earth/utils.js +9 -13
- package/es/heatmap/index.js +10 -40
- package/es/heatmap/models/grid.js +28 -52
- package/es/heatmap/models/grid3d.js +28 -52
- package/es/heatmap/models/heatmap.js +91 -146
- package/es/heatmap/models/hexagon.js +28 -52
- package/es/heatmap/triangulation.js +0 -4
- package/es/image/index.js +9 -28
- package/es/image/models/image.js +66 -100
- package/es/index.js +9 -17
- package/es/line/index.js +9 -34
- package/es/line/models/arc.js +66 -118
- package/es/line/models/arc_3d.js +60 -108
- package/es/line/models/earthArc_3d.js +63 -111
- package/es/line/models/great_circle.js +56 -100
- package/es/line/models/half.js +46 -77
- package/es/line/models/line.js +94 -148
- package/es/line/models/linearline.js +45 -80
- package/es/line/models/simpleLine.js +41 -74
- package/es/line/models/wall.js +52 -92
- package/es/mask/index.js +9 -28
- package/es/mask/models/fill.js +29 -54
- package/es/plugins/DataMappingPlugin.js +80 -117
- package/es/plugins/DataSourcePlugin.js +45 -68
- package/es/plugins/FeatureScalePlugin.js +67 -122
- package/es/plugins/LayerAnimateStylePlugin.js +0 -5
- package/es/plugins/LayerMaskPlugin.js +3 -11
- package/es/plugins/LayerModelPlugin.js +67 -104
- package/es/plugins/LayerStylePlugin.js +3 -9
- package/es/plugins/LightingPlugin.js +12 -18
- package/es/plugins/MultiPassRendererPlugin.js +11 -16
- package/es/plugins/PixelPickingPlugin.js +12 -21
- package/es/plugins/RegisterStyleAttributePlugin.js +5 -12
- package/es/plugins/ShaderUniformPlugin.js +13 -27
- package/es/plugins/UpdateModelPlugin.js +0 -5
- package/es/plugins/UpdateStyleAttributePlugin.js +5 -11
- package/es/point/index.js +26 -77
- package/es/point/models/earthExtrude.js +61 -102
- package/es/point/models/earthFill.js +57 -87
- package/es/point/models/extrude.js +60 -101
- package/es/point/models/fill.js +70 -100
- package/es/point/models/fillmage.js +63 -107
- package/es/point/models/image.js +48 -88
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +30 -54
- package/es/point/models/radar.js +40 -64
- package/es/point/models/simplePoint.js +41 -69
- package/es/point/models/text.d.ts +2 -0
- package/es/point/models/text.js +214 -295
- package/es/point/shape/extrude.js +4 -13
- package/es/polygon/index.js +11 -40
- package/es/polygon/models/extrude.js +48 -92
- package/es/polygon/models/fill.js +54 -88
- package/es/polygon/models/index.js +3 -2
- package/es/polygon/models/ocean.js +42 -76
- package/es/polygon/models/water.js +37 -71
- package/es/raster/buffers/triangulation.js +2 -4
- package/es/raster/index.js +9 -32
- package/es/raster/models/raster.js +80 -116
- package/es/raster/models/rasterRgb.js +84 -127
- package/es/raster/models/rasterTerrainRgb.js +56 -84
- package/es/tile/interaction/getRasterData.js +14 -20
- package/es/tile/interaction/utils.js +7 -9
- package/es/tile/manager/base.js +63 -96
- package/es/tile/service/TileLayerService.js +30 -52
- package/es/tile/service/TilePickService.js +26 -40
- package/es/tile/service/TileSourceService.js +3 -7
- package/es/tile/tileFactory/DebugTile.js +28 -45
- package/es/tile/tileFactory/ImageTile.js +20 -38
- package/es/tile/tileFactory/MaskTile.js +22 -43
- package/es/tile/tileFactory/RasterRGBTile.js +22 -42
- package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
- package/es/tile/tileFactory/RasterTile.js +30 -53
- package/es/tile/tileFactory/Tile.js +63 -97
- package/es/tile/tileFactory/VectorTile.js +41 -68
- package/es/tile/tileFactory/index.js +0 -11
- package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
- package/es/tile/tileFactory/util.js +0 -3
- package/es/tile/tileLayer/BaseLayer.js +105 -146
- package/es/tile/utils.js +1 -1
- package/es/utils/blend.js +0 -2
- package/es/utils/collision-index.js +9 -16
- package/es/utils/dataMappingStyle.js +8 -18
- package/es/utils/extrude_polyline.js +101 -149
- package/es/utils/grid-index.js +2 -27
- package/es/utils/identityScale.js +0 -8
- package/es/utils/layerData.js +30 -44
- package/es/utils/multiPassRender.js +11 -13
- package/es/utils/polylineNormal.js +31 -37
- package/es/utils/simpleLine.js +2 -16
- package/es/utils/stencil.js +2 -3
- package/es/utils/symbol-layout.js +27 -53
- package/es/wind/index.js +9 -29
- package/es/wind/models/utils.js +26 -51
- package/es/wind/models/wind.js +101 -147
- package/es/wind/models/windRender.js +53 -66
- package/lib/Geometry/index.js +9 -38
- package/lib/Geometry/models/billboard.js +51 -97
- package/lib/Geometry/models/index.js +0 -5
- package/lib/Geometry/models/plane.js +79 -151
- package/lib/Geometry/models/sprite.js +60 -127
- package/lib/canvas/index.js +10 -40
- package/lib/canvas/models/canvas.js +41 -101
- package/lib/canvas/models/index.js +0 -3
- package/lib/citybuliding/building.js +8 -35
- package/lib/citybuliding/models/build.js +57 -92
- package/lib/core/BaseLayer.js +320 -478
- package/lib/core/BaseModel.js +97 -139
- package/lib/core/LayerPickService.js +21 -37
- package/lib/core/TextureService.js +0 -16
- package/lib/core/interface.js +21 -31
- package/lib/core/schema.js +0 -1
- package/lib/core/shape/Path.js +14 -31
- package/lib/core/shape/extrude.js +10 -54
- package/lib/core/triangulation.js +53 -153
- package/lib/earth/index.js +9 -43
- package/lib/earth/models/atmosphere.js +30 -63
- package/lib/earth/models/base.js +47 -90
- package/lib/earth/models/bloomsphere.js +30 -63
- package/lib/earth/utils.js +7 -31
- package/lib/heatmap/index.js +10 -48
- package/lib/heatmap/models/grid.js +28 -60
- package/lib/heatmap/models/grid3d.js +28 -60
- package/lib/heatmap/models/heatmap.js +91 -162
- package/lib/heatmap/models/hexagon.js +28 -60
- package/lib/heatmap/models/index.js +0 -6
- package/lib/heatmap/triangulation.js +0 -5
- package/lib/image/index.js +9 -36
- package/lib/image/models/image.js +66 -109
- package/lib/image/models/index.js +0 -3
- package/lib/index.js +7 -61
- package/lib/line/index.js +9 -40
- package/lib/line/models/arc.js +64 -128
- package/lib/line/models/arc_3d.js +58 -119
- package/lib/line/models/earthArc_3d.js +61 -122
- package/lib/line/models/great_circle.js +56 -111
- package/lib/line/models/half.js +46 -87
- package/lib/line/models/index.js +0 -11
- package/lib/line/models/line.js +92 -156
- package/lib/line/models/linearline.js +45 -92
- package/lib/line/models/simpleLine.js +41 -84
- package/lib/line/models/wall.js +52 -103
- package/lib/mask/index.js +9 -36
- package/lib/mask/models/fill.js +29 -63
- package/lib/mask/models/index.js +0 -3
- package/lib/plugins/DataMappingPlugin.js +80 -128
- package/lib/plugins/DataSourcePlugin.js +45 -76
- package/lib/plugins/FeatureScalePlugin.js +67 -138
- package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
- package/lib/plugins/LayerMaskPlugin.js +4 -17
- package/lib/plugins/LayerModelPlugin.js +68 -113
- package/lib/plugins/LayerStylePlugin.js +4 -14
- package/lib/plugins/LightingPlugin.js +12 -25
- package/lib/plugins/MultiPassRendererPlugin.js +11 -22
- package/lib/plugins/PixelPickingPlugin.js +12 -27
- package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
- package/lib/plugins/ShaderUniformPlugin.js +13 -34
- package/lib/plugins/UpdateModelPlugin.js +1 -10
- package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
- package/lib/point/index.js +26 -83
- package/lib/point/models/earthExtrude.js +61 -113
- package/lib/point/models/earthFill.js +57 -117
- package/lib/point/models/extrude.js +60 -111
- package/lib/point/models/fill.js +68 -109
- package/lib/point/models/fillmage.js +61 -115
- package/lib/point/models/image.js +48 -98
- package/lib/point/models/index.js +1 -12
- package/lib/point/models/normal.js +30 -64
- package/lib/point/models/radar.js +40 -74
- package/lib/point/models/simplePoint.js +41 -79
- package/lib/point/models/text.js +214 -303
- package/lib/point/shape/extrude.js +4 -20
- package/lib/polygon/index.js +11 -48
- package/lib/polygon/models/extrude.js +48 -103
- package/lib/polygon/models/fill.js +54 -98
- package/lib/polygon/models/index.js +2 -14
- package/lib/polygon/models/ocean.js +42 -88
- package/lib/polygon/models/water.js +37 -82
- package/lib/raster/buffers/triangulation.js +3 -7
- package/lib/raster/index.js +9 -40
- package/lib/raster/models/index.js +0 -5
- package/lib/raster/models/raster.js +80 -125
- package/lib/raster/models/rasterRgb.js +84 -139
- package/lib/raster/models/rasterTerrainRgb.js +56 -93
- package/lib/tile/interaction/getRasterData.js +14 -25
- package/lib/tile/interaction/utils.js +7 -19
- package/lib/tile/manager/base.js +63 -104
- package/lib/tile/service/TileLayerService.js +30 -57
- package/lib/tile/service/TilePickService.js +26 -48
- package/lib/tile/service/TileSourceService.js +2 -16
- package/lib/tile/style/utils.js +0 -3
- package/lib/tile/tileFactory/DebugTile.js +28 -53
- package/lib/tile/tileFactory/ImageTile.js +20 -46
- package/lib/tile/tileFactory/MaskTile.js +22 -51
- package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
- package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
- package/lib/tile/tileFactory/RasterTile.js +30 -63
- package/lib/tile/tileFactory/Tile.js +63 -102
- package/lib/tile/tileFactory/VectorTile.js +41 -76
- package/lib/tile/tileFactory/index.js +0 -25
- package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
- package/lib/tile/tileFactory/util.js +0 -9
- package/lib/tile/tileLayer/BaseLayer.js +105 -153
- package/lib/tile/utils.js +1 -5
- package/lib/utils/blend.js +0 -5
- package/lib/utils/collision-index.js +9 -25
- package/lib/utils/dataMappingStyle.js +8 -19
- package/lib/utils/extrude_polyline.js +101 -181
- package/lib/utils/grid-index.js +2 -28
- package/lib/utils/identityScale.js +0 -9
- package/lib/utils/layerData.js +30 -49
- package/lib/utils/multiPassRender.js +11 -16
- package/lib/utils/polylineNormal.js +31 -66
- package/lib/utils/simpleLine.js +2 -21
- package/lib/utils/stencil.js +0 -4
- package/lib/utils/symbol-layout.js +27 -55
- package/lib/wind/index.js +9 -37
- package/lib/wind/models/index.js +0 -3
- package/lib/wind/models/utils.js +26 -62
- package/lib/wind/models/wind.js +101 -157
- package/lib/wind/models/windRender.js +53 -71
- package/lib/wind/models/windShader.js +0 -1
- package/package.json +7 -7
|
@@ -1,88 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
12
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
-
|
|
20
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
-
|
|
22
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
-
|
|
24
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
-
|
|
26
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
-
|
|
28
17
|
var _l7Core = require("@antv/l7-core");
|
|
29
|
-
|
|
30
18
|
var _l7Utils = require("@antv/l7-utils");
|
|
31
|
-
|
|
32
19
|
var _lodash = require("lodash");
|
|
33
|
-
|
|
34
20
|
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
35
|
-
|
|
36
21
|
var _interface = require("../../core/interface");
|
|
37
|
-
|
|
38
22
|
var _triangulation = require("../../core/triangulation");
|
|
39
|
-
|
|
40
23
|
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); }; }
|
|
41
|
-
|
|
42
24
|
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; } }
|
|
43
|
-
|
|
44
25
|
/* babel-plugin-inline-import '../shaders/image/fillImage_frag.glsl' */
|
|
45
26
|
// static pointLayer shader - not support animate
|
|
46
27
|
var pointFillFrag = "uniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\nvarying vec2 v_uv; // \u672C\u8EAB\u7684 uv \u5750\u6807\nvarying vec2 v_Iconuv;\n\nvoid main() {\n\n float opacity = styleMappingMat[0][0];\n\n vec2 pos = v_Iconuv / u_textSize + v_uv / u_textSize * 64.;\n gl_FragColor = texture2D(u_texture, pos);\n gl_FragColor.a *= opacity;\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
47
|
-
|
|
48
28
|
/* babel-plugin-inline-import '../shaders/image/fillImage_vert.glsl' */
|
|
49
29
|
var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute vec2 a_Uv;\nattribute float a_Rotate;\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 mat2 u_RotateMatrix;\nuniform int u_Size_Unit;\n\nvarying vec2 v_uv; // \u672C\u8EAB\u7684 uv \u5750\u6807\nvarying vec2 v_Iconuv; // icon \u8D34\u56FE\u7684 uv \u5750\u6807\n\nuniform float u_raisingHeight: 0.0;\nuniform float u_heightfixed: 0.0;\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\n v_uv = (a_Extrude.xy + 1.0)/2.0;\n v_uv.y = 1.0 - v_uv.y;\n v_Iconuv = a_Uv;\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]\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 highp float angle_sin = sin(a_Rotate);\n highp float angle_cos = cos(a_Rotate);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n float newSize = a_Size;\n if(u_Size_Unit == 1) {\n newSize = newSize * u_PixelsPerMeter.z;\n }\n\n // vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);\n vec2 offset = (rotation_matrix * u_RotateMatrix * extrude.xy * (newSize) + textrueOffsets);\n vec3 aPosition = a_Position;\n\n offset = project_pixel(offset);\n\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n float raisingHeight = u_raisingHeight;\n if(u_heightfixed < 1.0) { // height fixed\n raisingHeight = project_pixel(u_raisingHeight);\n } else {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raisingHeight = u_raisingHeight * mapboxZoomScale;\n }\n }\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp *vec4(project_pos.xy + offset, raisingHeight, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));\n }\n \n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
50
|
-
|
|
51
30
|
var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
52
31
|
(0, _inherits2.default)(FillImageModel, _BaseModel);
|
|
53
|
-
|
|
54
32
|
var _super = _createSuper(FillImageModel);
|
|
55
|
-
|
|
56
33
|
function FillImageModel() {
|
|
57
34
|
var _this;
|
|
58
|
-
|
|
59
35
|
(0, _classCallCheck2.default)(this, FillImageModel);
|
|
60
|
-
|
|
61
36
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
62
37
|
args[_key] = arguments[_key];
|
|
63
38
|
}
|
|
64
|
-
|
|
65
39
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
66
40
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meter2coord", 1);
|
|
67
41
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isMeter", false);
|
|
68
42
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "radian", 0);
|
|
69
43
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateTexture", function () {
|
|
70
44
|
var createTexture2D = _this.rendererService.createTexture2D;
|
|
71
|
-
|
|
72
45
|
if (_this.texture) {
|
|
73
46
|
_this.texture.update({
|
|
74
47
|
data: _this.iconService.getCanvas(),
|
|
75
48
|
mag: 'linear',
|
|
76
49
|
min: 'linear mipmap nearest',
|
|
77
50
|
mipmap: true
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
|
|
51
|
+
});
|
|
52
|
+
// 更新完纹理后在更新的图层的时候需要更新所有的图层
|
|
81
53
|
_this.layerService.throttleRenderLayers();
|
|
82
|
-
|
|
83
54
|
return;
|
|
84
55
|
}
|
|
85
|
-
|
|
86
56
|
_this.texture = createTexture2D({
|
|
87
57
|
data: _this.iconService.getCanvas(),
|
|
88
58
|
mag: _l7Core.gl.LINEAR,
|
|
@@ -95,24 +65,23 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
95
65
|
});
|
|
96
66
|
return _this;
|
|
97
67
|
}
|
|
98
|
-
|
|
99
68
|
(0, _createClass2.default)(FillImageModel, [{
|
|
100
69
|
key: "getUninforms",
|
|
101
|
-
value:
|
|
70
|
+
value:
|
|
71
|
+
// 旋转的弧度
|
|
102
72
|
function getUninforms() {
|
|
103
73
|
var _ref = this.layer.getLayerConfig(),
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
74
|
+
_ref$opacity = _ref.opacity,
|
|
75
|
+
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
76
|
+
_ref$offsets = _ref.offsets,
|
|
77
|
+
offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets,
|
|
78
|
+
rotation = _ref.rotation,
|
|
79
|
+
_ref$raisingHeight = _ref.raisingHeight,
|
|
80
|
+
raisingHeight = _ref$raisingHeight === void 0 ? 0.0 : _ref$raisingHeight,
|
|
81
|
+
_ref$heightfixed = _ref.heightfixed,
|
|
82
|
+
heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
|
|
83
|
+
_ref$unit = _ref.unit,
|
|
84
|
+
unit = _ref$unit === void 0 ? 'pixel' : _ref$unit;
|
|
116
85
|
if (this.rendererService.getDirty()) {
|
|
117
86
|
this.texture.bind();
|
|
118
87
|
}
|
|
@@ -123,17 +92,12 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
123
92
|
* GAODE2.x -1
|
|
124
93
|
* GAODE1.x -1
|
|
125
94
|
*/
|
|
126
|
-
|
|
127
|
-
|
|
128
95
|
var rotateFlag = 1;
|
|
129
|
-
|
|
130
96
|
if (this.mapService.version === 'GAODE2.x' || this.mapService.version === 'GAODE1.x') {
|
|
131
97
|
rotateFlag = -1;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
98
|
+
}
|
|
99
|
+
// 控制图标的旋转角度(绕 Z 轴旋转)
|
|
135
100
|
this.radian = rotation !== undefined ? rotateFlag * Math.PI * rotation / 180 : rotateFlag * Math.PI * (this.mapService.getRotation() % 360) / 180;
|
|
136
|
-
|
|
137
101
|
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
138
102
|
opacity: opacity,
|
|
139
103
|
offsets: offsets
|
|
@@ -144,12 +108,10 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
144
108
|
offsets: offsets
|
|
145
109
|
});
|
|
146
110
|
var encodeData = this.layer.getEncodedData();
|
|
147
|
-
|
|
148
111
|
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
112
|
+
data = _this$calDataFrame.data,
|
|
113
|
+
width = _this$calDataFrame.width,
|
|
114
|
+
height = _this$calDataFrame.height;
|
|
153
115
|
this.rowCount = height; // 当前数据纹理有多少行
|
|
154
116
|
|
|
155
117
|
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
@@ -168,7 +130,6 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
168
130
|
height: 1
|
|
169
131
|
});
|
|
170
132
|
}
|
|
171
|
-
|
|
172
133
|
return {
|
|
173
134
|
u_raisingHeight: Number(raisingHeight),
|
|
174
135
|
u_heightfixed: Number(heightfixed),
|
|
@@ -193,25 +154,20 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
193
154
|
value: function () {
|
|
194
155
|
var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
195
156
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
196
|
-
while (1) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
case "end":
|
|
205
|
-
return _context.stop();
|
|
206
|
-
}
|
|
157
|
+
while (1) switch (_context.prev = _context.next) {
|
|
158
|
+
case 0:
|
|
159
|
+
this.iconService.on('imageUpdate', this.updateTexture);
|
|
160
|
+
this.updateTexture();
|
|
161
|
+
return _context.abrupt("return", this.buildModels());
|
|
162
|
+
case 3:
|
|
163
|
+
case "end":
|
|
164
|
+
return _context.stop();
|
|
207
165
|
}
|
|
208
166
|
}, _callee, this);
|
|
209
167
|
}));
|
|
210
|
-
|
|
211
168
|
function initModels() {
|
|
212
169
|
return _initModels.apply(this, arguments);
|
|
213
170
|
}
|
|
214
|
-
|
|
215
171
|
return initModels;
|
|
216
172
|
}()
|
|
217
173
|
}, {
|
|
@@ -220,57 +176,50 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
220
176
|
var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
221
177
|
var model;
|
|
222
178
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
223
|
-
while (1) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
case 4:
|
|
246
|
-
case "end":
|
|
247
|
-
return _context2.stop();
|
|
248
|
-
}
|
|
179
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
180
|
+
case 0:
|
|
181
|
+
_context2.next = 2;
|
|
182
|
+
return this.layer.buildLayerModel({
|
|
183
|
+
moduleName: 'pointFillImage',
|
|
184
|
+
vertexShader: pointFillVert,
|
|
185
|
+
fragmentShader: pointFillFrag,
|
|
186
|
+
triangulation: _triangulation.PointFillTriangulation,
|
|
187
|
+
depth: {
|
|
188
|
+
enable: false
|
|
189
|
+
},
|
|
190
|
+
cull: {
|
|
191
|
+
enable: true,
|
|
192
|
+
face: (0, _l7Utils.getCullFace)(this.mapService.version)
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
case 2:
|
|
196
|
+
model = _context2.sent;
|
|
197
|
+
return _context2.abrupt("return", [model]);
|
|
198
|
+
case 4:
|
|
199
|
+
case "end":
|
|
200
|
+
return _context2.stop();
|
|
249
201
|
}
|
|
250
202
|
}, _callee2, this);
|
|
251
203
|
}));
|
|
252
|
-
|
|
253
204
|
function buildModels() {
|
|
254
205
|
return _buildModels.apply(this, arguments);
|
|
255
206
|
}
|
|
256
|
-
|
|
257
207
|
return buildModels;
|
|
258
208
|
}()
|
|
259
209
|
}, {
|
|
260
210
|
key: "clearModels",
|
|
261
211
|
value: function clearModels() {
|
|
262
212
|
var _this$texture, _this$dataTexture;
|
|
263
|
-
|
|
264
213
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
265
214
|
(_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
|
|
266
215
|
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
267
|
-
}
|
|
216
|
+
}
|
|
268
217
|
|
|
218
|
+
// overwrite baseModel func
|
|
269
219
|
}, {
|
|
270
220
|
key: "registerBuiltinAttributes",
|
|
271
221
|
value: function registerBuiltinAttributes() {
|
|
272
222
|
var _this2 = this;
|
|
273
|
-
|
|
274
223
|
this.styleAttributeService.registerStyleAttribute({
|
|
275
224
|
name: 'rotate',
|
|
276
225
|
type: _l7Core.AttributeType.Attribute,
|
|
@@ -284,7 +233,7 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
284
233
|
size: 1,
|
|
285
234
|
update: function update(feature) {
|
|
286
235
|
var _feature$rotate = feature.rotate,
|
|
287
|
-
|
|
236
|
+
rotate = _feature$rotate === void 0 ? 0 : _feature$rotate;
|
|
288
237
|
return Array.isArray(rotate) ? [rotate[0]] : [rotate];
|
|
289
238
|
}
|
|
290
239
|
}
|
|
@@ -303,16 +252,13 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
303
252
|
size: 2,
|
|
304
253
|
update: function update(feature) {
|
|
305
254
|
var iconMap = _this2.iconService.getIconMap();
|
|
306
|
-
|
|
307
255
|
var shape = feature.shape;
|
|
308
|
-
|
|
309
256
|
var _ref2 = iconMap[shape] || {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
257
|
+
x: -64,
|
|
258
|
+
y: -64
|
|
259
|
+
},
|
|
260
|
+
x = _ref2.x,
|
|
261
|
+
y = _ref2.y;
|
|
316
262
|
return [x, y];
|
|
317
263
|
}
|
|
318
264
|
}
|
|
@@ -335,8 +281,9 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
335
281
|
return [extrude[extrudeIndex], extrude[extrudeIndex + 1], extrude[extrudeIndex + 2]];
|
|
336
282
|
}
|
|
337
283
|
}
|
|
338
|
-
});
|
|
284
|
+
});
|
|
339
285
|
|
|
286
|
+
// point layer size;
|
|
340
287
|
this.styleAttributeService.registerStyleAttribute({
|
|
341
288
|
name: 'size',
|
|
342
289
|
type: _l7Core.AttributeType.Attribute,
|
|
@@ -351,7 +298,7 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
351
298
|
size: 1,
|
|
352
299
|
update: function update(feature) {
|
|
353
300
|
var _feature$size = feature.size,
|
|
354
|
-
|
|
301
|
+
size = _feature$size === void 0 ? 5 : _feature$size;
|
|
355
302
|
return Array.isArray(size) ? [size[0]] : [size];
|
|
356
303
|
}
|
|
357
304
|
}
|
|
@@ -360,5 +307,4 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
360
307
|
}]);
|
|
361
308
|
return FillImageModel;
|
|
362
309
|
}(_BaseModel2.default);
|
|
363
|
-
|
|
364
310
|
exports.default = FillImageModel;
|
|
@@ -1,83 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
12
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
-
|
|
20
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
-
|
|
22
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
-
|
|
24
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
-
|
|
26
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
-
|
|
28
17
|
var _l7Core = require("@antv/l7-core");
|
|
29
|
-
|
|
30
18
|
var _lodash = require("lodash");
|
|
31
|
-
|
|
32
19
|
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
33
|
-
|
|
34
20
|
var _triangulation = require("../../core/triangulation");
|
|
35
|
-
|
|
36
21
|
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
22
|
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
23
|
/* babel-plugin-inline-import '../shaders/image_frag.glsl' */
|
|
41
24
|
var pointImageFrag = "\nuniform sampler2D u_texture;\nvarying vec4 v_color;\nvarying vec2 v_uv;\nuniform vec2 u_textSize;\nuniform float u_opacity : 1;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"picking\"\n\nvoid main(){\n float opacity = styleMappingMat[0][0];\n float size = styleMappingMat[1][0];\n vec2 pos = v_uv / u_textSize + gl_PointCoord / u_textSize * 64.;\n vec4 textureColor;\n\n // Y = 0.299R + 0.587G + 0.114B // \u4EAE\u5EA6\u63D0\u53D6\n \n textureColor = texture2D(u_texture, pos);\n\n // Tip: \u53BB\u9664\u8FB9\u7F18\u90E8\u5206 mipmap \u5BFC\u81F4\u7684\u6DF7\u5408\u53D8\u6697\n float fragmengTocenter = distance(vec2(0.5), gl_PointCoord);\n if(fragmengTocenter >= 0.5) {\n float luma = 0.299 * textureColor.r + 0.587 * textureColor.g + 0.114 * textureColor.b;\n textureColor.a *= luma;\n }\n \n \n\n if(all(lessThan(v_color, vec4(1.0+0.00001))) && all(greaterThan(v_color, vec4(1.0-0.00001))) || v_color==vec4(1.0)){\n gl_FragColor= textureColor;\n }else {\n gl_FragColor= step(0.01, textureColor.z) * v_color;\n }\n\n gl_FragColor.a = gl_FragColor.a * opacity;\n \n if (gl_FragColor.a < 0.01) {\n discard;\n }\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
42
|
-
|
|
43
25
|
/* babel-plugin-inline-import '../shaders/image_vert.glsl' */
|
|
44
26
|
var pointImageVert = "precision highp float;\nattribute vec3 a_Position;\nattribute vec4 a_Color;\nattribute vec2 a_Uv;\nattribute float a_Size;\nvarying vec4 v_color;\nvarying vec2 v_uv;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform vec2 u_offsets;\n\nuniform float u_opacity : 1;\nuniform float u_raisingHeight: 0.0;\nuniform float u_heightfixed: 0.0;\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\n#pragma include \"projection\"\n#pragma include \"picking\"\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\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 styleMappingMat[1][0] = a_Size;\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 - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n v_color = a_Color;\n v_uv = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n \n vec2 offset = project_pixel(textrueOffsets);\n\n float raisingHeight = u_raisingHeight;\n if(u_heightfixed < 1.0) { // false\n raisingHeight = project_pixel(u_raisingHeight);\n } else {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raisingHeight = u_raisingHeight * mapboxZoomScale;\n }\n }\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, raisingHeight, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));\n }\n\n gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;\n setPickingColor(a_PickingColor);\n}\n";
|
|
45
|
-
|
|
46
27
|
var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
47
28
|
(0, _inherits2.default)(ImageModel, _BaseModel);
|
|
48
|
-
|
|
49
29
|
var _super = _createSuper(ImageModel);
|
|
50
|
-
|
|
51
30
|
function ImageModel() {
|
|
52
31
|
var _this;
|
|
53
|
-
|
|
54
32
|
(0, _classCallCheck2.default)(this, ImageModel);
|
|
55
|
-
|
|
56
33
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
57
34
|
args[_key] = arguments[_key];
|
|
58
35
|
}
|
|
59
|
-
|
|
60
36
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
61
37
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateTexture", function () {
|
|
62
38
|
var createTexture2D = _this.rendererService.createTexture2D;
|
|
63
|
-
|
|
64
39
|
if (_this.texture) {
|
|
65
40
|
_this.texture.update({
|
|
66
41
|
data: _this.iconService.getCanvas(),
|
|
67
42
|
mag: 'linear',
|
|
68
43
|
min: 'linear mipmap nearest',
|
|
69
44
|
mipmap: true
|
|
70
|
-
});
|
|
45
|
+
});
|
|
46
|
+
// 更新完纹理后在更新的图层的时候需要更新所有的图层
|
|
71
47
|
// this.layer.layerModelNeedUpdate = true;
|
|
72
|
-
|
|
73
|
-
|
|
74
48
|
setTimeout(function () {
|
|
75
49
|
// 延迟渲染
|
|
76
50
|
_this.layerService.throttleRenderLayers();
|
|
77
51
|
});
|
|
78
52
|
return;
|
|
79
53
|
}
|
|
80
|
-
|
|
81
54
|
_this.texture = createTexture2D({
|
|
82
55
|
data: _this.iconService.getCanvas(),
|
|
83
56
|
mag: _l7Core.gl.LINEAR,
|
|
@@ -90,24 +63,21 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
90
63
|
});
|
|
91
64
|
return _this;
|
|
92
65
|
}
|
|
93
|
-
|
|
94
66
|
(0, _createClass2.default)(ImageModel, [{
|
|
95
67
|
key: "getUninforms",
|
|
96
68
|
value: function getUninforms() {
|
|
97
69
|
var _ref = this.layer.getLayerConfig(),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
70
|
+
_ref$opacity = _ref.opacity,
|
|
71
|
+
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
72
|
+
_ref$offsets = _ref.offsets,
|
|
73
|
+
offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets,
|
|
74
|
+
_ref$raisingHeight = _ref.raisingHeight,
|
|
75
|
+
raisingHeight = _ref$raisingHeight === void 0 ? 0 : _ref$raisingHeight,
|
|
76
|
+
_ref$heightfixed = _ref.heightfixed,
|
|
77
|
+
heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed;
|
|
107
78
|
if (this.rendererService.getDirty()) {
|
|
108
79
|
this.texture.bind();
|
|
109
80
|
}
|
|
110
|
-
|
|
111
81
|
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
112
82
|
opacity: opacity,
|
|
113
83
|
offsets: offsets
|
|
@@ -117,12 +87,10 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
117
87
|
offsets: offsets
|
|
118
88
|
});
|
|
119
89
|
var encodeData = this.layer.getEncodedData();
|
|
120
|
-
|
|
121
90
|
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
91
|
+
data = _this$calDataFrame.data,
|
|
92
|
+
width = _this$calDataFrame.width,
|
|
93
|
+
height = _this$calDataFrame.height;
|
|
126
94
|
this.rowCount = height; // 当前数据纹理有多少行
|
|
127
95
|
|
|
128
96
|
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
@@ -141,7 +109,6 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
141
109
|
height: 1
|
|
142
110
|
});
|
|
143
111
|
}
|
|
144
|
-
|
|
145
112
|
return {
|
|
146
113
|
u_raisingHeight: Number(raisingHeight),
|
|
147
114
|
u_heightfixed: Number(heightfixed),
|
|
@@ -159,32 +126,26 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
159
126
|
value: function () {
|
|
160
127
|
var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
161
128
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
162
|
-
while (1) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
case "end":
|
|
171
|
-
return _context.stop();
|
|
172
|
-
}
|
|
129
|
+
while (1) switch (_context.prev = _context.next) {
|
|
130
|
+
case 0:
|
|
131
|
+
this.iconService.on('imageUpdate', this.updateTexture);
|
|
132
|
+
this.updateTexture();
|
|
133
|
+
return _context.abrupt("return", this.buildModels());
|
|
134
|
+
case 3:
|
|
135
|
+
case "end":
|
|
136
|
+
return _context.stop();
|
|
173
137
|
}
|
|
174
138
|
}, _callee, this);
|
|
175
139
|
}));
|
|
176
|
-
|
|
177
140
|
function initModels() {
|
|
178
141
|
return _initModels.apply(this, arguments);
|
|
179
142
|
}
|
|
180
|
-
|
|
181
143
|
return initModels;
|
|
182
144
|
}()
|
|
183
145
|
}, {
|
|
184
146
|
key: "clearModels",
|
|
185
147
|
value: function clearModels() {
|
|
186
148
|
var _this$texture, _this$dataTexture;
|
|
187
|
-
|
|
188
149
|
(_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
|
|
189
150
|
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
190
151
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
@@ -195,44 +156,37 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
195
156
|
var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
196
157
|
var model;
|
|
197
158
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
198
|
-
while (1) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
case 4:
|
|
218
|
-
case "end":
|
|
219
|
-
return _context2.stop();
|
|
220
|
-
}
|
|
159
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
160
|
+
case 0:
|
|
161
|
+
_context2.next = 2;
|
|
162
|
+
return this.layer.buildLayerModel({
|
|
163
|
+
moduleName: 'pointImage',
|
|
164
|
+
vertexShader: pointImageVert,
|
|
165
|
+
fragmentShader: pointImageFrag,
|
|
166
|
+
triangulation: _triangulation.PointImageTriangulation,
|
|
167
|
+
depth: {
|
|
168
|
+
enable: false
|
|
169
|
+
},
|
|
170
|
+
primitive: _l7Core.gl.POINTS
|
|
171
|
+
});
|
|
172
|
+
case 2:
|
|
173
|
+
model = _context2.sent;
|
|
174
|
+
return _context2.abrupt("return", [model]);
|
|
175
|
+
case 4:
|
|
176
|
+
case "end":
|
|
177
|
+
return _context2.stop();
|
|
221
178
|
}
|
|
222
179
|
}, _callee2, this);
|
|
223
180
|
}));
|
|
224
|
-
|
|
225
181
|
function buildModels() {
|
|
226
182
|
return _buildModels.apply(this, arguments);
|
|
227
183
|
}
|
|
228
|
-
|
|
229
184
|
return buildModels;
|
|
230
185
|
}()
|
|
231
186
|
}, {
|
|
232
187
|
key: "registerBuiltinAttributes",
|
|
233
188
|
value: function registerBuiltinAttributes() {
|
|
234
189
|
var _this2 = this;
|
|
235
|
-
|
|
236
190
|
// point layer size;
|
|
237
191
|
this.styleAttributeService.registerStyleAttribute({
|
|
238
192
|
name: 'size',
|
|
@@ -248,12 +202,13 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
248
202
|
size: 1,
|
|
249
203
|
update: function update(feature) {
|
|
250
204
|
var _feature$size = feature.size,
|
|
251
|
-
|
|
205
|
+
size = _feature$size === void 0 ? 5 : _feature$size;
|
|
252
206
|
return Array.isArray(size) ? [size[0]] : [size];
|
|
253
207
|
}
|
|
254
208
|
}
|
|
255
|
-
});
|
|
209
|
+
});
|
|
256
210
|
|
|
211
|
+
// point layer size;
|
|
257
212
|
this.styleAttributeService.registerStyleAttribute({
|
|
258
213
|
name: 'uv',
|
|
259
214
|
type: _l7Core.AttributeType.Attribute,
|
|
@@ -268,17 +223,13 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
268
223
|
size: 2,
|
|
269
224
|
update: function update(feature) {
|
|
270
225
|
var iconMap = _this2.iconService.getIconMap();
|
|
271
|
-
|
|
272
226
|
var shape = feature.shape;
|
|
273
|
-
|
|
274
227
|
var _ref2 = iconMap[shape] || {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
228
|
+
x: -64,
|
|
229
|
+
y: -64
|
|
230
|
+
},
|
|
231
|
+
x = _ref2.x,
|
|
232
|
+
y = _ref2.y; // 非画布区域,默认的图标改为透明
|
|
282
233
|
return [x, y];
|
|
283
234
|
}
|
|
284
235
|
}
|
|
@@ -287,5 +238,4 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
287
238
|
}]);
|
|
288
239
|
return ImageModel;
|
|
289
240
|
}(_BaseModel2.default);
|
|
290
|
-
|
|
291
241
|
exports.default = ImageModel;
|