@antv/l7-layers 2.17.4 → 2.17.5
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 +325 -483
- package/es/core/BaseModel.js +51 -80
- package/es/core/CommonStyleAttribute.js +2 -5
- 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 +27 -39
- package/es/core/triangulation.js +99 -136
- 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 +92 -149
- 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 -35
- package/es/line/models/arc.js +63 -112
- package/es/line/models/arc_3d.js +58 -102
- package/es/line/models/earthArc_3d.js +60 -105
- package/es/line/models/flow.js +36 -60
- package/es/line/models/great_circle.js +53 -94
- package/es/line/models/line.js +92 -144
- package/es/line/models/linearline.js +42 -74
- package/es/line/models/simpleLine.js +38 -67
- package/es/line/models/wall.js +52 -92
- package/es/line/shaders/dash/line_dash_vert.glsl +1 -2
- package/es/line/shaders/line_frag.glsl +1 -3
- package/es/line/shaders/line_vert.glsl +2 -0
- package/es/line/shaders/linear/line_linear_frag.glsl +1 -1
- package/es/mask/index.js +9 -28
- package/es/mask/models/fill.js +29 -54
- package/es/plugins/DataMappingPlugin.js +78 -114
- 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 +69 -118
- package/es/plugins/LayerStylePlugin.js +4 -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 -78
- package/es/point/models/earthExtrude.js +58 -95
- package/es/point/models/earthFill.js +52 -80
- package/es/point/models/extrude.js +57 -94
- package/es/point/models/fill.js +56 -81
- package/es/point/models/fillmage.js +60 -100
- package/es/point/models/image.js +47 -83
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +30 -54
- package/es/point/models/radar.js +38 -63
- package/es/point/models/simplePoint.js +38 -62
- package/es/point/models/text.js +199 -296
- package/es/point/shape/extrude.js +4 -13
- package/es/polygon/index.js +11 -41
- package/es/polygon/models/extrude.js +87 -135
- package/es/polygon/models/fill.js +50 -79
- 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 +33 -55
- package/es/tile/service/TilePickService.js +26 -40
- package/es/tile/service/TileSourceService.js +3 -7
- package/es/tile/tileFactory/DebugTile.js +29 -46
- 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/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 +325 -474
- package/lib/core/BaseModel.js +51 -90
- package/lib/core/CommonStyleAttribute.js +2 -7
- 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 +27 -62
- package/lib/core/triangulation.js +98 -177
- 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 +92 -166
- 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 +61 -122
- package/lib/line/models/arc_3d.js +56 -113
- package/lib/line/models/earthArc_3d.js +58 -115
- package/lib/line/models/flow.js +36 -70
- package/lib/line/models/great_circle.js +53 -104
- package/lib/line/models/index.js +0 -11
- package/lib/line/models/line.js +90 -152
- package/lib/line/models/linearline.js +42 -86
- package/lib/line/models/simpleLine.js +38 -77
- package/lib/line/models/wall.js +52 -103
- package/lib/line/shaders/dash/line_dash_vert.glsl +1 -2
- package/lib/line/shaders/line_frag.glsl +1 -3
- package/lib/line/shaders/line_vert.glsl +2 -0
- package/lib/line/shaders/linear/line_linear_frag.glsl +1 -1
- 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 +78 -125
- 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 +70 -127
- package/lib/plugins/LayerStylePlugin.js +5 -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 +58 -106
- package/lib/point/models/earthFill.js +52 -110
- package/lib/point/models/extrude.js +57 -103
- package/lib/point/models/fill.js +54 -90
- package/lib/point/models/fillmage.js +58 -107
- package/lib/point/models/image.js +47 -92
- package/lib/point/models/index.js +1 -12
- package/lib/point/models/normal.js +30 -64
- package/lib/point/models/radar.js +38 -72
- package/lib/point/models/simplePoint.js +38 -72
- package/lib/point/models/text.js +199 -305
- package/lib/point/shape/extrude.js +4 -20
- package/lib/polygon/index.js +11 -48
- package/lib/polygon/models/extrude.js +87 -146
- package/lib/polygon/models/fill.js +50 -89
- 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 +33 -60
- 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 +29 -54
- 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/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,50 +7,35 @@ 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 { generateColorRamp } from '@antv/l7-utils';
|
|
17
14
|
import { isNumber } from 'lodash';
|
|
18
15
|
import BaseModel from "../../core/BaseModel";
|
|
19
16
|
import { LinearDir } from "../../core/interface";
|
|
20
17
|
import { LineTriangulation } from "../../core/triangulation";
|
|
21
|
-
|
|
22
18
|
/* babel-plugin-inline-import '../shaders/linearLine/line_linear_frag.glsl' */
|
|
23
19
|
var linear_line_frag = "\nvarying vec4 v_Color;\n#pragma include \"picking\"\nvoid main() {\n\n gl_FragColor = v_Color; // \u5168\u5C40\u900F\u660E\u5EA6\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
24
|
-
|
|
25
20
|
/* babel-plugin-inline-import '../shaders/linearLine/line_linear_vert.glsl' */
|
|
26
21
|
var linear_line_vert = "\nattribute float a_Miter;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\n// dash line\nattribute float a_Total_Distance;\nattribute vec2 a_DistanceAndIndex;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_heightfixed: 0.0;\nuniform float u_vertexScale: 1.0;\nuniform float u_raisingHeight: 0.0;\nuniform float u_opacity : 1.0;\nuniform sampler2D u_texture;\nuniform float u_linearDir: 1.0;\nvarying vec4 v_Color;\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n float lineDistance = a_DistanceAndIndex.x;\n float currentLinePointRatio = lineDistance / a_Total_Distance;\n \n\n float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\uFF08\u5411\u4E24\u4FA7\u504F\u79FB\u7684\u548C\uFF09\n float linePixelSize = project_pixel(a_Size.x) * 2.0; // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB \u5355\u4FA7 * 2\n float texV = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n float linearRadio =currentLinePointRatio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n if(u_linearDir < 1.0) {\n linearRadio = texV;\n }\n\n v_Color = texture2D(u_texture, vec2(linearRadio, 0.5));\n\n v_Color.a *= u_opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n\n\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5 vertex height\n float lineHeight = a_Size.y; // size \u7B2C\u4E8C\u4E2A\u53C2\u6570\u4EE3\u8868\u7684\u9AD8\u5EA6 [linewidth, lineheight]\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n lineHeight *= 0.2; // \u4FDD\u6301\u548C amap/mapbox \u4E00\u81F4\u7684\u6548\u679C\n h *= 0.2;\n if(u_heightfixed < 1.0) {\n lineHeight = project_pixel(a_Size.y);\n }\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h + u_raisingHeight, 1.0));\n } else {\n // mapbox - amap\n \n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // mapbox\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n h *= mapboxZoomScale;\n h += u_raisingHeight * mapboxZoomScale;\n if(u_heightfixed > 0.0) {\n lineHeight *= mapboxZoomScale;\n }\n \n } else {\n // amap\n h += u_raisingHeight;\n // lineHeight \u9876\u70B9\u504F\u79FB\u9AD8\u5EA6\n if(u_heightfixed < 1.0) {\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
27
|
-
|
|
28
22
|
var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
29
23
|
_inherits(LinearLineModel, _BaseModel);
|
|
30
|
-
|
|
31
24
|
var _super = _createSuper(LinearLineModel);
|
|
32
|
-
|
|
33
25
|
function LinearLineModel() {
|
|
34
26
|
var _this;
|
|
35
|
-
|
|
36
27
|
_classCallCheck(this, LinearLineModel);
|
|
37
|
-
|
|
38
28
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
39
29
|
args[_key] = arguments[_key];
|
|
40
30
|
}
|
|
41
|
-
|
|
42
31
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
43
|
-
|
|
44
32
|
_defineProperty(_assertThisInitialized(_this), "updateTexture", function () {
|
|
45
33
|
var createTexture2D = _this.rendererService.createTexture2D;
|
|
46
|
-
|
|
47
34
|
if (_this.colorTexture) {
|
|
48
35
|
_this.colorTexture.destroy();
|
|
49
36
|
}
|
|
50
|
-
|
|
51
37
|
var _ref = _this.layer.getLayerConfig(),
|
|
52
|
-
|
|
53
|
-
|
|
38
|
+
rampColors = _ref.rampColors;
|
|
54
39
|
var imageData = generateColorRamp(rampColors);
|
|
55
40
|
_this.colorTexture = createTexture2D({
|
|
56
41
|
data: new Uint8Array(imageData.data),
|
|
@@ -63,35 +48,32 @@ var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
63
48
|
flipY: false
|
|
64
49
|
});
|
|
65
50
|
});
|
|
66
|
-
|
|
67
51
|
return _this;
|
|
68
52
|
}
|
|
69
|
-
|
|
70
53
|
_createClass(LinearLineModel, [{
|
|
71
54
|
key: "getUninforms",
|
|
72
55
|
value: function getUninforms() {
|
|
73
56
|
var _ref2 = this.layer.getLayerConfig(),
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
57
|
+
_ref2$opacity = _ref2.opacity,
|
|
58
|
+
opacity = _ref2$opacity === void 0 ? 1 : _ref2$opacity,
|
|
59
|
+
_ref2$vertexHeightSca = _ref2.vertexHeightScale,
|
|
60
|
+
vertexHeightScale = _ref2$vertexHeightSca === void 0 ? 20.0 : _ref2$vertexHeightSca,
|
|
61
|
+
_ref2$raisingHeight = _ref2.raisingHeight,
|
|
62
|
+
raisingHeight = _ref2$raisingHeight === void 0 ? 0 : _ref2$raisingHeight,
|
|
63
|
+
_ref2$heightfixed = _ref2.heightfixed,
|
|
64
|
+
heightfixed = _ref2$heightfixed === void 0 ? false : _ref2$heightfixed,
|
|
65
|
+
_ref2$linearDir = _ref2.linearDir,
|
|
66
|
+
linearDir = _ref2$linearDir === void 0 ? LinearDir.VERTICAL : _ref2$linearDir;
|
|
85
67
|
if (this.rendererService.getDirty()) {
|
|
86
68
|
this.colorTexture.bind();
|
|
87
69
|
}
|
|
88
|
-
|
|
89
70
|
return {
|
|
90
71
|
u_linearDir: linearDir === LinearDir.VERTICAL ? 1.0 : 0.0,
|
|
91
72
|
u_opacity: isNumber(opacity) ? opacity : 1,
|
|
92
73
|
// 纹理支持参数
|
|
93
74
|
u_texture: this.colorTexture,
|
|
94
75
|
// 贴图
|
|
76
|
+
|
|
95
77
|
// 是否固定高度
|
|
96
78
|
u_heightfixed: Number(heightfixed),
|
|
97
79
|
// 顶点高度 scale
|
|
@@ -104,31 +86,25 @@ var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
104
86
|
value: function () {
|
|
105
87
|
var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
106
88
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
107
|
-
while (1) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
case "end":
|
|
115
|
-
return _context.stop();
|
|
116
|
-
}
|
|
89
|
+
while (1) switch (_context.prev = _context.next) {
|
|
90
|
+
case 0:
|
|
91
|
+
this.updateTexture();
|
|
92
|
+
return _context.abrupt("return", this.buildModels());
|
|
93
|
+
case 2:
|
|
94
|
+
case "end":
|
|
95
|
+
return _context.stop();
|
|
117
96
|
}
|
|
118
97
|
}, _callee, this);
|
|
119
98
|
}));
|
|
120
|
-
|
|
121
99
|
function initModels() {
|
|
122
100
|
return _initModels.apply(this, arguments);
|
|
123
101
|
}
|
|
124
|
-
|
|
125
102
|
return initModels;
|
|
126
103
|
}()
|
|
127
104
|
}, {
|
|
128
105
|
key: "clearModels",
|
|
129
106
|
value: function clearModels() {
|
|
130
107
|
var _this$colorTexture;
|
|
131
|
-
|
|
132
108
|
(_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0 ? void 0 : _this$colorTexture.destroy();
|
|
133
109
|
}
|
|
134
110
|
}, {
|
|
@@ -136,40 +112,33 @@ var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
136
112
|
value: function () {
|
|
137
113
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
138
114
|
var _ref3, _ref3$depth, depth, model;
|
|
139
|
-
|
|
140
115
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
141
|
-
while (1) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
case 6:
|
|
162
|
-
case "end":
|
|
163
|
-
return _context2.stop();
|
|
164
|
-
}
|
|
116
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
117
|
+
case 0:
|
|
118
|
+
_ref3 = this.layer.getLayerConfig(), _ref3$depth = _ref3.depth, depth = _ref3$depth === void 0 ? false : _ref3$depth;
|
|
119
|
+
this.layer.triangulation = LineTriangulation;
|
|
120
|
+
_context2.next = 4;
|
|
121
|
+
return this.layer.buildLayerModel({
|
|
122
|
+
moduleName: 'lineRampColors',
|
|
123
|
+
vertexShader: linear_line_vert,
|
|
124
|
+
fragmentShader: linear_line_frag,
|
|
125
|
+
triangulation: LineTriangulation,
|
|
126
|
+
depth: {
|
|
127
|
+
enable: depth
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
case 4:
|
|
131
|
+
model = _context2.sent;
|
|
132
|
+
return _context2.abrupt("return", [model]);
|
|
133
|
+
case 6:
|
|
134
|
+
case "end":
|
|
135
|
+
return _context2.stop();
|
|
165
136
|
}
|
|
166
137
|
}, _callee2, this);
|
|
167
138
|
}));
|
|
168
|
-
|
|
169
139
|
function buildModels() {
|
|
170
140
|
return _buildModels.apply(this, arguments);
|
|
171
141
|
}
|
|
172
|
-
|
|
173
142
|
return buildModels;
|
|
174
143
|
}()
|
|
175
144
|
}, {
|
|
@@ -223,12 +192,13 @@ var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
223
192
|
size: 2,
|
|
224
193
|
update: function update(feature) {
|
|
225
194
|
var _feature$size = feature.size,
|
|
226
|
-
|
|
195
|
+
size = _feature$size === void 0 ? 1 : _feature$size;
|
|
227
196
|
return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
|
|
228
197
|
}
|
|
229
198
|
}
|
|
230
|
-
});
|
|
199
|
+
});
|
|
231
200
|
|
|
201
|
+
// point layer size;
|
|
232
202
|
this.styleAttributeService.registerStyleAttribute({
|
|
233
203
|
name: 'normal',
|
|
234
204
|
type: AttributeType.Attribute,
|
|
@@ -265,8 +235,6 @@ var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
265
235
|
});
|
|
266
236
|
}
|
|
267
237
|
}]);
|
|
268
|
-
|
|
269
238
|
return LinearLineModel;
|
|
270
239
|
}(BaseModel);
|
|
271
|
-
|
|
272
240
|
export { LinearLineModel as default };
|
|
@@ -5,60 +5,46 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
|
-
|
|
9
8
|
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); }; }
|
|
10
|
-
|
|
11
9
|
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; } }
|
|
12
|
-
|
|
13
10
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
14
11
|
import { rgb2arr } from '@antv/l7-utils';
|
|
15
12
|
import { isNumber } from 'lodash';
|
|
16
13
|
import BaseModel from "../../core/BaseModel";
|
|
17
14
|
import { SimpleLineTriangulation } from "../../core/triangulation";
|
|
18
|
-
|
|
19
15
|
/* babel-plugin-inline-import '../shaders/simple/simpleline_frag.glsl' */
|
|
20
16
|
var simple_line_frag = "\nvarying vec4 v_color;\nvoid main() {\n gl_FragColor = v_color;\n\n}\n"; // linear simple line shader
|
|
21
|
-
|
|
22
17
|
/* babel-plugin-inline-import '../shaders/simple/simpleline_linear_frag.glsl' */
|
|
23
18
|
var simle_linear_frag = "uniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float opacity;\nvoid main() {\n gl_FragColor = mix(u_sourceColor, u_targetColor, v_distanceScale);\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n}\n";
|
|
24
|
-
|
|
25
19
|
/* babel-plugin-inline-import '../shaders/simple/simpleline_vert.glsl' */
|
|
26
20
|
var simple_line_vert = "attribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Position;\n\nattribute float a_Total_Distance;\nattribute float a_Distance;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_opacity: 1.0;\nuniform float u_vertexScale: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n\n\n#pragma include \"projection\"\n\nvarying vec4 v_color;\nvarying float v_distanceScale;\n\nvoid main() {\n\n v_color = a_Color; \n v_distanceScale = a_Distance / a_Total_Distance;\n v_color = vec4(a_Color.xyz, a_Color.w * u_opacity); \n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, project_pixel(a_Size.y) + h * 0.2, 1.0));\n } else {\n float lineHeight = a_Size.y;\n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n h *= 2.0/pow(2.0, 20.0 - u_Zoom);\n }\n\n // #define COORDINATE_SYSTEM_P20 5.0\n // #define COORDINATE_SYSTEM_P20_OFFSET 6.0\n // amap1.x\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, lineHeight + h, 1.0));\n gl_PointSize = 10.0;\n }\n}\n";
|
|
27
|
-
|
|
28
21
|
var SimpleLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
29
22
|
_inherits(SimpleLineModel, _BaseModel);
|
|
30
|
-
|
|
31
23
|
var _super = _createSuper(SimpleLineModel);
|
|
32
|
-
|
|
33
24
|
function SimpleLineModel() {
|
|
34
25
|
_classCallCheck(this, SimpleLineModel);
|
|
35
|
-
|
|
36
26
|
return _super.apply(this, arguments);
|
|
37
27
|
}
|
|
38
|
-
|
|
39
28
|
_createClass(SimpleLineModel, [{
|
|
40
29
|
key: "getUninforms",
|
|
41
30
|
value: function getUninforms() {
|
|
42
31
|
var _ref = this.layer.getLayerConfig(),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
32
|
+
_ref$opacity = _ref.opacity,
|
|
33
|
+
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
34
|
+
sourceColor = _ref.sourceColor,
|
|
35
|
+
targetColor = _ref.targetColor,
|
|
36
|
+
_ref$vertexHeightScal = _ref.vertexHeightScale,
|
|
37
|
+
vertexHeightScale = _ref$vertexHeightScal === void 0 ? 20.0 : _ref$vertexHeightScal;
|
|
38
|
+
|
|
39
|
+
// 转化渐变色
|
|
51
40
|
var useLinearColor = 0; // 默认不生效
|
|
52
|
-
|
|
53
41
|
var sourceColorArr = [0, 0, 0, 0];
|
|
54
42
|
var targetColorArr = [0, 0, 0, 0];
|
|
55
|
-
|
|
56
43
|
if (sourceColor && targetColor) {
|
|
57
44
|
sourceColorArr = rgb2arr(sourceColor);
|
|
58
45
|
targetColorArr = rgb2arr(targetColor);
|
|
59
46
|
useLinearColor = 1;
|
|
60
47
|
}
|
|
61
|
-
|
|
62
48
|
return {
|
|
63
49
|
u_opacity: isNumber(opacity) ? opacity : 1,
|
|
64
50
|
// 渐变色支持参数
|
|
@@ -74,32 +60,26 @@ var SimpleLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
74
60
|
value: function () {
|
|
75
61
|
var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
76
62
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
77
|
-
while (1) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
case "end":
|
|
84
|
-
return _context.stop();
|
|
85
|
-
}
|
|
63
|
+
while (1) switch (_context.prev = _context.next) {
|
|
64
|
+
case 0:
|
|
65
|
+
return _context.abrupt("return", this.buildModels());
|
|
66
|
+
case 1:
|
|
67
|
+
case "end":
|
|
68
|
+
return _context.stop();
|
|
86
69
|
}
|
|
87
70
|
}, _callee, this);
|
|
88
71
|
}));
|
|
89
|
-
|
|
90
72
|
function initModels() {
|
|
91
73
|
return _initModels.apply(this, arguments);
|
|
92
74
|
}
|
|
93
|
-
|
|
94
75
|
return initModels;
|
|
95
76
|
}()
|
|
96
77
|
}, {
|
|
97
78
|
key: "getShaders",
|
|
98
79
|
value: function getShaders() {
|
|
99
80
|
var _ref2 = this.layer.getLayerConfig(),
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
81
|
+
sourceColor = _ref2.sourceColor,
|
|
82
|
+
targetColor = _ref2.targetColor;
|
|
103
83
|
if (sourceColor && targetColor) {
|
|
104
84
|
// 分离 linear 功能
|
|
105
85
|
return {
|
|
@@ -120,41 +100,34 @@ var SimpleLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
120
100
|
value: function () {
|
|
121
101
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
122
102
|
var _this$getShaders, frag, vert, type, model;
|
|
123
|
-
|
|
124
103
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
125
|
-
while (1) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
case 5:
|
|
147
|
-
case "end":
|
|
148
|
-
return _context2.stop();
|
|
149
|
-
}
|
|
104
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
105
|
+
case 0:
|
|
106
|
+
_this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
|
|
107
|
+
_context2.next = 3;
|
|
108
|
+
return this.layer.buildLayerModel({
|
|
109
|
+
moduleName: type,
|
|
110
|
+
vertexShader: vert,
|
|
111
|
+
fragmentShader: frag,
|
|
112
|
+
triangulation: SimpleLineTriangulation,
|
|
113
|
+
primitive: gl.LINES,
|
|
114
|
+
depth: {
|
|
115
|
+
enable: false
|
|
116
|
+
},
|
|
117
|
+
pick: false
|
|
118
|
+
});
|
|
119
|
+
case 3:
|
|
120
|
+
model = _context2.sent;
|
|
121
|
+
return _context2.abrupt("return", [model]);
|
|
122
|
+
case 5:
|
|
123
|
+
case "end":
|
|
124
|
+
return _context2.stop();
|
|
150
125
|
}
|
|
151
126
|
}, _callee2, this);
|
|
152
127
|
}));
|
|
153
|
-
|
|
154
128
|
function buildModels() {
|
|
155
129
|
return _buildModels.apply(this, arguments);
|
|
156
130
|
}
|
|
157
|
-
|
|
158
131
|
return buildModels;
|
|
159
132
|
}()
|
|
160
133
|
}, {
|
|
@@ -208,15 +181,13 @@ var SimpleLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
208
181
|
size: 2,
|
|
209
182
|
update: function update(feature) {
|
|
210
183
|
var _feature$size = feature.size,
|
|
211
|
-
|
|
184
|
+
size = _feature$size === void 0 ? 1 : _feature$size;
|
|
212
185
|
return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
|
|
213
186
|
}
|
|
214
187
|
}
|
|
215
188
|
});
|
|
216
189
|
}
|
|
217
190
|
}]);
|
|
218
|
-
|
|
219
191
|
return SimpleLineModel;
|
|
220
192
|
}(BaseModel);
|
|
221
|
-
|
|
222
193
|
export { SimpleLineModel as default };
|