@antv/l7-layers 2.19.10 → 2.20.0
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/canvas/models/canvas.js +2 -2
- package/es/core/BaseLayer.d.ts +1 -1
- package/es/core/BaseLayer.js +22 -15
- package/es/core/BaseModel.d.ts +3 -1
- package/es/core/BaseModel.js +28 -4
- package/es/core/CommonStyleAttribute.d.ts +15 -0
- package/es/core/CommonStyleAttribute.js +21 -0
- package/es/core/TextureService.js +2 -2
- package/es/core/interface.d.ts +13 -9
- package/es/core/line_trangluation.d.ts +19 -0
- package/es/core/line_trangluation.js +91 -0
- package/es/core/shape/arrow.d.ts +25 -0
- package/es/core/shape/arrow.js +160 -0
- package/es/core/triangulation.d.ts +2 -8
- package/es/core/triangulation.js +6 -34
- package/es/earth/index.js +1 -1
- package/es/geometry/index.js +1 -1
- package/es/geometry/models/billboard.js +1 -1
- package/es/geometry/models/plane.js +2 -2
- package/es/geometry/models/sprite.js +2 -2
- package/es/heatmap/index.js +1 -1
- package/es/heatmap/models/heatmap.js +4 -4
- package/es/image/models/image.js +1 -1
- package/es/line/index.js +3 -2
- package/es/line/models/arc.js +6 -4
- package/es/line/models/arc_3d.js +4 -2
- package/es/line/models/earthArc_3d.js +4 -2
- package/es/line/models/flow.js +4 -5
- package/es/line/models/great_circle.js +1 -1
- package/es/line/models/line.js +3 -15
- package/es/line/models/linearline.js +1 -1
- package/es/line/models/wall.js +1 -1
- package/es/line/shaders/dash/arc_dash_vert.glsl +2 -5
- package/es/line/shaders/flow/flow_line_vert.glsl +36 -6
- package/es/line/shaders/linear/arc_linear_vert.glsl +2 -3
- package/es/plugins/DataMappingPlugin.js +3 -20
- package/es/plugins/PixelPickingPlugin.d.ts +4 -1
- package/es/plugins/PixelPickingPlugin.js +91 -22
- package/es/plugins/RegisterStyleAttributePlugin.d.ts +0 -1
- package/es/plugins/RegisterStyleAttributePlugin.js +4 -22
- package/es/plugins/ShaderUniformPlugin.d.ts +2 -0
- package/es/plugins/ShaderUniformPlugin.js +74 -6
- package/es/point/index.js +1 -1
- package/es/point/models/fill.js +31 -7
- package/es/point/models/fillmage.js +1 -1
- package/es/point/models/image.js +1 -1
- package/es/point/models/normal.js +30 -12
- package/es/point/models/text.js +1 -1
- package/es/point/shaders/fill_frag.glsl +20 -14
- package/es/point/shaders/fill_vert.glsl +19 -18
- package/es/point/shaders/normal_frag.glsl +4 -3
- package/es/point/shaders/normal_vert.glsl +12 -11
- package/es/polygon/index.js +1 -1
- package/es/polygon/models/extrude.js +1 -1
- package/es/polygon/models/extrusion.js +1 -1
- package/es/polygon/models/ocean.js +3 -3
- package/es/polygon/models/water.js +1 -1
- package/es/raster/models/raster.js +2 -2
- package/es/raster/models/rasterRgb.js +1 -1
- package/es/raster/models/rasterTerrainRgb.js +1 -1
- package/es/tile/core/BaseLayer.js +4 -4
- package/es/tile/interaction/getRasterData.js +4 -4
- package/es/tile/service/TileLayerService.js +4 -4
- package/es/tile/service/TilePickService.js +3 -3
- package/es/tile/tile/Tile.d.ts +3 -1
- package/es/tile/tile/Tile.js +2 -2
- package/es/wind/models/wind.js +5 -6
- package/lib/canvas/index.js +2 -3
- package/lib/canvas/models/canvas.js +4 -5
- package/lib/canvas/models/index.js +1 -2
- package/lib/citybuliding/building.js +2 -3
- package/lib/citybuliding/models/build.js +2 -3
- package/lib/core/BaseLayer.js +23 -17
- package/lib/core/BaseModel.js +30 -7
- package/lib/core/CommonStyleAttribute.js +22 -0
- package/lib/core/LayerPickService.js +2 -3
- package/lib/core/TextureService.js +4 -5
- package/lib/core/constant.js +3 -5
- package/lib/core/interface.js +6 -11
- package/lib/core/line_trangluation.js +99 -0
- package/lib/core/schema.js +2 -3
- package/lib/core/shape/Path.js +3 -6
- package/lib/core/shape/arrow.js +174 -0
- package/lib/core/triangulation.js +8 -37
- package/lib/earth/index.js +3 -4
- package/lib/earth/models/atmosphere.js +2 -3
- package/lib/earth/models/base.js +2 -3
- package/lib/earth/models/bloomsphere.js +2 -3
- package/lib/earth/utils.js +3 -6
- package/lib/geometry/index.js +3 -4
- package/lib/geometry/models/billboard.js +3 -4
- package/lib/geometry/models/index.js +1 -2
- package/lib/geometry/models/plane.js +4 -5
- package/lib/geometry/models/sprite.js +4 -5
- package/lib/heatmap/index.js +3 -4
- package/lib/heatmap/models/grid.js +2 -3
- package/lib/heatmap/models/grid3d.js +2 -3
- package/lib/heatmap/models/heatmap.js +6 -7
- package/lib/heatmap/models/hexagon.js +2 -3
- package/lib/heatmap/models/index.js +1 -2
- package/lib/image/index.js +2 -3
- package/lib/image/models/image.js +3 -4
- package/lib/image/models/index.js +1 -2
- package/lib/line/index.js +5 -5
- package/lib/line/models/arc.js +8 -7
- package/lib/line/models/arc_3d.js +6 -5
- package/lib/line/models/earthArc_3d.js +6 -5
- package/lib/line/models/flow.js +6 -8
- package/lib/line/models/great_circle.js +3 -4
- package/lib/line/models/index.js +1 -2
- package/lib/line/models/line.js +5 -18
- package/lib/line/models/linearline.js +3 -4
- package/lib/line/models/simpleLine.js +2 -3
- package/lib/line/models/wall.js +3 -4
- package/lib/line/shaders/dash/arc_dash_vert.glsl +2 -5
- package/lib/line/shaders/flow/flow_line_vert.glsl +36 -6
- package/lib/line/shaders/linear/arc_linear_vert.glsl +2 -3
- package/lib/mask/index.js +2 -3
- package/lib/mask/models/fill.js +2 -3
- package/lib/mask/models/index.js +1 -2
- package/lib/plugins/DataMappingPlugin.js +5 -23
- package/lib/plugins/DataSourcePlugin.js +2 -3
- package/lib/plugins/FeatureScalePlugin.js +4 -5
- package/lib/plugins/LayerAnimateStylePlugin.js +2 -3
- package/lib/plugins/LayerMaskPlugin.js +2 -3
- package/lib/plugins/LayerModelPlugin.js +2 -3
- package/lib/plugins/LayerStylePlugin.js +2 -3
- package/lib/plugins/LightingPlugin.js +2 -3
- package/lib/plugins/MultiPassRendererPlugin.js +2 -3
- package/lib/plugins/PixelPickingPlugin.js +93 -25
- package/lib/plugins/RegisterStyleAttributePlugin.js +6 -25
- package/lib/plugins/ShaderUniformPlugin.js +75 -8
- package/lib/plugins/UpdateModelPlugin.js +2 -3
- package/lib/plugins/UpdateStyleAttributePlugin.js +2 -3
- package/lib/point/index.js +3 -4
- package/lib/point/models/billboard_point.js +2 -3
- package/lib/point/models/earthExtrude.js +2 -3
- package/lib/point/models/earthFill.js +2 -3
- package/lib/point/models/extrude.js +2 -3
- package/lib/point/models/fill.js +33 -10
- package/lib/point/models/fillmage.js +3 -4
- package/lib/point/models/image.js +3 -4
- package/lib/point/models/index.js +1 -2
- package/lib/point/models/normal.js +32 -15
- package/lib/point/models/radar.js +2 -3
- package/lib/point/models/text.js +3 -4
- package/lib/point/shaders/fill_frag.glsl +20 -14
- package/lib/point/shaders/fill_vert.glsl +19 -18
- package/lib/point/shaders/normal_frag.glsl +4 -3
- package/lib/point/shaders/normal_vert.glsl +12 -11
- package/lib/polygon/index.js +3 -4
- package/lib/polygon/models/extrude.js +3 -4
- package/lib/polygon/models/extrusion.js +3 -4
- package/lib/polygon/models/fill.js +2 -3
- package/lib/polygon/models/index.js +1 -2
- package/lib/polygon/models/ocean.js +5 -6
- package/lib/polygon/models/water.js +3 -4
- package/lib/raster/index.js +2 -3
- package/lib/raster/models/index.js +1 -2
- package/lib/raster/models/raster.js +4 -5
- package/lib/raster/models/rasterRgb.js +3 -4
- package/lib/raster/models/rasterTerrainRgb.js +3 -4
- package/lib/tile/core/BaseLayer.js +6 -7
- package/lib/tile/core/TileDebugLayer.js +2 -3
- package/lib/tile/interaction/getRasterData.js +4 -4
- package/lib/tile/service/TileLayerService.js +6 -7
- package/lib/tile/service/TilePickService.js +5 -6
- package/lib/tile/service/TileSourceService.js +4 -5
- package/lib/tile/tile/DebugTile.js +2 -3
- package/lib/tile/tile/ImageTile.js +2 -3
- package/lib/tile/tile/MaskTile.js +2 -3
- package/lib/tile/tile/RasterRGBTile.js +2 -3
- package/lib/tile/tile/RasterTerrainRGBTile.js +2 -3
- package/lib/tile/tile/RasterTile.js +2 -3
- package/lib/tile/tile/Tile.js +4 -5
- package/lib/tile/tile/VectorTile.js +2 -3
- package/lib/tile/utils/constants.js +2 -3
- package/lib/tile/utils/utils.js +1 -2
- package/lib/utils/blend.js +2 -3
- package/lib/utils/collision-index.js +2 -3
- package/lib/utils/extrude_polyline.js +2 -3
- package/lib/utils/grid-index.js +1 -2
- package/lib/utils/simpleLine.js +2 -3
- package/lib/wind/index.js +2 -3
- package/lib/wind/models/index.js +1 -2
- package/lib/wind/models/wind.js +7 -9
- package/lib/wind/models/windRender.js +4 -5
- package/lib/wind/models/windShader.js +6 -12
- package/package.json +7 -7
package/es/point/models/fill.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
4
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
5
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
@@ -11,14 +12,15 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
11
12
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
12
13
|
import { PointFillTriangulation } from '@antv/l7-utils';
|
|
13
14
|
import BaseModel from "../../core/BaseModel";
|
|
15
|
+
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
14
16
|
import { SizeUnitType } from "../../core/interface";
|
|
15
17
|
// animate pointLayer shader - support animate
|
|
16
18
|
/* babel-plugin-inline-import '../shaders/animate/wave_frag.glsl' */
|
|
17
19
|
var waveFillFrag = "\nuniform float u_additive;\n\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nuniform float u_time;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nvoid main() {\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n \n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n float PI = 3.14159;\n float N_RINGS = 3.0;\n float FREQ = 1.0;\n\n gl_FragColor = v_color;\n\n float d = length(v_data.xy);\n if(d > 0.5) {\n discard;\n }\n float intensity = clamp(cos(d * PI), 0.0, 1.0) * clamp(cos(2.0 * PI * (d * 2.0 * u_animate.z - u_animate.y * u_time)), 0.0, 1.0);\n \n // \u6839\u636E\u53E0\u52A0\u6A21\u5F0F\u9009\u62E9\u6548\u679C\n if(u_additive > 0.0) {\n gl_FragColor *= intensity;\n // \u4F18\u5316\u6C34\u6CE2\u70B9 blend additive \u6A21\u5F0F\u4E0B\u6709\u7684\u62FE\u53D6\u6548\u679C \n gl_FragColor = filterColorAlpha(gl_FragColor, gl_FragColor.a);\n } else {\n gl_FragColor = vec4(gl_FragColor.xyz, gl_FragColor.a * intensity);\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n"; // static pointLayer shader - not support animate
|
|
18
20
|
/* babel-plugin-inline-import '../shaders/fill_frag.glsl' */
|
|
19
|
-
var pointFillFrag = "uniform float u_additive;\
|
|
21
|
+
var pointFillFrag = "\nlayout(std140) uniform commonUniforms {\n vec3 u_blur_height_fixed;\n float u_stroke_width;\n float u_additive;\n float u_stroke_opacity;\n float u_size_unit;\n};\n\nin vec4 v_color;\nin vec4 v_stroke;\nin vec4 v_data;\nin float v_radius;\n\n#pragma include \"scene_uniforms\"\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nout vec4 outputColor;\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius + u_stroke_width);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n } else if (shape == 1) {\n outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n } else if (shape == 2) {\n outer_df = sdBox(v_data.xy, vec2(1.));\n inner_df = sdBox(v_data.xy, vec2(r));\n } else if (shape == 3) {\n outer_df = sdPentagon(v_data.xy, 0.8);\n inner_df = sdPentagon(v_data.xy, r * 0.8);\n } else if (shape == 4) {\n outer_df = sdHexagon(v_data.xy, 0.8);\n inner_df = sdHexagon(v_data.xy, r * 0.8);\n } else if (shape == 5) {\n outer_df = sdOctogon(v_data.xy, 1.0);\n inner_df = sdOctogon(v_data.xy, r);\n } else if (shape == 6) {\n outer_df = sdHexagram(v_data.xy, 0.52);\n inner_df = sdHexagram(v_data.xy, r * 0.52);\n } else if (shape == 7) {\n outer_df = sdRhombus(v_data.xy, vec2(1.0));\n inner_df = sdRhombus(v_data.xy, vec2(r));\n } else if (shape == 8) {\n outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n }\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n\n if(u_stroke_width < 0.01) {\n outputColor = v_color;\n } else {\n outputColor = mix(v_color, v_stroke * u_stroke_opacity, color_t);\n }\n\n if(u_additive > 0.0) {\n outputColor *= opacity_t;\n outputColor = filterColorAlpha(outputColor, outputColor.a);\n } else {\n outputColor.a *= opacity_t;\n outputColor = filterColor(outputColor);\n }\n // \u4F5C\u4E3A mask \u6A21\u677F\u65F6\u9700\u8981\u4E22\u5F03\u900F\u660E\u7684\u50CF\u7D20\n if(outputColor.a < 0.01) {\n discard;\n } \n}\n";
|
|
20
22
|
/* babel-plugin-inline-import '../shaders/fill_vert.glsl' */
|
|
21
|
-
var pointFillVert = "
|
|
23
|
+
var pointFillVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 11) in vec3 a_Extrude;\nlayout(location = 10) in float a_Shape;\n\nlayout(std140) uniform commonUniforms {\n vec3 u_blur_height_fixed;\n float u_stroke_width;\n float u_additive;\n float u_stroke_opacity;\n float u_size_unit;\n};\n\nout vec4 v_color;\nout vec4 v_stroke;\nout vec4 v_data;\nout float v_radius;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n#pragma include \"rotation_2d\"\n\nvoid main() {\n // \u900F\u660E\u5EA6\u8BA1\u7B97\n v_stroke = stroke; \n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n /*\n * setPickingSize \u8BBE\u7F6E\u62FE\u53D6\u5927\u5C0F\n * u_meter2coord \u5728\u7B49\u9762\u79EF\u5927\u5C0F\u7684\u65F6\u5019\u8BBE\u7F6E\u5355\u4F4D\n */\n float newSize = setPickingSize(a_Size);\n // float newSize = setPickingSize(a_Size) * 0.00001038445708445579;\n\n\n\n // unpack color(vec2)\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n\n if(u_size_unit == 1.0) {\n newSize = newSize * u_PixelsPerMeter.z;\n }\n\n v_radius = newSize;\n\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur_height_fixed.x);\n\n vec2 offset = (extrude.xy * (newSize + u_stroke_width) + u_offsets);\n vec3 aPosition = a_Position;\n\n offset = project_pixel(offset);\n offset = rotate_matrix(offset,rotation);\n \n // TODP: /abs(extrude.x) \u662F\u4E3A\u4E86\u517C\u5BB9\u5730\u7403\u6A21\u5F0F\n v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);\n\n\n // vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n float raisingHeight = u_blur_height_fixed.y;\n\n if(u_blur_height_fixed.z < 1.0) { // false\n raisingHeight = project_pixel(u_blur_height_fixed.y);\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_blur_height_fixed.y * mapboxZoomScale;\n }\n }\n \n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offset, raisingHeight, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
22
24
|
var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
23
25
|
_inherits(FillModel, _BaseModel);
|
|
24
26
|
var _super = _createSuper(FillModel);
|
|
@@ -43,13 +45,23 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
43
45
|
heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
|
|
44
46
|
_ref$unit = _ref.unit,
|
|
45
47
|
unit = _ref$unit === void 0 ? 'pixel' : _ref$unit;
|
|
46
|
-
|
|
48
|
+
var commonIniform = _objectSpread({
|
|
47
49
|
u_blur_height_fixed: [blur, Number(raisingHeight), Number(heightfixed)],
|
|
48
50
|
u_additive: blend === 'additive' ? 1.0 : 0.0,
|
|
49
51
|
u_stroke_opacity: strokeOpacity,
|
|
50
52
|
u_stroke_width: strokeWidth,
|
|
51
53
|
u_size_unit: SizeUnitType[unit]
|
|
52
54
|
}, this.getStyleAttribute());
|
|
55
|
+
var attributes = this.getStyleAttribute();
|
|
56
|
+
this.uniformBuffers[0].subData({
|
|
57
|
+
offset: 0,
|
|
58
|
+
data: new Uint8Array(new Float32Array([].concat(_toConsumableArray(attributes.u_stroke), _toConsumableArray(attributes.u_offsets), [attributes.u_opacity, attributes.u_rotation])).buffer)
|
|
59
|
+
});
|
|
60
|
+
this.uniformBuffers[1].subData({
|
|
61
|
+
offset: 0,
|
|
62
|
+
data: new Uint8Array(new Float32Array([].concat(_toConsumableArray(commonIniform.u_blur_height_fixed), [commonIniform.u_stroke_width, commonIniform.u_stroke_opacity, commonIniform.u_additive, commonIniform.u_size_unit])).buffer)
|
|
63
|
+
});
|
|
64
|
+
return commonIniform;
|
|
53
65
|
}
|
|
54
66
|
}, {
|
|
55
67
|
key: "getAnimateUniforms",
|
|
@@ -92,7 +104,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
92
104
|
key: "buildModels",
|
|
93
105
|
value: function () {
|
|
94
106
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
95
|
-
var _ref3, _ref3$animateOption, animateOption, _this$getShaders, frag, vert, type, model;
|
|
107
|
+
var _ref3, _ref3$animateOption, animateOption, _this$getShaders, frag, vert, type, attributeUniformBuffer, commonUniforms, model;
|
|
96
108
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
97
109
|
while (1) switch (_context2.prev = _context2.next) {
|
|
98
110
|
case 0:
|
|
@@ -101,7 +113,16 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
101
113
|
} : _ref3$animateOption;
|
|
102
114
|
_this$getShaders = this.getShaders(animateOption), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
|
|
103
115
|
this.layer.triangulation = PointFillTriangulation;
|
|
104
|
-
|
|
116
|
+
attributeUniformBuffer = this.rendererService.createBuffer({
|
|
117
|
+
data: new Float32Array(4 + 2 + 1 + 1),
|
|
118
|
+
isUBO: true
|
|
119
|
+
});
|
|
120
|
+
commonUniforms = this.rendererService.createBuffer({
|
|
121
|
+
data: new Float32Array(8),
|
|
122
|
+
isUBO: true
|
|
123
|
+
});
|
|
124
|
+
this.uniformBuffers.push(attributeUniformBuffer, commonUniforms);
|
|
125
|
+
_context2.next = 8;
|
|
105
126
|
return this.layer.buildLayerModel({
|
|
106
127
|
moduleName: type,
|
|
107
128
|
vertexShader: vert,
|
|
@@ -112,10 +133,10 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
112
133
|
enable: false
|
|
113
134
|
}
|
|
114
135
|
});
|
|
115
|
-
case
|
|
136
|
+
case 8:
|
|
116
137
|
model = _context2.sent;
|
|
117
138
|
return _context2.abrupt("return", [model]);
|
|
118
|
-
case
|
|
139
|
+
case 10:
|
|
119
140
|
case "end":
|
|
120
141
|
return _context2.stop();
|
|
121
142
|
}
|
|
@@ -173,6 +194,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
173
194
|
type: AttributeType.Attribute,
|
|
174
195
|
descriptor: {
|
|
175
196
|
name: 'a_Extrude',
|
|
197
|
+
shaderLocation: ShaderLocation.EXTRUDE,
|
|
176
198
|
buffer: {
|
|
177
199
|
// give the WebGL driver a hint that this buffer may change
|
|
178
200
|
usage: gl.DYNAMIC_DRAW,
|
|
@@ -194,6 +216,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
194
216
|
type: AttributeType.Attribute,
|
|
195
217
|
descriptor: {
|
|
196
218
|
name: 'a_Size',
|
|
219
|
+
shaderLocation: ShaderLocation.SIZE,
|
|
197
220
|
buffer: {
|
|
198
221
|
// give the WebGL driver a hint that this buffer may change
|
|
199
222
|
usage: gl.DYNAMIC_DRAW,
|
|
@@ -215,6 +238,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
215
238
|
type: AttributeType.Attribute,
|
|
216
239
|
descriptor: {
|
|
217
240
|
name: 'a_Shape',
|
|
241
|
+
shaderLocation: ShaderLocation.SHAPE,
|
|
218
242
|
buffer: {
|
|
219
243
|
// give the WebGL driver a hint that this buffer may change
|
|
220
244
|
usage: gl.DYNAMIC_DRAW,
|
|
@@ -157,7 +157,7 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
157
157
|
value: function clearModels() {
|
|
158
158
|
var _this$texture;
|
|
159
159
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
160
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
160
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
// overwrite baseModel func
|
package/es/point/models/image.js
CHANGED
|
@@ -105,7 +105,7 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
105
105
|
key: "clearModels",
|
|
106
106
|
value: function clearModels() {
|
|
107
107
|
var _this$texture;
|
|
108
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
108
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
109
109
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
110
110
|
}
|
|
111
111
|
}, {
|
|
@@ -10,13 +10,12 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
10
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); }; }
|
|
11
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; } }
|
|
12
12
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
13
|
-
import { lodashUtil } from '@antv/l7-utils';
|
|
14
13
|
import BaseModel from "../../core/BaseModel";
|
|
14
|
+
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
15
15
|
/* babel-plugin-inline-import '../shaders/normal_frag.glsl' */
|
|
16
|
-
var normalFrag = "
|
|
16
|
+
var normalFrag = "in vec4 v_color;\nout vec4 outputColor;\nvoid main() {\n outputColor = v_color;\n}";
|
|
17
17
|
/* babel-plugin-inline-import '../shaders/normal_vert.glsl' */
|
|
18
|
-
var normalVert = "
|
|
19
|
-
var isNumber = lodashUtil.isNumber;
|
|
18
|
+
var normalVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\n\nlayout(std140) uniform u_Common {\n float u_size_scale;\n};\n\nout vec4 v_color;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n\nvoid main() {\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n\n if (u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(a_Position, 1.0);\n } else {\n vec4 project_pos = project_position(vec4(a_Position, 1.0)) + vec4(a_Size / 2., -a_Size /2., 0., 0.);\n gl_Position = project_common_position_to_clipspace(project_pos);\n }\n\n gl_PointSize = a_Size * u_size_scale * 2.0 * u_DevicePixelRatio;\n}\n";
|
|
20
19
|
export function PointTriangulation(feature) {
|
|
21
20
|
var coordinates = feature.coordinates;
|
|
22
21
|
return {
|
|
@@ -42,10 +41,19 @@ var NormalModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
42
41
|
}, {
|
|
43
42
|
key: "getUninforms",
|
|
44
43
|
value: function getUninforms() {
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
var attributes = this.getStyleAttribute();
|
|
45
|
+
// FIXME: No need to update each frame
|
|
46
|
+
this.uniformBuffers[0].subData({
|
|
47
|
+
offset: 0,
|
|
48
|
+
data: new Uint8Array(new Float32Array([].concat(_toConsumableArray(attributes.u_stroke), _toConsumableArray(attributes.u_offsets), [attributes.u_opacity, attributes.u_rotation])).buffer)
|
|
49
|
+
});
|
|
50
|
+
this.uniformBuffers[1].subData({
|
|
51
|
+
offset: 0,
|
|
52
|
+
data: new Uint8Array(new Float32Array([0.5]).buffer)
|
|
53
|
+
});
|
|
54
|
+
return _objectSpread({
|
|
55
|
+
u_size_scale: 0.5
|
|
56
|
+
}, attributes);
|
|
49
57
|
}
|
|
50
58
|
}, {
|
|
51
59
|
key: "initModels",
|
|
@@ -70,12 +78,21 @@ var NormalModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
70
78
|
key: "buildModels",
|
|
71
79
|
value: function () {
|
|
72
80
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
73
|
-
var model;
|
|
81
|
+
var uniformBuffer, commonBuffer, model;
|
|
74
82
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
75
83
|
while (1) switch (_context2.prev = _context2.next) {
|
|
76
84
|
case 0:
|
|
77
85
|
this.layer.triangulation = PointTriangulation;
|
|
78
|
-
|
|
86
|
+
uniformBuffer = this.rendererService.createBuffer({
|
|
87
|
+
data: new Float32Array(4 + 2 + 1 + 1),
|
|
88
|
+
isUBO: true
|
|
89
|
+
});
|
|
90
|
+
commonBuffer = this.rendererService.createBuffer({
|
|
91
|
+
data: new Float32Array(4),
|
|
92
|
+
isUBO: true
|
|
93
|
+
});
|
|
94
|
+
this.uniformBuffers.push(uniformBuffer, commonBuffer);
|
|
95
|
+
_context2.next = 6;
|
|
79
96
|
return this.layer.buildLayerModel({
|
|
80
97
|
moduleName: 'pointNormal',
|
|
81
98
|
vertexShader: normalVert,
|
|
@@ -88,10 +105,10 @@ var NormalModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
88
105
|
primitive: gl.POINTS,
|
|
89
106
|
pick: false
|
|
90
107
|
});
|
|
91
|
-
case
|
|
108
|
+
case 6:
|
|
92
109
|
model = _context2.sent;
|
|
93
110
|
return _context2.abrupt("return", [model]);
|
|
94
|
-
case
|
|
111
|
+
case 8:
|
|
95
112
|
case "end":
|
|
96
113
|
return _context2.stop();
|
|
97
114
|
}
|
|
@@ -115,6 +132,7 @@ var NormalModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
115
132
|
type: AttributeType.Attribute,
|
|
116
133
|
descriptor: {
|
|
117
134
|
name: 'a_Size',
|
|
135
|
+
shaderLocation: ShaderLocation.SIZE,
|
|
118
136
|
buffer: {
|
|
119
137
|
usage: gl.DYNAMIC_DRAW,
|
|
120
138
|
data: [],
|
package/es/point/models/text.js
CHANGED
|
@@ -234,7 +234,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
234
234
|
key: "clearModels",
|
|
235
235
|
value: function clearModels() {
|
|
236
236
|
var _this$texture;
|
|
237
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
237
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
238
238
|
// TODO this.mapping
|
|
239
239
|
this.layer.off('remapping', this.mapping);
|
|
240
240
|
}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
uniform float u_additive;
|
|
2
|
-
uniform float u_stroke_opacity : 1;
|
|
3
|
-
uniform float u_stroke_width : 2;
|
|
4
1
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
layout(std140) uniform commonUniforms {
|
|
3
|
+
vec3 u_blur_height_fixed;
|
|
4
|
+
float u_stroke_width;
|
|
5
|
+
float u_additive;
|
|
6
|
+
float u_stroke_opacity;
|
|
7
|
+
float u_size_unit;
|
|
8
|
+
};
|
|
9
9
|
|
|
10
|
+
in vec4 v_color;
|
|
11
|
+
in vec4 v_stroke;
|
|
12
|
+
in vec4 v_data;
|
|
13
|
+
in float v_radius;
|
|
10
14
|
|
|
15
|
+
#pragma include "scene_uniforms"
|
|
11
16
|
#pragma include "sdf_2d"
|
|
12
17
|
#pragma include "picking"
|
|
13
18
|
|
|
19
|
+
out vec4 outputColor;
|
|
14
20
|
|
|
15
21
|
void main() {
|
|
16
22
|
int shape = int(floor(v_data.w + 0.5));
|
|
@@ -58,20 +64,20 @@ void main() {
|
|
|
58
64
|
);
|
|
59
65
|
|
|
60
66
|
if(u_stroke_width < 0.01) {
|
|
61
|
-
|
|
67
|
+
outputColor = v_color;
|
|
62
68
|
} else {
|
|
63
|
-
|
|
69
|
+
outputColor = mix(v_color, v_stroke * u_stroke_opacity, color_t);
|
|
64
70
|
}
|
|
65
71
|
|
|
66
72
|
if(u_additive > 0.0) {
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
outputColor *= opacity_t;
|
|
74
|
+
outputColor = filterColorAlpha(outputColor, outputColor.a);
|
|
69
75
|
} else {
|
|
70
|
-
|
|
71
|
-
|
|
76
|
+
outputColor.a *= opacity_t;
|
|
77
|
+
outputColor = filterColor(outputColor);
|
|
72
78
|
}
|
|
73
79
|
// 作为 mask 模板时需要丢弃透明的像素
|
|
74
|
-
if(
|
|
80
|
+
if(outputColor.a < 0.01) {
|
|
75
81
|
discard;
|
|
76
82
|
}
|
|
77
83
|
}
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
layout(location = 0) in vec3 a_Position;
|
|
2
|
+
layout(location = 1) in vec4 a_Color;
|
|
3
|
+
layout(location = 9) in float a_Size;
|
|
4
|
+
layout(location = 11) in vec3 a_Extrude;
|
|
5
|
+
layout(location = 10) in float a_Shape;
|
|
6
|
+
|
|
7
|
+
layout(std140) uniform commonUniforms {
|
|
8
|
+
vec3 u_blur_height_fixed;
|
|
9
|
+
float u_stroke_width;
|
|
10
|
+
float u_additive;
|
|
11
|
+
float u_stroke_opacity;
|
|
12
|
+
float u_size_unit;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
out vec4 v_color;
|
|
16
|
+
out vec4 v_stroke;
|
|
17
|
+
out vec4 v_data;
|
|
18
|
+
out float v_radius;
|
|
17
19
|
|
|
18
20
|
#pragma include "projection"
|
|
19
21
|
#pragma include "picking"
|
|
20
22
|
#pragma include "rotation_2d"
|
|
21
23
|
|
|
22
|
-
|
|
23
24
|
void main() {
|
|
24
25
|
// 透明度计算
|
|
25
26
|
v_stroke = stroke;
|
|
@@ -37,7 +38,7 @@ void main() {
|
|
|
37
38
|
// unpack color(vec2)
|
|
38
39
|
v_color = vec4(a_Color.xyz, a_Color.w * opacity);
|
|
39
40
|
|
|
40
|
-
if(u_size_unit == 1) {
|
|
41
|
+
if(u_size_unit == 1.0) {
|
|
41
42
|
newSize = newSize * u_PixelsPerMeter.z;
|
|
42
43
|
}
|
|
43
44
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
layout(location = 0) in vec3 a_Position;
|
|
2
|
+
layout(location = 1) in vec4 a_Color;
|
|
3
|
+
layout(location = 9) in float a_Size;
|
|
1
4
|
|
|
2
|
-
|
|
3
|
-
|
|
5
|
+
layout(std140) uniform u_Common {
|
|
6
|
+
float u_size_scale;
|
|
7
|
+
};
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
attribute vec4 a_Color;
|
|
7
|
-
|
|
8
|
-
varying vec4 v_color;
|
|
9
|
+
out vec4 v_color;
|
|
9
10
|
|
|
10
11
|
#pragma include "projection"
|
|
11
12
|
#pragma include "project"
|
|
@@ -13,12 +14,12 @@ varying vec4 v_color;
|
|
|
13
14
|
void main() {
|
|
14
15
|
v_color = vec4(a_Color.xyz, a_Color.w * opacity);
|
|
15
16
|
|
|
16
|
-
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
17
|
-
gl_Position = u_Mvp * vec4(a_Position
|
|
17
|
+
if (u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
18
|
+
gl_Position = u_Mvp * vec4(a_Position, 1.0);
|
|
18
19
|
} else {
|
|
19
|
-
vec4 project_pos = project_position(vec4(a_Position, 1.0)) + vec4(a_Size / 2
|
|
20
|
-
gl_Position = project_common_position_to_clipspace(
|
|
20
|
+
vec4 project_pos = project_position(vec4(a_Position, 1.0)) + vec4(a_Size / 2., -a_Size /2., 0., 0.);
|
|
21
|
+
gl_Position = project_common_position_to_clipspace(project_pos);
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
gl_PointSize = a_Size * 2.0
|
|
24
|
+
gl_PointSize = a_Size * u_size_scale * 2.0 * u_DevicePixelRatio;
|
|
24
25
|
}
|
package/es/polygon/index.js
CHANGED
|
@@ -55,7 +55,7 @@ var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
55
55
|
value: function getModelType() {
|
|
56
56
|
var _shapeAttribute$scale;
|
|
57
57
|
var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
|
|
58
|
-
var shape = shapeAttribute === null || shapeAttribute === void 0
|
|
58
|
+
var shape = shapeAttribute === null || shapeAttribute === void 0 || (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
|
|
59
59
|
if (shape === 'fill' || !shape) {
|
|
60
60
|
return 'fill';
|
|
61
61
|
} else if (shape === 'extrude') {
|
|
@@ -153,7 +153,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
153
153
|
key: "clearModels",
|
|
154
154
|
value: function clearModels() {
|
|
155
155
|
var _this$texture;
|
|
156
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
156
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
157
157
|
}
|
|
158
158
|
}, {
|
|
159
159
|
key: "registerBuiltinAttributes",
|
|
@@ -90,7 +90,7 @@ var ExtrusionModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
90
90
|
key: "clearModels",
|
|
91
91
|
value: function clearModels() {
|
|
92
92
|
var _this$texture;
|
|
93
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
93
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
94
94
|
}
|
|
95
95
|
}, {
|
|
96
96
|
key: "registerBuiltinAttributes",
|
|
@@ -107,9 +107,9 @@ var OceanModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
107
107
|
key: "clearModels",
|
|
108
108
|
value: function clearModels() {
|
|
109
109
|
var _this$texture, _this$texture2, _this$texture3;
|
|
110
|
-
(_this$texture = this.texture1) === null || _this$texture === void 0
|
|
111
|
-
(_this$texture2 = this.texture2) === null || _this$texture2 === void 0
|
|
112
|
-
(_this$texture3 = this.texture3) === null || _this$texture3 === void 0
|
|
110
|
+
(_this$texture = this.texture1) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
111
|
+
(_this$texture2 = this.texture2) === null || _this$texture2 === void 0 || _this$texture2.destroy();
|
|
112
|
+
(_this$texture3 = this.texture3) === null || _this$texture3 === void 0 || _this$texture3.destroy();
|
|
113
113
|
}
|
|
114
114
|
}, {
|
|
115
115
|
key: "registerBuiltinAttributes",
|
|
@@ -102,7 +102,7 @@ var WaterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
102
102
|
key: "clearModels",
|
|
103
103
|
value: function clearModels() {
|
|
104
104
|
var _this$texture;
|
|
105
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
105
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
106
106
|
}
|
|
107
107
|
}, {
|
|
108
108
|
key: "registerBuiltinAttributes",
|
|
@@ -163,8 +163,8 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
163
163
|
key: "clearModels",
|
|
164
164
|
value: function clearModels() {
|
|
165
165
|
var _this$texture, _this$colorTexture;
|
|
166
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
167
|
-
(_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0
|
|
166
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
167
|
+
(_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0 || _this$colorTexture.destroy();
|
|
168
168
|
}
|
|
169
169
|
}, {
|
|
170
170
|
key: "registerBuiltinAttributes",
|
|
@@ -175,7 +175,7 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
175
175
|
key: "clearModels",
|
|
176
176
|
value: function clearModels() {
|
|
177
177
|
var _this$texture;
|
|
178
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
178
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
179
179
|
}
|
|
180
180
|
}, {
|
|
181
181
|
key: "registerBuiltinAttributes",
|
|
@@ -112,7 +112,7 @@ var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
|
112
112
|
key: "clearModels",
|
|
113
113
|
value: function clearModels() {
|
|
114
114
|
var _this$texture;
|
|
115
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
115
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
116
116
|
}
|
|
117
117
|
}, {
|
|
118
118
|
key: "buildModels",
|
|
@@ -49,7 +49,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
49
49
|
zoom: zoom,
|
|
50
50
|
latLonBounds: latLonBounds
|
|
51
51
|
};
|
|
52
|
-
(_this$tilesetManager = _this.tilesetManager) === null || _this$tilesetManager === void 0
|
|
52
|
+
(_this$tilesetManager = _this.tilesetManager) === null || _this$tilesetManager === void 0 || _this$tilesetManager.throttleUpdate(zoom, latLonBounds);
|
|
53
53
|
});
|
|
54
54
|
// 防抖操作
|
|
55
55
|
_defineProperty(this, "viewchange", debounce(this.mapchange, 24));
|
|
@@ -96,7 +96,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
96
96
|
var _this$getCurrentView2 = this.getCurrentView(),
|
|
97
97
|
latLonBounds = _this$getCurrentView2.latLonBounds,
|
|
98
98
|
zoom = _this$getCurrentView2.zoom;
|
|
99
|
-
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0
|
|
99
|
+
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0 || _this$tilesetManager2.update(zoom, latLonBounds);
|
|
100
100
|
}
|
|
101
101
|
}, {
|
|
102
102
|
key: "getCurrentView",
|
|
@@ -179,7 +179,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
179
179
|
var _this$tilesetManager3;
|
|
180
180
|
this.mapService.off('zoomend', this.mapchange);
|
|
181
181
|
this.mapService.off('moveend', this.viewchange);
|
|
182
|
-
(_this$tilesetManager3 = this.tilesetManager) === null || _this$tilesetManager3 === void 0
|
|
182
|
+
(_this$tilesetManager3 = this.tilesetManager) === null || _this$tilesetManager3 === void 0 || _this$tilesetManager3.destroy();
|
|
183
183
|
this.tileLayerService.destroy();
|
|
184
184
|
}
|
|
185
185
|
// 重新加载
|
|
@@ -192,7 +192,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
192
192
|
var _this$getCurrentView3 = this.getCurrentView(),
|
|
193
193
|
latLonBounds = _this$getCurrentView3.latLonBounds,
|
|
194
194
|
zoom = _this$getCurrentView3.zoom;
|
|
195
|
-
(_this$tilesetManager4 = this.tilesetManager) === null || _this$tilesetManager4 === void 0
|
|
195
|
+
(_this$tilesetManager4 = this.tilesetManager) === null || _this$tilesetManager4 === void 0 || _this$tilesetManager4.update(zoom, latLonBounds);
|
|
196
196
|
}
|
|
197
197
|
}, {
|
|
198
198
|
key: "tileUnLoad",
|
|
@@ -2,7 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
2
2
|
import { DOM } from '@antv/l7-utils';
|
|
3
3
|
export function readRasterValue(tile, mapService, x, y) {
|
|
4
4
|
var _tile$bboxPolygon, _tile$data, _tile$data2, _tile$data3;
|
|
5
|
-
var bbox = (tile === null || tile === void 0
|
|
5
|
+
var bbox = (tile === null || tile === void 0 || (_tile$bboxPolygon = tile.bboxPolygon) === null || _tile$bboxPolygon === void 0 ? void 0 : _tile$bboxPolygon.bbox) || [0, 0, 10, -10];
|
|
6
6
|
var _bbox = _slicedToArray(bbox, 4),
|
|
7
7
|
_bbox$ = _bbox[0],
|
|
8
8
|
minLng = _bbox$ === void 0 ? 0 : _bbox$,
|
|
@@ -21,12 +21,12 @@ export function readRasterValue(tile, mapService, x, y) {
|
|
|
21
21
|
(y - tileMaxXY.y) / tilePixelHeight // y
|
|
22
22
|
];
|
|
23
23
|
|
|
24
|
-
var tileWidth = (tile === null || tile === void 0
|
|
25
|
-
var tileHeight = (tile === null || tile === void 0
|
|
24
|
+
var tileWidth = (tile === null || tile === void 0 || (_tile$data = tile.data) === null || _tile$data === void 0 ? void 0 : _tile$data.width) || 1;
|
|
25
|
+
var tileHeight = (tile === null || tile === void 0 || (_tile$data2 = tile.data) === null || _tile$data2 === void 0 ? void 0 : _tile$data2.height) || 1;
|
|
26
26
|
var indexX = Math.floor(pos[0] * tileWidth);
|
|
27
27
|
var indexY = Math.floor(pos[1] * tileHeight);
|
|
28
28
|
var index = Math.max(0, indexY - 1) * tileWidth + indexX;
|
|
29
|
-
var data = tile === null || tile === void 0
|
|
29
|
+
var data = tile === null || tile === void 0 || (_tile$data3 = tile.data) === null || _tile$data3 === void 0 ? void 0 : _tile$data3.data[index];
|
|
30
30
|
return data;
|
|
31
31
|
}
|
|
32
32
|
export function readPixel(x, y, rendererService) {
|
|
@@ -71,17 +71,17 @@ export var TileLayerService = /*#__PURE__*/function () {
|
|
|
71
71
|
// 不可见 => 可见 兄弟节点加载完成
|
|
72
72
|
if (sourceTile.parent) {
|
|
73
73
|
var flag = this.isChildrenLoaded(sourceTile.parent);
|
|
74
|
-
tile === null || tile === void 0
|
|
74
|
+
tile === null || tile === void 0 || tile.updateVisible(flag);
|
|
75
75
|
} else {
|
|
76
|
-
tile === null || tile === void 0
|
|
76
|
+
tile === null || tile === void 0 || tile.updateVisible(true);
|
|
77
77
|
}
|
|
78
78
|
} else {
|
|
79
79
|
// 可见 => 不可见 兄弟节点加载完成
|
|
80
80
|
if (sourceTile.parent) {
|
|
81
81
|
var _flag = this.isChildrenLoaded(sourceTile.parent);
|
|
82
|
-
tile === null || tile === void 0
|
|
82
|
+
tile === null || tile === void 0 || tile.updateVisible(!_flag);
|
|
83
83
|
} else {
|
|
84
|
-
tile === null || tile === void 0
|
|
84
|
+
tile === null || tile === void 0 || tile.updateVisible(false);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
}
|
|
@@ -28,7 +28,7 @@ export var TilePickService = /*#__PURE__*/function () {
|
|
|
28
28
|
if (tile) {
|
|
29
29
|
// TODO 多图层拾取
|
|
30
30
|
var pickLayer = tile.getMainLayer();
|
|
31
|
-
pickLayer === null || pickLayer === void 0
|
|
31
|
+
pickLayer === null || pickLayer === void 0 || pickLayer.layerPickService.pickRender(target);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}, {
|
|
@@ -78,10 +78,10 @@ export var TilePickService = /*#__PURE__*/function () {
|
|
|
78
78
|
var layer = tile.getMainLayer();
|
|
79
79
|
switch (type) {
|
|
80
80
|
case SELECT:
|
|
81
|
-
layer === null || layer === void 0
|
|
81
|
+
layer === null || layer === void 0 || layer.hooks.beforeSelect.call([r, g, b]);
|
|
82
82
|
break;
|
|
83
83
|
case ACTIVE:
|
|
84
|
-
layer === null || layer === void 0
|
|
84
|
+
layer === null || layer === void 0 || layer.hooks.beforeHighlight.call([r, g, b]);
|
|
85
85
|
break;
|
|
86
86
|
}
|
|
87
87
|
});
|
package/es/tile/tile/Tile.d.ts
CHANGED
|
@@ -58,7 +58,6 @@ export default abstract class Tile extends EventEmitter implements ITile {
|
|
|
58
58
|
cursorEnabled?: boolean | undefined;
|
|
59
59
|
cursor?: string | undefined;
|
|
60
60
|
forward?: boolean | undefined;
|
|
61
|
-
usage?: string | undefined;
|
|
62
61
|
enableMask?: boolean | undefined;
|
|
63
62
|
enablePicking?: boolean | undefined;
|
|
64
63
|
enableHighlight?: boolean | undefined;
|
|
@@ -89,8 +88,11 @@ export default abstract class Tile extends EventEmitter implements ITile {
|
|
|
89
88
|
pickBufferScale?: number | undefined;
|
|
90
89
|
stencil?: boolean | undefined;
|
|
91
90
|
debug?: boolean | undefined;
|
|
91
|
+
renderer?: "regl" | "device" | undefined;
|
|
92
92
|
antialias?: boolean | undefined;
|
|
93
93
|
preserveDrawingBuffer?: boolean | undefined;
|
|
94
|
+
enableWebGPU?: boolean | undefined;
|
|
95
|
+
shaderCompilerPath?: string | undefined;
|
|
94
96
|
};
|
|
95
97
|
protected getMaskLayer(): ILayer[];
|
|
96
98
|
protected addTileMask(): Promise<ILayer>;
|