@antv/l7-layers 2.20.20 → 2.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) 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 +18 -19
  10. package/es/core/BaseLayer.js +134 -101
  11. package/es/core/BaseModel.js +15 -31
  12. package/es/core/LayerPickService.js +4 -6
  13. package/es/core/TextureService.js +1 -2
  14. package/es/core/interface.d.ts +31 -4
  15. package/es/core/shape/Path.js +1 -2
  16. package/es/core/shape/arrow.js +2 -6
  17. package/es/core/shape/extrude.js +0 -1
  18. package/es/core/triangulation.js +2 -2
  19. package/es/earth/models/base.js +0 -1
  20. package/es/heatmap/index.js +0 -1
  21. package/es/heatmap/models/heatmap.d.ts +0 -1
  22. package/es/heatmap/models/heatmap.js +2 -5
  23. package/es/index.d.ts +2 -1
  24. package/es/index.js +2 -89
  25. package/es/line/models/arc.js +5 -5
  26. package/es/line/models/arc_3d.js +4 -4
  27. package/es/line/models/great_circle.js +4 -4
  28. package/es/line/models/line.js +8 -12
  29. package/es/line/models/simple_line.js +1 -2
  30. package/es/line/models/wall.js +5 -4
  31. package/es/line/shaders/line/line_vert.glsl +0 -2
  32. package/es/line/shaders/wall/wall_vert.glsl +15 -0
  33. package/es/plugins/DataMappingPlugin.d.ts +4 -7
  34. package/es/plugins/DataMappingPlugin.js +8 -25
  35. package/es/plugins/DataSourcePlugin.d.ts +0 -1
  36. package/es/plugins/DataSourcePlugin.js +4 -7
  37. package/es/plugins/FeatureScalePlugin.d.ts +2 -5
  38. package/es/plugins/FeatureScalePlugin.js +5 -7
  39. package/es/plugins/LayerAnimateStylePlugin.d.ts +0 -1
  40. package/es/plugins/LayerAnimateStylePlugin.js +2 -5
  41. package/es/plugins/LayerMaskPlugin.d.ts +0 -1
  42. package/es/plugins/LayerMaskPlugin.js +2 -8
  43. package/es/plugins/LayerModelPlugin.d.ts +0 -1
  44. package/es/plugins/LayerModelPlugin.js +13 -18
  45. package/es/plugins/LayerStylePlugin.d.ts +0 -1
  46. package/es/plugins/LayerStylePlugin.js +2 -5
  47. package/es/plugins/LightingPlugin.d.ts +0 -1
  48. package/es/plugins/LightingPlugin.js +2 -5
  49. package/es/plugins/MultiPassRendererPlugin.d.ts +0 -1
  50. package/es/plugins/MultiPassRendererPlugin.js +2 -5
  51. package/es/plugins/PixelPickingPlugin.d.ts +2 -6
  52. package/es/plugins/PixelPickingPlugin.js +6 -12
  53. package/es/plugins/RegisterStyleAttributePlugin.d.ts +2 -5
  54. package/es/plugins/RegisterStyleAttributePlugin.js +2 -5
  55. package/es/plugins/ShaderUniformPlugin.d.ts +7 -8
  56. package/es/plugins/ShaderUniformPlugin.js +17 -43
  57. package/es/plugins/UpdateModelPlugin.d.ts +0 -1
  58. package/es/plugins/UpdateModelPlugin.js +2 -5
  59. package/es/plugins/UpdateStyleAttributePlugin.d.ts +2 -5
  60. package/es/plugins/UpdateStyleAttributePlugin.js +2 -6
  61. package/es/plugins/index.d.ts +15 -0
  62. package/es/plugins/index.js +18 -0
  63. package/es/point/models/fill.d.ts +1 -1
  64. package/es/point/models/fill.js +7 -10
  65. package/es/point/models/fillImage.js +4 -3
  66. package/es/point/models/image.js +4 -3
  67. package/es/polygon/models/extrude.js +0 -1
  68. package/es/polygon/models/fill.js +2 -3
  69. package/es/polygon/models/index.js +0 -1
  70. package/es/polygon/models/ocean.js +1 -2
  71. package/es/polygon/models/water.js +0 -2
  72. package/es/tile/core/BaseLayer.js +4 -5
  73. package/es/tile/interaction/getRasterData.js +0 -3
  74. package/es/tile/service/TileLayerService.d.ts +0 -1
  75. package/es/tile/service/TileLayerService.js +0 -1
  76. package/es/tile/service/TilePickService.d.ts +1 -1
  77. package/es/tile/service/TilePickService.js +2 -3
  78. package/es/tile/tile/Tile.js +8 -6
  79. package/es/utils/blend.js +7 -8
  80. package/es/utils/polylineNormal.js +0 -1
  81. package/es/utils/rampcolor_legend.js +1 -2
  82. package/es/wind/index.js +0 -1
  83. package/lib/canvas/index.js +63 -37
  84. package/lib/canvas/models/canvas.js +125 -138
  85. package/lib/canvas/models/constants.js +12 -0
  86. package/lib/canvas/models/index.js +22 -7
  87. package/lib/core/BaseLayer.js +134 -101
  88. package/lib/core/BaseModel.js +14 -30
  89. package/lib/core/LayerPickService.js +4 -6
  90. package/lib/core/TextureService.js +1 -2
  91. package/lib/core/shape/Path.js +1 -2
  92. package/lib/core/shape/arrow.js +2 -6
  93. package/lib/core/shape/extrude.js +0 -1
  94. package/lib/core/triangulation.js +2 -2
  95. package/lib/earth/models/base.js +0 -1
  96. package/lib/heatmap/index.js +0 -1
  97. package/lib/heatmap/models/heatmap.js +2 -5
  98. package/lib/index.js +9 -90
  99. package/lib/line/models/arc.js +4 -4
  100. package/lib/line/models/arc_3d.js +4 -4
  101. package/lib/line/models/great_circle.js +4 -4
  102. package/lib/line/models/line.js +10 -12
  103. package/lib/line/models/simple_line.js +0 -1
  104. package/lib/line/models/wall.js +5 -4
  105. package/lib/line/shaders/line/line_vert.glsl +0 -2
  106. package/lib/line/shaders/wall/wall_vert.glsl +15 -0
  107. package/lib/plugins/DataMappingPlugin.js +7 -24
  108. package/lib/plugins/DataSourcePlugin.js +3 -6
  109. package/lib/plugins/FeatureScalePlugin.js +5 -7
  110. package/lib/plugins/LayerAnimateStylePlugin.js +2 -5
  111. package/lib/plugins/LayerMaskPlugin.js +2 -8
  112. package/lib/plugins/LayerModelPlugin.js +13 -18
  113. package/lib/plugins/LayerStylePlugin.js +2 -5
  114. package/lib/plugins/LightingPlugin.js +2 -5
  115. package/lib/plugins/MultiPassRendererPlugin.js +2 -5
  116. package/lib/plugins/PixelPickingPlugin.js +6 -12
  117. package/lib/plugins/RegisterStyleAttributePlugin.js +2 -5
  118. package/lib/plugins/ShaderUniformPlugin.js +16 -42
  119. package/lib/plugins/UpdateModelPlugin.js +2 -5
  120. package/lib/plugins/UpdateStyleAttributePlugin.js +2 -5
  121. package/lib/plugins/index.js +26 -0
  122. package/lib/point/models/fill.js +10 -13
  123. package/lib/point/models/fillImage.js +4 -3
  124. package/lib/point/models/image.js +4 -3
  125. package/lib/polygon/models/extrude.js +0 -1
  126. package/lib/polygon/models/fill.js +1 -2
  127. package/lib/polygon/models/ocean.js +0 -1
  128. package/lib/polygon/models/water.js +0 -2
  129. package/lib/tile/core/BaseLayer.js +4 -5
  130. package/lib/tile/interaction/getRasterData.js +0 -3
  131. package/lib/tile/service/TileLayerService.js +0 -1
  132. package/lib/tile/service/TilePickService.js +2 -3
  133. package/lib/tile/tile/Tile.js +8 -6
  134. package/lib/utils/blend.js +7 -8
  135. package/lib/utils/polylineNormal.js +0 -1
  136. package/lib/utils/rampcolor_legend.js +1 -2
  137. package/lib/wind/index.js +0 -1
  138. package/package.json +18 -20
@@ -1,5 +1,6 @@
1
1
  import type { IAnimateOption, IMapService, ITexture2D, StyleAttributeField, StyleAttributeOption } from '@antv/l7-core';
2
2
  import type { IColorRamp } from '@antv/l7-utils';
3
+ import type { CanvasModelType } from '../canvas/models';
3
4
  import type { anchorType } from '../utils/symbol-layout';
4
5
  export declare enum lineStyleType {
5
6
  'solid' = 0,
@@ -199,10 +200,36 @@ export interface IDrawingOnCanvas {
199
200
  mapService: IMapService;
200
201
  size: [number, number];
201
202
  }
202
- export interface ICanvasLayerStyleOptions {
203
- zIndex: number;
204
- update: CanvasUpdateType | string;
205
- drawingOnCanvas: (option: IDrawingOnCanvas) => void;
203
+ export interface ICanvasLayerRenderParams {
204
+ canvas: HTMLCanvasElement;
205
+ ctx: RenderingContext;
206
+ container: {
207
+ width: number;
208
+ height: number;
209
+ bounds: [[number, number], [number, number]];
210
+ };
211
+ size: [number, number];
212
+ utils: {
213
+ lngLatToContainer: IMapService['lngLatToContainer'];
214
+ };
215
+ mapService: IMapService;
216
+ }
217
+ export interface ICanvasLayerOptions {
218
+ zIndex?: number;
219
+ contextType?: CanvasModelType;
220
+ getContext?: (canvas: HTMLCanvasElement) => RenderingContext;
221
+ trigger?: 'end' | 'change';
222
+ /**
223
+ * @deprecated
224
+ * @alias trigger
225
+ */
226
+ update?: CanvasUpdateType | string;
227
+ draw?: (renderParams: ICanvasLayerRenderParams) => void;
228
+ /**
229
+ * @deprecated
230
+ * @alias draw
231
+ */
232
+ drawingOnCanvas?: (renderParams: ICanvasLayerRenderParams) => void;
206
233
  }
207
234
  export interface IHeatMapLayerStyleOptions extends IBaseLayerStyleOptions {
208
235
  intensity: number;
@@ -1,5 +1,4 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- var _geometryShape;
3
2
  export var ShapeType3D = /*#__PURE__*/function (ShapeType3D) {
4
3
  ShapeType3D["CYLINDER"] = "cylinder";
5
4
  ShapeType3D["SQUARECOLUMN"] = "squareColumn";
@@ -52,4 +51,4 @@ export function hexagon() {
52
51
  export function pentagon() {
53
52
  return polygonPath(5);
54
53
  }
55
- export var geometryShape = (_geometryShape = {}, _defineProperty(_geometryShape, ShapeType2D.CIRCLE, circle), _defineProperty(_geometryShape, ShapeType2D.HEXAGON, hexagon), _defineProperty(_geometryShape, ShapeType2D.TRIANGLE, triangle), _defineProperty(_geometryShape, ShapeType2D.SQUARE, square), _defineProperty(_geometryShape, ShapeType2D.PENTAGON, pentagon), _defineProperty(_geometryShape, ShapeType3D.CYLINDER, circle), _defineProperty(_geometryShape, ShapeType3D.HEXAGONCOLUMN, hexagon), _defineProperty(_geometryShape, ShapeType3D.TRIANGLECOLUMN, triangle), _defineProperty(_geometryShape, ShapeType3D.SQUARECOLUMN, square), _defineProperty(_geometryShape, ShapeType3D.PENTAGONCOLUMN, pentagon), _geometryShape);
54
+ export var geometryShape = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ShapeType2D.CIRCLE, circle), ShapeType2D.HEXAGON, hexagon), ShapeType2D.TRIANGLE, triangle), ShapeType2D.SQUARE, square), ShapeType2D.PENTAGON, pentagon), ShapeType3D.CYLINDER, circle), ShapeType3D.HEXAGONCOLUMN, hexagon), ShapeType3D.TRIANGLECOLUMN, triangle), ShapeType3D.SQUARECOLUMN, square), ShapeType3D.PENTAGONCOLUMN, pentagon);
@@ -110,14 +110,10 @@ export function lineArrowPath(coord) {
110
110
  var targetType = _typeof(symbol['target']) === 'object' ? symbol['target'].type : symbol['target'];
111
111
  var _ref = _typeof(symbol['source']) === 'object' ? symbol['source'] : {},
112
112
  _ref$width = _ref.width,
113
- sourceWidth = _ref$width === void 0 ? sourceType ? maxArrowWidthMap[sourceType] : 0 : _ref$width,
114
- _ref$height = _ref.height,
115
- sourceHeight = _ref$height === void 0 ? 2 : _ref$height;
113
+ sourceWidth = _ref$width === void 0 ? sourceType ? maxArrowWidthMap[sourceType] : 0 : _ref$width;
116
114
  var _ref2 = _typeof(symbol['target']) === 'object' ? symbol['target'] : {},
117
115
  _ref2$width = _ref2.width,
118
- targetWidth = _ref2$width === void 0 ? targetType ? maxArrowWidthMap[targetType] : 0 : _ref2$width,
119
- _ref2$height = _ref2.height,
120
- targetHeight = _ref2$height === void 0 ? 2 : _ref2$height;
116
+ targetWidth = _ref2$width === void 0 ? targetType ? maxArrowWidthMap[targetType] : 0 : _ref2$width;
121
117
  return {
122
118
  vertices: [0, PathHeight, 1 * sourceWidth].concat(_toConsumableArray(coord), [1, PathHeight, -1 * targetWidth], _toConsumableArray(coord), [1, -PathHeight, -1 * targetWidth], _toConsumableArray(coord), [0, -PathHeight, 1 * sourceWidth], _toConsumableArray(coord), [0, PathHeight, 1 * sourceWidth], _toConsumableArray(coord), [1, PathHeight, -1 * targetWidth], _toConsumableArray(coord), [1, -PathHeight, -1 * targetWidth], _toConsumableArray(coord), [0, -PathHeight, 1 * sourceWidth], _toConsumableArray(coord)),
123
119
  outLineIndices: [0, 1, 2, 0, 2, 3].map(function (t) {
@@ -83,7 +83,6 @@ export function extrude_PolygonNormal(path) {
83
83
  // 顶部uv
84
84
  -1 // 顶部uv
85
85
  );
86
-
87
86
  normals.push(0, 0, 1);
88
87
  }
89
88
  var triangles = earcut(flattengeo.vertices, flattengeo.holes, flattengeo.dimensions);
@@ -354,8 +354,8 @@ export function HeatmapGridTriangulation(feature) {
354
354
  export function RasterImageTriangulation(feature) {
355
355
  var coordinates = feature.coordinates;
356
356
  // [ x, y, z. uv.x, uv.y]
357
- var positions = [].concat(_toConsumableArray(coordinates[0]), [0, 0, 1, coordinates[1][0], coordinates[0][1], 0, 1, 1], _toConsumableArray(coordinates[1]), [0, 1, 0], _toConsumableArray(coordinates[0]), [0, 0, 1], _toConsumableArray(coordinates[1]), [0, 1, 0, coordinates[0][0], coordinates[1][1], 0, 0, 0]);
358
- var indexs = [0, 1, 2, 3, 4, 5];
357
+ var positions = [].concat(_toConsumableArray(coordinates[0]), [0, 0, 0], _toConsumableArray(coordinates[1]), [0, 1, 0], _toConsumableArray(coordinates[2]), [0, 1, 1], _toConsumableArray(coordinates[3]), [0, 0, 1]);
358
+ var indexs = [0, 1, 2, 0, 2, 3];
359
359
  return {
360
360
  vertices: positions,
361
361
  indices: indexs,
@@ -61,7 +61,6 @@ var BaseEarthModel = /*#__PURE__*/function (_BaseModel) {
61
61
  u_specularRatio: (globalOptions === null || globalOptions === void 0 ? void 0 : globalOptions.specularRatio) || 0.1 // 高光反射
62
62
  // u_texture: this.texture,
63
63
  };
64
-
65
64
  this.textures = [this.texture];
66
65
  var commonBufferInfo = this.getUniformsBufferInfo(commonOptions);
67
66
  return commonBufferInfo;
@@ -69,7 +69,6 @@ var HeatMapLayer = /*#__PURE__*/function (_BaseLayer) {
69
69
  if (this.layerModel) {
70
70
  this.layerModel.render(options); // 独立的渲染流程
71
71
  }
72
-
73
72
  return this;
74
73
  }
75
74
  if (this.encodeDataLength <= 0 && !this.forceRender) {
@@ -1,5 +1,4 @@
1
1
  import type { IFramebuffer, IModel, IModelUniform, IRenderOptions, ITexture2D } from '@antv/l7-core';
2
- import 'reflect-metadata';
3
2
  import BaseModel from '../../core/BaseModel';
4
3
  export default class HeatMapModel extends BaseModel {
5
4
  protected texture: ITexture2D;
@@ -8,15 +8,12 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
8
8
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
9
9
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
10
10
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
11
- var _dec, _class;
12
11
  import _regeneratorRuntime from "@babel/runtime/regenerator";
13
12
  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); }; }
14
13
  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; } }
15
14
  import { AttributeType, TextureUsage, gl } from '@antv/l7-core';
16
15
  import { generateColorRamp, getCullFace, lodashUtil } from '@antv/l7-utils';
17
16
  import { mat4 } from 'gl-matrix';
18
- import { injectable } from 'inversify';
19
- import 'reflect-metadata';
20
17
  import BaseModel from "../../core/BaseModel";
21
18
  import { HeatmapTriangulation } from "../../core/triangulation";
22
19
  /* babel-plugin-inline-import '../shaders/heatmap/heatmap_3d_frag.glsl' */
@@ -34,7 +31,7 @@ var heatmap_framebuffer_frag = "layout(std140) uniform commonUniforms {\n float
34
31
  var heatmap_framebuffer_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 9) in float a_Size;\nlayout(location = 10) in vec2 a_Dir;\n\n\nlayout(std140) uniform commonUniforms {\n float u_radius;\n float u_intensity;\n float u_common_uniforms_padding1;\n float u_common_uniforms_padding2;\n};\n\nout vec2 v_extrude;\nout float v_weight;\n\n#define GAUSS_COEF 0.3989422804014327\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main(){\n vec3 picking_color_placeholder = u_PickingColor;\n\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";
35
32
  import { heatMap3DTriangulation } from "../triangulation";
36
33
  var isEqual = lodashUtil.isEqual;
37
- var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_BaseModel) {
34
+ var HeatMapModel = /*#__PURE__*/function (_BaseModel) {
38
35
  _inherits(HeatMapModel, _BaseModel);
39
36
  var _super = _createSuper(HeatMapModel);
40
37
  function HeatMapModel() {
@@ -491,5 +488,5 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
491
488
  }
492
489
  }]);
493
490
  return HeatMapModel;
494
- }(BaseModel)) || _class);
491
+ }(BaseModel);
495
492
  export { HeatMapModel as default };
package/es/index.d.ts CHANGED
@@ -9,9 +9,10 @@ import LineLayer from './line/index';
9
9
  import PointLayer from './point';
10
10
  import PolygonLayer from './polygon';
11
11
  import RasterLayer from './raster';
12
+ import TileLayer from './tile/core/BaseLayer';
12
13
  import TileDebugLayer from './tile/core/TileDebugLayer';
13
14
  import EarthLayer from './earth';
14
15
  import MaskLayer from './mask';
15
16
  import WindLayer from './wind';
16
17
  export * from './core/interface';
17
- export { BaseLayer, BaseModel, PointLayer, PolygonLayer, LineLayer, CityBuildingLayer, GeometryLayer, CanvasLayer, ImageLayer, RasterLayer, HeatmapLayer, EarthLayer, WindLayer, MaskLayer, TileDebugLayer, };
18
+ export { BaseLayer, BaseModel, CanvasLayer, CityBuildingLayer, EarthLayer, GeometryLayer, HeatmapLayer, ImageLayer, LineLayer, MaskLayer, PointLayer, PolygonLayer, RasterLayer, TileDebugLayer, TileLayer, WindLayer, };
package/es/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import { container, TYPES } from '@antv/l7-core';
2
1
  import CanvasLayer from "./canvas";
3
2
  import CityBuildingLayer from "./citybuliding/building";
4
3
  import BaseLayer from "./core/BaseLayer";
@@ -10,96 +9,10 @@ import LineLayer from "./line/index";
10
9
  import PointLayer from "./point";
11
10
  import PolygonLayer from "./polygon";
12
11
  import RasterLayer from "./raster";
12
+ import TileLayer from "./tile/core/BaseLayer";
13
13
  import TileDebugLayer from "./tile/core/TileDebugLayer";
14
14
  import EarthLayer from "./earth";
15
15
  import MaskLayer from "./mask";
16
16
  import WindLayer from "./wind";
17
-
18
- // import ConfigSchemaValidationPlugin from './plugins/ConfigSchemaValidationPlugin';
19
- import DataMappingPlugin from "./plugins/DataMappingPlugin";
20
- import DataSourcePlugin from "./plugins/DataSourcePlugin";
21
- import FeatureScalePlugin from "./plugins/FeatureScalePlugin";
22
- import LayerAnimateStylePlugin from "./plugins/LayerAnimateStylePlugin";
23
- import LayerMaskPlugin from "./plugins/LayerMaskPlugin";
24
- import LayerModelPlugin from "./plugins/LayerModelPlugin";
25
- import LayerStylePlugin from "./plugins/LayerStylePlugin";
26
- import LightingPlugin from "./plugins/LightingPlugin";
27
- import MultiPassRendererPlugin from "./plugins/MultiPassRendererPlugin";
28
- import PixelPickingPlugin from "./plugins/PixelPickingPlugin";
29
- import RegisterStyleAttributePlugin from "./plugins/RegisterStyleAttributePlugin";
30
- import ShaderUniformPlugin from "./plugins/ShaderUniformPlugin";
31
- import UpdateModelPlugin from "./plugins/UpdateModelPlugin";
32
- import UpdateStyleAttributePlugin from "./plugins/UpdateStyleAttributePlugin";
33
-
34
- /**
35
- * 校验传入参数配置项的正确性
36
- * @see /dev-docs/ConfigSchemaValidation.md
37
- */
38
- // container
39
- // .bind<ILayerPlugin>(TYPES.ILayerPlugin)
40
- // .to(ConfigSchemaValidationPlugin)
41
- // .inRequestScope();
42
- /**
43
- * 获取 Source
44
- */
45
- container.bind(TYPES.ILayerPlugin).to(DataSourcePlugin).inRequestScope();
46
- /**
47
- * 根据 StyleAttribute 创建 VertexAttribute
48
- */
49
- container.bind(TYPES.ILayerPlugin).to(RegisterStyleAttributePlugin).inRequestScope();
50
- /**
51
- * 根据 Source 创建 Scale
52
- */
53
- container.bind(TYPES.ILayerPlugin).to(FeatureScalePlugin).inRequestScope();
54
- /**
55
- * 使用 Scale 进行数据映射
56
- */
57
- container.bind(TYPES.ILayerPlugin).to(DataMappingPlugin).inRequestScope();
58
-
59
- /**
60
- * 更新地图样式配置项 如active, show, hide
61
- */
62
- container.bind(TYPES.ILayerPlugin).to(LayerStylePlugin).inRequestScope();
63
-
64
- /**
65
- * 初始化地图 Mask
66
- */
67
- container.bind(TYPES.ILayerPlugin).to(LayerMaskPlugin).inRequestScope();
68
-
69
- /**
70
- * 负责属性更新
71
- */
72
- container.bind(TYPES.ILayerPlugin).to(UpdateStyleAttributePlugin).inRequestScope();
73
-
74
- /**
75
- * 负责Model更新
76
- */
77
- container.bind(TYPES.ILayerPlugin).to(UpdateModelPlugin).inRequestScope();
78
-
79
- /**
80
- * Multi Pass 自定义渲染管线
81
- */
82
- container.bind(TYPES.ILayerPlugin).to(MultiPassRendererPlugin).inRequestScope();
83
- /**
84
- * 传入相机坐标系参数
85
- */
86
- container.bind(TYPES.ILayerPlugin).to(ShaderUniformPlugin).inRequestScope();
87
-
88
- /**
89
- * 传入动画参数
90
- */
91
- container.bind(TYPES.ILayerPlugin).to(LayerAnimateStylePlugin).inRequestScope();
92
- /**
93
- * 传入光照相关参数
94
- */
95
- container.bind(TYPES.ILayerPlugin).to(LightingPlugin).inRequestScope();
96
- /**
97
- * 负责拾取过程中 Encode 以及 Highlight 阶段及结束后恢复
98
- */
99
- container.bind(TYPES.ILayerPlugin).to(PixelPickingPlugin).inRequestScope();
100
- /**
101
- * 初始化Model
102
- */
103
- container.bind(TYPES.ILayerPlugin).to(LayerModelPlugin).inRequestScope();
104
17
  export * from "./core/interface";
105
- export { BaseLayer, BaseModel, PointLayer, PolygonLayer, LineLayer, CityBuildingLayer, GeometryLayer, CanvasLayer, ImageLayer, RasterLayer, HeatmapLayer, EarthLayer, WindLayer, MaskLayer, TileDebugLayer };
18
+ export { BaseLayer, BaseModel, CanvasLayer, CityBuildingLayer, EarthLayer, GeometryLayer, HeatmapLayer, ImageLayer, LineLayer, MaskLayer, PointLayer, PolygonLayer, RasterLayer, TileDebugLayer, TileLayer, WindLayer };
@@ -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 { ShaderLocation } from "../../core/CommonStyleAttribute";
16
16
  import { LineArcTriangulation } from "../../core/triangulation";
@@ -22,7 +22,6 @@ var lineStyleObj = {
22
22
  solid: 0.0,
23
23
  dash: 1.0
24
24
  };
25
- var isNumber = lodashUtil.isNumber;
26
25
  var ArcModel = /*#__PURE__*/function (_BaseModel) {
27
26
  _inherits(ArcModel, _BaseModel);
28
27
  var _super = _createSuper(ArcModel);
@@ -94,7 +93,8 @@ var ArcModel = /*#__PURE__*/function (_BaseModel) {
94
93
  useLinearColor = 1;
95
94
  }
96
95
  if (this.rendererService.getDirty()) {
97
- this.texture.bind();
96
+ var _this$texture;
97
+ (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.bind();
98
98
  }
99
99
  var commonOptions = {
100
100
  u_animate: this.animateOption2Array(animateOption),
@@ -151,8 +151,8 @@ var ArcModel = /*#__PURE__*/function (_BaseModel) {
151
151
  }, {
152
152
  key: "clearModels",
153
153
  value: function clearModels() {
154
- var _this$texture;
155
- (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
154
+ var _this$texture2;
155
+ (_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
156
156
  this.iconService.off('imageUpdate', this.updateTexture);
157
157
  }
158
158
  }, {
@@ -92,7 +92,8 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
92
92
  useLinearColor = 1;
93
93
  }
94
94
  if (this.rendererService.getDirty()) {
95
- this.texture.bind();
95
+ var _this$texture;
96
+ (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.bind();
96
97
  }
97
98
  var commonOptions = {
98
99
  u_animate: this.animateOption2Array(animateOption),
@@ -113,7 +114,6 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
113
114
  u_time: this.layer.getLayerAnimateTime() || 0,
114
115
  u_linearColor: useLinearColor //是否使用渐变色
115
116
  };
116
-
117
117
  var commonBufferInfo = this.getUniformsBufferInfo(commonOptions);
118
118
  return commonBufferInfo;
119
119
  }
@@ -150,8 +150,8 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
150
150
  }, {
151
151
  key: "clearModels",
152
152
  value: function clearModels() {
153
- var _this$texture;
154
- (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
153
+ var _this$texture2;
154
+ (_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
155
155
  this.iconService.off('imageUpdate', this.updateTexture);
156
156
  }
157
157
  }, {
@@ -77,7 +77,8 @@ var GreatCircleModel = /*#__PURE__*/function (_BaseModel) {
77
77
  dashArray.push(0, 0);
78
78
  }
79
79
  if (this.rendererService.getDirty()) {
80
- this.texture.bind();
80
+ var _this$texture;
81
+ (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.bind();
81
82
  }
82
83
 
83
84
  // 转化渐变色
@@ -146,8 +147,8 @@ var GreatCircleModel = /*#__PURE__*/function (_BaseModel) {
146
147
  }, {
147
148
  key: "clearModels",
148
149
  value: function clearModels() {
149
- var _this$texture;
150
- (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
150
+ var _this$texture2;
151
+ (_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
151
152
  this.iconService.off('imageUpdate', this.updateTexture);
152
153
  }
153
154
  }, {
@@ -245,7 +246,6 @@ var GreatCircleModel = /*#__PURE__*/function (_BaseModel) {
245
246
  update: function update(feature) {
246
247
  var iconMap = _this2.iconService.getIconMap();
247
248
  var texture = feature.texture;
248
- // console.log('icon feature', feature)
249
249
  var _ref4 = iconMap[texture] || {
250
250
  x: 0,
251
251
  y: 0
@@ -11,20 +11,15 @@ 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 { LineTriangulation, rgb2arr } from '@antv/l7-utils';
14
+ import { rgb2arr } from '@antv/l7-utils';
15
15
  import BaseModel from "../../core/BaseModel";
16
16
  import { LinearDir, TextureBlend } from "../../core/interface";
17
- // import { LineTriangulation } from '../../core/triangulation';
18
-
17
+ import { LineTriangulation } from "../../core/triangulation";
19
18
  import { ShaderLocation } from "../../core/CommonStyleAttribute";
20
19
  /* babel-plugin-inline-import '../shaders/line/line_frag.glsl' */
21
20
  var line_frag = "// #extension GL_OES_standard_derivatives : enable\n#define Animate 0.0\n#define LineTexture 1.0\n\nuniform sampler2D u_texture;\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array;\n vec4 u_blur;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed: 0.0;\n float u_vertexScale: 1.0;\n float u_raisingHeight: 0.0;\n float u_strokeWidth: 0.0;\n float u_textureBlend;\n float u_line_texture;\n float u_linearDir: 1.0;\n float u_linearColor: 0;\n float u_time;\n};\n\nin vec4 v_color;\nin vec4 v_stroke;\n// dash\nin vec4 v_dash_array;\nin float v_d_distance_ratio;\nin vec2 v_iconMapUV;\nin vec4 v_texture_data;\n\nout vec4 outputColor;\n#pragma include \"picking\"\n\n// [animate, duration, interval, trailLength],\nvoid main() {\n if(u_dash_array!=vec4(0.0)){\n float dashLength = mod(v_d_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(!(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z))) {\n // \u865A\u7EBF\u90E8\u5206\n discard;\n };\n }\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = v_texture_data.r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n if(u_linearDir < 1.0) {\n d_distance_ratio = v_texture_data.a;\n }\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n outputColor = mix(u_sourceColor, u_targetColor, d_distance_ratio);\n outputColor.a *= v_color.a;\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n outputColor = v_color;\n }\n // anti-alias\n // float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));\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 outputColor.a *= alpha;\n }\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = v_texture_data.g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = v_texture_data.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_texture_data.a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // v = max(smoothstep(0.95, 1.0, v), v);\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture(SAMPLER_2D(u_texture), uv);\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n outputColor += pattern;\n } else { // replace\n pattern.a *= v_color.a;\n if(outputColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n outputColor = pattern;\n }\n } \n\n float v = v_texture_data.a;\n float strokeWidth = min(0.5, u_strokeWidth);\n // \u7ED8\u5236 border\n if(strokeWidth > 0.01) {\n float borderOuterWidth = strokeWidth / 2.0;\n\n\n if(v >= 1.0 - strokeWidth || v <= strokeWidth) {\n if(v > strokeWidth) { // \u5916\u4FA7\n float linear = smoothstep(0.0, 1.0, (v - (1.0 - strokeWidth))/strokeWidth);\n // float linear = step(0.0, (v - (1.0 - borderWidth))/borderWidth);\n outputColor.rgb = mix(outputColor.rgb, v_stroke.rgb, linear);\n } else if(v <= strokeWidth) {\n float linear = smoothstep(0.0, 1.0, v/strokeWidth);\n outputColor.rgb = mix(v_stroke.rgb, outputColor.rgb, linear);\n }\n }\n\n if(v < borderOuterWidth) {\n outputColor.a = mix(0.0, outputColor.a, v/borderOuterWidth);\n } else if(v > 1.0 - borderOuterWidth) {\n outputColor.a = mix(outputColor.a, 0.0, (v - (1.0 - borderOuterWidth))/borderOuterWidth);\n }\n }\n\n // blur\n float blurV = v_texture_data.a;\n if(blurV < 0.5) {\n outputColor.a *= mix(u_blur.r, u_blur.g, blurV/0.5);\n } else {\n outputColor.a *= mix(u_blur.g, u_blur.b, (blurV - 0.5)/0.5);\n }\n \n outputColor = filterColor(outputColor);\n}\n";
22
21
  /* babel-plugin-inline-import '../shaders/line/line_vert.glsl' */
23
- var line_vert = "\n#define Animate 0.0\n\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in vec2 a_Size;\nlayout(location = 10) in vec3 a_DistanceAndIndexAndMiter;\nlayout(location = 13) in vec4 a_Normal_Total_Distance;\nlayout(location = 14) in vec2 a_iconMapUV;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array;\n vec4 u_blur;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed: 0.0;\n float u_vertexScale: 1.0;\n float u_raisingHeight: 0.0;\n float u_strokeWidth: 0.0;\n float u_textureBlend;\n float u_line_texture;\n float u_linearDir: 1.0;\n float u_linearColor: 0;\n float u_time;\n};\n\n\nout vec4 v_color;\nout vec4 v_stroke;\n//dash\nout vec4 v_dash_array;\nout float v_d_distance_ratio;\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nout vec2 v_iconMapUV;\nout vec4 v_texture_data;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec2 a_DistanceAndIndex = a_DistanceAndIndexAndMiter.xy;\n float a_Miter = a_DistanceAndIndexAndMiter.z;\n vec3 a_Normal = a_Normal_Total_Distance.xyz;\n float a_Total_Distance = a_Normal_Total_Distance.w;\n //dash\u8F93\u51FA\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_Total_Distance;\n v_d_distance_ratio = a_DistanceAndIndex.x / a_Total_Distance;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n v_iconMapUV = a_iconMapUV;\n d_texPixelLen = project_float_pixel(u_icon_step);\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n v_color = a_Color;\n v_color.a *= opacity;\n v_stroke = stroke;\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 v_texture_data = vec4(currentLinePointRatio, lineDistance, d_texPixelLen, texV);\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\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";
24
- var lineStyleObj = {
25
- solid: 0.0,
26
- dash: 1.0
27
- };
22
+ var line_vert = "\n#define Animate 0.0\n\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in vec2 a_Size;\nlayout(location = 10) in vec3 a_DistanceAndIndexAndMiter;\nlayout(location = 13) in vec4 a_Normal_Total_Distance;\nlayout(location = 14) in vec2 a_iconMapUV;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array;\n vec4 u_blur;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed: 0.0;\n float u_vertexScale: 1.0;\n float u_raisingHeight: 0.0;\n float u_strokeWidth: 0.0;\n float u_textureBlend;\n float u_line_texture;\n float u_linearDir: 1.0;\n float u_linearColor: 0;\n float u_time;\n};\n\n\nout vec4 v_color;\nout vec4 v_stroke;\n//dash\nout vec4 v_dash_array;\nout float v_d_distance_ratio;\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nout vec2 v_iconMapUV;\nout vec4 v_texture_data;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec2 a_DistanceAndIndex = a_DistanceAndIndexAndMiter.xy;\n float a_Miter = a_DistanceAndIndexAndMiter.z;\n vec3 a_Normal = a_Normal_Total_Distance.xyz;\n float a_Total_Distance = a_Normal_Total_Distance.w;\n //dash\u8F93\u51FA\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_Total_Distance;\n v_d_distance_ratio = a_DistanceAndIndex.x / a_Total_Distance;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n v_iconMapUV = a_iconMapUV;\n d_texPixelLen = project_float_pixel(u_icon_step);\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n v_color = a_Color;\n v_color.a *= opacity;\n v_stroke = stroke;\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 v_texture_data = vec4(currentLinePointRatio, lineDistance, d_texPixelLen, texV);\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\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 // \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";
28
23
  var LineModel = /*#__PURE__*/function (_BaseModel) {
29
24
  _inherits(LineModel, _BaseModel);
30
25
  var _super = _createSuper(LineModel);
@@ -100,7 +95,8 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
100
95
  u_dash_array.push(0, 0);
101
96
  }
102
97
  if (this.rendererService.getDirty() && this.texture) {
103
- this.texture.bind();
98
+ var _this$texture;
99
+ (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.bind();
104
100
  }
105
101
  var _ref2 = this.layer.getLayerConfig(),
106
102
  animateOption = _ref2.animateOption;
@@ -175,8 +171,8 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
175
171
  }, {
176
172
  key: "clearModels",
177
173
  value: function clearModels() {
178
- var _this$texture;
179
- (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
174
+ var _this$texture2;
175
+ (_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
180
176
  this.iconService.off('imageUpdate', this.updateTexture);
181
177
  }
182
178
  }, {
@@ -188,7 +184,7 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
188
184
  while (1) switch (_context2.prev = _context2.next) {
189
185
  case 0:
190
186
  _ref3 = this.layer.getLayerConfig(), _ref3$depth = _ref3.depth, depth = _ref3$depth === void 0 ? false : _ref3$depth;
191
- _this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type; // console.log(frag)
187
+ _this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
192
188
  this.layer.triangulation = LineTriangulation;
193
189
  _context2.next = 5;
194
190
  return this.layer.buildLayerModel({
@@ -8,7 +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 { lodashUtil, rgb2arr } from '@antv/l7-utils';
11
+ import { rgb2arr } from '@antv/l7-utils';
12
12
  import BaseModel from "../../core/BaseModel";
13
13
  import { SimpleLineTriangulation } from "../../core/triangulation";
14
14
  /* babel-plugin-inline-import '../shaders/simple/simpleline_frag.glsl' */
@@ -16,7 +16,6 @@ var simple_line_frag = "\nlayout(std140) uniform commonUniorm {\n vec4 u_source
16
16
  /* babel-plugin-inline-import '../shaders/simple/simpleline_vert.glsl' */
17
17
  var simple_line_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in vec4 a_SizeDistanceAndTotalDistance;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec4 u_dash_array;\n float u_vertexScale: 1.0;\n float u_linearColor: 0;\n};\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nout vec4 v_color;\nout float v_distanceScale;\nout vec4 v_dash_array;\n\nvoid main() {\n //dash\u8F93\u51FA\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_SizeDistanceAndTotalDistance.a;\n\n v_color = a_Color; \n v_distanceScale = a_SizeDistanceAndTotalDistance.b / a_SizeDistanceAndTotalDistance.a;\n v_color.a = v_color.a * 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_SizeDistanceAndTotalDistance.y) + h * 0.2, 1.0));\n } else {\n float lineHeight = a_SizeDistanceAndTotalDistance.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 // 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";
18
18
  import { ShaderLocation } from "../../core/CommonStyleAttribute";
19
- var isNumber = lodashUtil.isNumber;
20
19
  var SimpleLineModel = /*#__PURE__*/function (_BaseModel) {
21
20
  _inherits(SimpleLineModel, _BaseModel);
22
21
  var _super = _createSuper(SimpleLineModel);
@@ -17,7 +17,7 @@ import { LineTriangulation } from "../../core/triangulation";
17
17
  /* babel-plugin-inline-import '../shaders/wall/wall_frag.glsl' */
18
18
  var line_frag = "#define Animate 0.0\n#define LineTexture 1.0\n\n// line texture\n\nuniform sampler2D u_texture;\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed;\n float u_linearColor: 0;\n float u_line_texture;\n float u_textureBlend;\n float u_iconStepCount;\n float u_time;\n};\nin vec2 v_iconMapUV;\nin float v_blur;\nin float v_radio;\nin vec4 v_color;\nin vec4 v_dataset;\n\nout vec4 outputColor;\n#pragma include \"picking\"\n\nvoid main() {\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 outputColor = mix(u_sourceColor, u_targetColor, v);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n outputColor = v_color;\n }\n\n outputColor.a *= v_color.a; // \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 outputColor.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 = texture(SAMPLER_2D(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 outputColor = filterColor(outputColor + pattern);\n } else { // replace\n pattern.a *= v_color.a;\n if(outputColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n outputColor = filterColor(pattern);\n }\n }\n \n\n // blur - AA\n if(v < v_blur) {\n outputColor.a = mix(0.0, outputColor.a, v/v_blur);\n } else if(v > 1.0 - v_blur) {\n outputColor.a = mix(outputColor.a, 0.0, (v - (1.0 - v_blur))/v_blur);\n }\n\n outputColor = filterColor(outputColor);\n}\n";
19
19
  /* babel-plugin-inline-import '../shaders/wall/wall_vert.glsl' */
20
- var line_vert = "#define Animate 0.0\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in vec2 a_Size;\nlayout(location = 10) in float a_Miter;\nlayout(location = 11) in float a_Total_Distance;\nlayout(location = 12) in vec4 a_Instance;\nlayout(location = 13) in vec3 a_Normal;\nlayout(location = 14) in vec2 a_iconMapUV;\nlayout(location = 15) in float a_Distance;\n\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed;\n float u_linearColor: 0;\n float u_line_texture;\n float u_textureBlend;\n float u_iconStepCount;\n float u_time;\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\nout vec2 v_iconMapUV;\nout vec4 v_color;\nout float v_blur;\nout float v_radio;\nout 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) { \n originSize = project_float_meter(a_Size.x); // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n }\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 * opacity);\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 line_vert = "#define Animate 0.0\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in vec2 a_Size;\nlayout(location = 10) in float a_Miter;\nlayout(location = 11) in float a_Total_Distance;\nlayout(location = 12) in vec4 a_Instance;\nlayout(location = 13) in vec3 a_Normal;\nlayout(location = 14) in vec2 a_iconMapUV;\nlayout(location = 15) in float a_Distance;\n\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed;\n float u_linearColor: 0;\n float u_line_texture;\n float u_textureBlend;\n float u_iconStepCount;\n float u_time;\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\nout vec2 v_iconMapUV;\nout vec4 v_color;\nout float v_blur;\nout float v_radio;\nout 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) { \n originSize = project_float_meter(a_Size.x); // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n }\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 * opacity);\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// \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 if(u_heightfixed > 0.0) {\n wallHeight *= mapboxZoomScale;\n }\n \n } else {\n // lineHeight \u9876\u70B9\u504F\u79FB\u9AD8\u5EA6\n if(u_heightfixed < 1.0) {\n wallHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n }\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
21
21
  var LineWallModel = /*#__PURE__*/function (_BaseModel) {
22
22
  _inherits(LineWallModel, _BaseModel);
23
23
  var _super = _createSuper(LineWallModel);
@@ -68,7 +68,8 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
68
68
  var _ref2 = this.layer.getLayerConfig(),
69
69
  animateOption = _ref2.animateOption;
70
70
  if (this.rendererService.getDirty()) {
71
- this.texture.bind();
71
+ var _this$texture;
72
+ (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.bind();
72
73
  }
73
74
 
74
75
  // 转化渐变色
@@ -130,8 +131,8 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
130
131
  }, {
131
132
  key: "clearModels",
132
133
  value: function clearModels() {
133
- var _this$texture;
134
- (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
134
+ var _this$texture2;
135
+ (_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
135
136
  this.iconService.off('imageUpdate', this.updateTexture);
136
137
  }
137
138
  }, {
@@ -91,8 +91,6 @@ void main() {
91
91
  }
92
92
  gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h + u_raisingHeight, 1.0));
93
93
  } else {
94
- // mapbox - amap
95
-
96
94
  // 兼容 mapbox 在线高度上的效果表现基本一致
97
95
  if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
98
96
  // mapbox
@@ -78,6 +78,21 @@ void main() {
78
78
  if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
79
79
  gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));
80
80
  } else {
81
+ // 兼容 mapbox 在线高度上的效果表现基本一致
82
+ if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
83
+ // mapbox
84
+ // 保持高度相对不变
85
+ float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
86
+ if(u_heightfixed > 0.0) {
87
+ wallHeight *= mapboxZoomScale;
88
+ }
89
+
90
+ } else {
91
+ // lineHeight 顶点偏移高度
92
+ if(u_heightfixed < 1.0) {
93
+ wallHeight *= pow(2.0, 20.0 - u_Zoom);
94
+ }
95
+ }
81
96
  gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));
82
97
  }
83
98
 
@@ -1,11 +1,8 @@
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
  export default class DataMappingPlugin implements ILayerPlugin {
4
- private readonly mapService;
5
- private readonly fontService;
6
- apply(layer: ILayer, { styleAttributeService, }: {
7
- styleAttributeService: IStyleAttributeService;
8
- }): void;
3
+ private mapService;
4
+ private fontService;
5
+ apply(layer: ILayer, { styleAttributeService, mapService, fontService }: L7Container): void;
9
6
  private generateMaping;
10
7
  private mapping;
11
8
  private adjustData2Amap2Coordinates;