@antv/l7-layers 2.21.3 → 2.21.4-beta.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 (55) hide show
  1. package/README.md +7 -5
  2. package/es/citybuliding/models/build.js +1 -1
  3. package/es/core/CommonStyleAttribute.js +1 -1
  4. package/es/core/shape/arrow.js +2 -2
  5. package/es/core/triangulation.js +1 -1
  6. package/es/earth/models/atmosphere.js +1 -1
  7. package/es/earth/models/base.js +1 -1
  8. package/es/earth/models/bloomsphere.js +1 -1
  9. package/es/geometry/models/billboard.js +1 -1
  10. package/es/geometry/models/plane.js +1 -1
  11. package/es/heatmap/index.js +1 -1
  12. package/es/line/models/flow.js +1 -1
  13. package/es/line/models/great_circle.js +1 -1
  14. package/es/line/models/simple_line.js +1 -1
  15. package/es/plugins/index.d.ts +1 -1
  16. package/es/point/models/earthExtrude.js +1 -1
  17. package/es/point/models/fill.js +1 -1
  18. package/es/point/models/radar.js +1 -1
  19. package/es/point/models/text.js +1 -1
  20. package/es/polygon/models/extrusion.js +1 -1
  21. package/es/polygon/models/fill.js +2 -2
  22. package/es/polygon/models/ocean.js +1 -1
  23. package/es/raster/index.js +1 -1
  24. package/es/raster/models/rasterTerrainRgb.js +1 -1
  25. package/es/tile/core/BaseLayer.d.ts +1 -2
  26. package/es/tile/service/TileLayerService.d.ts +1 -1
  27. package/es/tile/service/TilePickService.d.ts +1 -1
  28. package/es/tile/tile/Tile.d.ts +1 -1
  29. package/es/tile/tile/index.d.ts +1 -1
  30. package/es/tile/tile/util.d.ts +1 -1
  31. package/lib/citybuliding/models/build.js +1 -1
  32. package/lib/core/CommonStyleAttribute.js +1 -1
  33. package/lib/core/shape/arrow.js +2 -2
  34. package/lib/earth/models/atmosphere.js +1 -1
  35. package/lib/earth/models/bloomsphere.js +1 -1
  36. package/lib/heatmap/index.js +1 -1
  37. package/lib/line/models/great_circle.js +1 -1
  38. package/lib/line/models/simple_line.js +1 -1
  39. package/lib/plugins/index.d.ts +1 -1
  40. package/lib/point/models/earthExtrude.js +1 -1
  41. package/lib/point/models/fill.js +1 -1
  42. package/lib/point/models/text.js +1 -1
  43. package/lib/polygon/models/extrusion.js +1 -1
  44. package/lib/polygon/models/fill.js +1 -1
  45. package/lib/polygon/models/ocean.js +1 -1
  46. package/lib/raster/index.js +1 -1
  47. package/lib/raster/models/rasterTerrainRgb.js +1 -1
  48. package/lib/tile/core/BaseLayer.d.ts +1 -2
  49. package/lib/tile/service/TileLayerService.d.ts +1 -1
  50. package/lib/tile/service/TilePickService.d.ts +1 -1
  51. package/lib/tile/tile/Tile.d.ts +1 -1
  52. package/lib/tile/tile/index.d.ts +1 -1
  53. package/lib/tile/tile/util.d.ts +1 -1
  54. package/package.json +21 -20
  55. package/CHANGELOG.md +0 -492
@@ -9,8 +9,8 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
9
9
  var _l7Core = require("@antv/l7-core");
10
10
  var _l7Utils = require("@antv/l7-utils");
11
11
  var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
12
- var _triangulation = require("../../core/triangulation");
13
12
  var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
13
+ var _triangulation = require("../../core/triangulation");
14
14
  /* babel-plugin-inline-import '../shaders/bloomshpere/bloomsphere_frag.glsl' */
15
15
  const bloomSphereFrag = "\nin vec3 vVertexNormal;\nin vec4 v_Color;\n\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n};\nout vec4 outputColor;\n#pragma include \"scene_uniforms\"\nvoid main() {\n float intensity = - dot(normalize(vVertexNormal), normalize(u_CameraPosition));\n // \u53BB\u9664\u80CC\u9762\n if(intensity > 1.0) intensity = 0.0;\n\n outputColor = vec4(v_Color.rgb, v_Color.a * intensity * u_opacity);\n}\n";
16
16
  /* babel-plugin-inline-import '../shaders/bloomshpere/bloomsphere_vert.glsl' */
@@ -8,8 +8,8 @@ exports.default = void 0;
8
8
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _BaseLayer = _interopRequireDefault(require("../core/BaseLayer"));
11
- var _models = _interopRequireDefault(require("./models"));
12
11
  var _rampcolor_legend = require("../utils/rampcolor_legend");
12
+ var _models = _interopRequireDefault(require("./models"));
13
13
  class HeatMapLayer extends _BaseLayer.default {
14
14
  constructor(...args) {
15
15
  super(...args);
@@ -10,8 +10,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
10
10
  var _l7Core = require("@antv/l7-core");
11
11
  var _l7Utils = require("@antv/l7-utils");
12
12
  var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
13
- var _triangulation = require("../../core/triangulation");
14
13
  var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
14
+ var _triangulation = require("../../core/triangulation");
15
15
  /* babel-plugin-inline-import '../shaders/greatCircle/line_arc_great_circle_frag.glsl' */
16
16
  const line_arc_frag = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n#define LineTexture 1.0\n\nuniform sampler2D u_texture;\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array: [10.0, 5., 0, 0];\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float segmentNumber;\n float u_line_type: 0.0;\n float u_icon_step: 100;\n float u_line_texture: 0.0;\n float u_textureBlend;\n float u_time;\n float u_linearColor: 0;\n};\n\nin vec4 v_line_data;\nin vec2 v_iconMapUV;\nin vec4 v_dash_array;\nin float v_distance_ratio;\nin vec4 v_color;\n\nout vec4 outputColor;\n#pragma include \"picking\"\n#pragma include \"project\"\n#pragma include \"projection\"\n\nvoid main() {\n\n float animateSpeed = 0.0;\n float d_segmentIndex = v_line_data.g;\n \n // \u8BBE\u7F6E\u5F27\u7EBF\u7684\u5E95\u8272\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n outputColor = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);\n outputColor.a *= v_color.a;\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n outputColor = v_color;\n }\n\n // float blur = 1.- smoothstep(u_blur, 1., length(v_normal.xy));\n // float blur = smoothstep(1.0, u_blur, length(v_normal.xy));\n if(u_line_type == LineTypeDash) {\n float dashLength = mod(v_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) {\n // \u5B9E\u7EBF\u90E8\u5206\n } else {\n // \u865A\u7EBF\u90E8\u5206\n discard;\n };\n }\n\n // \u8BBE\u7F6E\u5F27\u7EBF\u7684\u52A8\u753B\u6A21\u5F0F\n if(u_animate.x == Animate) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- v_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n alpha = smoothstep(0., 1., alpha);\n outputColor.a *= alpha;\n }\n\n // \u8BBE\u7F6E\u5F27\u7EBF\u7684\u8D34\u56FE\n if(LineTexture == u_line_texture && u_line_type != LineTypeDash) { \n float arcRadio = smoothstep( 0.0, 1.0, (d_segmentIndex / (segmentNumber - 1.0)));\n // float arcRadio = d_segmentIndex / (segmentNumber - 1.0);\n float count = v_line_data.b; // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n float u = fract(arcRadio * count - animateSpeed * count);\n // float u = fract(arcRadio * count - animateSpeed);\n if(u_animate.x == Animate) {\n u = outputColor.a/v_color.a;\n }\n\n float v = v_line_data.a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture(SAMPLER_2D(u_texture), uv);\n \n // \u8BBE\u7F6E\u8D34\u56FE\u548C\u5E95\u8272\u7684\u53E0\u52A0\u6A21\u5F0F\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n outputColor = filterColor(outputColor + pattern);\n } else { // replace\n pattern.a *= v_color.a;\n if(outputColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n outputColor = filterColor(pattern);\n }\n } else {\n outputColor = filterColor(outputColor);\n }\n\n // gl_FragColor = filterColor(gl_FragColor);\n}";
17
17
  /* babel-plugin-inline-import '../shaders/greatCircle/line_arc_great_circle_vert.glsl' */
@@ -9,8 +9,8 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
9
9
  var _l7Core = require("@antv/l7-core");
10
10
  var _l7Utils = require("@antv/l7-utils");
11
11
  var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
12
- var _triangulation = require("../../core/triangulation");
13
12
  var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
13
+ var _triangulation = require("../../core/triangulation");
14
14
  /* babel-plugin-inline-import '../shaders/simple/simpleline_frag.glsl' */
15
15
  const simple_line_frag = "\nlayout(std140) uniform commonUniorm {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec4 u_dash_array;\n float u_vertexScale: 1.0;\n float u_linearColor: 0;\n};\nin float v_distanceScale;\nin vec4 v_color;\n//dash\nin vec4 v_dash_array;\n\nout vec4 outputColor;\nvoid main() {\n if(u_dash_array!=vec4(0.0)){\n float dashLength = mod(v_distanceScale, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(!(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z))) {\n // \u865A\u7EBF\u90E8\u5206\n discard;\n };\n }\n if(u_linearColor==1.0){\n outputColor = mix(u_sourceColor, u_targetColor, v_distanceScale);\n outputColor.a *= v_color.a; // \u5168\u5C40\u900F\u660E\u5EA6\n }\n else{\n outputColor = v_color;\n }\n}\n";
16
16
  /* babel-plugin-inline-import '../shaders/simple/simpleline_vert.glsl' */
@@ -12,4 +12,4 @@ import RegisterStyleAttributePlugin from './RegisterStyleAttributePlugin';
12
12
  import ShaderUniformPlugin from './ShaderUniformPlugin';
13
13
  import UpdateModelPlugin from './UpdateModelPlugin';
14
14
  import UpdateStyleAttributePlugin from './UpdateStyleAttributePlugin';
15
- export declare function createPlugins(): (DataSourcePlugin | RegisterStyleAttributePlugin | FeatureScalePlugin | DataMappingPlugin | LayerStylePlugin | LayerMaskPlugin | UpdateStyleAttributePlugin | UpdateModelPlugin | MultiPassRendererPlugin | ShaderUniformPlugin | LayerAnimateStylePlugin | LightingPlugin | PixelPickingPlugin | LayerModelPlugin)[];
15
+ export declare function createPlugins(): (DataMappingPlugin | DataSourcePlugin | FeatureScalePlugin | LayerAnimateStylePlugin | LayerMaskPlugin | LayerModelPlugin | LayerStylePlugin | LightingPlugin | MultiPassRendererPlugin | PixelPickingPlugin | RegisterStyleAttributePlugin | ShaderUniformPlugin | UpdateModelPlugin | UpdateStyleAttributePlugin)[];
@@ -10,9 +10,9 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
10
10
  var _l7Core = require("@antv/l7-core");
11
11
  var _l7Utils = require("@antv/l7-utils");
12
12
  var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
13
+ var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
13
14
  var _triangulation = require("../../core/triangulation");
14
15
  var _utils = require("../../earth/utils");
15
- var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
16
16
  /* babel-plugin-inline-import '../shaders/earthExtrude/earthExtrude_frag.glsl' */
17
17
  const pointExtrudeFrag = "precision highp float;\nin vec4 v_color;\n\n#pragma include \"picking\"\n\nlayout(std140) uniform commonUniform {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor: 0;\n float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_globel;\n float u_r;\n float u_pickLight: 0.0;\n float u_opacitylinear: 0.0;\n float u_opacitylinear_dir: 1.0;\n float u_lightEnable: 1.0;\n};\nin float v_lightWeight;\nin float v_barLinearZ;\nout vec4 outputColor;\nvoid main() {\n\n outputColor = v_color;\n\n // \u5F00\u542F\u900F\u660E\u5EA6\u6E10\u53D8\n if(u_opacitylinear > 0.0) {\n outputColor.a *= u_opacitylinear_dir > 0.0 ? (1.0 - v_barLinearZ): v_barLinearZ;\n }\n\n // picking\n if(u_pickLight > 0.0) {\n outputColor = filterColorAlpha(outputColor, v_lightWeight);\n } else {\n outputColor = filterColor(outputColor);\n }\n}\n";
18
18
  /* babel-plugin-inline-import '../shaders/earthExtrude/earthExtrude_vert.glsl' */
@@ -7,9 +7,9 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
9
9
  var _l7Core = require("@antv/l7-core");
10
- var _triangulation = require("../../core/triangulation");
11
10
  var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
12
11
  var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
12
+ var _triangulation = require("../../core/triangulation");
13
13
  var _interface = require("../../core/interface");
14
14
  /* babel-plugin-inline-import '../shaders/fill/fill_frag.glsl' */
15
15
  const pointFillFrag = "\nlayout(std140) uniform commonUniforms {\n vec3 u_blur_height_fixed;\n float u_stroke_width;\n float u_additive;\n float u_stroke_opacity;\n float u_size_unit;\n float u_time;\n vec4 u_animate;\n};\n\nin vec4 v_color;\nin vec4 v_stroke;\nin vec4 v_data;\nin float v_radius;\n\n#pragma include \"scene_uniforms\"\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nout vec4 outputColor;\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius + u_stroke_width);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n } else if (shape == 1) {\n outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n } else if (shape == 2) {\n outer_df = sdBox(v_data.xy, vec2(1.));\n inner_df = sdBox(v_data.xy, vec2(r));\n } else if (shape == 3) {\n outer_df = sdPentagon(v_data.xy, 0.8);\n inner_df = sdPentagon(v_data.xy, r * 0.8);\n } else if (shape == 4) {\n outer_df = sdHexagon(v_data.xy, 0.8);\n inner_df = sdHexagon(v_data.xy, r * 0.8);\n } else if (shape == 5) {\n outer_df = sdOctogon(v_data.xy, 1.0);\n inner_df = sdOctogon(v_data.xy, r);\n } else if (shape == 6) {\n outer_df = sdHexagram(v_data.xy, 0.52);\n inner_df = sdHexagram(v_data.xy, r * 0.52);\n } else if (shape == 7) {\n outer_df = sdRhombus(v_data.xy, vec2(1.0));\n inner_df = sdRhombus(v_data.xy, vec2(r));\n } else if (shape == 8) {\n outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n }\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n\n float PI = 3.14159;\n float N_RINGS = 3.0;\n float FREQ = 1.0;\n\n if(u_stroke_width < 0.01) {\n outputColor = v_color;\n } else {\n outputColor = mix(v_color, v_stroke * u_stroke_opacity, color_t);\n }\n float intensity = 1.0;\n if(u_time!=-1.0){\n //wave\u76F8\u5173\u903B\u8F91\n float d = length(v_data.xy);\n if(d > 0.5) {\n discard;\n }\n intensity = clamp(cos(d * PI), 0.0, 1.0) * clamp(cos(2.0 * PI * (d * 2.0 * u_animate.z - u_animate.y * u_time)), 0.0, 1.0);\n }\n\n if(u_additive > 0.0) {\n outputColor *= opacity_t;\n outputColor *= intensity;//wave\n outputColor = filterColorAlpha(outputColor, outputColor.a);\n } else {\n outputColor.a *= opacity_t;\n outputColor.a *= intensity;//wave \n outputColor = filterColor(outputColor);\n }\n // \u4F5C\u4E3A mask \u6A21\u677F\u65F6\u9700\u8981\u4E22\u5F03\u900F\u660E\u7684\u50CF\u7D20\n if(outputColor.a < 0.01) {\n discard;\n } \n}\n";
@@ -12,9 +12,9 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
12
12
  var _l7Core = require("@antv/l7-core");
13
13
  var _l7Utils = require("@antv/l7-utils");
14
14
  var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
15
+ var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
15
16
  var _collisionIndex = _interopRequireDefault(require("../../utils/collision-index"));
16
17
  var _symbolLayout = require("../../utils/symbol-layout");
17
- var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
18
18
  /* babel-plugin-inline-import '../shaders/text/text_frag.glsl' */
19
19
  const textFrag = "#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105\n#define FONT_SIZE 48.0\n\nuniform sampler2D u_sdf_map;\nlayout(std140) uniform commonUniforms {\n vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\n vec2 u_sdf_map_size;\n float u_raisingHeight: 0.0;\n float u_stroke_width : 2;\n float u_gamma_scale : 0.5;\n float u_halo_blur : 0.5;\n};\n\nin vec2 v_uv;\nin float v_gamma_scale;\nin vec4 v_color;\nin vec4 v_stroke_color;\nin float v_fontScale;\n\nout vec4 outputColor;\n\n#pragma include \"picking\"\nvoid main() {\n // get style data mapping\n\n // get sdf from atlas\n float dist = texture(SAMPLER_2D(u_sdf_map), v_uv).a;\n\n lowp float buff = (6.0 - u_stroke_width / v_fontScale) / SDF_PX;\n highp float gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (v_fontScale * u_gamma_scale) / 1.0;\n\n highp float gamma_scaled = gamma * v_gamma_scale;\n\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);\n\n outputColor = mix(v_color, v_stroke_color, smoothstep(0., 0.5, 1.- dist));\n\n outputColor.a *= alpha;\n // \u4F5C\u4E3A mask \u6A21\u677F\u65F6\u9700\u8981\u4E22\u5F03\u900F\u660E\u7684\u50CF\u7D20\n if (outputColor.a < 0.01) {\n discard;\n }\n outputColor = filterColor(outputColor);\n}\n";
20
20
  /* babel-plugin-inline-import '../shaders/text/text_vert.glsl' */
@@ -10,8 +10,8 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  var _l7Core = require("@antv/l7-core");
12
12
  var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
13
- var _triangulation = require("../../core/triangulation");
14
13
  var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
14
+ var _triangulation = require("../../core/triangulation");
15
15
  /* babel-plugin-inline-import '../shaders/extrusion/polygon_extrusion_frag.glsl' */
16
16
  const polygonExtrudeFrag = "\nin vec4 v_Color;\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\nout vec4 outputColor;\nvoid main() {\n\n outputColor = v_Color;\n outputColor = filterColor(outputColor);\n}\n";
17
17
  /* babel-plugin-inline-import '../shaders/extrusion/polygon_extrusion_vert.glsl' */
@@ -9,8 +9,8 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
9
9
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
10
  var _l7Core = require("@antv/l7-core");
11
11
  var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
12
- var _triangulation = require("../../core/triangulation");
13
12
  var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
13
+ var _triangulation = require("../../core/triangulation");
14
14
  /* babel-plugin-inline-import '../shaders/fill/fill_frag.glsl' */
15
15
  const polygon_frag = "in vec4 v_color;\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\nout vec4 outputColor;\nvoid main() {\n outputColor = v_color;\n outputColor = filterColor(outputColor);\n}\n";
16
16
  /* babel-plugin-inline-import '../shaders/fill/fill_linear_frag.glsl' */
@@ -11,8 +11,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
11
11
  var _l7Core = require("@antv/l7-core");
12
12
  var _l7Utils = require("@antv/l7-utils");
13
13
  var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
14
- var _triangulation = require("../../core/triangulation");
15
14
  var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
15
+ var _triangulation = require("../../core/triangulation");
16
16
  /* babel-plugin-inline-import '../shaders/ocean/ocean_frag.glsl' */
17
17
  const ocean_frag = "\nlayout(std140) uniform commonUniforms {\n vec4 u_watercolor;\n vec4 u_watercolor2;\n float u_time;\n};\n\nin vec2 v_uv;\nin float v_opacity;\nout vec4 outputColor;\n\nfloat coast2water_fadedepth = 0.10;\nfloat large_waveheight = .750; // change to adjust the \"heavy\" waves\nfloat large_wavesize = 3.4; // factor to adjust the large wave size\nfloat small_waveheight = 0.6; // change to adjust the small random waves\nfloat small_wavesize = 0.5; // factor to ajust the small wave size\nfloat water_softlight_fact = 15.; // range [1..200] (should be << smaller than glossy-fact)\nfloat water_glossylight_fact= 120.; // range [1..200]\nfloat particle_amount = 70.;\n\nvec3 water_specularcolor = vec3(1.3, 1.3, 0.9); // specular Color (RGB) of the water-highlights\n#define light vec3(-0., sin(u_time*0.5)*.5 + .35, 2.8) // position of the sun\n\nuniform sampler2D u_texture1;\nuniform sampler2D u_texture2;\nuniform sampler2D u_texture3;\n\n \n\nfloat hash( float n ) {\n return fract(sin(n)*43758.5453123);\n}\n\n// 2d noise function\nfloat noise1( in vec2 x ) {\n vec2 p = floor(x);\n vec2 f = smoothstep(0.0, 1.0, fract(x));\n float n = p.x + p.y*57.0;\n return mix(mix( hash(n+ 0.0), hash(n+ 1.0),f.x),\n mix( hash(n+ 57.0), hash(n+ 58.0),f.x),f.y);\n}\n\nfloat noise(vec2 p) {\n return texture(SAMPLER_2D(u_texture2),p*vec2(1./256.)).x;\n}\n\nvec4 highness(vec2 p) {\n vec4 t = texture(SAMPLER_2D(u_texture1),fract(p));\n float clipped = -2.0-smoothstep(3.,10.,t.a)*6.9-smoothstep(10.,100.,t.a)*89.9-smoothstep(0.,10000.,t.a)*10000.0;\n return clamp(t, 0.0,3.0)+clamp(t/3.0-1.0, 0.0,1.0)+clamp(t/16.0-1.0, 0.0,1.0);\n}\n\nfloat height_map( vec2 p ) {\n vec4 height=highness(p);\n /*\n height = -0.5+\n 0.5*smoothstep(-100.,0.,-height)+\n 2.75*smoothstep(0.,2.,height)+\n 1.75*smoothstep(2.,4.,height)+\n 2.75*smoothstep(4.,16.,height)+\n 1.5*smoothstep(16.,1000.,height);\n */\n\n mat2 m = mat2( 0.9563*1.4, -0.2924*1.4, 0.2924*1.4, 0.9563*1.4 );\n //p = p*6.;\n float f = 0.6000*noise1( p ); p = m*p*1.1*6.;\n f += 0.2500*noise( p ); p = m*p*1.32;\n f += 0.1666*noise( p ); p = m*p*1.11;\n f += 0.0834*noise( p ); p = m*p*1.12;\n f += 0.0634*noise( p ); p = m*p*1.13;\n f += 0.0444*noise( p ); p = m*p*1.14;\n f += 0.0274*noise( p ); p = m*p*1.15;\n f += 0.0134*noise( p ); p = m*p*1.16;\n f += 0.0104*noise( p ); p = m*p*1.17;\n f += 0.0084*noise( p );\n f = .25*f+dot(height,vec4(-.03125,-.125,.25,.25))*.5;\n const float FLAT_LEVEL = 0.92525;\n //f = f*0.25+height*0.75;\n if (f<FLAT_LEVEL)\n f = f;\n else\n f = pow((f-FLAT_LEVEL)/(1.-FLAT_LEVEL), 2.)*(1.-FLAT_LEVEL)*2.0+FLAT_LEVEL; // makes a smooth coast-increase\n return clamp(f, 0., 10.);\n}\n\nvec3 plasma_quintic( float x ) {\n x = clamp( x, 0.0, 1.0);\n vec4 x1 = vec4( 1.0, x, x * x, x * x * x ); // 1 x x2 x3\n vec4 x2 = x1 * x1.w * x; // x4 x5 x6 x7\n return vec3(\n dot( x1.xyzw, vec4( +0.063861086, +1.992659096, -1.023901152, -0.490832805 ) ) + dot( x2.xy, vec2( +1.308442123, -0.914547012 ) ),\n dot( x1.xyzw, vec4( +0.049718590, -0.791144343, +2.892305078, +0.811726816 ) ) + dot( x2.xy, vec2( -4.686502417, +2.717794514 ) ),\n dot( x1.xyzw, vec4( +0.513275779, +1.580255060, -5.164414457, +4.559573646 ) ) + dot( x2.xy, vec2( -1.916810682, +0.570638854 ) ) );\n}\n\nvec4 color(vec2 p){\n vec4 c1 = vec4(1.7,1.6,.9,1);\n vec4 c2 = vec4(.2,.94,.1,1);\n vec4 c3 = vec4(.3,.2,.0,1);\n vec4 c4 = vec4(.99,.99,1.6,1);\n vec4 v = highness(p);\n float los = smoothstep(0.1,1.1,v.b);\n float his = smoothstep(3.5,6.5,v.b);\n float ces = smoothstep(1.,5.,v.a);\n vec4 lo = mix(c1,c2,los);\n vec4 hi = mix(c3,c4,his);\n vec4 ce = mix(lo,hi,ces);\n\n return vec4(plasma_quintic(ces),1).ragb;\n}\n\nvec3 terrain_map( vec2 p )\n{\n return color(p).rgb*0.75+0.25*vec3(0.7, .55, .4)+texture(SAMPLER_2D(u_texture3), fract(p*5.)).rgb*.5; // test-terrain is simply 'sandstone'\n}\n\nconst mat2 m = mat2( 0.72, -1.60, 1.60, 0.72 );\n\nfloat water_map( vec2 p, float height ) {\n vec2 p2 = p*large_wavesize;\n vec2 shift1 = 0.001*vec2( u_time*160.0*2.0, u_time*120.0*2.0 );\n vec2 shift2 = 0.001*vec2( u_time*190.0*2.0, -u_time*130.0*2.0 );\n\n // coarse crossing 'ocean' waves...\n float f = 0.6000*noise( p );\n f += 0.2500*noise( p*m );\n f += 0.1666*noise( p*m*m );\n float wave = sin(p2.x*0.622+p2.y*0.622+shift2.x*4.269)*large_waveheight*f*height*height ;\n\n p *= small_wavesize;\n f = 0.;\n float amp = 1.0, s = .5;\n for (int i=0; i<9; i++)\n { p = m*p*.947; f -= amp*abs(sin((noise( p+shift1*s )-.5)*2.)); amp = amp*.59; s*=-1.329; }\n \n return wave+f*small_waveheight;\n}\n\nfloat nautic(vec2 p) {\n p *= 18.;\n float f = 0.;\n float amp = 1.0, s = .5;\n for (int i=0; i<3; i++)\n { p = m*p*1.2; f += amp*abs(smoothstep(0., 1., noise( p+u_time*s ))-.5); amp = amp*.5; s*=-1.227; }\n return pow(1.-f, 5.);\n}\n\nfloat particles(vec2 p) {\n p *= 200.;\n float f = 0.;\n float amp = 1.0, s = 1.5;\n for (int i=0; i<3; i++)\n { p = m*p*1.2; f += amp*noise( p+u_time*s ); amp = amp*.5; s*=-1.227; }\n return pow(f*.35, 7.)*particle_amount;\n}\n\nfloat test_shadow( vec2 xy, float height) {\n vec3 r0 = vec3(xy, height);\n vec3 rd = normalize( light - r0 );\n \n float hit = 1.0;\n float t = 0.001;\n for (int j=1; j<25; j++)\n {\n vec3 p = r0 + t*rd;\n float h = height_map( p.xy );\n float height_diff = p.z - h;\n if (height_diff<0.0)\n {\n return 0.0;\n }\n t += 0.01+height_diff*.02;\n hit = min(hit, 2.*height_diff/t); // soft shaddow \n }\n return hit;\n}\n\nvec3 CalcTerrain(vec2 uv, float height) {\n vec3 col = terrain_map( uv );\n vec2 iResolution = vec2(512.);\n float h1 = height_map(uv-vec2(0., 0.5)/ iResolution.xy);\n float h2 = height_map(uv+vec2(0., 0.5)/ iResolution.xy);\n float h3 = height_map(uv-vec2(0.5, 0.)/ iResolution.xy);\n float h4 = height_map(uv+vec2(0.5, 0.)/ iResolution.xy);\n vec3 norm = normalize(vec3(h3-h4, h1-h2, 1.));\n vec3 r0 = vec3(uv, height);\n vec3 rd = normalize( light - r0 );\n float grad = dot(norm, rd);\n col *= grad+pow(grad, 8.);\n float terrainshade = test_shadow( uv, height );\n col = mix(col*.25, col, terrainshade);\n return col;\n}\n\n\nvoid main() {\n vec3 watercolor = u_watercolor.rgb;\n vec3 watercolor2 = u_watercolor2.rgb;\n vec2 uv = v_uv;\n float WATER_LEVEL = 0.84; // Water level (range: 0.0 - 2.0)\n float deepwater_fadedepth = 0.4 + coast2water_fadedepth;\n float height = height_map( uv );\n vec3 col;\n\n float waveheight = clamp(WATER_LEVEL*3.-1.5, 0., 1.);\n float level = WATER_LEVEL + .2*water_map(uv*15. + vec2(u_time*.1), waveheight);\n if (height > level)\n {\n col = CalcTerrain(uv, height);\n }\n if (height <= level)\n {\n vec2 dif = vec2(.0, .01);\n vec2 pos = uv*15. + vec2(u_time*.01);\n float h1 = water_map(pos-dif,waveheight);\n float h2 = water_map(pos+dif,waveheight);\n float h3 = water_map(pos-dif.yx,waveheight);\n float h4 = water_map(pos+dif.yx,waveheight);\n vec3 normwater = normalize(vec3(h3-h4, h1-h2, .125)); // norm-vector of the 'bumpy' water-plane\n uv += normwater.xy*.002*(level-height);\n \n col = CalcTerrain(uv, height);\n\n float coastfade = clamp((level-height)/coast2water_fadedepth, 0., 1.);\n float coastfade2= clamp((level-height)/deepwater_fadedepth, 0., 1.);\n float intensity = col.r*.2126+col.g*.7152+col.b*.0722;\n watercolor = mix(watercolor*intensity, watercolor2, smoothstep(0., 1., coastfade2));\n\n vec3 r0 = vec3(uv, WATER_LEVEL);\n vec3 rd = normalize( light - r0 ); // ray-direction to the light from water-position\n float grad = dot(normwater, rd); // dot-product of norm-vector and light-direction\n float specular = pow(grad, water_softlight_fact); // used for soft highlights \n float specular2= pow(grad, water_glossylight_fact); // used for glossy highlights\n float gradpos = dot(vec3(0., 0., 1.), rd);\n float specular1= smoothstep(0., 1., pow(gradpos, 5.)); // used for diffusity (some darker corona around light's specular reflections...) \n float watershade = test_shadow( uv, level );\n watercolor *= 2.2+watershade;\n watercolor += (.2+.8*watershade) * ((grad-1.0)*.5+specular) * .25;\n watercolor /= (1.+specular1*1.25);\n watercolor += watershade*specular2*water_specularcolor;\n watercolor += watershade*coastfade*(1.-coastfade2)*(vec3(.5, .6, .7)*nautic(uv)+vec3(1., 1., 1.)*particles(uv));\n \n col = mix(col, watercolor, coastfade);\n }\n \n outputColor = vec4(col, v_opacity); \n}\n";
18
18
  /* babel-plugin-inline-import '../shaders/ocean/ocean_vert.glsl' */
@@ -8,8 +8,8 @@ exports.default = void 0;
8
8
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _BaseLayer = _interopRequireDefault(require("../core/BaseLayer"));
11
- var _index = _interopRequireDefault(require("./models/index"));
12
11
  var _rampcolor_legend = require("../utils/rampcolor_legend");
12
+ var _index = _interopRequireDefault(require("./models/index"));
13
13
  class RaterLayer extends _BaseLayer.default {
14
14
  constructor(...args) {
15
15
  super(...args);
@@ -10,8 +10,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
10
10
  var _l7Core = require("@antv/l7-core");
11
11
  var _l7Utils = require("@antv/l7-utils");
12
12
  var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
13
- var _triangulation = require("../../core/triangulation");
14
13
  var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
14
+ var _triangulation = require("../../core/triangulation");
15
15
  /* babel-plugin-inline-import '../shaders/terrain/terrain_rgb_frag.glsl' */
16
16
  const Raster_terrainFrag = "uniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_unpack;\n vec2 u_domain;\n float u_opacity;\n float u_noDataValue;\n float u_clampLow;\n float u_clampHigh;\n};\n\nin vec2 v_texCoord;\nout vec4 outputColor;\n\n\nfloat getElevation(vec2 coord, float bias) {\n // Convert encoded elevation value to meters\n vec4 data = texture(SAMPLER_2D(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 texture(SAMPLER_2D(u_colorTexture), coord);\n}\n\nvoid main() {\n float value = getElevation(v_texCoord,0.0);\n if (value == u_noDataValue) {\n outputColor = vec4(0.0, 0, 0, 0.0);\n } else if ((u_clampLow < 0.5 && value < u_domain[0]) || (u_clampHigh < 0.5 && value > u_domain[1])) {\n outputColor = vec4(0.0, 0, 0, 0.0);\n } else {\n \n outputColor = getColor(value);\n outputColor.a = outputColor.a * u_opacity ;\n if(outputColor.a < 0.01)\n discard;\n }\n}\n";
17
17
  /* babel-plugin-inline-import '../shaders/terrain/terrain_rgb_vert.glsl' */
@@ -1,4 +1,3 @@
1
- /// <reference types="lodash" />
2
1
  import type { IInteractionTarget, ILayer, ILayerService, IMapService, IPickingService, IRendererService } from '@antv/l7-core';
3
2
  import type { SourceTile, TilesetManager } from '@antv/l7-utils';
4
3
  import { TileLayerService } from '../service/TileLayerService';
@@ -29,7 +28,7 @@ export default class BaseTileLayer {
29
28
  getLayers(): ILayer[];
30
29
  getTiles(): import("@antv/l7-core").ITile[];
31
30
  getTile(key: string): import("@antv/l7-core").ITile | undefined;
32
- viewchange: import("lodash").DebouncedFunc<() => void>;
31
+ viewchange: import("@antv/l7-utils").DebouncedFunc<() => void>;
33
32
  tileLoaded(tile: SourceTile): void;
34
33
  tileError(error: Error): void;
35
34
  destroy(): void;
@@ -14,7 +14,7 @@ export declare class TileLayerService {
14
14
  private layerService;
15
15
  private parent;
16
16
  private layerTiles;
17
- constructor({ rendererService, layerService, parent, }: ITileLayerServiceOptions);
17
+ constructor({ rendererService, layerService, parent }: ITileLayerServiceOptions);
18
18
  get tiles(): ITile[];
19
19
  hasTile(tileKey: string): boolean;
20
20
  addTile(tile: ITile): void;
@@ -11,7 +11,7 @@ export declare class TilePickService implements ITilePickService {
11
11
  private tileSourceService;
12
12
  private parent;
13
13
  private tilePickID;
14
- constructor({ layerService, tileLayerService, parent, }: ITilePickServiceOptions);
14
+ constructor({ layerService, tileLayerService, parent }: ITilePickServiceOptions);
15
15
  pickRender(target: IInteractionTarget): void;
16
16
  pick(layer: ILayer, target: IInteractionTarget): Promise<boolean>;
17
17
  selectFeature(pickedColors: Uint8Array | undefined): void;
@@ -47,7 +47,7 @@ export default abstract class Tile extends EventEmitter implements ITile {
47
47
  enablePropagation?: boolean | undefined;
48
48
  fitBoundsOptions?: unknown;
49
49
  name?: string | undefined;
50
- blend?: "normal" | "additive" | "subtractive" | "min" | "max" | "none" | undefined;
50
+ blend?: "min" | "max" | "normal" | "additive" | "subtractive" | "none" | undefined;
51
51
  depth?: boolean | undefined;
52
52
  pickedFeatureID?: number | undefined;
53
53
  enableMultiPassRenderer?: boolean | undefined;
@@ -7,6 +7,6 @@ import RasterTerrainRGBTile from './RasterTerrainRGBTile';
7
7
  import RasterTile from './RasterTile';
8
8
  import VectorTile from './VectorTile';
9
9
  export type TileType = 'VectorTile' | 'DebugTile' | 'PolygonLayer' | 'PointLayer' | 'LineLayer' | 'RasterLayer' | 'image' | 'MaskLayer' | 'TileDebugLayer';
10
- export declare function getTileFactory(layer: ILayer): typeof VectorTile | typeof DebugTile | typeof MaskLayer | typeof RasterRGBTile | typeof RasterTile | typeof RasterTerrainRGBTile | typeof ImageTile;
10
+ export declare function getTileFactory(layer: ILayer): typeof DebugTile | typeof ImageTile | typeof MaskLayer | typeof RasterRGBTile | typeof RasterTerrainRGBTile | typeof RasterTile | typeof VectorTile;
11
11
  export * from '../interface';
12
12
  export * from './Tile';
@@ -1,5 +1,5 @@
1
1
  import LineLayer from '../../line';
2
2
  import PointLayer from '../../point/index';
3
3
  import PolygonLayer from '../../polygon';
4
- export declare function getTileLayer(type: string): typeof PolygonLayer | typeof LineLayer | typeof PointLayer;
4
+ export declare function getTileLayer(type: string): typeof LineLayer | typeof PointLayer | typeof PolygonLayer;
5
5
  export declare function isNeedMask(type: string): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-layers",
3
- "version": "2.21.3",
3
+ "version": "2.21.4-beta.1",
4
4
  "description": "L7's collection of built-in layers",
5
5
  "license": "MIT",
6
6
  "author": "https://github.com/orgs/antvis/people",
@@ -14,20 +14,8 @@
14
14
  "lib",
15
15
  "es"
16
16
  ],
17
- "scripts": {
18
- "dev": "father dev",
19
- "build": "npm run clean && father build",
20
- "check-deps": "father doctor",
21
- "lint": "eslint src __tests__",
22
- "clean": "rimraf dist es lib",
23
- "sync": "tnpm sync"
24
- },
25
17
  "dependencies": {
26
18
  "@antv/async-hook": "^2.2.9",
27
- "@antv/l7-core": "^2.21.3",
28
- "@antv/l7-maps": "^2.21.3",
29
- "@antv/l7-source": "^2.21.3",
30
- "@antv/l7-utils": "^2.21.3",
31
19
  "@babel/runtime": "^7.7.7",
32
20
  "@mapbox/martini": "^0.2.0",
33
21
  "@turf/clone": "^6.5.0",
@@ -44,20 +32,33 @@
44
32
  "extrude-polyline": "^1.0.6",
45
33
  "gl-matrix": "^3.1.0",
46
34
  "gl-vec2": "^1.3.0",
47
- "polyline-miter-util": "^1.0.1"
35
+ "polyline-miter-util": "^1.0.1",
36
+ "@antv/l7-core": "2.21.4-beta.1",
37
+ "@antv/l7-maps": "2.21.4-beta.1",
38
+ "@antv/l7-source": "2.21.4-beta.1",
39
+ "@antv/l7-utils": "2.21.4-beta.1"
48
40
  },
49
41
  "devDependencies": {
50
- "@antv/l7-test-utils": "^2.21.3",
51
42
  "@types/d3-array": "^2.0.0",
52
43
  "@types/d3-color": "^1.2.2",
53
44
  "@types/d3-interpolate": "1.1.6",
54
45
  "@types/d3-scale": "^2.1.1",
55
46
  "@types/earcut": "^2.1.0",
56
- "@types/gl-matrix": "^2.4.5",
57
- "@types/lodash": "^4.14.138"
47
+ "@types/gl-matrix": "^2.4.5"
48
+ },
49
+ "peerDependencies": {
50
+ "@antv/l7-test-utils": "2.21.4-beta.1"
58
51
  },
59
52
  "publishConfig": {
60
- "access": "public"
53
+ "access": "public",
54
+ "registry": "https://registry.npmjs.org"
61
55
  },
62
- "gitHead": "522dec125e1d49bfe3b7325239bb6c9103311b2d"
63
- }
56
+ "repository": "git@github.com:antvis/L7.git",
57
+ "scripts": {
58
+ "dev": "father dev",
59
+ "build": "npm run clean && father build",
60
+ "check-deps": "father doctor",
61
+ "lint": "eslint src __tests__",
62
+ "clean": "rimraf dist es lib"
63
+ }
64
+ }