@antv/l7-layers 2.17.12 → 2.18.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 (42) hide show
  1. package/es/core/BaseLayer.js +7 -2
  2. package/es/earth/models/atmosphere.js +2 -1
  3. package/es/earth/models/bloomsphere.js +2 -1
  4. package/es/heatmap/models/heatmap.js +2 -2
  5. package/es/image/models/image.js +6 -29
  6. package/es/line/models/arc.js +2 -2
  7. package/es/line/models/linearline.js +2 -2
  8. package/es/line/models/simpleLine.js +2 -2
  9. package/es/line/models/wall.js +2 -2
  10. package/es/mask/models/fill.js +2 -2
  11. package/es/plugins/DataMappingPlugin.js +2 -2
  12. package/es/plugins/FeatureScalePlugin.js +4 -1
  13. package/es/plugins/ShaderUniformPlugin.js +1 -2
  14. package/es/point/models/earthExtrude.js +2 -2
  15. package/es/point/models/normal.js +2 -1
  16. package/es/point/models/text.js +2 -2
  17. package/es/polygon/models/ocean.js +2 -2
  18. package/es/polygon/models/water.js +2 -1
  19. package/es/tile/tileFactory/Tile.d.ts +0 -1
  20. package/es/tile/tileLayer/BaseLayer.js +2 -1
  21. package/es/utils/layerData.js +2 -2
  22. package/lib/core/BaseLayer.js +30 -25
  23. package/lib/earth/models/atmosphere.js +3 -2
  24. package/lib/earth/models/bloomsphere.js +3 -2
  25. package/lib/heatmap/models/heatmap.js +2 -2
  26. package/lib/image/models/image.js +6 -29
  27. package/lib/line/models/arc.js +2 -2
  28. package/lib/line/models/linearline.js +2 -2
  29. package/lib/line/models/simpleLine.js +2 -2
  30. package/lib/line/models/wall.js +2 -2
  31. package/lib/mask/models/fill.js +2 -2
  32. package/lib/plugins/DataMappingPlugin.js +2 -2
  33. package/lib/plugins/FeatureScalePlugin.js +8 -5
  34. package/lib/plugins/ShaderUniformPlugin.js +1 -2
  35. package/lib/point/models/earthExtrude.js +2 -2
  36. package/lib/point/models/normal.js +3 -2
  37. package/lib/point/models/text.js +2 -2
  38. package/lib/polygon/models/ocean.js +2 -2
  39. package/lib/polygon/models/water.js +3 -2
  40. package/lib/tile/tileLayer/BaseLayer.js +3 -2
  41. package/lib/utils/layerData.js +3 -3
  42. package/package.json +7 -8
@@ -25,14 +25,19 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
25
25
  import { AsyncSeriesBailHook, AsyncWaterfallHook, SyncBailHook, SyncHook } from '@antv/async-hook';
26
26
  import { BlendType, IDebugLog, ILayerStage, lazyInject, TYPES } from '@antv/l7-core';
27
27
  import Source from '@antv/l7-source';
28
- import { encodePickingColor } from '@antv/l7-utils';
28
+ import { encodePickingColor, lodashUtil } from '@antv/l7-utils';
29
29
  import { EventEmitter } from 'eventemitter3';
30
- import { isEqual, isFunction, isNumber, isObject, isPlainObject, isUndefined } from 'lodash';
31
30
  import { BlendTypes } from "../utils/blend";
32
31
  import { calculateData } from "../utils/layerData";
33
32
  import { createMultiPassRenderer, normalizePasses } from "../utils/multiPassRender";
34
33
  import LayerPickService from "./LayerPickService";
35
34
  import TextureService from "./TextureService";
35
+ var isEqual = lodashUtil.isEqual,
36
+ isFunction = lodashUtil.isFunction,
37
+ isNumber = lodashUtil.isNumber,
38
+ isObject = lodashUtil.isObject,
39
+ isPlainObject = lodashUtil.isPlainObject,
40
+ isUndefined = lodashUtil.isUndefined;
36
41
  /**
37
42
  * 分配 layer id
38
43
  */
@@ -8,13 +8,14 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
9
  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; } }
10
10
  import { AttributeType, gl } from '@antv/l7-core';
11
- import { isNumber } from 'lodash';
11
+ import { lodashUtil } from '@antv/l7-utils';
12
12
  import BaseModel from "../../core/BaseModel";
13
13
  import { earthTriangulation } from "../../core/triangulation";
14
14
  /* babel-plugin-inline-import '../shaders/atmosphere_frag.glsl' */
15
15
  var atmoSphereFrag = "\nuniform float u_opacity;\nuniform vec3 u_CameraPosition;\n\nvarying vec3 vVertexNormal;\nvarying float v_offset;\nvarying vec4 v_Color;\nvoid main() {\n \n \n // float intensity = pow(0.5 + dot(normalize(vVertexNormal), normalize(u_CameraPosition)), 3.0);\n float intensity = pow(v_offset + dot(normalize(vVertexNormal), normalize(u_CameraPosition)), 3.0);\n // \u53BB\u9664\u80CC\u9762\n if(intensity > 1.0) intensity = 0.0;\n\n gl_FragColor = vec4(v_Color.rgb, v_Color.a * intensity * u_opacity);\n}\n";
16
16
  /* babel-plugin-inline-import '../shaders/atmosphere_vert.glsl' */
17
17
  var atmoSphereVert = "\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute vec2 a_Uv;\nattribute vec4 a_Color;\nuniform vec3 u_CameraPosition;\nvarying float v_CamreaDistance;\n\nuniform mat4 u_ViewProjectionMatrix;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_ViewMatrix;\n\nvarying vec3 vVertexNormal;\nvarying vec4 v_Color;\nvarying float v_offset;\n\nvoid main() {\n float EARTH_RADIUS = 100.0;\n \n v_Color = a_Color;\n\n v_offset = min(((length(u_CameraPosition) - EARTH_RADIUS)/600.0) * 0.5 + 0.4, 1.0);\n vVertexNormal = a_Normal;\n\n gl_Position = u_ViewProjectionMatrix * u_ModelMatrix * vec4(a_Position, 1.0);\n}\n";
18
+ var isNumber = lodashUtil.isNumber;
18
19
  var EarthAtomSphereModel = /*#__PURE__*/function (_BaseModel) {
19
20
  _inherits(EarthAtomSphereModel, _BaseModel);
20
21
  var _super = _createSuper(EarthAtomSphereModel);
@@ -8,13 +8,14 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
9
  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; } }
10
10
  import { AttributeType, gl } from '@antv/l7-core';
11
- import { isNumber } from 'lodash';
11
+ import { lodashUtil } from '@antv/l7-utils';
12
12
  import BaseModel from "../../core/BaseModel";
13
13
  import { earthOuterTriangulation } from "../../core/triangulation";
14
14
  /* babel-plugin-inline-import '../shaders/bloomsphere_frag.glsl' */
15
15
  var bloomSphereFrag = "\nuniform float u_opacity;\nuniform vec3 u_CameraPosition;\nvarying vec3 vVertexNormal;\n\nvarying vec4 v_Color;\nvoid main() {\n\n\n float intensity = - dot(normalize(vVertexNormal), normalize(u_CameraPosition));\n // \u53BB\u9664\u80CC\u9762\n if(intensity > 1.0) intensity = 0.0;\n\n gl_FragColor = vec4(v_Color.rgb, v_Color.a * intensity * u_opacity);\n}\n";
16
16
  /* babel-plugin-inline-import '../shaders/bloomsphere_vert.glsl' */
17
17
  var bloomSphereVert = "\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute vec2 a_Uv;\nattribute vec4 a_Color;\nuniform vec3 u_CameraPosition;\nuniform mat4 u_ViewProjectionMatrix;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_ViewMatrix;\n\nvarying vec3 vVertexNormal;\nvarying vec4 v_Color;\n\nvoid main() {\n v_Color = a_Color;\n\n vVertexNormal = a_Normal;\n\n gl_Position = u_ViewProjectionMatrix * u_ModelMatrix * vec4(a_Position, 1.0);\n}\n";
18
+ var isNumber = lodashUtil.isNumber;
18
19
  var EarthBloomSphereModel = /*#__PURE__*/function (_BaseModel) {
19
20
  _inherits(EarthBloomSphereModel, _BaseModel);
20
21
  var _super = _createSuper(EarthBloomSphereModel);
@@ -11,7 +11,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
11
11
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
12
  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; } }
13
13
  import { AttributeType, gl } from '@antv/l7-core';
14
- import { generateColorRamp, getCullFace } from '@antv/l7-utils';
14
+ import { generateColorRamp, getCullFace, lodashUtil } from '@antv/l7-utils';
15
15
  import { mat4 } from 'gl-matrix';
16
16
  import { injectable } from 'inversify';
17
17
  import 'reflect-metadata';
@@ -29,8 +29,8 @@ var heatmapColorVert = "precision highp float;\nattribute vec3 a_Position;\nattr
29
29
  var heatmapFramebufferFrag = "precision highp float;\nuniform float u_intensity;\nvarying float v_weight;\nvarying vec2 v_extrude;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(){\n float d = -0.5 * 3.0 * 3.0 * dot(v_extrude, v_extrude);\n float val = v_weight * u_intensity * GAUSS_COEF * exp(d);\n gl_FragColor = vec4(val, 1., 1., 1.);\n}\n";
30
30
  /* babel-plugin-inline-import '../shaders/heatmap_framebuffer_vert.glsl' */
31
31
  var heatmapFramebufferVert = "precision highp float;\nattribute vec3 a_Position;\nattribute float a_Size;\nattribute vec2 a_Dir;\nuniform float u_intensity;\nuniform float u_radius;\nvarying vec2 v_extrude;\nvarying float v_weight;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n#define GAUSS_COEF 0.3989422804014327\n\n#pragma include \"projection\"\n\nvoid main(){\n v_weight = a_Size;\n float ZERO = 1.0 / 255.0 / 16.0;\n float extrude_x = a_Dir.x * 2.0 -1.0;\n float extrude_y = a_Dir.y * 2.0 -1.0;\n vec2 extrude_dir = normalize(vec2(extrude_x,extrude_y));\n float S = sqrt(-2.0 * log(ZERO / a_Size / u_intensity / GAUSS_COEF)) / 2.5;\n v_extrude = extrude_dir * S;\n\n vec2 offset = project_pixel(v_extrude * u_radius);\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, 0.0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n }\n}\n";
32
- import { isEqual } from 'lodash';
33
32
  import { heatMap3DTriangulation } from "../triangulation";
33
+ var isEqual = lodashUtil.isEqual;
34
34
  var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_BaseModel) {
35
35
  _inherits(HeatMapModel, _BaseModel);
36
36
  var _super = _createSuper(HeatMapModel);
@@ -8,7 +8,6 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
9
  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; } }
10
10
  import { AttributeType, gl } from '@antv/l7-core';
11
- import { isMini } from '@antv/l7-utils';
12
11
  import BaseModel from "../../core/BaseModel";
13
12
  import { RasterImageTriangulation } from "../../core/triangulation";
14
13
  /* babel-plugin-inline-import '../shaders/image_frag.glsl' */
@@ -36,8 +35,7 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
36
35
  key: "initModels",
37
36
  value: function () {
38
37
  var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
39
- var _this = this;
40
- var source, createTexture2D, canvas, img, imageData, model;
38
+ var source, createTexture2D, imageData, model;
41
39
  return _regeneratorRuntime.wrap(function _callee$(_context) {
42
40
  while (1) switch (_context.prev = _context.next) {
43
41
  case 0:
@@ -47,29 +45,9 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
47
45
  height: 0,
48
46
  width: 0
49
47
  });
50
- if (!isMini) {
51
- _context.next = 11;
52
- break;
53
- }
54
- // @ts-ignore
55
- canvas = this.layerService.sceneService.getSceneConfig().canvas;
56
- img = canvas.createImage();
57
- img.crossOrigin = 'anonymous';
58
- img.src = source.data.originData;
59
- img.onload = function () {
60
- _this.texture = createTexture2D({
61
- data: img,
62
- width: img.width,
63
- height: img.height
64
- });
65
- _this.layerService.reRender();
66
- };
67
- _context.next = 15;
68
- break;
69
- case 11:
70
- _context.next = 13;
48
+ _context.next = 5;
71
49
  return source.data.images;
72
- case 13:
50
+ case 5:
73
51
  imageData = _context.sent;
74
52
  this.texture = createTexture2D({
75
53
  data: imageData[0],
@@ -78,8 +56,7 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
78
56
  mag: gl.LINEAR,
79
57
  min: gl.LINEAR
80
58
  });
81
- case 15:
82
- _context.next = 17;
59
+ _context.next = 9;
83
60
  return this.layer.buildLayerModel({
84
61
  moduleName: 'rasterImage',
85
62
  vertexShader: ImageVert,
@@ -94,10 +71,10 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
94
71
  enable: false
95
72
  }
96
73
  });
97
- case 17:
74
+ case 9:
98
75
  model = _context.sent;
99
76
  return _context.abrupt("return", [model]);
100
- case 19:
77
+ case 11:
101
78
  case "end":
102
79
  return _context.stop();
103
80
  }
@@ -10,8 +10,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
12
  import { AttributeType, gl } from '@antv/l7-core';
13
- import { rgb2arr } from '@antv/l7-utils';
14
- import { isNumber } from 'lodash';
13
+ import { lodashUtil, rgb2arr } from '@antv/l7-utils';
15
14
  import BaseModel from "../../core/BaseModel";
16
15
  import { LineArcTriangulation } from "../../core/triangulation";
17
16
  // arc dash line
@@ -31,6 +30,7 @@ var lineStyleObj = {
31
30
  solid: 0.0,
32
31
  dash: 1.0
33
32
  };
33
+ var isNumber = lodashUtil.isNumber;
34
34
  var ArcModel = /*#__PURE__*/function (_BaseModel) {
35
35
  _inherits(ArcModel, _BaseModel);
36
36
  var _super = _createSuper(ArcModel);
@@ -10,8 +10,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
12
  import { AttributeType, gl } from '@antv/l7-core';
13
- import { generateColorRamp } from '@antv/l7-utils';
14
- import { isNumber } from 'lodash';
13
+ import { generateColorRamp, lodashUtil } from '@antv/l7-utils';
15
14
  import BaseModel from "../../core/BaseModel";
16
15
  import { LinearDir } from "../../core/interface";
17
16
  import { LineTriangulation } from "../../core/triangulation";
@@ -19,6 +18,7 @@ import { LineTriangulation } from "../../core/triangulation";
19
18
  var linear_line_frag = "\nvarying vec4 v_Color;\n#pragma include \"picking\"\nvoid main() {\n\n gl_FragColor = v_Color; // \u5168\u5C40\u900F\u660E\u5EA6\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
20
19
  /* babel-plugin-inline-import '../shaders/linearLine/line_linear_vert.glsl' */
21
20
  var linear_line_vert = "\nattribute float a_Miter;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\n// dash line\nattribute float a_Total_Distance;\nattribute vec2 a_DistanceAndIndex;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_heightfixed: 0.0;\nuniform float u_vertexScale: 1.0;\nuniform float u_raisingHeight: 0.0;\nuniform float u_opacity : 1.0;\nuniform sampler2D u_texture;\nuniform float u_linearDir: 1.0;\nvarying vec4 v_Color;\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n float lineDistance = a_DistanceAndIndex.x;\n float currentLinePointRatio = lineDistance / a_Total_Distance;\n \n\n float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\uFF08\u5411\u4E24\u4FA7\u504F\u79FB\u7684\u548C\uFF09\n float linePixelSize = project_pixel(a_Size.x) * 2.0; // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB \u5355\u4FA7 * 2\n float texV = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n float linearRadio =currentLinePointRatio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n if(u_linearDir < 1.0) {\n linearRadio = texV;\n }\n\n v_Color = texture2D(u_texture, vec2(linearRadio, 0.5));\n\n v_Color.a *= u_opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n\n\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5 vertex height\n float lineHeight = a_Size.y; // size \u7B2C\u4E8C\u4E2A\u53C2\u6570\u4EE3\u8868\u7684\u9AD8\u5EA6 [linewidth, lineheight]\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n lineHeight *= 0.2; // \u4FDD\u6301\u548C amap/mapbox \u4E00\u81F4\u7684\u6548\u679C\n h *= 0.2;\n if(u_heightfixed < 1.0) {\n lineHeight = project_pixel(a_Size.y);\n }\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h + u_raisingHeight, 1.0));\n } else {\n // mapbox - amap\n \n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // mapbox\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n h *= mapboxZoomScale;\n h += u_raisingHeight * mapboxZoomScale;\n if(u_heightfixed > 0.0) {\n lineHeight *= mapboxZoomScale;\n }\n \n } else {\n // amap\n h += u_raisingHeight;\n // lineHeight \u9876\u70B9\u504F\u79FB\u9AD8\u5EA6\n if(u_heightfixed < 1.0) {\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
21
+ var isNumber = lodashUtil.isNumber;
22
22
  var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
23
23
  _inherits(LinearLineModel, _BaseModel);
24
24
  var _super = _createSuper(LinearLineModel);
@@ -8,8 +8,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
9
  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; } }
10
10
  import { AttributeType, gl } from '@antv/l7-core';
11
- import { rgb2arr } from '@antv/l7-utils';
12
- import { isNumber } from 'lodash';
11
+ import { lodashUtil, rgb2arr } from '@antv/l7-utils';
13
12
  import BaseModel from "../../core/BaseModel";
14
13
  import { SimpleLineTriangulation } from "../../core/triangulation";
15
14
  /* babel-plugin-inline-import '../shaders/simple/simpleline_frag.glsl' */
@@ -18,6 +17,7 @@ var simple_line_frag = "\nvarying vec4 v_color;\nvoid main() {\n gl_FragColor =
18
17
  var simle_linear_frag = "uniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float opacity;\nvoid main() {\n gl_FragColor = mix(u_sourceColor, u_targetColor, v_distanceScale);\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n}\n";
19
18
  /* babel-plugin-inline-import '../shaders/simple/simpleline_vert.glsl' */
20
19
  var simple_line_vert = "attribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Position;\n\nattribute float a_Total_Distance;\nattribute float a_Distance;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_opacity: 1.0;\nuniform float u_vertexScale: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n\n\n#pragma include \"projection\"\n\nvarying vec4 v_color;\nvarying float v_distanceScale;\n\nvoid main() {\n\n v_color = a_Color; \n v_distanceScale = a_Distance / a_Total_Distance;\n v_color = vec4(a_Color.xyz, a_Color.w * u_opacity); \n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, project_pixel(a_Size.y) + h * 0.2, 1.0));\n } else {\n float lineHeight = a_Size.y;\n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n h *= 2.0/pow(2.0, 20.0 - u_Zoom);\n }\n\n // #define COORDINATE_SYSTEM_P20 5.0\n // #define COORDINATE_SYSTEM_P20_OFFSET 6.0\n // amap1.x\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, lineHeight + h, 1.0));\n gl_PointSize = 10.0;\n }\n}\n";
20
+ var isNumber = lodashUtil.isNumber;
21
21
  var SimpleLineModel = /*#__PURE__*/function (_BaseModel) {
22
22
  _inherits(SimpleLineModel, _BaseModel);
23
23
  var _super = _createSuper(SimpleLineModel);
@@ -10,14 +10,14 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
12
  import { AttributeType, gl } from '@antv/l7-core';
13
- import { rgb2arr } from '@antv/l7-utils';
14
- import { isNumber } from 'lodash';
13
+ import { lodashUtil, rgb2arr } from '@antv/l7-utils';
15
14
  import BaseModel from "../../core/BaseModel";
16
15
  import { LineTriangulation } from "../../core/triangulation";
17
16
  /* babel-plugin-inline-import '../shaders/wall/wall_frag.glsl' */
18
17
  var line_frag = "#define Animate 0.0\n#define LineTexture 1.0\n\n// line texture\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_opacity : 1.0;\nuniform float u_textureBlend;\nuniform float u_iconStepCount;\nuniform float u_time;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ]; // \u63A7\u5236\u8FD0\u52A8\n\nvarying vec2 v_iconMapUV;\nvarying float v_blur;\nvarying float v_radio;\nvarying vec4 v_color;\nvarying vec4 v_dataset;\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = u_opacity;\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = v_dataset.r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float v = v_dataset.a;\n\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, v);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n gl_FragColor = v_color;\n }\n\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n if(u_animate.x == Animate) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n alpha = smoothstep(0., 1., alpha);\n gl_FragColor.a *= alpha;\n }\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = v_dataset.g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = v_dataset.b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);\n float v = v_dataset.a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 start\n float flag = 0.0;\n if(u > 1.0/u_iconStepCount) {\n flag = 1.0;\n }\n u = fract(u*u_iconStepCount);\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 end\n\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture2D(u_texture, uv);\n\n // Tip: \u5224\u65AD\u7EB9\u7406\u95F4\u9694\n if(flag > 0.0) {\n pattern = vec4(0.0);\n }\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n gl_FragColor = filterColor(gl_FragColor + pattern);\n } else { // replace\n pattern.a *= opacity;\n if(gl_FragColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n gl_FragColor = filterColor(pattern);\n }\n }\n \n\n // blur - AA\n if(v < v_blur) {\n gl_FragColor.a = mix(0.0, gl_FragColor.a, v/v_blur);\n } else if(v > 1.0 - v_blur) {\n gl_FragColor.a = mix(gl_FragColor.a, 0.0, (v - (1.0 - v_blur))/v_blur);\n }\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
19
18
  /* babel-plugin-inline-import '../shaders/wall/wall_vert.glsl' */
20
19
  var line_vert = "#define Animate 0.0\n\nattribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\nattribute vec2 a_iconMapUV;\nattribute float a_Total_Distance;\nattribute float a_Distance;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\nuniform float u_icon_step: 100;\nuniform float u_heightfixed;\nuniform float u_linearColor: 0;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nvarying vec2 v_iconMapUV;\nvarying vec4 v_color;\nvarying float v_blur;\nvarying float v_radio;\nvarying vec4 v_dataset;\n\nvoid main() {\n\n\n float d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n\n v_iconMapUV = a_iconMapUV;\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n d_texPixelLen = project_pixel(u_icon_step);\n } else {\n d_texPixelLen = u_icon_step;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n if(u_animate.x == Animate || u_linearColor == 1.0) {\n d_distance_ratio = a_Distance / a_Total_Distance;\n }\n\n float miter = (a_Miter + 1.0)/2.0;\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n v_dataset[0] = d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n v_dataset[1] = a_Distance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n v_dataset[2] = d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n v_dataset[3] = miter; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C 0 - 1\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float originSize = a_Size.x; // \u56FA\u5B9A\u9AD8\u5EA6\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n originSize = project_float_pixel(a_Size.x);\n }\n\n float wallHeight = originSize * miter;\n float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));\n\n v_blur = min(project_float_pixel(2.0) / originSize, 0.05);\n v_color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
20
+ var isNumber = lodashUtil.isNumber;
21
21
  var LineWallModel = /*#__PURE__*/function (_BaseModel) {
22
22
  _inherits(LineWallModel, _BaseModel);
23
23
  var _super = _createSuper(LineWallModel);
@@ -7,14 +7,14 @@ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
7
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
9
  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; } }
10
- import { rgb2arr } from '@antv/l7-utils';
11
- import { isNumber } from 'lodash';
10
+ import { lodashUtil, rgb2arr } from '@antv/l7-utils';
12
11
  import BaseModel from "../../core/BaseModel";
13
12
  import { polygonTriangulation } from "../../core/triangulation";
14
13
  /* babel-plugin-inline-import '../../shader/minify_frag.glsl' */
15
14
  var mask_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";
16
15
  /* babel-plugin-inline-import '../shaders/mask_vert.glsl' */
17
16
  var mask_vert = "attribute vec3 a_Position;\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}\n\n";
17
+ var isNumber = lodashUtil.isNumber;
18
18
  var MaskModel = /*#__PURE__*/function (_BaseModel) {
19
19
  _inherits(MaskModel, _BaseModel);
20
20
  var _super = _createSuper(MaskModel);
@@ -10,10 +10,10 @@ var _dec, _dec2, _dec3, _class, _class2, _descriptor, _descriptor2;
10
10
  import _regeneratorRuntime from "@babel/runtime/regenerator";
11
11
  import { IDebugLog, ILayerStage, TYPES } from '@antv/l7-core';
12
12
  import { Version } from '@antv/l7-maps';
13
- import { normalize, rgb2arr } from '@antv/l7-utils';
13
+ import { lodashUtil, normalize, rgb2arr } from '@antv/l7-utils';
14
14
  import { inject, injectable } from 'inversify';
15
- import { cloneDeep } from 'lodash';
16
15
  import 'reflect-metadata';
16
+ var cloneDeep = lodashUtil.cloneDeep;
17
17
  var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IMapService), _dec3 = inject(TYPES.IFontService), _dec(_class = (_class2 = /*#__PURE__*/function () {
18
18
  function DataMappingPlugin() {
19
19
  _classCallCheck(this, DataMappingPlugin);
@@ -6,13 +6,16 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
6
6
  var _scaleMap, _dec, _class;
7
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
  import { IDebugLog, ILayerStage, ScaleTypes, StyleScaleType } from '@antv/l7-core';
9
+ import { lodashUtil } from '@antv/l7-utils';
9
10
  import { extent } from 'd3-array';
10
11
  import * as d3interpolate from 'd3-interpolate';
11
12
  import * as d3 from 'd3-scale';
12
13
  import { injectable } from 'inversify';
13
- import { isNil, isString, uniq } from 'lodash';
14
14
  import 'reflect-metadata';
15
15
  import identity from "../utils/identityScale";
16
+ var isNil = lodashUtil.isNil,
17
+ isString = lodashUtil.isString,
18
+ uniq = lodashUtil.uniq;
16
19
  var dateRegex = /^(?:(?!0000)[0-9]{4}([-/.]+)(?:(?:0?[1-9]|1[0-2])\1(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])\1(?:29|30)|(?:0?[13578]|1[02])\1(?:31))|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)([-/.]?)0?2\2(?:29))(\s+([01]|([01][0-9]|2[0-3])):([0-9]|[0-5][0-9]):([0-9]|[0-5][0-9]))?$/;
17
20
  var scaleMap = (_scaleMap = {}, _defineProperty(_scaleMap, ScaleTypes.LINEAR, d3.scaleLinear), _defineProperty(_scaleMap, ScaleTypes.POWER, d3.scalePow), _defineProperty(_scaleMap, ScaleTypes.LOG, d3.scaleLog), _defineProperty(_scaleMap, ScaleTypes.IDENTITY, identity), _defineProperty(_scaleMap, ScaleTypes.SEQUENTIAL, d3.scaleSequential), _defineProperty(_scaleMap, ScaleTypes.TIME, d3.scaleTime), _defineProperty(_scaleMap, ScaleTypes.QUANTILE, d3.scaleQuantile), _defineProperty(_scaleMap, ScaleTypes.QUANTIZE, d3.scaleQuantize), _defineProperty(_scaleMap, ScaleTypes.THRESHOLD, d3.scaleThreshold), _defineProperty(_scaleMap, ScaleTypes.CAT, d3.scaleOrdinal), _defineProperty(_scaleMap, ScaleTypes.DIVERGING, d3.scaleDiverging), _scaleMap);
18
21
  /**
@@ -6,7 +6,6 @@ import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecorated
6
6
  import _initializerWarningHelper from "@babel/runtime/helpers/esm/initializerWarningHelper";
7
7
  var _dec, _dec2, _dec3, _dec4, _dec5, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4;
8
8
  import { CameraUniform, CoordinateUniform, TYPES } from '@antv/l7-core';
9
- import { $window } from '@antv/l7-utils';
10
9
  import { inject, injectable } from 'inversify';
11
10
  import 'reflect-metadata';
12
11
 
@@ -50,7 +49,7 @@ var ShaderUniformPlugin = (_dec = injectable(), _dec2 = inject(TYPES.ICameraServ
50
49
  height = _this$rendererService.height;
51
50
  layer.models.forEach(function (model) {
52
51
  var _model$addUniforms;
53
- model.addUniforms((_model$addUniforms = {}, _defineProperty(_model$addUniforms, CameraUniform.ProjectionMatrix, _this.cameraService.getProjectionMatrix()), _defineProperty(_model$addUniforms, CameraUniform.ViewMatrix, _this.cameraService.getViewMatrix()), _defineProperty(_model$addUniforms, CameraUniform.ViewProjectionMatrix, _this.cameraService.getViewProjectionMatrix()), _defineProperty(_model$addUniforms, CameraUniform.Zoom, _this.cameraService.getZoom()), _defineProperty(_model$addUniforms, CameraUniform.ZoomScale, _this.cameraService.getZoomScale()), _defineProperty(_model$addUniforms, CameraUniform.FocalDistance, _this.cameraService.getFocalDistance()), _defineProperty(_model$addUniforms, CameraUniform.CameraPosition, _this.cameraService.getCameraPosition()), _defineProperty(_model$addUniforms, CoordinateUniform.CoordinateSystem, _this.coordinateSystemService.getCoordinateSystem()), _defineProperty(_model$addUniforms, CoordinateUniform.ViewportCenter, _this.coordinateSystemService.getViewportCenter()), _defineProperty(_model$addUniforms, CoordinateUniform.ViewportCenterProjection, _this.coordinateSystemService.getViewportCenterProjection()), _defineProperty(_model$addUniforms, CoordinateUniform.PixelsPerDegree, _this.coordinateSystemService.getPixelsPerDegree()), _defineProperty(_model$addUniforms, CoordinateUniform.PixelsPerDegree2, _this.coordinateSystemService.getPixelsPerDegree2()), _defineProperty(_model$addUniforms, CoordinateUniform.PixelsPerMeter, _this.coordinateSystemService.getPixelsPerMeter()), _defineProperty(_model$addUniforms, CoordinateUniform.Mvp, mvp), _defineProperty(_model$addUniforms, "u_sceneCenterMercator", sceneCenterMercator), _defineProperty(_model$addUniforms, "u_ViewportSize", [width, height]), _defineProperty(_model$addUniforms, "u_ModelMatrix", _this.cameraService.getModelMatrix()), _defineProperty(_model$addUniforms, "u_DevicePixelRatio", $window.devicePixelRatio), _defineProperty(_model$addUniforms, "u_PickingBuffer", layer.getLayerConfig().pickingBuffer || 0), _defineProperty(_model$addUniforms, "u_shaderPick", Number(layer.getShaderPickStat())), _model$addUniforms));
52
+ model.addUniforms((_model$addUniforms = {}, _defineProperty(_model$addUniforms, CameraUniform.ProjectionMatrix, _this.cameraService.getProjectionMatrix()), _defineProperty(_model$addUniforms, CameraUniform.ViewMatrix, _this.cameraService.getViewMatrix()), _defineProperty(_model$addUniforms, CameraUniform.ViewProjectionMatrix, _this.cameraService.getViewProjectionMatrix()), _defineProperty(_model$addUniforms, CameraUniform.Zoom, _this.cameraService.getZoom()), _defineProperty(_model$addUniforms, CameraUniform.ZoomScale, _this.cameraService.getZoomScale()), _defineProperty(_model$addUniforms, CameraUniform.FocalDistance, _this.cameraService.getFocalDistance()), _defineProperty(_model$addUniforms, CameraUniform.CameraPosition, _this.cameraService.getCameraPosition()), _defineProperty(_model$addUniforms, CoordinateUniform.CoordinateSystem, _this.coordinateSystemService.getCoordinateSystem()), _defineProperty(_model$addUniforms, CoordinateUniform.ViewportCenter, _this.coordinateSystemService.getViewportCenter()), _defineProperty(_model$addUniforms, CoordinateUniform.ViewportCenterProjection, _this.coordinateSystemService.getViewportCenterProjection()), _defineProperty(_model$addUniforms, CoordinateUniform.PixelsPerDegree, _this.coordinateSystemService.getPixelsPerDegree()), _defineProperty(_model$addUniforms, CoordinateUniform.PixelsPerDegree2, _this.coordinateSystemService.getPixelsPerDegree2()), _defineProperty(_model$addUniforms, CoordinateUniform.PixelsPerMeter, _this.coordinateSystemService.getPixelsPerMeter()), _defineProperty(_model$addUniforms, CoordinateUniform.Mvp, mvp), _defineProperty(_model$addUniforms, "u_sceneCenterMercator", sceneCenterMercator), _defineProperty(_model$addUniforms, "u_ViewportSize", [width, height]), _defineProperty(_model$addUniforms, "u_ModelMatrix", _this.cameraService.getModelMatrix()), _defineProperty(_model$addUniforms, "u_DevicePixelRatio", window.devicePixelRatio), _defineProperty(_model$addUniforms, "u_PickingBuffer", layer.getLayerConfig().pickingBuffer || 0), _defineProperty(_model$addUniforms, "u_shaderPick", Number(layer.getShaderPickStat())), _model$addUniforms));
54
53
  });
55
54
 
56
55
  // TODO:脏检查,决定是否需要渲染
@@ -10,8 +10,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
12
  import { AttributeType, gl } from '@antv/l7-core';
13
- import { calculateCentroid, getCullFace, rgb2arr } from '@antv/l7-utils';
14
- import { isNumber } from 'lodash';
13
+ import { calculateCentroid, getCullFace, lodashUtil, rgb2arr } from '@antv/l7-utils';
15
14
  import BaseModel from "../../core/BaseModel";
16
15
  import { PointExtrudeTriangulation } from "../../core/triangulation";
17
16
  import { lglt2xyz } from "../../earth/utils";
@@ -19,6 +18,7 @@ import { lglt2xyz } from "../../earth/utils";
19
18
  var pointExtrudeFrag = "varying vec4 v_color;\nuniform float u_opacity: 1.0;\n\nuniform float u_pickLight: 0.0;\n\n#pragma include \"picking\"\n\n\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\nuniform float u_opacitylinear: 0.0;\nuniform float u_opacitylinear_dir: 1.0;\nvarying float v_lightWeight;\nvarying float v_barLinearZ;\nvoid main() {\n\n gl_FragColor = v_color;\n\n // \u5F00\u542F\u900F\u660E\u5EA6\u6E10\u53D8\n if(u_opacitylinear > 0.0) {\n gl_FragColor.a *= u_opacitylinear_dir > 0.0 ? (1.0 - v_barLinearZ): v_barLinearZ;\n }\n\n // picking\n if(u_pickLight > 0.0) {\n gl_FragColor = filterColorAlpha(gl_FragColor, v_lightWeight);\n } else {\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
20
19
  /* babel-plugin-inline-import '../shaders/earth/extrude_vert.glsl' */
21
20
  var pointExtrudeVert = "precision highp float;\n\n#define pi 3.1415926535\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec3 a_Position;\nattribute vec3 a_Pos;\nattribute vec4 a_Color;\nattribute vec3 a_Size;\nattribute vec3 a_Normal;\n\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_globel;\nuniform float u_r;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nvarying vec4 v_color;\n\nuniform float u_opacity : 1;\nuniform float u_lightEnable: 1;\nvarying float v_lightWeight;\nvarying float v_barLinearZ;\n// \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nfloat getYRadian(float x, float z) {\n if(x > 0.0 && z > 0.0) {\n return atan(x/z);\n } else if(x > 0.0 && z <= 0.0){\n return atan(-z/x) + pi/2.0;\n } else if(x <= 0.0 && z <= 0.0) {\n return pi + atan(x/z); //atan(x/z) + \n } else {\n return atan(z/-x) + pi*3.0/2.0;\n }\n}\n\nfloat getXRadian(float y, float r) {\n return atan(y/r);\n}\n\nvoid main() {\n\n \n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n vec3 size = a_Size * a_Position;\n\n // a_Position.z \u662F\u5728\u6784\u5EFA\u7F51\u683C\u7684\u65F6\u5019\u4F20\u5165\u7684\u6807\u51C6\u503C 0 - 1\uFF0C\u5728\u63D2\u503C\u5668\u63D2\u503C\u53EF\u4EE5\u83B7\u53D6 0\uFF5E1 \u7EBF\u6027\u6E10\u53D8\u7684\u503C\n v_barLinearZ = a_Position.z;\n\n vec3 offset = size; // \u63A7\u5236\u5706\u67F1\u4F53\u7684\u5927\u5C0F - \u4ECE\u6807\u51C6\u5355\u4F4D\u5706\u67F1\u4F53\u8FDB\u884C\u504F\u79FB\n if(u_heightfixed < 1.0) { // \u5706\u67F1\u4F53\u4E0D\u56FA\u5B9A\u9AD8\u5EA6\n \n if (u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {\n // P20 \u5750\u6807\u7CFB\u4E0B\uFF0C\u4E3A\u4E86\u548C Web \u58A8\u5361\u6258\u5750\u6807\u7CFB\u7EDF\u4E00\uFF0Czoom \u9ED8\u8BA4\u51CF1\n offset = offset * pow(2.0, (19.0 - u_Zoom));\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n // P20_2 \u5750\u6807\u7CFB\u4E0B\uFF0C\u4E3A\u4E86\u548C Web \u58A8\u5361\u6258\u5750\u6807\u7CFB\u7EDF\u4E00\uFF0Czoom \u9ED8\u8BA4\u51CF3\n offset = offset * pow(2.0, (19.0 - 3.0 - u_Zoom));\n }\n } else {// \u5706\u67F1\u4F53\u56FA\u5B9A\u9AD8\u5EA6 \uFF08 \u5904\u7406 mapbox \uFF09\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n offset *= 4.0/pow(2.0, 21.0 - u_Zoom);\n }\n }\n\n\n vec4 project_pos = project_position(vec4(a_Pos.xy, 0., 1.0));\n\n // u_r \u63A7\u5236\u5706\u67F1\u7684\u751F\u957F\n vec4 pos = vec4(project_pos.xy + offset.xy, offset.z * u_r, 1.0);\n\n // \u5706\u67F1\u5149\u7167\u6548\u679C\n float lightWeight = 1.0;\n if(u_lightEnable > 0.0) { // \u53D6\u6D88\u4E09\u5143\u8868\u8FBE\u5F0F\uFF0C\u589E\u5F3A\u5065\u58EE\u6027\n lightWeight = calc_lighting(pos);\n }\n v_lightWeight = lightWeight;\n // \u8BBE\u7F6E\u5706\u67F1\u7684\u5E95\u8272\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n v_color = mix(u_sourceColor, u_targetColor, barLinearZ);\n v_color.rgb *= lightWeight;\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n v_color = a_Color;\n }\n v_color.a *= u_opacity;\n\n \n // \u5728\u5730\u7403\u6A21\u5F0F\u4E0B\uFF0C\u5C06\u539F\u672C\u5782\u76F4\u4E8E xy \u5E73\u9762\u7684\u5706\u67F1\u8C03\u6574\u59FF\u6001\u5230\u9002\u5E94\u5706\u7684\u89D2\u5EA6\n //\u65CB\u8F6C\u77E9\u9635mx\uFF0C\u521B\u5EFA\u7ED5x\u8F74\u65CB\u8F6C\u77E9\u9635\n float r = sqrt(a_Pos.z*a_Pos.z + a_Pos.x*a_Pos.x);\n float xRadian = getXRadian(a_Pos.y, r);\n float xcos = cos(xRadian);//\u6C42\u89E3\u65CB\u8F6C\u89D2\u5EA6\u4F59\u5F26\u503C\n float xsin = sin(xRadian);//\u6C42\u89E3\u65CB\u8F6C\u89D2\u5EA6\u6B63\u5F26\u503C\n mat4 mx = mat4(\n 1,0,0,0, \n 0,xcos,-xsin,0, \n 0,xsin,xcos,0, \n 0,0,0,1);\n\n //\u65CB\u8F6C\u77E9\u9635my\uFF0C\u521B\u5EFA\u7ED5y\u8F74\u65CB\u8F6C\u77E9\u9635\n float yRadian = getYRadian(a_Pos.x, a_Pos.z);\n float ycos = cos(yRadian);//\u6C42\u89E3\u65CB\u8F6C\u89D2\u5EA6\u4F59\u5F26\u503C\n float ysin = sin(yRadian);//\u6C42\u89E3\u65CB\u8F6C\u89D2\u5EA6\u6B63\u5F26\u503C\n mat4 my = mat4(\n ycos,0,-ysin,0, \n 0,1,0,0, \n ysin,0,ycos,0, \n 0,0,0,1);\n\n gl_Position = u_ViewProjectionMatrix * vec4(( my * mx * vec4(a_Position * a_Size, 1.0)).xyz + a_Pos, 1.0);\n \n\n setPickingColor(a_PickingColor);\n}\n";
21
+ var isNumber = lodashUtil.isNumber;
22
22
  var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
23
23
  _inherits(ExtrudeModel, _BaseModel);
24
24
  var _super = _createSuper(ExtrudeModel);
@@ -9,12 +9,13 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
9
9
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
10
  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; } }
11
11
  import { AttributeType, gl } from '@antv/l7-core';
12
- import { isNumber } from 'lodash';
12
+ import { lodashUtil } from '@antv/l7-utils';
13
13
  import BaseModel from "../../core/BaseModel";
14
14
  /* babel-plugin-inline-import '../shaders/normal_frag.glsl' */
15
15
  var normalFrag = "varying vec4 v_color;\nvoid main() {\n gl_FragColor = v_color;\n}\n";
16
16
  /* babel-plugin-inline-import '../shaders/normal_vert.glsl' */
17
17
  var normalVert = "\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform float u_opacity : 1;\nuniform mat4 u_Mvp;\nattribute float a_Size;\nattribute vec4 a_Color;\n\nvarying vec4 v_color;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n\nvoid main() {\n v_color = vec4(a_Color.xyz, a_Color.w * u_opacity);\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(a_Position.xy, a_Position.z, 1.0);\n } else {\n vec4 project_pos = project_position(vec4(a_Position, 1.0)) + vec4(a_Size / 2.,-a_Size /2.,0.,0.);\n gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy),project_pos.z,project_pos.w));\n }\n\n gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;\n}\n";
18
+ var isNumber = lodashUtil.isNumber;
18
19
  export function PointTriangulation(feature) {
19
20
  var coordinates = feature.coordinates;
20
21
  return {
@@ -15,8 +15,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
15
15
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
16
16
  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; } }
17
17
  import { AttributeType, gl } from '@antv/l7-core';
18
- import { boundsContains, calculateCentroid, padBounds, rgb2arr } from '@antv/l7-utils';
19
- import { isEqual } from 'lodash';
18
+ import { boundsContains, calculateCentroid, lodashUtil, padBounds, rgb2arr } from '@antv/l7-utils';
20
19
  import BaseModel from "../../core/BaseModel";
21
20
  import CollisionIndex from "../../utils/collision-index";
22
21
  import { getGlyphQuads, shapeText } from "../../utils/symbol-layout";
@@ -24,6 +23,7 @@ import { getGlyphQuads, shapeText } from "../../utils/symbol-layout";
24
23
  var textFrag = "#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105\n#define FONT_SIZE 48.0\nuniform sampler2D u_sdf_map;\nuniform float u_gamma_scale : 0.5;\nuniform float u_stroke_width : 2.0;\nuniform float u_halo_blur : 0.5;\nuniform float u_DevicePixelRatio;\n\nvarying vec4 v_color;\nvarying vec4 v_stroke_color;\nvarying vec2 v_uv;\nvarying float v_gamma_scale;\nvarying float v_fontScale;\n\n\n#pragma include \"picking\"\nvoid main() {\n // get style data mapping\n\n // get sdf from atlas\n float dist = texture2D(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 gl_FragColor = mix(v_color, v_stroke_color, smoothstep(0., 0.5, 1.- dist));\n\n gl_FragColor.a *= alpha;\n // \u4F5C\u4E3A mask \u6A21\u677F\u65F6\u9700\u8981\u4E22\u5F03\u900F\u660E\u7684\u50CF\u7D20\n if (gl_FragColor.a < 0.01) {\n discard;\n }\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
25
24
  /* babel-plugin-inline-import '../shaders/text_vert.glsl' */
26
25
  var textVert = "#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105\n#define FONT_SIZE 24.0\nattribute vec3 a_Position;\nattribute vec2 a_tex;\nattribute vec2 a_textOffsets;\nattribute vec4 a_Color;\nattribute float a_Size;\nattribute float a_Rotate;\n\nuniform vec2 u_sdf_map_size;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_raisingHeight: 0.0;\n\nvarying vec2 v_uv;\nvarying float v_gamma_scale;\nvarying vec4 v_color;\nvarying vec4 v_stroke_color;\nvarying float v_fontScale;\n// uniform float u_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\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 v_uv = a_tex / u_sdf_map_size;\n\n\n\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n v_stroke_color = vec4(u_stroke_color.xyz, u_stroke_color.w * opacity);\n\n // \u6587\u672C\u7F29\u653E\u6BD4\u4F8B\n float fontScale = a_Size / FONT_SIZE;\n v_fontScale = fontScale;\n\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // vec4 projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n highp float angle_sin = sin(a_Rotate);\n highp float angle_cos = cos(a_Rotate);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n \n // gl_Position = vec4(projected_position.xy / projected_position.w + rotation_matrix * a_textOffsets * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);\n\n float raiseHeight = 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 raiseHeight = u_raisingHeight * mapboxZoomScale;\n }\n\n vec4 projected_position;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n projected_position = u_Mvp *(vec4(a_Position.xyz + vec3(0.0, 0.0, raiseHeight), 1.0));\n } else { // else\n projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz + vec3(0.0, 0.0, raiseHeight), 1.0));\n }\n\n gl_Position = vec4(\n projected_position.xy / projected_position.w + rotation_matrix * a_textOffsets * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);\n v_gamma_scale = gl_Position.w;\n setPickingColor(a_PickingColor);\n\n}\n";
26
+ var isEqual = lodashUtil.isEqual;
27
27
  export function TextTrianglation(feature) {
28
28
  // @ts-ignore
29
29
  var that = this;
@@ -10,14 +10,14 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
10
10
  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; } }
11
11
  import { AttributeType, gl } from '@antv/l7-core';
12
12
  import { Version } from '@antv/l7-maps';
13
- import { rgb2arr } from '@antv/l7-utils';
14
- import { isNumber } from 'lodash';
13
+ import { lodashUtil, rgb2arr } from '@antv/l7-utils';
15
14
  import BaseModel from "../../core/BaseModel";
16
15
  import { polygonTriangulation } from "../../core/triangulation";
17
16
  /* babel-plugin-inline-import '../shaders/water/polygon_ocean_frag.glsl' */
18
17
  var ocean_frag = "\nuniform float u_time: 0.0;\nuniform float u_opacity: 1.0;\n\nvarying vec2 v_uv;\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// vec3 watercolor = vec3(0.43, 0.60, 0.66); // 'transparent' low-water color (RGB)\n// vec3 watercolor2 = vec3(0.06, 0.07, 0.11); // deep-water color (RGB, should be darker than the low-water color)\nuniform vec4 u_watercolor;\nuniform vec4 u_watercolor2;\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 texture2D(u_texture2,p*vec2(1./256.)).x;\n}\n\nvec4 highness(vec2 p) {\n vec4 t = texture2D(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)+texture2D(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\n float opacity = u_opacity;\n gl_FragColor = vec4(col, opacity); \n}\n";
19
18
  /* babel-plugin-inline-import '../shaders/water/polygon_ocean_vert.glsl' */
20
19
  var ocean_vert = "attribute vec2 a_uv;\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\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\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}\n\n";
20
+ var isNumber = lodashUtil.isNumber;
21
21
  var OceanModel = /*#__PURE__*/function (_BaseModel) {
22
22
  _inherits(OceanModel, _BaseModel);
23
23
  var _super = _createSuper(OceanModel);
@@ -10,13 +10,14 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
10
10
  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; } }
11
11
  import { AttributeType, gl } from '@antv/l7-core';
12
12
  import { Version } from '@antv/l7-maps';
13
- import { isNumber } from 'lodash';
13
+ import { lodashUtil } from '@antv/l7-utils';
14
14
  import BaseModel from "../../core/BaseModel";
15
15
  import { polygonTriangulation } from "../../core/triangulation";
16
16
  /* babel-plugin-inline-import '../shaders/water/polygon_water_frag.glsl' */
17
17
  var water_frag = "uniform sampler2D u_texture;\nuniform float u_time: 0.0;\nuniform float u_speed: 1.0;\nuniform float u_opacity: 1.0;\n\nvarying vec4 v_Color;\nvarying vec2 v_uv;\n\nfloat rand(vec2 n) { return 0.5 + 0.5 * fract(sin(dot(n.xy, vec2(12.9898, 78.233)))* 43758.5453); }\n\nfloat water(vec3 p) {\n float t = u_time * u_speed;\n p.z += t * 2.; p.x += t * 2.;\n vec3 c1 = texture2D(u_texture, p.xz / 30.).xyz;\n p.z += t * 3.; p.x += t * 0.52;\n vec3 c2 = texture2D(u_texture, p.xz / 30.).xyz;\n p.z += t * 4.; p.x += t * 0.8;\n vec3 c3 = texture2D(u_texture, p.xz / 30.).xyz;\n c1 += c2 - c3;\n float z = (c1.x + c1.y + c1.z) / 3.;\n return p.y + z / 4.;\n}\n\nfloat map(vec3 p) {\n float d = 100.0;\n d = water(p);\n return d;\n}\n\nfloat intersect(vec3 ro, vec3 rd) {\n float d = 0.0;\n for (int i = 0; i <= 100; i++) {\n float h = map(ro + rd * d);\n if (h < 0.1) return d;\n d += h;\n }\n return 0.0;\n}\n\nvec3 norm(vec3 p) {\n float eps = .1;\n return normalize(vec3(\n map(p + vec3(eps, 0, 0)) - map(p + vec3(-eps, 0, 0)),\n map(p + vec3(0, eps, 0)) - map(p + vec3(0, -eps, 0)),\n map(p + vec3(0, 0, eps)) - map(p + vec3(0, 0, -eps))\n ));\n} \n\nfloat calSpc() {\n vec3 l1 = normalize(vec3(1, 1, 1));\n vec3 ro = vec3(-3, 20, -8);\n vec3 rc = vec3(0, 0, 0);\n vec3 ww = normalize(rc - ro);\n vec3 uu = normalize(cross(vec3(0,1,0), ww));\n vec3 vv = normalize(cross(rc - ro, uu));\n vec3 rd = normalize(uu * v_uv.x + vv * v_uv.y + ww);\n float d = intersect(ro, rd);\n vec3 p = ro + rd * d;\n vec3 n = norm(p);\n float spc = pow(max(0.0, dot(reflect(l1, n), rd)), 30.0);\n return spc;\n}\n\nvoid main() {\n float opacity = u_opacity;\n gl_FragColor = v_Color;\n gl_FragColor.a *= opacity;\n\n float spc = calSpc();\n gl_FragColor += spc * 0.4;\n}\n";
18
18
  /* babel-plugin-inline-import '../shaders/water/polygon_water_vert.glsl' */
19
19
  var water_vert = "attribute vec4 a_Color;\nattribute vec2 a_uv;\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\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 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}\n\n";
20
+ var isNumber = lodashUtil.isNumber;
20
21
  var WaterModel = /*#__PURE__*/function (_BaseModel) {
21
22
  _inherits(WaterModel, _BaseModel);
22
23
  var _super = _createSuper(WaterModel);
@@ -83,7 +83,6 @@ export default abstract class Tile implements ITile {
83
83
  map?: import("@antv/l7-core").IMapWrapper | undefined;
84
84
  logoPosition?: import("@antv/l7-core").PositionName | undefined;
85
85
  logoVisible?: boolean | undefined;
86
- isMini?: boolean | undefined;
87
86
  animate?: boolean | undefined;
88
87
  pickBufferScale?: number | undefined;
89
88
  stencil?: boolean | undefined;
@@ -4,11 +4,12 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
4
4
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
5
  import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  import { TYPES } from '@antv/l7-core';
7
- import { debounce } from 'lodash';
7
+ import { lodashUtil } from '@antv/l7-utils';
8
8
  import { TileLayerService } from "../service/TileLayerService";
9
9
  import { TilePickService } from "../service/TilePickService";
10
10
  import { ProxyFuncs } from "../style/constants";
11
11
  import { getTileFactory } from "../tileFactory";
12
+ var debounce = lodashUtil.debounce;
12
13
  var BaseTileLayer = /*#__PURE__*/function () {
13
14
  // 瓦片是否加载成功
14
15
 
@@ -1,7 +1,7 @@
1
1
  import { Version } from '@antv/l7-maps';
2
2
  import Source from '@antv/l7-source';
3
- import { normalize, rgb2arr } from '@antv/l7-utils';
4
- import { cloneDeep } from 'lodash';
3
+ import { lodashUtil, normalize, rgb2arr } from '@antv/l7-utils';
4
+ var cloneDeep = lodashUtil.cloneDeep;
5
5
  function getArrowPoints(p1, p2) {
6
6
  var dir = [p2[0] - p1[0], p2[1] - p1[1]];
7
7
  var normalizeDir = normalize(dir);