@antv/l7-layers 2.12.1 → 2.13.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.
Files changed (96) hide show
  1. package/es/core/BaseLayer.d.ts +1 -1
  2. package/es/core/BaseLayer.js +18 -7
  3. package/es/core/TextureService.d.ts +4 -3
  4. package/es/core/TextureService.js +32 -10
  5. package/es/core/interface.d.ts +5 -6
  6. package/es/core/interface.js +7 -0
  7. package/es/line/index.d.ts +1 -1
  8. package/es/line/models/index.d.ts +1 -1
  9. package/es/line/models/index.js +0 -2
  10. package/es/plugins/DataMappingPlugin.js +10 -7
  11. package/es/point/index.d.ts +1 -1
  12. package/es/point/models/fill.d.ts +0 -14
  13. package/es/point/models/fill.js +9 -100
  14. package/es/point/models/fillmage.d.ts +0 -5
  15. package/es/point/models/fillmage.js +15 -65
  16. package/es/point/models/index.d.ts +1 -1
  17. package/es/point/models/index.js +0 -4
  18. package/es/point/models/radar.d.ts +0 -7
  19. package/es/point/models/radar.js +13 -79
  20. package/es/point/models/text.js +1 -1
  21. package/es/point/shaders/fill_vert.glsl +9 -26
  22. package/es/point/shaders/image/fillImage_vert.glsl +8 -14
  23. package/es/point/shaders/radar/radar_vert.glsl +12 -19
  24. package/es/point/shaders/text_vert.glsl +1 -1
  25. package/es/polygon/index.js +0 -2
  26. package/es/polygon/models/index.d.ts +1 -1
  27. package/es/polygon/models/index.js +2 -4
  28. package/es/raster/models/raster.d.ts +0 -2
  29. package/es/raster/models/raster.js +6 -22
  30. package/es/raster/models/rasterTerrainRgb.js +6 -6
  31. package/es/raster/shaders/raster_2d_frag.glsl +1 -0
  32. package/es/tile/tileFactory/RasterRGBTile.js +0 -1
  33. package/es/tile/tileFactory/RasterTile.js +13 -8
  34. package/lib/core/BaseLayer.js +17 -6
  35. package/lib/core/TextureService.js +31 -9
  36. package/lib/core/interface.js +9 -1
  37. package/lib/line/models/index.js +0 -3
  38. package/lib/plugins/DataMappingPlugin.js +10 -7
  39. package/lib/point/models/fill.js +8 -98
  40. package/lib/point/models/fillmage.js +16 -67
  41. package/lib/point/models/index.js +0 -6
  42. package/lib/point/models/radar.js +13 -80
  43. package/lib/point/models/text.js +1 -1
  44. package/lib/point/shaders/fill_vert.glsl +9 -26
  45. package/lib/point/shaders/image/fillImage_vert.glsl +8 -14
  46. package/lib/point/shaders/radar/radar_vert.glsl +12 -19
  47. package/lib/point/shaders/text_vert.glsl +1 -1
  48. package/lib/polygon/index.js +0 -2
  49. package/lib/polygon/models/index.js +2 -5
  50. package/lib/raster/models/raster.js +5 -21
  51. package/lib/raster/models/rasterTerrainRgb.js +5 -5
  52. package/lib/raster/shaders/raster_2d_frag.glsl +1 -0
  53. package/lib/tile/tileFactory/RasterTile.js +14 -8
  54. package/package.json +6 -6
  55. package/es/line/models/tile.d.ts +0 -8
  56. package/es/line/models/tile.js +0 -201
  57. package/es/line/shaders/tile/line_tile_map_vert.glsl +0 -25
  58. package/es/line/shaders/tile/line_tile_vert.glsl +0 -52
  59. package/es/line/shaders/tile/simpleline_map_vert.glsl +0 -15
  60. package/es/line/shaders/tile/simpleline_vert.glsl +0 -21
  61. package/es/point/models/tile.d.ts +0 -15
  62. package/es/point/models/tile.js +0 -217
  63. package/es/point/models/tileText.d.ts +0 -52
  64. package/es/point/models/tileText.js +0 -544
  65. package/es/point/shaders/tile/fill_tile_frag.glsl +0 -76
  66. package/es/point/shaders/tile/fill_tile_vert.glsl +0 -78
  67. package/es/point/shaders/tile/text_frag.glsl +0 -33
  68. package/es/point/shaders/tile/text_map_frag.glsl +0 -31
  69. package/es/point/shaders/tile/text_map_vert.glsl +0 -38
  70. package/es/point/shaders/tile/text_vert.glsl +0 -48
  71. package/es/polygon/models/tile.d.ts +0 -12
  72. package/es/polygon/models/tile.js +0 -141
  73. package/es/polygon/shaders/tile/polygon_tile_map_vert.glsl +0 -16
  74. package/es/polygon/shaders/tile/polygon_tile_vert.glsl +0 -42
  75. package/es/raster/models/rasterTile.d.ts +0 -18
  76. package/es/raster/models/rasterTile.js +0 -180
  77. package/es/tile/tileFactory/layers/RasterDataLayer.d.ts +0 -11
  78. package/es/tile/tileFactory/layers/RasterDataLayer.js +0 -89
  79. package/lib/line/models/tile.js +0 -217
  80. package/lib/line/shaders/tile/line_tile_map_vert.glsl +0 -25
  81. package/lib/line/shaders/tile/line_tile_vert.glsl +0 -52
  82. package/lib/line/shaders/tile/simpleline_map_vert.glsl +0 -15
  83. package/lib/line/shaders/tile/simpleline_vert.glsl +0 -21
  84. package/lib/point/models/tile.js +0 -233
  85. package/lib/point/models/tileText.js +0 -560
  86. package/lib/point/shaders/tile/fill_tile_frag.glsl +0 -76
  87. package/lib/point/shaders/tile/fill_tile_vert.glsl +0 -78
  88. package/lib/point/shaders/tile/text_frag.glsl +0 -33
  89. package/lib/point/shaders/tile/text_map_frag.glsl +0 -31
  90. package/lib/point/shaders/tile/text_map_vert.glsl +0 -38
  91. package/lib/point/shaders/tile/text_vert.glsl +0 -48
  92. package/lib/polygon/models/tile.js +0 -156
  93. package/lib/polygon/shaders/tile/polygon_tile_map_vert.glsl +0 -16
  94. package/lib/polygon/shaders/tile/polygon_tile_vert.glsl +0 -42
  95. package/lib/raster/models/rasterTile.js +0 -196
  96. package/lib/tile/tileFactory/layers/RasterDataLayer.js +0 -105
@@ -1,78 +0,0 @@
1
- attribute vec4 a_Color;
2
- attribute vec3 a_Position;
3
- attribute vec3 a_Extrude;
4
- attribute float a_Size;
5
- attribute float a_Shape;
6
-
7
- uniform mat4 u_ModelMatrix;
8
- uniform mat4 u_Mvp;
9
-
10
- // uniform vec2 u_tileOrigin;
11
- // uniform float u_coord;
12
-
13
- varying vec4 v_data;
14
- varying vec4 v_color;
15
- varying float v_radius;
16
-
17
- uniform float u_opacity : 1;
18
- uniform float u_stroke_opacity : 1;
19
- uniform float u_stroke_width : 2;
20
- uniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];
21
-
22
- #pragma include "projection"
23
- #pragma include "picking"
24
-
25
- void main() {
26
- vec3 extrude = a_Extrude;
27
- float shape_type = a_Shape;
28
- float newSize = setPickingSize(a_Size);
29
-
30
- // cal style mapping
31
-
32
- v_color = a_Color;
33
- v_radius = newSize;
34
-
35
- // anti-alias
36
- // float antialiased_blur = -max(u_blur, antialiasblur);
37
- float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, 0.0);
38
-
39
- vec2 offset = (extrude.xy * (newSize + u_stroke_width));
40
- offset = project_pixel(offset);
41
-
42
- v_data = vec4(extrude.x, extrude.y, antialiasblur,shape_type);
43
-
44
- vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));
45
-
46
- if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
47
- float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
48
- }
49
-
50
- // if(u_coord > 0.0) {
51
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
52
- gl_Position = u_Mvp * vec4(project_pos.xy + offset, 0.0, 1.0);
53
- } else {
54
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));
55
- }
56
- // } else {
57
-
58
- // vec2 pointPos = a_Position.xy;
59
- // vec4 world = vec4(project_mvt_offset_position(vec4(u_tileOrigin, 0.0, 1.0)).xyz, 1.0); // 瓦片起始点的世界坐标
60
-
61
- // vec2 pointOffset = pointPos * pow(2.0, u_Zoom); // 瓦片内的点的偏移坐标
62
-
63
- // world.xy += offset;
64
- // world.xy += pointOffset;
65
-
66
- // if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
67
- // // Needs to be divided with project_uCommonUnitsPerMeter
68
- // world.w *= u_PixelsPerMeter.z;
69
- // }
70
-
71
- // gl_Position = u_ViewProjectionMatrix * world + u_ViewportCenterProjection;
72
- // }
73
-
74
-
75
- setPickingColor(a_PickingColor);
76
-
77
-
78
- }
@@ -1,33 +0,0 @@
1
- #define SDF_PX 8.0
2
- #define EDGE_GAMMA 0.105
3
- #define FONT_SIZE 48.0
4
- uniform sampler2D u_sdf_map;
5
- uniform float u_gamma_scale : 0.5;
6
- // uniform float u_font_size : 24.0;
7
- uniform float u_opacity : 1.0;
8
- uniform vec4 u_stroke_color : [0, 0, 0, 1];
9
- uniform float u_stroke_width : 2.0;
10
- uniform float u_halo_blur : 0.5;
11
- uniform float u_DevicePixelRatio;
12
-
13
- varying vec4 v_color;
14
- varying vec2 v_uv;
15
- varying float v_gamma_scale;
16
- varying float v_fontScale;
17
-
18
- #pragma include "picking"
19
- void main() {
20
- // get sdf from atlas
21
- float dist = texture2D(u_sdf_map, v_uv).a;
22
-
23
- lowp float buff = (6.0 - u_stroke_width / v_fontScale) / SDF_PX;
24
- highp float gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (v_fontScale * u_gamma_scale) / 1.0;
25
-
26
- highp float gamma_scaled = gamma * v_gamma_scale;
27
-
28
- highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);
29
-
30
- gl_FragColor = mix(vec4(v_color.rgb, v_color.a * u_opacity), vec4(u_stroke_color.rgb, u_stroke_color.a * u_opacity), smoothstep(0., 0.5, 1. - dist));
31
- gl_FragColor.a= gl_FragColor.a * alpha;
32
- gl_FragColor = filterColor(gl_FragColor);
33
- }
@@ -1,31 +0,0 @@
1
- #define SDF_PX 8.0
2
- #define EDGE_GAMMA 0.105
3
- #define FONT_SIZE 48.0
4
- uniform sampler2D u_sdf_map;
5
- uniform float u_gamma_scale : 0.5;
6
-
7
- uniform float u_opacity : 1.0;
8
- uniform vec4 u_stroke_color : [0, 0, 0, 1];
9
- uniform float u_stroke_width : 2.0;
10
- uniform float u_halo_blur : 0.5;
11
- uniform float u_DevicePixelRatio;
12
-
13
- varying vec2 v_uv;
14
- varying float v_gamma_scale;
15
- varying float v_fontScale;
16
- uniform vec4 u_color;
17
-
18
- void main() {
19
- // get sdf from atlas
20
- float dist = texture2D(u_sdf_map, v_uv).a;
21
-
22
- lowp float buff = (6.0 - u_stroke_width / v_fontScale) / SDF_PX;
23
- highp float gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (v_fontScale * u_gamma_scale) / 1.0;
24
-
25
- highp float gamma_scaled = gamma * v_gamma_scale;
26
-
27
- highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);
28
-
29
- gl_FragColor = mix(vec4(u_color.rgb, u_color.a * u_opacity), vec4(u_stroke_color.rgb, u_stroke_color.a * u_opacity), smoothstep(0., 0.5, 1. - dist));
30
- gl_FragColor.a= gl_FragColor.a * alpha;
31
- }
@@ -1,38 +0,0 @@
1
- #define FONT_SIZE 24.0
2
- attribute vec3 a_Position;
3
- attribute vec2 a_tex;
4
- attribute vec2 a_textOffsets;
5
-
6
- uniform vec2 u_sdf_map_size;
7
- uniform mat4 u_ModelMatrix;
8
- uniform mat4 u_Mvp;
9
-
10
- uniform float u_size;
11
-
12
- varying vec2 v_uv;
13
- varying float v_gamma_scale;
14
- varying float v_fontScale;
15
-
16
- #pragma include "projection"
17
-
18
- void main() {
19
- v_uv = a_tex / u_sdf_map_size;
20
-
21
- // 文本缩放比例
22
- float fontScale = u_size / FONT_SIZE;
23
- v_fontScale = fontScale;
24
-
25
- vec4 project_pos = project_position(vec4(a_Position, 1.0));
26
-
27
- vec4 projected_position;
28
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
29
- projected_position = u_Mvp * (vec4(a_Position.xyz, 1.0));
30
- } else { // else
31
- projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
32
- }
33
-
34
- gl_Position = vec4(
35
- projected_position.xy / projected_position.w + a_textOffsets * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);
36
- v_gamma_scale = gl_Position.w;
37
-
38
- }
@@ -1,48 +0,0 @@
1
- #define SDF_PX 8.0
2
- #define EDGE_GAMMA 0.105
3
- #define FONT_SIZE 24.0
4
- attribute vec3 a_Position;
5
- attribute vec2 a_tex;
6
- attribute vec2 a_textOffsets;
7
- attribute vec4 a_Color;
8
- attribute float a_Size;
9
-
10
- uniform vec2 u_sdf_map_size;
11
- uniform mat4 u_ModelMatrix;
12
- uniform mat4 u_Mvp;
13
-
14
- varying vec2 v_uv;
15
- varying float v_gamma_scale;
16
- varying vec4 v_color;
17
- varying float v_fontScale;
18
-
19
- uniform float u_opacity : 1;
20
- uniform float u_stroke_width : 2;
21
- uniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];
22
-
23
- #pragma include "projection"
24
- #pragma include "picking"
25
-
26
- void main() {
27
- v_color = a_Color;
28
- v_uv = a_tex / u_sdf_map_size;
29
-
30
- // 文本缩放比例
31
- float fontScale = a_Size / FONT_SIZE;
32
- v_fontScale = fontScale;
33
-
34
- vec4 project_pos = project_position(vec4(a_Position, 1.0));
35
-
36
- vec4 projected_position;
37
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
38
- projected_position = u_Mvp * (vec4(a_Position.xyz, 1.0));
39
- } else { // else
40
- projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
41
- }
42
-
43
- gl_Position = vec4(
44
- projected_position.xy / projected_position.w + a_textOffsets * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);
45
- v_gamma_scale = gl_Position.w;
46
- setPickingColor(a_PickingColor);
47
-
48
- }
@@ -1,156 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
-
14
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
-
16
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
-
18
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
24
- var _l7Utils = require("@antv/l7-utils");
25
-
26
- var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
27
-
28
- var _triangulation = require("../../core/triangulation");
29
-
30
- 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); }; }
31
-
32
- 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; } }
33
-
34
- /* babel-plugin-inline-import '../../shader/minify_picking_frag.glsl' */
35
- var polygon_tile_frag = "uniform float u_opacity : 1.0;\nvarying vec4 v_color;\n\n#pragma include \"picking\"\n\nvoid main() {\n gl_FragColor = v_color;\n gl_FragColor.a *= u_opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
36
-
37
- /* babel-plugin-inline-import '../shaders/tile/polygon_tile_vert.glsl' */
38
- var polygon_tile_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n// uniform vec2 u_tileOrigin;\n// uniform float u_coord;\n\nvarying vec4 v_color;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n v_color = a_Color;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n // if(u_coord > 0.0) {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n // } else {\n // vec4 world = vec4(project_mvt_offset_position(vec4(u_tileOrigin, 0.0, 1.0)).xyz, 1.0); // \u74E6\u7247\u8D77\u59CB\u70B9\u7684\u4E16\u754C\u5750\u6807\n\n // vec2 pointOffset = a_Position.xy * pow(2.0, u_Zoom); // \u74E6\u7247\u5185\u7684\u70B9\u7684\u504F\u79FB\u5750\u6807\n \n // world.xy += pointOffset;\n\n // if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // // Needs to be divided with project_uCommonUnitsPerMeter\n // world.w *= u_PixelsPerMeter.z;\n // }\n\n // gl_Position = u_ViewProjectionMatrix * world + u_ViewportCenterProjection;\n // }\n\n setPickingColor(a_PickingColor);\n}\n\n";
39
-
40
- /* babel-plugin-inline-import '../../shader/minify_frag.glsl' */
41
- var polygon_tile_map_frag = "uniform float u_opacity : 1.0;\nuniform vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n gl_FragColor.a *= u_opacity;\n}\n";
42
-
43
- /* babel-plugin-inline-import '../shaders/tile/polygon_tile_map_vert.glsl' */
44
- var polygon_tile_map_vert = "attribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n#pragma include \"projection\"\n\nvoid main() {\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n}";
45
-
46
- var FillModel = /*#__PURE__*/function (_BaseModel) {
47
- (0, _inherits2.default)(FillModel, _BaseModel);
48
-
49
- var _super = _createSuper(FillModel);
50
-
51
- function FillModel() {
52
- (0, _classCallCheck2.default)(this, FillModel);
53
- return _super.apply(this, arguments);
54
- }
55
-
56
- (0, _createClass2.default)(FillModel, [{
57
- key: "getUninforms",
58
- value: function getUninforms() {
59
- var _ref = this.layer.getLayerConfig(),
60
- _ref$opacity = _ref.opacity,
61
- opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
62
- usage = _ref.usage,
63
- _ref$color = _ref.color,
64
- color = _ref$color === void 0 ? '#fff' : _ref$color;
65
-
66
- return {
67
- // u_tileOrigin: tileOrigin || [0, 0],
68
- // u_coord: coord === 'lnglat' ? 1.0 : 0.0,
69
- u_opacity: opacity,
70
- u_color: usage === 'basemap' ? (0, _l7Utils.rgb2arr)(color) : [0, 0, 0, 0]
71
- };
72
- }
73
- }, {
74
- key: "initModels",
75
- value: function () {
76
- var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
77
- return _regenerator.default.wrap(function _callee$(_context) {
78
- while (1) {
79
- switch (_context.prev = _context.next) {
80
- case 0:
81
- _context.next = 2;
82
- return this.buildModels();
83
-
84
- case 2:
85
- return _context.abrupt("return", _context.sent);
86
-
87
- case 3:
88
- case "end":
89
- return _context.stop();
90
- }
91
- }
92
- }, _callee, this);
93
- }));
94
-
95
- function initModels() {
96
- return _initModels.apply(this, arguments);
97
- }
98
-
99
- return initModels;
100
- }()
101
- }, {
102
- key: "buildModels",
103
- value: function () {
104
- var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
105
- var _ref2, _ref2$mask, mask, _ref2$maskInside, maskInside, usage, model;
106
-
107
- return _regenerator.default.wrap(function _callee2$(_context2) {
108
- while (1) {
109
- switch (_context2.prev = _context2.next) {
110
- case 0:
111
- _ref2 = this.layer.getLayerConfig(), _ref2$mask = _ref2.mask, mask = _ref2$mask === void 0 ? false : _ref2$mask, _ref2$maskInside = _ref2.maskInside, maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside, usage = _ref2.usage;
112
- this.layer.triangulation = _triangulation.polygonTriangulation;
113
- _context2.next = 4;
114
- return this.layer.buildLayerModel({
115
- moduleName: 'polygonTile_' + usage,
116
- vertexShader: usage === 'basemap' ? polygon_tile_map_vert : polygon_tile_vert,
117
- fragmentShader: usage === 'basemap' ? polygon_tile_map_frag : polygon_tile_frag,
118
- triangulation: _triangulation.polygonTriangulation,
119
- depth: {
120
- enable: false
121
- },
122
- blend: this.getBlend(),
123
- stencil: (0, _l7Utils.getMask)(mask, maskInside),
124
- pick: usage !== 'basemap'
125
- });
126
-
127
- case 4:
128
- model = _context2.sent;
129
- return _context2.abrupt("return", [model]);
130
-
131
- case 6:
132
- case "end":
133
- return _context2.stop();
134
- }
135
- }
136
- }, _callee2, this);
137
- }));
138
-
139
- function buildModels() {
140
- return _buildModels.apply(this, arguments);
141
- }
142
-
143
- return buildModels;
144
- }()
145
- }, {
146
- key: "clearModels",
147
- value: function clearModels() {}
148
- }, {
149
- key: "registerBuiltinAttributes",
150
- value: function registerBuiltinAttributes() {//
151
- }
152
- }]);
153
- return FillModel;
154
- }(_BaseModel2.default);
155
-
156
- exports.default = FillModel;
@@ -1,16 +0,0 @@
1
- attribute vec3 a_Position;
2
-
3
- uniform mat4 u_ModelMatrix;
4
- uniform mat4 u_Mvp;
5
-
6
- #pragma include "projection"
7
-
8
- void main() {
9
- vec4 project_pos = project_position(vec4(a_Position, 1.0));
10
-
11
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
12
- gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));
13
- } else {
14
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
15
- }
16
- }
@@ -1,42 +0,0 @@
1
- attribute vec4 a_Color;
2
- attribute vec3 a_Position;
3
-
4
- uniform mat4 u_ModelMatrix;
5
- uniform mat4 u_Mvp;
6
-
7
- // uniform vec2 u_tileOrigin;
8
- // uniform float u_coord;
9
-
10
- varying vec4 v_color;
11
-
12
- #pragma include "projection"
13
- #pragma include "picking"
14
-
15
- void main() {
16
- v_color = a_Color;
17
- vec4 project_pos = project_position(vec4(a_Position, 1.0));
18
-
19
- // if(u_coord > 0.0) {
20
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
21
- gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));
22
- } else {
23
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
24
- }
25
- // } else {
26
- // vec4 world = vec4(project_mvt_offset_position(vec4(u_tileOrigin, 0.0, 1.0)).xyz, 1.0); // 瓦片起始点的世界坐标
27
-
28
- // vec2 pointOffset = a_Position.xy * pow(2.0, u_Zoom); // 瓦片内的点的偏移坐标
29
-
30
- // world.xy += pointOffset;
31
-
32
- // if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
33
- // // Needs to be divided with project_uCommonUnitsPerMeter
34
- // world.w *= u_PixelsPerMeter.z;
35
- // }
36
-
37
- // gl_Position = u_ViewProjectionMatrix * world + u_ViewportCenterProjection;
38
- // }
39
-
40
- setPickingColor(a_PickingColor);
41
- }
42
-
@@ -1,196 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
-
14
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
-
16
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
-
18
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
24
- var _l7Core = require("@antv/l7-core");
25
-
26
- var _l7Utils = require("@antv/l7-utils");
27
-
28
- var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
29
-
30
- var _triangulation = require("../../core/triangulation");
31
-
32
- 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); }; }
33
-
34
- 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; } }
35
-
36
- /* babel-plugin-inline-import '../shaders/raster_2d_frag.glsl' */
37
- 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 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);\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 gl_FragColor = color;\n gl_FragColor.a = gl_FragColor.a * u_opacity ;\n }\n}\n";
38
-
39
- /* babel-plugin-inline-import '../shaders/raster_2d_vert.glsl' */
40
- var rasterVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\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 if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy,0., 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n }\n}\n";
41
-
42
- var RasterModel = /*#__PURE__*/function (_BaseModel) {
43
- (0, _inherits2.default)(RasterModel, _BaseModel);
44
-
45
- var _super = _createSuper(RasterModel);
46
-
47
- function RasterModel() {
48
- (0, _classCallCheck2.default)(this, RasterModel);
49
- return _super.apply(this, arguments);
50
- }
51
-
52
- (0, _createClass2.default)(RasterModel, [{
53
- key: "getUninforms",
54
- value: function getUninforms() {
55
- var createTexture2D = this.rendererService.createTexture2D;
56
-
57
- var _ref = this.layer.getLayerConfig(),
58
- _ref$colorTexture = _ref.colorTexture,
59
- colorTexture = _ref$colorTexture === void 0 ? createTexture2D({
60
- data: [],
61
- width: 0,
62
- height: 0,
63
- flipY: false
64
- }) : _ref$colorTexture,
65
- _ref$opacity = _ref.opacity,
66
- opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
67
- _ref$clampLow = _ref.clampLow,
68
- clampLow = _ref$clampLow === void 0 ? true : _ref$clampLow,
69
- _ref$clampHigh = _ref.clampHigh,
70
- clampHigh = _ref$clampHigh === void 0 ? true : _ref$clampHigh,
71
- _ref$noDataValue = _ref.noDataValue,
72
- noDataValue = _ref$noDataValue === void 0 ? -9999999 : _ref$noDataValue,
73
- _ref$domain = _ref.domain,
74
- domain = _ref$domain === void 0 ? [0, 1] : _ref$domain;
75
-
76
- return {
77
- u_opacity: opacity || 1,
78
- u_texture: this.texture,
79
- u_domain: domain,
80
- u_clampLow: clampLow,
81
- u_clampHigh: typeof clampHigh !== 'undefined' ? clampHigh : clampLow,
82
- u_noDataValue: noDataValue,
83
- u_colorTexture: colorTexture
84
- };
85
- }
86
- }, {
87
- key: "initModels",
88
- value: function () {
89
- var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
90
- var _ref2, _ref2$mask, mask, _ref2$maskInside, maskInside, source, createTexture2D, parserDataItem, model;
91
-
92
- return _regenerator.default.wrap(function _callee$(_context) {
93
- while (1) {
94
- switch (_context.prev = _context.next) {
95
- case 0:
96
- _ref2 = this.layer.getLayerConfig(), _ref2$mask = _ref2.mask, mask = _ref2$mask === void 0 ? false : _ref2$mask, _ref2$maskInside = _ref2.maskInside, maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside;
97
- source = this.layer.getSource();
98
- createTexture2D = this.rendererService.createTexture2D;
99
- parserDataItem = source.data.dataArray[0];
100
- this.texture = createTexture2D({
101
- data: parserDataItem.data,
102
- width: parserDataItem.width,
103
- height: parserDataItem.height,
104
- format: _l7Core.gl.LUMINANCE,
105
- type: _l7Core.gl.FLOAT
106
- });
107
- _context.next = 7;
108
- return this.layer.buildLayerModel({
109
- moduleName: 'rasterTileImageData',
110
- vertexShader: rasterVert,
111
- fragmentShader: rasterFrag,
112
- triangulation: _triangulation.RasterImageTriangulation,
113
- depth: {
114
- enable: false
115
- },
116
- stencil: (0, _l7Utils.getMask)(mask, maskInside)
117
- });
118
-
119
- case 7:
120
- model = _context.sent;
121
- return _context.abrupt("return", [model]);
122
-
123
- case 9:
124
- case "end":
125
- return _context.stop();
126
- }
127
- }
128
- }, _callee, this);
129
- }));
130
-
131
- function initModels() {
132
- return _initModels.apply(this, arguments);
133
- }
134
-
135
- return initModels;
136
- }()
137
- }, {
138
- key: "buildModels",
139
- value: function () {
140
- var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
141
- return _regenerator.default.wrap(function _callee2$(_context2) {
142
- while (1) {
143
- switch (_context2.prev = _context2.next) {
144
- case 0:
145
- _context2.next = 2;
146
- return this.initModels();
147
-
148
- case 2:
149
- return _context2.abrupt("return", _context2.sent);
150
-
151
- case 3:
152
- case "end":
153
- return _context2.stop();
154
- }
155
- }
156
- }, _callee2, this);
157
- }));
158
-
159
- function buildModels() {
160
- return _buildModels.apply(this, arguments);
161
- }
162
-
163
- return buildModels;
164
- }()
165
- }, {
166
- key: "clearModels",
167
- value: function clearModels() {
168
- var _this$texture;
169
-
170
- (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
171
- }
172
- }, {
173
- key: "registerBuiltinAttributes",
174
- value: function registerBuiltinAttributes() {
175
- this.styleAttributeService.registerStyleAttribute({
176
- name: 'uv',
177
- type: _l7Core.AttributeType.Attribute,
178
- descriptor: {
179
- name: 'a_Uv',
180
- buffer: {
181
- usage: _l7Core.gl.DYNAMIC_DRAW,
182
- data: [],
183
- type: _l7Core.gl.FLOAT
184
- },
185
- size: 2,
186
- update: function update(feature, featureIdx, vertex) {
187
- return [vertex[3], vertex[4]];
188
- }
189
- }
190
- });
191
- }
192
- }]);
193
- return RasterModel;
194
- }(_BaseModel2.default);
195
-
196
- exports.default = RasterModel;