@antv/l7-layers 2.17.2 → 2.17.4

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 (242) hide show
  1. package/es/Geometry/index.js +31 -9
  2. package/es/Geometry/models/billboard.js +89 -51
  3. package/es/Geometry/models/plane.js +143 -81
  4. package/es/Geometry/models/sprite.js +118 -60
  5. package/es/canvas/index.js +33 -10
  6. package/es/canvas/models/canvas.js +97 -41
  7. package/es/citybuliding/building.js +27 -8
  8. package/es/citybuliding/models/build.js +82 -57
  9. package/es/core/BaseLayer.js +478 -313
  10. package/es/core/BaseModel.js +80 -51
  11. package/es/core/CommonStyleAttribute.js +5 -2
  12. package/es/core/LayerPickService.js +32 -21
  13. package/es/core/TextureService.js +13 -0
  14. package/es/core/interface.js +24 -17
  15. package/es/core/shape/Path.js +20 -13
  16. package/es/core/shape/extrude.js +39 -27
  17. package/es/core/triangulation.js +136 -99
  18. package/es/earth/index.js +33 -9
  19. package/es/earth/models/atmosphere.js +54 -30
  20. package/es/earth/models/base.js +85 -47
  21. package/es/earth/models/bloomsphere.js +54 -30
  22. package/es/earth/utils.js +13 -9
  23. package/es/heatmap/index.js +40 -10
  24. package/es/heatmap/models/grid.js +52 -28
  25. package/es/heatmap/models/grid3d.js +52 -28
  26. package/es/heatmap/models/heatmap.js +149 -92
  27. package/es/heatmap/models/hexagon.js +52 -28
  28. package/es/heatmap/triangulation.js +4 -0
  29. package/es/image/index.js +28 -9
  30. package/es/image/models/image.js +100 -66
  31. package/es/index.js +17 -9
  32. package/es/line/index.js +35 -9
  33. package/es/line/models/arc.js +114 -64
  34. package/es/line/models/arc_3d.js +102 -58
  35. package/es/line/models/earthArc_3d.js +105 -60
  36. package/es/line/models/flow.js +60 -36
  37. package/es/line/models/great_circle.js +94 -53
  38. package/es/line/models/line.js +138 -86
  39. package/es/line/models/linearline.js +76 -43
  40. package/es/line/models/simpleLine.js +69 -39
  41. package/es/line/models/wall.js +92 -52
  42. package/es/mask/index.js +28 -9
  43. package/es/mask/models/fill.js +54 -29
  44. package/es/plugins/DataMappingPlugin.js +114 -78
  45. package/es/plugins/DataSourcePlugin.js +68 -45
  46. package/es/plugins/FeatureScalePlugin.js +122 -67
  47. package/es/plugins/LayerAnimateStylePlugin.js +5 -0
  48. package/es/plugins/LayerMaskPlugin.js +11 -3
  49. package/es/plugins/LayerModelPlugin.js +108 -69
  50. package/es/plugins/LayerStylePlugin.js +9 -3
  51. package/es/plugins/LightingPlugin.js +18 -12
  52. package/es/plugins/MultiPassRendererPlugin.js +16 -11
  53. package/es/plugins/PixelPickingPlugin.js +21 -12
  54. package/es/plugins/RegisterStyleAttributePlugin.js +12 -5
  55. package/es/plugins/ShaderUniformPlugin.js +27 -13
  56. package/es/plugins/UpdateModelPlugin.js +5 -0
  57. package/es/plugins/UpdateStyleAttributePlugin.js +11 -5
  58. package/es/point/index.js +78 -26
  59. package/es/point/models/earthExtrude.js +95 -58
  60. package/es/point/models/earthFill.js +80 -52
  61. package/es/point/models/extrude.js +94 -57
  62. package/es/point/models/fill.js +81 -56
  63. package/es/point/models/fillmage.js +100 -60
  64. package/es/point/models/image.js +83 -47
  65. package/es/point/models/index.js +2 -2
  66. package/es/point/models/normal.js +54 -30
  67. package/es/point/models/radar.js +63 -38
  68. package/es/point/models/simplePoint.js +62 -38
  69. package/es/point/models/text.js +296 -199
  70. package/es/point/shape/extrude.js +13 -4
  71. package/es/polygon/index.js +41 -11
  72. package/es/polygon/models/extrude.js +135 -87
  73. package/es/polygon/models/fill.js +79 -50
  74. package/es/polygon/models/index.js +2 -3
  75. package/es/polygon/models/ocean.js +76 -42
  76. package/es/polygon/models/water.js +71 -37
  77. package/es/raster/buffers/triangulation.js +4 -2
  78. package/es/raster/index.js +32 -9
  79. package/es/raster/models/raster.js +116 -80
  80. package/es/raster/models/rasterRgb.js +127 -84
  81. package/es/raster/models/rasterTerrainRgb.js +84 -56
  82. package/es/tile/interaction/getRasterData.js +20 -14
  83. package/es/tile/interaction/utils.js +9 -7
  84. package/es/tile/manager/base.js +96 -63
  85. package/es/tile/service/TileLayerService.js +55 -33
  86. package/es/tile/service/TilePickService.js +40 -26
  87. package/es/tile/service/TileSourceService.js +7 -3
  88. package/es/tile/tileFactory/DebugTile.js +46 -29
  89. package/es/tile/tileFactory/ImageTile.js +38 -20
  90. package/es/tile/tileFactory/MaskTile.js +43 -22
  91. package/es/tile/tileFactory/RasterRGBTile.js +42 -22
  92. package/es/tile/tileFactory/RasterTerrainRGBTile.js +38 -20
  93. package/es/tile/tileFactory/RasterTile.js +53 -30
  94. package/es/tile/tileFactory/Tile.js +97 -63
  95. package/es/tile/tileFactory/VectorTile.js +68 -41
  96. package/es/tile/tileFactory/index.js +11 -0
  97. package/es/tile/tileFactory/layers/TileDebugLayer.js +27 -6
  98. package/es/tile/tileFactory/util.js +3 -0
  99. package/es/tile/tileLayer/BaseLayer.js +146 -105
  100. package/es/tile/utils.js +1 -1
  101. package/es/utils/blend.js +2 -0
  102. package/es/utils/collision-index.js +16 -9
  103. package/es/utils/extrude_polyline.js +149 -101
  104. package/es/utils/grid-index.js +27 -2
  105. package/es/utils/identityScale.js +8 -0
  106. package/es/utils/layerData.js +44 -30
  107. package/es/utils/multiPassRender.js +13 -11
  108. package/es/utils/polylineNormal.js +37 -31
  109. package/es/utils/simpleLine.js +16 -2
  110. package/es/utils/stencil.js +3 -2
  111. package/es/utils/symbol-layout.js +53 -27
  112. package/es/wind/index.js +29 -9
  113. package/es/wind/models/utils.js +51 -26
  114. package/es/wind/models/wind.js +147 -101
  115. package/es/wind/models/windRender.js +66 -53
  116. package/lib/Geometry/index.js +38 -9
  117. package/lib/Geometry/models/billboard.js +97 -51
  118. package/lib/Geometry/models/index.js +5 -0
  119. package/lib/Geometry/models/plane.js +151 -79
  120. package/lib/Geometry/models/sprite.js +127 -60
  121. package/lib/canvas/index.js +40 -10
  122. package/lib/canvas/models/canvas.js +101 -41
  123. package/lib/canvas/models/index.js +3 -0
  124. package/lib/citybuliding/building.js +35 -8
  125. package/lib/citybuliding/models/build.js +92 -57
  126. package/lib/core/BaseLayer.js +469 -313
  127. package/lib/core/BaseModel.js +90 -51
  128. package/lib/core/CommonStyleAttribute.js +7 -2
  129. package/lib/core/LayerPickService.js +37 -21
  130. package/lib/core/TextureService.js +16 -0
  131. package/lib/core/interface.js +31 -21
  132. package/lib/core/schema.js +1 -0
  133. package/lib/core/shape/Path.js +31 -14
  134. package/lib/core/shape/extrude.js +62 -27
  135. package/lib/core/triangulation.js +177 -98
  136. package/lib/earth/index.js +43 -9
  137. package/lib/earth/models/atmosphere.js +63 -30
  138. package/lib/earth/models/base.js +90 -47
  139. package/lib/earth/models/bloomsphere.js +63 -30
  140. package/lib/earth/utils.js +31 -7
  141. package/lib/heatmap/index.js +48 -10
  142. package/lib/heatmap/models/grid.js +60 -28
  143. package/lib/heatmap/models/grid3d.js +60 -28
  144. package/lib/heatmap/models/heatmap.js +166 -92
  145. package/lib/heatmap/models/hexagon.js +60 -28
  146. package/lib/heatmap/models/index.js +6 -0
  147. package/lib/heatmap/triangulation.js +5 -0
  148. package/lib/image/index.js +36 -9
  149. package/lib/image/models/image.js +109 -66
  150. package/lib/image/models/index.js +3 -0
  151. package/lib/index.js +61 -7
  152. package/lib/line/index.js +40 -9
  153. package/lib/line/models/arc.js +124 -62
  154. package/lib/line/models/arc_3d.js +113 -56
  155. package/lib/line/models/earthArc_3d.js +115 -58
  156. package/lib/line/models/flow.js +70 -36
  157. package/lib/line/models/great_circle.js +104 -53
  158. package/lib/line/models/index.js +11 -0
  159. package/lib/line/models/line.js +146 -84
  160. package/lib/line/models/linearline.js +88 -43
  161. package/lib/line/models/simpleLine.js +79 -39
  162. package/lib/line/models/wall.js +103 -52
  163. package/lib/mask/index.js +36 -9
  164. package/lib/mask/models/fill.js +63 -29
  165. package/lib/mask/models/index.js +3 -0
  166. package/lib/plugins/DataMappingPlugin.js +125 -78
  167. package/lib/plugins/DataSourcePlugin.js +76 -45
  168. package/lib/plugins/FeatureScalePlugin.js +138 -67
  169. package/lib/plugins/LayerAnimateStylePlugin.js +10 -0
  170. package/lib/plugins/LayerMaskPlugin.js +17 -4
  171. package/lib/plugins/LayerModelPlugin.js +117 -70
  172. package/lib/plugins/LayerStylePlugin.js +14 -4
  173. package/lib/plugins/LightingPlugin.js +25 -12
  174. package/lib/plugins/MultiPassRendererPlugin.js +22 -11
  175. package/lib/plugins/PixelPickingPlugin.js +27 -12
  176. package/lib/plugins/RegisterStyleAttributePlugin.js +19 -5
  177. package/lib/plugins/ShaderUniformPlugin.js +34 -13
  178. package/lib/plugins/UpdateModelPlugin.js +10 -1
  179. package/lib/plugins/UpdateStyleAttributePlugin.js +16 -5
  180. package/lib/point/index.js +83 -26
  181. package/lib/point/models/earthExtrude.js +106 -58
  182. package/lib/point/models/earthFill.js +110 -52
  183. package/lib/point/models/extrude.js +103 -57
  184. package/lib/point/models/fill.js +90 -54
  185. package/lib/point/models/fillmage.js +107 -58
  186. package/lib/point/models/image.js +92 -47
  187. package/lib/point/models/index.js +12 -1
  188. package/lib/point/models/normal.js +64 -30
  189. package/lib/point/models/radar.js +72 -38
  190. package/lib/point/models/simplePoint.js +72 -38
  191. package/lib/point/models/text.js +305 -199
  192. package/lib/point/shape/extrude.js +20 -4
  193. package/lib/polygon/index.js +48 -11
  194. package/lib/polygon/models/extrude.js +146 -87
  195. package/lib/polygon/models/fill.js +89 -50
  196. package/lib/polygon/models/index.js +14 -2
  197. package/lib/polygon/models/ocean.js +88 -42
  198. package/lib/polygon/models/water.js +82 -37
  199. package/lib/raster/buffers/triangulation.js +7 -3
  200. package/lib/raster/index.js +40 -9
  201. package/lib/raster/models/index.js +5 -0
  202. package/lib/raster/models/raster.js +125 -80
  203. package/lib/raster/models/rasterRgb.js +139 -84
  204. package/lib/raster/models/rasterTerrainRgb.js +93 -56
  205. package/lib/tile/interaction/getRasterData.js +25 -14
  206. package/lib/tile/interaction/utils.js +19 -7
  207. package/lib/tile/manager/base.js +104 -63
  208. package/lib/tile/service/TileLayerService.js +60 -33
  209. package/lib/tile/service/TilePickService.js +48 -26
  210. package/lib/tile/service/TileSourceService.js +16 -2
  211. package/lib/tile/style/utils.js +3 -0
  212. package/lib/tile/tileFactory/DebugTile.js +54 -29
  213. package/lib/tile/tileFactory/ImageTile.js +46 -20
  214. package/lib/tile/tileFactory/MaskTile.js +51 -22
  215. package/lib/tile/tileFactory/RasterRGBTile.js +50 -22
  216. package/lib/tile/tileFactory/RasterTerrainRGBTile.js +46 -20
  217. package/lib/tile/tileFactory/RasterTile.js +63 -30
  218. package/lib/tile/tileFactory/Tile.js +102 -63
  219. package/lib/tile/tileFactory/VectorTile.js +76 -41
  220. package/lib/tile/tileFactory/index.js +25 -0
  221. package/lib/tile/tileFactory/layers/TileDebugLayer.js +32 -6
  222. package/lib/tile/tileFactory/util.js +9 -0
  223. package/lib/tile/tileLayer/BaseLayer.js +153 -105
  224. package/lib/tile/utils.js +5 -1
  225. package/lib/utils/blend.js +5 -0
  226. package/lib/utils/collision-index.js +25 -9
  227. package/lib/utils/extrude_polyline.js +181 -101
  228. package/lib/utils/grid-index.js +28 -2
  229. package/lib/utils/identityScale.js +9 -0
  230. package/lib/utils/layerData.js +49 -30
  231. package/lib/utils/multiPassRender.js +16 -11
  232. package/lib/utils/polylineNormal.js +66 -31
  233. package/lib/utils/simpleLine.js +21 -2
  234. package/lib/utils/stencil.js +4 -0
  235. package/lib/utils/symbol-layout.js +55 -27
  236. package/lib/wind/index.js +37 -9
  237. package/lib/wind/models/index.js +3 -0
  238. package/lib/wind/models/utils.js +62 -26
  239. package/lib/wind/models/wind.js +157 -101
  240. package/lib/wind/models/windRender.js +71 -53
  241. package/lib/wind/models/windShader.js +1 -0
  242. package/package.json +7 -7
@@ -1,13 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = extrudePolygon;
8
9
  exports.fillPolygon = fillPolygon;
10
+
9
11
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
12
+
10
13
  var _earcut = _interopRequireDefault(require("earcut"));
14
+
11
15
  /**
12
16
  * 拉伸多边形顶点,返回拉伸后的顶点信息
13
17
  * @param paths 路径数据组
@@ -16,44 +20,56 @@ var _earcut = _interopRequireDefault(require("earcut"));
16
20
  function extrudePolygon(path) {
17
21
  var p1 = path[0][0];
18
22
  var p2 = path[0][path[0].length - 1];
23
+
19
24
  if (p1[0] === p2[0] && p1[1] === p2[1]) {
20
25
  path[0] = path[0].slice(0, path[0].length - 1);
21
26
  }
27
+
22
28
  var n = path[0].length;
29
+
23
30
  var flattengeo = _earcut.default.flatten(path);
31
+
24
32
  var positions = [];
25
33
  var indexArray = [];
26
- var normals = [];
27
- // 设置顶部z值
34
+ var normals = []; // 设置顶部z值
35
+
28
36
  for (var j = 0; j < flattengeo.vertices.length / 3; j++) {
29
37
  flattengeo.vertices[j * 3 + 2] = 1;
30
38
  normals.push(0, 0, 1);
31
39
  }
40
+
32
41
  positions.push.apply(positions, (0, _toConsumableArray2.default)(flattengeo.vertices));
33
42
  var triangles = (0, _earcut.default)(flattengeo.vertices, flattengeo.holes, flattengeo.dimensions);
34
43
  indexArray.push.apply(indexArray, (0, _toConsumableArray2.default)(triangles));
35
- var _loop = function _loop() {
44
+
45
+ var _loop = function _loop(i) {
36
46
  var prePoint = flattengeo.vertices.slice(i * 3, i * 3 + 3);
37
47
  var nextPoint = flattengeo.vertices.slice(i * 3 + 3, i * 3 + 6);
48
+
38
49
  if (nextPoint.length === 0) {
39
50
  nextPoint = flattengeo.vertices.slice(0, 3);
40
51
  }
52
+
41
53
  var indexOffset = positions.length / 3;
42
54
  positions.push(prePoint[0], prePoint[1], 1, nextPoint[0], nextPoint[1], 1, prePoint[0], prePoint[1], 0, nextPoint[0], nextPoint[1], 0);
43
55
  indexArray.push.apply(indexArray, (0, _toConsumableArray2.default)([1, 2, 0, 3, 2, 1].map(function (v) {
44
56
  return v + indexOffset;
45
57
  })));
46
58
  };
59
+
47
60
  for (var i = 0; i < n; i++) {
48
- _loop();
61
+ _loop(i);
49
62
  }
63
+
50
64
  return {
51
65
  positions: positions,
52
66
  index: indexArray
53
67
  };
54
68
  }
69
+
55
70
  function fillPolygon(points) {
56
71
  var flattengeo = _earcut.default.flatten(points);
72
+
57
73
  var triangles = (0, _earcut.default)(flattengeo.vertices, flattengeo.holes, flattengeo.dimensions);
58
74
  return {
59
75
  positions: flattengeo.vertices,
@@ -1,66 +1,94 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
9
+
8
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
9
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+
10
14
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
+
11
16
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
+
12
18
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
19
+
13
20
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
21
+
14
22
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
23
+
15
24
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
25
+
16
26
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
27
+
17
28
  var _BaseLayer2 = _interopRequireDefault(require("../core/BaseLayer"));
29
+
18
30
  var _models = _interopRequireDefault(require("./models/"));
31
+
19
32
  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); }; }
33
+
20
34
  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; } }
35
+
21
36
  var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
22
37
  (0, _inherits2.default)(PolygonLayer, _BaseLayer);
38
+
23
39
  var _super = _createSuper(PolygonLayer);
40
+
24
41
  function PolygonLayer() {
25
42
  var _this;
43
+
26
44
  (0, _classCallCheck2.default)(this, PolygonLayer);
45
+
27
46
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
28
47
  args[_key] = arguments[_key];
29
48
  }
49
+
30
50
  _this = _super.call.apply(_super, [this].concat(args));
31
51
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "type", 'PolygonLayer');
32
52
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "enableEncodeStyles", ['opacity']);
33
53
  return _this;
34
54
  }
55
+
35
56
  (0, _createClass2.default)(PolygonLayer, [{
36
57
  key: "buildModels",
37
58
  value: function () {
38
59
  var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
39
60
  var shape;
40
61
  return _regenerator.default.wrap(function _callee$(_context) {
41
- while (1) switch (_context.prev = _context.next) {
42
- case 0:
43
- shape = this.getModelType();
44
- this.layerModel = new _models.default[shape](this);
45
- _context.next = 4;
46
- return this.initLayerModels();
47
- case 4:
48
- case "end":
49
- return _context.stop();
62
+ while (1) {
63
+ switch (_context.prev = _context.next) {
64
+ case 0:
65
+ shape = this.getModelType();
66
+ this.layerModel = new _models.default[shape](this);
67
+ _context.next = 4;
68
+ return this.initLayerModels();
69
+
70
+ case 4:
71
+ case "end":
72
+ return _context.stop();
73
+ }
50
74
  }
51
75
  }, _callee, this);
52
76
  }));
77
+
53
78
  function buildModels() {
54
79
  return _buildModels.apply(this, arguments);
55
80
  }
81
+
56
82
  return buildModels;
57
83
  }()
58
84
  }, {
59
85
  key: "getModelType",
60
86
  value: function getModelType() {
61
87
  var _shapeAttribute$scale;
88
+
62
89
  var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
63
90
  var shape = shapeAttribute === null || shapeAttribute === void 0 ? void 0 : (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
91
+
64
92
  if (shape === 'fill' || !shape) {
65
93
  return 'fill';
66
94
  } else if (shape === 'extrude') {
@@ -81,33 +109,42 @@ var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
81
109
  // pointlayer
82
110
  // 2D、 3d、 shape、image、text、normal、
83
111
  var layerData = this.getEncodedData();
112
+
84
113
  var _this$getLayerConfig = this.getLayerConfig(),
85
- shape2d = _this$getLayerConfig.shape2d,
86
- shape3d = _this$getLayerConfig.shape3d;
114
+ shape2d = _this$getLayerConfig.shape2d,
115
+ shape3d = _this$getLayerConfig.shape3d;
116
+
87
117
  var iconMap = this.iconService.getIconMap();
88
118
  var item = layerData.find(function (fe) {
89
119
  return fe.hasOwnProperty('shape');
90
120
  });
121
+
91
122
  if (!item) {
92
123
  return 'fill';
93
124
  } else {
94
125
  var shape = item.shape;
126
+
95
127
  if (shape === 'dot') {
96
128
  return 'point_normal';
97
129
  }
130
+
98
131
  if ((shape2d === null || shape2d === void 0 ? void 0 : shape2d.indexOf(shape)) !== -1) {
99
132
  return 'point_fill';
100
133
  }
134
+
101
135
  if ((shape3d === null || shape3d === void 0 ? void 0 : shape3d.indexOf(shape)) !== -1) {
102
136
  return 'point_extrude';
103
137
  }
138
+
104
139
  if (iconMap.hasOwnProperty(shape)) {
105
140
  return 'point_image';
106
141
  }
142
+
107
143
  return 'text';
108
144
  }
109
145
  }
110
146
  }]);
111
147
  return PolygonLayer;
112
148
  }(_BaseLayer2.default);
149
+
113
150
  exports.default = PolygonLayer;
@@ -1,68 +1,97 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
9
+
8
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
9
12
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
+
10
14
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
15
+
11
16
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
17
+
12
18
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
19
+
13
20
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
21
+
14
22
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
23
+
15
24
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
25
+
16
26
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
27
+
17
28
  var _l7Core = require("@antv/l7-core");
29
+
18
30
  var _l7Utils = require("@antv/l7-utils");
31
+
19
32
  var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
33
+
20
34
  var _triangulation = require("../../core/triangulation");
35
+
21
36
  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); }; }
37
+
22
38
  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; } }
39
+
23
40
  /* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_frag.glsl' */
24
41
  var polygonExtrudeFrag = "uniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\n\n#pragma include \"picking\"\n\nvoid main() {\n\n\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n\n gl_FragColor = v_Color;\n \n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
42
+
25
43
  /* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_vert.glsl' */
26
44
  var polygonExtrudeVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n \n float isSide = a_Position.z;\n float topU = a_uvs[0];\n float topV = 1.0 - a_uvs[1];\n float sidey = a_uvs[2];\n\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n float lightWeight = calc_lighting(pos);\n\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n\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 project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {\n // side face\n // if(u_sidesurface < 1.0) {\n // discard;\n // }\n\n if(u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n v_Color = linearColor;\n } else {\n v_Color = a_Color;\n }\n\n } else {\n v_Color = a_Color;\n }\n\n v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);\n\n\n setPickingColor(a_PickingColor);\n}\n"; // extrude
45
+
27
46
  /* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_frag.glsl' */
28
47
  var polygonExtrudeTexFrag = "uniform sampler2D u_texture;\nuniform float u_opacity: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nvarying vec3 v_uvs;\nvarying vec2 v_texture_data;\n\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = u_opacity;\n float isSide = v_texture_data.x;\n float lightWeight = v_texture_data.y;\n float topU = v_uvs[0];\n float topV = 1.0 - v_uvs[1];\n float sidey = v_uvs[2];\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {// \u662F\u5426\u662F\u8FB9\u7F18\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n\n if(u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n gl_FragColor = linearColor;\n } else {\n gl_FragColor = v_Color;\n }\n } else {\n\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n\n gl_FragColor = texture2D(u_texture, vec2(topU, topV));\n // gl_FragColor = vec4(1.0, 0., 0., 1.0);\n }\n \n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n"; // texture
48
+
29
49
  /* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_vert.glsl' */
30
50
  var polygonExtrudeTexVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform sampler2D u_texture;\n\n\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\nvarying vec4 v_Color;\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\nuniform float u_linearColor: 0.0;\n\nvarying vec2 v_texture_data;\nvarying vec3 v_uvs;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n \n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n float lightWeight = calc_lighting(pos);\n vec4 project_pos = project_position(pos);\n v_uvs = a_uvs;\n\n v_texture_data = vec2(a_Position.z, lightWeight);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n\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 project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n\n\n\n setPickingColor(a_PickingColor);\n}\n"; // extrude picking
51
+
31
52
  /* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_picklight_frag.glsl' */
32
53
  var polygonExtrudePickLightFrag = "uniform float u_opacity: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nvarying vec3 v_uvs;\nvarying vec2 v_texture_data;\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = u_opacity;\n float isSide = v_texture_data.x;\n float sidey = v_uvs[2];\n float lightWeight = v_texture_data.y;\n\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n \n if( u_linearColor == 1.0) {\n // side use linear\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n gl_FragColor = linearColor;\n } else {\n // side notuse linear\n gl_FragColor = v_Color;\n }\n } else {\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n gl_FragColor = v_Color;\n }\n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColorAlpha(gl_FragColor, lightWeight);\n}\n";
54
+
33
55
  /* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_picklight_vert.glsl' */
34
56
  var polygonExtrudePickLightVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\n\nvarying vec2 v_texture_data;\nvarying vec3 v_uvs;\nvarying vec4 v_Color;\n\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n\n\n v_uvs = a_uvs;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += 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 project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n float lightWeight = calc_lighting(pos);\n v_texture_data = vec2(a_Position.z,lightWeight);\n\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n setPickingColor(a_PickingColor);\n}\n";
57
+
35
58
  var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
36
59
  (0, _inherits2.default)(ExtrudeModel, _BaseModel);
60
+
37
61
  var _super = _createSuper(ExtrudeModel);
62
+
38
63
  function ExtrudeModel() {
39
64
  (0, _classCallCheck2.default)(this, ExtrudeModel);
40
65
  return _super.apply(this, arguments);
41
66
  }
67
+
42
68
  (0, _createClass2.default)(ExtrudeModel, [{
43
69
  key: "getUninforms",
44
70
  value: function getUninforms() {
45
71
  var _ref = this.layer.getLayerConfig(),
46
- _ref$heightfixed = _ref.heightfixed,
47
- heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
48
- _ref$raisingHeight = _ref.raisingHeight,
49
- raisingHeight = _ref$raisingHeight === void 0 ? 0 : _ref$raisingHeight,
50
- _ref$topsurface = _ref.topsurface,
51
- topsurface = _ref$topsurface === void 0 ? true : _ref$topsurface,
52
- _ref$sidesurface = _ref.sidesurface,
53
- sidesurface = _ref$sidesurface === void 0 ? true : _ref$sidesurface,
54
- sourceColor = _ref.sourceColor,
55
- targetColor = _ref.targetColor;
56
-
57
- // 转化渐变色
72
+ _ref$heightfixed = _ref.heightfixed,
73
+ heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
74
+ _ref$raisingHeight = _ref.raisingHeight,
75
+ raisingHeight = _ref$raisingHeight === void 0 ? 0 : _ref$raisingHeight,
76
+ _ref$topsurface = _ref.topsurface,
77
+ topsurface = _ref$topsurface === void 0 ? true : _ref$topsurface,
78
+ _ref$sidesurface = _ref.sidesurface,
79
+ sidesurface = _ref$sidesurface === void 0 ? true : _ref$sidesurface,
80
+ sourceColor = _ref.sourceColor,
81
+ targetColor = _ref.targetColor; // 转化渐变色
82
+
83
+
58
84
  var useLinearColor = 0; // 默认不生效
85
+
59
86
  var sourceColorArr = [1, 1, 1, 1];
60
87
  var targetColorArr = [1, 1, 1, 1];
88
+
61
89
  if (sourceColor && targetColor) {
62
90
  sourceColorArr = (0, _l7Utils.rgb2arr)(sourceColor);
63
91
  targetColorArr = (0, _l7Utils.rgb2arr)(targetColor);
64
92
  useLinearColor = 1;
65
93
  }
94
+
66
95
  return (0, _objectSpread2.default)({
67
96
  // 控制侧面和顶面的显示隐藏
68
97
  u_topsurface: Number(topsurface),
@@ -81,21 +110,27 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
81
110
  value: function () {
82
111
  var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
83
112
  return _regenerator.default.wrap(function _callee$(_context) {
84
- while (1) switch (_context.prev = _context.next) {
85
- case 0:
86
- _context.next = 2;
87
- return this.loadTexture();
88
- case 2:
89
- return _context.abrupt("return", this.buildModels());
90
- case 3:
91
- case "end":
92
- return _context.stop();
113
+ while (1) {
114
+ switch (_context.prev = _context.next) {
115
+ case 0:
116
+ _context.next = 2;
117
+ return this.loadTexture();
118
+
119
+ case 2:
120
+ return _context.abrupt("return", this.buildModels());
121
+
122
+ case 3:
123
+ case "end":
124
+ return _context.stop();
125
+ }
93
126
  }
94
127
  }, _callee, this);
95
128
  }));
129
+
96
130
  function initModels() {
97
131
  return _initModels.apply(this, arguments);
98
132
  }
133
+
99
134
  return initModels;
100
135
  }()
101
136
  }, {
@@ -103,38 +138,46 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
103
138
  value: function () {
104
139
  var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
105
140
  var _this$getShaders, frag, vert, type, model;
141
+
106
142
  return _regenerator.default.wrap(function _callee2$(_context2) {
107
- while (1) switch (_context2.prev = _context2.next) {
108
- case 0:
109
- _this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
110
- _context2.next = 3;
111
- return this.layer.buildLayerModel({
112
- moduleName: type,
113
- vertexShader: vert,
114
- fragmentShader: frag,
115
- inject: this.getInject(),
116
- triangulation: _triangulation.PolygonExtrudeTriangulation
117
- });
118
- case 3:
119
- model = _context2.sent;
120
- return _context2.abrupt("return", [model]);
121
- case 5:
122
- case "end":
123
- return _context2.stop();
143
+ while (1) {
144
+ switch (_context2.prev = _context2.next) {
145
+ case 0:
146
+ _this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
147
+ _context2.next = 3;
148
+ return this.layer.buildLayerModel({
149
+ moduleName: type,
150
+ vertexShader: vert,
151
+ fragmentShader: frag,
152
+ inject: this.getInject(),
153
+ triangulation: _triangulation.PolygonExtrudeTriangulation
154
+ });
155
+
156
+ case 3:
157
+ model = _context2.sent;
158
+ return _context2.abrupt("return", [model]);
159
+
160
+ case 5:
161
+ case "end":
162
+ return _context2.stop();
163
+ }
124
164
  }
125
165
  }, _callee2, this);
126
166
  }));
167
+
127
168
  function buildModels() {
128
169
  return _buildModels.apply(this, arguments);
129
170
  }
171
+
130
172
  return buildModels;
131
173
  }()
132
174
  }, {
133
175
  key: "getShaders",
134
176
  value: function getShaders() {
135
177
  var _ref2 = this.layer.getLayerConfig(),
136
- pickLight = _ref2.pickLight,
137
- mapTexture = _ref2.mapTexture;
178
+ pickLight = _ref2.pickLight,
179
+ mapTexture = _ref2.mapTexture;
180
+
138
181
  if (mapTexture) {
139
182
  return {
140
183
  frag: polygonExtrudeTexFrag,
@@ -142,6 +185,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
142
185
  type: 'polygonExtrudeTexture'
143
186
  };
144
187
  }
188
+
145
189
  if (pickLight) {
146
190
  return {
147
191
  frag: polygonExtrudePickLightFrag,
@@ -160,6 +204,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
160
204
  key: "clearModels",
161
205
  value: function clearModels() {
162
206
  var _this$texture;
207
+
163
208
  (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
164
209
  }
165
210
  }, {
@@ -170,21 +215,25 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
170
215
  var layerCenter = this.layer.coordCenter || this.layer.getSource().center;
171
216
  var lngLen = bounds[2] - bounds[0];
172
217
  var latLen = bounds[3] - bounds[1];
218
+
173
219
  if (this.mapService.version === 'GAODE2.x') {
174
220
  // @ts-ignore
175
221
  var _this$mapService$coor = this.mapService.coordToAMap2RelativeCoordinates([bbox[0], bbox[1]], layerCenter),
176
- _this$mapService$coor2 = (0, _slicedToArray2.default)(_this$mapService$coor, 2),
177
- minX = _this$mapService$coor2[0],
178
- minY = _this$mapService$coor2[1];
179
- // @ts-ignore
222
+ _this$mapService$coor2 = (0, _slicedToArray2.default)(_this$mapService$coor, 2),
223
+ minX = _this$mapService$coor2[0],
224
+ minY = _this$mapService$coor2[1]; // @ts-ignore
225
+
226
+
180
227
  var _this$mapService$coor3 = this.mapService.coordToAMap2RelativeCoordinates([bbox[2], bbox[3]], layerCenter),
181
- _this$mapService$coor4 = (0, _slicedToArray2.default)(_this$mapService$coor3, 2),
182
- maxX = _this$mapService$coor4[0],
183
- maxY = _this$mapService$coor4[1];
228
+ _this$mapService$coor4 = (0, _slicedToArray2.default)(_this$mapService$coor3, 2),
229
+ maxX = _this$mapService$coor4[0],
230
+ maxY = _this$mapService$coor4[1];
231
+
184
232
  lngLen = maxX - minX;
185
233
  latLen = maxY - minY;
186
234
  bounds = [minX, minY, maxX, maxY];
187
235
  }
236
+
188
237
  this.styleAttributeService.registerStyleAttribute({
189
238
  name: 'uvs',
190
239
  type: _l7Core.AttributeType.Attribute,
@@ -199,9 +248,9 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
199
248
  size: 3,
200
249
  update: function update(feature, featureIdx, vertex) {
201
250
  var lng = vertex[0];
202
- var lat = vertex[1];
203
- // console.log((lng - bounds[0]) / lngLen, (lat - bounds[1]) / latLen, vertex[4])
251
+ var lat = vertex[1]; // console.log((lng - bounds[0]) / lngLen, (lat - bounds[1]) / latLen, vertex[4])
204
252
  // 临时 兼容高德V2
253
+
205
254
  return [(lng - bounds[0]) / lngLen, (lat - bounds[1]) / latLen, vertex[4]];
206
255
  }
207
256
  }
@@ -236,7 +285,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
236
285
  size: 1,
237
286
  update: function update(feature) {
238
287
  var _feature$size = feature.size,
239
- size = _feature$size === void 0 ? 10 : _feature$size;
288
+ size = _feature$size === void 0 ? 10 : _feature$size;
240
289
  return Array.isArray(size) ? [size[0]] : [size];
241
290
  }
242
291
  }
@@ -247,54 +296,64 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
247
296
  value: function () {
248
297
  var _loadTexture = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
249
298
  var _this = this;
299
+
250
300
  var _ref3, mapTexture, createTexture2D;
301
+
251
302
  return _regenerator.default.wrap(function _callee3$(_context3) {
252
- while (1) switch (_context3.prev = _context3.next) {
253
- case 0:
254
- _ref3 = this.layer.getLayerConfig(), mapTexture = _ref3.mapTexture;
255
- createTexture2D = this.rendererService.createTexture2D;
256
- this.texture = createTexture2D({
257
- height: 0,
258
- width: 0
259
- });
260
- if (!mapTexture) {
261
- _context3.next = 5;
262
- break;
263
- }
264
- return _context3.abrupt("return", new Promise(function (resolve, reject) {
265
- var image = new Image();
266
- image.crossOrigin = 'anonymous';
267
- image.src = mapTexture;
268
- image.onload = function () {
269
- _this.texture = createTexture2D({
270
- data: image,
271
- width: image.width,
272
- height: image.height,
273
- wrapS: _l7Core.gl.CLAMP_TO_EDGE,
274
- wrapT: _l7Core.gl.CLAMP_TO_EDGE,
275
- min: _l7Core.gl.LINEAR,
276
- mag: _l7Core.gl.LINEAR
277
- });
278
- return resolve(null);
279
- // this.layerService.reRender();
280
- };
281
-
282
- image.onerror = function () {
283
- reject(new Error('image load error'));
284
- };
285
- }));
286
- case 5:
287
- case "end":
288
- return _context3.stop();
303
+ while (1) {
304
+ switch (_context3.prev = _context3.next) {
305
+ case 0:
306
+ _ref3 = this.layer.getLayerConfig(), mapTexture = _ref3.mapTexture;
307
+ createTexture2D = this.rendererService.createTexture2D;
308
+ this.texture = createTexture2D({
309
+ height: 0,
310
+ width: 0
311
+ });
312
+
313
+ if (!mapTexture) {
314
+ _context3.next = 5;
315
+ break;
316
+ }
317
+
318
+ return _context3.abrupt("return", new Promise(function (resolve, reject) {
319
+ var image = new Image();
320
+ image.crossOrigin = 'anonymous';
321
+ image.src = mapTexture;
322
+
323
+ image.onload = function () {
324
+ _this.texture = createTexture2D({
325
+ data: image,
326
+ width: image.width,
327
+ height: image.height,
328
+ wrapS: _l7Core.gl.CLAMP_TO_EDGE,
329
+ wrapT: _l7Core.gl.CLAMP_TO_EDGE,
330
+ min: _l7Core.gl.LINEAR,
331
+ mag: _l7Core.gl.LINEAR
332
+ });
333
+ return resolve(null); // this.layerService.reRender();
334
+ };
335
+
336
+ image.onerror = function () {
337
+ reject(new Error('image load error'));
338
+ };
339
+ }));
340
+
341
+ case 5:
342
+ case "end":
343
+ return _context3.stop();
344
+ }
289
345
  }
290
346
  }, _callee3, this);
291
347
  }));
348
+
292
349
  function loadTexture() {
293
350
  return _loadTexture.apply(this, arguments);
294
351
  }
352
+
295
353
  return loadTexture;
296
354
  }()
297
355
  }]);
298
356
  return ExtrudeModel;
299
357
  }(_BaseModel2.default);
358
+
300
359
  exports.default = ExtrudeModel;