@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
|
@@ -22,7 +22,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
22
22
|
var pointFillFrag = "\nuniform float u_additive;\nuniform float u_opacity: 1.0;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nvarying vec2 v_exteude;\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 = sdCircle(v_data.xy, 1.0);\n float inner_df = sdCircle(v_data.xy, r);\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n gl_FragColor = vec4(v_color.rgb, v_color.a * u_opacity);\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n } else {\n gl_FragColor.a *= opacity_t;\n }\n\n if(gl_FragColor.a > 0.0) {\n gl_FragColor = filterColor(gl_FragColor);\n }\n\n vec2 extrude = v_exteude;\n vec2 dir = normalize(extrude);\n vec2 baseDir = vec2(1.0, 0.0);\n float pi = 3.14159265359;\n float flag = sign(dir.y);\n float rades = dot(dir, baseDir);\n float radar_v = (flag - 1.0) * -0.5 * acos(rades)/pi;\n // simple AA\n if(radar_v > 0.99) {\n radar_v = 1.0 - (radar_v - 0.99)/0.01;\n }\n\n gl_FragColor.a *= radar_v;\n}\n";
|
|
23
23
|
/* babel-plugin-inline-import '../shaders/radar/radar_vert.glsl' */
|
|
24
24
|
var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nuniform float u_speed: 1.0;\nuniform float u_time;\n\nuniform mat4 u_ModelMatrix;\n\nuniform int u_size_unit;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nvarying vec2 v_exteude;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float newSize = setPickingSize(a_Size);\n\n float time = u_time * u_speed;\n mat2 rotateMatrix = mat2( \n cos(time), sin(time), \n -sin(time), cos(time)\n );\n v_exteude = rotateMatrix * a_Extrude.xy;\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // anti-alias\n float blur = 0.0;\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, blur);\n\n if(u_size_unit == 1) {\n newSize = newSize * u_PixelsPerMeter.z;\n }\n // radius(16-bit)\n v_radius = newSize;\n\n vec2 offset = (extrude.xy * (newSize));\n vec3 aPosition = a_Position;\n \n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n \n v_data = vec4(extrude.x, extrude.y, antialiasblur, -1.0);\n\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
25
|
-
var RadarModel = /*#__PURE__*/function (_BaseModel) {
|
|
25
|
+
var RadarModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
26
26
|
(0, _inherits2.default)(RadarModel, _BaseModel);
|
|
27
27
|
var _super = _createSuper(RadarModel);
|
|
28
28
|
function RadarModel() {
|
|
@@ -167,5 +167,4 @@ var RadarModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
167
167
|
}
|
|
168
168
|
}]);
|
|
169
169
|
return RadarModel;
|
|
170
|
-
}(_BaseModel2.default);
|
|
171
|
-
exports.default = RadarModel;
|
|
170
|
+
}(_BaseModel2.default);
|
package/lib/point/models/text.js
CHANGED
|
@@ -59,7 +59,7 @@ function TextTrianglation(feature) {
|
|
|
59
59
|
size: 7
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
62
|
+
var TextModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
63
63
|
(0, _inherits2.default)(TextModel, _BaseModel);
|
|
64
64
|
var _super = _createSuper(TextModel);
|
|
65
65
|
function TextModel() {
|
|
@@ -242,7 +242,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
242
242
|
key: "clearModels",
|
|
243
243
|
value: function clearModels() {
|
|
244
244
|
var _this$texture;
|
|
245
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
245
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
246
246
|
// TODO this.mapping
|
|
247
247
|
this.layer.off('remapping', this.mapping);
|
|
248
248
|
}
|
|
@@ -615,5 +615,4 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
615
615
|
}()
|
|
616
616
|
}]);
|
|
617
617
|
return TextModel;
|
|
618
|
-
}(_BaseModel2.default);
|
|
619
|
-
exports.default = TextModel;
|
|
618
|
+
}(_BaseModel2.default);
|
|
@@ -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/lib/polygon/index.js
CHANGED
|
@@ -18,7 +18,7 @@ var _BaseLayer2 = _interopRequireDefault(require("../core/BaseLayer"));
|
|
|
18
18
|
var _models = _interopRequireDefault(require("./models/"));
|
|
19
19
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
20
20
|
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; } }
|
|
21
|
-
var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
21
|
+
var PolygonLayer = exports.default = /*#__PURE__*/function (_BaseLayer) {
|
|
22
22
|
(0, _inherits2.default)(PolygonLayer, _BaseLayer);
|
|
23
23
|
var _super = _createSuper(PolygonLayer);
|
|
24
24
|
function PolygonLayer() {
|
|
@@ -62,7 +62,7 @@ var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
62
62
|
value: function getModelType() {
|
|
63
63
|
var _shapeAttribute$scale;
|
|
64
64
|
var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
|
|
65
|
-
var shape = shapeAttribute === null || shapeAttribute === void 0
|
|
65
|
+
var shape = shapeAttribute === null || shapeAttribute === void 0 || (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
|
|
66
66
|
if (shape === 'fill' || !shape) {
|
|
67
67
|
return 'fill';
|
|
68
68
|
} else if (shape === 'extrude') {
|
|
@@ -113,5 +113,4 @@ var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
113
113
|
}
|
|
114
114
|
}]);
|
|
115
115
|
return PolygonLayer;
|
|
116
|
-
}(_BaseLayer2.default);
|
|
117
|
-
exports.default = PolygonLayer;
|
|
116
|
+
}(_BaseLayer2.default);
|
|
@@ -32,7 +32,7 @@ var polygonExtrudeTexVert = "precision highp float;\n\n#define ambientRatio 0.5\
|
|
|
32
32
|
var polygonExtrudePickLightFrag = "uniform float u_opacity: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nvarying vec3 v_uvs;\nvarying vec2 v_texture_data;\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = u_opacity;\n float isSide = v_texture_data.x;\n float sidey = v_uvs[2];\n float lightWeight = v_texture_data.y;\n\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n \n if( u_linearColor == 1.0) {\n // side use linear\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n gl_FragColor = linearColor;\n } else {\n // side notuse linear\n gl_FragColor = v_Color;\n }\n } else {\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n gl_FragColor = v_Color;\n }\n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColorAlpha(gl_FragColor, lightWeight);\n}\n";
|
|
33
33
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_picklight_vert.glsl' */
|
|
34
34
|
var polygonExtrudePickLightVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\n\n\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\n\nvarying vec2 v_texture_data;\nvarying vec3 v_uvs;\nvarying vec4 v_Color;\n\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n\n\n v_uvs = a_uvs;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\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 project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n float lightWeight = calc_lighting(pos);\n v_texture_data = vec2(a_Position.z,lightWeight);\n\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
35
|
-
var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
35
|
+
var ExtrudeModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
36
36
|
(0, _inherits2.default)(ExtrudeModel, _BaseModel);
|
|
37
37
|
var _super = _createSuper(ExtrudeModel);
|
|
38
38
|
function ExtrudeModel() {
|
|
@@ -160,7 +160,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
160
160
|
key: "clearModels",
|
|
161
161
|
value: function clearModels() {
|
|
162
162
|
var _this$texture;
|
|
163
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
163
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
164
164
|
}
|
|
165
165
|
}, {
|
|
166
166
|
key: "registerBuiltinAttributes",
|
|
@@ -296,5 +296,4 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
296
296
|
}()
|
|
297
297
|
}]);
|
|
298
298
|
return ExtrudeModel;
|
|
299
|
-
}(_BaseModel2.default);
|
|
300
|
-
exports.default = ExtrudeModel;
|
|
299
|
+
}(_BaseModel2.default);
|
|
@@ -22,7 +22,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
22
22
|
var polygonExtrudeFrag = "\nuniform float u_opacity: 1.0;\nvarying vec4 v_Color;\nvarying vec2 v_texture_data;\n\n\n#pragma include \"picking\"\n\nvoid main() {\n\n gl_FragColor = v_Color;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
23
23
|
/* babel-plugin-inline-import '../shaders/extrusion/polygon_extrusion_vert.glsl' */
|
|
24
24
|
var polygonExtrudeVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\n\n\n\nvarying vec4 v_Color;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n \n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size + (1.0 - a_Position.z) * extrusionBase, 1.0);\n float lightWeight = calc_lighting(pos);\n vec4 project_pos = project_position(pos);\n v_Color = a_Color;\n v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
25
|
-
var ExtrusionModel = /*#__PURE__*/function (_BaseModel) {
|
|
25
|
+
var ExtrusionModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
26
26
|
(0, _inherits2.default)(ExtrusionModel, _BaseModel);
|
|
27
27
|
var _super = _createSuper(ExtrusionModel);
|
|
28
28
|
function ExtrusionModel() {
|
|
@@ -97,7 +97,7 @@ var ExtrusionModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
97
97
|
key: "clearModels",
|
|
98
98
|
value: function clearModels() {
|
|
99
99
|
var _this$texture;
|
|
100
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
100
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
101
101
|
}
|
|
102
102
|
}, {
|
|
103
103
|
key: "registerBuiltinAttributes",
|
|
@@ -140,5 +140,4 @@ var ExtrusionModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
140
140
|
}
|
|
141
141
|
}]);
|
|
142
142
|
return ExtrusionModel;
|
|
143
|
-
}(_BaseModel2.default);
|
|
144
|
-
exports.default = ExtrusionModel;
|
|
143
|
+
}(_BaseModel2.default);
|
|
@@ -27,7 +27,7 @@ var polygon_linear_frag = "#pragma include \"picking\"\nuniform float u_opacityl
|
|
|
27
27
|
var polygon_linear_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\n\nuniform float u_raisingHeight: 0.0;\n\nvarying vec4 v_Color;\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nuniform float u_opacitylinear: 0.0;\n\nattribute vec3 a_linear;\nvarying vec3 v_linear;\nvarying vec2 v_pos;\n\nvoid main() {\n if(u_opacitylinear > 0.0) {\n v_linear = a_linear;\n v_pos = a_Position.xy;\n }\n v_Color = vec4(a_Color.xyz, a_Color.w * opacity);\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n project_pos.z += u_raisingHeight;\n\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 project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n setPickingColor(a_PickingColor);\n}";
|
|
28
28
|
/* babel-plugin-inline-import '../shaders/polygon_vert.glsl' */
|
|
29
29
|
var polygon_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\n\n\nuniform float u_raisingHeight: 0.0;\n\nvarying vec4 v_color;\n\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\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n project_pos.z += u_raisingHeight;\n\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 project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n \n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n\n";
|
|
30
|
-
var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
30
|
+
var FillModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
31
31
|
(0, _inherits2.default)(FillModel, _BaseModel);
|
|
32
32
|
var _super = _createSuper(FillModel);
|
|
33
33
|
function FillModel() {
|
|
@@ -161,5 +161,4 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
161
161
|
}
|
|
162
162
|
}]);
|
|
163
163
|
return FillModel;
|
|
164
|
-
}(_BaseModel2.default);
|
|
165
|
-
exports.default = FillModel;
|
|
164
|
+
}(_BaseModel2.default);
|
|
@@ -24,7 +24,7 @@ var ocean_frag = "\nuniform float u_time: 0.0;\nuniform float u_opacity: 1.0;\n\
|
|
|
24
24
|
/* babel-plugin-inline-import '../shaders/water/polygon_ocean_vert.glsl' */
|
|
25
25
|
var ocean_vert = "attribute vec2 a_uv;\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\n\n\nvarying vec2 v_uv;\n\n#pragma include \"projection\"\n\nvoid main() {\n v_uv = a_uv;\n\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n}\n\n";
|
|
26
26
|
var isNumber = _l7Utils.lodashUtil.isNumber;
|
|
27
|
-
var OceanModel = /*#__PURE__*/function (_BaseModel) {
|
|
27
|
+
var OceanModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
28
28
|
(0, _inherits2.default)(OceanModel, _BaseModel);
|
|
29
29
|
var _super = _createSuper(OceanModel);
|
|
30
30
|
function OceanModel() {
|
|
@@ -114,9 +114,9 @@ var OceanModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
114
114
|
key: "clearModels",
|
|
115
115
|
value: function clearModels() {
|
|
116
116
|
var _this$texture, _this$texture2, _this$texture3;
|
|
117
|
-
(_this$texture = this.texture1) === null || _this$texture === void 0
|
|
118
|
-
(_this$texture2 = this.texture2) === null || _this$texture2 === void 0
|
|
119
|
-
(_this$texture3 = this.texture3) === null || _this$texture3 === void 0
|
|
117
|
+
(_this$texture = this.texture1) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
118
|
+
(_this$texture2 = this.texture2) === null || _this$texture2 === void 0 || _this$texture2.destroy();
|
|
119
|
+
(_this$texture3 = this.texture3) === null || _this$texture3 === void 0 || _this$texture3.destroy();
|
|
120
120
|
}
|
|
121
121
|
}, {
|
|
122
122
|
key: "registerBuiltinAttributes",
|
|
@@ -203,5 +203,4 @@ var OceanModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
203
203
|
}
|
|
204
204
|
}]);
|
|
205
205
|
return OceanModel;
|
|
206
|
-
}(_BaseModel2.default);
|
|
207
|
-
exports.default = OceanModel;
|
|
206
|
+
}(_BaseModel2.default);
|
|
@@ -24,7 +24,7 @@ var water_frag = "uniform sampler2D u_texture;\nuniform float u_time: 0.0;\nunif
|
|
|
24
24
|
/* babel-plugin-inline-import '../shaders/water/polygon_water_vert.glsl' */
|
|
25
25
|
var water_vert = "attribute vec4 a_Color;\nattribute vec2 a_uv;\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\n\n\nvarying vec4 v_Color;\nvarying vec2 v_uv;\nuniform float u_opacity: 1.0;\n\n\n#pragma include \"projection\"\n\nvoid main() {\n v_uv = a_uv;\n\n v_Color = a_Color;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n}\n\n";
|
|
26
26
|
var isNumber = _l7Utils.lodashUtil.isNumber;
|
|
27
|
-
var WaterModel = /*#__PURE__*/function (_BaseModel) {
|
|
27
|
+
var WaterModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
28
28
|
(0, _inherits2.default)(WaterModel, _BaseModel);
|
|
29
29
|
var _super = _createSuper(WaterModel);
|
|
30
30
|
function WaterModel() {
|
|
@@ -109,7 +109,7 @@ var WaterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
109
109
|
key: "clearModels",
|
|
110
110
|
value: function clearModels() {
|
|
111
111
|
var _this$texture;
|
|
112
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
112
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
113
113
|
}
|
|
114
114
|
}, {
|
|
115
115
|
key: "registerBuiltinAttributes",
|
|
@@ -180,5 +180,4 @@ var WaterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
180
180
|
}
|
|
181
181
|
}]);
|
|
182
182
|
return WaterModel;
|
|
183
|
-
}(_BaseModel2.default);
|
|
184
|
-
exports.default = WaterModel;
|
|
183
|
+
}(_BaseModel2.default);
|
package/lib/raster/index.js
CHANGED
|
@@ -18,7 +18,7 @@ var _BaseLayer2 = _interopRequireDefault(require("../core/BaseLayer"));
|
|
|
18
18
|
var _index = _interopRequireDefault(require("./models/index"));
|
|
19
19
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
20
20
|
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; } }
|
|
21
|
-
var RaterLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
21
|
+
var RaterLayer = exports.default = /*#__PURE__*/function (_BaseLayer) {
|
|
22
22
|
(0, _inherits2.default)(RaterLayer, _BaseLayer);
|
|
23
23
|
var _super = _createSuper(RaterLayer);
|
|
24
24
|
function RaterLayer() {
|
|
@@ -84,5 +84,4 @@ var RaterLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
84
84
|
}
|
|
85
85
|
}]);
|
|
86
86
|
return RaterLayer;
|
|
87
|
-
}(_BaseLayer2.default);
|
|
88
|
-
exports.default = RaterLayer;
|
|
87
|
+
}(_BaseLayer2.default);
|
|
@@ -22,7 +22,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
22
22
|
var rasterFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\nuniform float u_min;\nuniform float u_max;\nuniform vec2 u_domain;\nuniform float u_noDataValue;\nuniform bool u_clampLow: true;\nuniform bool u_clampHigh: true;\nvarying vec2 v_texCoord;\nbool isnan_emu(float x) { return (x > 0.0 || x < 0.0) ? x != x : x != 0.0; }\n\n\nvoid main() {\n\n float value = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y)).r;\n if (value == u_noDataValue || isnan_emu(value))\n discard;\n else if ((!u_clampLow && value < u_domain[0]) || (!u_clampHigh && value > u_domain[1]))\n discard;\n else {\n float normalisedValue =(value - u_domain[0]) / (u_domain[1] -u_domain[0]);\n vec4 color = texture2D(u_colorTexture,vec2(normalisedValue, 0));\n \n gl_FragColor = color;\n gl_FragColor.a = gl_FragColor.a * u_opacity ;\n if(gl_FragColor.a < 0.01)\n discard;\n \n }\n}\n";
|
|
23
23
|
/* babel-plugin-inline-import '../shaders/raster_2d_vert.glsl' */
|
|
24
24
|
var rasterVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\n\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));\n}\n";
|
|
25
|
-
var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
25
|
+
var RasterModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
26
26
|
(0, _inherits2.default)(RasterModel, _BaseModel);
|
|
27
27
|
var _super = _createSuper(RasterModel);
|
|
28
28
|
function RasterModel() {
|
|
@@ -170,8 +170,8 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
170
170
|
key: "clearModels",
|
|
171
171
|
value: function clearModels() {
|
|
172
172
|
var _this$texture, _this$colorTexture;
|
|
173
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
174
|
-
(_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0
|
|
173
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
174
|
+
(_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0 || _this$colorTexture.destroy();
|
|
175
175
|
}
|
|
176
176
|
}, {
|
|
177
177
|
key: "registerBuiltinAttributes",
|
|
@@ -197,5 +197,4 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
197
197
|
}
|
|
198
198
|
}]);
|
|
199
199
|
return RasterModel;
|
|
200
|
-
}(_BaseModel2.default);
|
|
201
|
-
exports.default = RasterModel;
|
|
200
|
+
}(_BaseModel2.default);
|
|
@@ -27,7 +27,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
27
27
|
var rasterVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\n\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));\n}\n";
|
|
28
28
|
/* babel-plugin-inline-import '../shaders/raster_rgb_frag.glsl' */
|
|
29
29
|
var rasterFrag = "precision mediump float;\nuniform vec2 u_rminmax: vec2(0,255); \nuniform vec2 u_gminmax: vec2(0,255);\nuniform vec2 u_bminmax: vec2(0,255);\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nuniform float u_noDataValue : 0.0;\nvarying vec2 v_texCoord;\n\nvoid main() {\n vec3 rgb = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y)).rgb;\n if(rgb == vec3(u_noDataValue)) {\n gl_FragColor = vec4(0.0, 0, 0, 0.0);\n } else {\n gl_FragColor = vec4(rgb.r / (u_rminmax.y -u_rminmax.x), rgb.g /(u_gminmax.y -u_gminmax.x), rgb.b/ (u_bminmax.y - u_bminmax.x), u_opacity);\n }\n if(gl_FragColor.a < 0.01)\n discard;\n \n}";
|
|
30
|
-
var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
30
|
+
var RasterModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
31
31
|
(0, _inherits2.default)(RasterModel, _BaseModel);
|
|
32
32
|
var _super = _createSuper(RasterModel);
|
|
33
33
|
function RasterModel() {
|
|
@@ -182,7 +182,7 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
182
182
|
key: "clearModels",
|
|
183
183
|
value: function clearModels() {
|
|
184
184
|
var _this$texture;
|
|
185
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
185
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
186
186
|
}
|
|
187
187
|
}, {
|
|
188
188
|
key: "registerBuiltinAttributes",
|
|
@@ -208,5 +208,4 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
208
208
|
}
|
|
209
209
|
}]);
|
|
210
210
|
return RasterModel;
|
|
211
|
-
}(_BaseModel2.default);
|
|
212
|
-
exports.default = RasterModel;
|
|
211
|
+
}(_BaseModel2.default);
|
|
@@ -22,7 +22,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
22
22
|
var Raster_terrainFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\n\nuniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\n\nvarying vec2 v_texCoord;\n\nuniform vec2 u_domain;\nuniform float u_noDataValue;\nuniform bool u_clampLow: true;\nuniform bool u_clampHigh: true;\nuniform vec4 u_unpack;\n\nfloat getElevation(vec2 coord, float bias) {\n // Convert encoded elevation value to meters\n vec4 data = texture2D(u_texture, coord,bias) * 255.0;\n data.a = -1.0;\n return dot(data, u_unpack);\n}\n\nvec4 getColor(float value) {\n float normalisedValue =(value- u_domain[0]) / (u_domain[1] - u_domain[0]);\n vec2 coord = vec2(normalisedValue, 0);\n return texture2D(u_colorTexture, coord);\n}\n\nvoid main() {\n float value = getElevation(v_texCoord,0.0);\n if (value == u_noDataValue) {\n gl_FragColor = vec4(0.0, 0, 0, 0.0);\n } else if ((!u_clampLow && value < u_domain[0]) || (!u_clampHigh && value > u_domain[1])) {\n gl_FragColor = vec4(0.0, 0, 0, 0.0);\n } else {\n \n gl_FragColor = getColor(value);\n gl_FragColor.a = gl_FragColor.a * u_opacity ;\n if(gl_FragColor.a < 0.01)\n discard;\n }\n}\n";
|
|
23
23
|
/* babel-plugin-inline-import '../shaders/rater_terrain_rgb_vert.glsl' */
|
|
24
24
|
var Raster_terrainVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\n\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));\n}\n";
|
|
25
|
-
var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
25
|
+
var RasterTerrainRGB = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
26
26
|
(0, _inherits2.default)(RasterTerrainRGB, _BaseModel);
|
|
27
27
|
var _super = _createSuper(RasterTerrainRGB);
|
|
28
28
|
function RasterTerrainRGB() {
|
|
@@ -119,7 +119,7 @@ var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
|
119
119
|
key: "clearModels",
|
|
120
120
|
value: function clearModels() {
|
|
121
121
|
var _this$texture;
|
|
122
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
122
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
123
123
|
}
|
|
124
124
|
}, {
|
|
125
125
|
key: "buildModels",
|
|
@@ -162,5 +162,4 @@ var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
|
162
162
|
}
|
|
163
163
|
}]);
|
|
164
164
|
return RasterTerrainRGB;
|
|
165
|
-
}(_BaseModel2.default);
|
|
166
|
-
exports.default = RasterTerrainRGB;
|
|
165
|
+
}(_BaseModel2.default);
|
|
@@ -17,7 +17,7 @@ var _TilePickService = require("../service/TilePickService");
|
|
|
17
17
|
var _tile = require("../tile");
|
|
18
18
|
var _constants = require("../utils/constants");
|
|
19
19
|
var debounce = _l7Utils.lodashUtil.debounce;
|
|
20
|
-
var BaseTileLayer = /*#__PURE__*/function () {
|
|
20
|
+
var BaseTileLayer = exports.default = /*#__PURE__*/function () {
|
|
21
21
|
// 瓦片是否加载成功
|
|
22
22
|
|
|
23
23
|
function BaseTileLayer(parent) {
|
|
@@ -56,7 +56,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
56
56
|
zoom: zoom,
|
|
57
57
|
latLonBounds: latLonBounds
|
|
58
58
|
};
|
|
59
|
-
(_this$tilesetManager = _this.tilesetManager) === null || _this$tilesetManager === void 0
|
|
59
|
+
(_this$tilesetManager = _this.tilesetManager) === null || _this$tilesetManager === void 0 || _this$tilesetManager.throttleUpdate(zoom, latLonBounds);
|
|
60
60
|
});
|
|
61
61
|
// 防抖操作
|
|
62
62
|
(0, _defineProperty2.default)(this, "viewchange", debounce(this.mapchange, 24));
|
|
@@ -103,7 +103,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
103
103
|
var _this$getCurrentView2 = this.getCurrentView(),
|
|
104
104
|
latLonBounds = _this$getCurrentView2.latLonBounds,
|
|
105
105
|
zoom = _this$getCurrentView2.zoom;
|
|
106
|
-
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0
|
|
106
|
+
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0 || _this$tilesetManager2.update(zoom, latLonBounds);
|
|
107
107
|
}
|
|
108
108
|
}, {
|
|
109
109
|
key: "getCurrentView",
|
|
@@ -186,7 +186,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
186
186
|
var _this$tilesetManager3;
|
|
187
187
|
this.mapService.off('zoomend', this.mapchange);
|
|
188
188
|
this.mapService.off('moveend', this.viewchange);
|
|
189
|
-
(_this$tilesetManager3 = this.tilesetManager) === null || _this$tilesetManager3 === void 0
|
|
189
|
+
(_this$tilesetManager3 = this.tilesetManager) === null || _this$tilesetManager3 === void 0 || _this$tilesetManager3.destroy();
|
|
190
190
|
this.tileLayerService.destroy();
|
|
191
191
|
}
|
|
192
192
|
// 重新加载
|
|
@@ -199,7 +199,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
199
199
|
var _this$getCurrentView3 = this.getCurrentView(),
|
|
200
200
|
latLonBounds = _this$getCurrentView3.latLonBounds,
|
|
201
201
|
zoom = _this$getCurrentView3.zoom;
|
|
202
|
-
(_this$tilesetManager4 = this.tilesetManager) === null || _this$tilesetManager4 === void 0
|
|
202
|
+
(_this$tilesetManager4 = this.tilesetManager) === null || _this$tilesetManager4 === void 0 || _this$tilesetManager4.update(zoom, latLonBounds);
|
|
203
203
|
}
|
|
204
204
|
}, {
|
|
205
205
|
key: "tileUnLoad",
|
|
@@ -344,5 +344,4 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
344
344
|
}
|
|
345
345
|
}]);
|
|
346
346
|
return BaseTileLayer;
|
|
347
|
-
}();
|
|
348
|
-
exports.default = BaseTileLayer;
|
|
347
|
+
}();
|
|
@@ -17,7 +17,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
17
17
|
var _BaseLayer2 = _interopRequireDefault(require("../../core/BaseLayer"));
|
|
18
18
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
19
19
|
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; } }
|
|
20
|
-
var TileDebugLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
20
|
+
var TileDebugLayer = exports.default = /*#__PURE__*/function (_BaseLayer) {
|
|
21
21
|
(0, _inherits2.default)(TileDebugLayer, _BaseLayer);
|
|
22
22
|
var _super = _createSuper(TileDebugLayer);
|
|
23
23
|
function TileDebugLayer() {
|
|
@@ -60,5 +60,4 @@ var TileDebugLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
60
60
|
}()
|
|
61
61
|
}]);
|
|
62
62
|
return TileDebugLayer;
|
|
63
|
-
}(_BaseLayer2.default);
|
|
64
|
-
exports.default = TileDebugLayer;
|
|
63
|
+
}(_BaseLayer2.default);
|
|
@@ -10,7 +10,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _l7Utils = require("@antv/l7-utils");
|
|
11
11
|
function readRasterValue(tile, mapService, x, y) {
|
|
12
12
|
var _tile$bboxPolygon, _tile$data, _tile$data2, _tile$data3;
|
|
13
|
-
var bbox = (tile === null || tile === void 0
|
|
13
|
+
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];
|
|
14
14
|
var _bbox = (0, _slicedToArray2.default)(bbox, 4),
|
|
15
15
|
_bbox$ = _bbox[0],
|
|
16
16
|
minLng = _bbox$ === void 0 ? 0 : _bbox$,
|
|
@@ -29,12 +29,12 @@ function readRasterValue(tile, mapService, x, y) {
|
|
|
29
29
|
(y - tileMaxXY.y) / tilePixelHeight // y
|
|
30
30
|
];
|
|
31
31
|
|
|
32
|
-
var tileWidth = (tile === null || tile === void 0
|
|
33
|
-
var tileHeight = (tile === null || tile === void 0
|
|
32
|
+
var tileWidth = (tile === null || tile === void 0 || (_tile$data = tile.data) === null || _tile$data === void 0 ? void 0 : _tile$data.width) || 1;
|
|
33
|
+
var tileHeight = (tile === null || tile === void 0 || (_tile$data2 = tile.data) === null || _tile$data2 === void 0 ? void 0 : _tile$data2.height) || 1;
|
|
34
34
|
var indexX = Math.floor(pos[0] * tileWidth);
|
|
35
35
|
var indexY = Math.floor(pos[1] * tileHeight);
|
|
36
36
|
var index = Math.max(0, indexY - 1) * tileWidth + indexX;
|
|
37
|
-
var data = tile === null || tile === void 0
|
|
37
|
+
var data = tile === null || tile === void 0 || (_tile$data3 = tile.data) === null || _tile$data3 === void 0 ? void 0 : _tile$data3.data[index];
|
|
38
38
|
return data;
|
|
39
39
|
}
|
|
40
40
|
function readPixel(x, y, rendererService) {
|
|
@@ -12,7 +12,7 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
12
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
14
|
require("reflect-metadata");
|
|
15
|
-
var TileLayerService = /*#__PURE__*/function () {
|
|
15
|
+
var TileLayerService = exports.TileLayerService = /*#__PURE__*/function () {
|
|
16
16
|
function TileLayerService(_ref) {
|
|
17
17
|
var rendererService = _ref.rendererService,
|
|
18
18
|
layerService = _ref.layerService,
|
|
@@ -78,17 +78,17 @@ var TileLayerService = /*#__PURE__*/function () {
|
|
|
78
78
|
// 不可见 => 可见 兄弟节点加载完成
|
|
79
79
|
if (sourceTile.parent) {
|
|
80
80
|
var flag = this.isChildrenLoaded(sourceTile.parent);
|
|
81
|
-
tile === null || tile === void 0
|
|
81
|
+
tile === null || tile === void 0 || tile.updateVisible(flag);
|
|
82
82
|
} else {
|
|
83
|
-
tile === null || tile === void 0
|
|
83
|
+
tile === null || tile === void 0 || tile.updateVisible(true);
|
|
84
84
|
}
|
|
85
85
|
} else {
|
|
86
86
|
// 可见 => 不可见 兄弟节点加载完成
|
|
87
87
|
if (sourceTile.parent) {
|
|
88
88
|
var _flag = this.isChildrenLoaded(sourceTile.parent);
|
|
89
|
-
tile === null || tile === void 0
|
|
89
|
+
tile === null || tile === void 0 || tile.updateVisible(!_flag);
|
|
90
90
|
} else {
|
|
91
|
-
tile === null || tile === void 0
|
|
91
|
+
tile === null || tile === void 0 || tile.updateVisible(false);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -201,5 +201,4 @@ var TileLayerService = /*#__PURE__*/function () {
|
|
|
201
201
|
}
|
|
202
202
|
}]);
|
|
203
203
|
return TileLayerService;
|
|
204
|
-
}();
|
|
205
|
-
exports.TileLayerService = TileLayerService;
|
|
204
|
+
}();
|