@antv/l7-layers 2.9.25-alpha.0 → 2.9.26-alpha.1

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 (126) hide show
  1. package/es/heatmap/models/heatmap.js +1 -1
  2. package/es/tile/tileFactory/base.d.ts +1 -1
  3. package/es/tile/utils.js +1 -1
  4. package/lib/Geometry/index.js +114 -77
  5. package/lib/Geometry/models/billboard.js +232 -181
  6. package/lib/Geometry/models/index.js +18 -34
  7. package/lib/Geometry/models/plane.js +407 -278
  8. package/lib/Geometry/models/sprite.js +291 -189
  9. package/lib/canvas/index.js +101 -66
  10. package/lib/canvas/models/canvas.js +207 -140
  11. package/lib/canvas/models/index.js +12 -30
  12. package/lib/citybuliding/building.js +98 -63
  13. package/lib/citybuliding/models/build.js +192 -146
  14. package/lib/core/BaseLayer.js +1331 -814
  15. package/lib/core/BaseModel.js +457 -279
  16. package/lib/core/interface.js +40 -53
  17. package/lib/core/schema.js +21 -39
  18. package/lib/core/shape/Path.js +67 -79
  19. package/lib/core/shape/extrude.js +132 -91
  20. package/lib/core/triangulation.js +378 -196
  21. package/lib/earth/index.js +100 -62
  22. package/lib/earth/models/atmosphere.js +146 -112
  23. package/lib/earth/models/base.js +210 -150
  24. package/lib/earth/models/bloomsphere.js +146 -112
  25. package/lib/earth/utils.js +111 -91
  26. package/lib/heatmap/index.js +149 -92
  27. package/lib/heatmap/models/grid.js +118 -91
  28. package/lib/heatmap/models/grid3d.js +155 -123
  29. package/lib/heatmap/models/heatmap.js +475 -338
  30. package/lib/heatmap/models/hexagon.js +121 -92
  31. package/lib/heatmap/models/index.js +22 -37
  32. package/lib/heatmap/triangulation.js +31 -47
  33. package/lib/image/index.js +111 -74
  34. package/lib/image/models/dataImage.js +232 -174
  35. package/lib/image/models/image.js +175 -128
  36. package/lib/image/models/index.js +15 -32
  37. package/lib/index.js +263 -97
  38. package/lib/line/index.js +131 -85
  39. package/lib/line/models/arc.js +352 -237
  40. package/lib/line/models/arc_3d.js +334 -228
  41. package/lib/line/models/earthArc_3d.js +336 -228
  42. package/lib/line/models/great_circle.js +291 -200
  43. package/lib/line/models/half.js +286 -201
  44. package/lib/line/models/index.js +42 -50
  45. package/lib/line/models/line.js +428 -299
  46. package/lib/line/models/linearline.js +277 -203
  47. package/lib/line/models/simpleLine.js +239 -175
  48. package/lib/line/models/tile.js +348 -237
  49. package/lib/line/models/wall.js +327 -235
  50. package/lib/mask/index.js +92 -59
  51. package/lib/mask/models/fill.js +134 -82
  52. package/lib/mask/models/index.js +12 -30
  53. package/lib/plugins/DataMappingPlugin.js +342 -224
  54. package/lib/plugins/DataSourcePlugin.js +102 -87
  55. package/lib/plugins/FeatureScalePlugin.js +330 -240
  56. package/lib/plugins/LayerAnimateStylePlugin.js +61 -55
  57. package/lib/plugins/LayerModelPlugin.js +80 -73
  58. package/lib/plugins/LayerStylePlugin.js +48 -51
  59. package/lib/plugins/LightingPlugin.js +80 -68
  60. package/lib/plugins/MultiPassRendererPlugin.js +91 -65
  61. package/lib/plugins/PixelPickingPlugin.js +150 -109
  62. package/lib/plugins/RegisterStyleAttributePlugin.js +110 -110
  63. package/lib/plugins/ShaderUniformPlugin.js +118 -99
  64. package/lib/plugins/UpdateModelPlugin.js +40 -47
  65. package/lib/plugins/UpdateStyleAttributePlugin.js +93 -75
  66. package/lib/point/index.js +226 -150
  67. package/lib/point/models/earthExtrude.js +279 -201
  68. package/lib/point/models/earthFill.js +287 -202
  69. package/lib/point/models/extrude.js +299 -203
  70. package/lib/point/models/fill.js +406 -275
  71. package/lib/point/models/fillmage.js +365 -256
  72. package/lib/point/models/image.js +241 -168
  73. package/lib/point/models/index.js +46 -52
  74. package/lib/point/models/normal.js +183 -134
  75. package/lib/point/models/radar.js +304 -211
  76. package/lib/point/models/simplePoint.js +194 -142
  77. package/lib/point/models/text.js +608 -385
  78. package/lib/point/models/tile.js +314 -223
  79. package/lib/point/shape/extrude.js +56 -52
  80. package/lib/polygon/index.js +154 -102
  81. package/lib/polygon/models/extrude.js +311 -223
  82. package/lib/polygon/models/fill.js +215 -153
  83. package/lib/polygon/models/index.js +46 -52
  84. package/lib/polygon/models/ocean.js +244 -173
  85. package/lib/polygon/models/tile.js +144 -100
  86. package/lib/polygon/models/water.js +222 -153
  87. package/lib/raster/buffers/triangulation.js +27 -40
  88. package/lib/raster/index.js +115 -75
  89. package/lib/raster/models/index.js +16 -33
  90. package/lib/raster/models/raster.js +178 -135
  91. package/lib/raster/raster.js +187 -132
  92. package/lib/tile/interface.js +4 -16
  93. package/lib/tile/manager/tileConfigManager.js +125 -86
  94. package/lib/tile/manager/tileLayerManager.js +313 -229
  95. package/lib/tile/manager/tilePickerManager.js +192 -123
  96. package/lib/tile/models/tileModel.js +71 -52
  97. package/lib/tile/tileFactory/base.js +432 -309
  98. package/lib/tile/tileFactory/index.js +51 -49
  99. package/lib/tile/tileFactory/line.js +65 -50
  100. package/lib/tile/tileFactory/point.js +65 -50
  101. package/lib/tile/tileFactory/polygon.js +65 -50
  102. package/lib/tile/tileFactory/raster.js +66 -54
  103. package/lib/tile/tileFactory/rasterData.js +88 -76
  104. package/lib/tile/tileFactory/rasterDataLayer.js +97 -62
  105. package/lib/tile/tileFactory/vectorLayer.js +168 -109
  106. package/lib/tile/tileLayer/baseTileLayer.js +420 -221
  107. package/lib/tile/tmsTileLayer.js +110 -67
  108. package/lib/tile/utils.js +110 -92
  109. package/lib/utils/blend.js +59 -79
  110. package/lib/utils/collision-index.js +107 -64
  111. package/lib/utils/dataMappingStyle.js +105 -60
  112. package/lib/utils/extrude_polyline.js +600 -398
  113. package/lib/utils/grid-index.js +163 -111
  114. package/lib/utils/layerData.js +130 -99
  115. package/lib/utils/multiPassRender.js +49 -41
  116. package/lib/utils/polylineNormal.js +148 -96
  117. package/lib/utils/simpleLine.js +100 -85
  118. package/lib/utils/symbol-layout.js +219 -116
  119. package/lib/utils/updateShape.js +15 -41
  120. package/lib/wind/index.js +109 -71
  121. package/lib/wind/models/index.js +12 -30
  122. package/lib/wind/models/utils.js +144 -105
  123. package/lib/wind/models/wind.js +333 -224
  124. package/lib/wind/models/windRender.js +329 -218
  125. package/lib/wind/models/windShader.js +23 -181
  126. package/package.json +6 -6
@@ -1,183 +1,25 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";
18
2
 
19
- // src/wind/models/windShader.ts
20
- var windShader_exports = {};
21
- __export(windShader_exports, {
22
- drawFrag: () => drawFrag,
23
- drawVert: () => drawVert,
24
- fullScreenFrag: () => fullScreenFrag,
25
- fullScreenVert: () => fullScreenVert,
26
- updateFrag: () => updateFrag,
27
- updateVert: () => updateVert
28
- });
29
- module.exports = __toCommonJS(windShader_exports);
30
- var drawVert = `
31
- precision mediump float;
32
-
33
- attribute float a_index;
34
-
35
- uniform sampler2D u_particles;
36
- uniform float u_particles_res;
37
-
38
- varying vec2 v_particle_pos;
39
-
40
- void main() {
41
- vec4 color = texture2D(u_particles, vec2(
42
- fract(a_index / u_particles_res),
43
- floor(a_index / u_particles_res) / u_particles_res)
44
- );
45
-
46
- // decode current particle position from the pixel's RGBA value
47
- v_particle_pos = vec2( color.r / 255.0 + color.b, color.g / 255.0 + color.a);
48
-
49
- gl_PointSize = 1.0;
50
- gl_Position = vec4(2.0 * v_particle_pos.x - 1.0, 1.0 - 2.0 * v_particle_pos.y, 0, 1);
51
- }`;
52
- var drawFrag = `
53
- precision mediump float;
54
-
55
- uniform sampler2D u_wind;
56
- uniform vec2 u_wind_min;
57
- uniform vec2 u_wind_max;
58
- uniform sampler2D u_color_ramp;
59
-
60
- varying vec2 v_particle_pos;
61
-
62
- void main() {
63
- vec2 velocity = mix(u_wind_min, u_wind_max, texture2D(u_wind, v_particle_pos).rg);
64
- float speed_t = length(velocity) / length(u_wind_max);
65
-
66
- // color ramp is encoded in a 16x16 texture
67
- vec2 ramp_pos = vec2( fract(16.0 * speed_t), floor(16.0 * speed_t) / 16.0);
68
-
69
- gl_FragColor = texture2D(u_color_ramp, ramp_pos);
70
- }`;
71
- var updateVert = `
72
- precision mediump float;
73
-
74
- attribute vec2 a_pos;
75
-
76
- varying vec2 v_tex_pos;
77
-
78
- void main() {
79
- v_tex_pos = a_pos;
80
- gl_Position = vec4(1.0 - 2.0 * a_pos, 0, 1);
81
- // framebuffer \u59CB\u7EC8\u7528\u94FA\u6EE1\u5C4F\u5E55\u7684 texture
82
- }`;
83
- var updateFrag = `
84
- precision highp float;
85
-
86
- uniform sampler2D u_particles;
87
- uniform sampler2D u_wind;
88
- uniform vec2 u_wind_res;
89
- uniform vec2 u_wind_min;
90
- uniform vec2 u_wind_max;
91
- uniform float u_rand_seed;
92
- uniform float u_speed_factor;
93
- uniform float u_drop_rate;
94
- uniform float u_drop_rate_bump;
95
-
96
- varying vec2 v_tex_pos;
97
-
98
- // pseudo-random generator
99
- const vec3 rand_constants = vec3(12.9898, 78.233, 4375.85453);
100
- float rand(const vec2 co) {
101
- float t = dot(rand_constants.xy, co);
102
- return fract(sin(t) * (rand_constants.z + t));
103
- }
104
-
105
- // wind speed lookup; use manual bilinear filtering based on 4 adjacent pixels for smooth interpolation
106
- vec2 lookup_wind(const vec2 uv) {
107
- // return texture2D(u_wind, uv).rg; // lower-res hardware filtering
108
- vec2 px = 1.0 / u_wind_res;
109
- vec2 vc = (floor(uv * u_wind_res)) * px;
110
- vec2 f = fract(uv * u_wind_res);
111
- vec2 tl = texture2D(u_wind, vc).rg;
112
- vec2 tr = texture2D(u_wind, vc + vec2(px.x, 0)).rg;
113
- vec2 bl = texture2D(u_wind, vc + vec2(0, px.y)).rg;
114
- vec2 br = texture2D(u_wind, vc + px).rg;
115
- return mix(mix(tl, tr, f.x), mix(bl, br, f.x), f.y);
116
- }
117
-
118
- void main() {
119
- vec4 color = texture2D(u_particles, v_tex_pos);
120
- vec2 pos = vec2(
121
- color.r / 255.0 + color.b,
122
- color.g / 255.0 + color.a); // decode particle position from pixel RGBA
123
- vec2 velocity = mix(u_wind_min, u_wind_max, lookup_wind(pos));
124
- float speed_t = length(velocity) / length(u_wind_max);
125
-
126
- // take EPSG:4236 distortion into account for calculating where the particle moved
127
- float distortion = cos(radians(pos.y * 180.0 - 90.0));
128
- vec2 offset = vec2(velocity.x / distortion, -velocity.y) * 0.0001 * u_speed_factor;
129
-
130
- // update particle position, wrapping around the date line
131
- pos = fract(1.0 + pos + offset);
132
-
133
- // a random seed to use for the particle drop
134
- vec2 seed = (pos + v_tex_pos) * u_rand_seed;
135
-
136
- // drop rate is a chance a particle will restart at random position, to avoid degeneration
137
- float drop_rate = u_drop_rate + speed_t * u_drop_rate_bump;
138
- float drop = step(1.0 - drop_rate, rand(seed));
139
-
140
- vec2 random_pos = vec2(
141
- rand(seed + 1.3),
142
- rand(seed + 2.1));
143
- pos = mix(pos, random_pos, drop);
144
-
145
- // encode the new particle position back into RGBA
146
- gl_FragColor = vec4(
147
- fract(pos * 255.0),
148
- floor(pos * 255.0) / 255.0);
149
- }`;
150
- var fullScreenVert = `
151
- precision mediump float;
152
-
153
- attribute vec2 a_pos;
154
-
155
- varying vec2 v_tex_pos;
156
-
157
- void main() {
158
- v_tex_pos = a_pos;
159
- gl_Position = vec4(1.0 - 2.0 * a_pos, 0.0, 1.0);
160
- gl_PointSize = 100.0;
161
- }`;
162
- var fullScreenFrag = `
163
- precision mediump float;
164
-
165
- uniform sampler2D u_screen;
166
- uniform float u_opacity;
167
- varying vec2 v_tex_pos;
168
-
169
- void main() {
170
- vec4 color = texture2D(u_screen, 1.0 - v_tex_pos);
171
-
172
- // a hack to guarantee opacity fade out even with a value close to 1.0
173
- gl_FragColor = vec4(floor(255.0 * color * u_opacity) / 255.0);
174
- }`;
175
- // Annotate the CommonJS export names for ESM import in node:
176
- 0 && (module.exports = {
177
- drawFrag,
178
- drawVert,
179
- fullScreenFrag,
180
- fullScreenVert,
181
- updateFrag,
182
- updateVert
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
183
5
  });
6
+ exports.updateVert = exports.updateFrag = exports.fullScreenVert = exports.fullScreenFrag = exports.drawVert = exports.drawFrag = void 0;
7
+
8
+ /**
9
+ * drawProgram drawVert drawFrag
10
+ * screenProgram screenVert screenFrag
11
+ * updateProgram updateVert updateFrag
12
+ * fullScreenProgram fullScreenVert fullScreenFrag
13
+ */
14
+ var drawVert = "\n precision mediump float;\n\n attribute float a_index;\n\n uniform sampler2D u_particles;\n uniform float u_particles_res;\n\n varying vec2 v_particle_pos;\n\n void main() {\n vec4 color = texture2D(u_particles, vec2(\n fract(a_index / u_particles_res),\n floor(a_index / u_particles_res) / u_particles_res)\n );\n\n // decode current particle position from the pixel's RGBA value\n v_particle_pos = vec2( color.r / 255.0 + color.b, color.g / 255.0 + color.a);\n\n gl_PointSize = 1.0;\n gl_Position = vec4(2.0 * v_particle_pos.x - 1.0, 1.0 - 2.0 * v_particle_pos.y, 0, 1);\n }";
15
+ exports.drawVert = drawVert;
16
+ var drawFrag = "\n precision mediump float;\n\n uniform sampler2D u_wind;\n uniform vec2 u_wind_min;\n uniform vec2 u_wind_max;\n uniform sampler2D u_color_ramp;\n\n varying vec2 v_particle_pos;\n\n void main() {\n vec2 velocity = mix(u_wind_min, u_wind_max, texture2D(u_wind, v_particle_pos).rg);\n float speed_t = length(velocity) / length(u_wind_max);\n\n // color ramp is encoded in a 16x16 texture\n vec2 ramp_pos = vec2( fract(16.0 * speed_t), floor(16.0 * speed_t) / 16.0);\n\n gl_FragColor = texture2D(u_color_ramp, ramp_pos);\n }";
17
+ exports.drawFrag = drawFrag;
18
+ var updateVert = "\n precision mediump float;\n\n attribute vec2 a_pos;\n\n varying vec2 v_tex_pos;\n\n void main() {\n v_tex_pos = a_pos;\n gl_Position = vec4(1.0 - 2.0 * a_pos, 0, 1);\n // framebuffer \u59CB\u7EC8\u7528\u94FA\u6EE1\u5C4F\u5E55\u7684 texture\n }";
19
+ exports.updateVert = updateVert;
20
+ var updateFrag = "\n precision highp float;\n\n uniform sampler2D u_particles;\n uniform sampler2D u_wind;\n uniform vec2 u_wind_res;\n uniform vec2 u_wind_min;\n uniform vec2 u_wind_max;\n uniform float u_rand_seed;\n uniform float u_speed_factor;\n uniform float u_drop_rate;\n uniform float u_drop_rate_bump;\n\n varying vec2 v_tex_pos;\n\n // pseudo-random generator\n const vec3 rand_constants = vec3(12.9898, 78.233, 4375.85453);\n float rand(const vec2 co) {\n float t = dot(rand_constants.xy, co);\n return fract(sin(t) * (rand_constants.z + t));\n }\n\n // wind speed lookup; use manual bilinear filtering based on 4 adjacent pixels for smooth interpolation\n vec2 lookup_wind(const vec2 uv) {\n // return texture2D(u_wind, uv).rg; // lower-res hardware filtering\n vec2 px = 1.0 / u_wind_res;\n vec2 vc = (floor(uv * u_wind_res)) * px;\n vec2 f = fract(uv * u_wind_res);\n vec2 tl = texture2D(u_wind, vc).rg;\n vec2 tr = texture2D(u_wind, vc + vec2(px.x, 0)).rg;\n vec2 bl = texture2D(u_wind, vc + vec2(0, px.y)).rg;\n vec2 br = texture2D(u_wind, vc + px).rg;\n return mix(mix(tl, tr, f.x), mix(bl, br, f.x), f.y);\n }\n\n void main() {\n vec4 color = texture2D(u_particles, v_tex_pos);\n vec2 pos = vec2(\n color.r / 255.0 + color.b,\n color.g / 255.0 + color.a); // decode particle position from pixel RGBA\n vec2 velocity = mix(u_wind_min, u_wind_max, lookup_wind(pos));\n float speed_t = length(velocity) / length(u_wind_max);\n\n // take EPSG:4236 distortion into account for calculating where the particle moved\n float distortion = cos(radians(pos.y * 180.0 - 90.0));\n vec2 offset = vec2(velocity.x / distortion, -velocity.y) * 0.0001 * u_speed_factor;\n\n // update particle position, wrapping around the date line\n pos = fract(1.0 + pos + offset);\n\n // a random seed to use for the particle drop\n vec2 seed = (pos + v_tex_pos) * u_rand_seed;\n\n // drop rate is a chance a particle will restart at random position, to avoid degeneration\n float drop_rate = u_drop_rate + speed_t * u_drop_rate_bump;\n float drop = step(1.0 - drop_rate, rand(seed));\n\n vec2 random_pos = vec2(\n rand(seed + 1.3),\n rand(seed + 2.1));\n pos = mix(pos, random_pos, drop);\n\n // encode the new particle position back into RGBA\n gl_FragColor = vec4(\n fract(pos * 255.0),\n floor(pos * 255.0) / 255.0);\n }";
21
+ exports.updateFrag = updateFrag;
22
+ var fullScreenVert = "\n precision mediump float;\n\n attribute vec2 a_pos;\n\n varying vec2 v_tex_pos;\n\n void main() {\n v_tex_pos = a_pos;\n gl_Position = vec4(1.0 - 2.0 * a_pos, 0.0, 1.0);\n gl_PointSize = 100.0;\n }";
23
+ exports.fullScreenVert = fullScreenVert;
24
+ var fullScreenFrag = "\n precision mediump float;\n\n uniform sampler2D u_screen;\n uniform float u_opacity;\n varying vec2 v_tex_pos;\n\n void main() {\n vec4 color = texture2D(u_screen, 1.0 - v_tex_pos);\n\n // a hack to guarantee opacity fade out even with a value close to 1.0\n gl_FragColor = vec4(floor(255.0 * color * u_opacity) / 255.0);\n }";
25
+ exports.fullScreenFrag = fullScreenFrag;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-layers",
3
- "version": "2.9.25-alpha.0",
3
+ "version": "2.9.26-alpha.1",
4
4
  "description": "L7's collection of built-in layers",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -27,10 +27,10 @@
27
27
  "license": "ISC",
28
28
  "dependencies": {
29
29
  "@antv/async-hook": "^2.1.0",
30
- "@antv/l7-core": "2.9.25-alpha.0",
31
- "@antv/l7-maps": "2.9.25-alpha.0",
32
- "@antv/l7-source": "2.9.25-alpha.0",
33
- "@antv/l7-utils": "2.9.25-alpha.0",
30
+ "@antv/l7-core": "2.9.26-alpha.1",
31
+ "@antv/l7-maps": "2.9.26-alpha.1",
32
+ "@antv/l7-source": "2.9.26-alpha.1",
33
+ "@antv/l7-utils": "2.9.26-alpha.1",
34
34
  "@babel/runtime": "^7.7.7",
35
35
  "@mapbox/martini": "^0.2.0",
36
36
  "@turf/helpers": "^6.1.4",
@@ -61,7 +61,7 @@
61
61
  "@types/gl-matrix": "^2.4.5",
62
62
  "@types/lodash": "^4.14.138"
63
63
  },
64
- "gitHead": "5216ad73535dbd3c4188dd9717952db3dfcb4f71",
64
+ "gitHead": "67d87ef5bb69514814e447773c55afe328e7e713",
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  }