@antv/l7-layers 2.15.2 → 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 (242) 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.js +197 -299
  69. package/es/point/shape/extrude.js +4 -13
  70. package/es/polygon/index.js +11 -40
  71. package/es/polygon/models/extrude.js +48 -92
  72. package/es/polygon/models/fill.js +54 -88
  73. package/es/polygon/models/index.js +3 -2
  74. package/es/polygon/models/ocean.js +42 -76
  75. package/es/polygon/models/water.js +37 -71
  76. package/es/raster/buffers/triangulation.js +2 -4
  77. package/es/raster/index.js +9 -32
  78. package/es/raster/models/raster.js +80 -116
  79. package/es/raster/models/rasterRgb.js +84 -127
  80. package/es/raster/models/rasterTerrainRgb.js +56 -84
  81. package/es/tile/interaction/getRasterData.js +14 -20
  82. package/es/tile/interaction/utils.js +7 -9
  83. package/es/tile/manager/base.js +63 -96
  84. package/es/tile/service/TileLayerService.js +30 -52
  85. package/es/tile/service/TilePickService.js +26 -40
  86. package/es/tile/service/TileSourceService.js +3 -7
  87. package/es/tile/tileFactory/DebugTile.js +28 -45
  88. package/es/tile/tileFactory/ImageTile.js +20 -38
  89. package/es/tile/tileFactory/MaskTile.js +22 -43
  90. package/es/tile/tileFactory/RasterRGBTile.js +22 -42
  91. package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
  92. package/es/tile/tileFactory/RasterTile.js +30 -53
  93. package/es/tile/tileFactory/Tile.js +63 -97
  94. package/es/tile/tileFactory/VectorTile.js +41 -68
  95. package/es/tile/tileFactory/index.js +0 -11
  96. package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
  97. package/es/tile/tileFactory/util.js +0 -3
  98. package/es/tile/tileLayer/BaseLayer.js +105 -146
  99. package/es/tile/utils.js +1 -1
  100. package/es/utils/blend.js +0 -2
  101. package/es/utils/collision-index.js +9 -16
  102. package/es/utils/dataMappingStyle.js +8 -18
  103. package/es/utils/extrude_polyline.js +101 -149
  104. package/es/utils/grid-index.js +2 -27
  105. package/es/utils/identityScale.js +0 -8
  106. package/es/utils/layerData.js +30 -44
  107. package/es/utils/multiPassRender.js +11 -13
  108. package/es/utils/polylineNormal.js +31 -37
  109. package/es/utils/simpleLine.js +2 -16
  110. package/es/utils/stencil.js +2 -3
  111. package/es/utils/symbol-layout.js +27 -53
  112. package/es/wind/index.js +9 -29
  113. package/es/wind/models/utils.js +26 -51
  114. package/es/wind/models/wind.js +101 -147
  115. package/es/wind/models/windRender.js +53 -66
  116. package/lib/Geometry/index.js +9 -38
  117. package/lib/Geometry/models/billboard.js +51 -97
  118. package/lib/Geometry/models/index.js +0 -5
  119. package/lib/Geometry/models/plane.js +79 -151
  120. package/lib/Geometry/models/sprite.js +60 -127
  121. package/lib/canvas/index.js +10 -40
  122. package/lib/canvas/models/canvas.js +41 -101
  123. package/lib/canvas/models/index.js +0 -3
  124. package/lib/citybuliding/building.js +8 -35
  125. package/lib/citybuliding/models/build.js +57 -92
  126. package/lib/core/BaseLayer.js +320 -478
  127. package/lib/core/BaseModel.js +97 -139
  128. package/lib/core/LayerPickService.js +21 -37
  129. package/lib/core/TextureService.js +0 -16
  130. package/lib/core/interface.js +21 -31
  131. package/lib/core/schema.js +0 -1
  132. package/lib/core/shape/Path.js +14 -31
  133. package/lib/core/shape/extrude.js +10 -54
  134. package/lib/core/triangulation.js +53 -153
  135. package/lib/earth/index.js +9 -43
  136. package/lib/earth/models/atmosphere.js +30 -63
  137. package/lib/earth/models/base.js +47 -90
  138. package/lib/earth/models/bloomsphere.js +30 -63
  139. package/lib/earth/utils.js +7 -31
  140. package/lib/heatmap/index.js +10 -48
  141. package/lib/heatmap/models/grid.js +28 -60
  142. package/lib/heatmap/models/grid3d.js +28 -60
  143. package/lib/heatmap/models/heatmap.js +91 -162
  144. package/lib/heatmap/models/hexagon.js +28 -60
  145. package/lib/heatmap/models/index.js +0 -6
  146. package/lib/heatmap/triangulation.js +0 -5
  147. package/lib/image/index.js +9 -36
  148. package/lib/image/models/image.js +66 -109
  149. package/lib/image/models/index.js +0 -3
  150. package/lib/index.js +7 -61
  151. package/lib/line/index.js +9 -40
  152. package/lib/line/models/arc.js +64 -128
  153. package/lib/line/models/arc_3d.js +58 -119
  154. package/lib/line/models/earthArc_3d.js +61 -122
  155. package/lib/line/models/great_circle.js +56 -111
  156. package/lib/line/models/half.js +46 -87
  157. package/lib/line/models/index.js +0 -11
  158. package/lib/line/models/line.js +92 -156
  159. package/lib/line/models/linearline.js +45 -92
  160. package/lib/line/models/simpleLine.js +41 -84
  161. package/lib/line/models/wall.js +52 -103
  162. package/lib/mask/index.js +9 -36
  163. package/lib/mask/models/fill.js +29 -63
  164. package/lib/mask/models/index.js +0 -3
  165. package/lib/plugins/DataMappingPlugin.js +80 -128
  166. package/lib/plugins/DataSourcePlugin.js +45 -76
  167. package/lib/plugins/FeatureScalePlugin.js +67 -138
  168. package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
  169. package/lib/plugins/LayerMaskPlugin.js +4 -17
  170. package/lib/plugins/LayerModelPlugin.js +68 -113
  171. package/lib/plugins/LayerStylePlugin.js +4 -14
  172. package/lib/plugins/LightingPlugin.js +12 -25
  173. package/lib/plugins/MultiPassRendererPlugin.js +11 -22
  174. package/lib/plugins/PixelPickingPlugin.js +12 -27
  175. package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
  176. package/lib/plugins/ShaderUniformPlugin.js +13 -34
  177. package/lib/plugins/UpdateModelPlugin.js +1 -10
  178. package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
  179. package/lib/point/index.js +26 -83
  180. package/lib/point/models/earthExtrude.js +61 -113
  181. package/lib/point/models/earthFill.js +57 -117
  182. package/lib/point/models/extrude.js +60 -111
  183. package/lib/point/models/fill.js +68 -109
  184. package/lib/point/models/fillmage.js +61 -115
  185. package/lib/point/models/image.js +48 -98
  186. package/lib/point/models/index.js +1 -12
  187. package/lib/point/models/normal.js +30 -64
  188. package/lib/point/models/radar.js +40 -74
  189. package/lib/point/models/simplePoint.js +41 -79
  190. package/lib/point/models/text.js +197 -307
  191. package/lib/point/shape/extrude.js +4 -20
  192. package/lib/polygon/index.js +11 -48
  193. package/lib/polygon/models/extrude.js +48 -103
  194. package/lib/polygon/models/fill.js +54 -98
  195. package/lib/polygon/models/index.js +2 -14
  196. package/lib/polygon/models/ocean.js +42 -88
  197. package/lib/polygon/models/water.js +37 -82
  198. package/lib/raster/buffers/triangulation.js +3 -7
  199. package/lib/raster/index.js +9 -40
  200. package/lib/raster/models/index.js +0 -5
  201. package/lib/raster/models/raster.js +80 -125
  202. package/lib/raster/models/rasterRgb.js +84 -139
  203. package/lib/raster/models/rasterTerrainRgb.js +56 -93
  204. package/lib/tile/interaction/getRasterData.js +14 -25
  205. package/lib/tile/interaction/utils.js +7 -19
  206. package/lib/tile/manager/base.js +63 -104
  207. package/lib/tile/service/TileLayerService.js +30 -57
  208. package/lib/tile/service/TilePickService.js +26 -48
  209. package/lib/tile/service/TileSourceService.js +2 -16
  210. package/lib/tile/style/utils.js +0 -3
  211. package/lib/tile/tileFactory/DebugTile.js +28 -53
  212. package/lib/tile/tileFactory/ImageTile.js +20 -46
  213. package/lib/tile/tileFactory/MaskTile.js +22 -51
  214. package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
  215. package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
  216. package/lib/tile/tileFactory/RasterTile.js +30 -63
  217. package/lib/tile/tileFactory/Tile.js +63 -102
  218. package/lib/tile/tileFactory/VectorTile.js +41 -76
  219. package/lib/tile/tileFactory/index.js +0 -25
  220. package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
  221. package/lib/tile/tileFactory/util.js +0 -9
  222. package/lib/tile/tileLayer/BaseLayer.js +105 -153
  223. package/lib/tile/utils.js +1 -5
  224. package/lib/utils/blend.js +0 -5
  225. package/lib/utils/collision-index.js +9 -25
  226. package/lib/utils/dataMappingStyle.js +8 -19
  227. package/lib/utils/extrude_polyline.js +101 -181
  228. package/lib/utils/grid-index.js +2 -28
  229. package/lib/utils/identityScale.js +0 -9
  230. package/lib/utils/layerData.js +30 -49
  231. package/lib/utils/multiPassRender.js +11 -16
  232. package/lib/utils/polylineNormal.js +31 -66
  233. package/lib/utils/simpleLine.js +2 -21
  234. package/lib/utils/stencil.js +0 -4
  235. package/lib/utils/symbol-layout.js +27 -55
  236. package/lib/wind/index.js +9 -37
  237. package/lib/wind/models/index.js +0 -3
  238. package/lib/wind/models/utils.js +26 -62
  239. package/lib/wind/models/wind.js +101 -157
  240. package/lib/wind/models/windRender.js +53 -71
  241. package/lib/wind/models/windShader.js +0 -1
  242. package/package.json +7 -7
@@ -1,86 +1,63 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
-
14
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
-
16
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
-
18
12
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
24
15
  var _l7Core = require("@antv/l7-core");
25
-
26
16
  var _l7Utils = require("@antv/l7-utils");
27
-
28
17
  var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
29
-
30
18
  var _triangulation = require("../../core/triangulation");
31
-
32
19
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
33
-
34
20
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
35
-
36
21
  /* babel-plugin-inline-import '../shaders/raster_terrain_rgb_frag.glsl' */
37
22
  var Raster_terrainFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\n\nuniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\n\nvarying vec2 v_texCoord;\n\nuniform vec2 u_domain;\nuniform float u_noDataValue;\nuniform bool u_clampLow: true;\nuniform bool u_clampHigh: true;\nuniform vec4 u_unpack;\n\nfloat getElevation(vec2 coord, float bias) {\n // Convert encoded elevation value to meters\n vec4 data = texture2D(u_texture, coord,bias) * 255.0;\n data.a = -1.0;\n return dot(data, u_unpack);\n}\n\nvec4 getColor(float value) {\n float normalisedValue =(value- u_domain[0]) / (u_domain[1] - u_domain[0]);\n vec2 coord = vec2(normalisedValue, 0);\n return texture2D(u_colorTexture, coord);\n}\n\nvoid main() {\n float value = getElevation(v_texCoord,0.0);\n if (value == u_noDataValue) {\n gl_FragColor = vec4(0.0, 0, 0, 0.0);\n } else if ((!u_clampLow && value < u_domain[0]) || (!u_clampHigh && value > u_domain[1])) {\n gl_FragColor = vec4(0.0, 0, 0, 0.0);\n } else {\n \n gl_FragColor = getColor(value);\n gl_FragColor.a = gl_FragColor.a * u_opacity ;\n if(gl_FragColor.a < 0.01)\n discard;\n }\n}\n";
38
-
39
23
  /* babel-plugin-inline-import '../shaders/rater_terrain_rgb_vert.glsl' */
40
24
  var Raster_terrainVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy,0., 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n }\n}\n";
41
-
42
25
  var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
43
26
  (0, _inherits2.default)(RasterTerrainRGB, _BaseModel);
44
-
45
27
  var _super = _createSuper(RasterTerrainRGB);
46
-
47
28
  function RasterTerrainRGB() {
48
29
  (0, _classCallCheck2.default)(this, RasterTerrainRGB);
49
30
  return _super.apply(this, arguments);
50
31
  }
51
-
52
32
  (0, _createClass2.default)(RasterTerrainRGB, [{
53
33
  key: "getUninforms",
54
34
  value: function getUninforms() {
55
35
  var _ref = this.layer.getLayerConfig(),
56
- opacity = _ref.opacity,
57
- _ref$clampLow = _ref.clampLow,
58
- clampLow = _ref$clampLow === void 0 ? true : _ref$clampLow,
59
- _ref$clampHigh = _ref.clampHigh,
60
- clampHigh = _ref$clampHigh === void 0 ? true : _ref$clampHigh,
61
- _ref$noDataValue = _ref.noDataValue,
62
- noDataValue = _ref$noDataValue === void 0 ? -9999999 : _ref$noDataValue,
63
- domain = _ref.domain,
64
- rampColors = _ref.rampColors,
65
- colorTexture = _ref.colorTexture,
66
- _ref$rScaler = _ref.rScaler,
67
- rScaler = _ref$rScaler === void 0 ? 6553.6 : _ref$rScaler,
68
- _ref$gScaler = _ref.gScaler,
69
- gScaler = _ref$gScaler === void 0 ? 25.6 : _ref$gScaler,
70
- _ref$bScaler = _ref.bScaler,
71
- bScaler = _ref$bScaler === void 0 ? 0.1 : _ref$bScaler,
72
- _ref$offset = _ref.offset,
73
- offset = _ref$offset === void 0 ? 10000 : _ref$offset;
74
-
36
+ opacity = _ref.opacity,
37
+ _ref$clampLow = _ref.clampLow,
38
+ clampLow = _ref$clampLow === void 0 ? true : _ref$clampLow,
39
+ _ref$clampHigh = _ref.clampHigh,
40
+ clampHigh = _ref$clampHigh === void 0 ? true : _ref$clampHigh,
41
+ _ref$noDataValue = _ref.noDataValue,
42
+ noDataValue = _ref$noDataValue === void 0 ? -9999999 : _ref$noDataValue,
43
+ domain = _ref.domain,
44
+ rampColors = _ref.rampColors,
45
+ colorTexture = _ref.colorTexture,
46
+ _ref$rScaler = _ref.rScaler,
47
+ rScaler = _ref$rScaler === void 0 ? 6553.6 : _ref$rScaler,
48
+ _ref$gScaler = _ref.gScaler,
49
+ gScaler = _ref$gScaler === void 0 ? 25.6 : _ref$gScaler,
50
+ _ref$bScaler = _ref.bScaler,
51
+ bScaler = _ref$bScaler === void 0 ? 0.1 : _ref$bScaler,
52
+ _ref$offset = _ref.offset,
53
+ offset = _ref$offset === void 0 ? 10000 : _ref$offset;
75
54
  var newdomain = domain || (0, _l7Utils.getDefaultDomain)(rampColors);
76
55
  var texture = colorTexture;
77
-
78
56
  if (!colorTexture) {
79
57
  texture = this.layer.textureService.getColorTexture(rampColors, newdomain);
80
58
  } else {
81
59
  this.layer.textureService.setColorTexture(colorTexture, rampColors, newdomain);
82
60
  }
83
-
84
61
  return {
85
62
  u_opacity: opacity || 1,
86
63
  u_texture: this.texture,
@@ -98,58 +75,50 @@ var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
98
75
  var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
99
76
  var source, createTexture2D, imageData, model;
100
77
  return _regenerator.default.wrap(function _callee$(_context) {
101
- while (1) {
102
- switch (_context.prev = _context.next) {
103
- case 0:
104
- source = this.layer.getSource();
105
- createTexture2D = this.rendererService.createTexture2D;
106
- _context.next = 4;
107
- return source.data.images;
108
-
109
- case 4:
110
- imageData = _context.sent;
111
- this.texture = createTexture2D({
112
- data: imageData[0],
113
- width: imageData[0].width,
114
- height: imageData[0].height,
115
- min: _l7Core.gl.LINEAR,
116
- mag: _l7Core.gl.LINEAR
117
- });
118
- _context.next = 8;
119
- return this.layer.buildLayerModel({
120
- moduleName: 'RasterTileDataImage',
121
- vertexShader: Raster_terrainVert,
122
- fragmentShader: Raster_terrainFrag,
123
- triangulation: _triangulation.RasterImageTriangulation,
124
- primitive: _l7Core.gl.TRIANGLES,
125
- depth: {
126
- enable: false
127
- }
128
- });
129
-
130
- case 8:
131
- model = _context.sent;
132
- return _context.abrupt("return", [model]);
133
-
134
- case 10:
135
- case "end":
136
- return _context.stop();
137
- }
78
+ while (1) switch (_context.prev = _context.next) {
79
+ case 0:
80
+ source = this.layer.getSource();
81
+ createTexture2D = this.rendererService.createTexture2D;
82
+ _context.next = 4;
83
+ return source.data.images;
84
+ case 4:
85
+ imageData = _context.sent;
86
+ this.texture = createTexture2D({
87
+ data: imageData[0],
88
+ width: imageData[0].width,
89
+ height: imageData[0].height,
90
+ min: _l7Core.gl.LINEAR,
91
+ mag: _l7Core.gl.LINEAR
92
+ });
93
+ _context.next = 8;
94
+ return this.layer.buildLayerModel({
95
+ moduleName: 'RasterTileDataImage',
96
+ vertexShader: Raster_terrainVert,
97
+ fragmentShader: Raster_terrainFrag,
98
+ triangulation: _triangulation.RasterImageTriangulation,
99
+ primitive: _l7Core.gl.TRIANGLES,
100
+ depth: {
101
+ enable: false
102
+ }
103
+ });
104
+ case 8:
105
+ model = _context.sent;
106
+ return _context.abrupt("return", [model]);
107
+ case 10:
108
+ case "end":
109
+ return _context.stop();
138
110
  }
139
111
  }, _callee, this);
140
112
  }));
141
-
142
113
  function initModels() {
143
114
  return _initModels.apply(this, arguments);
144
115
  }
145
-
146
116
  return initModels;
147
117
  }()
148
118
  }, {
149
119
  key: "clearModels",
150
120
  value: function clearModels() {
151
121
  var _this$texture;
152
-
153
122
  (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
154
123
  }
155
124
  }, {
@@ -157,23 +126,18 @@ var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
157
126
  value: function () {
158
127
  var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
159
128
  return _regenerator.default.wrap(function _callee2$(_context2) {
160
- while (1) {
161
- switch (_context2.prev = _context2.next) {
162
- case 0:
163
- return _context2.abrupt("return", this.initModels());
164
-
165
- case 1:
166
- case "end":
167
- return _context2.stop();
168
- }
129
+ while (1) switch (_context2.prev = _context2.next) {
130
+ case 0:
131
+ return _context2.abrupt("return", this.initModels());
132
+ case 1:
133
+ case "end":
134
+ return _context2.stop();
169
135
  }
170
136
  }, _callee2, this);
171
137
  }));
172
-
173
138
  function buildModels() {
174
139
  return _buildModels.apply(this, arguments);
175
140
  }
176
-
177
141
  return buildModels;
178
142
  }()
179
143
  }, {
@@ -199,5 +163,4 @@ var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
199
163
  }]);
200
164
  return RasterTerrainRGB;
201
165
  }(_BaseModel2.default);
202
-
203
166
  exports.default = RasterTerrainRGB;
@@ -1,39 +1,34 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.readPixel = readPixel;
9
8
  exports.readRasterValue = readRasterValue;
10
-
11
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
-
13
10
  var _l7Utils = require("@antv/l7-utils");
14
-
15
11
  function readRasterValue(tile, mapService, x, y) {
16
12
  var _tile$bboxPolygon, _tile$data, _tile$data2, _tile$data3;
17
-
18
13
  var bbox = (tile === null || tile === void 0 ? void 0 : (_tile$bboxPolygon = tile.bboxPolygon) === null || _tile$bboxPolygon === void 0 ? void 0 : _tile$bboxPolygon.bbox) || [0, 0, 10, -10];
19
-
20
14
  var _bbox = (0, _slicedToArray2.default)(bbox, 4),
21
- _bbox$ = _bbox[0],
22
- minLng = _bbox$ === void 0 ? 0 : _bbox$,
23
- _bbox$2 = _bbox[1],
24
- minLat = _bbox$2 === void 0 ? 0 : _bbox$2,
25
- _bbox$3 = _bbox[2],
26
- maxLng = _bbox$3 === void 0 ? 10 : _bbox$3,
27
- _bbox$4 = _bbox[3],
28
- maxLat = _bbox$4 === void 0 ? -10 : _bbox$4;
29
-
15
+ _bbox$ = _bbox[0],
16
+ minLng = _bbox$ === void 0 ? 0 : _bbox$,
17
+ _bbox$2 = _bbox[1],
18
+ minLat = _bbox$2 === void 0 ? 0 : _bbox$2,
19
+ _bbox$3 = _bbox[2],
20
+ maxLng = _bbox$3 === void 0 ? 10 : _bbox$3,
21
+ _bbox$4 = _bbox[3],
22
+ maxLat = _bbox$4 === void 0 ? -10 : _bbox$4;
30
23
  var tileXY = mapService.lngLatToContainer([minLng, minLat]);
31
24
  var tileMaxXY = mapService.lngLatToContainer([maxLng, maxLat]);
32
25
  var tilePixelWidth = tileMaxXY.x - tileXY.x;
33
26
  var tilePixelHeight = tileXY.y - tileMaxXY.y;
34
- var pos = [(x - tileXY.x) / tilePixelWidth, // x
27
+ var pos = [(x - tileXY.x) / tilePixelWidth,
28
+ // x
35
29
  (y - tileMaxXY.y) / tilePixelHeight // y
36
30
  ];
31
+
37
32
  var tileWidth = (tile === null || tile === void 0 ? void 0 : (_tile$data = tile.data) === null || _tile$data === void 0 ? void 0 : _tile$data.width) || 1;
38
33
  var tileHeight = (tile === null || tile === void 0 ? void 0 : (_tile$data2 = tile.data) === null || _tile$data2 === void 0 ? void 0 : _tile$data2.height) || 1;
39
34
  var indexX = Math.floor(pos[0] * tileWidth);
@@ -42,24 +37,19 @@ function readRasterValue(tile, mapService, x, y) {
42
37
  var data = tile === null || tile === void 0 ? void 0 : (_tile$data3 = tile.data) === null || _tile$data3 === void 0 ? void 0 : _tile$data3.data[index];
43
38
  return data;
44
39
  }
45
-
46
40
  function readPixel(x, y, rendererService) {
47
41
  var readPixels = rendererService.readPixels,
48
- getContainer = rendererService.getContainer;
42
+ getContainer = rendererService.getContainer;
49
43
  var xInDevicePixel = x * _l7Utils.DOM.DPR;
50
44
  var yInDevicePixel = y * _l7Utils.DOM.DPR;
51
-
52
45
  var _getContainerSize = getContainerSize(getContainer()),
53
- width = _getContainerSize.width,
54
- height = _getContainerSize.height;
55
-
46
+ width = _getContainerSize.width,
47
+ height = _getContainerSize.height;
56
48
  width *= _l7Utils.DOM.DPR;
57
49
  height *= _l7Utils.DOM.DPR;
58
-
59
50
  if (xInDevicePixel > width - 1 * _l7Utils.DOM.DPR || xInDevicePixel < 0 || yInDevicePixel > height - 1 * _l7Utils.DOM.DPR || yInDevicePixel < 0) {
60
51
  return false;
61
52
  }
62
-
63
53
  var pickedColors = readPixels({
64
54
  x: Math.floor(xInDevicePixel),
65
55
  // 视口坐标系原点在左上,而 WebGL 在左下,需要翻转 Y 轴
@@ -70,7 +60,6 @@ function readPixel(x, y, rendererService) {
70
60
  });
71
61
  return pickedColors;
72
62
  }
73
-
74
63
  function getContainerSize(container) {
75
64
  if (container.getContext) {
76
65
  return {
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -12,11 +11,8 @@ exports.setFeatureSelect = setFeatureSelect;
12
11
  exports.setHighlight = setHighlight;
13
12
  exports.setPickState = setPickState;
14
13
  exports.setSelect = setSelect;
15
-
16
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
17
-
18
15
  var _l7Utils = require("@antv/l7-utils");
19
-
20
16
  function clearPickState(layers) {
21
17
  layers.filter(function (layer) {
22
18
  return layer.inited && layer.isVisible();
@@ -27,7 +23,6 @@ function clearPickState(layers) {
27
23
  layer.setCurrentSelectedId(null);
28
24
  });
29
25
  }
30
-
31
26
  function setSelect(layers, pickedColors, renderList) {
32
27
  var selectedId = (0, _l7Utils.decodePickingColor)(pickedColors);
33
28
  var pickColor;
@@ -38,12 +33,11 @@ function setSelect(layers, pickedColors, renderList) {
38
33
  pickColor = pickedColors;
39
34
  } else {
40
35
  selectFeature(layer, new Uint8Array([0, 0, 0, 0])); // toggle select
41
-
42
36
  layer.setCurrentSelectedId(null);
43
37
  pickColor = null;
44
38
  }
45
- }); // unselect normal layer
46
-
39
+ });
40
+ // unselect normal layer
47
41
  renderList.filter(function (layer) {
48
42
  return layer.inited && layer.isVisible() && layer.needPick('click');
49
43
  }).filter(function (layer) {
@@ -54,12 +48,12 @@ function setSelect(layers, pickedColors, renderList) {
54
48
  });
55
49
  return pickColor;
56
50
  }
57
-
58
51
  function setHighlight(layers, pickedColors) {
59
52
  var pickId = (0, _l7Utils.decodePickingColor)(pickedColors);
60
53
  layers.filter(function (layer) {
61
54
  return layer.inited && layer.isVisible();
62
- }) // @ts-ignore
55
+ })
56
+ // @ts-ignore
63
57
  .filter(function (layer) {
64
58
  return layer.getPickID() !== pickId;
65
59
  }).map(function (layer) {
@@ -68,14 +62,12 @@ function setHighlight(layers, pickedColors) {
68
62
  layer.hooks.beforeHighlight.call(pickedColors);
69
63
  });
70
64
  }
71
-
72
65
  function setPickState(layers, pickColors) {
73
66
  if (pickColors.select) {
74
67
  layers.map(function (layer) {
75
68
  selectFeature(layer, pickColors.select);
76
69
  });
77
70
  }
78
-
79
71
  if (pickColors.active) {
80
72
  layers.filter(function (layer) {
81
73
  return layer.inited && layer.isVisible();
@@ -84,17 +76,14 @@ function setPickState(layers, pickColors) {
84
76
  });
85
77
  }
86
78
  }
87
-
88
79
  function selectFeature(layer, pickedColors) {
89
80
  // @ts-ignore
90
81
  var _pickedColors = (0, _slicedToArray2.default)(pickedColors, 3),
91
- r = _pickedColors[0],
92
- g = _pickedColors[1],
93
- b = _pickedColors[2];
94
-
82
+ r = _pickedColors[0],
83
+ g = _pickedColors[1],
84
+ b = _pickedColors[2];
95
85
  layer.hooks.beforeSelect.call([r, g, b]);
96
86
  }
97
-
98
87
  function setFeatureSelect(color, layers) {
99
88
  var id = (0, _l7Utils.decodePickingColor)(color);
100
89
  layers.map(function (layer) {
@@ -102,7 +91,6 @@ function setFeatureSelect(color, layers) {
102
91
  layer.setCurrentSelectedId(id);
103
92
  });
104
93
  }
105
-
106
94
  function setFeatureActive(color, layers) {
107
95
  var id = (0, _l7Utils.decodePickingColor)(color);
108
96
  layers.map(function (layer) {