@antv/l7-layers 2.19.11 → 2.20.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 (173) hide show
  1. package/es/canvas/models/canvas.js +2 -2
  2. package/es/core/BaseLayer.d.ts +1 -1
  3. package/es/core/BaseLayer.js +18 -11
  4. package/es/core/BaseModel.d.ts +3 -1
  5. package/es/core/BaseModel.js +28 -4
  6. package/es/core/CommonStyleAttribute.d.ts +15 -0
  7. package/es/core/CommonStyleAttribute.js +21 -0
  8. package/es/core/TextureService.js +2 -2
  9. package/es/earth/index.js +1 -1
  10. package/es/geometry/index.js +1 -1
  11. package/es/geometry/models/billboard.js +1 -1
  12. package/es/geometry/models/plane.js +2 -2
  13. package/es/geometry/models/sprite.js +2 -2
  14. package/es/heatmap/index.js +1 -1
  15. package/es/heatmap/models/heatmap.js +4 -4
  16. package/es/image/models/image.js +1 -1
  17. package/es/line/index.js +1 -1
  18. package/es/line/models/arc.js +1 -1
  19. package/es/line/models/arc_3d.js +1 -1
  20. package/es/line/models/earthArc_3d.js +1 -1
  21. package/es/line/models/great_circle.js +1 -1
  22. package/es/line/models/line.js +1 -1
  23. package/es/line/models/linearline.js +1 -1
  24. package/es/line/models/wall.js +1 -1
  25. package/es/plugins/DataMappingPlugin.js +1 -1
  26. package/es/plugins/PixelPickingPlugin.d.ts +4 -1
  27. package/es/plugins/PixelPickingPlugin.js +91 -22
  28. package/es/plugins/RegisterStyleAttributePlugin.d.ts +0 -1
  29. package/es/plugins/RegisterStyleAttributePlugin.js +4 -22
  30. package/es/plugins/ShaderUniformPlugin.d.ts +2 -0
  31. package/es/plugins/ShaderUniformPlugin.js +74 -6
  32. package/es/point/index.js +1 -1
  33. package/es/point/models/fill.js +31 -7
  34. package/es/point/models/fillmage.js +1 -1
  35. package/es/point/models/image.js +1 -1
  36. package/es/point/models/normal.js +30 -12
  37. package/es/point/models/text.js +1 -1
  38. package/es/point/shaders/fill_frag.glsl +20 -14
  39. package/es/point/shaders/fill_vert.glsl +19 -18
  40. package/es/point/shaders/normal_frag.glsl +4 -3
  41. package/es/point/shaders/normal_vert.glsl +12 -11
  42. package/es/polygon/index.js +1 -1
  43. package/es/polygon/models/extrude.js +1 -1
  44. package/es/polygon/models/extrusion.js +1 -1
  45. package/es/polygon/models/ocean.js +3 -3
  46. package/es/polygon/models/water.js +1 -1
  47. package/es/raster/models/raster.js +2 -2
  48. package/es/raster/models/rasterRgb.js +1 -1
  49. package/es/raster/models/rasterTerrainRgb.js +1 -1
  50. package/es/tile/core/BaseLayer.js +4 -4
  51. package/es/tile/interaction/getRasterData.js +4 -4
  52. package/es/tile/service/TileLayerService.js +4 -4
  53. package/es/tile/service/TilePickService.js +3 -3
  54. package/es/tile/tile/Tile.d.ts +3 -0
  55. package/es/tile/tile/Tile.js +2 -2
  56. package/es/wind/models/wind.js +5 -6
  57. package/lib/canvas/index.js +2 -3
  58. package/lib/canvas/models/canvas.js +4 -5
  59. package/lib/canvas/models/index.js +1 -2
  60. package/lib/citybuliding/building.js +2 -3
  61. package/lib/citybuliding/models/build.js +2 -3
  62. package/lib/core/BaseLayer.js +19 -13
  63. package/lib/core/BaseModel.js +30 -7
  64. package/lib/core/CommonStyleAttribute.js +22 -0
  65. package/lib/core/LayerPickService.js +2 -3
  66. package/lib/core/TextureService.js +4 -5
  67. package/lib/core/constant.js +3 -5
  68. package/lib/core/interface.js +6 -11
  69. package/lib/core/schema.js +2 -3
  70. package/lib/core/shape/Path.js +3 -6
  71. package/lib/core/triangulation.js +2 -2
  72. package/lib/earth/index.js +3 -4
  73. package/lib/earth/models/atmosphere.js +2 -3
  74. package/lib/earth/models/base.js +2 -3
  75. package/lib/earth/models/bloomsphere.js +2 -3
  76. package/lib/earth/utils.js +3 -6
  77. package/lib/geometry/index.js +3 -4
  78. package/lib/geometry/models/billboard.js +3 -4
  79. package/lib/geometry/models/index.js +1 -2
  80. package/lib/geometry/models/plane.js +4 -5
  81. package/lib/geometry/models/sprite.js +4 -5
  82. package/lib/heatmap/index.js +3 -4
  83. package/lib/heatmap/models/grid.js +2 -3
  84. package/lib/heatmap/models/grid3d.js +2 -3
  85. package/lib/heatmap/models/heatmap.js +6 -7
  86. package/lib/heatmap/models/hexagon.js +2 -3
  87. package/lib/heatmap/models/index.js +1 -2
  88. package/lib/image/index.js +2 -3
  89. package/lib/image/models/image.js +3 -4
  90. package/lib/image/models/index.js +1 -2
  91. package/lib/line/index.js +3 -4
  92. package/lib/line/models/arc.js +3 -4
  93. package/lib/line/models/arc_3d.js +3 -4
  94. package/lib/line/models/earthArc_3d.js +3 -4
  95. package/lib/line/models/flow.js +2 -3
  96. package/lib/line/models/great_circle.js +3 -4
  97. package/lib/line/models/index.js +1 -2
  98. package/lib/line/models/line.js +3 -4
  99. package/lib/line/models/linearline.js +3 -4
  100. package/lib/line/models/simpleLine.js +2 -3
  101. package/lib/line/models/wall.js +3 -4
  102. package/lib/mask/index.js +2 -3
  103. package/lib/mask/models/fill.js +2 -3
  104. package/lib/mask/models/index.js +1 -2
  105. package/lib/plugins/DataMappingPlugin.js +3 -4
  106. package/lib/plugins/DataSourcePlugin.js +2 -3
  107. package/lib/plugins/FeatureScalePlugin.js +4 -5
  108. package/lib/plugins/LayerAnimateStylePlugin.js +2 -3
  109. package/lib/plugins/LayerMaskPlugin.js +2 -3
  110. package/lib/plugins/LayerModelPlugin.js +2 -3
  111. package/lib/plugins/LayerStylePlugin.js +2 -3
  112. package/lib/plugins/LightingPlugin.js +2 -3
  113. package/lib/plugins/MultiPassRendererPlugin.js +2 -3
  114. package/lib/plugins/PixelPickingPlugin.js +93 -25
  115. package/lib/plugins/RegisterStyleAttributePlugin.js +6 -25
  116. package/lib/plugins/ShaderUniformPlugin.js +75 -8
  117. package/lib/plugins/UpdateModelPlugin.js +2 -3
  118. package/lib/plugins/UpdateStyleAttributePlugin.js +2 -3
  119. package/lib/point/index.js +3 -4
  120. package/lib/point/models/billboard_point.js +2 -3
  121. package/lib/point/models/earthExtrude.js +2 -3
  122. package/lib/point/models/earthFill.js +2 -3
  123. package/lib/point/models/extrude.js +2 -3
  124. package/lib/point/models/fill.js +33 -10
  125. package/lib/point/models/fillmage.js +3 -4
  126. package/lib/point/models/image.js +3 -4
  127. package/lib/point/models/index.js +1 -2
  128. package/lib/point/models/normal.js +32 -15
  129. package/lib/point/models/radar.js +2 -3
  130. package/lib/point/models/text.js +3 -4
  131. package/lib/point/shaders/fill_frag.glsl +20 -14
  132. package/lib/point/shaders/fill_vert.glsl +19 -18
  133. package/lib/point/shaders/normal_frag.glsl +4 -3
  134. package/lib/point/shaders/normal_vert.glsl +12 -11
  135. package/lib/polygon/index.js +3 -4
  136. package/lib/polygon/models/extrude.js +3 -4
  137. package/lib/polygon/models/extrusion.js +3 -4
  138. package/lib/polygon/models/fill.js +2 -3
  139. package/lib/polygon/models/index.js +1 -2
  140. package/lib/polygon/models/ocean.js +5 -6
  141. package/lib/polygon/models/water.js +3 -4
  142. package/lib/raster/index.js +2 -3
  143. package/lib/raster/models/index.js +1 -2
  144. package/lib/raster/models/raster.js +4 -5
  145. package/lib/raster/models/rasterRgb.js +3 -4
  146. package/lib/raster/models/rasterTerrainRgb.js +3 -4
  147. package/lib/tile/core/BaseLayer.js +6 -7
  148. package/lib/tile/core/TileDebugLayer.js +2 -3
  149. package/lib/tile/interaction/getRasterData.js +4 -4
  150. package/lib/tile/service/TileLayerService.js +6 -7
  151. package/lib/tile/service/TilePickService.js +5 -6
  152. package/lib/tile/service/TileSourceService.js +4 -5
  153. package/lib/tile/tile/DebugTile.js +2 -3
  154. package/lib/tile/tile/ImageTile.js +2 -3
  155. package/lib/tile/tile/MaskTile.js +2 -3
  156. package/lib/tile/tile/RasterRGBTile.js +2 -3
  157. package/lib/tile/tile/RasterTerrainRGBTile.js +2 -3
  158. package/lib/tile/tile/RasterTile.js +2 -3
  159. package/lib/tile/tile/Tile.js +4 -5
  160. package/lib/tile/tile/VectorTile.js +2 -3
  161. package/lib/tile/utils/constants.js +2 -3
  162. package/lib/tile/utils/utils.js +1 -2
  163. package/lib/utils/blend.js +2 -3
  164. package/lib/utils/collision-index.js +2 -3
  165. package/lib/utils/extrude_polyline.js +2 -3
  166. package/lib/utils/grid-index.js +1 -2
  167. package/lib/utils/simpleLine.js +2 -3
  168. package/lib/wind/index.js +2 -3
  169. package/lib/wind/models/index.js +1 -2
  170. package/lib/wind/models/wind.js +7 -9
  171. package/lib/wind/models/windRender.js +4 -5
  172. package/lib/wind/models/windShader.js +6 -12
  173. package/package.json +7 -7
@@ -47,7 +47,7 @@ var isEqual = _l7Utils.lodashUtil.isEqual,
47
47
  * 分配 layer id
48
48
  */
49
49
  var layerIdCounter = 0;
50
- var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function (_ref) {
50
+ var BaseLayer = exports.default = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function (_ref) {
51
51
  (0, _inherits2.default)(BaseLayer, _ref);
52
52
  var _super = _createSuper(BaseLayer);
53
53
  // private pickingPassRender: IPass<'pixelPicking'>;
@@ -381,7 +381,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
381
381
  id: this.id,
382
382
  type: this.type
383
383
  };
384
- (_this$debugService = this.debugService) === null || _this$debugService === void 0 ? void 0 : _this$debugService.log(key, values);
384
+ (_this$debugService = this.debugService) === null || _this$debugService === void 0 || _this$debugService.log(key, values);
385
385
  }
386
386
  }, {
387
387
  key: "updateModelData",
@@ -957,6 +957,12 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
957
957
  if (this.isDestroyed) {
958
958
  return;
959
959
  }
960
+
961
+ // destroy all UBOs
962
+ this.layerModel.uniformBuffers.forEach(function (buffer) {
963
+ buffer.destroy();
964
+ });
965
+
960
966
  // remove child layer
961
967
  this.layerChildren.map(function (child) {
962
968
  return child.destroy(false);
@@ -975,7 +981,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
975
981
  this.hooks.beforeDestroy.call();
976
982
  // 清除sources事件
977
983
  this.layerSource.off('update', this.sourceEvent);
978
- (_this$multiPassRender = this.multiPassRenderer) === null || _this$multiPassRender === void 0 ? void 0 : _this$multiPassRender.destroy();
984
+ (_this$multiPassRender = this.multiPassRenderer) === null || _this$multiPassRender === void 0 || _this$multiPassRender.destroy();
979
985
  this.textureService.destroy();
980
986
 
981
987
  // 清除所有属性以及关联的 vao == 销毁所有 => model this.models.forEach((model) => model.destroy());
@@ -985,11 +991,11 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
985
991
 
986
992
  this.hooks.afterDestroy.call();
987
993
  // Tip: 清除各个图层自定义的 models 资源
988
- (_this$layerModel = this.layerModel) === null || _this$layerModel === void 0 ? void 0 : _this$layerModel.clearModels(refresh);
989
- (_this$tileLayer = this.tileLayer) === null || _this$tileLayer === void 0 ? void 0 : _this$tileLayer.destroy();
994
+ (_this$layerModel = this.layerModel) === null || _this$layerModel === void 0 || _this$layerModel.clearModels(refresh);
995
+ (_this$tileLayer = this.tileLayer) === null || _this$tileLayer === void 0 || _this$tileLayer.destroy();
990
996
  this.models = [];
991
997
  // 清除图层日志(如果有的话:非瓦片相关)
992
- (_this$debugService2 = this.debugService) === null || _this$debugService2 === void 0 ? void 0 : _this$debugService2.removeLog(this.id);
998
+ (_this$debugService2 = this.debugService) === null || _this$debugService2 === void 0 || _this$debugService2.removeLog(this.id);
993
999
  this.emit('remove', {
994
1000
  target: this,
995
1001
  type: 'remove'
@@ -1016,7 +1022,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1016
1022
  this.models.forEach(function (model) {
1017
1023
  return model.destroy();
1018
1024
  });
1019
- (_this$layerModel2 = this.layerModel) === null || _this$layerModel2 === void 0 ? void 0 : _this$layerModel2.clearModels();
1025
+ (_this$layerModel2 = this.layerModel) === null || _this$layerModel2 === void 0 || _this$layerModel2.clearModels();
1020
1026
  this.models = [];
1021
1027
  }
1022
1028
  }, {
@@ -1099,10 +1105,10 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1099
1105
  value: function getLegend(name) {
1100
1106
  var _attribute$scale, _scales$0$option, _attribute$scale2;
1101
1107
  var attribute = this.styleAttributeService.getLayerStyleAttribute(name);
1102
- var scales = (attribute === null || attribute === void 0 ? void 0 : (_attribute$scale = attribute.scale) === null || _attribute$scale === void 0 ? void 0 : _attribute$scale.scalers) || [];
1108
+ var scales = (attribute === null || attribute === void 0 || (_attribute$scale = attribute.scale) === null || _attribute$scale === void 0 ? void 0 : _attribute$scale.scalers) || [];
1103
1109
  return {
1104
1110
  type: (_scales$0$option = scales[0].option) === null || _scales$0$option === void 0 ? void 0 : _scales$0$option.type,
1105
- field: attribute === null || attribute === void 0 ? void 0 : (_attribute$scale2 = attribute.scale) === null || _attribute$scale2 === void 0 ? void 0 : _attribute$scale2.field,
1111
+ field: attribute === null || attribute === void 0 || (_attribute$scale2 = attribute.scale) === null || _attribute$scale2 === void 0 ? void 0 : _attribute$scale2.field,
1106
1112
  items: this.getLegendItems(name)
1107
1113
  };
1108
1114
  }
@@ -1176,7 +1182,6 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1176
1182
  _this$shaderModuleSer = this.shaderModuleService.getModule(moduleName), vs = _this$shaderModuleSer.vs, fs = _this$shaderModuleSer.fs, uniforms = _this$shaderModuleSer.uniforms;
1177
1183
  createModel = this.rendererService.createModel;
1178
1184
  return _context3.abrupt("return", new Promise(function (resolve) {
1179
- // console.log(this.encodedData)
1180
1185
  var _this10$styleAttribut = _this10.styleAttributeService.createAttributesAndIndices(_this10.encodedData, triangulation, styleOption),
1181
1186
  attributes = _this10$styleAttribut.attributes,
1182
1187
  elements = _this10$styleAttribut.elements,
@@ -1187,7 +1192,9 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1187
1192
  fs: fs,
1188
1193
  vs: vs,
1189
1194
  elements: elements,
1190
- blend: _blend.BlendTypes[_l7Core.BlendType.normal]
1195
+ blend: _blend.BlendTypes[_l7Core.BlendType.normal],
1196
+ uniformBuffers: [].concat((0, _toConsumableArray2.default)(_this10.layerModel.uniformBuffers), (0, _toConsumableArray2.default)(_this10.rendererService.uniformBuffers)),
1197
+ textures: _this10.layerModel.textures
1191
1198
  }, rest);
1192
1199
  if (count) {
1193
1200
  modelOptions.count = count;
@@ -1476,5 +1483,4 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1476
1483
  enumerable: true,
1477
1484
  writable: true,
1478
1485
  initializer: null
1479
- })), _class));
1480
- exports.default = BaseLayer;
1486
+ })), _class));
@@ -18,11 +18,19 @@ var _l7Core = require("@antv/l7-core");
18
18
  var _l7Utils = require("@antv/l7-utils");
19
19
  var _blend = require("../utils/blend");
20
20
  var _stencil = require("../utils/stencil");
21
- var _CommonStyleAttribute = require("./CommonStyleAttribute");
22
21
  var _constant = require("./constant");
22
+ var _CommonStyleAttribute = require("./CommonStyleAttribute");
23
23
  var _dec, _class, _descriptor;
24
+ var shaderLocationMap = {
25
+ opacity: _CommonStyleAttribute.ShaderLocation.OPACITY,
26
+ stroke: _CommonStyleAttribute.ShaderLocation.STROKE,
27
+ offsets: _CommonStyleAttribute.ShaderLocation.OFFSETS,
28
+ rotation: _CommonStyleAttribute.ShaderLocation.ROTATION,
29
+ extrusionBase: _CommonStyleAttribute.ShaderLocation.EXTRUSION_BASE
30
+ };
31
+
24
32
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
25
- var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function () {
33
+ var BaseModel = exports.default = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function () {
26
34
  // @lazyInject(TYPES.IIconService)
27
35
  // protected readonly iconService: IIconService;
28
36
 
@@ -35,7 +43,8 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
35
43
 
36
44
  function BaseModel(layer) {
37
45
  (0, _classCallCheck2.default)(this, BaseModel);
38
- // style texture data mapping
46
+ (0, _defineProperty2.default)(this, "uniformBuffers", []);
47
+ (0, _defineProperty2.default)(this, "textures", []);
39
48
  (0, _defineProperty2.default)(this, "preStyleAttribute", {});
40
49
  (0, _defineProperty2.default)(this, "encodeStyleAttribute", {});
41
50
  (0, _initializerDefineProperty2.default)(this, "configService", _descriptor, this);
@@ -215,18 +224,30 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
215
224
  value: function getInject() {
216
225
  var encodeStyleAttribute = this.layer.encodeStyleAttribute;
217
226
  var str = '';
227
+ // a_Position = 0
228
+ // a_Color = 1
229
+ // a_PickingColor = 2
230
+
231
+ var uniforms = [];
232
+ // 支持数据映射的类型
218
233
  this.layer.enableShaderEncodeStyles.forEach(function (key) {
219
234
  if (encodeStyleAttribute[key]) {
235
+ // 配置了数据映射的类型
220
236
  str += "#define USE_ATTRIBUTE_".concat(key.toUpperCase(), " 0.0; \n\n");
237
+ } else {
238
+ uniforms.push(" ".concat(_constant.DefaultUniformStyleType[key], " u_").concat(key, ";"));
221
239
  }
222
- str += "\n #ifdef USE_ATTRIBUTE_".concat(key.toUpperCase(), "\n attribute ").concat(_constant.DefaultUniformStyleType[key], " a_").concat(key.charAt(0).toUpperCase() + key.slice(1), ";\n #else\n uniform ").concat(_constant.DefaultUniformStyleType[key], " u_").concat(key, ";\n #endif\n\n ");
240
+ str += "\n #ifdef USE_ATTRIBUTE_".concat(key.toUpperCase(), "\n layout(location = ").concat(shaderLocationMap[key], ") in ").concat(_constant.DefaultUniformStyleType[key], " a_").concat(key.charAt(0).toUpperCase() + key.slice(1), ";\n #endif\n\n ");
223
241
  });
242
+ var attributeUniforms = uniforms.length ? "\nlayout(std140) uniform AttributeUniforms {\n".concat(uniforms.join('\n'), "\n};\n ") : '';
243
+ str += attributeUniforms;
224
244
  var innerStr = '';
225
245
  this.layer.enableShaderEncodeStyles.forEach(function (key) {
226
- innerStr += "\n\n#ifdef USE_ATTRIBUTE_".concat(key.toUpperCase(), "\n ").concat(_constant.DefaultUniformStyleType[key], " ").concat(key, " = a_").concat(key.charAt(0).toUpperCase() + key.slice(1), ";\n#else\n ").concat(_constant.DefaultUniformStyleType[key], " ").concat(key, " = u_").concat(key, ";\n#endif\n\n");
246
+ innerStr += "\n\n #ifdef USE_ATTRIBUTE_".concat(key.toUpperCase(), "\n ").concat(_constant.DefaultUniformStyleType[key], " ").concat(key, " = a_").concat(key.charAt(0).toUpperCase() + key.slice(1), ";\n #else\n ").concat(_constant.DefaultUniformStyleType[key], " ").concat(key, " = u_").concat(key, ";\n #endif\n\n ");
227
247
  });
228
248
  return {
229
249
  'vs:#decl': str,
250
+ 'fs:#decl': attributeUniforms,
230
251
  'vs:#main-start': innerStr
231
252
  };
232
253
  }
@@ -261,6 +282,9 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
261
282
  var options = (0, _CommonStyleAttribute.getCommonStyleAttributeOptions)(key);
262
283
  if (options) {
263
284
  _this2.styleAttributeService.registerStyleAttribute(options);
285
+ if (options.descriptor) {
286
+ options.descriptor.shaderLocation = shaderLocationMap[key];
287
+ }
264
288
  }
265
289
  });
266
290
  }
@@ -276,5 +300,4 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
276
300
  enumerable: true,
277
301
  writable: true,
278
302
  initializer: null
279
- })), _class));
280
- exports.default = BaseModel;
303
+ })), _class));
@@ -3,8 +3,25 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.ShaderLocation = void 0;
6
7
  exports.getCommonStyleAttributeOptions = getCommonStyleAttributeOptions;
7
8
  var _l7Core = require("@antv/l7-core");
9
+ var ShaderLocation = exports.ShaderLocation = /*#__PURE__*/function (ShaderLocation) {
10
+ ShaderLocation[ShaderLocation["POSITION"] = 0] = "POSITION";
11
+ ShaderLocation[ShaderLocation["COLOR"] = 1] = "COLOR";
12
+ ShaderLocation[ShaderLocation["VERTEX_ID"] = 2] = "VERTEX_ID";
13
+ ShaderLocation[ShaderLocation["PICKING_COLOR"] = 3] = "PICKING_COLOR";
14
+ ShaderLocation[ShaderLocation["STROKE"] = 4] = "STROKE";
15
+ ShaderLocation[ShaderLocation["OPACITY"] = 5] = "OPACITY";
16
+ ShaderLocation[ShaderLocation["OFFSETS"] = 6] = "OFFSETS";
17
+ ShaderLocation[ShaderLocation["ROTATION"] = 7] = "ROTATION";
18
+ ShaderLocation[ShaderLocation["EXTRUSION_BASE"] = 8] = "EXTRUSION_BASE";
19
+ ShaderLocation[ShaderLocation["SIZE"] = 9] = "SIZE";
20
+ ShaderLocation[ShaderLocation["SHAPE"] = 10] = "SHAPE";
21
+ ShaderLocation[ShaderLocation["EXTRUDE"] = 11] = "EXTRUDE";
22
+ ShaderLocation[ShaderLocation["MAX"] = 12] = "MAX";
23
+ return ShaderLocation;
24
+ }({});
8
25
  function getCommonStyleAttributeOptions(name) {
9
26
  switch (name) {
10
27
  // // roate
@@ -14,6 +31,7 @@ function getCommonStyleAttributeOptions(name) {
14
31
  type: _l7Core.AttributeType.Attribute,
15
32
  descriptor: {
16
33
  name: 'a_Rotation',
34
+ shaderLocation: ShaderLocation.ROTATION,
17
35
  buffer: {
18
36
  usage: _l7Core.gl.DYNAMIC_DRAW,
19
37
  data: [],
@@ -33,6 +51,7 @@ function getCommonStyleAttributeOptions(name) {
33
51
  type: _l7Core.AttributeType.Attribute,
34
52
  descriptor: {
35
53
  name: 'a_Stroke',
54
+ shaderLocation: ShaderLocation.STROKE,
36
55
  buffer: {
37
56
  // give the WebGL driver a hint that this buffer may change
38
57
  usage: _l7Core.gl.DYNAMIC_DRAW,
@@ -53,6 +72,7 @@ function getCommonStyleAttributeOptions(name) {
53
72
  type: _l7Core.AttributeType.Attribute,
54
73
  descriptor: {
55
74
  name: 'a_Opacity',
75
+ shaderLocation: ShaderLocation.OPACITY,
56
76
  buffer: {
57
77
  // give the WebGL driver a hint that this buffer may change
58
78
  usage: _l7Core.gl.STATIC_DRAW,
@@ -73,6 +93,7 @@ function getCommonStyleAttributeOptions(name) {
73
93
  type: _l7Core.AttributeType.Attribute,
74
94
  descriptor: {
75
95
  name: 'a_ExtrusionBase',
96
+ shaderLocation: ShaderLocation.EXTRUSION_BASE,
76
97
  buffer: {
77
98
  // give the WebGL driver a hint that this buffer may change
78
99
  usage: _l7Core.gl.STATIC_DRAW,
@@ -93,6 +114,7 @@ function getCommonStyleAttributeOptions(name) {
93
114
  type: _l7Core.AttributeType.Attribute,
94
115
  descriptor: {
95
116
  name: 'a_Offsets',
117
+ shaderLocation: ShaderLocation.OFFSETS,
96
118
  buffer: {
97
119
  // give the WebGL driver a hint that this buffer may change
98
120
  usage: _l7Core.gl.STATIC_DRAW,
@@ -11,7 +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 _l7Utils = require("@antv/l7-utils");
14
- var BaseLayerPickService = /*#__PURE__*/function () {
14
+ var BaseLayerPickService = exports.default = /*#__PURE__*/function () {
15
15
  function BaseLayerPickService(layer) {
16
16
  (0, _classCallCheck2.default)(this, BaseLayerPickService);
17
17
  this.layer = layer;
@@ -133,5 +133,4 @@ var BaseLayerPickService = /*#__PURE__*/function () {
133
133
  }
134
134
  }]);
135
135
  return BaseLayerPickService;
136
- }();
137
- exports.default = BaseLayerPickService;
136
+ }();
@@ -9,7 +9,7 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
10
  var _l7Core = require("@antv/l7-core");
11
11
  var _l7Utils = require("@antv/l7-utils");
12
- var TextureService = /*#__PURE__*/function () {
12
+ var TextureService = exports.default = /*#__PURE__*/function () {
13
13
  function TextureService(layer) {
14
14
  (0, _classCallCheck2.default)(this, TextureService);
15
15
  this.layer = layer;
@@ -53,7 +53,7 @@ var TextureService = /*#__PURE__*/function () {
53
53
  key: "destroy",
54
54
  value: function destroy() {
55
55
  var _this$colorTexture;
56
- (_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0 ? void 0 : _this$colorTexture.destroy();
56
+ (_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0 || _this$colorTexture.destroy();
57
57
  }
58
58
  }, {
59
59
  key: "getColorRampBar",
@@ -75,9 +75,8 @@ var TextureService = /*#__PURE__*/function () {
75
75
  key: "getTextureKey",
76
76
  value: function getTextureKey(colorRamp, domain) {
77
77
  var _colorRamp$positions;
78
- return "".concat(colorRamp.colors.join('_'), "_").concat(colorRamp === null || colorRamp === void 0 ? void 0 : (_colorRamp$positions = colorRamp.positions) === null || _colorRamp$positions === void 0 ? void 0 : _colorRamp$positions.join('_'), "_").concat(colorRamp.type, "_").concat(domain === null || domain === void 0 ? void 0 : domain.join('_'));
78
+ return "".concat(colorRamp.colors.join('_'), "_").concat(colorRamp === null || colorRamp === void 0 || (_colorRamp$positions = colorRamp.positions) === null || _colorRamp$positions === void 0 ? void 0 : _colorRamp$positions.join('_'), "_").concat(colorRamp.type, "_").concat(domain === null || domain === void 0 ? void 0 : domain.join('_'));
79
79
  }
80
80
  }]);
81
81
  return TextureService;
82
- }();
83
- exports.default = TextureService;
82
+ }();
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DefaultUniformStyleValue = exports.DefaultUniformStyleType = void 0;
7
- var DefaultUniformStyleValue = {
7
+ var DefaultUniformStyleValue = exports.DefaultUniformStyleValue = {
8
8
  opacity: 1,
9
9
  stroke: [1, 0, 0, 1],
10
10
  offsets: [0, 0],
@@ -13,8 +13,7 @@ var DefaultUniformStyleValue = {
13
13
  strokeOpacity: 1,
14
14
  thetaOffset: 0.314
15
15
  };
16
- exports.DefaultUniformStyleValue = DefaultUniformStyleValue;
17
- var DefaultUniformStyleType = {
16
+ var DefaultUniformStyleType = exports.DefaultUniformStyleType = {
18
17
  opacity: 'float',
19
18
  stroke: 'vec4',
20
19
  offsets: 'vec2',
@@ -23,5 +22,4 @@ var DefaultUniformStyleType = {
23
22
  extrusionBase: 'float',
24
23
  strokeOpacity: 'float',
25
24
  thetaOffset: 'float'
26
- };
27
- exports.DefaultUniformStyleType = DefaultUniformStyleType;
25
+ };
@@ -4,19 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.lineStyleType = exports.TextureBlend = exports.SizeUnitType = exports.LinearDir = exports.CanvasUpdateType = void 0;
7
- var lineStyleType = /*#__PURE__*/function (lineStyleType) {
7
+ var lineStyleType = exports.lineStyleType = /*#__PURE__*/function (lineStyleType) {
8
8
  lineStyleType[lineStyleType["solid"] = 0] = "solid";
9
9
  lineStyleType[lineStyleType["dash"] = 1] = "dash";
10
10
  return lineStyleType;
11
11
  }({});
12
- exports.lineStyleType = lineStyleType;
13
- var LinearDir = /*#__PURE__*/function (LinearDir) {
12
+ var LinearDir = exports.LinearDir = /*#__PURE__*/function (LinearDir) {
14
13
  LinearDir["VERTICAL"] = "vertical";
15
14
  LinearDir["HORIZONTAL"] = "horizontal";
16
15
  return LinearDir;
17
16
  }({});
18
- exports.LinearDir = LinearDir;
19
- var TextureBlend = /*#__PURE__*/function (TextureBlend) {
17
+ var TextureBlend = exports.TextureBlend = /*#__PURE__*/function (TextureBlend) {
20
18
  TextureBlend["NORMAL"] = "normal";
21
19
  TextureBlend["REPLACE"] = "replace";
22
20
  return TextureBlend;
@@ -24,16 +22,13 @@ var TextureBlend = /*#__PURE__*/function (TextureBlend) {
24
22
  /**
25
23
  * 基础图层类型定义
26
24
  */
27
- exports.TextureBlend = TextureBlend;
28
- var SizeUnitType = /*#__PURE__*/function (SizeUnitType) {
25
+ var SizeUnitType = exports.SizeUnitType = /*#__PURE__*/function (SizeUnitType) {
29
26
  SizeUnitType[SizeUnitType["pixel"] = 0] = "pixel";
30
27
  SizeUnitType[SizeUnitType["meter"] = 1] = "meter";
31
28
  return SizeUnitType;
32
29
  }({}); // 栅格瓦片图层
33
- exports.SizeUnitType = SizeUnitType;
34
- var CanvasUpdateType = /*#__PURE__*/function (CanvasUpdateType) {
30
+ var CanvasUpdateType = exports.CanvasUpdateType = /*#__PURE__*/function (CanvasUpdateType) {
35
31
  CanvasUpdateType["ALWAYS"] = "always";
36
32
  CanvasUpdateType["DRAGEND"] = "dragend";
37
33
  return CanvasUpdateType;
38
- }({});
39
- exports.CanvasUpdateType = CanvasUpdateType;
34
+ }({});
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
  /**
8
8
  * BaseLayer Schema
9
9
  */
10
- var _default = {
10
+ var _default = exports.default = {
11
11
  properties: {
12
12
  enablePicking: {
13
13
  type: 'boolean'
@@ -28,5 +28,4 @@ var _default = {
28
28
  }]
29
29
  }
30
30
  }
31
- };
32
- exports.default = _default;
31
+ };
@@ -14,7 +14,7 @@ exports.square = square;
14
14
  exports.triangle = triangle;
15
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
16
  var _geometryShape;
17
- var ShapeType3D = /*#__PURE__*/function (ShapeType3D) {
17
+ var ShapeType3D = exports.ShapeType3D = /*#__PURE__*/function (ShapeType3D) {
18
18
  ShapeType3D["CYLINDER"] = "cylinder";
19
19
  ShapeType3D["SQUARECOLUMN"] = "squareColumn";
20
20
  ShapeType3D["TRIANGLECOLUMN"] = "triangleColumn";
@@ -22,8 +22,7 @@ var ShapeType3D = /*#__PURE__*/function (ShapeType3D) {
22
22
  ShapeType3D["PENTAGONCOLUMN"] = "pentagonColumn";
23
23
  return ShapeType3D;
24
24
  }({});
25
- exports.ShapeType3D = ShapeType3D;
26
- var ShapeType2D = /*#__PURE__*/function (ShapeType2D) {
25
+ var ShapeType2D = exports.ShapeType2D = /*#__PURE__*/function (ShapeType2D) {
27
26
  ShapeType2D["CIRCLE"] = "circle";
28
27
  ShapeType2D["SQUARE"] = "square";
29
28
  ShapeType2D["TRIANGLE"] = "triangle";
@@ -36,7 +35,6 @@ var ShapeType2D = /*#__PURE__*/function (ShapeType2D) {
36
35
  * @param pointCount 顶点个数 3 => 三角形
37
36
  * @param start 顶点起始角度 调整图形的方向
38
37
  */
39
- exports.ShapeType2D = ShapeType2D;
40
38
  function polygonPath(pointCount) {
41
39
  var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
42
40
  var step = Math.PI * 2 / pointCount;
@@ -67,5 +65,4 @@ function hexagon() {
67
65
  function pentagon() {
68
66
  return polygonPath(5);
69
67
  }
70
- var 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);
71
- exports.geometryShape = geometryShape;
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);
@@ -33,8 +33,8 @@ var _utils = require("../earth/utils");
33
33
  var _extrude_polyline = _interopRequireDefault(require("../utils/extrude_polyline"));
34
34
  var _extrude = _interopRequireWildcard(require("./shape/extrude"));
35
35
  var _Path = require("./shape/Path");
36
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
37
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
36
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
37
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
38
38
  // @ts-ignore
39
39
 
40
40
  var GeometryCache = {};
@@ -26,7 +26,7 @@ var EarthModels = {
26
26
  bloomSphere: _bloomsphere.default
27
27
  };
28
28
  var earthLayerTypes = ['base', 'atomSphere', 'bloomSphere'];
29
- var EarthLayer = /*#__PURE__*/function (_BaseLayer) {
29
+ var EarthLayer = exports.default = /*#__PURE__*/function (_BaseLayer) {
30
30
  (0, _inherits2.default)(EarthLayer, _BaseLayer);
31
31
  var _super = _createSuper(EarthLayer);
32
32
  function EarthLayer() {
@@ -88,7 +88,7 @@ var EarthLayer = /*#__PURE__*/function (_BaseLayer) {
88
88
  value: function getModelType() {
89
89
  var _shapeAttribute$scale;
90
90
  var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
91
- var shape = (shapeAttribute === null || shapeAttribute === void 0 ? void 0 : (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field) || 'base';
91
+ var shape = (shapeAttribute === null || shapeAttribute === void 0 || (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field) || 'base';
92
92
  if (earthLayerTypes.indexOf(shape) < 0) {
93
93
  shape = 'base';
94
94
  }
@@ -96,5 +96,4 @@ var EarthLayer = /*#__PURE__*/function (_BaseLayer) {
96
96
  }
97
97
  }]);
98
98
  return EarthLayer;
99
- }(_BaseLayer2.default);
100
- exports.default = EarthLayer;
99
+ }(_BaseLayer2.default);
@@ -23,7 +23,7 @@ var atmoSphereFrag = "\nuniform float u_opacity;\nuniform vec3 u_CameraPosition;
23
23
  /* babel-plugin-inline-import '../shaders/atmosphere_vert.glsl' */
24
24
  var atmoSphereVert = "\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute vec2 a_Uv;\nattribute vec4 a_Color;\nuniform vec3 u_CameraPosition;\nvarying float v_CamreaDistance;\n\nuniform mat4 u_ViewProjectionMatrix;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_ViewMatrix;\n\nvarying vec3 vVertexNormal;\nvarying vec4 v_Color;\nvarying float v_offset;\n\nvoid main() {\n float EARTH_RADIUS = 100.0;\n \n v_Color = a_Color;\n\n v_offset = min(((length(u_CameraPosition) - EARTH_RADIUS)/600.0) * 0.5 + 0.4, 1.0);\n vVertexNormal = a_Normal;\n\n gl_Position = u_ViewProjectionMatrix * u_ModelMatrix * vec4(a_Position, 1.0);\n}\n";
25
25
  var isNumber = _l7Utils.lodashUtil.isNumber;
26
- var EarthAtomSphereModel = /*#__PURE__*/function (_BaseModel) {
26
+ var EarthAtomSphereModel = exports.default = /*#__PURE__*/function (_BaseModel) {
27
27
  (0, _inherits2.default)(EarthAtomSphereModel, _BaseModel);
28
28
  var _super = _createSuper(EarthAtomSphereModel);
29
29
  function EarthAtomSphereModel() {
@@ -156,5 +156,4 @@ var EarthAtomSphereModel = /*#__PURE__*/function (_BaseModel) {
156
156
  }
157
157
  }]);
158
158
  return EarthAtomSphereModel;
159
- }(_BaseModel2.default);
160
- exports.default = EarthAtomSphereModel;
159
+ }(_BaseModel2.default);
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
23
23
  var baseFrag = "\nuniform sampler2D u_texture;\n\nvarying vec2 v_texCoord;\nvarying float v_lightWeight;\n\n\nvoid main() {\n\n vec4 color = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y));\n color.xyz = color.xyz * v_lightWeight;\n gl_FragColor = color;\n}\n";
24
24
  /* babel-plugin-inline-import '../shaders/base_vert.glsl' */
25
25
  var baseVert = "// attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n\n// attribute vec2 a_Extrude;\n// attribute float a_Size;\n// attribute float a_Shape;\n\nuniform vec3 u_CameraPosition;\nuniform mat4 u_ViewProjectionMatrix;\nuniform mat4 u_ModelMatrix;\nuniform float u_ambientRatio : 0.5;\nuniform float u_diffuseRatio : 0.3;\nuniform float u_specularRatio : 0.2;\nuniform vec3 u_sunLight: [1.0, -10.5, 12.0];\n\n\n\nfloat calc_lighting(vec4 pos) {\n\n vec3 worldPos = vec3(pos * u_ModelMatrix);\n\n vec3 worldNormal = a_Normal;\n\n // cal light weight\n vec3 viewDir = normalize(u_CameraPosition - worldPos);\n\n vec3 lightDir = normalize(u_sunLight);\n\n vec3 halfDir = normalize(viewDir+lightDir);\n // lambert\n float lambert = dot(worldNormal, lightDir);\n // specular\n float specular = pow(max(0.0, dot(worldNormal, halfDir)), 32.0);\n //sum to light weight\n float lightWeight = u_ambientRatio + u_diffuseRatio * lambert + u_specularRatio * specular;\n\n return lightWeight;\n}\n\nvarying float v_lightWeight;\nvoid main() {\n\n v_texCoord = a_Uv;\n\n float lightWeight = calc_lighting(vec4(a_Position, 1.0));\n v_lightWeight = lightWeight;\n\n gl_Position = u_ViewProjectionMatrix * u_ModelMatrix * vec4(a_Position, 1.0);\n}\n";
26
- var BaseEarthModel = /*#__PURE__*/function (_BaseModel) {
26
+ var BaseEarthModel = exports.default = /*#__PURE__*/function (_BaseModel) {
27
27
  (0, _inherits2.default)(BaseEarthModel, _BaseModel);
28
28
  var _super = _createSuper(BaseEarthModel);
29
29
  function BaseEarthModel() {
@@ -214,5 +214,4 @@ var BaseEarthModel = /*#__PURE__*/function (_BaseModel) {
214
214
  }
215
215
  }]);
216
216
  return BaseEarthModel;
217
- }(_BaseModel2.default);
218
- exports.default = BaseEarthModel;
217
+ }(_BaseModel2.default);
@@ -23,7 +23,7 @@ var bloomSphereFrag = "\nuniform float u_opacity;\nuniform vec3 u_CameraPosition
23
23
  /* babel-plugin-inline-import '../shaders/bloomsphere_vert.glsl' */
24
24
  var bloomSphereVert = "\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute vec2 a_Uv;\nattribute vec4 a_Color;\nuniform vec3 u_CameraPosition;\nuniform mat4 u_ViewProjectionMatrix;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_ViewMatrix;\n\nvarying vec3 vVertexNormal;\nvarying vec4 v_Color;\n\nvoid main() {\n v_Color = a_Color;\n\n vVertexNormal = a_Normal;\n\n gl_Position = u_ViewProjectionMatrix * u_ModelMatrix * vec4(a_Position, 1.0);\n}\n";
25
25
  var isNumber = _l7Utils.lodashUtil.isNumber;
26
- var EarthBloomSphereModel = /*#__PURE__*/function (_BaseModel) {
26
+ var EarthBloomSphereModel = exports.default = /*#__PURE__*/function (_BaseModel) {
27
27
  (0, _inherits2.default)(EarthBloomSphereModel, _BaseModel);
28
28
  var _super = _createSuper(EarthBloomSphereModel);
29
29
  function EarthBloomSphereModel() {
@@ -155,5 +155,4 @@ var EarthBloomSphereModel = /*#__PURE__*/function (_BaseModel) {
155
155
  }
156
156
  }]);
157
157
  return EarthBloomSphereModel;
158
- }(_BaseModel2.default);
159
- exports.default = EarthBloomSphereModel;
158
+ }(_BaseModel2.default);
@@ -12,18 +12,15 @@ var _glMatrix = require("gl-matrix");
12
12
  // 该文件专门记录地球模式的数值
13
13
 
14
14
  // 地球网格半径
15
- var EARTH_RADIUS = 100;
16
- exports.EARTH_RADIUS = EARTH_RADIUS;
17
- var EARTH_SEGMENTS = 36;
18
- exports.EARTH_SEGMENTS = EARTH_SEGMENTS;
19
- var EARTH_RADIUS_OUTER = 40;
15
+ var EARTH_RADIUS = exports.EARTH_RADIUS = 100;
16
+ var EARTH_SEGMENTS = exports.EARTH_SEGMENTS = 36;
17
+ var EARTH_RADIUS_OUTER = exports.EARTH_RADIUS_OUTER = 40;
20
18
 
21
19
  /**
22
20
  * 角度转弧度
23
21
  * @param deg
24
22
  * @returns
25
23
  */
26
- exports.EARTH_RADIUS_OUTER = EARTH_RADIUS_OUTER;
27
24
  function torad(deg) {
28
25
  return deg / 180 * Math.acos(-1);
29
26
  }
@@ -18,7 +18,7 @@ var _BaseLayer2 = _interopRequireDefault(require("../core/BaseLayer"));
18
18
  var _models = _interopRequireDefault(require("./models"));
19
19
  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); }; }
20
20
  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; } }
21
- var GeometryLayer = /*#__PURE__*/function (_BaseLayer) {
21
+ var GeometryLayer = exports.default = /*#__PURE__*/function (_BaseLayer) {
22
22
  (0, _inherits2.default)(GeometryLayer, _BaseLayer);
23
23
  var _super = _createSuper(GeometryLayer);
24
24
  function GeometryLayer() {
@@ -83,7 +83,7 @@ var GeometryLayer = /*#__PURE__*/function (_BaseLayer) {
83
83
  value: function getModelType() {
84
84
  var _shapeAttribute$scale;
85
85
  var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
86
- var shape = shapeAttribute === null || shapeAttribute === void 0 ? void 0 : (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
86
+ var shape = shapeAttribute === null || shapeAttribute === void 0 || (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
87
87
  if (shape === 'plane') {
88
88
  return 'plane';
89
89
  } else if (shape === 'sprite') {
@@ -96,5 +96,4 @@ var GeometryLayer = /*#__PURE__*/function (_BaseLayer) {
96
96
  }
97
97
  }]);
98
98
  return GeometryLayer;
99
- }(_BaseLayer2.default);
100
- exports.default = GeometryLayer;
99
+ }(_BaseLayer2.default);
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
23
23
  var planeFrag = "\nuniform sampler2D u_texture;\nuniform float u_opacity;\n\nvarying vec3 v_Color;\nvarying vec2 v_uv;\n\n#pragma include \"picking\"\nvoid main() {\n gl_FragColor = texture2D(u_texture, vec2(v_uv.x, 1.0 - v_uv.y));\n gl_FragColor.a *= u_opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
24
24
  /* babel-plugin-inline-import '../shaders/billboard_vert.glsl' */
25
25
  var planeVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform float u_raisingHeight: 0.0;\nuniform float u_opacity;\nuniform vec2 u_size: [1.0, 1.0];\nuniform mat2 u_RotateMatrix;\n\nattribute vec3 a_Extrude;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nattribute vec3 a_Color;\n\nvarying vec3 v_Color;\nvarying vec2 v_uv;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\nvoid main() {\n vec3 extrude = a_Extrude;\n v_Color = a_Color;\n v_uv = a_Uv;\n\n float raiseHeight = u_raisingHeight;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raiseHeight = u_raisingHeight * mapboxZoomScale;\n }\n\n // \u8BA1\u7B97\u7ECF\u7EAC\u5EA6\u70B9\u4F4D\u5750\u6807\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n\n // \u8BA1\u7B97\u7ED5 z \u8F74\u65CB\u8F6C\u540E\u7684\u504F\u79FB\n vec2 offsetXY = project_pixel(u_RotateMatrix * vec2(extrude.x * u_size.x, 0.0));\n // \u7ED5 z \u8F74\u65CB\u8F6C\n float x = project_pos.x + offsetXY.x;\n float y = project_pos.y + offsetXY.y;\n // z \u8F74\u4E0D\u53C2\u4E0E\u65CB\u8F6C\n float z = project_pixel(extrude.y * u_size.y + raiseHeight);\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(x , y, z , 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
26
- var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
26
+ var BillBoardModel = exports.default = /*#__PURE__*/function (_BaseModel) {
27
27
  (0, _inherits2.default)(BillBoardModel, _BaseModel);
28
28
  var _super = _createSuper(BillBoardModel);
29
29
  function BillBoardModel() {
@@ -86,7 +86,7 @@ var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
86
86
  key: "clearModels",
87
87
  value: function clearModels() {
88
88
  var _this$texture;
89
- (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
89
+ (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
90
90
  }
91
91
  }, {
92
92
  key: "initModels",
@@ -214,5 +214,4 @@ var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
214
214
  }
215
215
  }]);
216
216
  return BillBoardModel;
217
- }(_BaseModel2.default);
218
- exports.default = BillBoardModel;
217
+ }(_BaseModel2.default);
@@ -13,5 +13,4 @@ var GeometryModels = {
13
13
  sprite: _sprite.default,
14
14
  billboard: _billboard.default
15
15
  };
16
- var _default = GeometryModels;
17
- exports.default = _default;
16
+ var _default = exports.default = GeometryModels;
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
24
24
  var planeFrag = "\nuniform sampler2D u_texture;\nuniform float u_mapFlag;\nuniform float u_opacity;\n\nvarying vec3 v_Color;\nvarying vec2 v_uv;\nvarying float v_clip;\n\n#pragma include \"picking\"\nvoid main() {\n // gl_FragColor = vec4(v_Color, u_opacity);\n if(u_mapFlag > 0.0) {\n gl_FragColor = texture2D(u_texture, vec2(v_uv.x, 1.0 - v_uv.y));\n gl_FragColor.a *= u_opacity;\n } else {\n // gl_FragColor = vec4(v_uv, 0.0, u_opacity);\n gl_FragColor = vec4(v_Color, u_opacity);\n }\n gl_FragColor.a *= v_clip;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
25
25
  /* babel-plugin-inline-import '../shaders/plane_vert.glsl' */
26
26
  var planeVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\n\nuniform float u_opacity;\nuniform float u_terrainClipHeight;\n\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nattribute vec3 a_Color;\n\nvarying vec3 v_Color;\nvarying vec2 v_uv;\nvarying float v_clip;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\nvoid main() {\n v_Color = a_Color;\n v_uv = a_Uv;\n \n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n v_clip = 1.0;\n if(a_Position.z < u_terrainClipHeight) {\n v_clip = 0.0;\n }\n \n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy, a_Position.z, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
27
- var PlaneModel = /*#__PURE__*/function (_BaseModel) {
27
+ var PlaneModel = exports.default = /*#__PURE__*/function (_BaseModel) {
28
28
  (0, _inherits2.default)(PlaneModel, _BaseModel);
29
29
  var _super = _createSuper(PlaneModel);
30
30
  function PlaneModel() {
@@ -129,7 +129,7 @@ var PlaneModel = /*#__PURE__*/function (_BaseModel) {
129
129
  if (this.mapTexture !== mapTexture) {
130
130
  var _this$texture;
131
131
  this.mapTexture = mapTexture;
132
- (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
132
+ (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
133
133
  this.updateTexture(mapTexture);
134
134
  }
135
135
  return {
@@ -145,7 +145,7 @@ var PlaneModel = /*#__PURE__*/function (_BaseModel) {
145
145
  var _this$texture2;
146
146
  // @ts-ignore
147
147
  this.terrainImage = null;
148
- (_this$texture2 = this.texture) === null || _this$texture2 === void 0 ? void 0 : _this$texture2.destroy();
148
+ (_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
149
149
  }
150
150
  }, {
151
151
  key: "initModels",
@@ -378,5 +378,4 @@ var PlaneModel = /*#__PURE__*/function (_BaseModel) {
378
378
  }
379
379
  }]);
380
380
  return PlaneModel;
381
- }(_BaseModel2.default);
382
- exports.default = PlaneModel;
381
+ }(_BaseModel2.default);