@antv/l7-layers 2.9.14 → 2.9.15

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 (218) hide show
  1. package/LICENSE.md +1 -1
  2. package/es/core/BaseLayer.d.ts +2 -4
  3. package/es/core/BaseLayer.js +21 -47
  4. package/es/core/BaseLayer.js.map +1 -1
  5. package/es/core/BaseModel.d.ts +1 -2
  6. package/es/core/BaseModel.js +0 -3
  7. package/es/core/BaseModel.js.map +1 -1
  8. package/es/core/LayerGroup.d.ts +9 -0
  9. package/es/{tile/tileFactory/rasterDataLayer.js → core/LayerGroup.js} +32 -39
  10. package/es/core/LayerGroup.js.map +1 -0
  11. package/es/core/interface.d.ts +1 -14
  12. package/es/core/interface.js.map +1 -1
  13. package/es/image/models/image.js.map +1 -1
  14. package/es/line/index.d.ts +1 -1
  15. package/es/line/index.js +1 -13
  16. package/es/line/index.js.map +1 -1
  17. package/es/line/models/index.d.ts +1 -1
  18. package/es/line/models/index.js +1 -9
  19. package/es/line/models/index.js.map +1 -1
  20. package/es/plugins/DataMappingPlugin.js +1 -1
  21. package/es/plugins/DataMappingPlugin.js.map +1 -1
  22. package/es/plugins/DataSourcePlugin.js +6 -7
  23. package/es/plugins/DataSourcePlugin.js.map +1 -1
  24. package/es/plugins/FeatureScalePlugin.js +9 -35
  25. package/es/plugins/FeatureScalePlugin.js.map +1 -1
  26. package/es/plugins/ShaderUniformPlugin.js +1 -3
  27. package/es/plugins/ShaderUniformPlugin.js.map +1 -1
  28. package/es/point/index.d.ts +1 -1
  29. package/es/point/index.js +2 -10
  30. package/es/point/index.js.map +1 -1
  31. package/es/point/models/extrude.d.ts +1 -0
  32. package/es/point/models/extrude.js +10 -2
  33. package/es/point/models/extrude.js.map +1 -1
  34. package/es/point/models/fill.d.ts +1 -8
  35. package/es/point/models/fill.js +75 -55
  36. package/es/point/models/fill.js.map +1 -1
  37. package/es/point/models/index.d.ts +1 -1
  38. package/es/point/models/index.js +1 -9
  39. package/es/point/models/index.js.map +1 -1
  40. package/es/point/models/radar.js +6 -2
  41. package/es/point/models/radar.js.map +1 -1
  42. package/es/polygon/index.js +0 -6
  43. package/es/polygon/index.js.map +1 -1
  44. package/es/polygon/models/index.d.ts +1 -1
  45. package/es/polygon/models/index.js +1 -5
  46. package/es/polygon/models/index.js.map +1 -1
  47. package/es/raster/index.d.ts +2 -2
  48. package/es/raster/index.js +4 -4
  49. package/es/raster/index.js.map +1 -1
  50. package/es/raster/models/index.js +1 -1
  51. package/es/raster/models/index.js.map +1 -1
  52. package/es/raster/models/raste-tile.d.ts +23 -0
  53. package/es/raster/models/raste-tile.js +285 -0
  54. package/es/raster/models/raste-tile.js.map +1 -0
  55. package/es/raster/models/raster.d.ts +0 -2
  56. package/es/raster/models/raster.js +12 -24
  57. package/es/raster/models/raster.js.map +1 -1
  58. package/lib/core/BaseLayer.js +20 -45
  59. package/lib/core/BaseLayer.js.map +1 -1
  60. package/lib/core/BaseModel.js +0 -2
  61. package/lib/core/BaseModel.js.map +1 -1
  62. package/lib/{tile/tileFactory/rasterDataLayer.js → core/LayerGroup.js} +32 -40
  63. package/lib/core/LayerGroup.js.map +1 -0
  64. package/lib/core/interface.js.map +1 -1
  65. package/lib/image/models/image.js.map +1 -1
  66. package/lib/line/index.js +1 -13
  67. package/lib/line/index.js.map +1 -1
  68. package/lib/line/models/index.js +1 -13
  69. package/lib/line/models/index.js.map +1 -1
  70. package/lib/plugins/DataMappingPlugin.js +1 -1
  71. package/lib/plugins/DataMappingPlugin.js.map +1 -1
  72. package/lib/plugins/DataSourcePlugin.js +6 -7
  73. package/lib/plugins/DataSourcePlugin.js.map +1 -1
  74. package/lib/plugins/FeatureScalePlugin.js +9 -35
  75. package/lib/plugins/FeatureScalePlugin.js.map +1 -1
  76. package/lib/plugins/ShaderUniformPlugin.js +1 -3
  77. package/lib/plugins/ShaderUniformPlugin.js.map +1 -1
  78. package/lib/point/index.js +2 -10
  79. package/lib/point/index.js.map +1 -1
  80. package/lib/point/models/extrude.js +11 -2
  81. package/lib/point/models/extrude.js.map +1 -1
  82. package/lib/point/models/fill.js +93 -51
  83. package/lib/point/models/fill.js.map +1 -1
  84. package/lib/point/models/index.js +1 -13
  85. package/lib/point/models/index.js.map +1 -1
  86. package/lib/point/models/radar.js +5 -1
  87. package/lib/point/models/radar.js.map +1 -1
  88. package/lib/polygon/index.js +0 -6
  89. package/lib/polygon/index.js.map +1 -1
  90. package/lib/polygon/models/index.js +1 -7
  91. package/lib/polygon/models/index.js.map +1 -1
  92. package/lib/raster/index.js +4 -4
  93. package/lib/raster/index.js.map +1 -1
  94. package/lib/raster/models/index.js +2 -2
  95. package/lib/raster/models/index.js.map +1 -1
  96. package/lib/raster/models/raste-tile.js +294 -0
  97. package/lib/raster/models/raste-tile.js.map +1 -0
  98. package/lib/raster/models/raster.js +12 -24
  99. package/lib/raster/models/raster.js.map +1 -1
  100. package/package.json +7 -9
  101. package/es/line/models/earthArc_3d.d.ts +0 -17
  102. package/es/line/models/earthArc_3d.js +0 -311
  103. package/es/line/models/earthArc_3d.js.map +0 -1
  104. package/es/line/models/half.d.ts +0 -18
  105. package/es/line/models/half.js +0 -244
  106. package/es/line/models/half.js.map +0 -1
  107. package/es/line/models/tile.d.ts +0 -20
  108. package/es/line/models/tile.js +0 -327
  109. package/es/line/models/tile.js.map +0 -1
  110. package/es/point/models/earthExtrude.d.ts +0 -24
  111. package/es/point/models/earthExtrude.js +0 -259
  112. package/es/point/models/earthExtrude.js.map +0 -1
  113. package/es/point/models/earthFill.d.ts +0 -20
  114. package/es/point/models/earthFill.js +0 -255
  115. package/es/point/models/earthFill.js.map +0 -1
  116. package/es/point/models/tile.d.ts +0 -31
  117. package/es/point/models/tile.js +0 -291
  118. package/es/point/models/tile.js.map +0 -1
  119. package/es/polygon/models/tile.d.ts +0 -16
  120. package/es/polygon/models/tile.js +0 -137
  121. package/es/polygon/models/tile.js.map +0 -1
  122. package/es/tile/interface.d.ts +0 -28
  123. package/es/tile/interface.js +0 -2
  124. package/es/tile/interface.js.map +0 -1
  125. package/es/tile/manager/tileConfigManager.d.ts +0 -17
  126. package/es/tile/manager/tileConfigManager.js +0 -123
  127. package/es/tile/manager/tileConfigManager.js.map +0 -1
  128. package/es/tile/manager/tileLayerManager.d.ts +0 -35
  129. package/es/tile/manager/tileLayerManager.js +0 -297
  130. package/es/tile/manager/tileLayerManager.js.map +0 -1
  131. package/es/tile/manager/tilePickerManager.d.ts +0 -21
  132. package/es/tile/manager/tilePickerManager.js +0 -189
  133. package/es/tile/manager/tilePickerManager.js.map +0 -1
  134. package/es/tile/models/tileModel.d.ts +0 -8
  135. package/es/tile/models/tileModel.js +0 -61
  136. package/es/tile/models/tileModel.js.map +0 -1
  137. package/es/tile/tileFactory/base.d.ts +0 -44
  138. package/es/tile/tileFactory/base.js +0 -423
  139. package/es/tile/tileFactory/base.js.map +0 -1
  140. package/es/tile/tileFactory/index.d.ts +0 -5
  141. package/es/tile/tileFactory/index.js +0 -30
  142. package/es/tile/tileFactory/index.js.map +0 -1
  143. package/es/tile/tileFactory/line.d.ts +0 -12
  144. package/es/tile/tileFactory/line.js +0 -65
  145. package/es/tile/tileFactory/line.js.map +0 -1
  146. package/es/tile/tileFactory/point.d.ts +0 -12
  147. package/es/tile/tileFactory/point.js +0 -65
  148. package/es/tile/tileFactory/point.js.map +0 -1
  149. package/es/tile/tileFactory/polygon.d.ts +0 -12
  150. package/es/tile/tileFactory/polygon.js +0 -65
  151. package/es/tile/tileFactory/polygon.js.map +0 -1
  152. package/es/tile/tileFactory/raster.d.ts +0 -12
  153. package/es/tile/tileFactory/raster.js +0 -61
  154. package/es/tile/tileFactory/raster.js.map +0 -1
  155. package/es/tile/tileFactory/rasterData.d.ts +0 -12
  156. package/es/tile/tileFactory/rasterData.js +0 -86
  157. package/es/tile/tileFactory/rasterData.js.map +0 -1
  158. package/es/tile/tileFactory/rasterDataLayer.d.ts +0 -19
  159. package/es/tile/tileFactory/rasterDataLayer.js.map +0 -1
  160. package/es/tile/tileFactory/vectorLayer.d.ts +0 -27
  161. package/es/tile/tileFactory/vectorLayer.js +0 -131
  162. package/es/tile/tileFactory/vectorLayer.js.map +0 -1
  163. package/es/tile/tileLayer/baseTileLayer.d.ts +0 -47
  164. package/es/tile/tileLayer/baseTileLayer.js +0 -409
  165. package/es/tile/tileLayer/baseTileLayer.js.map +0 -1
  166. package/es/tile/tmsTileLayer.d.ts +0 -7
  167. package/es/tile/tmsTileLayer.js +0 -100
  168. package/es/tile/tmsTileLayer.js.map +0 -1
  169. package/es/tile/utils.d.ts +0 -11
  170. package/es/tile/utils.js +0 -125
  171. package/es/tile/utils.js.map +0 -1
  172. package/lib/line/models/earthArc_3d.js +0 -328
  173. package/lib/line/models/earthArc_3d.js.map +0 -1
  174. package/lib/line/models/half.js +0 -260
  175. package/lib/line/models/half.js.map +0 -1
  176. package/lib/line/models/tile.js +0 -342
  177. package/lib/line/models/tile.js.map +0 -1
  178. package/lib/point/models/earthExtrude.js +0 -277
  179. package/lib/point/models/earthExtrude.js.map +0 -1
  180. package/lib/point/models/earthFill.js +0 -291
  181. package/lib/point/models/earthFill.js.map +0 -1
  182. package/lib/point/models/tile.js +0 -308
  183. package/lib/point/models/tile.js.map +0 -1
  184. package/lib/polygon/models/tile.js +0 -152
  185. package/lib/polygon/models/tile.js.map +0 -1
  186. package/lib/tile/interface.js +0 -2
  187. package/lib/tile/interface.js.map +0 -1
  188. package/lib/tile/manager/tileConfigManager.js +0 -134
  189. package/lib/tile/manager/tileConfigManager.js.map +0 -1
  190. package/lib/tile/manager/tileLayerManager.js +0 -305
  191. package/lib/tile/manager/tileLayerManager.js.map +0 -1
  192. package/lib/tile/manager/tilePickerManager.js +0 -195
  193. package/lib/tile/manager/tilePickerManager.js.map +0 -1
  194. package/lib/tile/models/tileModel.js +0 -73
  195. package/lib/tile/models/tileModel.js.map +0 -1
  196. package/lib/tile/tileFactory/base.js +0 -436
  197. package/lib/tile/tileFactory/base.js.map +0 -1
  198. package/lib/tile/tileFactory/index.js +0 -60
  199. package/lib/tile/tileFactory/index.js.map +0 -1
  200. package/lib/tile/tileFactory/line.js +0 -76
  201. package/lib/tile/tileFactory/line.js.map +0 -1
  202. package/lib/tile/tileFactory/point.js +0 -76
  203. package/lib/tile/tileFactory/point.js.map +0 -1
  204. package/lib/tile/tileFactory/polygon.js +0 -76
  205. package/lib/tile/tileFactory/polygon.js.map +0 -1
  206. package/lib/tile/tileFactory/raster.js +0 -74
  207. package/lib/tile/tileFactory/raster.js.map +0 -1
  208. package/lib/tile/tileFactory/rasterData.js +0 -99
  209. package/lib/tile/tileFactory/rasterData.js.map +0 -1
  210. package/lib/tile/tileFactory/rasterDataLayer.js.map +0 -1
  211. package/lib/tile/tileFactory/vectorLayer.js +0 -145
  212. package/lib/tile/tileFactory/vectorLayer.js.map +0 -1
  213. package/lib/tile/tileLayer/baseTileLayer.js +0 -407
  214. package/lib/tile/tileLayer/baseTileLayer.js.map +0 -1
  215. package/lib/tile/tmsTileLayer.js +0 -116
  216. package/lib/tile/tmsTileLayer.js.map +0 -1
  217. package/lib/tile/utils.js +0 -147
  218. package/lib/tile/utils.js.map +0 -1
@@ -1,4 +1,4 @@
1
- export declare type PolygonModelType = 'fill' | 'extrude' | 'line' | 'point_fill' | 'point_image' | 'point_normal' | 'point_extrude' | 'text' | 'water' | 'ocean' | 'vectorpolygon' | 'tile';
1
+ export declare type PolygonModelType = 'fill' | 'extrude' | 'line' | 'point_fill' | 'point_image' | 'point_normal' | 'point_extrude' | 'text' | 'water' | 'ocean';
2
2
  declare const PolygonModels: {
3
3
  [key in PolygonModelType]: any;
4
4
  };
@@ -4,11 +4,9 @@ import PointFillModel from '../../point/models/fill';
4
4
  import IMageModel from '../../point/models/image';
5
5
  import NormalModel from '../../point/models/normal';
6
6
  import TextModel from '../../point/models/text';
7
- import PolygonTileModel from '../../tile/models/tileModel';
8
7
  import ExtrudeModel from './extrude';
9
8
  import FillModel from './fill';
10
9
  import Ocean from './ocean';
11
- import TilePolygonModel from './tile';
12
10
  import Water from './water';
13
11
  var PolygonModels = {
14
12
  fill: FillModel,
@@ -20,9 +18,7 @@ var PolygonModels = {
20
18
  point_normal: NormalModel,
21
19
  point_extrude: PointExtrudeModel,
22
20
  water: Water,
23
- ocean: Ocean,
24
- vectorpolygon: PolygonTileModel,
25
- tile: TilePolygonModel
21
+ ocean: Ocean
26
22
  };
27
23
  export default PolygonModels;
28
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/polygon/models/index.ts"],"names":["LineModel","PointExtrudeModel","PointFillModel","IMageModel","NormalModel","TextModel","PolygonTileModel","ExtrudeModel","FillModel","Ocean","TilePolygonModel","Water","PolygonModels","fill","line","extrude","text","point_fill","point_image","point_normal","point_extrude","water","ocean","vectorpolygon","tile"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,wBAAtB;AACA,OAAOC,iBAAP,MAA8B,4BAA9B;AACA,OAAOC,cAAP,MAA2B,yBAA3B;AACA,OAAOC,UAAP,MAAuB,0BAAvB;AACA,OAAOC,WAAP,MAAwB,2BAAxB;AACA,OAAOC,SAAP,MAAsB,yBAAtB;AACA,OAAOC,gBAAP,MAA6B,6BAA7B;AACA,OAAOC,YAAP,MAAyB,WAAzB;AACA,OAAOC,SAAP,MAAsB,QAAtB;AACA,OAAOC,KAAP,MAAkB,SAAlB;AACA,OAAOC,gBAAP,MAA6B,QAA7B;AACA,OAAOC,KAAP,MAAkB,SAAlB;AAgBA,IAAMC,aAAiD,GAAG;AACxDC,EAAAA,IAAI,EAAEL,SADkD;AAExDM,EAAAA,IAAI,EAAEd,SAFkD;AAGxDe,EAAAA,OAAO,EAAER,YAH+C;AAIxDS,EAAAA,IAAI,EAAEX,SAJkD;AAKxDY,EAAAA,UAAU,EAAEf,cAL4C;AAMxDgB,EAAAA,WAAW,EAAEf,UAN2C;AAOxDgB,EAAAA,YAAY,EAAEf,WAP0C;AAQxDgB,EAAAA,aAAa,EAAEnB,iBARyC;AASxDoB,EAAAA,KAAK,EAAEV,KATiD;AAUxDW,EAAAA,KAAK,EAAEb,KAViD;AAYxDc,EAAAA,aAAa,EAAEjB,gBAZyC;AAaxDkB,EAAAA,IAAI,EAAEd;AAbkD,CAA1D;AAeA,eAAeE,aAAf","sourcesContent":["import LineModel from '../../line/models/line';\nimport PointExtrudeModel from '../../point/models/extrude';\nimport PointFillModel from '../../point/models/fill';\nimport IMageModel from '../../point/models/image';\nimport NormalModel from '../../point/models/normal';\nimport TextModel from '../../point/models/text';\nimport PolygonTileModel from '../../tile/models/tileModel';\nimport ExtrudeModel from './extrude';\nimport FillModel from './fill';\nimport Ocean from './ocean';\nimport TilePolygonModel from './tile';\nimport Water from './water';\n\nexport type PolygonModelType =\n | 'fill'\n | 'extrude'\n | 'line'\n | 'point_fill'\n | 'point_image'\n | 'point_normal'\n | 'point_extrude'\n | 'text'\n | 'water'\n | 'ocean'\n | 'vectorpolygon'\n | 'tile';\n\nconst PolygonModels: { [key in PolygonModelType]: any } = {\n fill: FillModel,\n line: LineModel,\n extrude: ExtrudeModel,\n text: TextModel,\n point_fill: PointFillModel,\n point_image: IMageModel,\n point_normal: NormalModel,\n point_extrude: PointExtrudeModel,\n water: Water,\n ocean: Ocean,\n // point_fill: PointModels.fill,\n vectorpolygon: PolygonTileModel,\n tile: TilePolygonModel,\n};\nexport default PolygonModels;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../src/polygon/models/index.ts"],"names":["LineModel","PointExtrudeModel","PointFillModel","IMageModel","NormalModel","TextModel","ExtrudeModel","FillModel","Ocean","Water","PolygonModels","fill","line","extrude","text","point_fill","point_image","point_normal","point_extrude","water","ocean"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,wBAAtB;AACA,OAAOC,iBAAP,MAA8B,4BAA9B;AACA,OAAOC,cAAP,MAA2B,yBAA3B;AACA,OAAOC,UAAP,MAAuB,0BAAvB;AACA,OAAOC,WAAP,MAAwB,2BAAxB;AACA,OAAOC,SAAP,MAAsB,yBAAtB;AACA,OAAOC,YAAP,MAAyB,WAAzB;AACA,OAAOC,SAAP,MAAsB,QAAtB;AACA,OAAOC,KAAP,MAAkB,SAAlB;AACA,OAAOC,KAAP,MAAkB,SAAlB;AAcA,IAAMC,aAAiD,GAAG;AACxDC,EAAAA,IAAI,EAAEJ,SADkD;AAExDK,EAAAA,IAAI,EAAEZ,SAFkD;AAGxDa,EAAAA,OAAO,EAAEP,YAH+C;AAIxDQ,EAAAA,IAAI,EAAET,SAJkD;AAKxDU,EAAAA,UAAU,EAAEb,cAL4C;AAMxDc,EAAAA,WAAW,EAAEb,UAN2C;AAOxDc,EAAAA,YAAY,EAAEb,WAP0C;AAQxDc,EAAAA,aAAa,EAAEjB,iBARyC;AASxDkB,EAAAA,KAAK,EAAEV,KATiD;AAUxDW,EAAAA,KAAK,EAAEZ;AAViD,CAA1D;AAaA,eAAeE,aAAf","sourcesContent":["import LineModel from '../../line/models/line';\nimport PointExtrudeModel from '../../point/models/extrude';\nimport PointFillModel from '../../point/models/fill';\nimport IMageModel from '../../point/models/image';\nimport NormalModel from '../../point/models/normal';\nimport TextModel from '../../point/models/text';\nimport ExtrudeModel from './extrude';\nimport FillModel from './fill';\nimport Ocean from './ocean';\nimport Water from './water';\n\nexport type PolygonModelType =\n | 'fill'\n | 'extrude'\n | 'line'\n | 'point_fill'\n | 'point_image'\n | 'point_normal'\n | 'point_extrude'\n | 'text'\n | 'water'\n | 'ocean';\n\nconst PolygonModels: { [key in PolygonModelType]: any } = {\n fill: FillModel,\n line: LineModel,\n extrude: ExtrudeModel,\n text: TextModel,\n point_fill: PointFillModel,\n point_image: IMageModel,\n point_normal: NormalModel,\n point_extrude: PointExtrudeModel,\n water: Water,\n ocean: Ocean,\n // point_fill: PointModels.fill,\n};\nexport default PolygonModels;\n"],"file":"index.js"}
@@ -1,7 +1,7 @@
1
- import BaseLayer from '../core/BaseLayer';
2
1
  import { IRasterLayerStyleOptions } from '../core/interface';
2
+ import LayerGroup from '../core/LayerGroup';
3
3
  import { RasterModelType } from './models/index';
4
- export default class RaterLayer extends BaseLayer<IRasterLayerStyleOptions> {
4
+ export default class RaterLayer extends LayerGroup<IRasterLayerStyleOptions> {
5
5
  type: string;
6
6
  buildModels(): void;
7
7
  rebuildModels(): void;
@@ -10,11 +10,11 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
10
10
 
11
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; } }
12
12
 
13
- import BaseLayer from '../core/BaseLayer';
13
+ import LayerGroup from '../core/LayerGroup';
14
14
  import RasterModels from './models/index';
15
15
 
16
- var RaterLayer = function (_BaseLayer) {
17
- _inherits(RaterLayer, _BaseLayer);
16
+ var RaterLayer = function (_LayerGroup) {
17
+ _inherits(RaterLayer, _LayerGroup);
18
18
 
19
19
  var _super = _createSuper(RaterLayer);
20
20
 
@@ -87,7 +87,7 @@ var RaterLayer = function (_BaseLayer) {
87
87
  }]);
88
88
 
89
89
  return RaterLayer;
90
- }(BaseLayer);
90
+ }(LayerGroup);
91
91
 
92
92
  export { RaterLayer as default };
93
93
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/raster/index.ts"],"names":["BaseLayer","RasterModels","RaterLayer","modelType","getModelType","layerModel","models","initModels","buildModels","properties","opacity","type","minimum","maximum","defaultConfig","raster","raster3d","rasterTile","layerSource","parser"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,SAAP,MAAsB,mBAAtB;AAEA,OAAOC,YAAP,MAA8C,gBAA9C;;IACqBC,U;;;;;;;;;;;;;;;;2DACG,a;;;;;;;WACtB,uBAAqB;AACnB,UAAMC,SAAS,GAAG,KAAKC,YAAL,EAAlB;AACA,WAAKC,UAAL,GAAkB,IAAIJ,YAAY,CAACE,SAAD,CAAhB,CAA4B,IAA5B,CAAlB;AACA,WAAKG,MAAL,GAAc,KAAKD,UAAL,CAAgBE,UAAhB,EAAd;AACD;;;WACD,yBAAuB;AACrB,WAAKD,MAAL,GAAc,KAAKD,UAAL,CAAgBG,WAAhB,EAAd;AACD;;;WACD,2BAA4B;AAC1B,aAAO;AACLC,QAAAA,UAAU,EAAE;AACVC,UAAAA,OAAO,EAAE;AACPC,YAAAA,IAAI,EAAE,QADC;AAEPC,YAAAA,OAAO,EAAE,CAFF;AAGPC,YAAAA,OAAO,EAAE;AAHF;AADC;AADP,OAAP;AASD;;;WACD,4BAA6B;AAC3B,UAAMF,IAAI,GAAG,KAAKP,YAAL,EAAb;AACA,UAAMU,aAAa,GAAG;AACpBC,QAAAA,MAAM,EAAE,EADY;AAEpBC,QAAAA,QAAQ,EAAE,EAFU;AAGpBC,QAAAA,UAAU,EAAE;AAHQ,OAAtB;AAKA,aAAOH,aAAa,CAACH,IAAD,CAApB;AACD;;;WAED,wBAA0C;AAExC,cAAQ,KAAKO,WAAL,CAAiBC,MAAjB,CAAwBR,IAAhC;AACE,aAAK,QAAL;AACE,iBAAO,QAAP;;AACF,aAAK,YAAL;AACE,iBAAO,YAAP;;AACF;AACE,iBAAO,QAAP;AANJ;AASD;;;;EA1CqCX,S;;SAAnBE,U","sourcesContent":["import BaseLayer from '../core/BaseLayer';\nimport { IRasterLayerStyleOptions } from '../core/interface';\nimport RasterModels, { RasterModelType } from './models/index';\nexport default class RaterLayer extends BaseLayer<IRasterLayerStyleOptions> {\n public type: string = 'RasterLayer';\n public buildModels() {\n const modelType = this.getModelType();\n this.layerModel = new RasterModels[modelType](this);\n this.models = this.layerModel.initModels();\n }\n public rebuildModels() {\n this.models = this.layerModel.buildModels();\n }\n protected getConfigSchema() {\n return {\n properties: {\n opacity: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n },\n },\n };\n }\n protected getDefaultConfig() {\n const type = this.getModelType();\n const defaultConfig = {\n raster: {},\n raster3d: {},\n rasterTile: {},\n };\n return defaultConfig[type];\n }\n\n protected getModelType(): RasterModelType {\n // 根据 source 的类型判断 model type\n switch (this.layerSource.parser.type) {\n case 'raster':\n return 'raster';\n case 'rasterTile':\n return 'rasterTile';\n default:\n return 'raster';\n }\n // return 'raster';\n }\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/raster/index.ts"],"names":["LayerGroup","RasterModels","RaterLayer","modelType","getModelType","layerModel","models","initModels","buildModels","properties","opacity","type","minimum","maximum","defaultConfig","raster","raster3d","rasterTile","layerSource","parser"],"mappings":";;;;;;;;;;;;AACA,OAAOA,UAAP,MAAuB,oBAAvB;AACA,OAAOC,YAAP,MAA8C,gBAA9C;;IACqBC,U;;;;;;;;;;;;;;;;2DACG,a;;;;;;;WACtB,uBAAqB;AACnB,UAAMC,SAAS,GAAG,KAAKC,YAAL,EAAlB;AACA,WAAKC,UAAL,GAAkB,IAAIJ,YAAY,CAACE,SAAD,CAAhB,CAA4B,IAA5B,CAAlB;AACA,WAAKG,MAAL,GAAc,KAAKD,UAAL,CAAgBE,UAAhB,EAAd;AACD;;;WACD,yBAAuB;AACrB,WAAKD,MAAL,GAAc,KAAKD,UAAL,CAAgBG,WAAhB,EAAd;AACD;;;WACD,2BAA4B;AAC1B,aAAO;AACLC,QAAAA,UAAU,EAAE;AACVC,UAAAA,OAAO,EAAE;AACPC,YAAAA,IAAI,EAAE,QADC;AAEPC,YAAAA,OAAO,EAAE,CAFF;AAGPC,YAAAA,OAAO,EAAE;AAHF;AADC;AADP,OAAP;AASD;;;WACD,4BAA6B;AAC3B,UAAMF,IAAI,GAAG,KAAKP,YAAL,EAAb;AACA,UAAMU,aAAa,GAAG;AACpBC,QAAAA,MAAM,EAAE,EADY;AAEpBC,QAAAA,QAAQ,EAAE,EAFU;AAGpBC,QAAAA,UAAU,EAAE;AAHQ,OAAtB;AAKA,aAAOH,aAAa,CAACH,IAAD,CAApB;AACD;;;WAED,wBAA0C;AAExC,cAAQ,KAAKO,WAAL,CAAiBC,MAAjB,CAAwBR,IAAhC;AACE,aAAK,QAAL;AACE,iBAAO,QAAP;;AACF,aAAK,YAAL;AACE,iBAAO,YAAP;;AACF;AACE,iBAAO,QAAP;AANJ;AASD;;;;EA1CqCX,U;;SAAnBE,U","sourcesContent":["import { IRasterLayerStyleOptions } from '../core/interface';\nimport LayerGroup from '../core/LayerGroup';\nimport RasterModels, { RasterModelType } from './models/index';\nexport default class RaterLayer extends LayerGroup<IRasterLayerStyleOptions> {\n public type: string = 'RasterLayer';\n public buildModels() {\n const modelType = this.getModelType();\n this.layerModel = new RasterModels[modelType](this);\n this.models = this.layerModel.initModels();\n }\n public rebuildModels() {\n this.models = this.layerModel.buildModels();\n }\n protected getConfigSchema() {\n return {\n properties: {\n opacity: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n },\n },\n };\n }\n protected getDefaultConfig() {\n const type = this.getModelType();\n const defaultConfig = {\n raster: {},\n raster3d: {},\n rasterTile: {},\n };\n return defaultConfig[type];\n }\n\n protected getModelType(): RasterModelType {\n // 根据 source 的类型判断 model type\n switch (this.layerSource.parser.type) {\n case 'raster':\n return 'raster';\n case 'rasterTile':\n return 'rasterTile';\n default:\n return 'raster';\n }\n // return 'raster';\n }\n}\n"],"file":"index.js"}
@@ -1,4 +1,4 @@
1
- import RasterTileModel from '../../tile/models/tileModel';
1
+ import RasterTileModel from './raste-tile';
2
2
  import RasterModel from './raster';
3
3
  var RasterModels = {
4
4
  raster: RasterModel,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/raster/models/index.ts"],"names":["RasterTileModel","RasterModel","RasterModels","raster","raster3d","rasterTile"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,6BAA5B;AACA,OAAOC,WAAP,MAAwB,UAAxB;AAGA,IAAMC,YAA+C,GAAG;AACtDC,EAAAA,MAAM,EAAEF,WAD8C;AAEtDG,EAAAA,QAAQ,EAAEH,WAF4C;AAGtDI,EAAAA,UAAU,EAAEL;AAH0C,CAAxD;AAMA,eAAeE,YAAf","sourcesContent":["import RasterTileModel from '../../tile/models/tileModel';\nimport RasterModel from './raster';\nexport type RasterModelType = 'raster' | 'raster3d' | 'rasterTile';\n\nconst RasterModels: { [key in RasterModelType]: any } = {\n raster: RasterModel,\n raster3d: RasterModel,\n rasterTile: RasterTileModel,\n};\n\nexport default RasterModels;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../src/raster/models/index.ts"],"names":["RasterTileModel","RasterModel","RasterModels","raster","raster3d","rasterTile"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,cAA5B;AACA,OAAOC,WAAP,MAAwB,UAAxB;AAGA,IAAMC,YAA+C,GAAG;AACtDC,EAAAA,MAAM,EAAEF,WAD8C;AAEtDG,EAAAA,QAAQ,EAAEH,WAF4C;AAGtDI,EAAAA,UAAU,EAAEL;AAH0C,CAAxD;AAMA,eAAeE,YAAf","sourcesContent":["import RasterTileModel from './raste-tile';\nimport RasterModel from './raster';\nexport type RasterModelType = 'raster' | 'raster3d' | 'rasterTile';\n\nconst RasterModels: { [key in RasterModelType]: any } = {\n raster: RasterModel,\n raster3d: RasterModel,\n rasterTile: RasterTileModel,\n};\n\nexport default RasterModels;\n"],"file":"index.js"}
@@ -0,0 +1,23 @@
1
+ import { IModelUniform } from '@antv/l7-core';
2
+ import { TilesetManager } from '@antv/l7-utils';
3
+ import BaseModel from '../../core/BaseModel';
4
+ export default class RasterTileModel extends BaseModel {
5
+ initedTileset: boolean;
6
+ tilesetManager: TilesetManager | undefined;
7
+ showGrid: boolean;
8
+ private subGridLayer;
9
+ private subTextLayer;
10
+ private lastViewStates;
11
+ private timer;
12
+ getUninforms(): IModelUniform;
13
+ initModels(): never[];
14
+ buildModels(): never[];
15
+ clearModels(): void;
16
+ renderSubGridLayer(): void;
17
+ protected registerBuiltinAttributes(): void;
18
+ private bindTilesetEvent;
19
+ private creatSubLayer;
20
+ private renderSubLayers;
21
+ private destroySubLayer;
22
+ private getCurrentView;
23
+ }
@@ -0,0 +1,285 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
+ import _inherits from "@babel/runtime/helpers/inherits";
5
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
+
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); }; }
10
+
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; } }
12
+
13
+ import { createLayerContainer } from '@antv/l7-core';
14
+ import BaseModel from '../../core/BaseModel';
15
+ import ImageLayer from '../../image';
16
+ import LineLayer from '../../line';
17
+ import PointLayer from '../../point';
18
+
19
+ var RasterTileModel = function (_BaseModel) {
20
+ _inherits(RasterTileModel, _BaseModel);
21
+
22
+ var _super = _createSuper(RasterTileModel);
23
+
24
+ function RasterTileModel() {
25
+ var _this;
26
+
27
+ _classCallCheck(this, RasterTileModel);
28
+
29
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
30
+ args[_key] = arguments[_key];
31
+ }
32
+
33
+ _this = _super.call.apply(_super, [this].concat(args));
34
+
35
+ _defineProperty(_assertThisInitialized(_this), "initedTileset", false);
36
+
37
+ _defineProperty(_assertThisInitialized(_this), "tilesetManager", void 0);
38
+
39
+ _defineProperty(_assertThisInitialized(_this), "showGrid", false);
40
+
41
+ _defineProperty(_assertThisInitialized(_this), "subGridLayer", void 0);
42
+
43
+ _defineProperty(_assertThisInitialized(_this), "subTextLayer", void 0);
44
+
45
+ _defineProperty(_assertThisInitialized(_this), "lastViewStates", void 0);
46
+
47
+ _defineProperty(_assertThisInitialized(_this), "timer", void 0);
48
+
49
+ _defineProperty(_assertThisInitialized(_this), "renderSubLayers", function () {
50
+ if (!_this.tilesetManager) {
51
+ return;
52
+ }
53
+
54
+ var rasteTileLayer = _this.layer;
55
+
56
+ _this.tilesetManager.tiles.filter(function (tile) {
57
+ return tile.isLoaded;
58
+ }).map(function (tile) {
59
+ if (!tile.layer) {
60
+ tile.layer = _this.creatSubLayer(tile);
61
+ rasteTileLayer.addChild(tile.layer);
62
+ } else {
63
+ tile.layer.updateLayerConfig({
64
+ visible: tile.isVisible
65
+ });
66
+ }
67
+
68
+ return tile.layer;
69
+ });
70
+
71
+ if (_this.showGrid) {
72
+ if (!rasteTileLayer.hasChild(_this.subGridLayer)) {
73
+ rasteTileLayer.addChild(_this.subGridLayer);
74
+ }
75
+
76
+ if (!rasteTileLayer.hasChild(_this.subTextLayer)) {
77
+ rasteTileLayer.addChild(_this.subTextLayer);
78
+ }
79
+ }
80
+
81
+ _this.layerService.renderLayers();
82
+
83
+ if (_this.tilesetManager.isLoaded) {
84
+ rasteTileLayer.emit('tiles-loaded', _this.tilesetManager.currentTiles);
85
+ }
86
+ });
87
+
88
+ return _this;
89
+ }
90
+
91
+ _createClass(RasterTileModel, [{
92
+ key: "getUninforms",
93
+ value: function getUninforms() {
94
+ return {};
95
+ }
96
+ }, {
97
+ key: "initModels",
98
+ value: function initModels() {
99
+ var _this$tilesetManager;
100
+
101
+ var source = this.layer.getSource();
102
+ this.tilesetManager = source.tileset;
103
+
104
+ if (!this.initedTileset) {
105
+ this.bindTilesetEvent();
106
+ this.initedTileset = true;
107
+ }
108
+
109
+ var _this$getCurrentView = this.getCurrentView(),
110
+ latLonBounds = _this$getCurrentView.latLonBounds,
111
+ zoom = _this$getCurrentView.zoom;
112
+
113
+ (_this$tilesetManager = this.tilesetManager) === null || _this$tilesetManager === void 0 ? void 0 : _this$tilesetManager.update(zoom, latLonBounds);
114
+
115
+ if (this.showGrid) {
116
+ this.renderSubGridLayer();
117
+ }
118
+
119
+ return this.buildModels();
120
+ }
121
+ }, {
122
+ key: "buildModels",
123
+ value: function buildModels() {
124
+ return [];
125
+ }
126
+ }, {
127
+ key: "clearModels",
128
+ value: function clearModels() {}
129
+ }, {
130
+ key: "renderSubGridLayer",
131
+ value: function renderSubGridLayer() {
132
+ if (!this.tilesetManager) {
133
+ return;
134
+ }
135
+
136
+ var features = this.tilesetManager.currentTiles.map(function (tile) {
137
+ return tile.bboxPolygon;
138
+ });
139
+ var data = {
140
+ type: 'FeatureCollection',
141
+ features: features
142
+ };
143
+
144
+ if (this.subGridLayer) {
145
+ this.subGridLayer.setData(data);
146
+ this.subTextLayer.setData(data);
147
+ return;
148
+ }
149
+
150
+ this.subGridLayer = new LineLayer({
151
+ autoFit: false
152
+ }).source(data).size(1).color('red').shape('simple').style({
153
+ lineType: 'dash',
154
+ dashArray: [1, 2]
155
+ });
156
+ this.subTextLayer = new PointLayer({
157
+ autoFit: false
158
+ }).source(data).size(14).color('red').shape('meta', 'text').style({
159
+ opacity: 1,
160
+ strokeWidth: 1,
161
+ stroke: '#fff'
162
+ });
163
+ this.subGridLayer.setContainer(createLayerContainer(this.layer.sceneContainer), this.layer.sceneContainer);
164
+ this.subTextLayer.setContainer(createLayerContainer(this.layer.sceneContainer), this.layer.sceneContainer);
165
+ this.subGridLayer.init();
166
+ this.subTextLayer.init();
167
+ }
168
+ }, {
169
+ key: "registerBuiltinAttributes",
170
+ value: function registerBuiltinAttributes() {}
171
+ }, {
172
+ key: "bindTilesetEvent",
173
+ value: function bindTilesetEvent() {
174
+ var _this2 = this;
175
+
176
+ if (!this.tilesetManager) {
177
+ return;
178
+ }
179
+
180
+ this.tilesetManager.on('tile-loaded', function (tile) {});
181
+ this.tilesetManager.on('tile-unload', function (tile) {
182
+ _this2.destroySubLayer(tile);
183
+ });
184
+ this.tilesetManager.on('tile-error', function (error, tile) {});
185
+ this.tilesetManager.on('tile-update', this.renderSubLayers);
186
+ this.mapService.on('mapchange', function (e) {
187
+ var _this2$getCurrentView = _this2.getCurrentView(),
188
+ latLonBounds = _this2$getCurrentView.latLonBounds,
189
+ zoom = _this2$getCurrentView.zoom;
190
+
191
+ if (_this2.mapService.version === 'GAODE1.x') {
192
+ var _this2$layer$getLayer = _this2.layer.getLayerConfig(),
193
+ visible = _this2$layer$getLayer.visible;
194
+
195
+ if (zoom < 3 && visible) {
196
+ _this2.layer.updateLayerConfig({
197
+ visible: false
198
+ });
199
+
200
+ _this2.layerService.updateLayerRenderList();
201
+ } else if (zoom >= 3 && !visible) {
202
+ _this2.layer.updateLayerConfig({
203
+ visible: true
204
+ });
205
+
206
+ _this2.layerService.updateLayerRenderList();
207
+ }
208
+ }
209
+
210
+ if (_this2.lastViewStates && _this2.lastViewStates.zoom === zoom && _this2.lastViewStates.latLonBounds.toString() === latLonBounds.toString()) {
211
+ return;
212
+ }
213
+
214
+ _this2.lastViewStates = {
215
+ zoom: zoom,
216
+ latLonBounds: latLonBounds
217
+ };
218
+
219
+ if (_this2.timer) {
220
+ clearTimeout(_this2.timer);
221
+ _this2.timer = null;
222
+ }
223
+
224
+ _this2.timer = setTimeout(function () {
225
+ var _this2$tilesetManager;
226
+
227
+ (_this2$tilesetManager = _this2.tilesetManager) === null || _this2$tilesetManager === void 0 ? void 0 : _this2$tilesetManager.update(zoom, latLonBounds);
228
+
229
+ if (_this2.showGrid) {
230
+ _this2.renderSubGridLayer();
231
+ }
232
+ }, 250);
233
+ });
234
+ }
235
+ }, {
236
+ key: "creatSubLayer",
237
+ value: function creatSubLayer(tile) {
238
+ var _ref = this.layer.getLayerConfig(),
239
+ _ref$opacity = _ref.opacity,
240
+ opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
241
+ _ref$zIndex = _ref.zIndex,
242
+ zIndex = _ref$zIndex === void 0 ? 0 : _ref$zIndex;
243
+
244
+ var layer = new ImageLayer({
245
+ visible: tile.isVisible,
246
+ zIndex: zIndex
247
+ }).source(tile.data, {
248
+ parser: {
249
+ type: 'image',
250
+ extent: tile.bounds
251
+ }
252
+ }).style({
253
+ opacity: opacity
254
+ });
255
+ var container = createLayerContainer(this.layer.sceneContainer);
256
+ layer.setContainer(container, this.layer.sceneContainer);
257
+ layer.init();
258
+ return layer;
259
+ }
260
+ }, {
261
+ key: "destroySubLayer",
262
+ value: function destroySubLayer(tile) {
263
+ if (tile.layer) {
264
+ var layerGroup = this.layer;
265
+ layerGroup.removeChild(tile.layer);
266
+ }
267
+ }
268
+ }, {
269
+ key: "getCurrentView",
270
+ value: function getCurrentView() {
271
+ var bounds = this.mapService.getBounds();
272
+ var latLonBounds = [bounds[0][0], bounds[0][1], bounds[1][0], bounds[1][1]];
273
+ var zoom = this.mapService.getZoom();
274
+ return {
275
+ latLonBounds: latLonBounds,
276
+ zoom: zoom
277
+ };
278
+ }
279
+ }]);
280
+
281
+ return RasterTileModel;
282
+ }(BaseModel);
283
+
284
+ export { RasterTileModel as default };
285
+ //# sourceMappingURL=raste-tile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/raster/models/raste-tile.ts"],"names":["createLayerContainer","BaseModel","ImageLayer","LineLayer","PointLayer","RasterTileModel","tilesetManager","rasteTileLayer","layer","tiles","filter","tile","isLoaded","map","creatSubLayer","addChild","updateLayerConfig","visible","isVisible","showGrid","hasChild","subGridLayer","subTextLayer","layerService","renderLayers","emit","currentTiles","source","getSource","tileset","initedTileset","bindTilesetEvent","getCurrentView","latLonBounds","zoom","update","renderSubGridLayer","buildModels","features","bboxPolygon","data","type","setData","autoFit","size","color","shape","style","lineType","dashArray","opacity","strokeWidth","stroke","setContainer","sceneContainer","init","on","destroySubLayer","error","renderSubLayers","mapService","e","version","getLayerConfig","updateLayerRenderList","lastViewStates","toString","timer","clearTimeout","setTimeout","zIndex","parser","extent","bounds","container","layerGroup","removeChild","getBounds","getZoom"],"mappings":";;;;;;;;;;;;AAAA,SACEA,oBADF,QAKO,eALP;AAQA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,OAAOC,UAAP,MAAuB,aAAvB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,aAAvB;;IAEqBC,e;;;;;;;;;;;;;;;;oEAEI,K;;;;+DAIL,K;;;;;;;;;;sEA0LQ,YAAM;AAC9B,UAAI,CAAC,MAAKC,cAAV,EAA0B;AACxB;AACD;;AAED,UAAMC,cAAc,GAAG,MAAKC,KAA5B;;AAEA,YAAKF,cAAL,CAAoBG,KAApB,CACGC,MADH,CACU,UAACC,IAAD;AAAA,eAAUA,IAAI,CAACC,QAAf;AAAA,OADV,EAEGC,GAFH,CAEO,UAACF,IAAD,EAAU;AACb,YAAI,CAACA,IAAI,CAACH,KAAV,EAAiB;AACfG,UAAAA,IAAI,CAACH,KAAL,GAAa,MAAKM,aAAL,CAAmBH,IAAnB,CAAb;AACAJ,UAAAA,cAAc,CAACQ,QAAf,CAAwBJ,IAAI,CAACH,KAA7B;AACD,SAHD,MAGO;AAELG,UAAAA,IAAI,CAACH,KAAL,CAAWQ,iBAAX,CAA6B;AAC3BC,YAAAA,OAAO,EAAEN,IAAI,CAACO;AADa,WAA7B;AAGD;;AACD,eAAOP,IAAI,CAACH,KAAZ;AACD,OAbH;;AAeA,UAAI,MAAKW,QAAT,EAAmB;AACjB,YAAI,CAACZ,cAAc,CAACa,QAAf,CAAwB,MAAKC,YAA7B,CAAL,EAAiD;AAC/Cd,UAAAA,cAAc,CAACQ,QAAf,CAAwB,MAAKM,YAA7B;AACD;;AACD,YAAI,CAACd,cAAc,CAACa,QAAf,CAAwB,MAAKE,YAA7B,CAAL,EAAiD;AAC/Cf,UAAAA,cAAc,CAACQ,QAAf,CAAwB,MAAKO,YAA7B;AACD;AACF;;AAED,YAAKC,YAAL,CAAkBC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A9C,MAAAA,KAAK,CAAC+C,IAAN;AAEA,aAAO/C,KAAP;AACD;;;WA2CD,yBAAwBG,IAAxB,EAAoC;AAClC,UAAIA,IAAI,CAACH,KAAT,EAAgB;AACd,YAAMmE,UAAU,GAAG,KAAKnE,KAAxB;AACAmE,QAAAA,UAAU,CAACC,WAAX,CAAuBjE,IAAI,CAACH,KAA5B;AACD;AACF;;;WAGD,0BAAyB;AACvB,UAAMiE,MAAM,GAAG,KAAKb,UAAL,CAAgBiB,SAAhB,EAAf;AACA,UAAM5C,YAA8C,GAAG,CACrDwC,MAAM,CAAC,CAAD,CAAN,CAAU,CAAV,CADqD,EAErDA,MAAM,CAAC,CAAD,CAAN,CAAU,CAAV,CAFqD,EAGrDA,MAAM,CAAC,CAAD,CAAN,CAAU,CAAV,CAHqD,EAIrDA,MAAM,CAAC,CAAD,CAAN,CAAU,CAAV,CAJqD,CAAvD;AAMA,UAAMvC,IAAI,GAAG,KAAK0B,UAAL,CAAgBkB,OAAhB,EAAb;AAEA,aAAO;AAAE7C,QAAAA,YAAY,EAAZA,YAAF;AAAgBC,QAAAA,IAAI,EAAJA;AAAhB,OAAP;AACD;;;;EA3P0CjC,S;;SAAxBI,e","sourcesContent":["import {\n createLayerContainer,\n ILayer,\n ILayerGroup,\n IModelUniform,\n} from '@antv/l7-core';\nimport { Tile, TilesetManager } from '@antv/l7-utils';\nimport { Container } from 'inversify';\nimport BaseModel from '../../core/BaseModel';\nimport { IRasterTileLayerStyleOptions } from '../../core/interface';\nimport ImageLayer from '../../image';\nimport LineLayer from '../../line';\nimport PointLayer from '../../point';\n\nexport default class RasterTileModel extends BaseModel {\n // 瓦片是否加载成功\n public initedTileset = false;\n // 瓦片数据管理器\n public tilesetManager: TilesetManager | undefined;\n // 是否开启瓦片网格子图层,用于调试\n public showGrid = false;\n // 瓦片网格子图层,用于调试\n private subGridLayer: ILayer;\n // 瓦片网格文本子图层,用于调试\n private subTextLayer: ILayer;\n // 上一次视野状态\n private lastViewStates: {\n zoom: number;\n latLonBounds: [number, number, number, number];\n };\n private timer: any;\n\n public getUninforms(): IModelUniform {\n return {};\n }\n\n public initModels() {\n const source = this.layer.getSource();\n this.tilesetManager = source.tileset;\n\n if (!this.initedTileset) {\n this.bindTilesetEvent();\n this.initedTileset = true;\n }\n\n const { latLonBounds, zoom } = this.getCurrentView();\n this.tilesetManager?.update(zoom, latLonBounds);\n\n if (this.showGrid) {\n this.renderSubGridLayer();\n }\n\n return this.buildModels();\n }\n\n public buildModels() {\n return [];\n }\n\n public clearModels() {\n //\n }\n\n // 渲染瓦片网格图层方便调试\n public renderSubGridLayer() {\n if (!this.tilesetManager) {\n return;\n }\n\n const features = this.tilesetManager.currentTiles.map(\n (tile) => tile.bboxPolygon,\n );\n\n const data = { type: 'FeatureCollection', features };\n\n if (this.subGridLayer) {\n this.subGridLayer.setData(data);\n this.subTextLayer.setData(data);\n return;\n }\n\n this.subGridLayer = new LineLayer({ autoFit: false })\n .source(data)\n .size(1)\n .color('red')\n .shape('simple')\n .style({ lineType: 'dash', dashArray: [1, 2] });\n\n this.subTextLayer = new PointLayer({ autoFit: false })\n .source(data)\n .size(14)\n .color('red')\n .shape('meta', 'text')\n .style({\n opacity: 1,\n strokeWidth: 1,\n stroke: '#fff',\n });\n\n this.subGridLayer.setContainer(\n createLayerContainer(this.layer.sceneContainer as Container),\n this.layer.sceneContainer as Container,\n );\n this.subTextLayer.setContainer(\n createLayerContainer(this.layer.sceneContainer as Container),\n this.layer.sceneContainer as Container,\n );\n this.subGridLayer.init();\n this.subTextLayer.init();\n }\n\n protected registerBuiltinAttributes() {\n //\n }\n\n // 监听瓦片管理器\n private bindTilesetEvent() {\n if (!this.tilesetManager) {\n return;\n }\n // 瓦片数据加载成功\n this.tilesetManager.on('tile-loaded', (tile: Tile) => {\n // todo: 将事件抛出,图层上可以监听使用\n });\n\n // 瓦片数据从缓存删除或被执行重新加载\n this.tilesetManager.on('tile-unload', (tile: Tile) => {\n // todo: 将事件抛出,图层上可以监听使用\n this.destroySubLayer(tile);\n });\n\n // 瓦片数据加载失败\n this.tilesetManager.on('tile-error', (error, tile: Tile) => {\n // todo: 将事件抛出,图层上可以监听使用\n });\n\n // 瓦片显隐状态更新\n this.tilesetManager.on('tile-update', this.renderSubLayers);\n\n // 地图视野发生改变\n this.mapService.on('mapchange', (e) => {\n const { latLonBounds, zoom } = this.getCurrentView();\n\n if (this.mapService.version === 'GAODE1.x') {\n const { visible } = this.layer.getLayerConfig();\n if (zoom < 3 && visible) {\n this.layer.updateLayerConfig({ visible: false });\n this.layerService.updateLayerRenderList();\n } else if (zoom >= 3 && !visible) {\n this.layer.updateLayerConfig({ visible: true });\n this.layerService.updateLayerRenderList();\n }\n }\n\n if (\n this.lastViewStates &&\n this.lastViewStates.zoom === zoom &&\n this.lastViewStates.latLonBounds.toString() === latLonBounds.toString()\n ) {\n return;\n }\n this.lastViewStates = { zoom, latLonBounds };\n\n if (this.timer) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n\n this.timer = setTimeout(() => {\n this.tilesetManager?.update(zoom, latLonBounds);\n if (this.showGrid) {\n this.renderSubGridLayer();\n }\n }, 250);\n });\n }\n\n // 创建子图层\n private creatSubLayer(tile: Tile) {\n const {\n opacity = 1,\n zIndex = 0,\n } = this.layer.getLayerConfig() as IRasterTileLayerStyleOptions;\n const layer = new ImageLayer({\n visible: tile.isVisible,\n zIndex,\n })\n .source(tile.data, {\n parser: {\n type: 'image',\n extent: tile.bounds,\n },\n })\n .style({\n opacity,\n });\n const container = createLayerContainer(\n this.layer.sceneContainer as Container,\n );\n layer.setContainer(container, this.layer.sceneContainer as Container);\n layer.init();\n\n return layer;\n }\n\n // 更新子图层\n private renderSubLayers = () => {\n if (!this.tilesetManager) {\n return;\n }\n\n const rasteTileLayer = this.layer as ILayerGroup;\n\n this.tilesetManager.tiles\n .filter((tile) => tile.isLoaded)\n .map((tile) => {\n if (!tile.layer) {\n tile.layer = this.creatSubLayer(tile);\n rasteTileLayer.addChild(tile.layer);\n } else {\n // 显隐藏控制\n tile.layer.updateLayerConfig({\n visible: tile.isVisible,\n });\n }\n return tile.layer;\n });\n\n if (this.showGrid) {\n if (!rasteTileLayer.hasChild(this.subGridLayer)) {\n rasteTileLayer.addChild(this.subGridLayer);\n }\n if (!rasteTileLayer.hasChild(this.subTextLayer)) {\n rasteTileLayer.addChild(this.subTextLayer);\n }\n }\n\n this.layerService.renderLayers();\n\n if (this.tilesetManager.isLoaded) {\n // 将事件抛出,图层上可以使用瓦片\n rasteTileLayer.emit('tiles-loaded', this.tilesetManager.currentTiles);\n }\n };\n\n // 摧毁子图层\n private destroySubLayer(tile: Tile) {\n if (tile.layer) {\n const layerGroup = this.layer as ILayerGroup;\n layerGroup.removeChild(tile.layer);\n }\n }\n\n // 获取当前视野参数\n private getCurrentView() {\n const bounds = this.mapService.getBounds();\n const latLonBounds: [number, number, number, number] = [\n bounds[0][0],\n bounds[0][1],\n bounds[1][0],\n bounds[1][1],\n ];\n const zoom = this.mapService.getZoom();\n\n return { latLonBounds, zoom };\n }\n}\n"],"file":"raste-tile.js"}
@@ -3,7 +3,6 @@ import BaseModel from '../../core/BaseModel';
3
3
  export default class RasterModel extends BaseModel {
4
4
  protected texture: ITexture2D;
5
5
  protected colorTexture: ITexture2D;
6
- private rampColors;
7
6
  getUninforms(): {
8
7
  u_opacity: number;
9
8
  u_texture: ITexture2D;
@@ -15,7 +14,6 @@ export default class RasterModel extends BaseModel {
15
14
  };
16
15
  initModels(): import("@antv/l7-core").IModel[];
17
16
  buildModels(): import("@antv/l7-core").IModel[];
18
- clearModels(): void;
19
17
  protected registerBuiltinAttributes(): void;
20
18
  private updateColorTexure;
21
19
  }
@@ -5,7 +5,6 @@ import _inherits from "@babel/runtime/helpers/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- import _isEqual from "lodash/isEqual";
9
8
 
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
10
 
@@ -38,8 +37,6 @@ var RasterModel = function (_BaseModel) {
38
37
 
39
38
  _defineProperty(_assertThisInitialized(_this), "colorTexture", void 0);
40
39
 
41
- _defineProperty(_assertThisInitialized(_this), "rampColors", void 0);
42
-
43
40
  return _this;
44
41
  }
45
42
 
@@ -56,14 +53,9 @@ var RasterModel = function (_BaseModel) {
56
53
  _ref$noDataValue = _ref.noDataValue,
57
54
  noDataValue = _ref$noDataValue === void 0 ? -9999999 : _ref$noDataValue,
58
55
  _ref$domain = _ref.domain,
59
- domain = _ref$domain === void 0 ? [0, 1] : _ref$domain,
60
- rampColors = _ref.rampColors;
61
-
62
- if (!_isEqual(this.rampColors, rampColors)) {
63
- this.updateColorTexure();
64
- this.rampColors = rampColors;
65
- }
56
+ domain = _ref$domain === void 0 ? [0, 1] : _ref$domain;
66
57
 
58
+ this.updateColorTexure();
67
59
  return {
68
60
  u_opacity: opacity || 1,
69
61
  u_texture: this.texture,
@@ -77,13 +69,13 @@ var RasterModel = function (_BaseModel) {
77
69
  }, {
78
70
  key: "initModels",
79
71
  value: function initModels() {
72
+ this.layer.isLayerGroup = false;
73
+
80
74
  var _ref2 = this.layer.getLayerConfig(),
81
75
  _ref2$mask = _ref2.mask,
82
76
  mask = _ref2$mask === void 0 ? false : _ref2$mask,
83
77
  _ref2$maskInside = _ref2.maskInside,
84
- maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside,
85
- rampColorsData = _ref2.rampColorsData,
86
- rampColors = _ref2.rampColors;
78
+ maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside;
87
79
 
88
80
  var source = this.layer.getSource();
89
81
  var createTexture2D = this.rendererService.createTexture2D;
@@ -95,7 +87,11 @@ var RasterModel = function (_BaseModel) {
95
87
  format: gl.LUMINANCE,
96
88
  type: gl.FLOAT
97
89
  });
98
- var imageData = rampColorsData ? rampColorsData : generateColorRamp(rampColors);
90
+
91
+ var _ref3 = this.layer.getLayerConfig(),
92
+ rampColors = _ref3.rampColors;
93
+
94
+ var imageData = generateColorRamp(rampColors);
99
95
  this.colorTexture = createTexture2D({
100
96
  data: imageData.data,
101
97
  width: imageData.width,
@@ -120,14 +116,6 @@ var RasterModel = function (_BaseModel) {
120
116
  value: function buildModels() {
121
117
  return this.initModels();
122
118
  }
123
- }, {
124
- key: "clearModels",
125
- value: function clearModels() {
126
- var _this$texture, _this$colorTexture;
127
-
128
- (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
129
- (_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0 ? void 0 : _this$colorTexture.destroy();
130
- }
131
119
  }, {
132
120
  key: "registerBuiltinAttributes",
133
121
  value: function registerBuiltinAttributes() {
@@ -153,8 +141,8 @@ var RasterModel = function (_BaseModel) {
153
141
  value: function updateColorTexure() {
154
142
  var createTexture2D = this.rendererService.createTexture2D;
155
143
 
156
- var _ref3 = this.layer.getLayerConfig(),
157
- rampColors = _ref3.rampColors;
144
+ var _ref4 = this.layer.getLayerConfig(),
145
+ rampColors = _ref4.rampColors;
158
146
 
159
147
  var imageData = generateColorRamp(rampColors);
160
148
  this.colorTexture = createTexture2D({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/raster/models/raster.ts"],"names":["AttributeType","gl","generateColorRamp","getMask","BaseModel","RasterImageTriangulation","RasterModel","layer","getLayerConfig","opacity","clampLow","clampHigh","noDataValue","domain","rampColors","updateColorTexure","u_opacity","u_texture","texture","u_domain","u_clampLow","u_clampHigh","u_noDataValue","u_colorTexture","colorTexture","mask","maskInside","rampColorsData","source","getSource","createTexture2D","rendererService","parserDataItem","data","dataArray","width","height","format","LUMINANCE","type","FLOAT","imageData","flipY","buildLayerModel","moduleName","vertexShader","rasterVert","fragmentShader","rasterFrag","triangulation","primitive","TRIANGLES","depth","enable","blend","getBlend","stencil","initModels","destroy","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx"],"mappings":";;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAOO,eAPP;AAQA,SAASC,iBAAT,EAA4BC,OAA5B,QAAuD,gBAAvD;AAEA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,wBAAT,QAAyC,0BAAzC;;;;IAGqBC,W;;;;;;;;;;;;;;;;;;;;;;;;;;;WAInB,wBAAsB;AACpB,iBAOI,KAAKC,KAAL,CAAWC,cAAX,EAPJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,+BAEEC,QAFF;AAAA,UAEEA,QAFF,8BAEa,IAFb;AAAA,gCAGEC,SAHF;AAAA,UAGEA,SAHF,+BAGc,IAHd;AAAA,kCAIEC,WAJF;AAAA,UAIEA,WAJF,iCAIgB,CAAC,OAJjB;AAAA,6BAKEC,MALF;AAAA,UAKEA,MALF,4BAKW,CAAC,CAAD,EAAI,CAAJ,CALX;AAAA,UAMEC,UANF,QAMEA,UANF;;AAQA,UAAI,CAAC,SAAQ,KAAKA,UAAb,EAAyBA,UAAzB,CAAL,EAA2C;AACzC,aAAKC,iBAAL;AACA,aAAKD,UAAL,GAAkBA,UAAlB;AACD;;AAED,aAAO;AACLE,QAAAA,SAAS,EAAEP,OAAO,IAAI,CADjB;AAELQ,QAAAA,SAAS,EAAE,KAAKC,OAFX;AAGLC,QAAAA,QAAQ,EAAEN,MAHL;AAILO,QAAAA,UAAU,EAAEV,QAJP;AAKLW,QAAAA,WAAW,EAAE,OAAOV,SAAP,KAAqB,WAArB,GAAmCA,SAAnC,GAA+CD,QALvD;AAMLY,QAAAA,aAA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AAGvC,iBAAiB,CAACY,UAAD,CAAnC;AACA,WAAKU,YAAL,GAAoBM,eAAe,CAAC;AAClCG,QAAAA,IAAI,EAAEQ,SAAS,CAACR,IADkB;AAElCE,QAAAA,KAAK,EAAEM,SAAS,CAACN,KAFiB;AAGlCC,QAAAA,MAAM,EAAEK,SAAS,CAACL,MAHgB;AAIlCM,QAAAA,KAAK,EAAE;AAJ2B,OAAD,CAAnC;AAMD;;;;EArHsCtC,S;;SAApBE,W","sourcesContent":["import {\n AttributeType,\n gl,\n IEncodeFeature,\n ITexture2D,\n lazyInject,\n TYPES,\n} from '@antv/l7-core';\nimport { generateColorRamp, getMask, IColorRamp } from '@antv/l7-utils';\nimport { isEqual } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { IRasterLayerStyleOptions } from '../../core/interface';\nimport { RasterImageTriangulation } from '../../core/triangulation';\nimport rasterFrag from '../shaders/raster_2d_frag.glsl';\nimport rasterVert from '../shaders/raster_2d_vert.glsl';\nexport default class RasterModel extends BaseModel {\n protected texture: ITexture2D;\n protected colorTexture: ITexture2D;\n private rampColors: any;\n public getUninforms() {\n const {\n opacity = 1,\n clampLow = true,\n clampHigh = true,\n noDataValue = -9999999,\n domain = [0, 1],\n rampColors,\n } = this.layer.getLayerConfig() as IRasterLayerStyleOptions;\n if (!isEqual(this.rampColors, rampColors)) {\n this.updateColorTexure();\n this.rampColors = rampColors;\n }\n\n return {\n u_opacity: opacity || 1,\n u_texture: this.texture,\n u_domain: domain,\n u_clampLow: clampLow,\n u_clampHigh: typeof clampHigh !== 'undefined' ? clampHigh : clampLow,\n u_noDataValue: noDataValue,\n u_colorTexture: this.colorTexture,\n };\n }\n\n public initModels() {\n const {\n mask = false,\n maskInside = true,\n rampColorsData,\n rampColors,\n } = this.layer.getLayerConfig() as IRasterLayerStyleOptions;\n const source = this.layer.getSource();\n const { createTexture2D } = this.rendererService;\n const parserDataItem = source.data.dataArray[0];\n this.texture = createTexture2D({\n data: parserDataItem.data,\n width: parserDataItem.width,\n height: parserDataItem.height,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n // aniso: 4,\n });\n const imageData = rampColorsData\n ? rampColorsData\n : generateColorRamp(rampColors as IColorRamp);\n this.colorTexture = createTexture2D({\n data: imageData.data,\n width: imageData.width,\n height: imageData.height,\n flipY: false,\n });\n return [\n this.layer.buildLayerModel({\n moduleName: 'RasterImageData',\n vertexShader: rasterVert,\n fragmentShader: rasterFrag,\n triangulation: RasterImageTriangulation,\n primitive: gl.TRIANGLES,\n depth: { enable: false },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n\n public buildModels() {\n return this.initModels();\n }\n\n public clearModels(): void {\n this.texture?.destroy();\n this.colorTexture?.destroy();\n }\n\n protected registerBuiltinAttributes() {\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Uv',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3], vertex[4]];\n },\n },\n });\n }\n\n private updateColorTexure() {\n const { createTexture2D } = this.rendererService;\n const {\n rampColors,\n } = this.layer.getLayerConfig() as IRasterLayerStyleOptions;\n const imageData = generateColorRamp(rampColors as IColorRamp);\n this.colorTexture = createTexture2D({\n data: imageData.data,\n width: imageData.width,\n height: imageData.height,\n flipY: false,\n });\n }\n}\n"],"file":"raster.js"}
1
+ {"version":3,"sources":["../../../src/raster/models/raster.ts"],"names":["AttributeType","gl","generateColorRamp","getMask","BaseModel","RasterImageTriangulation","RasterModel","layer","getLayerConfig","opacity","clampLow","clampHigh","noDataValue","domain","updateColorTexure","u_opacity","u_texture","texture","u_domain","u_clampLow","u_clampHigh","u_noDataValue","u_colorTexture","colorTexture","isLayerGroup","mask","maskInside","source","getSource","createTexture2D","rendererService","parserDataItem","data","dataArray","width","height","format","LUMINANCE","type","FLOAT","rampColors","imageData","flipY","buildLayerModel","moduleName","vertexShader","rasterVert","fragmentShader","rasterFrag","triangulation","primitive","TRIANGLES","depth","enable","blend","getBlend","stencil","initModels","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx"],"mappings":";;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAOO,eAPP;AAQA,SAASC,iBAAT,EAA4BC,OAA5B,QAAuD,gBAAvD;AACA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,wBAAT,QAAyC,0BAAzC;;;;IAGqBC,W;;;;;;;;;;;;;;;;;;;;;;;;;WAGnB,wBAAsB;AACpB,iBAMI,KAAKC,KAAL,CAAWC,cAAX,EANJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,+BAEEC,QAFF;AAAA,UAEEA,QAFF,8BAEa,IAFb;AAAA,gCAGEC,SAHF;AAAA,UAGEA,SAHF,+BAGc,IAHd;AAAA,kCAIEC,WAJF;AAAA,UAIEA,WAJF,iCAIgB,CAAC,OAJjB;AAAA,6BAKEC,MALF;AAAA,UAKEA,MALF,4BAKW,CAAC,CAAD,EAAI,CAAJ,CALX;;AAOA,WAAKC,iBAAL;AACA,aAAO;AACLC,QAAAA,SAAS,EAAEN,OAAO,IAAI,CADjB;AAELO,QAAAA,SAAS,EAAE,KAAKC,OAFX;AAGLC,QAAAA,QAAQ,EAAEL,MAHL;AAILM,QAAAA,UAAU,EAAET,QAJP;AAKLU,QAAAA,WAAW,EAAE,OAAOT,SAAP,KAAqB,WAArB,GAAmCA,SAAnC,GAA+CD,QALvD;AAMLW,QAAAA,aAAa,EAAET,WANV;AAOLU,QAAAA,cAAc,EAAE,KAAKC;AAPhB,OAAP;AASD;;;WAED,sBAAoB;AAElB,WAAKhB,KAAL,CAAWiB,YAAX,G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EAAEM,SAAS,CAACN,MAHgB;AAIlCO,QAAAA,KAAK,EAAE;AAJ2B,OAAD,CAAnC;AAMD;;;;EA3GsCtC,S;;SAApBE,W","sourcesContent":["import {\n AttributeType,\n gl,\n IEncodeFeature,\n ITexture2D,\n lazyInject,\n TYPES,\n} from '@antv/l7-core';\nimport { generateColorRamp, getMask, IColorRamp } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { IRasterLayerStyleOptions } from '../../core/interface';\nimport { RasterImageTriangulation } from '../../core/triangulation';\nimport rasterFrag from '../shaders/raster_2d_frag.glsl';\nimport rasterVert from '../shaders/raster_2d_vert.glsl';\nexport default class RasterModel extends BaseModel {\n protected texture: ITexture2D;\n protected colorTexture: ITexture2D;\n public getUninforms() {\n const {\n opacity = 1,\n clampLow = true,\n clampHigh = true,\n noDataValue = -9999999,\n domain = [0, 1],\n } = this.layer.getLayerConfig() as IRasterLayerStyleOptions;\n this.updateColorTexure();\n return {\n u_opacity: opacity || 1,\n u_texture: this.texture,\n u_domain: domain,\n u_clampLow: clampLow,\n u_clampHigh: typeof clampHigh !== 'undefined' ? clampHigh : clampLow,\n u_noDataValue: noDataValue,\n u_colorTexture: this.colorTexture,\n };\n }\n\n public initModels() {\n // 指定当前 layer 当作普通的 layer 进行渲染\n this.layer.isLayerGroup = false;\n\n const {\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as IRasterLayerStyleOptions;\n const source = this.layer.getSource();\n const { createTexture2D } = this.rendererService;\n const parserDataItem = source.data.dataArray[0];\n this.texture = createTexture2D({\n data: parserDataItem.data,\n width: parserDataItem.width,\n height: parserDataItem.height,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n // aniso: 4,\n });\n const {\n rampColors,\n } = this.layer.getLayerConfig() as IRasterLayerStyleOptions;\n const imageData = generateColorRamp(rampColors as IColorRamp);\n this.colorTexture = createTexture2D({\n data: imageData.data,\n width: imageData.width,\n height: imageData.height,\n flipY: false,\n });\n return [\n this.layer.buildLayerModel({\n moduleName: 'RasterImageData',\n vertexShader: rasterVert,\n fragmentShader: rasterFrag,\n triangulation: RasterImageTriangulation,\n primitive: gl.TRIANGLES,\n depth: { enable: false },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n\n public buildModels() {\n return this.initModels();\n }\n protected registerBuiltinAttributes() {\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Uv',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3], vertex[4]];\n },\n },\n });\n }\n\n private updateColorTexure() {\n const { createTexture2D } = this.rendererService;\n const {\n rampColors,\n } = this.layer.getLayerConfig() as IRasterLayerStyleOptions;\n const imageData = generateColorRamp(rampColors as IColorRamp);\n this.colorTexture = createTexture2D({\n data: imageData.data,\n width: imageData.width,\n height: imageData.height,\n flipY: false,\n });\n }\n}\n"],"file":"raster.js"}