@antv/l7-layers 2.17.3 → 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 +112 -63
  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 +136 -85
  39. package/es/line/models/linearline.js +74 -42
  40. package/es/line/models/simpleLine.js +67 -38
  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 +122 -61
  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 +144 -83
  160. package/lib/line/models/linearline.js +86 -42
  161. package/lib/line/models/simpleLine.js +77 -38
  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,5 +1,6 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
2
  import earcut from 'earcut';
3
+
3
4
  /**
4
5
  * 拉伸多边形顶点,返回拉伸后的顶点信息
5
6
  * @param paths 路径数据组
@@ -8,37 +9,45 @@ import earcut from 'earcut';
8
9
  export default function extrudePolygon(path) {
9
10
  var p1 = path[0][0];
10
11
  var p2 = path[0][path[0].length - 1];
12
+
11
13
  if (p1[0] === p2[0] && p1[1] === p2[1]) {
12
14
  path[0] = path[0].slice(0, path[0].length - 1);
13
15
  }
16
+
14
17
  var n = path[0].length;
15
18
  var flattengeo = earcut.flatten(path);
16
19
  var positions = [];
17
20
  var indexArray = [];
18
- var normals = [];
19
- // 设置顶部z值
21
+ var normals = []; // 设置顶部z值
22
+
20
23
  for (var j = 0; j < flattengeo.vertices.length / 3; j++) {
21
24
  flattengeo.vertices[j * 3 + 2] = 1;
22
25
  normals.push(0, 0, 1);
23
26
  }
27
+
24
28
  positions.push.apply(positions, _toConsumableArray(flattengeo.vertices));
25
29
  var triangles = earcut(flattengeo.vertices, flattengeo.holes, flattengeo.dimensions);
26
30
  indexArray.push.apply(indexArray, _toConsumableArray(triangles));
27
- var _loop = function _loop() {
31
+
32
+ var _loop = function _loop(i) {
28
33
  var prePoint = flattengeo.vertices.slice(i * 3, i * 3 + 3);
29
34
  var nextPoint = flattengeo.vertices.slice(i * 3 + 3, i * 3 + 6);
35
+
30
36
  if (nextPoint.length === 0) {
31
37
  nextPoint = flattengeo.vertices.slice(0, 3);
32
38
  }
39
+
33
40
  var indexOffset = positions.length / 3;
34
41
  positions.push(prePoint[0], prePoint[1], 1, nextPoint[0], nextPoint[1], 1, prePoint[0], prePoint[1], 0, nextPoint[0], nextPoint[1], 0);
35
42
  indexArray.push.apply(indexArray, _toConsumableArray([1, 2, 0, 3, 2, 1].map(function (v) {
36
43
  return v + indexOffset;
37
44
  })));
38
45
  };
46
+
39
47
  for (var i = 0; i < n; i++) {
40
- _loop();
48
+ _loop(i);
41
49
  }
50
+
42
51
  return {
43
52
  positions: positions,
44
53
  index: indexArray
@@ -7,53 +7,73 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
7
7
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
9
  import _regeneratorRuntime from "@babel/runtime/regenerator";
10
+
10
11
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
+
11
13
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
+
12
15
  import BaseLayer from "../core/BaseLayer";
13
16
  import PolygonModels from "./models/";
17
+
14
18
  var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
15
19
  _inherits(PolygonLayer, _BaseLayer);
20
+
16
21
  var _super = _createSuper(PolygonLayer);
22
+
17
23
  function PolygonLayer() {
18
24
  var _this;
25
+
19
26
  _classCallCheck(this, PolygonLayer);
27
+
20
28
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
21
29
  args[_key] = arguments[_key];
22
30
  }
31
+
23
32
  _this = _super.call.apply(_super, [this].concat(args));
33
+
24
34
  _defineProperty(_assertThisInitialized(_this), "type", 'PolygonLayer');
35
+
25
36
  _defineProperty(_assertThisInitialized(_this), "enableEncodeStyles", ['opacity']);
37
+
26
38
  return _this;
27
39
  }
40
+
28
41
  _createClass(PolygonLayer, [{
29
42
  key: "buildModels",
30
43
  value: function () {
31
44
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
32
45
  var shape;
33
46
  return _regeneratorRuntime.wrap(function _callee$(_context) {
34
- while (1) switch (_context.prev = _context.next) {
35
- case 0:
36
- shape = this.getModelType();
37
- this.layerModel = new PolygonModels[shape](this);
38
- _context.next = 4;
39
- return this.initLayerModels();
40
- case 4:
41
- case "end":
42
- return _context.stop();
47
+ while (1) {
48
+ switch (_context.prev = _context.next) {
49
+ case 0:
50
+ shape = this.getModelType();
51
+ this.layerModel = new PolygonModels[shape](this);
52
+ _context.next = 4;
53
+ return this.initLayerModels();
54
+
55
+ case 4:
56
+ case "end":
57
+ return _context.stop();
58
+ }
43
59
  }
44
60
  }, _callee, this);
45
61
  }));
62
+
46
63
  function buildModels() {
47
64
  return _buildModels.apply(this, arguments);
48
65
  }
66
+
49
67
  return buildModels;
50
68
  }()
51
69
  }, {
52
70
  key: "getModelType",
53
71
  value: function getModelType() {
54
72
  var _shapeAttribute$scale;
73
+
55
74
  var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
56
75
  var shape = shapeAttribute === null || shapeAttribute === void 0 ? void 0 : (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
76
+
57
77
  if (shape === 'fill' || !shape) {
58
78
  return 'fill';
59
79
  } else if (shape === 'extrude') {
@@ -74,33 +94,43 @@ var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
74
94
  // pointlayer
75
95
  // 2D、 3d、 shape、image、text、normal、
76
96
  var layerData = this.getEncodedData();
97
+
77
98
  var _this$getLayerConfig = this.getLayerConfig(),
78
- shape2d = _this$getLayerConfig.shape2d,
79
- shape3d = _this$getLayerConfig.shape3d;
99
+ shape2d = _this$getLayerConfig.shape2d,
100
+ shape3d = _this$getLayerConfig.shape3d;
101
+
80
102
  var iconMap = this.iconService.getIconMap();
81
103
  var item = layerData.find(function (fe) {
82
104
  return fe.hasOwnProperty('shape');
83
105
  });
106
+
84
107
  if (!item) {
85
108
  return 'fill';
86
109
  } else {
87
110
  var shape = item.shape;
111
+
88
112
  if (shape === 'dot') {
89
113
  return 'point_normal';
90
114
  }
115
+
91
116
  if ((shape2d === null || shape2d === void 0 ? void 0 : shape2d.indexOf(shape)) !== -1) {
92
117
  return 'point_fill';
93
118
  }
119
+
94
120
  if ((shape3d === null || shape3d === void 0 ? void 0 : shape3d.indexOf(shape)) !== -1) {
95
121
  return 'point_extrude';
96
122
  }
123
+
97
124
  if (iconMap.hasOwnProperty(shape)) {
98
125
  return 'point_image';
99
126
  }
127
+
100
128
  return 'text';
101
129
  }
102
130
  }
103
131
  }]);
132
+
104
133
  return PolygonLayer;
105
134
  }(BaseLayer);
135
+
106
136
  export { PolygonLayer as default };
@@ -7,55 +7,72 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
7
7
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
8
8
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
9
9
  import _regeneratorRuntime from "@babel/runtime/regenerator";
10
+
10
11
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
+
11
13
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
+
12
15
  import { AttributeType, gl } from '@antv/l7-core';
13
16
  import { rgb2arr } from '@antv/l7-utils';
14
17
  import BaseModel from "../../core/BaseModel";
15
18
  import { PolygonExtrudeTriangulation } from "../../core/triangulation";
19
+
16
20
  /* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_frag.glsl' */
17
21
  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";
22
+
18
23
  /* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_vert.glsl' */
19
24
  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
25
+
20
26
  /* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_frag.glsl' */
21
27
  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
28
+
22
29
  /* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_vert.glsl' */
23
30
  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
31
+
24
32
  /* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_picklight_frag.glsl' */
25
33
  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";
34
+
26
35
  /* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_picklight_vert.glsl' */
27
36
  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";
37
+
28
38
  var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
29
39
  _inherits(ExtrudeModel, _BaseModel);
40
+
30
41
  var _super = _createSuper(ExtrudeModel);
42
+
31
43
  function ExtrudeModel() {
32
44
  _classCallCheck(this, ExtrudeModel);
45
+
33
46
  return _super.apply(this, arguments);
34
47
  }
48
+
35
49
  _createClass(ExtrudeModel, [{
36
50
  key: "getUninforms",
37
51
  value: function getUninforms() {
38
52
  var _ref = this.layer.getLayerConfig(),
39
- _ref$heightfixed = _ref.heightfixed,
40
- heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
41
- _ref$raisingHeight = _ref.raisingHeight,
42
- raisingHeight = _ref$raisingHeight === void 0 ? 0 : _ref$raisingHeight,
43
- _ref$topsurface = _ref.topsurface,
44
- topsurface = _ref$topsurface === void 0 ? true : _ref$topsurface,
45
- _ref$sidesurface = _ref.sidesurface,
46
- sidesurface = _ref$sidesurface === void 0 ? true : _ref$sidesurface,
47
- sourceColor = _ref.sourceColor,
48
- targetColor = _ref.targetColor;
49
-
50
- // 转化渐变色
53
+ _ref$heightfixed = _ref.heightfixed,
54
+ heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
55
+ _ref$raisingHeight = _ref.raisingHeight,
56
+ raisingHeight = _ref$raisingHeight === void 0 ? 0 : _ref$raisingHeight,
57
+ _ref$topsurface = _ref.topsurface,
58
+ topsurface = _ref$topsurface === void 0 ? true : _ref$topsurface,
59
+ _ref$sidesurface = _ref.sidesurface,
60
+ sidesurface = _ref$sidesurface === void 0 ? true : _ref$sidesurface,
61
+ sourceColor = _ref.sourceColor,
62
+ targetColor = _ref.targetColor; // 转化渐变色
63
+
64
+
51
65
  var useLinearColor = 0; // 默认不生效
66
+
52
67
  var sourceColorArr = [1, 1, 1, 1];
53
68
  var targetColorArr = [1, 1, 1, 1];
69
+
54
70
  if (sourceColor && targetColor) {
55
71
  sourceColorArr = rgb2arr(sourceColor);
56
72
  targetColorArr = rgb2arr(targetColor);
57
73
  useLinearColor = 1;
58
74
  }
75
+
59
76
  return _objectSpread({
60
77
  // 控制侧面和顶面的显示隐藏
61
78
  u_topsurface: Number(topsurface),
@@ -74,21 +91,27 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
74
91
  value: function () {
75
92
  var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
76
93
  return _regeneratorRuntime.wrap(function _callee$(_context) {
77
- while (1) switch (_context.prev = _context.next) {
78
- case 0:
79
- _context.next = 2;
80
- return this.loadTexture();
81
- case 2:
82
- return _context.abrupt("return", this.buildModels());
83
- case 3:
84
- case "end":
85
- return _context.stop();
94
+ while (1) {
95
+ switch (_context.prev = _context.next) {
96
+ case 0:
97
+ _context.next = 2;
98
+ return this.loadTexture();
99
+
100
+ case 2:
101
+ return _context.abrupt("return", this.buildModels());
102
+
103
+ case 3:
104
+ case "end":
105
+ return _context.stop();
106
+ }
86
107
  }
87
108
  }, _callee, this);
88
109
  }));
110
+
89
111
  function initModels() {
90
112
  return _initModels.apply(this, arguments);
91
113
  }
114
+
92
115
  return initModels;
93
116
  }()
94
117
  }, {
@@ -96,38 +119,46 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
96
119
  value: function () {
97
120
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
98
121
  var _this$getShaders, frag, vert, type, model;
122
+
99
123
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
100
- while (1) switch (_context2.prev = _context2.next) {
101
- case 0:
102
- _this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
103
- _context2.next = 3;
104
- return this.layer.buildLayerModel({
105
- moduleName: type,
106
- vertexShader: vert,
107
- fragmentShader: frag,
108
- inject: this.getInject(),
109
- triangulation: PolygonExtrudeTriangulation
110
- });
111
- case 3:
112
- model = _context2.sent;
113
- return _context2.abrupt("return", [model]);
114
- case 5:
115
- case "end":
116
- return _context2.stop();
124
+ while (1) {
125
+ switch (_context2.prev = _context2.next) {
126
+ case 0:
127
+ _this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
128
+ _context2.next = 3;
129
+ return this.layer.buildLayerModel({
130
+ moduleName: type,
131
+ vertexShader: vert,
132
+ fragmentShader: frag,
133
+ inject: this.getInject(),
134
+ triangulation: PolygonExtrudeTriangulation
135
+ });
136
+
137
+ case 3:
138
+ model = _context2.sent;
139
+ return _context2.abrupt("return", [model]);
140
+
141
+ case 5:
142
+ case "end":
143
+ return _context2.stop();
144
+ }
117
145
  }
118
146
  }, _callee2, this);
119
147
  }));
148
+
120
149
  function buildModels() {
121
150
  return _buildModels.apply(this, arguments);
122
151
  }
152
+
123
153
  return buildModels;
124
154
  }()
125
155
  }, {
126
156
  key: "getShaders",
127
157
  value: function getShaders() {
128
158
  var _ref2 = this.layer.getLayerConfig(),
129
- pickLight = _ref2.pickLight,
130
- mapTexture = _ref2.mapTexture;
159
+ pickLight = _ref2.pickLight,
160
+ mapTexture = _ref2.mapTexture;
161
+
131
162
  if (mapTexture) {
132
163
  return {
133
164
  frag: polygonExtrudeTexFrag,
@@ -135,6 +166,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
135
166
  type: 'polygonExtrudeTexture'
136
167
  };
137
168
  }
169
+
138
170
  if (pickLight) {
139
171
  return {
140
172
  frag: polygonExtrudePickLightFrag,
@@ -153,6 +185,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
153
185
  key: "clearModels",
154
186
  value: function clearModels() {
155
187
  var _this$texture;
188
+
156
189
  (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
157
190
  }
158
191
  }, {
@@ -163,21 +196,25 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
163
196
  var layerCenter = this.layer.coordCenter || this.layer.getSource().center;
164
197
  var lngLen = bounds[2] - bounds[0];
165
198
  var latLen = bounds[3] - bounds[1];
199
+
166
200
  if (this.mapService.version === 'GAODE2.x') {
167
201
  // @ts-ignore
168
202
  var _this$mapService$coor = this.mapService.coordToAMap2RelativeCoordinates([bbox[0], bbox[1]], layerCenter),
169
- _this$mapService$coor2 = _slicedToArray(_this$mapService$coor, 2),
170
- minX = _this$mapService$coor2[0],
171
- minY = _this$mapService$coor2[1];
172
- // @ts-ignore
203
+ _this$mapService$coor2 = _slicedToArray(_this$mapService$coor, 2),
204
+ minX = _this$mapService$coor2[0],
205
+ minY = _this$mapService$coor2[1]; // @ts-ignore
206
+
207
+
173
208
  var _this$mapService$coor3 = this.mapService.coordToAMap2RelativeCoordinates([bbox[2], bbox[3]], layerCenter),
174
- _this$mapService$coor4 = _slicedToArray(_this$mapService$coor3, 2),
175
- maxX = _this$mapService$coor4[0],
176
- maxY = _this$mapService$coor4[1];
209
+ _this$mapService$coor4 = _slicedToArray(_this$mapService$coor3, 2),
210
+ maxX = _this$mapService$coor4[0],
211
+ maxY = _this$mapService$coor4[1];
212
+
177
213
  lngLen = maxX - minX;
178
214
  latLen = maxY - minY;
179
215
  bounds = [minX, minY, maxX, maxY];
180
216
  }
217
+
181
218
  this.styleAttributeService.registerStyleAttribute({
182
219
  name: 'uvs',
183
220
  type: AttributeType.Attribute,
@@ -192,9 +229,9 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
192
229
  size: 3,
193
230
  update: function update(feature, featureIdx, vertex) {
194
231
  var lng = vertex[0];
195
- var lat = vertex[1];
196
- // console.log((lng - bounds[0]) / lngLen, (lat - bounds[1]) / latLen, vertex[4])
232
+ var lat = vertex[1]; // console.log((lng - bounds[0]) / lngLen, (lat - bounds[1]) / latLen, vertex[4])
197
233
  // 临时 兼容高德V2
234
+
198
235
  return [(lng - bounds[0]) / lngLen, (lat - bounds[1]) / latLen, vertex[4]];
199
236
  }
200
237
  }
@@ -229,7 +266,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
229
266
  size: 1,
230
267
  update: function update(feature) {
231
268
  var _feature$size = feature.size,
232
- size = _feature$size === void 0 ? 10 : _feature$size;
269
+ size = _feature$size === void 0 ? 10 : _feature$size;
233
270
  return Array.isArray(size) ? [size[0]] : [size];
234
271
  }
235
272
  }
@@ -240,54 +277,65 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
240
277
  value: function () {
241
278
  var _loadTexture = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
242
279
  var _this = this;
280
+
243
281
  var _ref3, mapTexture, createTexture2D;
282
+
244
283
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
245
- while (1) switch (_context3.prev = _context3.next) {
246
- case 0:
247
- _ref3 = this.layer.getLayerConfig(), mapTexture = _ref3.mapTexture;
248
- createTexture2D = this.rendererService.createTexture2D;
249
- this.texture = createTexture2D({
250
- height: 0,
251
- width: 0
252
- });
253
- if (!mapTexture) {
254
- _context3.next = 5;
255
- break;
256
- }
257
- return _context3.abrupt("return", new Promise(function (resolve, reject) {
258
- var image = new Image();
259
- image.crossOrigin = 'anonymous';
260
- image.src = mapTexture;
261
- image.onload = function () {
262
- _this.texture = createTexture2D({
263
- data: image,
264
- width: image.width,
265
- height: image.height,
266
- wrapS: gl.CLAMP_TO_EDGE,
267
- wrapT: gl.CLAMP_TO_EDGE,
268
- min: gl.LINEAR,
269
- mag: gl.LINEAR
270
- });
271
- return resolve(null);
272
- // this.layerService.reRender();
273
- };
274
-
275
- image.onerror = function () {
276
- reject(new Error('image load error'));
277
- };
278
- }));
279
- case 5:
280
- case "end":
281
- return _context3.stop();
284
+ while (1) {
285
+ switch (_context3.prev = _context3.next) {
286
+ case 0:
287
+ _ref3 = this.layer.getLayerConfig(), mapTexture = _ref3.mapTexture;
288
+ createTexture2D = this.rendererService.createTexture2D;
289
+ this.texture = createTexture2D({
290
+ height: 0,
291
+ width: 0
292
+ });
293
+
294
+ if (!mapTexture) {
295
+ _context3.next = 5;
296
+ break;
297
+ }
298
+
299
+ return _context3.abrupt("return", new Promise(function (resolve, reject) {
300
+ var image = new Image();
301
+ image.crossOrigin = 'anonymous';
302
+ image.src = mapTexture;
303
+
304
+ image.onload = function () {
305
+ _this.texture = createTexture2D({
306
+ data: image,
307
+ width: image.width,
308
+ height: image.height,
309
+ wrapS: gl.CLAMP_TO_EDGE,
310
+ wrapT: gl.CLAMP_TO_EDGE,
311
+ min: gl.LINEAR,
312
+ mag: gl.LINEAR
313
+ });
314
+ return resolve(null); // this.layerService.reRender();
315
+ };
316
+
317
+ image.onerror = function () {
318
+ reject(new Error('image load error'));
319
+ };
320
+ }));
321
+
322
+ case 5:
323
+ case "end":
324
+ return _context3.stop();
325
+ }
282
326
  }
283
327
  }, _callee3, this);
284
328
  }));
329
+
285
330
  function loadTexture() {
286
331
  return _loadTexture.apply(this, arguments);
287
332
  }
333
+
288
334
  return loadTexture;
289
335
  }()
290
336
  }]);
337
+
291
338
  return ExtrudeModel;
292
339
  }(BaseModel);
340
+
293
341
  export { ExtrudeModel as default };