@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
@@ -13,7 +13,6 @@ exports.polygonPath = polygonPath;
13
13
  exports.square = square;
14
14
  exports.triangle = triangle;
15
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
- var _geometryShape;
17
16
  var ShapeType3D = exports.ShapeType3D = /*#__PURE__*/function (ShapeType3D) {
18
17
  ShapeType3D["CYLINDER"] = "cylinder";
19
18
  ShapeType3D["SQUARECOLUMN"] = "squareColumn";
@@ -65,4 +64,4 @@ function hexagon() {
65
64
  function pentagon() {
66
65
  return polygonPath(5);
67
66
  }
68
- var geometryShape = exports.geometryShape = (_geometryShape = {}, (0, _defineProperty2.default)(_geometryShape, ShapeType2D.CIRCLE, circle), (0, _defineProperty2.default)(_geometryShape, ShapeType2D.HEXAGON, hexagon), (0, _defineProperty2.default)(_geometryShape, ShapeType2D.TRIANGLE, triangle), (0, _defineProperty2.default)(_geometryShape, ShapeType2D.SQUARE, square), (0, _defineProperty2.default)(_geometryShape, ShapeType2D.PENTAGON, pentagon), (0, _defineProperty2.default)(_geometryShape, ShapeType3D.CYLINDER, circle), (0, _defineProperty2.default)(_geometryShape, ShapeType3D.HEXAGONCOLUMN, hexagon), (0, _defineProperty2.default)(_geometryShape, ShapeType3D.TRIANGLECOLUMN, triangle), (0, _defineProperty2.default)(_geometryShape, ShapeType3D.SQUARECOLUMN, square), (0, _defineProperty2.default)(_geometryShape, ShapeType3D.PENTAGONCOLUMN, pentagon), _geometryShape);
67
+ var geometryShape = exports.geometryShape = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, 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);
@@ -124,14 +124,10 @@ function lineArrowPath(coord) {
124
124
  var targetType = (0, _typeof2.default)(symbol['target']) === 'object' ? symbol['target'].type : symbol['target'];
125
125
  var _ref = (0, _typeof2.default)(symbol['source']) === 'object' ? symbol['source'] : {},
126
126
  _ref$width = _ref.width,
127
- sourceWidth = _ref$width === void 0 ? sourceType ? maxArrowWidthMap[sourceType] : 0 : _ref$width,
128
- _ref$height = _ref.height,
129
- sourceHeight = _ref$height === void 0 ? 2 : _ref$height;
127
+ sourceWidth = _ref$width === void 0 ? sourceType ? maxArrowWidthMap[sourceType] : 0 : _ref$width;
130
128
  var _ref2 = (0, _typeof2.default)(symbol['target']) === 'object' ? symbol['target'] : {},
131
129
  _ref2$width = _ref2.width,
132
- targetWidth = _ref2$width === void 0 ? targetType ? maxArrowWidthMap[targetType] : 0 : _ref2$width,
133
- _ref2$height = _ref2.height,
134
- targetHeight = _ref2$height === void 0 ? 2 : _ref2$height;
130
+ targetWidth = _ref2$width === void 0 ? targetType ? maxArrowWidthMap[targetType] : 0 : _ref2$width;
135
131
  return {
136
132
  vertices: [0, PathHeight, 1 * sourceWidth].concat((0, _toConsumableArray2.default)(coord), [1, PathHeight, -1 * targetWidth], (0, _toConsumableArray2.default)(coord), [1, -PathHeight, -1 * targetWidth], (0, _toConsumableArray2.default)(coord), [0, -PathHeight, 1 * sourceWidth], (0, _toConsumableArray2.default)(coord), [0, PathHeight, 1 * sourceWidth], (0, _toConsumableArray2.default)(coord), [1, PathHeight, -1 * targetWidth], (0, _toConsumableArray2.default)(coord), [1, -PathHeight, -1 * targetWidth], (0, _toConsumableArray2.default)(coord), [0, -PathHeight, 1 * sourceWidth], (0, _toConsumableArray2.default)(coord)),
137
133
  outLineIndices: [0, 1, 2, 0, 2, 3].map(function (t) {
@@ -92,7 +92,6 @@ function extrude_PolygonNormal(path) {
92
92
  // 顶部uv
93
93
  -1 // 顶部uv
94
94
  );
95
-
96
95
  normals.push(0, 0, 1);
97
96
  }
98
97
  var triangles = (0, _earcut.default)(flattengeo.vertices, flattengeo.holes, flattengeo.dimensions);
@@ -383,8 +383,8 @@ function HeatmapGridTriangulation(feature) {
383
383
  function RasterImageTriangulation(feature) {
384
384
  var coordinates = feature.coordinates;
385
385
  // [ x, y, z. uv.x, uv.y]
386
- var positions = [].concat((0, _toConsumableArray2.default)(coordinates[0]), [0, 0, 1, coordinates[1][0], coordinates[0][1], 0, 1, 1], (0, _toConsumableArray2.default)(coordinates[1]), [0, 1, 0], (0, _toConsumableArray2.default)(coordinates[0]), [0, 0, 1], (0, _toConsumableArray2.default)(coordinates[1]), [0, 1, 0, coordinates[0][0], coordinates[1][1], 0, 0, 0]);
387
- var indexs = [0, 1, 2, 3, 4, 5];
386
+ var positions = [].concat((0, _toConsumableArray2.default)(coordinates[0]), [0, 0, 0], (0, _toConsumableArray2.default)(coordinates[1]), [0, 1, 0], (0, _toConsumableArray2.default)(coordinates[2]), [0, 1, 1], (0, _toConsumableArray2.default)(coordinates[3]), [0, 0, 1]);
387
+ var indexs = [0, 1, 2, 0, 2, 3];
388
388
  return {
389
389
  vertices: positions,
390
390
  indices: indexs,
@@ -68,7 +68,6 @@ var BaseEarthModel = exports.default = /*#__PURE__*/function (_BaseModel) {
68
68
  u_specularRatio: (globalOptions === null || globalOptions === void 0 ? void 0 : globalOptions.specularRatio) || 0.1 // 高光反射
69
69
  // u_texture: this.texture,
70
70
  };
71
-
72
71
  this.textures = [this.texture];
73
72
  var commonBufferInfo = this.getUniformsBufferInfo(commonOptions);
74
73
  return commonBufferInfo;
@@ -76,7 +76,6 @@ var HeatMapLayer = exports.default = /*#__PURE__*/function (_BaseLayer) {
76
76
  if (this.layerModel) {
77
77
  this.layerModel.render(options); // 独立的渲染流程
78
78
  }
79
-
80
79
  return this;
81
80
  }
82
81
  if (this.encodeDataLength <= 0 && !this.forceRender) {
@@ -19,13 +19,10 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
19
19
  var _l7Core = require("@antv/l7-core");
20
20
  var _l7Utils = require("@antv/l7-utils");
21
21
  var _glMatrix = require("gl-matrix");
22
- var _inversify = require("inversify");
23
- require("reflect-metadata");
24
22
  var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
25
23
  var _triangulation = require("../../core/triangulation");
26
24
  var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
27
25
  var _triangulation2 = require("../triangulation");
28
- var _dec, _class;
29
26
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
30
27
  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; } }
31
28
  /* babel-plugin-inline-import '../shaders/heatmap/heatmap_3d_frag.glsl' */
@@ -41,7 +38,7 @@ var heatmap_framebuffer_frag = "layout(std140) uniform commonUniforms {\n float
41
38
  /* babel-plugin-inline-import '../shaders/heatmap/heatmap_framebuffer_vert.glsl' */
42
39
  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";
43
40
  var isEqual = _l7Utils.lodashUtil.isEqual;
44
- var HeatMapModel = exports.default = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function (_BaseModel) {
41
+ var HeatMapModel = exports.default = /*#__PURE__*/function (_BaseModel) {
45
42
  (0, _inherits2.default)(HeatMapModel, _BaseModel);
46
43
  var _super = _createSuper(HeatMapModel);
47
44
  function HeatMapModel() {
@@ -498,4 +495,4 @@ var HeatMapModel = exports.default = (_dec = (0, _inversify.injectable)(), _dec(
498
495
  }
499
496
  }]);
500
497
  return HeatMapModel;
501
- }(_BaseModel2.default)) || _class);
498
+ }(_BaseModel2.default);
package/lib/index.js CHANGED
@@ -16,6 +16,7 @@ var _exportNames = {
16
16
  PointLayer: true,
17
17
  PolygonLayer: true,
18
18
  RasterLayer: true,
19
+ TileLayer: true,
19
20
  TileDebugLayer: true,
20
21
  EarthLayer: true,
21
22
  MaskLayer: true,
@@ -105,13 +106,18 @@ Object.defineProperty(exports, "TileDebugLayer", {
105
106
  return _TileDebugLayer.default;
106
107
  }
107
108
  });
109
+ Object.defineProperty(exports, "TileLayer", {
110
+ enumerable: true,
111
+ get: function get() {
112
+ return _BaseLayer2.default;
113
+ }
114
+ });
108
115
  Object.defineProperty(exports, "WindLayer", {
109
116
  enumerable: true,
110
117
  get: function get() {
111
118
  return _wind.default;
112
119
  }
113
120
  });
114
- var _l7Core = require("@antv/l7-core");
115
121
  var _canvas = _interopRequireDefault(require("./canvas"));
116
122
  var _building = _interopRequireDefault(require("./citybuliding/building"));
117
123
  var _BaseLayer = _interopRequireDefault(require("./core/BaseLayer"));
@@ -123,24 +129,11 @@ var _index = _interopRequireDefault(require("./line/index"));
123
129
  var _point = _interopRequireDefault(require("./point"));
124
130
  var _polygon = _interopRequireDefault(require("./polygon"));
125
131
  var _raster = _interopRequireDefault(require("./raster"));
132
+ var _BaseLayer2 = _interopRequireDefault(require("./tile/core/BaseLayer"));
126
133
  var _TileDebugLayer = _interopRequireDefault(require("./tile/core/TileDebugLayer"));
127
134
  var _earth = _interopRequireDefault(require("./earth"));
128
135
  var _mask = _interopRequireDefault(require("./mask"));
129
136
  var _wind = _interopRequireDefault(require("./wind"));
130
- var _DataMappingPlugin = _interopRequireDefault(require("./plugins/DataMappingPlugin"));
131
- var _DataSourcePlugin = _interopRequireDefault(require("./plugins/DataSourcePlugin"));
132
- var _FeatureScalePlugin = _interopRequireDefault(require("./plugins/FeatureScalePlugin"));
133
- var _LayerAnimateStylePlugin = _interopRequireDefault(require("./plugins/LayerAnimateStylePlugin"));
134
- var _LayerMaskPlugin = _interopRequireDefault(require("./plugins/LayerMaskPlugin"));
135
- var _LayerModelPlugin = _interopRequireDefault(require("./plugins/LayerModelPlugin"));
136
- var _LayerStylePlugin = _interopRequireDefault(require("./plugins/LayerStylePlugin"));
137
- var _LightingPlugin = _interopRequireDefault(require("./plugins/LightingPlugin"));
138
- var _MultiPassRendererPlugin = _interopRequireDefault(require("./plugins/MultiPassRendererPlugin"));
139
- var _PixelPickingPlugin = _interopRequireDefault(require("./plugins/PixelPickingPlugin"));
140
- var _RegisterStyleAttributePlugin = _interopRequireDefault(require("./plugins/RegisterStyleAttributePlugin"));
141
- var _ShaderUniformPlugin = _interopRequireDefault(require("./plugins/ShaderUniformPlugin"));
142
- var _UpdateModelPlugin = _interopRequireDefault(require("./plugins/UpdateModelPlugin"));
143
- var _UpdateStyleAttributePlugin = _interopRequireDefault(require("./plugins/UpdateStyleAttributePlugin"));
144
137
  var _interface = require("./core/interface");
145
138
  Object.keys(_interface).forEach(function (key) {
146
139
  if (key === "default" || key === "__esModule") return;
@@ -152,78 +145,4 @@ Object.keys(_interface).forEach(function (key) {
152
145
  return _interface[key];
153
146
  }
154
147
  });
155
- });
156
- // 逐步替换为 Geometry
157
-
158
- // import ConfigSchemaValidationPlugin from './plugins/ConfigSchemaValidationPlugin';
159
-
160
- /**
161
- * 校验传入参数配置项的正确性
162
- * @see /dev-docs/ConfigSchemaValidation.md
163
- */
164
- // container
165
- // .bind<ILayerPlugin>(TYPES.ILayerPlugin)
166
- // .to(ConfigSchemaValidationPlugin)
167
- // .inRequestScope();
168
- /**
169
- * 获取 Source
170
- */
171
- _l7Core.container.bind(_l7Core.TYPES.ILayerPlugin).to(_DataSourcePlugin.default).inRequestScope();
172
- /**
173
- * 根据 StyleAttribute 创建 VertexAttribute
174
- */
175
- _l7Core.container.bind(_l7Core.TYPES.ILayerPlugin).to(_RegisterStyleAttributePlugin.default).inRequestScope();
176
- /**
177
- * 根据 Source 创建 Scale
178
- */
179
- _l7Core.container.bind(_l7Core.TYPES.ILayerPlugin).to(_FeatureScalePlugin.default).inRequestScope();
180
- /**
181
- * 使用 Scale 进行数据映射
182
- */
183
- _l7Core.container.bind(_l7Core.TYPES.ILayerPlugin).to(_DataMappingPlugin.default).inRequestScope();
184
-
185
- /**
186
- * 更新地图样式配置项 如active, show, hide
187
- */
188
- _l7Core.container.bind(_l7Core.TYPES.ILayerPlugin).to(_LayerStylePlugin.default).inRequestScope();
189
-
190
- /**
191
- * 初始化地图 Mask
192
- */
193
- _l7Core.container.bind(_l7Core.TYPES.ILayerPlugin).to(_LayerMaskPlugin.default).inRequestScope();
194
-
195
- /**
196
- * 负责属性更新
197
- */
198
- _l7Core.container.bind(_l7Core.TYPES.ILayerPlugin).to(_UpdateStyleAttributePlugin.default).inRequestScope();
199
-
200
- /**
201
- * 负责Model更新
202
- */
203
- _l7Core.container.bind(_l7Core.TYPES.ILayerPlugin).to(_UpdateModelPlugin.default).inRequestScope();
204
-
205
- /**
206
- * Multi Pass 自定义渲染管线
207
- */
208
- _l7Core.container.bind(_l7Core.TYPES.ILayerPlugin).to(_MultiPassRendererPlugin.default).inRequestScope();
209
- /**
210
- * 传入相机坐标系参数
211
- */
212
- _l7Core.container.bind(_l7Core.TYPES.ILayerPlugin).to(_ShaderUniformPlugin.default).inRequestScope();
213
-
214
- /**
215
- * 传入动画参数
216
- */
217
- _l7Core.container.bind(_l7Core.TYPES.ILayerPlugin).to(_LayerAnimateStylePlugin.default).inRequestScope();
218
- /**
219
- * 传入光照相关参数
220
- */
221
- _l7Core.container.bind(_l7Core.TYPES.ILayerPlugin).to(_LightingPlugin.default).inRequestScope();
222
- /**
223
- * 负责拾取过程中 Encode 以及 Highlight 阶段及结束后恢复
224
- */
225
- _l7Core.container.bind(_l7Core.TYPES.ILayerPlugin).to(_PixelPickingPlugin.default).inRequestScope();
226
- /**
227
- * 初始化Model
228
- */
229
- _l7Core.container.bind(_l7Core.TYPES.ILayerPlugin).to(_LayerModelPlugin.default).inRequestScope();
148
+ });
@@ -29,7 +29,6 @@ var lineStyleObj = {
29
29
  solid: 0.0,
30
30
  dash: 1.0
31
31
  };
32
- var isNumber = _l7Utils.lodashUtil.isNumber;
33
32
  var ArcModel = exports.default = /*#__PURE__*/function (_BaseModel) {
34
33
  (0, _inherits2.default)(ArcModel, _BaseModel);
35
34
  var _super = _createSuper(ArcModel);
@@ -101,7 +100,8 @@ var ArcModel = exports.default = /*#__PURE__*/function (_BaseModel) {
101
100
  useLinearColor = 1;
102
101
  }
103
102
  if (this.rendererService.getDirty()) {
104
- this.texture.bind();
103
+ var _this$texture;
104
+ (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.bind();
105
105
  }
106
106
  var commonOptions = {
107
107
  u_animate: this.animateOption2Array(animateOption),
@@ -158,8 +158,8 @@ var ArcModel = exports.default = /*#__PURE__*/function (_BaseModel) {
158
158
  }, {
159
159
  key: "clearModels",
160
160
  value: function clearModels() {
161
- var _this$texture;
162
- (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
161
+ var _this$texture2;
162
+ (_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
163
163
  this.iconService.off('imageUpdate', this.updateTexture);
164
164
  }
165
165
  }, {
@@ -98,7 +98,8 @@ var Arc3DModel = exports.default = /*#__PURE__*/function (_BaseModel) {
98
98
  useLinearColor = 1;
99
99
  }
100
100
  if (this.rendererService.getDirty()) {
101
- this.texture.bind();
101
+ var _this$texture;
102
+ (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.bind();
102
103
  }
103
104
  var commonOptions = {
104
105
  u_animate: this.animateOption2Array(animateOption),
@@ -119,7 +120,6 @@ var Arc3DModel = exports.default = /*#__PURE__*/function (_BaseModel) {
119
120
  u_time: this.layer.getLayerAnimateTime() || 0,
120
121
  u_linearColor: useLinearColor //是否使用渐变色
121
122
  };
122
-
123
123
  var commonBufferInfo = this.getUniformsBufferInfo(commonOptions);
124
124
  return commonBufferInfo;
125
125
  }
@@ -156,8 +156,8 @@ var Arc3DModel = exports.default = /*#__PURE__*/function (_BaseModel) {
156
156
  }, {
157
157
  key: "clearModels",
158
158
  value: function clearModels() {
159
- var _this$texture;
160
- (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
159
+ var _this$texture2;
160
+ (_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
161
161
  this.iconService.off('imageUpdate', this.updateTexture);
162
162
  }
163
163
  }, {
@@ -84,7 +84,8 @@ var GreatCircleModel = exports.default = /*#__PURE__*/function (_BaseModel) {
84
84
  dashArray.push(0, 0);
85
85
  }
86
86
  if (this.rendererService.getDirty()) {
87
- this.texture.bind();
87
+ var _this$texture;
88
+ (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.bind();
88
89
  }
89
90
 
90
91
  // 转化渐变色
@@ -153,8 +154,8 @@ var GreatCircleModel = exports.default = /*#__PURE__*/function (_BaseModel) {
153
154
  }, {
154
155
  key: "clearModels",
155
156
  value: function clearModels() {
156
- var _this$texture;
157
- (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
157
+ var _this$texture2;
158
+ (_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
158
159
  this.iconService.off('imageUpdate', this.updateTexture);
159
160
  }
160
161
  }, {
@@ -252,7 +253,6 @@ var GreatCircleModel = exports.default = /*#__PURE__*/function (_BaseModel) {
252
253
  update: function update(feature) {
253
254
  var iconMap = _this2.iconService.getIconMap();
254
255
  var texture = feature.texture;
255
- // console.log('icon feature', feature)
256
256
  var _ref4 = iconMap[texture] || {
257
257
  x: 0,
258
258
  y: 0
@@ -19,17 +19,14 @@ var _l7Core = require("@antv/l7-core");
19
19
  var _l7Utils = require("@antv/l7-utils");
20
20
  var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
21
21
  var _interface = require("../../core/interface");
22
+ var _triangulation = require("../../core/triangulation");
22
23
  var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
23
24
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
24
- 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; } } // import { LineTriangulation } from '../../core/triangulation';
25
+ 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; } }
25
26
  /* babel-plugin-inline-import '../shaders/line/line_frag.glsl' */
26
27
  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";
27
28
  /* babel-plugin-inline-import '../shaders/line/line_vert.glsl' */
28
- 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";
29
- var lineStyleObj = {
30
- solid: 0.0,
31
- dash: 1.0
32
- };
29
+ 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";
33
30
  var LineModel = exports.default = /*#__PURE__*/function (_BaseModel) {
34
31
  (0, _inherits2.default)(LineModel, _BaseModel);
35
32
  var _super = _createSuper(LineModel);
@@ -105,7 +102,8 @@ var LineModel = exports.default = /*#__PURE__*/function (_BaseModel) {
105
102
  u_dash_array.push(0, 0);
106
103
  }
107
104
  if (this.rendererService.getDirty() && this.texture) {
108
- this.texture.bind();
105
+ var _this$texture;
106
+ (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.bind();
109
107
  }
110
108
  var _ref2 = this.layer.getLayerConfig(),
111
109
  animateOption = _ref2.animateOption;
@@ -180,8 +178,8 @@ var LineModel = exports.default = /*#__PURE__*/function (_BaseModel) {
180
178
  }, {
181
179
  key: "clearModels",
182
180
  value: function clearModels() {
183
- var _this$texture;
184
- (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
181
+ var _this$texture2;
182
+ (_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
185
183
  this.iconService.off('imageUpdate', this.updateTexture);
186
184
  }
187
185
  }, {
@@ -193,14 +191,14 @@ var LineModel = exports.default = /*#__PURE__*/function (_BaseModel) {
193
191
  while (1) switch (_context2.prev = _context2.next) {
194
192
  case 0:
195
193
  _ref3 = this.layer.getLayerConfig(), _ref3$depth = _ref3.depth, depth = _ref3$depth === void 0 ? false : _ref3$depth;
196
- _this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type; // console.log(frag)
197
- this.layer.triangulation = _l7Utils.LineTriangulation;
194
+ _this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
195
+ this.layer.triangulation = _triangulation.LineTriangulation;
198
196
  _context2.next = 5;
199
197
  return this.layer.buildLayerModel({
200
198
  moduleName: 'line' + type,
201
199
  vertexShader: vert,
202
200
  fragmentShader: frag,
203
- triangulation: _l7Utils.LineTriangulation,
201
+ triangulation: _triangulation.LineTriangulation,
204
202
  inject: this.getInject(),
205
203
  depth: {
206
204
  enable: depth
@@ -23,7 +23,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
23
23
  var simple_line_frag = "\nlayout(std140) uniform commonUniorm {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec4 u_dash_array;\n float u_vertexScale: 1.0;\n float u_linearColor: 0;\n};\nin float v_distanceScale;\nin vec4 v_color;\n//dash\nin vec4 v_dash_array;\n\nout vec4 outputColor;\nvoid main() {\n if(u_dash_array!=vec4(0.0)){\n float dashLength = mod(v_distanceScale, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(!(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z))) {\n // \u865A\u7EBF\u90E8\u5206\n discard;\n };\n }\n if(u_linearColor==1.0){\n outputColor = mix(u_sourceColor, u_targetColor, v_distanceScale);\n outputColor.a *= v_color.a; // \u5168\u5C40\u900F\u660E\u5EA6\n }\n else{\n outputColor = v_color;\n }\n}\n";
24
24
  /* babel-plugin-inline-import '../shaders/simple/simpleline_vert.glsl' */
25
25
  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";
26
- var isNumber = _l7Utils.lodashUtil.isNumber;
27
26
  var SimpleLineModel = exports.default = /*#__PURE__*/function (_BaseModel) {
28
27
  (0, _inherits2.default)(SimpleLineModel, _BaseModel);
29
28
  var _super = _createSuper(SimpleLineModel);
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
24
24
  /* babel-plugin-inline-import '../shaders/wall/wall_frag.glsl' */
25
25
  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";
26
26
  /* babel-plugin-inline-import '../shaders/wall/wall_vert.glsl' */
27
- 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";
27
+ 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";
28
28
  var LineWallModel = exports.default = /*#__PURE__*/function (_BaseModel) {
29
29
  (0, _inherits2.default)(LineWallModel, _BaseModel);
30
30
  var _super = _createSuper(LineWallModel);
@@ -75,7 +75,8 @@ var LineWallModel = exports.default = /*#__PURE__*/function (_BaseModel) {
75
75
  var _ref2 = this.layer.getLayerConfig(),
76
76
  animateOption = _ref2.animateOption;
77
77
  if (this.rendererService.getDirty()) {
78
- this.texture.bind();
78
+ var _this$texture;
79
+ (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.bind();
79
80
  }
80
81
 
81
82
  // 转化渐变色
@@ -137,8 +138,8 @@ var LineWallModel = exports.default = /*#__PURE__*/function (_BaseModel) {
137
138
  }, {
138
139
  key: "clearModels",
139
140
  value: function clearModels() {
140
- var _this$texture;
141
- (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
141
+ var _this$texture2;
142
+ (_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
142
143
  this.iconService.off('imageUpdate', this.updateTexture);
143
144
  }
144
145
  }, {
@@ -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
 
@@ -8,29 +8,24 @@ exports.default = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
- var _initializerDefineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/initializerDefineProperty"));
12
11
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
14
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
- var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime/helpers/applyDecoratedDescriptor"));
16
- var _initializerWarningHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/initializerWarningHelper"));
17
13
  var _l7Core = require("@antv/l7-core");
18
14
  var _l7Utils = require("@antv/l7-utils");
19
- var _inversify = require("inversify");
20
- require("reflect-metadata");
21
- var _dec, _dec2, _dec3, _class, _class2, _descriptor, _descriptor2;
22
15
  var cloneDeep = _l7Utils.lodashUtil.cloneDeep;
23
- var DataMappingPlugin = exports.default = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inversify.inject)(_l7Core.TYPES.IMapService), _dec3 = (0, _inversify.inject)(_l7Core.TYPES.IFontService), _dec(_class = (_class2 = /*#__PURE__*/function () {
16
+ var DataMappingPlugin = exports.default = /*#__PURE__*/function () {
24
17
  function DataMappingPlugin() {
25
18
  (0, _classCallCheck2.default)(this, DataMappingPlugin);
26
- (0, _initializerDefineProperty2.default)(this, "mapService", _descriptor, this);
27
- (0, _initializerDefineProperty2.default)(this, "fontService", _descriptor2, this);
28
19
  }
29
20
  (0, _createClass2.default)(DataMappingPlugin, [{
30
21
  key: "apply",
31
22
  value: function apply(layer, _ref) {
32
23
  var _this = this;
33
- var styleAttributeService = _ref.styleAttributeService;
24
+ var styleAttributeService = _ref.styleAttributeService,
25
+ mapService = _ref.mapService,
26
+ fontService = _ref.fontService;
27
+ this.mapService = mapService;
28
+ this.fontService = fontService;
34
29
  layer.hooks.init.tapPromise('DataMappingPlugin', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
35
30
  return _regenerator.default.wrap(function _callee$(_context) {
36
31
  while (1) switch (_context.prev = _context.next) {
@@ -94,7 +89,6 @@ var DataMappingPlugin = exports.default = (_dec = (0, _inversify.injectable)(),
94
89
  return attribute.needRemapping;
95
90
  } // 如果filter变化
96
91
  );
97
-
98
92
  var filterData = dataArray;
99
93
  // 数据过滤完 再执行数据映射
100
94
  if (filter !== null && filter !== void 0 && filter.needRemapping && filter !== null && filter !== void 0 && filter.scale) {
@@ -106,7 +100,6 @@ var DataMappingPlugin = exports.default = (_dec = (0, _inversify.injectable)(),
106
100
  // 过滤数据
107
101
  var encodeData = _this.mapping(layer, attributesToRemapping, filterData, layer.getEncodedData() // TODO 优化
108
102
  );
109
-
110
103
  layer.setEncodedData(encodeData);
111
104
  }
112
105
 
@@ -283,14 +276,4 @@ var DataMappingPlugin = exports.default = (_dec = (0, _inversify.injectable)(),
283
276
  }
284
277
  }]);
285
278
  return DataMappingPlugin;
286
- }(), (_descriptor = (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "mapService", [_dec2], {
287
- configurable: true,
288
- enumerable: true,
289
- writable: true,
290
- initializer: null
291
- }), _descriptor2 = (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "fontService", [_dec3], {
292
- configurable: true,
293
- enumerable: true,
294
- writable: true,
295
- initializer: null
296
- })), _class2)) || _class);
279
+ }();
@@ -11,10 +11,7 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
11
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
12
12
  var _l7Core = require("@antv/l7-core");
13
13
  var _l7Source = _interopRequireDefault(require("@antv/l7-source"));
14
- var _inversify = require("inversify");
15
- require("reflect-metadata");
16
- var _dec, _class;
17
- var DataSourcePlugin = exports.default = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
14
+ var DataSourcePlugin = exports.default = /*#__PURE__*/function () {
18
15
  function DataSourcePlugin() {
19
16
  (0, _classCallCheck2.default)(this, DataSourcePlugin);
20
17
  }
@@ -22,7 +19,7 @@ var DataSourcePlugin = exports.default = (_dec = (0, _inversify.injectable)(), _
22
19
  key: "apply",
23
20
  value: function apply(layer) {
24
21
  var _this = this;
25
- this.mapService = layer.getContainer().get(_l7Core.TYPES.IMapService);
22
+ this.mapService = layer.getContainer().mapService;
26
23
  layer.hooks.init.tapPromise('DataSourcePlugin', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
27
24
  var source, _ref2, data, options;
28
25
  return _regenerator.default.wrap(function _callee$(_context) {
@@ -109,4 +106,4 @@ var DataSourcePlugin = exports.default = (_dec = (0, _inversify.injectable)(), _
109
106
  }
110
107
  }]);
111
108
  return DataSourcePlugin;
112
- }()) || _class);
109
+ }();