@antv/l7-layers 2.15.1 → 2.15.3

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 (243) hide show
  1. package/es/Geometry/index.js +9 -31
  2. package/es/Geometry/models/billboard.js +51 -89
  3. package/es/Geometry/models/plane.js +81 -143
  4. package/es/Geometry/models/sprite.js +60 -118
  5. package/es/canvas/index.js +10 -33
  6. package/es/canvas/models/canvas.js +41 -97
  7. package/es/citybuliding/building.js +8 -27
  8. package/es/citybuliding/models/build.js +57 -82
  9. package/es/core/BaseLayer.js +320 -484
  10. package/es/core/BaseModel.js +97 -126
  11. package/es/core/LayerPickService.js +21 -32
  12. package/es/core/TextureService.js +0 -13
  13. package/es/core/interface.js +17 -24
  14. package/es/core/shape/Path.js +13 -20
  15. package/es/core/shape/extrude.js +10 -31
  16. package/es/core/triangulation.js +54 -114
  17. package/es/earth/index.js +9 -33
  18. package/es/earth/models/atmosphere.js +30 -54
  19. package/es/earth/models/base.js +47 -85
  20. package/es/earth/models/bloomsphere.js +30 -54
  21. package/es/earth/utils.js +9 -13
  22. package/es/heatmap/index.js +10 -40
  23. package/es/heatmap/models/grid.js +28 -52
  24. package/es/heatmap/models/grid3d.js +28 -52
  25. package/es/heatmap/models/heatmap.js +91 -146
  26. package/es/heatmap/models/hexagon.js +28 -52
  27. package/es/heatmap/triangulation.js +0 -4
  28. package/es/image/index.js +9 -28
  29. package/es/image/models/image.js +66 -100
  30. package/es/index.js +9 -17
  31. package/es/line/index.js +9 -34
  32. package/es/line/models/arc.js +66 -118
  33. package/es/line/models/arc_3d.js +60 -108
  34. package/es/line/models/earthArc_3d.js +63 -111
  35. package/es/line/models/great_circle.js +56 -100
  36. package/es/line/models/half.js +46 -77
  37. package/es/line/models/line.js +94 -148
  38. package/es/line/models/linearline.js +45 -80
  39. package/es/line/models/simpleLine.js +41 -74
  40. package/es/line/models/wall.js +52 -92
  41. package/es/mask/index.js +9 -28
  42. package/es/mask/models/fill.js +29 -54
  43. package/es/plugins/DataMappingPlugin.js +80 -117
  44. package/es/plugins/DataSourcePlugin.js +45 -68
  45. package/es/plugins/FeatureScalePlugin.js +67 -122
  46. package/es/plugins/LayerAnimateStylePlugin.js +0 -5
  47. package/es/plugins/LayerMaskPlugin.js +3 -11
  48. package/es/plugins/LayerModelPlugin.js +67 -104
  49. package/es/plugins/LayerStylePlugin.js +3 -9
  50. package/es/plugins/LightingPlugin.js +12 -18
  51. package/es/plugins/MultiPassRendererPlugin.js +11 -16
  52. package/es/plugins/PixelPickingPlugin.js +12 -21
  53. package/es/plugins/RegisterStyleAttributePlugin.js +5 -12
  54. package/es/plugins/ShaderUniformPlugin.js +13 -27
  55. package/es/plugins/UpdateModelPlugin.js +0 -5
  56. package/es/plugins/UpdateStyleAttributePlugin.js +5 -11
  57. package/es/point/index.js +26 -77
  58. package/es/point/models/earthExtrude.js +61 -102
  59. package/es/point/models/earthFill.js +57 -87
  60. package/es/point/models/extrude.js +60 -101
  61. package/es/point/models/fill.js +70 -100
  62. package/es/point/models/fillmage.js +63 -107
  63. package/es/point/models/image.js +48 -88
  64. package/es/point/models/index.js +2 -2
  65. package/es/point/models/normal.js +30 -54
  66. package/es/point/models/radar.js +40 -64
  67. package/es/point/models/simplePoint.js +41 -69
  68. package/es/point/models/text.d.ts +2 -0
  69. package/es/point/models/text.js +214 -295
  70. package/es/point/shape/extrude.js +4 -13
  71. package/es/polygon/index.js +11 -40
  72. package/es/polygon/models/extrude.js +48 -92
  73. package/es/polygon/models/fill.js +54 -88
  74. package/es/polygon/models/index.js +3 -2
  75. package/es/polygon/models/ocean.js +42 -76
  76. package/es/polygon/models/water.js +37 -71
  77. package/es/raster/buffers/triangulation.js +2 -4
  78. package/es/raster/index.js +9 -32
  79. package/es/raster/models/raster.js +80 -116
  80. package/es/raster/models/rasterRgb.js +84 -127
  81. package/es/raster/models/rasterTerrainRgb.js +56 -84
  82. package/es/tile/interaction/getRasterData.js +14 -20
  83. package/es/tile/interaction/utils.js +7 -9
  84. package/es/tile/manager/base.js +63 -96
  85. package/es/tile/service/TileLayerService.js +30 -52
  86. package/es/tile/service/TilePickService.js +26 -40
  87. package/es/tile/service/TileSourceService.js +3 -7
  88. package/es/tile/tileFactory/DebugTile.js +28 -45
  89. package/es/tile/tileFactory/ImageTile.js +20 -38
  90. package/es/tile/tileFactory/MaskTile.js +22 -43
  91. package/es/tile/tileFactory/RasterRGBTile.js +22 -42
  92. package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
  93. package/es/tile/tileFactory/RasterTile.js +30 -53
  94. package/es/tile/tileFactory/Tile.js +63 -97
  95. package/es/tile/tileFactory/VectorTile.js +41 -68
  96. package/es/tile/tileFactory/index.js +0 -11
  97. package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
  98. package/es/tile/tileFactory/util.js +0 -3
  99. package/es/tile/tileLayer/BaseLayer.js +105 -146
  100. package/es/tile/utils.js +1 -1
  101. package/es/utils/blend.js +0 -2
  102. package/es/utils/collision-index.js +9 -16
  103. package/es/utils/dataMappingStyle.js +8 -18
  104. package/es/utils/extrude_polyline.js +101 -149
  105. package/es/utils/grid-index.js +2 -27
  106. package/es/utils/identityScale.js +0 -8
  107. package/es/utils/layerData.js +30 -44
  108. package/es/utils/multiPassRender.js +11 -13
  109. package/es/utils/polylineNormal.js +31 -37
  110. package/es/utils/simpleLine.js +2 -16
  111. package/es/utils/stencil.js +2 -3
  112. package/es/utils/symbol-layout.js +27 -53
  113. package/es/wind/index.js +9 -29
  114. package/es/wind/models/utils.js +26 -51
  115. package/es/wind/models/wind.js +101 -147
  116. package/es/wind/models/windRender.js +53 -66
  117. package/lib/Geometry/index.js +9 -38
  118. package/lib/Geometry/models/billboard.js +51 -97
  119. package/lib/Geometry/models/index.js +0 -5
  120. package/lib/Geometry/models/plane.js +79 -151
  121. package/lib/Geometry/models/sprite.js +60 -127
  122. package/lib/canvas/index.js +10 -40
  123. package/lib/canvas/models/canvas.js +41 -101
  124. package/lib/canvas/models/index.js +0 -3
  125. package/lib/citybuliding/building.js +8 -35
  126. package/lib/citybuliding/models/build.js +57 -92
  127. package/lib/core/BaseLayer.js +320 -478
  128. package/lib/core/BaseModel.js +97 -139
  129. package/lib/core/LayerPickService.js +21 -37
  130. package/lib/core/TextureService.js +0 -16
  131. package/lib/core/interface.js +21 -31
  132. package/lib/core/schema.js +0 -1
  133. package/lib/core/shape/Path.js +14 -31
  134. package/lib/core/shape/extrude.js +10 -54
  135. package/lib/core/triangulation.js +53 -153
  136. package/lib/earth/index.js +9 -43
  137. package/lib/earth/models/atmosphere.js +30 -63
  138. package/lib/earth/models/base.js +47 -90
  139. package/lib/earth/models/bloomsphere.js +30 -63
  140. package/lib/earth/utils.js +7 -31
  141. package/lib/heatmap/index.js +10 -48
  142. package/lib/heatmap/models/grid.js +28 -60
  143. package/lib/heatmap/models/grid3d.js +28 -60
  144. package/lib/heatmap/models/heatmap.js +91 -162
  145. package/lib/heatmap/models/hexagon.js +28 -60
  146. package/lib/heatmap/models/index.js +0 -6
  147. package/lib/heatmap/triangulation.js +0 -5
  148. package/lib/image/index.js +9 -36
  149. package/lib/image/models/image.js +66 -109
  150. package/lib/image/models/index.js +0 -3
  151. package/lib/index.js +7 -61
  152. package/lib/line/index.js +9 -40
  153. package/lib/line/models/arc.js +64 -128
  154. package/lib/line/models/arc_3d.js +58 -119
  155. package/lib/line/models/earthArc_3d.js +61 -122
  156. package/lib/line/models/great_circle.js +56 -111
  157. package/lib/line/models/half.js +46 -87
  158. package/lib/line/models/index.js +0 -11
  159. package/lib/line/models/line.js +92 -156
  160. package/lib/line/models/linearline.js +45 -92
  161. package/lib/line/models/simpleLine.js +41 -84
  162. package/lib/line/models/wall.js +52 -103
  163. package/lib/mask/index.js +9 -36
  164. package/lib/mask/models/fill.js +29 -63
  165. package/lib/mask/models/index.js +0 -3
  166. package/lib/plugins/DataMappingPlugin.js +80 -128
  167. package/lib/plugins/DataSourcePlugin.js +45 -76
  168. package/lib/plugins/FeatureScalePlugin.js +67 -138
  169. package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
  170. package/lib/plugins/LayerMaskPlugin.js +4 -17
  171. package/lib/plugins/LayerModelPlugin.js +68 -113
  172. package/lib/plugins/LayerStylePlugin.js +4 -14
  173. package/lib/plugins/LightingPlugin.js +12 -25
  174. package/lib/plugins/MultiPassRendererPlugin.js +11 -22
  175. package/lib/plugins/PixelPickingPlugin.js +12 -27
  176. package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
  177. package/lib/plugins/ShaderUniformPlugin.js +13 -34
  178. package/lib/plugins/UpdateModelPlugin.js +1 -10
  179. package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
  180. package/lib/point/index.js +26 -83
  181. package/lib/point/models/earthExtrude.js +61 -113
  182. package/lib/point/models/earthFill.js +57 -117
  183. package/lib/point/models/extrude.js +60 -111
  184. package/lib/point/models/fill.js +68 -109
  185. package/lib/point/models/fillmage.js +61 -115
  186. package/lib/point/models/image.js +48 -98
  187. package/lib/point/models/index.js +1 -12
  188. package/lib/point/models/normal.js +30 -64
  189. package/lib/point/models/radar.js +40 -74
  190. package/lib/point/models/simplePoint.js +41 -79
  191. package/lib/point/models/text.js +214 -303
  192. package/lib/point/shape/extrude.js +4 -20
  193. package/lib/polygon/index.js +11 -48
  194. package/lib/polygon/models/extrude.js +48 -103
  195. package/lib/polygon/models/fill.js +54 -98
  196. package/lib/polygon/models/index.js +2 -14
  197. package/lib/polygon/models/ocean.js +42 -88
  198. package/lib/polygon/models/water.js +37 -82
  199. package/lib/raster/buffers/triangulation.js +3 -7
  200. package/lib/raster/index.js +9 -40
  201. package/lib/raster/models/index.js +0 -5
  202. package/lib/raster/models/raster.js +80 -125
  203. package/lib/raster/models/rasterRgb.js +84 -139
  204. package/lib/raster/models/rasterTerrainRgb.js +56 -93
  205. package/lib/tile/interaction/getRasterData.js +14 -25
  206. package/lib/tile/interaction/utils.js +7 -19
  207. package/lib/tile/manager/base.js +63 -104
  208. package/lib/tile/service/TileLayerService.js +30 -57
  209. package/lib/tile/service/TilePickService.js +26 -48
  210. package/lib/tile/service/TileSourceService.js +2 -16
  211. package/lib/tile/style/utils.js +0 -3
  212. package/lib/tile/tileFactory/DebugTile.js +28 -53
  213. package/lib/tile/tileFactory/ImageTile.js +20 -46
  214. package/lib/tile/tileFactory/MaskTile.js +22 -51
  215. package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
  216. package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
  217. package/lib/tile/tileFactory/RasterTile.js +30 -63
  218. package/lib/tile/tileFactory/Tile.js +63 -102
  219. package/lib/tile/tileFactory/VectorTile.js +41 -76
  220. package/lib/tile/tileFactory/index.js +0 -25
  221. package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
  222. package/lib/tile/tileFactory/util.js +0 -9
  223. package/lib/tile/tileLayer/BaseLayer.js +105 -153
  224. package/lib/tile/utils.js +1 -5
  225. package/lib/utils/blend.js +0 -5
  226. package/lib/utils/collision-index.js +9 -25
  227. package/lib/utils/dataMappingStyle.js +8 -19
  228. package/lib/utils/extrude_polyline.js +101 -181
  229. package/lib/utils/grid-index.js +2 -28
  230. package/lib/utils/identityScale.js +0 -9
  231. package/lib/utils/layerData.js +30 -49
  232. package/lib/utils/multiPassRender.js +11 -16
  233. package/lib/utils/polylineNormal.js +31 -66
  234. package/lib/utils/simpleLine.js +2 -21
  235. package/lib/utils/stencil.js +0 -4
  236. package/lib/utils/symbol-layout.js +27 -55
  237. package/lib/wind/index.js +9 -37
  238. package/lib/wind/models/index.js +0 -3
  239. package/lib/wind/models/utils.js +26 -62
  240. package/lib/wind/models/wind.js +101 -157
  241. package/lib/wind/models/windRender.js +53 -71
  242. package/lib/wind/models/windShader.js +0 -1
  243. package/package.json +7 -7
@@ -8,120 +8,86 @@ 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
-
12
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); }; }
13
-
14
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; } }
15
-
16
13
  import BaseModel from "../../core/BaseModel";
17
14
  import { CanvasUpdateType } from "../../core/interface";
18
-
19
15
  var CanvaModel = /*#__PURE__*/function (_BaseModel) {
20
16
  _inherits(CanvaModel, _BaseModel);
21
-
22
17
  var _super = _createSuper(CanvaModel);
23
-
24
18
  function CanvaModel() {
25
19
  var _this;
26
-
27
20
  _classCallCheck(this, CanvaModel);
28
-
29
21
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
30
22
  args[_key] = arguments[_key];
31
23
  }
32
-
33
24
  _this = _super.call.apply(_super, [this].concat(args));
34
-
35
25
  _defineProperty(_assertThisInitialized(_this), "updateMode", CanvasUpdateType.ALWAYS);
36
-
37
26
  _defineProperty(_assertThisInitialized(_this), "renderUpdate", function () {
38
27
  var _ref = _this.layer.getLayerConfig(),
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
-
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;
49
37
  if (+_this.canvas.style.zIndex === zIndex) {
50
38
  _this.canvas.style.zIndex = zIndex + '';
51
39
  }
52
-
53
40
  if (_this.updateMode !== update) {
54
41
  _this.updateMode = update;
55
-
56
42
  _this.unBindListener();
57
-
58
43
  _this.bindListener();
59
44
  }
60
-
61
45
  if (_this.updateMode === CanvasUpdateType.ALWAYS && animateOption.enable) {
62
46
  _this.renderCanvas();
63
47
  }
64
48
  });
65
-
66
49
  _defineProperty(_assertThisInitialized(_this), "unBindListener", function () {
67
50
  _this.mapService.off('mapchange', _this.renderCanvas);
68
-
69
51
  _this.mapService.off('zoomstart', _this.clearCanvas);
70
-
71
52
  _this.mapService.off('zoomend', _this.renderCanvas);
72
-
73
53
  _this.mapService.off('movestart', _this.clearCanvas);
74
-
75
54
  _this.mapService.off('moveend', _this.renderCanvas);
76
55
  });
77
-
78
56
  _defineProperty(_assertThisInitialized(_this), "bindListener", function () {
79
57
  if (_this.updateMode === CanvasUpdateType.ALWAYS) {
80
58
  _this.mapService.on('mapchange', _this.renderCanvas);
81
59
  } else {
82
60
  _this.mapService.on('zoomstart', _this.clearCanvas);
83
-
84
61
  _this.mapService.on('zoomend', _this.renderCanvas);
85
-
86
62
  _this.mapService.on('movestart', _this.clearCanvas);
87
-
88
63
  _this.mapService.on('moveend', _this.renderCanvas);
89
64
  }
90
65
  });
91
-
92
66
  _defineProperty(_assertThisInitialized(_this), "clearCanvas", function () {
93
67
  if (_this.ctx) {
94
68
  var _this$rendererService = _this.rendererService.getViewportSize(),
95
- w = _this$rendererService.width,
96
- h = _this$rendererService.height;
97
-
69
+ w = _this$rendererService.width,
70
+ h = _this$rendererService.height;
98
71
  _this.ctx.clearRect(0, 0, w, h);
99
72
  }
100
73
  });
101
-
102
74
  _defineProperty(_assertThisInitialized(_this), "renderCanvas", function () {
103
75
  var _this$rendererService2 = _this.rendererService.getViewportSize(),
104
- viewWidth = _this$rendererService2.width,
105
- viewHeight = _this$rendererService2.height;
106
-
76
+ viewWidth = _this$rendererService2.width,
77
+ viewHeight = _this$rendererService2.height;
107
78
  if (_this.prevSize[0] !== viewWidth || _this.prevSize[1] !== viewHeight) {
108
79
  _this.prevSize = [viewWidth, viewHeight];
109
-
110
80
  var size = _this.mapService.getSize();
111
-
112
81
  var _size = _slicedToArray(size, 2),
113
- width = _size[0],
114
- height = _size[1];
115
-
82
+ width = _size[0],
83
+ height = _size[1];
116
84
  _this.canvas.width = viewWidth;
117
85
  _this.canvas.height = viewHeight;
118
86
  _this.canvas.style.width = width + 'px';
119
87
  _this.canvas.style.height = height + 'px';
120
88
  }
121
-
122
89
  var _ref2 = _this.layer.getLayerConfig(),
123
- drawingOnCanvas = _ref2.drawingOnCanvas;
124
-
90
+ drawingOnCanvas = _ref2.drawingOnCanvas;
125
91
  if (_this.ctx) {
126
92
  drawingOnCanvas({
127
93
  canvas: _this.canvas,
@@ -131,21 +97,17 @@ var CanvaModel = /*#__PURE__*/function (_BaseModel) {
131
97
  });
132
98
  }
133
99
  });
134
-
135
100
  return _this;
136
101
  }
137
-
138
102
  _createClass(CanvaModel, [{
139
103
  key: "clearModels",
140
104
  value: function clearModels() {
141
105
  if (this.canvas) {
142
106
  var _this$mapService$getC;
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
-
107
+ (_this$mapService$getC = this.mapService.getContainer()) === null || _this$mapService$getC === void 0 ? void 0 : _this$mapService$getC.removeChild(this.canvas);
108
+ // @ts-ignore
146
109
  this.canvas = null;
147
110
  }
148
-
149
111
  this.unBindListener();
150
112
  }
151
113
  }, {
@@ -153,51 +115,40 @@ var CanvaModel = /*#__PURE__*/function (_BaseModel) {
153
115
  value: function () {
154
116
  var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
155
117
  var _ref3, _ref3$update, update;
156
-
157
118
  return _regeneratorRuntime.wrap(function _callee$(_context) {
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
- }
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();
173
131
  }
174
132
  }, _callee, this);
175
133
  }));
176
-
177
134
  function initModels() {
178
135
  return _initModels.apply(this, arguments);
179
136
  }
180
-
181
137
  return initModels;
182
138
  }()
183
139
  }, {
184
140
  key: "initCanvas",
185
141
  value: function initCanvas() {
186
142
  var _this$mapService$getC2;
187
-
188
143
  var _ref4 = this.layer.getLayerConfig(),
189
- zIndex = _ref4.zIndex;
190
-
144
+ zIndex = _ref4.zIndex;
191
145
  var size = this.mapService.getSize();
192
-
193
146
  var _size2 = _slicedToArray(size, 2),
194
- width = _size2[0],
195
- height = _size2[1];
196
-
147
+ width = _size2[0],
148
+ height = _size2[1];
197
149
  var _this$rendererService3 = this.rendererService.getViewportSize(),
198
- viewWidth = _this$rendererService3.width,
199
- viewHeight = _this$rendererService3.height;
200
-
150
+ viewWidth = _this$rendererService3.width,
151
+ viewHeight = _this$rendererService3.height;
201
152
  this.prevSize = [viewWidth, viewHeight];
202
153
  var canvas = document.createElement('canvas');
203
154
  this.canvas = canvas;
@@ -219,23 +170,18 @@ var CanvaModel = /*#__PURE__*/function (_BaseModel) {
219
170
  value: function () {
220
171
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
221
172
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
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
- }
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();
231
179
  }
232
180
  }, _callee2, this);
233
181
  }));
234
-
235
182
  function buildModels() {
236
183
  return _buildModels.apply(this, arguments);
237
184
  }
238
-
239
185
  return buildModels;
240
186
  }()
241
187
  }, {
@@ -244,8 +190,6 @@ var CanvaModel = /*#__PURE__*/function (_BaseModel) {
244
190
  return;
245
191
  }
246
192
  }]);
247
-
248
193
  return CanvaModel;
249
194
  }(BaseModel);
250
-
251
195
  export { CanvaModel as default };
@@ -7,59 +7,42 @@ 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
-
11
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); }; }
12
-
13
11
  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
-
15
12
  import BaseLayer from "../core/BaseLayer";
16
13
  import CityBuildModel from "./models/build";
17
-
18
14
  var CityBuildingLayer = /*#__PURE__*/function (_BaseLayer) {
19
15
  _inherits(CityBuildingLayer, _BaseLayer);
20
-
21
16
  var _super = _createSuper(CityBuildingLayer);
22
-
23
17
  function CityBuildingLayer() {
24
18
  var _this;
25
-
26
19
  _classCallCheck(this, CityBuildingLayer);
27
-
28
20
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
29
21
  args[_key] = arguments[_key];
30
22
  }
31
-
32
23
  _this = _super.call.apply(_super, [this].concat(args));
33
-
34
24
  _defineProperty(_assertThisInitialized(_this), "type", 'CityBuildingLayer');
35
-
36
25
  return _this;
37
26
  }
38
-
39
27
  _createClass(CityBuildingLayer, [{
40
28
  key: "buildModels",
41
29
  value: function () {
42
30
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
43
31
  return _regeneratorRuntime.wrap(function _callee$(_context) {
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
- }
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();
55
40
  }
56
41
  }, _callee, this);
57
42
  }));
58
-
59
43
  function buildModels() {
60
44
  return _buildModels.apply(this, arguments);
61
45
  }
62
-
63
46
  return buildModels;
64
47
  }()
65
48
  }, {
@@ -75,8 +58,6 @@ var CityBuildingLayer = /*#__PURE__*/function (_BaseLayer) {
75
58
  return 'citybuilding';
76
59
  }
77
60
  }]);
78
-
79
61
  return CityBuildingLayer;
80
62
  }(BaseLayer);
81
-
82
63
  export { CityBuildingLayer as default };
@@ -6,56 +6,45 @@ 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
-
10
9
  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
-
12
10
  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
-
14
11
  import { AttributeType, gl } from '@antv/l7-core';
15
12
  import { rgb2arr } from '@antv/l7-utils';
16
13
  import BaseModel from "../../core/BaseModel";
17
14
  import { PolygonExtrudeTriangulation } from "../../core/triangulation";
18
-
19
15
  /* babel-plugin-inline-import '../shaders/build_frag.glsl' */
20
16
  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
-
22
17
  /* babel-plugin-inline-import '../shaders/build_vert.glsl' */
23
18
  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
-
25
19
  var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
26
20
  _inherits(CityBuildModel, _BaseModel);
27
-
28
21
  var _super = _createSuper(CityBuildModel);
29
-
30
22
  function CityBuildModel() {
31
23
  _classCallCheck(this, CityBuildModel);
32
-
33
24
  return _super.apply(this, arguments);
34
25
  }
35
-
36
26
  _createClass(CityBuildModel, [{
37
27
  key: "getUninforms",
38
28
  value: function getUninforms() {
39
29
  var _ref = this.layer.getLayerConfig(),
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
-
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;
59
48
  return {
60
49
  u_cityCenter: sweep.sweepCenter || this.cityCenter,
61
50
  u_cityMinSize: this.cityMinSize * sweep.sweepRadius,
@@ -74,17 +63,16 @@ var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
74
63
  value: function calCityGeo() {
75
64
  // @ts-ignore
76
65
  var _this$layer$getSource = _slicedToArray(this.layer.getSource().extent, 4),
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
-
66
+ minLng = _this$layer$getSource[0],
67
+ minLat = _this$layer$getSource[1],
68
+ maxLng = _this$layer$getSource[2],
69
+ maxLat = _this$layer$getSource[3];
82
70
  if (this.mapService.version === 'GAODE2.x') {
83
71
  // @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
-
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
88
76
  var l2 = this.mapService.lngLatToCoord([minLng, minLat]);
89
77
  this.cityMinSize = Math.sqrt(Math.pow(l1[0] - l2[0], 2) + Math.pow(l1[1] - l2[1], 2)) / 4;
90
78
  } else {
@@ -99,25 +87,20 @@ var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
99
87
  value: function () {
100
88
  var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
101
89
  return _regeneratorRuntime.wrap(function _callee$(_context) {
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
- }
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();
113
98
  }
114
99
  }, _callee, this);
115
100
  }));
116
-
117
101
  function initModels() {
118
102
  return _initModels.apply(this, arguments);
119
103
  }
120
-
121
104
  return initModels;
122
105
  }()
123
106
  }, {
@@ -126,40 +109,34 @@ var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
126
109
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
127
110
  var model;
128
111
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
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
- }
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();
155
134
  }
156
135
  }, _callee2, this);
157
136
  }));
158
-
159
137
  function buildModels() {
160
138
  return _buildModels.apply(this, arguments);
161
139
  }
162
-
163
140
  return buildModels;
164
141
  }()
165
142
  }, {
@@ -197,7 +174,7 @@ var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
197
174
  size: 1,
198
175
  update: function update(feature) {
199
176
  var _feature$size = feature.size,
200
- size = _feature$size === void 0 ? 10 : _feature$size;
177
+ size = _feature$size === void 0 ? 10 : _feature$size;
201
178
  return Array.isArray(size) ? [size[0]] : [size];
202
179
  }
203
180
  }
@@ -221,8 +198,6 @@ var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
221
198
  });
222
199
  }
223
200
  }]);
224
-
225
201
  return CityBuildModel;
226
202
  }(BaseModel);
227
-
228
203
  export { CityBuildModel as default };