@antv/l7-layers 2.15.2 → 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.js +197 -299
- 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 +197 -307
- 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
|
@@ -7,63 +7,45 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
|
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
|
-
|
|
11
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
-
|
|
13
11
|
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; } }
|
|
14
|
-
|
|
15
12
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
16
13
|
import { getCullFace } from '@antv/l7-utils';
|
|
17
14
|
import { isNumber } from 'lodash';
|
|
18
15
|
import BaseModel from "../../core/BaseModel";
|
|
19
16
|
import { SizeUnitType } from "../../core/interface";
|
|
20
|
-
import { PointFillTriangulation } from "../../core/triangulation";
|
|
21
|
-
|
|
17
|
+
import { PointFillTriangulation } from "../../core/triangulation";
|
|
18
|
+
// static pointLayer shader - not support animate
|
|
22
19
|
/* babel-plugin-inline-import '../shaders/image/fillImage_frag.glsl' */
|
|
23
20
|
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";
|
|
24
|
-
|
|
25
21
|
/* babel-plugin-inline-import '../shaders/image/fillImage_vert.glsl' */
|
|
26
22
|
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";
|
|
27
|
-
|
|
28
23
|
var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
29
24
|
_inherits(FillImageModel, _BaseModel);
|
|
30
|
-
|
|
31
25
|
var _super = _createSuper(FillImageModel);
|
|
32
|
-
|
|
33
26
|
function FillImageModel() {
|
|
34
27
|
var _this;
|
|
35
|
-
|
|
36
28
|
_classCallCheck(this, FillImageModel);
|
|
37
|
-
|
|
38
29
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
39
30
|
args[_key] = arguments[_key];
|
|
40
31
|
}
|
|
41
|
-
|
|
42
32
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
43
|
-
|
|
44
33
|
_defineProperty(_assertThisInitialized(_this), "meter2coord", 1);
|
|
45
|
-
|
|
46
34
|
_defineProperty(_assertThisInitialized(_this), "isMeter", false);
|
|
47
|
-
|
|
48
35
|
_defineProperty(_assertThisInitialized(_this), "radian", 0);
|
|
49
|
-
|
|
50
36
|
_defineProperty(_assertThisInitialized(_this), "updateTexture", function () {
|
|
51
37
|
var createTexture2D = _this.rendererService.createTexture2D;
|
|
52
|
-
|
|
53
38
|
if (_this.texture) {
|
|
54
39
|
_this.texture.update({
|
|
55
40
|
data: _this.iconService.getCanvas(),
|
|
56
41
|
mag: 'linear',
|
|
57
42
|
min: 'linear mipmap nearest',
|
|
58
43
|
mipmap: true
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
|
|
44
|
+
});
|
|
45
|
+
// 更新完纹理后在更新的图层的时候需要更新所有的图层
|
|
62
46
|
_this.layerService.throttleRenderLayers();
|
|
63
|
-
|
|
64
47
|
return;
|
|
65
48
|
}
|
|
66
|
-
|
|
67
49
|
_this.texture = createTexture2D({
|
|
68
50
|
data: _this.iconService.getCanvas(),
|
|
69
51
|
mag: gl.LINEAR,
|
|
@@ -74,27 +56,25 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
74
56
|
mipmap: true
|
|
75
57
|
});
|
|
76
58
|
});
|
|
77
|
-
|
|
78
59
|
return _this;
|
|
79
60
|
}
|
|
80
|
-
|
|
81
61
|
_createClass(FillImageModel, [{
|
|
82
62
|
key: "getUninforms",
|
|
83
|
-
value:
|
|
63
|
+
value:
|
|
64
|
+
// 旋转的弧度
|
|
84
65
|
function getUninforms() {
|
|
85
66
|
var _ref = this.layer.getLayerConfig(),
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
67
|
+
_ref$opacity = _ref.opacity,
|
|
68
|
+
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
69
|
+
_ref$offsets = _ref.offsets,
|
|
70
|
+
offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets,
|
|
71
|
+
rotation = _ref.rotation,
|
|
72
|
+
_ref$raisingHeight = _ref.raisingHeight,
|
|
73
|
+
raisingHeight = _ref$raisingHeight === void 0 ? 0.0 : _ref$raisingHeight,
|
|
74
|
+
_ref$heightfixed = _ref.heightfixed,
|
|
75
|
+
heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
|
|
76
|
+
_ref$unit = _ref.unit,
|
|
77
|
+
unit = _ref$unit === void 0 ? 'pixel' : _ref$unit;
|
|
98
78
|
if (this.rendererService.getDirty()) {
|
|
99
79
|
this.texture.bind();
|
|
100
80
|
}
|
|
@@ -105,17 +85,12 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
105
85
|
* GAODE2.x -1
|
|
106
86
|
* GAODE1.x -1
|
|
107
87
|
*/
|
|
108
|
-
|
|
109
|
-
|
|
110
88
|
var rotateFlag = 1;
|
|
111
|
-
|
|
112
89
|
if (this.mapService.version === 'GAODE2.x' || this.mapService.version === 'GAODE1.x') {
|
|
113
90
|
rotateFlag = -1;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
91
|
+
}
|
|
92
|
+
// 控制图标的旋转角度(绕 Z 轴旋转)
|
|
117
93
|
this.radian = rotation !== undefined ? rotateFlag * Math.PI * rotation / 180 : rotateFlag * Math.PI * (this.mapService.getRotation() % 360) / 180;
|
|
118
|
-
|
|
119
94
|
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
120
95
|
opacity: opacity,
|
|
121
96
|
offsets: offsets
|
|
@@ -126,12 +101,10 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
126
101
|
offsets: offsets
|
|
127
102
|
});
|
|
128
103
|
var encodeData = this.layer.getEncodedData();
|
|
129
|
-
|
|
130
104
|
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
105
|
+
data = _this$calDataFrame.data,
|
|
106
|
+
width = _this$calDataFrame.width,
|
|
107
|
+
height = _this$calDataFrame.height;
|
|
135
108
|
this.rowCount = height; // 当前数据纹理有多少行
|
|
136
109
|
|
|
137
110
|
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
@@ -150,7 +123,6 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
150
123
|
height: 1
|
|
151
124
|
});
|
|
152
125
|
}
|
|
153
|
-
|
|
154
126
|
return {
|
|
155
127
|
u_raisingHeight: Number(raisingHeight),
|
|
156
128
|
u_heightfixed: Number(heightfixed),
|
|
@@ -175,25 +147,20 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
175
147
|
value: function () {
|
|
176
148
|
var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
177
149
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
178
|
-
while (1) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
case "end":
|
|
187
|
-
return _context.stop();
|
|
188
|
-
}
|
|
150
|
+
while (1) switch (_context.prev = _context.next) {
|
|
151
|
+
case 0:
|
|
152
|
+
this.iconService.on('imageUpdate', this.updateTexture);
|
|
153
|
+
this.updateTexture();
|
|
154
|
+
return _context.abrupt("return", this.buildModels());
|
|
155
|
+
case 3:
|
|
156
|
+
case "end":
|
|
157
|
+
return _context.stop();
|
|
189
158
|
}
|
|
190
159
|
}, _callee, this);
|
|
191
160
|
}));
|
|
192
|
-
|
|
193
161
|
function initModels() {
|
|
194
162
|
return _initModels.apply(this, arguments);
|
|
195
163
|
}
|
|
196
|
-
|
|
197
164
|
return initModels;
|
|
198
165
|
}()
|
|
199
166
|
}, {
|
|
@@ -202,57 +169,50 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
202
169
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
203
170
|
var model;
|
|
204
171
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
205
|
-
while (1) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
case 4:
|
|
228
|
-
case "end":
|
|
229
|
-
return _context2.stop();
|
|
230
|
-
}
|
|
172
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
173
|
+
case 0:
|
|
174
|
+
_context2.next = 2;
|
|
175
|
+
return this.layer.buildLayerModel({
|
|
176
|
+
moduleName: 'pointFillImage',
|
|
177
|
+
vertexShader: pointFillVert,
|
|
178
|
+
fragmentShader: pointFillFrag,
|
|
179
|
+
triangulation: PointFillTriangulation,
|
|
180
|
+
depth: {
|
|
181
|
+
enable: false
|
|
182
|
+
},
|
|
183
|
+
cull: {
|
|
184
|
+
enable: true,
|
|
185
|
+
face: getCullFace(this.mapService.version)
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
case 2:
|
|
189
|
+
model = _context2.sent;
|
|
190
|
+
return _context2.abrupt("return", [model]);
|
|
191
|
+
case 4:
|
|
192
|
+
case "end":
|
|
193
|
+
return _context2.stop();
|
|
231
194
|
}
|
|
232
195
|
}, _callee2, this);
|
|
233
196
|
}));
|
|
234
|
-
|
|
235
197
|
function buildModels() {
|
|
236
198
|
return _buildModels.apply(this, arguments);
|
|
237
199
|
}
|
|
238
|
-
|
|
239
200
|
return buildModels;
|
|
240
201
|
}()
|
|
241
202
|
}, {
|
|
242
203
|
key: "clearModels",
|
|
243
204
|
value: function clearModels() {
|
|
244
205
|
var _this$texture, _this$dataTexture;
|
|
245
|
-
|
|
246
206
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
247
207
|
(_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
|
|
248
208
|
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
249
|
-
}
|
|
209
|
+
}
|
|
250
210
|
|
|
211
|
+
// overwrite baseModel func
|
|
251
212
|
}, {
|
|
252
213
|
key: "registerBuiltinAttributes",
|
|
253
214
|
value: function registerBuiltinAttributes() {
|
|
254
215
|
var _this2 = this;
|
|
255
|
-
|
|
256
216
|
this.styleAttributeService.registerStyleAttribute({
|
|
257
217
|
name: 'rotate',
|
|
258
218
|
type: AttributeType.Attribute,
|
|
@@ -266,7 +226,7 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
266
226
|
size: 1,
|
|
267
227
|
update: function update(feature) {
|
|
268
228
|
var _feature$rotate = feature.rotate,
|
|
269
|
-
|
|
229
|
+
rotate = _feature$rotate === void 0 ? 0 : _feature$rotate;
|
|
270
230
|
return Array.isArray(rotate) ? [rotate[0]] : [rotate];
|
|
271
231
|
}
|
|
272
232
|
}
|
|
@@ -285,16 +245,13 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
285
245
|
size: 2,
|
|
286
246
|
update: function update(feature) {
|
|
287
247
|
var iconMap = _this2.iconService.getIconMap();
|
|
288
|
-
|
|
289
248
|
var shape = feature.shape;
|
|
290
|
-
|
|
291
249
|
var _ref2 = iconMap[shape] || {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
250
|
+
x: -64,
|
|
251
|
+
y: -64
|
|
252
|
+
},
|
|
253
|
+
x = _ref2.x,
|
|
254
|
+
y = _ref2.y;
|
|
298
255
|
return [x, y];
|
|
299
256
|
}
|
|
300
257
|
}
|
|
@@ -317,8 +274,9 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
317
274
|
return [extrude[extrudeIndex], extrude[extrudeIndex + 1], extrude[extrudeIndex + 2]];
|
|
318
275
|
}
|
|
319
276
|
}
|
|
320
|
-
});
|
|
277
|
+
});
|
|
321
278
|
|
|
279
|
+
// point layer size;
|
|
322
280
|
this.styleAttributeService.registerStyleAttribute({
|
|
323
281
|
name: 'size',
|
|
324
282
|
type: AttributeType.Attribute,
|
|
@@ -333,15 +291,13 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
333
291
|
size: 1,
|
|
334
292
|
update: function update(feature) {
|
|
335
293
|
var _feature$size = feature.size,
|
|
336
|
-
|
|
294
|
+
size = _feature$size === void 0 ? 5 : _feature$size;
|
|
337
295
|
return Array.isArray(size) ? [size[0]] : [size];
|
|
338
296
|
}
|
|
339
297
|
}
|
|
340
298
|
});
|
|
341
299
|
}
|
|
342
300
|
}]);
|
|
343
|
-
|
|
344
301
|
return FillImageModel;
|
|
345
302
|
}(BaseModel);
|
|
346
|
-
|
|
347
303
|
export { FillImageModel as default };
|
package/es/point/models/image.js
CHANGED
|
@@ -7,58 +7,43 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
|
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
|
-
|
|
11
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
-
|
|
13
11
|
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; } }
|
|
14
|
-
|
|
15
12
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
16
13
|
import { isNumber } from 'lodash';
|
|
17
14
|
import BaseModel from "../../core/BaseModel";
|
|
18
15
|
import { PointImageTriangulation } from "../../core/triangulation";
|
|
19
|
-
|
|
20
16
|
/* babel-plugin-inline-import '../shaders/image_frag.glsl' */
|
|
21
17
|
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";
|
|
22
|
-
|
|
23
18
|
/* babel-plugin-inline-import '../shaders/image_vert.glsl' */
|
|
24
19
|
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";
|
|
25
|
-
|
|
26
20
|
var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
27
21
|
_inherits(ImageModel, _BaseModel);
|
|
28
|
-
|
|
29
22
|
var _super = _createSuper(ImageModel);
|
|
30
|
-
|
|
31
23
|
function ImageModel() {
|
|
32
24
|
var _this;
|
|
33
|
-
|
|
34
25
|
_classCallCheck(this, ImageModel);
|
|
35
|
-
|
|
36
26
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
37
27
|
args[_key] = arguments[_key];
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
41
|
-
|
|
42
30
|
_defineProperty(_assertThisInitialized(_this), "updateTexture", function () {
|
|
43
31
|
var createTexture2D = _this.rendererService.createTexture2D;
|
|
44
|
-
|
|
45
32
|
if (_this.texture) {
|
|
46
33
|
_this.texture.update({
|
|
47
34
|
data: _this.iconService.getCanvas(),
|
|
48
35
|
mag: 'linear',
|
|
49
36
|
min: 'linear mipmap nearest',
|
|
50
37
|
mipmap: true
|
|
51
|
-
});
|
|
38
|
+
});
|
|
39
|
+
// 更新完纹理后在更新的图层的时候需要更新所有的图层
|
|
52
40
|
// this.layer.layerModelNeedUpdate = true;
|
|
53
|
-
|
|
54
|
-
|
|
55
41
|
setTimeout(function () {
|
|
56
42
|
// 延迟渲染
|
|
57
43
|
_this.layerService.throttleRenderLayers();
|
|
58
44
|
});
|
|
59
45
|
return;
|
|
60
46
|
}
|
|
61
|
-
|
|
62
47
|
_this.texture = createTexture2D({
|
|
63
48
|
data: _this.iconService.getCanvas(),
|
|
64
49
|
mag: gl.LINEAR,
|
|
@@ -69,27 +54,23 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
69
54
|
mipmap: true
|
|
70
55
|
});
|
|
71
56
|
});
|
|
72
|
-
|
|
73
57
|
return _this;
|
|
74
58
|
}
|
|
75
|
-
|
|
76
59
|
_createClass(ImageModel, [{
|
|
77
60
|
key: "getUninforms",
|
|
78
61
|
value: function getUninforms() {
|
|
79
62
|
var _ref = this.layer.getLayerConfig(),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
63
|
+
_ref$opacity = _ref.opacity,
|
|
64
|
+
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
65
|
+
_ref$offsets = _ref.offsets,
|
|
66
|
+
offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets,
|
|
67
|
+
_ref$raisingHeight = _ref.raisingHeight,
|
|
68
|
+
raisingHeight = _ref$raisingHeight === void 0 ? 0 : _ref$raisingHeight,
|
|
69
|
+
_ref$heightfixed = _ref.heightfixed,
|
|
70
|
+
heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed;
|
|
89
71
|
if (this.rendererService.getDirty()) {
|
|
90
72
|
this.texture.bind();
|
|
91
73
|
}
|
|
92
|
-
|
|
93
74
|
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
94
75
|
opacity: opacity,
|
|
95
76
|
offsets: offsets
|
|
@@ -99,12 +80,10 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
99
80
|
offsets: offsets
|
|
100
81
|
});
|
|
101
82
|
var encodeData = this.layer.getEncodedData();
|
|
102
|
-
|
|
103
83
|
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
84
|
+
data = _this$calDataFrame.data,
|
|
85
|
+
width = _this$calDataFrame.width,
|
|
86
|
+
height = _this$calDataFrame.height;
|
|
108
87
|
this.rowCount = height; // 当前数据纹理有多少行
|
|
109
88
|
|
|
110
89
|
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
@@ -123,7 +102,6 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
123
102
|
height: 1
|
|
124
103
|
});
|
|
125
104
|
}
|
|
126
|
-
|
|
127
105
|
return {
|
|
128
106
|
u_raisingHeight: Number(raisingHeight),
|
|
129
107
|
u_heightfixed: Number(heightfixed),
|
|
@@ -141,32 +119,26 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
141
119
|
value: function () {
|
|
142
120
|
var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
143
121
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
144
|
-
while (1) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
case "end":
|
|
153
|
-
return _context.stop();
|
|
154
|
-
}
|
|
122
|
+
while (1) switch (_context.prev = _context.next) {
|
|
123
|
+
case 0:
|
|
124
|
+
this.iconService.on('imageUpdate', this.updateTexture);
|
|
125
|
+
this.updateTexture();
|
|
126
|
+
return _context.abrupt("return", this.buildModels());
|
|
127
|
+
case 3:
|
|
128
|
+
case "end":
|
|
129
|
+
return _context.stop();
|
|
155
130
|
}
|
|
156
131
|
}, _callee, this);
|
|
157
132
|
}));
|
|
158
|
-
|
|
159
133
|
function initModels() {
|
|
160
134
|
return _initModels.apply(this, arguments);
|
|
161
135
|
}
|
|
162
|
-
|
|
163
136
|
return initModels;
|
|
164
137
|
}()
|
|
165
138
|
}, {
|
|
166
139
|
key: "clearModels",
|
|
167
140
|
value: function clearModels() {
|
|
168
141
|
var _this$texture, _this$dataTexture;
|
|
169
|
-
|
|
170
142
|
(_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
|
|
171
143
|
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
172
144
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
@@ -177,44 +149,37 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
177
149
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
178
150
|
var model;
|
|
179
151
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
180
|
-
while (1) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
case 4:
|
|
200
|
-
case "end":
|
|
201
|
-
return _context2.stop();
|
|
202
|
-
}
|
|
152
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
153
|
+
case 0:
|
|
154
|
+
_context2.next = 2;
|
|
155
|
+
return this.layer.buildLayerModel({
|
|
156
|
+
moduleName: 'pointImage',
|
|
157
|
+
vertexShader: pointImageVert,
|
|
158
|
+
fragmentShader: pointImageFrag,
|
|
159
|
+
triangulation: PointImageTriangulation,
|
|
160
|
+
depth: {
|
|
161
|
+
enable: false
|
|
162
|
+
},
|
|
163
|
+
primitive: gl.POINTS
|
|
164
|
+
});
|
|
165
|
+
case 2:
|
|
166
|
+
model = _context2.sent;
|
|
167
|
+
return _context2.abrupt("return", [model]);
|
|
168
|
+
case 4:
|
|
169
|
+
case "end":
|
|
170
|
+
return _context2.stop();
|
|
203
171
|
}
|
|
204
172
|
}, _callee2, this);
|
|
205
173
|
}));
|
|
206
|
-
|
|
207
174
|
function buildModels() {
|
|
208
175
|
return _buildModels.apply(this, arguments);
|
|
209
176
|
}
|
|
210
|
-
|
|
211
177
|
return buildModels;
|
|
212
178
|
}()
|
|
213
179
|
}, {
|
|
214
180
|
key: "registerBuiltinAttributes",
|
|
215
181
|
value: function registerBuiltinAttributes() {
|
|
216
182
|
var _this2 = this;
|
|
217
|
-
|
|
218
183
|
// point layer size;
|
|
219
184
|
this.styleAttributeService.registerStyleAttribute({
|
|
220
185
|
name: 'size',
|
|
@@ -230,12 +195,13 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
230
195
|
size: 1,
|
|
231
196
|
update: function update(feature) {
|
|
232
197
|
var _feature$size = feature.size,
|
|
233
|
-
|
|
198
|
+
size = _feature$size === void 0 ? 5 : _feature$size;
|
|
234
199
|
return Array.isArray(size) ? [size[0]] : [size];
|
|
235
200
|
}
|
|
236
201
|
}
|
|
237
|
-
});
|
|
202
|
+
});
|
|
238
203
|
|
|
204
|
+
// point layer size;
|
|
239
205
|
this.styleAttributeService.registerStyleAttribute({
|
|
240
206
|
name: 'uv',
|
|
241
207
|
type: AttributeType.Attribute,
|
|
@@ -250,25 +216,19 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
250
216
|
size: 2,
|
|
251
217
|
update: function update(feature) {
|
|
252
218
|
var iconMap = _this2.iconService.getIconMap();
|
|
253
|
-
|
|
254
219
|
var shape = feature.shape;
|
|
255
|
-
|
|
256
220
|
var _ref2 = iconMap[shape] || {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
221
|
+
x: -64,
|
|
222
|
+
y: -64
|
|
223
|
+
},
|
|
224
|
+
x = _ref2.x,
|
|
225
|
+
y = _ref2.y; // 非画布区域,默认的图标改为透明
|
|
264
226
|
return [x, y];
|
|
265
227
|
}
|
|
266
228
|
}
|
|
267
229
|
});
|
|
268
230
|
}
|
|
269
231
|
}]);
|
|
270
|
-
|
|
271
232
|
return ImageModel;
|
|
272
233
|
}(BaseModel);
|
|
273
|
-
|
|
274
234
|
export { ImageModel as default };
|
package/es/point/models/index.js
CHANGED