@antv/l7-layers 2.20.19 → 2.21.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 (116) hide show
  1. package/es/canvas/index.d.ts +13 -8
  2. package/es/canvas/index.js +63 -36
  3. package/es/canvas/models/canvas.d.ts +19 -14
  4. package/es/canvas/models/canvas.js +125 -139
  5. package/es/canvas/models/constants.d.ts +2 -0
  6. package/es/canvas/models/constants.js +6 -0
  7. package/es/canvas/models/index.d.ts +2 -5
  8. package/es/canvas/models/index.js +2 -5
  9. package/es/core/BaseLayer.d.ts +17 -19
  10. package/es/core/BaseLayer.js +88 -62
  11. package/es/core/BaseModel.js +15 -29
  12. package/es/core/LayerPickService.js +4 -5
  13. package/es/core/TextureService.js +1 -2
  14. package/es/core/interface.d.ts +31 -4
  15. package/es/core/shape/arrow.js +2 -6
  16. package/es/heatmap/models/heatmap.d.ts +0 -1
  17. package/es/heatmap/models/heatmap.js +2 -5
  18. package/es/index.d.ts +2 -1
  19. package/es/index.js +2 -89
  20. package/es/line/models/arc.js +5 -5
  21. package/es/line/models/arc_3d.js +4 -3
  22. package/es/line/models/great_circle.js +4 -4
  23. package/es/line/models/line.js +5 -8
  24. package/es/line/models/simple_line.js +1 -2
  25. package/es/line/models/wall.js +4 -3
  26. package/es/plugins/DataMappingPlugin.d.ts +4 -7
  27. package/es/plugins/DataMappingPlugin.js +8 -23
  28. package/es/plugins/DataSourcePlugin.d.ts +0 -1
  29. package/es/plugins/DataSourcePlugin.js +4 -7
  30. package/es/plugins/FeatureScalePlugin.d.ts +2 -5
  31. package/es/plugins/FeatureScalePlugin.js +4 -6
  32. package/es/plugins/LayerAnimateStylePlugin.d.ts +0 -1
  33. package/es/plugins/LayerAnimateStylePlugin.js +2 -5
  34. package/es/plugins/LayerMaskPlugin.d.ts +0 -1
  35. package/es/plugins/LayerMaskPlugin.js +2 -8
  36. package/es/plugins/LayerModelPlugin.d.ts +0 -1
  37. package/es/plugins/LayerModelPlugin.js +13 -18
  38. package/es/plugins/LayerStylePlugin.d.ts +0 -1
  39. package/es/plugins/LayerStylePlugin.js +2 -5
  40. package/es/plugins/LightingPlugin.d.ts +0 -1
  41. package/es/plugins/LightingPlugin.js +2 -5
  42. package/es/plugins/MultiPassRendererPlugin.d.ts +0 -1
  43. package/es/plugins/MultiPassRendererPlugin.js +2 -5
  44. package/es/plugins/PixelPickingPlugin.d.ts +2 -6
  45. package/es/plugins/PixelPickingPlugin.js +4 -9
  46. package/es/plugins/RegisterStyleAttributePlugin.d.ts +2 -5
  47. package/es/plugins/RegisterStyleAttributePlugin.js +2 -5
  48. package/es/plugins/ShaderUniformPlugin.d.ts +7 -8
  49. package/es/plugins/ShaderUniformPlugin.js +16 -42
  50. package/es/plugins/UpdateModelPlugin.d.ts +0 -1
  51. package/es/plugins/UpdateModelPlugin.js +2 -5
  52. package/es/plugins/UpdateStyleAttributePlugin.d.ts +2 -5
  53. package/es/plugins/UpdateStyleAttributePlugin.js +2 -6
  54. package/es/plugins/index.d.ts +15 -0
  55. package/es/plugins/index.js +18 -0
  56. package/es/point/models/fill.d.ts +1 -1
  57. package/es/point/models/fill.js +6 -9
  58. package/es/point/models/fillImage.js +4 -3
  59. package/es/point/models/image.js +4 -3
  60. package/es/polygon/models/extrude.js +0 -1
  61. package/es/polygon/models/ocean.js +1 -2
  62. package/es/polygon/models/water.js +0 -2
  63. package/es/tile/core/BaseLayer.js +4 -5
  64. package/es/tile/interaction/getRasterData.js +4 -16
  65. package/es/tile/service/TileLayerService.d.ts +0 -1
  66. package/es/tile/service/TileLayerService.js +0 -1
  67. package/es/tile/service/TilePickService.d.ts +1 -1
  68. package/es/tile/service/TilePickService.js +2 -3
  69. package/es/tile/tile/Tile.js +8 -6
  70. package/es/tile/utils/utils.d.ts +0 -4
  71. package/es/tile/utils/utils.js +0 -11
  72. package/lib/canvas/index.js +63 -37
  73. package/lib/canvas/models/canvas.js +125 -138
  74. package/lib/canvas/models/constants.js +12 -0
  75. package/lib/canvas/models/index.js +22 -7
  76. package/lib/core/BaseLayer.js +88 -62
  77. package/lib/core/BaseModel.js +14 -28
  78. package/lib/core/LayerPickService.js +4 -5
  79. package/lib/core/TextureService.js +1 -2
  80. package/lib/core/shape/arrow.js +2 -6
  81. package/lib/heatmap/models/heatmap.js +2 -5
  82. package/lib/index.js +9 -90
  83. package/lib/line/models/arc.js +4 -4
  84. package/lib/line/models/arc_3d.js +4 -3
  85. package/lib/line/models/great_circle.js +4 -4
  86. package/lib/line/models/line.js +5 -8
  87. package/lib/line/models/simple_line.js +0 -1
  88. package/lib/line/models/wall.js +4 -3
  89. package/lib/plugins/DataMappingPlugin.js +7 -22
  90. package/lib/plugins/DataSourcePlugin.js +3 -6
  91. package/lib/plugins/FeatureScalePlugin.js +4 -6
  92. package/lib/plugins/LayerAnimateStylePlugin.js +2 -5
  93. package/lib/plugins/LayerMaskPlugin.js +2 -8
  94. package/lib/plugins/LayerModelPlugin.js +13 -18
  95. package/lib/plugins/LayerStylePlugin.js +2 -5
  96. package/lib/plugins/LightingPlugin.js +2 -5
  97. package/lib/plugins/MultiPassRendererPlugin.js +2 -5
  98. package/lib/plugins/PixelPickingPlugin.js +4 -9
  99. package/lib/plugins/RegisterStyleAttributePlugin.js +2 -5
  100. package/lib/plugins/ShaderUniformPlugin.js +15 -41
  101. package/lib/plugins/UpdateModelPlugin.js +2 -5
  102. package/lib/plugins/UpdateStyleAttributePlugin.js +2 -5
  103. package/lib/plugins/index.js +26 -0
  104. package/lib/point/models/fill.js +6 -9
  105. package/lib/point/models/fillImage.js +4 -3
  106. package/lib/point/models/image.js +4 -3
  107. package/lib/polygon/models/extrude.js +0 -1
  108. package/lib/polygon/models/ocean.js +0 -1
  109. package/lib/polygon/models/water.js +0 -2
  110. package/lib/tile/core/BaseLayer.js +4 -5
  111. package/lib/tile/interaction/getRasterData.js +4 -16
  112. package/lib/tile/service/TileLayerService.js +0 -1
  113. package/lib/tile/service/TilePickService.js +2 -3
  114. package/lib/tile/tile/Tile.js +8 -6
  115. package/lib/tile/utils/utils.js +0 -12
  116. package/package.json +18 -20
@@ -1,5 +1,4 @@
1
1
  import type { ILayer, ILayerPlugin } from '@antv/l7-core';
2
- import 'reflect-metadata';
3
2
  interface IDirectionalLight {
4
3
  type: 'directional';
5
4
  direction: [number, number, number];
@@ -2,10 +2,7 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
4
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
5
- var _dec, _class;
6
5
  var _excluded = ["type"];
7
- import { injectable } from 'inversify';
8
- import 'reflect-metadata';
9
6
  var lightTypeUniformMap = {
10
7
  directional: {
11
8
  lights: 'u_DirectionalLights',
@@ -72,7 +69,7 @@ export function generateLightingUniforms(lights) {
72
69
  /**
73
70
  * 光照 & Shadow
74
71
  */
75
- var LightingPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function () {
72
+ var LightingPlugin = /*#__PURE__*/function () {
76
73
  function LightingPlugin() {
77
74
  _classCallCheck(this, LightingPlugin);
78
75
  }
@@ -94,5 +91,5 @@ var LightingPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (
94
91
  }
95
92
  }]);
96
93
  return LightingPlugin;
97
- }()) || _class);
94
+ }();
98
95
  export { LightingPlugin as default };
@@ -1,5 +1,4 @@
1
1
  import type { ILayer, ILayerPlugin, IPass, IPostProcessingPass, IRendererService } from '@antv/l7-core';
2
- import 'reflect-metadata';
3
2
  /**
4
3
  * 自定义渲染管线:
5
4
  * ClearPass -> PixelPickingPass(可选) -> RenderPass/TAAPass -> PostProcessing -> CopyPass
@@ -1,8 +1,5 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- var _dec, _class;
4
- import { injectable } from 'inversify';
5
- import 'reflect-metadata';
6
3
  import { createMultiPassRenderer } from "../utils/multiPassRender";
7
4
 
8
5
  /**
@@ -18,7 +15,7 @@ import { createMultiPassRenderer } from "../utils/multiPassRender";
18
15
  * ],
19
16
  * })
20
17
  */
21
- var MultiPassRendererPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function () {
18
+ var MultiPassRendererPlugin = /*#__PURE__*/function () {
22
19
  function MultiPassRendererPlugin() {
23
20
  _classCallCheck(this, MultiPassRendererPlugin);
24
21
  }
@@ -56,5 +53,5 @@ var MultiPassRendererPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/f
56
53
  }
57
54
  }]);
58
55
  return MultiPassRendererPlugin;
59
- }()) || _class);
56
+ }();
60
57
  export { MultiPassRendererPlugin as default };
@@ -1,5 +1,4 @@
1
- import type { ILayer, ILayerPlugin, IRendererService, IStyleAttributeService } from '@antv/l7-core';
2
- import 'reflect-metadata';
1
+ import type { ILayer, ILayerPlugin, L7Container } from '@antv/l7-core';
3
2
  export default class PixelPickingPlugin implements ILayerPlugin {
4
3
  /**
5
4
  * Use map to keep order of insertion.
@@ -8,8 +7,5 @@ export default class PixelPickingPlugin implements ILayerPlugin {
8
7
  private pickingUniformMap;
9
8
  private pickOption2Array;
10
9
  private updatePickOption;
11
- apply(layer: ILayer, { rendererService, styleAttributeService, }: {
12
- rendererService: IRendererService;
13
- styleAttributeService: IStyleAttributeService;
14
- }): void;
10
+ apply(layer: ILayer, { styleAttributeService }: L7Container): void;
15
11
  }
@@ -1,11 +1,8 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
4
- var _dec, _class;
5
4
  import { AttributeType, gl } from '@antv/l7-core';
6
5
  import { decodePickingColor, encodePickingColor, lodashUtil, rgb2arr } from '@antv/l7-utils';
7
- import { injectable } from 'inversify';
8
- import 'reflect-metadata';
9
6
  import { ShaderLocation } from "../core/CommonStyleAttribute";
10
7
  var isNumber = lodashUtil.isNumber;
11
8
  var PickingStage = {
@@ -13,7 +10,7 @@ var PickingStage = {
13
10
  ENCODE: 1.0,
14
11
  HIGHLIGHT: 2.0
15
12
  };
16
- var PixelPickingPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function () {
13
+ var PixelPickingPlugin = /*#__PURE__*/function () {
17
14
  function PixelPickingPlugin() {
18
15
  _classCallCheck(this, PixelPickingPlugin);
19
16
  }
@@ -27,7 +24,7 @@ var PixelPickingPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
27
24
 
28
25
  function pickOption2Array() {
29
26
  var array = [];
30
- this.pickingUniformMap.forEach(function (value, key) {
27
+ this.pickingUniformMap.forEach(function (value) {
31
28
  if (isNumber(value)) {
32
29
  array.push(value);
33
30
  } else {
@@ -58,9 +55,7 @@ var PixelPickingPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
58
55
  key: "apply",
59
56
  value: function apply(layer, _ref) {
60
57
  var _this2 = this;
61
- var rendererService = _ref.rendererService,
62
- styleAttributeService = _ref.styleAttributeService;
63
- var uniformBuffer;
58
+ var styleAttributeService = _ref.styleAttributeService;
64
59
  this.pickingUniformMap = new Map([['u_HighlightColor', [1, 0, 0, 1]], ['u_SelectColor', [1, 0, 0, 1]], ['u_PickingColor', [0, 0, 0]], ['u_PickingStage', 0], ['u_CurrentSelectedId', [0, 0, 0]], ['u_PickingThreshold', 10], ['u_PickingBuffer', 0], ['u_shaderPick', 0], ['u_EnableSelect', 0], ['u_activeMix', 0]]);
65
60
 
66
61
  // TODO: 由于 Shader 目前无法根据是否开启拾取进行内容修改,因此即使不开启也需要生成 a_PickingColor
@@ -169,5 +164,5 @@ var PixelPickingPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
169
164
  }
170
165
  }]);
171
166
  return PixelPickingPlugin;
172
- }()) || _class);
167
+ }();
173
168
  export { PixelPickingPlugin as default };
@@ -1,12 +1,9 @@
1
- import type { ILayer, ILayerPlugin, IStyleAttributeService } from '@antv/l7-core';
2
- import 'reflect-metadata';
1
+ import type { ILayer, ILayerPlugin, L7Container } from '@antv/l7-core';
3
2
  /**
4
3
  * 在初始化阶段完成属性的注册,以及首次根据 Layer 指定的三角化方法完成 indices 和 attribute 的创建
5
4
  */
6
5
  export default class RegisterStyleAttributePlugin implements ILayerPlugin {
7
- apply(layer: ILayer, { styleAttributeService, }: {
8
- styleAttributeService: IStyleAttributeService;
9
- }): void;
6
+ apply(layer: ILayer, { styleAttributeService }: L7Container): void;
10
7
  private registerBuiltinAttributes;
11
8
  private registerPositionAttribute;
12
9
  private registerColorAttribute;
@@ -1,16 +1,13 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- var _dec, _class;
4
3
  import { AttributeType, gl } from '@antv/l7-core';
5
- import { injectable } from 'inversify';
6
- import 'reflect-metadata';
7
4
  import { ShaderLocation } from "../core/CommonStyleAttribute";
8
5
  import { isTileGroup } from "../tile/utils/utils";
9
6
 
10
7
  /**
11
8
  * 在初始化阶段完成属性的注册,以及首次根据 Layer 指定的三角化方法完成 indices 和 attribute 的创建
12
9
  */
13
- var RegisterStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function () {
10
+ var RegisterStyleAttributePlugin = /*#__PURE__*/function () {
14
11
  function RegisterStyleAttributePlugin() {
15
12
  _classCallCheck(this, RegisterStyleAttributePlugin);
16
13
  }
@@ -109,5 +106,5 @@ var RegisterStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE
109
106
  }
110
107
  }]);
111
108
  return RegisterStyleAttributePlugin;
112
- }()) || _class);
109
+ }();
113
110
  export { RegisterStyleAttributePlugin as default };
@@ -1,5 +1,4 @@
1
- import type { ILayer, ILayerPlugin } from '@antv/l7-core';
2
- import 'reflect-metadata';
1
+ import type { ILayer, ILayerPlugin, L7Container } from '@antv/l7-core';
3
2
  /**
4
3
  * 在渲染之前需要获取当前 Shader 所需 Uniform,例如:
5
4
  * 1. 从相机服务中获取 View & ProjectionMatrix,当前缩放等级等等
@@ -8,12 +7,12 @@ import 'reflect-metadata';
8
7
  * 3. 当前 Layer 本身的样式属性
9
8
  */
10
9
  export default class ShaderUniformPlugin implements ILayerPlugin {
11
- private readonly cameraService;
12
- private readonly coordinateSystemService;
13
- private readonly rendererService;
14
- private readonly mapService;
15
- private readonly layerService;
16
- apply(layer: ILayer): void;
10
+ private cameraService;
11
+ private coordinateSystemService;
12
+ private rendererService;
13
+ private mapService;
14
+ private layerService;
15
+ apply(layer: ILayer, { rendererService, mapService, layerService, coordinateSystemService, cameraService, }: L7Container): void;
17
16
  /**
18
17
  * 对于每个 layer 都有不同的几何中心点,因此在绘制每个 layer 的时候都需要重新设置
19
18
  * @param layer
@@ -1,15 +1,9 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
1
2
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
3
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
- import _initializerDefineProperty from "@babel/runtime/helpers/esm/initializerDefineProperty";
4
4
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
5
5
  import _createClass from "@babel/runtime/helpers/esm/createClass";
6
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
- import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
8
- import _initializerWarningHelper from "@babel/runtime/helpers/esm/initializerWarningHelper";
9
- var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5;
10
- import { CameraUniform, CoordinateUniform, TYPES } from '@antv/l7-core';
11
- import { inject, injectable } from 'inversify';
12
- import 'reflect-metadata';
6
+ import { CameraUniform, CoordinateUniform } from '@antv/l7-core';
13
7
 
14
8
  /**
15
9
  * 在渲染之前需要获取当前 Shader 所需 Uniform,例如:
@@ -18,19 +12,24 @@ import 'reflect-metadata';
18
12
  * @see https://yuque.antfin-inc.com/yuqi.pyq/fgetpa/doml91
19
13
  * 3. 当前 Layer 本身的样式属性
20
14
  */
21
- var ShaderUniformPlugin = (_dec = injectable(), _dec2 = inject(TYPES.ICameraService), _dec3 = inject(TYPES.ICoordinateSystemService), _dec4 = inject(TYPES.IRendererService), _dec5 = inject(TYPES.IMapService), _dec6 = inject(TYPES.ILayerService), _dec(_class = (_class2 = /*#__PURE__*/function () {
15
+ var ShaderUniformPlugin = /*#__PURE__*/function () {
22
16
  function ShaderUniformPlugin() {
23
17
  _classCallCheck(this, ShaderUniformPlugin);
24
- _initializerDefineProperty(this, "cameraService", _descriptor, this);
25
- _initializerDefineProperty(this, "coordinateSystemService", _descriptor2, this);
26
- _initializerDefineProperty(this, "rendererService", _descriptor3, this);
27
- _initializerDefineProperty(this, "mapService", _descriptor4, this);
28
- _initializerDefineProperty(this, "layerService", _descriptor5, this);
29
18
  }
30
19
  _createClass(ShaderUniformPlugin, [{
31
20
  key: "apply",
32
- value: function apply(layer) {
21
+ value: function apply(layer, _ref) {
33
22
  var _this = this;
23
+ var rendererService = _ref.rendererService,
24
+ mapService = _ref.mapService,
25
+ layerService = _ref.layerService,
26
+ coordinateSystemService = _ref.coordinateSystemService,
27
+ cameraService = _ref.cameraService;
28
+ this.rendererService = rendererService;
29
+ this.mapService = mapService;
30
+ this.layerService = layerService;
31
+ this.coordinateSystemService = coordinateSystemService;
32
+ this.cameraService = cameraService;
34
33
  var version = this.mapService.version;
35
34
  var mvp = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; // default matrix (for gaode2.x)
36
35
  var sceneCenterMercator = [0, 0];
@@ -76,7 +75,7 @@ var ShaderUniformPlugin = (_dec = injectable(), _dec2 = inject(TYPES.ICameraServ
76
75
  });
77
76
  }
78
77
 
79
- // For WebGL1. regl
78
+ // For WebGL1. regl
80
79
  var platformString = _this.rendererService.queryVerdorInfo();
81
80
  if (platformString === 'WebGL1') {
82
81
  layer.models.forEach(function (model) {
@@ -145,30 +144,5 @@ var ShaderUniformPlugin = (_dec = injectable(), _dec2 = inject(TYPES.ICameraServ
145
144
  }
146
145
  }]);
147
146
  return ShaderUniformPlugin;
148
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "cameraService", [_dec2], {
149
- configurable: true,
150
- enumerable: true,
151
- writable: true,
152
- initializer: null
153
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "coordinateSystemService", [_dec3], {
154
- configurable: true,
155
- enumerable: true,
156
- writable: true,
157
- initializer: null
158
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "rendererService", [_dec4], {
159
- configurable: true,
160
- enumerable: true,
161
- writable: true,
162
- initializer: null
163
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "mapService", [_dec5], {
164
- configurable: true,
165
- enumerable: true,
166
- writable: true,
167
- initializer: null
168
- }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "layerService", [_dec6], {
169
- configurable: true,
170
- enumerable: true,
171
- writable: true,
172
- initializer: null
173
- })), _class2)) || _class);
147
+ }();
174
148
  export { ShaderUniformPlugin as default };
@@ -1,5 +1,4 @@
1
1
  import type { ILayer, ILayerPlugin } from '@antv/l7-core';
2
- import 'reflect-metadata';
3
2
  /**
4
3
  * Model 更新
5
4
  */
@@ -1,12 +1,9 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- var _dec, _class;
4
- import { injectable } from 'inversify';
5
- import 'reflect-metadata';
6
3
  /**
7
4
  * Model 更新
8
5
  */
9
- var UpdateModelPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function () {
6
+ var UpdateModelPlugin = /*#__PURE__*/function () {
10
7
  function UpdateModelPlugin() {
11
8
  _classCallCheck(this, UpdateModelPlugin);
12
9
  }
@@ -29,5 +26,5 @@ var UpdateModelPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functio
29
26
  }
30
27
  }]);
31
28
  return UpdateModelPlugin;
32
- }()) || _class);
29
+ }();
33
30
  export { UpdateModelPlugin as default };
@@ -1,12 +1,9 @@
1
- import type { ILayer, ILayerPlugin, IStyleAttributeService } from '@antv/l7-core';
2
- import 'reflect-metadata';
1
+ import type { ILayer, ILayerPlugin, L7Container } from '@antv/l7-core';
3
2
  /**
4
3
  * 在初始化阶段完成属性的注册,以及首次根据 Layer 指定的三角化方法完成 indices 和 attribute 的创建
5
4
  */
6
5
  export default class UpdateStyleAttributePlugin implements ILayerPlugin {
7
- apply(layer: ILayer, { styleAttributeService, }: {
8
- styleAttributeService: IStyleAttributeService;
9
- }): void;
6
+ apply(layer: ILayer, { styleAttributeService }: L7Container): void;
10
7
  private updateStyleAttribute;
11
8
  private initStyleAttribute;
12
9
  }
@@ -1,13 +1,9 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- var _dec, _class;
4
- import { injectable } from 'inversify';
5
- import 'reflect-metadata';
6
-
7
3
  /**
8
4
  * 在初始化阶段完成属性的注册,以及首次根据 Layer 指定的三角化方法完成 indices 和 attribute 的创建
9
5
  */
10
- var UpdateStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function () {
6
+ var UpdateStyleAttributePlugin = /*#__PURE__*/function () {
11
7
  function UpdateStyleAttributePlugin() {
12
8
  _classCallCheck(this, UpdateStyleAttributePlugin);
13
9
  }
@@ -72,5 +68,5 @@ var UpdateStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__
72
68
  }
73
69
  }]);
74
70
  return UpdateStyleAttributePlugin;
75
- }()) || _class);
71
+ }();
76
72
  export { UpdateStyleAttributePlugin as default };
@@ -0,0 +1,15 @@
1
+ import DataMappingPlugin from './DataMappingPlugin';
2
+ import DataSourcePlugin from './DataSourcePlugin';
3
+ import FeatureScalePlugin from './FeatureScalePlugin';
4
+ import LayerAnimateStylePlugin from './LayerAnimateStylePlugin';
5
+ import LayerMaskPlugin from './LayerMaskPlugin';
6
+ import LayerModelPlugin from './LayerModelPlugin';
7
+ import LayerStylePlugin from './LayerStylePlugin';
8
+ import LightingPlugin from './LightingPlugin';
9
+ import MultiPassRendererPlugin from './MultiPassRendererPlugin';
10
+ import PixelPickingPlugin from './PixelPickingPlugin';
11
+ import RegisterStyleAttributePlugin from './RegisterStyleAttributePlugin';
12
+ import ShaderUniformPlugin from './ShaderUniformPlugin';
13
+ import UpdateModelPlugin from './UpdateModelPlugin';
14
+ import UpdateStyleAttributePlugin from './UpdateStyleAttributePlugin';
15
+ export declare function createPlugins(): (DataMappingPlugin | DataSourcePlugin | FeatureScalePlugin | LayerAnimateStylePlugin | LayerMaskPlugin | LayerModelPlugin | LayerStylePlugin | LightingPlugin | MultiPassRendererPlugin | PixelPickingPlugin | RegisterStyleAttributePlugin | ShaderUniformPlugin | UpdateModelPlugin | UpdateStyleAttributePlugin)[];
@@ -0,0 +1,18 @@
1
+ // import ConfigSchemaValidationPlugin from './ConfigSchemaValidationPlugin';
2
+ import DataMappingPlugin from "./DataMappingPlugin";
3
+ import DataSourcePlugin from "./DataSourcePlugin";
4
+ import FeatureScalePlugin from "./FeatureScalePlugin";
5
+ import LayerAnimateStylePlugin from "./LayerAnimateStylePlugin";
6
+ import LayerMaskPlugin from "./LayerMaskPlugin";
7
+ import LayerModelPlugin from "./LayerModelPlugin";
8
+ import LayerStylePlugin from "./LayerStylePlugin";
9
+ import LightingPlugin from "./LightingPlugin";
10
+ import MultiPassRendererPlugin from "./MultiPassRendererPlugin";
11
+ import PixelPickingPlugin from "./PixelPickingPlugin";
12
+ import RegisterStyleAttributePlugin from "./RegisterStyleAttributePlugin";
13
+ import ShaderUniformPlugin from "./ShaderUniformPlugin";
14
+ import UpdateModelPlugin from "./UpdateModelPlugin";
15
+ import UpdateStyleAttributePlugin from "./UpdateStyleAttributePlugin";
16
+ export function createPlugins() {
17
+ return [new DataSourcePlugin(), new RegisterStyleAttributePlugin(), new FeatureScalePlugin(), new DataMappingPlugin(), new LayerStylePlugin(), new LayerMaskPlugin(), new UpdateStyleAttributePlugin(), new UpdateModelPlugin(), new MultiPassRendererPlugin(), new ShaderUniformPlugin(), new LayerAnimateStylePlugin(), new LightingPlugin(), new PixelPickingPlugin(), new LayerModelPlugin()];
18
+ }
@@ -21,7 +21,7 @@ export default class FillModel extends BaseModel {
21
21
  * 根据 animateOption 的值返回对应的 shader 代码
22
22
  * @returns
23
23
  */
24
- getShaders(animateOption: Partial<IAnimateOption>): {
24
+ getShaders(): {
25
25
  frag: string;
26
26
  vert: string;
27
27
  type: string;
@@ -97,17 +97,14 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
97
97
  key: "buildModels",
98
98
  value: function () {
99
99
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
100
- var _ref3, _ref3$animateOption, animateOption, _this$getShaders, frag, vert, type, model;
100
+ var _this$getShaders, frag, vert, type, model;
101
101
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
102
102
  while (1) switch (_context2.prev = _context2.next) {
103
103
  case 0:
104
- _ref3 = this.layer.getLayerConfig(), _ref3$animateOption = _ref3.animateOption, animateOption = _ref3$animateOption === void 0 ? {
105
- enable: false
106
- } : _ref3$animateOption;
107
- _this$getShaders = this.getShaders(animateOption), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
104
+ _this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
108
105
  this.layer.triangulation = PointFillTriangulation;
109
106
  this.initUniformsBuffer();
110
- _context2.next = 6;
107
+ _context2.next = 5;
111
108
  return this.layer.buildLayerModel({
112
109
  moduleName: type,
113
110
  vertexShader: vert,
@@ -118,10 +115,10 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
118
115
  enable: false
119
116
  }
120
117
  });
121
- case 6:
118
+ case 5:
122
119
  model = _context2.sent;
123
120
  return _context2.abrupt("return", [model]);
124
- case 8:
121
+ case 7:
125
122
  case "end":
126
123
  return _context2.stop();
127
124
  }
@@ -138,7 +135,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
138
135
  */
139
136
  }, {
140
137
  key: "getShaders",
141
- value: function getShaders(animateOption) {
138
+ value: function getShaders() {
142
139
  return {
143
140
  frag: pointFillFrag,
144
141
  vert: pointFillVert,
@@ -72,7 +72,8 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
72
72
  _ref$unit = _ref.unit,
73
73
  unit = _ref$unit === void 0 ? 'pixel' : _ref$unit;
74
74
  if (this.rendererService.getDirty()) {
75
- this.texture.bind();
75
+ var _this$texture;
76
+ (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.bind();
76
77
  }
77
78
  /**
78
79
  * rotateFlag
@@ -158,9 +159,9 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
158
159
  }, {
159
160
  key: "clearModels",
160
161
  value: function clearModels() {
161
- var _this$texture;
162
+ var _this$texture2;
162
163
  this.iconService.off('imageUpdate', this.updateTexture);
163
- (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
164
+ (_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
164
165
  }
165
166
 
166
167
  // overwrite baseModel func
@@ -62,7 +62,8 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
62
62
  value: function getUninforms() {
63
63
  // ThreeJS 图层兼容
64
64
  if (this.rendererService.getDirty()) {
65
- this.texture.bind();
65
+ var _this$texture;
66
+ (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.bind();
66
67
  }
67
68
  var commonInfo = this.getCommonUniformsInfo();
68
69
  var attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
@@ -111,8 +112,8 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
111
112
  }, {
112
113
  key: "clearModels",
113
114
  value: function clearModels() {
114
- var _this$texture;
115
- (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
115
+ var _this$texture2;
116
+ (_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
116
117
  this.iconService.off('imageUpdate', this.updateTexture);
117
118
  }
118
119
  }, {
@@ -215,7 +215,6 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
215
215
  update: function update(feature, featureIdx, vertex) {
216
216
  var lng = vertex[0];
217
217
  var lat = vertex[1];
218
- // console.log((lng - bounds[0]) / lngLen, (lat - bounds[1]) / latLen, vertex[4])
219
218
  // 临时 兼容高德V2
220
219
  return [(lng - bounds[0]) / lngLen, (lat - bounds[1]) / latLen, vertex[4]];
221
220
  }
@@ -10,7 +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 { lodashUtil, rgb2arr } from '@antv/l7-utils';
13
+ import { rgb2arr } 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/ocean/ocean_frag.glsl' */
@@ -18,7 +18,6 @@ var ocean_frag = "\nlayout(std140) uniform commonUniforms {\n vec4 u_watercolor
18
18
  /* babel-plugin-inline-import '../shaders/ocean/ocean_vert.glsl' */
19
19
  var ocean_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 14) in vec2 a_uv;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_watercolor;\n vec4 u_watercolor2;\n float u_time;\n};\n\n\nout vec2 v_uv;\nout float v_opacity;\n\n#pragma include \"projection\"\n\nvoid main() {\n v_uv = a_uv;\n v_opacity = opacity;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n}\n\n";
20
20
  import { ShaderLocation } from "../../core/CommonStyleAttribute";
21
- var isNumber = lodashUtil.isNumber;
22
21
  var OceanModel = /*#__PURE__*/function (_BaseModel) {
23
22
  _inherits(OceanModel, _BaseModel);
24
23
  var _super = _createSuper(OceanModel);
@@ -10,7 +10,6 @@ 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 { lodashUtil } from '@antv/l7-utils';
14
13
  import BaseModel from "../../core/BaseModel";
15
14
  import { ShaderLocation } from "../../core/CommonStyleAttribute";
16
15
  import { polygonTriangulation } from "../../core/triangulation";
@@ -18,7 +17,6 @@ import { polygonTriangulation } from "../../core/triangulation";
18
17
  var water_frag = "uniform sampler2D u_texture;\nlayout(std140) uniform commonUniforms {\n float u_speed;\n float u_time;\n};\n\nout vec4 outputColor;\n\n\nin vec4 v_Color;\nin 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 = texture(SAMPLER_2D(u_texture), p.xz / 30.).xyz;\n p.z += t * 3.; p.x += t * 0.52;\n vec3 c2 = texture(SAMPLER_2D(u_texture), p.xz / 30.).xyz;\n p.z += t * 4.; p.x += t * 0.8;\n vec3 c3 = texture(SAMPLER_2D(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\n outputColor = v_Color;\n float spc = calSpc();\n outputColor += spc * 0.4;\n}\n";
19
18
  /* babel-plugin-inline-import '../shaders/water/polygon_water_vert.glsl' */
20
19
  var water_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 14) in vec2 a_uv;\nlayout(std140) uniform commonUniforms {\n float u_speed;\n float u_time;\n};\nout vec4 v_Color;\nout vec2 v_uv;\n\n\n#pragma include \"projection\"\n\nvoid main() {\n v_uv = a_uv;\n v_Color = a_Color;\n v_Color.a *= opacity;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n}\n\n";
21
- var isNumber = lodashUtil.isNumber;
22
20
  var WaterModel = /*#__PURE__*/function (_BaseModel) {
23
21
  _inherits(WaterModel, _BaseModel);
24
22
  var _super = _createSuper(WaterModel);
@@ -3,7 +3,6 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
3
  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
- import { TYPES } from '@antv/l7-core';
7
6
  import { lodashUtil } from '@antv/l7-utils';
8
7
  import { TileLayerService } from "../service/TileLayerService";
9
8
  import { TilePickService } from "../service/TilePickService";
@@ -55,10 +54,10 @@ var BaseTileLayer = /*#__PURE__*/function () {
55
54
  _defineProperty(this, "viewchange", debounce(this.mapchange, 24));
56
55
  this.parent = parent;
57
56
  var container = this.parent.getContainer();
58
- this.rendererService = container.get(TYPES.IRendererService);
59
- this.layerService = container.get(TYPES.ILayerService);
60
- this.mapService = container.get(TYPES.IMapService);
61
- this.pickingService = container.get(TYPES.IPickingService);
57
+ this.rendererService = container.rendererService;
58
+ this.layerService = container.layerService;
59
+ this.mapService = container.mapService;
60
+ this.pickingService = container.pickingService;
62
61
 
63
62
  // 初始化瓦片管理服务
64
63
  this.tileLayerService = new TileLayerService({
@@ -31,14 +31,12 @@ export function readRasterValue(tile, mapService, x, y) {
31
31
  }
32
32
  export function readPixel(x, y, rendererService) {
33
33
  var readPixels = rendererService.readPixels,
34
- getContainer = rendererService.getContainer;
34
+ getViewportSize = rendererService.getViewportSize;
35
35
  var xInDevicePixel = x * DOM.DPR;
36
36
  var yInDevicePixel = y * DOM.DPR;
37
- var _getContainerSize = getContainerSize(getContainer()),
38
- width = _getContainerSize.width,
39
- height = _getContainerSize.height;
40
- width *= DOM.DPR;
41
- height *= DOM.DPR;
37
+ var _getViewportSize = getViewportSize(),
38
+ width = _getViewportSize.width,
39
+ height = _getViewportSize.height;
42
40
  if (xInDevicePixel > width - 1 * DOM.DPR || xInDevicePixel < 0 || yInDevicePixel > height - 1 * DOM.DPR || yInDevicePixel < 0) {
43
41
  return false;
44
42
  }
@@ -51,14 +49,4 @@ export function readPixel(x, y, rendererService) {
51
49
  data: new Uint8Array(1 * 1 * 4)
52
50
  });
53
51
  return pickedColors;
54
- }
55
- function getContainerSize(container) {
56
- if (container.getContext) {
57
- return {
58
- width: container.width / DOM.DPR,
59
- height: container.height / DOM.DPR
60
- };
61
- } else {
62
- return container.getBoundingClientRect();
63
- }
64
52
  }
@@ -1,6 +1,5 @@
1
1
  import type { ILayer, ILayerService, ILngLat, IRendererService, ITile } from '@antv/l7-core';
2
2
  import type { SourceTile } from '@antv/l7-utils';
3
- import 'reflect-metadata';
4
3
  interface ITileLayerServiceOptions {
5
4
  rendererService: IRendererService;
6
5
  layerService: ILayerService;
@@ -4,7 +4,6 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
4
  import _createClass from "@babel/runtime/helpers/esm/createClass";
5
5
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
6
6
  import _regeneratorRuntime from "@babel/runtime/regenerator";
7
- import 'reflect-metadata';
8
7
  export var TileLayerService = /*#__PURE__*/function () {
9
8
  function TileLayerService(_ref) {
10
9
  var rendererService = _ref.rendererService,
@@ -22,5 +22,5 @@ export declare class TilePickService implements ITilePickService {
22
22
  private pickId2Color;
23
23
  /** 从瓦片中根据数据 */
24
24
  getFeatureById(pickedFeatureIdx: number): any[];
25
- pickRasterLayer(layer: ILayer, target: IInteractionTarget, parent?: ILayer): boolean;
25
+ pickRasterLayer(): boolean;
26
26
  }