@antv/l7-layers 2.16.0 → 2.16.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 (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 +485 -321
  10. package/es/core/BaseModel.js +126 -97
  11. package/es/core/LayerPickService.js +32 -21
  12. package/es/core/TextureService.js +13 -0
  13. package/es/core/interface.js +24 -17
  14. package/es/core/shape/Path.js +20 -13
  15. package/es/core/shape/extrude.js +31 -10
  16. package/es/core/triangulation.js +114 -54
  17. package/es/earth/index.js +33 -9
  18. package/es/earth/models/atmosphere.js +54 -30
  19. package/es/earth/models/base.js +85 -47
  20. package/es/earth/models/bloomsphere.js +54 -30
  21. package/es/earth/utils.js +13 -9
  22. package/es/heatmap/index.js +40 -10
  23. package/es/heatmap/models/grid.js +52 -28
  24. package/es/heatmap/models/grid3d.js +52 -28
  25. package/es/heatmap/models/heatmap.js +146 -91
  26. package/es/heatmap/models/hexagon.js +52 -28
  27. package/es/heatmap/triangulation.js +4 -0
  28. package/es/image/index.js +28 -9
  29. package/es/image/models/image.js +100 -66
  30. package/es/index.js +17 -9
  31. package/es/line/index.js +34 -9
  32. package/es/line/models/arc.js +118 -66
  33. package/es/line/models/arc_3d.js +108 -60
  34. package/es/line/models/earthArc_3d.js +111 -63
  35. package/es/line/models/great_circle.js +100 -56
  36. package/es/line/models/half.js +77 -46
  37. package/es/line/models/line.js +148 -94
  38. package/es/line/models/linearline.js +80 -45
  39. package/es/line/models/simpleLine.js +74 -41
  40. package/es/line/models/wall.js +92 -52
  41. package/es/mask/index.js +28 -9
  42. package/es/mask/models/fill.js +54 -29
  43. package/es/plugins/DataMappingPlugin.js +117 -80
  44. package/es/plugins/DataSourcePlugin.js +68 -45
  45. package/es/plugins/FeatureScalePlugin.js +122 -67
  46. package/es/plugins/LayerAnimateStylePlugin.js +5 -0
  47. package/es/plugins/LayerMaskPlugin.js +11 -3
  48. package/es/plugins/LayerModelPlugin.js +104 -67
  49. package/es/plugins/LayerStylePlugin.js +9 -3
  50. package/es/plugins/LightingPlugin.js +18 -12
  51. package/es/plugins/MultiPassRendererPlugin.js +16 -11
  52. package/es/plugins/PixelPickingPlugin.js +21 -12
  53. package/es/plugins/RegisterStyleAttributePlugin.js +12 -5
  54. package/es/plugins/ShaderUniformPlugin.js +27 -13
  55. package/es/plugins/UpdateModelPlugin.js +5 -0
  56. package/es/plugins/UpdateStyleAttributePlugin.js +11 -5
  57. package/es/point/index.js +77 -26
  58. package/es/point/models/earthExtrude.js +102 -61
  59. package/es/point/models/earthFill.js +87 -57
  60. package/es/point/models/extrude.js +101 -60
  61. package/es/point/models/fill.js +100 -70
  62. package/es/point/models/fillmage.js +107 -63
  63. package/es/point/models/image.js +88 -48
  64. package/es/point/models/index.js +2 -2
  65. package/es/point/models/normal.js +54 -30
  66. package/es/point/models/radar.js +64 -40
  67. package/es/point/models/simplePoint.js +69 -41
  68. package/es/point/models/text.js +301 -198
  69. package/es/point/shape/extrude.js +13 -4
  70. package/es/polygon/index.js +40 -11
  71. package/es/polygon/models/extrude.js +92 -48
  72. package/es/polygon/models/fill.js +88 -54
  73. package/es/polygon/models/index.js +2 -3
  74. package/es/polygon/models/ocean.js +76 -42
  75. package/es/polygon/models/water.js +71 -37
  76. package/es/raster/buffers/triangulation.js +4 -2
  77. package/es/raster/index.js +32 -9
  78. package/es/raster/models/raster.js +116 -80
  79. package/es/raster/models/rasterRgb.js +127 -84
  80. package/es/raster/models/rasterTerrainRgb.js +84 -56
  81. package/es/tile/interaction/getRasterData.js +20 -14
  82. package/es/tile/interaction/utils.js +9 -7
  83. package/es/tile/manager/base.js +96 -63
  84. package/es/tile/service/TileLayerService.js +55 -33
  85. package/es/tile/service/TilePickService.js +40 -26
  86. package/es/tile/service/TileSourceService.js +7 -3
  87. package/es/tile/tileFactory/DebugTile.js +46 -29
  88. package/es/tile/tileFactory/ImageTile.js +38 -20
  89. package/es/tile/tileFactory/MaskTile.js +43 -22
  90. package/es/tile/tileFactory/RasterRGBTile.js +42 -22
  91. package/es/tile/tileFactory/RasterTerrainRGBTile.js +38 -20
  92. package/es/tile/tileFactory/RasterTile.js +53 -30
  93. package/es/tile/tileFactory/Tile.js +97 -63
  94. package/es/tile/tileFactory/VectorTile.js +68 -41
  95. package/es/tile/tileFactory/index.js +11 -0
  96. package/es/tile/tileFactory/layers/TileDebugLayer.js +27 -6
  97. package/es/tile/tileFactory/util.js +3 -0
  98. package/es/tile/tileLayer/BaseLayer.js +146 -105
  99. package/es/tile/utils.js +1 -1
  100. package/es/utils/blend.js +2 -0
  101. package/es/utils/collision-index.js +16 -9
  102. package/es/utils/dataMappingStyle.js +18 -8
  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 +479 -321
  127. package/lib/core/BaseModel.js +139 -97
  128. package/lib/core/LayerPickService.js +37 -21
  129. package/lib/core/TextureService.js +16 -0
  130. package/lib/core/interface.js +31 -21
  131. package/lib/core/schema.js +1 -0
  132. package/lib/core/shape/Path.js +31 -14
  133. package/lib/core/shape/extrude.js +54 -10
  134. package/lib/core/triangulation.js +153 -53
  135. package/lib/earth/index.js +43 -9
  136. package/lib/earth/models/atmosphere.js +63 -30
  137. package/lib/earth/models/base.js +90 -47
  138. package/lib/earth/models/bloomsphere.js +63 -30
  139. package/lib/earth/utils.js +31 -7
  140. package/lib/heatmap/index.js +48 -10
  141. package/lib/heatmap/models/grid.js +60 -28
  142. package/lib/heatmap/models/grid3d.js +60 -28
  143. package/lib/heatmap/models/heatmap.js +162 -91
  144. package/lib/heatmap/models/hexagon.js +60 -28
  145. package/lib/heatmap/models/index.js +6 -0
  146. package/lib/heatmap/triangulation.js +5 -0
  147. package/lib/image/index.js +36 -9
  148. package/lib/image/models/image.js +109 -66
  149. package/lib/image/models/index.js +3 -0
  150. package/lib/index.js +61 -7
  151. package/lib/line/index.js +40 -9
  152. package/lib/line/models/arc.js +128 -64
  153. package/lib/line/models/arc_3d.js +119 -58
  154. package/lib/line/models/earthArc_3d.js +122 -61
  155. package/lib/line/models/great_circle.js +111 -56
  156. package/lib/line/models/half.js +87 -46
  157. package/lib/line/models/index.js +11 -0
  158. package/lib/line/models/line.js +156 -92
  159. package/lib/line/models/linearline.js +92 -45
  160. package/lib/line/models/simpleLine.js +84 -41
  161. package/lib/line/models/wall.js +103 -52
  162. package/lib/mask/index.js +36 -9
  163. package/lib/mask/models/fill.js +63 -29
  164. package/lib/mask/models/index.js +3 -0
  165. package/lib/plugins/DataMappingPlugin.js +128 -80
  166. package/lib/plugins/DataSourcePlugin.js +76 -45
  167. package/lib/plugins/FeatureScalePlugin.js +138 -67
  168. package/lib/plugins/LayerAnimateStylePlugin.js +10 -0
  169. package/lib/plugins/LayerMaskPlugin.js +17 -4
  170. package/lib/plugins/LayerModelPlugin.js +113 -68
  171. package/lib/plugins/LayerStylePlugin.js +14 -4
  172. package/lib/plugins/LightingPlugin.js +25 -12
  173. package/lib/plugins/MultiPassRendererPlugin.js +22 -11
  174. package/lib/plugins/PixelPickingPlugin.js +27 -12
  175. package/lib/plugins/RegisterStyleAttributePlugin.js +19 -5
  176. package/lib/plugins/ShaderUniformPlugin.js +34 -13
  177. package/lib/plugins/UpdateModelPlugin.js +10 -1
  178. package/lib/plugins/UpdateStyleAttributePlugin.js +16 -5
  179. package/lib/point/index.js +83 -26
  180. package/lib/point/models/earthExtrude.js +113 -61
  181. package/lib/point/models/earthFill.js +117 -57
  182. package/lib/point/models/extrude.js +111 -60
  183. package/lib/point/models/fill.js +109 -68
  184. package/lib/point/models/fillmage.js +115 -61
  185. package/lib/point/models/image.js +98 -48
  186. package/lib/point/models/index.js +12 -1
  187. package/lib/point/models/normal.js +64 -30
  188. package/lib/point/models/radar.js +74 -40
  189. package/lib/point/models/simplePoint.js +79 -41
  190. package/lib/point/models/text.js +309 -198
  191. package/lib/point/shape/extrude.js +20 -4
  192. package/lib/polygon/index.js +48 -11
  193. package/lib/polygon/models/extrude.js +103 -48
  194. package/lib/polygon/models/fill.js +98 -54
  195. package/lib/polygon/models/index.js +14 -2
  196. package/lib/polygon/models/ocean.js +88 -42
  197. package/lib/polygon/models/water.js +82 -37
  198. package/lib/raster/buffers/triangulation.js +7 -3
  199. package/lib/raster/index.js +40 -9
  200. package/lib/raster/models/index.js +5 -0
  201. package/lib/raster/models/raster.js +125 -80
  202. package/lib/raster/models/rasterRgb.js +139 -84
  203. package/lib/raster/models/rasterTerrainRgb.js +93 -56
  204. package/lib/tile/interaction/getRasterData.js +25 -14
  205. package/lib/tile/interaction/utils.js +19 -7
  206. package/lib/tile/manager/base.js +104 -63
  207. package/lib/tile/service/TileLayerService.js +60 -33
  208. package/lib/tile/service/TilePickService.js +48 -26
  209. package/lib/tile/service/TileSourceService.js +16 -2
  210. package/lib/tile/style/utils.js +3 -0
  211. package/lib/tile/tileFactory/DebugTile.js +54 -29
  212. package/lib/tile/tileFactory/ImageTile.js +46 -20
  213. package/lib/tile/tileFactory/MaskTile.js +51 -22
  214. package/lib/tile/tileFactory/RasterRGBTile.js +50 -22
  215. package/lib/tile/tileFactory/RasterTerrainRGBTile.js +46 -20
  216. package/lib/tile/tileFactory/RasterTile.js +63 -30
  217. package/lib/tile/tileFactory/Tile.js +102 -63
  218. package/lib/tile/tileFactory/VectorTile.js +76 -41
  219. package/lib/tile/tileFactory/index.js +25 -0
  220. package/lib/tile/tileFactory/layers/TileDebugLayer.js +32 -6
  221. package/lib/tile/tileFactory/util.js +9 -0
  222. package/lib/tile/tileLayer/BaseLayer.js +153 -105
  223. package/lib/tile/utils.js +5 -1
  224. package/lib/utils/blend.js +5 -0
  225. package/lib/utils/collision-index.js +25 -9
  226. package/lib/utils/dataMappingStyle.js +19 -8
  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
@@ -8,86 +8,120 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
8
8
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
9
9
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
10
10
  import _regeneratorRuntime from "@babel/runtime/regenerator";
11
+
11
12
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
13
+
12
14
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
15
+
13
16
  import BaseModel from "../../core/BaseModel";
14
17
  import { CanvasUpdateType } from "../../core/interface";
18
+
15
19
  var CanvaModel = /*#__PURE__*/function (_BaseModel) {
16
20
  _inherits(CanvaModel, _BaseModel);
21
+
17
22
  var _super = _createSuper(CanvaModel);
23
+
18
24
  function CanvaModel() {
19
25
  var _this;
26
+
20
27
  _classCallCheck(this, CanvaModel);
28
+
21
29
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22
30
  args[_key] = arguments[_key];
23
31
  }
32
+
24
33
  _this = _super.call.apply(_super, [this].concat(args));
34
+
25
35
  _defineProperty(_assertThisInitialized(_this), "updateMode", CanvasUpdateType.ALWAYS);
36
+
26
37
  _defineProperty(_assertThisInitialized(_this), "renderUpdate", function () {
27
38
  var _ref = _this.layer.getLayerConfig(),
28
- _ref$zIndex = _ref.zIndex,
29
- zIndex = _ref$zIndex === void 0 ? 10 : _ref$zIndex,
30
- _ref$update = _ref.update,
31
- update = _ref$update === void 0 ? CanvasUpdateType.ALWAYS : _ref$update,
32
- _ref$animateOption = _ref.animateOption,
33
- animateOption = _ref$animateOption === void 0 ? {
34
- enable: false,
35
- duration: 20
36
- } : _ref$animateOption;
39
+ _ref$zIndex = _ref.zIndex,
40
+ zIndex = _ref$zIndex === void 0 ? 10 : _ref$zIndex,
41
+ _ref$update = _ref.update,
42
+ update = _ref$update === void 0 ? CanvasUpdateType.ALWAYS : _ref$update,
43
+ _ref$animateOption = _ref.animateOption,
44
+ animateOption = _ref$animateOption === void 0 ? {
45
+ enable: false,
46
+ duration: 20
47
+ } : _ref$animateOption;
48
+
37
49
  if (+_this.canvas.style.zIndex === zIndex) {
38
50
  _this.canvas.style.zIndex = zIndex + '';
39
51
  }
52
+
40
53
  if (_this.updateMode !== update) {
41
54
  _this.updateMode = update;
55
+
42
56
  _this.unBindListener();
57
+
43
58
  _this.bindListener();
44
59
  }
60
+
45
61
  if (_this.updateMode === CanvasUpdateType.ALWAYS && animateOption.enable) {
46
62
  _this.renderCanvas();
47
63
  }
48
64
  });
65
+
49
66
  _defineProperty(_assertThisInitialized(_this), "unBindListener", function () {
50
67
  _this.mapService.off('mapchange', _this.renderCanvas);
68
+
51
69
  _this.mapService.off('zoomstart', _this.clearCanvas);
70
+
52
71
  _this.mapService.off('zoomend', _this.renderCanvas);
72
+
53
73
  _this.mapService.off('movestart', _this.clearCanvas);
74
+
54
75
  _this.mapService.off('moveend', _this.renderCanvas);
55
76
  });
77
+
56
78
  _defineProperty(_assertThisInitialized(_this), "bindListener", function () {
57
79
  if (_this.updateMode === CanvasUpdateType.ALWAYS) {
58
80
  _this.mapService.on('mapchange', _this.renderCanvas);
59
81
  } else {
60
82
  _this.mapService.on('zoomstart', _this.clearCanvas);
83
+
61
84
  _this.mapService.on('zoomend', _this.renderCanvas);
85
+
62
86
  _this.mapService.on('movestart', _this.clearCanvas);
87
+
63
88
  _this.mapService.on('moveend', _this.renderCanvas);
64
89
  }
65
90
  });
91
+
66
92
  _defineProperty(_assertThisInitialized(_this), "clearCanvas", function () {
67
93
  if (_this.ctx) {
68
94
  var _this$rendererService = _this.rendererService.getViewportSize(),
69
- w = _this$rendererService.width,
70
- h = _this$rendererService.height;
95
+ w = _this$rendererService.width,
96
+ h = _this$rendererService.height;
97
+
71
98
  _this.ctx.clearRect(0, 0, w, h);
72
99
  }
73
100
  });
101
+
74
102
  _defineProperty(_assertThisInitialized(_this), "renderCanvas", function () {
75
103
  var _this$rendererService2 = _this.rendererService.getViewportSize(),
76
- viewWidth = _this$rendererService2.width,
77
- viewHeight = _this$rendererService2.height;
104
+ viewWidth = _this$rendererService2.width,
105
+ viewHeight = _this$rendererService2.height;
106
+
78
107
  if (_this.prevSize[0] !== viewWidth || _this.prevSize[1] !== viewHeight) {
79
108
  _this.prevSize = [viewWidth, viewHeight];
109
+
80
110
  var size = _this.mapService.getSize();
111
+
81
112
  var _size = _slicedToArray(size, 2),
82
- width = _size[0],
83
- height = _size[1];
113
+ width = _size[0],
114
+ height = _size[1];
115
+
84
116
  _this.canvas.width = viewWidth;
85
117
  _this.canvas.height = viewHeight;
86
118
  _this.canvas.style.width = width + 'px';
87
119
  _this.canvas.style.height = height + 'px';
88
120
  }
121
+
89
122
  var _ref2 = _this.layer.getLayerConfig(),
90
- drawingOnCanvas = _ref2.drawingOnCanvas;
123
+ drawingOnCanvas = _ref2.drawingOnCanvas;
124
+
91
125
  if (_this.ctx) {
92
126
  drawingOnCanvas({
93
127
  canvas: _this.canvas,
@@ -97,17 +131,21 @@ var CanvaModel = /*#__PURE__*/function (_BaseModel) {
97
131
  });
98
132
  }
99
133
  });
134
+
100
135
  return _this;
101
136
  }
137
+
102
138
  _createClass(CanvaModel, [{
103
139
  key: "clearModels",
104
140
  value: function clearModels() {
105
141
  if (this.canvas) {
106
142
  var _this$mapService$getC;
107
- (_this$mapService$getC = this.mapService.getContainer()) === null || _this$mapService$getC === void 0 ? void 0 : _this$mapService$getC.removeChild(this.canvas);
108
- // @ts-ignore
143
+
144
+ (_this$mapService$getC = this.mapService.getContainer()) === null || _this$mapService$getC === void 0 ? void 0 : _this$mapService$getC.removeChild(this.canvas); // @ts-ignore
145
+
109
146
  this.canvas = null;
110
147
  }
148
+
111
149
  this.unBindListener();
112
150
  }
113
151
  }, {
@@ -115,40 +153,51 @@ var CanvaModel = /*#__PURE__*/function (_BaseModel) {
115
153
  value: function () {
116
154
  var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
117
155
  var _ref3, _ref3$update, update;
156
+
118
157
  return _regeneratorRuntime.wrap(function _callee$(_context) {
119
- while (1) switch (_context.prev = _context.next) {
120
- case 0:
121
- _ref3 = this.layer.getLayerConfig(), _ref3$update = _ref3.update, update = _ref3$update === void 0 ? CanvasUpdateType.ALWAYS : _ref3$update;
122
- this.updateMode = update;
123
- this.initCanvas();
124
- this.renderCanvas();
125
- this.bindListener();
126
- this.mapService.getContainer();
127
- return _context.abrupt("return", []);
128
- case 7:
129
- case "end":
130
- return _context.stop();
158
+ while (1) {
159
+ switch (_context.prev = _context.next) {
160
+ case 0:
161
+ _ref3 = this.layer.getLayerConfig(), _ref3$update = _ref3.update, update = _ref3$update === void 0 ? CanvasUpdateType.ALWAYS : _ref3$update;
162
+ this.updateMode = update;
163
+ this.initCanvas();
164
+ this.renderCanvas();
165
+ this.bindListener();
166
+ this.mapService.getContainer();
167
+ return _context.abrupt("return", []);
168
+
169
+ case 7:
170
+ case "end":
171
+ return _context.stop();
172
+ }
131
173
  }
132
174
  }, _callee, this);
133
175
  }));
176
+
134
177
  function initModels() {
135
178
  return _initModels.apply(this, arguments);
136
179
  }
180
+
137
181
  return initModels;
138
182
  }()
139
183
  }, {
140
184
  key: "initCanvas",
141
185
  value: function initCanvas() {
142
186
  var _this$mapService$getC2;
187
+
143
188
  var _ref4 = this.layer.getLayerConfig(),
144
- zIndex = _ref4.zIndex;
189
+ zIndex = _ref4.zIndex;
190
+
145
191
  var size = this.mapService.getSize();
192
+
146
193
  var _size2 = _slicedToArray(size, 2),
147
- width = _size2[0],
148
- height = _size2[1];
194
+ width = _size2[0],
195
+ height = _size2[1];
196
+
149
197
  var _this$rendererService3 = this.rendererService.getViewportSize(),
150
- viewWidth = _this$rendererService3.width,
151
- viewHeight = _this$rendererService3.height;
198
+ viewWidth = _this$rendererService3.width,
199
+ viewHeight = _this$rendererService3.height;
200
+
152
201
  this.prevSize = [viewWidth, viewHeight];
153
202
  var canvas = document.createElement('canvas');
154
203
  this.canvas = canvas;
@@ -170,18 +219,23 @@ var CanvaModel = /*#__PURE__*/function (_BaseModel) {
170
219
  value: function () {
171
220
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
172
221
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
173
- while (1) switch (_context2.prev = _context2.next) {
174
- case 0:
175
- return _context2.abrupt("return", this.initModels());
176
- case 1:
177
- case "end":
178
- return _context2.stop();
222
+ while (1) {
223
+ switch (_context2.prev = _context2.next) {
224
+ case 0:
225
+ return _context2.abrupt("return", this.initModels());
226
+
227
+ case 1:
228
+ case "end":
229
+ return _context2.stop();
230
+ }
179
231
  }
180
232
  }, _callee2, this);
181
233
  }));
234
+
182
235
  function buildModels() {
183
236
  return _buildModels.apply(this, arguments);
184
237
  }
238
+
185
239
  return buildModels;
186
240
  }()
187
241
  }, {
@@ -190,6 +244,8 @@ var CanvaModel = /*#__PURE__*/function (_BaseModel) {
190
244
  return;
191
245
  }
192
246
  }]);
247
+
193
248
  return CanvaModel;
194
249
  }(BaseModel);
250
+
195
251
  export { CanvaModel as default };
@@ -7,42 +7,59 @@ 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 CityBuildModel from "./models/build";
17
+
14
18
  var CityBuildingLayer = /*#__PURE__*/function (_BaseLayer) {
15
19
  _inherits(CityBuildingLayer, _BaseLayer);
20
+
16
21
  var _super = _createSuper(CityBuildingLayer);
22
+
17
23
  function CityBuildingLayer() {
18
24
  var _this;
25
+
19
26
  _classCallCheck(this, CityBuildingLayer);
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", 'CityBuildingLayer');
35
+
25
36
  return _this;
26
37
  }
38
+
27
39
  _createClass(CityBuildingLayer, [{
28
40
  key: "buildModels",
29
41
  value: function () {
30
42
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
31
43
  return _regeneratorRuntime.wrap(function _callee$(_context) {
32
- while (1) switch (_context.prev = _context.next) {
33
- case 0:
34
- this.layerModel = new CityBuildModel(this);
35
- _context.next = 3;
36
- return this.initLayerModels();
37
- case 3:
38
- case "end":
39
- return _context.stop();
44
+ while (1) {
45
+ switch (_context.prev = _context.next) {
46
+ case 0:
47
+ this.layerModel = new CityBuildModel(this);
48
+ _context.next = 3;
49
+ return this.initLayerModels();
50
+
51
+ case 3:
52
+ case "end":
53
+ return _context.stop();
54
+ }
40
55
  }
41
56
  }, _callee, this);
42
57
  }));
58
+
43
59
  function buildModels() {
44
60
  return _buildModels.apply(this, arguments);
45
61
  }
62
+
46
63
  return buildModels;
47
64
  }()
48
65
  }, {
@@ -58,6 +75,8 @@ var CityBuildingLayer = /*#__PURE__*/function (_BaseLayer) {
58
75
  return 'citybuilding';
59
76
  }
60
77
  }]);
78
+
61
79
  return CityBuildingLayer;
62
80
  }(BaseLayer);
81
+
63
82
  export { CityBuildingLayer as default };
@@ -6,45 +6,56 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
6
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
7
7
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
8
  import _regeneratorRuntime from "@babel/runtime/regenerator";
9
+
9
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
+
10
12
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
+
11
14
  import { AttributeType, gl } from '@antv/l7-core';
12
15
  import { rgb2arr } from '@antv/l7-utils';
13
16
  import BaseModel from "../../core/BaseModel";
14
17
  import { PolygonExtrudeTriangulation } from "../../core/triangulation";
18
+
15
19
  /* babel-plugin-inline-import '../shaders/build_frag.glsl' */
16
20
  var buildFrag = "uniform float u_opacity: 1.0;\nuniform vec4 u_baseColor : [ 1.0, 0, 0, 1.0 ];\nuniform vec4 u_brightColor : [ 1.0, 0, 0, 1.0 ];\nuniform vec4 u_windowColor : [ 1.0, 0, 0, 1.0 ];\nuniform float u_near : 0;\nuniform float u_far : 1;\nvarying vec4 v_Color;\nvarying vec2 v_texCoord;\nuniform float u_Zoom : 1;\nuniform float u_time;\n\nuniform float u_circleSweep;\nuniform float u_cityMinSize;\nuniform vec3 u_circleSweepColor;\nuniform float u_circleSweepSpeed;\n\nvarying float v_worldDis;\n\n#pragma include \"picking\"\n\nvec3 getWindowColor(float n, float hot, vec3 brightColor, vec3 darkColor) {\n float s = step(hot, n);\n vec3 color = mix(brightColor,vec3(0.9,0.9,1.0),n);\n\n return mix(darkColor, color, s);\n}\nfloat random (vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233)))* 43758.5453123);\n}\n\nfloat LinearizeDepth()\n{\n float z = gl_FragCoord.z * 2.0 - 1.0;\n return (2.0 * u_near * u_far) / (u_far + u_near - z * (u_far - u_near));\n}\n\nvec3 fog(vec3 color, vec3 fogColor, float depth){\n float fogFactor=clamp(depth,0.0,1.0);\n vec3 output_color=mix(fogColor,color,fogFactor);\n return output_color;\n}\n\nfloat sdRect(vec2 p, vec2 sz) {\n vec2 d = abs(p) - sz;\n float outside = length(max(d, 0.));\n float inside = min(max(d.x, d.y), 0.);\n return outside + inside;\n}\n\nvoid main() {\n gl_FragColor = v_Color;\n vec3 baseColor = u_baseColor.xyz;\n vec3 brightColor = u_brightColor.xyz;\n vec3 windowColor = u_windowColor.xyz;\n float targetColId = 5.;\n float depth = 1.0 - LinearizeDepth() / u_far * u_Zoom;\n vec3 fogColor = vec3(23.0/255.0,31.0/255.0,51.0/255.0);\n if(v_texCoord.x < 0.) { //\u9876\u90E8\u989C\u8272\n vec3 foggedColor = fog(baseColor.xyz + vec3(0.12*0.9,0.2*0.9,0.3*0.9),fogColor,depth);\n gl_FragColor = vec4( foggedColor, v_Color.w);\n }else { // \u4FA7\u9762\u989C\u8272\n vec2 st = v_texCoord;\n vec2 UvScale = v_texCoord;\n float tStep = min(0.08,max(0.05* (18.0-u_Zoom),0.02));\n float tStart = 0.25 * tStep;\n float tEnd = 0.75 * tStep;\n float u = mod(UvScale.x, tStep);\n float v = mod(UvScale.y, tStep);\n float ux = floor(UvScale.x/tStep);\n float uy = floor(UvScale.y/tStep);\n float n = random(vec2(ux,uy));\n float lightP = u_time;\n float head = 1.0- step(0.005,st.y);\n /*step3*/\n // \u5C06\u7A97\u6237\u989C\u8272\u548C\u5899\u9762\u989C\u8272\u533A\u522B\u5F00\u6765\n float sU = step(tStart, u) - step(tEnd, u);\n float sV = step(tStart, v) - step(tEnd, v);\n vec2 windowSize = vec2(abs(tEnd-tStart),abs(tEnd-tStart));\n float dist = sdRect(vec2(u,v), windowSize);\n float s = sU * sV;\n\n float curColId = floor(UvScale.x / tStep);\n float sCol = step(targetColId - 0.2, curColId) - step(targetColId + 0.2, curColId);\n\n float mLightP = mod(lightP, 2.);\n float sRow = step(mLightP - 0.2, st.y) - step(mLightP, st.y);\n if(ux == targetColId){\n n =0.;\n }\n float timeP = min(0.75, abs ( sin(u_time/3.0) ) );\n float hot = smoothstep(1.0,0.0,timeP);\n vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), s);\n //vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), 1.0);\n float sFinal = s * sCol * sRow;\n color += mix(baseColor, brightColor, sFinal*n);\n if (st.y<0.01){\n color = baseColor;\n }\n if(head ==1.0) { // \u9876\u90E8\u4EAE\u7EBF\n color = brightColor;\n }\n color = color * v_Color.rgb;\n\n vec3 foggedColor = fog(color,fogColor,depth);\n\n gl_FragColor = vec4(foggedColor,1.0);\n }\n\n\n if(u_circleSweep > 0.0 && v_worldDis < u_cityMinSize) {\n float r = fract(((v_worldDis/u_cityMinSize) - u_time * u_circleSweepSpeed) * 2.0);\n gl_FragColor.rgb += r * r * u_circleSweepColor;\n }\n \n gl_FragColor.a *= u_opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
21
+
17
22
  /* babel-plugin-inline-import '../shaders/build_vert.glsl' */
18
23
  var buildVert = "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;\nuniform mat4 u_ModelMatrix;\n\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n\nvarying vec4 v_Color;\nuniform mat4 u_Mvp;\n\nuniform float u_circleSweep;\nuniform vec2 u_cityCenter;\n\nvarying float v_worldDis;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n v_texCoord = a_Uv;\n\n if(u_circleSweep > 0.0) {\n vec2 lnglatscale = vec2(0.0);\n if(u_CoordinateSystem != COORDINATE_SYSTEM_P20_2) {\n lnglatscale = (a_Position.xy - u_cityCenter) * vec2(0.0, 0.135);\n }\n v_worldDis = length(a_Position.xy + lnglatscale - u_cityCenter);\n }\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\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_Color = a_Color;\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n setPickingColor(a_PickingColor);\n}\n";
24
+
19
25
  var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
20
26
  _inherits(CityBuildModel, _BaseModel);
27
+
21
28
  var _super = _createSuper(CityBuildModel);
29
+
22
30
  function CityBuildModel() {
23
31
  _classCallCheck(this, CityBuildModel);
32
+
24
33
  return _super.apply(this, arguments);
25
34
  }
35
+
26
36
  _createClass(CityBuildModel, [{
27
37
  key: "getUninforms",
28
38
  value: function getUninforms() {
29
39
  var _ref = this.layer.getLayerConfig(),
30
- _ref$opacity = _ref.opacity,
31
- opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
32
- _ref$baseColor = _ref.baseColor,
33
- baseColor = _ref$baseColor === void 0 ? 'rgb(16,16,16)' : _ref$baseColor,
34
- _ref$brightColor = _ref.brightColor,
35
- brightColor = _ref$brightColor === void 0 ? 'rgb(255,176,38)' : _ref$brightColor,
36
- _ref$windowColor = _ref.windowColor,
37
- windowColor = _ref$windowColor === void 0 ? 'rgb(30,60,89)' : _ref$windowColor,
38
- _ref$time = _ref.time,
39
- time = _ref$time === void 0 ? 0 : _ref$time,
40
- _ref$sweep = _ref.sweep,
41
- sweep = _ref$sweep === void 0 ? {
42
- enable: false,
43
- sweepRadius: 1,
44
- sweepColor: 'rgb(255, 255, 255)',
45
- sweepSpeed: 0.4,
46
- sweepCenter: this.cityCenter
47
- } : _ref$sweep;
40
+ _ref$opacity = _ref.opacity,
41
+ opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
42
+ _ref$baseColor = _ref.baseColor,
43
+ baseColor = _ref$baseColor === void 0 ? 'rgb(16,16,16)' : _ref$baseColor,
44
+ _ref$brightColor = _ref.brightColor,
45
+ brightColor = _ref$brightColor === void 0 ? 'rgb(255,176,38)' : _ref$brightColor,
46
+ _ref$windowColor = _ref.windowColor,
47
+ windowColor = _ref$windowColor === void 0 ? 'rgb(30,60,89)' : _ref$windowColor,
48
+ _ref$time = _ref.time,
49
+ time = _ref$time === void 0 ? 0 : _ref$time,
50
+ _ref$sweep = _ref.sweep,
51
+ sweep = _ref$sweep === void 0 ? {
52
+ enable: false,
53
+ sweepRadius: 1,
54
+ sweepColor: 'rgb(255, 255, 255)',
55
+ sweepSpeed: 0.4,
56
+ sweepCenter: this.cityCenter
57
+ } : _ref$sweep;
58
+
48
59
  return {
49
60
  u_cityCenter: sweep.sweepCenter || this.cityCenter,
50
61
  u_cityMinSize: this.cityMinSize * sweep.sweepRadius,
@@ -63,16 +74,17 @@ var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
63
74
  value: function calCityGeo() {
64
75
  // @ts-ignore
65
76
  var _this$layer$getSource = _slicedToArray(this.layer.getSource().extent, 4),
66
- minLng = _this$layer$getSource[0],
67
- minLat = _this$layer$getSource[1],
68
- maxLng = _this$layer$getSource[2],
69
- maxLat = _this$layer$getSource[3];
77
+ minLng = _this$layer$getSource[0],
78
+ minLat = _this$layer$getSource[1],
79
+ maxLng = _this$layer$getSource[2],
80
+ maxLat = _this$layer$getSource[3];
81
+
70
82
  if (this.mapService.version === 'GAODE2.x') {
71
83
  // @ts-ignore
72
- this.cityCenter = this.mapService.lngLatToCoord([(maxLng + minLng) / 2, (maxLat + minLat) / 2]);
73
- // @ts-ignore
74
- var l1 = this.mapService.lngLatToCoord([maxLng, maxLat]);
75
- // @ts-ignore
84
+ this.cityCenter = this.mapService.lngLatToCoord([(maxLng + minLng) / 2, (maxLat + minLat) / 2]); // @ts-ignore
85
+
86
+ var l1 = this.mapService.lngLatToCoord([maxLng, maxLat]); // @ts-ignore
87
+
76
88
  var l2 = this.mapService.lngLatToCoord([minLng, minLat]);
77
89
  this.cityMinSize = Math.sqrt(Math.pow(l1[0] - l2[0], 2) + Math.pow(l1[1] - l2[1], 2)) / 4;
78
90
  } else {
@@ -87,20 +99,25 @@ var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
87
99
  value: function () {
88
100
  var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
89
101
  return _regeneratorRuntime.wrap(function _callee$(_context) {
90
- while (1) switch (_context.prev = _context.next) {
91
- case 0:
92
- this.calCityGeo();
93
- this.startModelAnimate();
94
- return _context.abrupt("return", this.buildModels());
95
- case 3:
96
- case "end":
97
- return _context.stop();
102
+ while (1) {
103
+ switch (_context.prev = _context.next) {
104
+ case 0:
105
+ this.calCityGeo();
106
+ this.startModelAnimate();
107
+ return _context.abrupt("return", this.buildModels());
108
+
109
+ case 3:
110
+ case "end":
111
+ return _context.stop();
112
+ }
98
113
  }
99
114
  }, _callee, this);
100
115
  }));
116
+
101
117
  function initModels() {
102
118
  return _initModels.apply(this, arguments);
103
119
  }
120
+
104
121
  return initModels;
105
122
  }()
106
123
  }, {
@@ -109,34 +126,40 @@ var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
109
126
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
110
127
  var model;
111
128
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
112
- while (1) switch (_context2.prev = _context2.next) {
113
- case 0:
114
- _context2.next = 2;
115
- return this.layer.buildLayerModel({
116
- moduleName: 'cityBuilding',
117
- vertexShader: buildVert,
118
- fragmentShader: buildFrag,
119
- triangulation: PolygonExtrudeTriangulation,
120
- depth: {
121
- enable: true
122
- },
123
- cull: {
124
- enable: true,
125
- face: gl.BACK
126
- }
127
- });
128
- case 2:
129
- model = _context2.sent;
130
- return _context2.abrupt("return", [model]);
131
- case 4:
132
- case "end":
133
- return _context2.stop();
129
+ while (1) {
130
+ switch (_context2.prev = _context2.next) {
131
+ case 0:
132
+ _context2.next = 2;
133
+ return this.layer.buildLayerModel({
134
+ moduleName: 'cityBuilding',
135
+ vertexShader: buildVert,
136
+ fragmentShader: buildFrag,
137
+ triangulation: PolygonExtrudeTriangulation,
138
+ depth: {
139
+ enable: true
140
+ },
141
+ cull: {
142
+ enable: true,
143
+ face: gl.BACK
144
+ }
145
+ });
146
+
147
+ case 2:
148
+ model = _context2.sent;
149
+ return _context2.abrupt("return", [model]);
150
+
151
+ case 4:
152
+ case "end":
153
+ return _context2.stop();
154
+ }
134
155
  }
135
156
  }, _callee2, this);
136
157
  }));
158
+
137
159
  function buildModels() {
138
160
  return _buildModels.apply(this, arguments);
139
161
  }
162
+
140
163
  return buildModels;
141
164
  }()
142
165
  }, {
@@ -174,7 +197,7 @@ var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
174
197
  size: 1,
175
198
  update: function update(feature) {
176
199
  var _feature$size = feature.size,
177
- size = _feature$size === void 0 ? 10 : _feature$size;
200
+ size = _feature$size === void 0 ? 10 : _feature$size;
178
201
  return Array.isArray(size) ? [size[0]] : [size];
179
202
  }
180
203
  }
@@ -198,6 +221,8 @@ var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
198
221
  });
199
222
  }
200
223
  }]);
224
+
201
225
  return CityBuildModel;
202
226
  }(BaseModel);
227
+
203
228
  export { CityBuildModel as default };