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