@antv/l7-layers 2.9.32-alpha.4 → 2.9.32-alpha.5

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 (55) hide show
  1. package/es/core/BaseLayer.d.ts +1 -0
  2. package/es/core/BaseLayer.js +20 -3
  3. package/es/core/interface.d.ts +4 -0
  4. package/es/mask/index.js +7 -0
  5. package/es/mask/models/index.d.ts +1 -1
  6. package/es/mask/models/index.js +3 -1
  7. package/es/plugins/DataMappingPlugin.d.ts +0 -1
  8. package/es/plugins/DataMappingPlugin.js +1 -8
  9. package/es/plugins/ShaderUniformPlugin.d.ts +5 -1
  10. package/es/plugins/ShaderUniformPlugin.js +10 -11
  11. package/es/raster/index.d.ts +1 -1
  12. package/es/raster/index.js +4 -0
  13. package/es/raster/models/index.d.ts +1 -1
  14. package/es/raster/models/index.js +2 -0
  15. package/es/raster/models/raster.d.ts +2 -1
  16. package/es/raster/models/raster.js +118 -44
  17. package/es/raster/models/rasterRgb.d.ts +20 -0
  18. package/es/raster/models/rasterRgb.js +226 -0
  19. package/es/raster/shaders/raster_rgb_frag.glsl +12 -0
  20. package/es/tile/tileFactory/base.d.ts +1 -1
  21. package/es/tile/tileFactory/base.js +8 -6
  22. package/es/tile/tileFactory/index.d.ts +1 -1
  23. package/es/tile/tileFactory/index.js +4 -0
  24. package/es/tile/tileFactory/line.d.ts +1 -1
  25. package/es/tile/tileFactory/line.js +8 -8
  26. package/es/tile/tileFactory/mask.d.ts +12 -0
  27. package/es/tile/tileFactory/mask.js +63 -0
  28. package/es/tile/tileFactory/point.d.ts +1 -1
  29. package/es/tile/tileFactory/point.js +8 -8
  30. package/es/tile/tileFactory/rasterData.js +6 -1
  31. package/es/tile/tileFactory/rasterDataLayer.d.ts +2 -1
  32. package/es/tile/tileFactory/rasterDataLayer.js +6 -1
  33. package/es/tile/tileFactory/vectorLayer.d.ts +6 -3
  34. package/es/tile/tileFactory/vectorLayer.js +4 -0
  35. package/es/utils/layerData.js +9 -6
  36. package/lib/core/BaseLayer.js +20 -3
  37. package/lib/mask/index.js +8 -0
  38. package/lib/mask/models/index.js +4 -1
  39. package/lib/plugins/DataMappingPlugin.js +1 -8
  40. package/lib/plugins/ShaderUniformPlugin.js +10 -11
  41. package/lib/raster/index.js +4 -0
  42. package/lib/raster/models/index.js +3 -0
  43. package/lib/raster/models/raster.js +120 -44
  44. package/lib/raster/models/rasterRgb.js +241 -0
  45. package/lib/raster/shaders/raster_rgb_frag.glsl +12 -0
  46. package/lib/tile/tileFactory/base.js +8 -7
  47. package/lib/tile/tileFactory/index.js +5 -0
  48. package/lib/tile/tileFactory/line.js +8 -8
  49. package/lib/tile/tileFactory/mask.js +74 -0
  50. package/lib/tile/tileFactory/point.js +8 -8
  51. package/lib/tile/tileFactory/rasterData.js +6 -1
  52. package/lib/tile/tileFactory/rasterDataLayer.js +7 -1
  53. package/lib/tile/tileFactory/vectorLayer.js +5 -0
  54. package/lib/utils/layerData.js +12 -8
  55. package/package.json +6 -6
@@ -0,0 +1,226 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/createClass";
4
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
+ import _inherits from "@babel/runtime/helpers/inherits";
6
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
+
11
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
+
13
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
+
15
+ import { AttributeType, gl } from '@antv/l7-core';
16
+ import { getMask } from '@antv/l7-utils';
17
+ import BaseModel from "../../core/BaseModel";
18
+ import { RasterImageTriangulation } from "../../core/triangulation";
19
+
20
+ /* babel-plugin-inline-import '../shaders/raster_rgb_frag.glsl' */
21
+ var rasterFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nuniform float u_channelRMax: 256.;\nuniform float u_channelGMax: 256.;\nuniform float u_channelBMax: 256.;\nvarying vec2 v_texCoord;\n\nvoid main() {\n vec3 rgb = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y)).rgb;\n gl_FragColor = vec4(rgb.r/u_channelRMax, rgb.g/u_channelGMax, rgb.b/u_channelBMax, u_opacity);\n}";
22
+
23
+ /* babel-plugin-inline-import '../shaders/raster_2d_vert.glsl' */
24
+ var rasterVert = "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\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";
25
+
26
+ var RasterModel = /*#__PURE__*/function (_BaseModel) {
27
+ _inherits(RasterModel, _BaseModel);
28
+
29
+ var _super = _createSuper(RasterModel);
30
+
31
+ function RasterModel() {
32
+ var _this;
33
+
34
+ _classCallCheck(this, RasterModel);
35
+
36
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
37
+ args[_key] = arguments[_key];
38
+ }
39
+
40
+ _this = _super.call.apply(_super, [this].concat(args));
41
+
42
+ _defineProperty(_assertThisInitialized(_this), "channelRMax", 256);
43
+
44
+ _defineProperty(_assertThisInitialized(_this), "channelGMax", 256);
45
+
46
+ _defineProperty(_assertThisInitialized(_this), "channelBMax", 256);
47
+
48
+ return _this;
49
+ }
50
+
51
+ _createClass(RasterModel, [{
52
+ key: "getUninforms",
53
+ value: function getUninforms() {
54
+ var _ref = this.layer.getLayerConfig(),
55
+ _ref$opacity = _ref.opacity,
56
+ opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
57
+ channelRMax = _ref.channelRMax,
58
+ channelGMax = _ref.channelGMax,
59
+ channelBMax = _ref.channelBMax;
60
+
61
+ return {
62
+ u_opacity: opacity || 1,
63
+ u_texture: this.texture,
64
+ u_channelRMax: channelRMax !== undefined ? channelRMax : this.channelRMax,
65
+ u_channelGMax: channelGMax !== undefined ? channelGMax : this.channelGMax,
66
+ u_channelBMax: channelBMax !== undefined ? channelBMax : this.channelBMax
67
+ };
68
+ }
69
+ }, {
70
+ key: "getRasterData",
71
+ value: function () {
72
+ var _getRasterData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(parserDataItem) {
73
+ var _yield$parserDataItem, rasterData, width, height, channelR, channelG, channelB;
74
+
75
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
76
+ while (1) {
77
+ switch (_context.prev = _context.next) {
78
+ case 0:
79
+ if (!Array.isArray(parserDataItem.data)) {
80
+ _context.next = 4;
81
+ break;
82
+ }
83
+
84
+ return _context.abrupt("return", {
85
+ data: parserDataItem.data,
86
+ width: parserDataItem.width,
87
+ height: parserDataItem.height
88
+ });
89
+
90
+ case 4:
91
+ _context.next = 6;
92
+ return parserDataItem.data;
93
+
94
+ case 6:
95
+ _yield$parserDataItem = _context.sent;
96
+ rasterData = _yield$parserDataItem.rasterData;
97
+ width = _yield$parserDataItem.width;
98
+ height = _yield$parserDataItem.height;
99
+ channelR = _yield$parserDataItem.channelR;
100
+ channelG = _yield$parserDataItem.channelG;
101
+ channelB = _yield$parserDataItem.channelB;
102
+ this.channelRMax = channelR;
103
+ this.channelGMax = channelG;
104
+ this.channelBMax = channelB;
105
+ return _context.abrupt("return", {
106
+ data: Array.from(rasterData),
107
+ width: width,
108
+ height: height
109
+ });
110
+
111
+ case 17:
112
+ case "end":
113
+ return _context.stop();
114
+ }
115
+ }
116
+ }, _callee, this);
117
+ }));
118
+
119
+ function getRasterData(_x) {
120
+ return _getRasterData.apply(this, arguments);
121
+ }
122
+
123
+ return getRasterData;
124
+ }()
125
+ }, {
126
+ key: "initModels",
127
+ value: function () {
128
+ var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(callbackModel) {
129
+ var _ref2, _ref2$mask, mask, _ref2$maskInside, maskInside, source, createTexture2D, parserDataItem, _yield$this$getRaster, data, width, height;
130
+
131
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
132
+ while (1) {
133
+ switch (_context2.prev = _context2.next) {
134
+ case 0:
135
+ _ref2 = this.layer.getLayerConfig(), _ref2$mask = _ref2.mask, mask = _ref2$mask === void 0 ? false : _ref2$mask, _ref2$maskInside = _ref2.maskInside, maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside;
136
+ source = this.layer.getSource();
137
+ createTexture2D = this.rendererService.createTexture2D;
138
+ parserDataItem = source.data.dataArray[0];
139
+ _context2.next = 6;
140
+ return this.getRasterData(parserDataItem);
141
+
142
+ case 6:
143
+ _yield$this$getRaster = _context2.sent;
144
+ data = _yield$this$getRaster.data;
145
+ width = _yield$this$getRaster.width;
146
+ height = _yield$this$getRaster.height;
147
+ this.texture = createTexture2D({
148
+ // @ts-ignore
149
+ data: data,
150
+ width: width,
151
+ height: height,
152
+ format: gl.RGB,
153
+ type: gl.FLOAT
154
+ });
155
+ this.layer.buildLayerModel({
156
+ moduleName: 'rasterImageDataRGBA',
157
+ vertexShader: rasterVert,
158
+ fragmentShader: rasterFrag,
159
+ triangulation: RasterImageTriangulation,
160
+ primitive: gl.TRIANGLES,
161
+ depth: {
162
+ enable: false
163
+ },
164
+ stencil: getMask(mask, maskInside),
165
+ pick: false
166
+ }).then(function (model) {
167
+ callbackModel([model]);
168
+ }).catch(function (err) {
169
+ console.warn(err);
170
+ callbackModel([]);
171
+ });
172
+
173
+ case 12:
174
+ case "end":
175
+ return _context2.stop();
176
+ }
177
+ }
178
+ }, _callee2, this);
179
+ }));
180
+
181
+ function initModels(_x2) {
182
+ return _initModels.apply(this, arguments);
183
+ }
184
+
185
+ return initModels;
186
+ }()
187
+ }, {
188
+ key: "buildModels",
189
+ value: function buildModels(callbackModel) {
190
+ this.initModels(callbackModel);
191
+ }
192
+ }, {
193
+ key: "clearModels",
194
+ value: function clearModels() {
195
+ var _this$texture;
196
+
197
+ (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
198
+ }
199
+ }, {
200
+ key: "registerBuiltinAttributes",
201
+ value: function registerBuiltinAttributes() {
202
+ // point layer size;
203
+ this.styleAttributeService.registerStyleAttribute({
204
+ name: 'uv',
205
+ type: AttributeType.Attribute,
206
+ descriptor: {
207
+ name: 'a_Uv',
208
+ buffer: {
209
+ // give the WebGL driver a hint that this buffer may change
210
+ usage: gl.DYNAMIC_DRAW,
211
+ data: [],
212
+ type: gl.FLOAT
213
+ },
214
+ size: 2,
215
+ update: function update(feature, featureIdx, vertex) {
216
+ return [vertex[3], vertex[4]];
217
+ }
218
+ }
219
+ });
220
+ }
221
+ }]);
222
+
223
+ return RasterModel;
224
+ }(BaseModel);
225
+
226
+ export { RasterModel as default };
@@ -0,0 +1,12 @@
1
+ precision mediump float;
2
+ uniform float u_opacity: 1.0;
3
+ uniform sampler2D u_texture;
4
+ uniform float u_channelRMax: 256.;
5
+ uniform float u_channelGMax: 256.;
6
+ uniform float u_channelBMax: 256.;
7
+ varying vec2 v_texCoord;
8
+
9
+ void main() {
10
+ vec3 rgb = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y)).rgb;
11
+ gl_FragColor = vec4(rgb.r/u_channelRMax, rgb.g/u_channelGMax, rgb.b/u_channelBMax, u_opacity);
12
+ }
@@ -30,7 +30,7 @@ export default class TileFactory implements ITileFactory {
30
30
  };
31
31
  createLayer(tileLayerOption: ILayerTileConfig): any;
32
32
  updateStyle(styles: ITileStyles): string;
33
- getDefautStyleAttributeField(layer: ILayer, type: string): string | string[] | 1;
33
+ getDefaultStyleAttributeField(layer: ILayer, type: string): string | string[] | 1;
34
34
  setStyleAttributeField(layer: ILayer, type: ScaleAttributeType, value: IScaleValue | undefined | string | string[]): ILayer | undefined;
35
35
  protected parseScaleValue(value: IScaleValue | string, type: string): (string | number | any[])[] | (import("@antv/l7-core").StyleAttributeField | ((...args: any[]) => [] | undefined))[];
36
36
  protected getTile(lng: number, lat: number): Tile;
@@ -5,7 +5,6 @@ import _createClass from "@babel/runtime/helpers/createClass";
5
5
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
6
6
  import Source from '@antv/l7-source';
7
7
  import { osmLonLat2TileXY } from '@antv/l7-utils';
8
- import MaskLayer from "../../mask";
9
8
  import { getLayerShape, readRasterValue, registerLayers } from "../utils";
10
9
  import VectorLayer from "./vectorLayer";
11
10
  import * as turf from '@turf/helpers';
@@ -170,7 +169,9 @@ var TileFactory = /*#__PURE__*/function () {
170
169
  var layers = [layer];
171
170
 
172
171
  if (mask && layer.isVector) {
173
- var masklayer = new MaskLayer().source({
172
+ var masklayer = new VectorLayer({
173
+ layerType: "MaskLayer"
174
+ }).source({
174
175
  type: 'FeatureCollection',
175
176
  features: [tile.bboxPolygon]
176
177
  }, {
@@ -187,15 +188,16 @@ var TileFactory = /*#__PURE__*/function () {
187
188
  registerLayers(this.parentLayer, layers);
188
189
  this.layers = [layer];
189
190
  return layer;
190
- }
191
+ } // eslint-disable-next-line @typescript-eslint/no-unused-vars
192
+
191
193
  }, {
192
194
  key: "updateStyle",
193
195
  value: function updateStyle(styles) {
194
196
  return '';
195
197
  }
196
198
  }, {
197
- key: "getDefautStyleAttributeField",
198
- value: function getDefautStyleAttributeField(layer, type) {
199
+ key: "getDefaultStyleAttributeField",
200
+ value: function getDefaultStyleAttributeField(layer, type) {
199
201
  switch (type) {
200
202
  case 'size':
201
203
  return 1;
@@ -224,7 +226,7 @@ var TileFactory = /*#__PURE__*/function () {
224
226
  return;
225
227
  }
226
228
 
227
- var defaultValue = this.getDefautStyleAttributeField(layer, type);
229
+ var defaultValue = this.getDefaultStyleAttributeField(layer, type);
228
230
 
229
231
  if (!value) {
230
232
  layer[type](defaultValue);
@@ -1,5 +1,5 @@
1
1
  import { IParserCfg } from '@antv/l7-core';
2
2
  import VectorLineTile from './line';
3
- export declare type TileType = 'PolygonLayer' | 'PointLayer' | 'LineLayer' | 'RasterLayer' | 'TileDebugLayer';
3
+ export declare type TileType = 'PolygonLayer' | 'PointLayer' | 'LineLayer' | 'RasterLayer' | 'MaskLayer' | 'TileDebugLayer';
4
4
  export declare function getTileFactory(tileType: TileType, parser: IParserCfg): typeof VectorLineTile;
5
5
  export * from '../interface';
@@ -2,6 +2,7 @@ import { rasterDataTypes } from '@antv/l7-source';
2
2
  import VectorLineTile from "./line";
3
3
  import VectorPointLayer from "./point";
4
4
  import VectorPolygonTile from "./polygon";
5
+ import VectorMask from "./mask";
5
6
  import RasterTileFactory from "./raster";
6
7
  import RasterDataFactory from "./rasterData";
7
8
  import TestTile from "./test";
@@ -16,6 +17,9 @@ export function getTileFactory(tileType, parser) {
16
17
  case 'PointLayer':
17
18
  return VectorPointLayer;
18
19
 
20
+ case 'MaskLayer':
21
+ return VectorMask;
22
+
19
23
  case 'TileDebugLayer':
20
24
  return TestTile;
21
25
 
@@ -2,7 +2,7 @@ import { ILayer, ISubLayerInitOptions } from '@antv/l7-core';
2
2
  import { Tile } from '@antv/l7-utils';
3
3
  import { ITileFactoryOptions } from '../interface';
4
4
  import TileFactory from './base';
5
- export default class VectorPolygonTile extends TileFactory {
5
+ export default class VectorLineTile extends TileFactory {
6
6
  parentLayer: ILayer;
7
7
  constructor(option: ITileFactoryOptions);
8
8
  createTile(tile: Tile, initOptions: ISubLayerInitOptions): {
@@ -10,22 +10,22 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
10
10
 
11
11
  import TileFactory from "./base";
12
12
 
13
- var VectorPolygonTile = /*#__PURE__*/function (_TileFactory) {
14
- _inherits(VectorPolygonTile, _TileFactory);
13
+ var VectorLineTile = /*#__PURE__*/function (_TileFactory) {
14
+ _inherits(VectorLineTile, _TileFactory);
15
15
 
16
- var _super = _createSuper(VectorPolygonTile);
16
+ var _super = _createSuper(VectorLineTile);
17
17
 
18
- function VectorPolygonTile(option) {
18
+ function VectorLineTile(option) {
19
19
  var _this;
20
20
 
21
- _classCallCheck(this, VectorPolygonTile);
21
+ _classCallCheck(this, VectorLineTile);
22
22
 
23
23
  _this = _super.call(this, option);
24
24
  _this.parentLayer = option.parent;
25
25
  return _this;
26
26
  }
27
27
 
28
- _createClass(VectorPolygonTile, [{
28
+ _createClass(VectorLineTile, [{
29
29
  key: "createTile",
30
30
  value: function createTile(tile, initOptions) {
31
31
  var _this$getFeatureData = this.getFeatureData(tile, initOptions),
@@ -56,7 +56,7 @@ var VectorPolygonTile = /*#__PURE__*/function (_TileFactory) {
56
56
  }
57
57
  }]);
58
58
 
59
- return VectorPolygonTile;
59
+ return VectorLineTile;
60
60
  }(TileFactory);
61
61
 
62
- export { VectorPolygonTile as default };
62
+ export { VectorLineTile as default };
@@ -0,0 +1,12 @@
1
+ import { ILayer, ISubLayerInitOptions } from '@antv/l7-core';
2
+ import { Tile } from '@antv/l7-utils';
3
+ import { ITileFactoryOptions } from '../interface';
4
+ import TileFactory from './base';
5
+ export default class VectorMaskTile extends TileFactory {
6
+ parentLayer: ILayer;
7
+ constructor(option: ITileFactoryOptions);
8
+ createTile(tile: Tile, initOptions: ISubLayerInitOptions): {
9
+ layers: any[];
10
+ layerIDList: any[];
11
+ };
12
+ }
@@ -0,0 +1,63 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _inherits from "@babel/runtime/helpers/inherits";
4
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
+
7
+ 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); }; }
8
+
9
+ 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; } }
10
+
11
+ import TileFactory from "./base";
12
+
13
+ var VectorMaskTile = /*#__PURE__*/function (_TileFactory) {
14
+ _inherits(VectorMaskTile, _TileFactory);
15
+
16
+ var _super = _createSuper(VectorMaskTile);
17
+
18
+ function VectorMaskTile(option) {
19
+ var _this;
20
+
21
+ _classCallCheck(this, VectorMaskTile);
22
+
23
+ _this = _super.call(this, option);
24
+ _this.parentLayer = option.parent;
25
+ return _this;
26
+ }
27
+
28
+ _createClass(VectorMaskTile, [{
29
+ key: "createTile",
30
+ value: function createTile(tile, initOptions) {
31
+ var _this$getFeatureData = this.getFeatureData(tile, initOptions),
32
+ features = _this$getFeatureData.features,
33
+ vectorTileLayer = _this$getFeatureData.vectorTileLayer,
34
+ source = _this$getFeatureData.source;
35
+
36
+ if (features.length === 0) {
37
+ return {
38
+ layers: [],
39
+ layerIDList: []
40
+ };
41
+ }
42
+
43
+ var layer = this.createLayer({
44
+ tile: tile,
45
+ initOptions: initOptions,
46
+ vectorTileLayer: vectorTileLayer,
47
+ source: source,
48
+ needListen: false
49
+ });
50
+ layer.once('modelLoaded', function () {
51
+ tile.layerLoad();
52
+ });
53
+ return {
54
+ layers: [layer],
55
+ layerIDList: [layer.id]
56
+ };
57
+ }
58
+ }]);
59
+
60
+ return VectorMaskTile;
61
+ }(TileFactory);
62
+
63
+ export { VectorMaskTile as default };
@@ -2,7 +2,7 @@ import { ILayer, ISubLayerInitOptions } from '@antv/l7-core';
2
2
  import { Tile } from '@antv/l7-utils';
3
3
  import { ITileFactoryOptions } from '../interface';
4
4
  import TileFactory from './base';
5
- export default class VectorPolygonTile extends TileFactory {
5
+ export default class VectorPointTile extends TileFactory {
6
6
  parentLayer: ILayer;
7
7
  constructor(option: ITileFactoryOptions);
8
8
  createTile(tile: Tile, initOptions: ISubLayerInitOptions): {
@@ -10,22 +10,22 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
10
10
 
11
11
  import TileFactory from "./base";
12
12
 
13
- var VectorPolygonTile = /*#__PURE__*/function (_TileFactory) {
14
- _inherits(VectorPolygonTile, _TileFactory);
13
+ var VectorPointTile = /*#__PURE__*/function (_TileFactory) {
14
+ _inherits(VectorPointTile, _TileFactory);
15
15
 
16
- var _super = _createSuper(VectorPolygonTile);
16
+ var _super = _createSuper(VectorPointTile);
17
17
 
18
- function VectorPolygonTile(option) {
18
+ function VectorPointTile(option) {
19
19
  var _this;
20
20
 
21
- _classCallCheck(this, VectorPolygonTile);
21
+ _classCallCheck(this, VectorPointTile);
22
22
 
23
23
  _this = _super.call(this, option);
24
24
  _this.parentLayer = option.parent;
25
25
  return _this;
26
26
  }
27
27
 
28
- _createClass(VectorPolygonTile, [{
28
+ _createClass(VectorPointTile, [{
29
29
  key: "createTile",
30
30
  value: function createTile(tile, initOptions) {
31
31
  var _this$getFeatureData = this.getFeatureData(tile, initOptions),
@@ -57,7 +57,7 @@ var VectorPolygonTile = /*#__PURE__*/function (_TileFactory) {
57
57
  }
58
58
  }]);
59
59
 
60
- return VectorPolygonTile;
60
+ return VectorPointTile;
61
61
  }(TileFactory);
62
62
 
63
- export { VectorPolygonTile as default };
63
+ export { VectorPointTile as default };
@@ -30,6 +30,8 @@ var RasterTiffTile = /*#__PURE__*/function (_TileFactory) {
30
30
  _createClass(RasterTiffTile, [{
31
31
  key: "createTile",
32
32
  value: function createTile(tile, initOptions) {
33
+ var _this$parentLayer, _this$parentLayer$get, _this$parentLayer$get2;
34
+
33
35
  var colorTexture = initOptions.colorTexture,
34
36
  opacity = initOptions.opacity,
35
37
  domain = initOptions.domain,
@@ -46,12 +48,14 @@ var RasterTiffTile = /*#__PURE__*/function (_TileFactory) {
46
48
  };
47
49
  }
48
50
 
51
+ var dataType = (_this$parentLayer = this.parentLayer) === null || _this$parentLayer === void 0 ? void 0 : (_this$parentLayer$get = _this$parentLayer.getSource()) === null || _this$parentLayer$get === void 0 ? void 0 : (_this$parentLayer$get2 = _this$parentLayer$get.parser) === null || _this$parentLayer$get2 === void 0 ? void 0 : _this$parentLayer$get2.dataType;
49
52
  var layer = new RasterDataLayer({
50
53
  visible: tile.isVisible,
51
54
  mask: mask
52
55
  }).source(rasterData.data, {
53
56
  parser: {
54
- type: 'raster',
57
+ // 数据栅格分为单通道栅格和多通道彩色栅格
58
+ type: dataType === 'rgb' ? 'rasterRgb' : 'raster',
55
59
  width: rasterData.width,
56
60
  height: rasterData.height,
57
61
  extent: tile.bboxPolygon.bbox
@@ -59,6 +63,7 @@ var RasterTiffTile = /*#__PURE__*/function (_TileFactory) {
59
63
  }).style({
60
64
  colorTexture: colorTexture,
61
65
  opacity: opacity,
66
+ // TODO: 目前从 domain 从父瓦片图层的 style 进行配置,后续考虑从每个时机请求的栅格文件中进行配置
62
67
  domain: domain,
63
68
  clampHigh: clampHigh,
64
69
  clampLow: clampLow
@@ -1,11 +1,12 @@
1
1
  import BaseLayer from '../../core/BaseLayer';
2
2
  import { IRasterLayerStyleOptions } from '../../core/interface';
3
3
  import RasterModel from '../../raster/models/rasterTile';
4
+ import RasterRgbModel from '../../raster/models/rasterRgb';
4
5
  export default class RasterTiffLayer extends BaseLayer<Partial<IRasterLayerStyleOptions>> {
5
6
  type: string;
6
7
  buildModels(): void;
7
8
  rebuildModels(): void;
8
- protected getModelType(): typeof RasterModel;
9
+ protected getModelType(): typeof RasterModel | typeof RasterRgbModel;
9
10
  protected getConfigSchema(): {
10
11
  properties: {
11
12
  opacity: {
@@ -12,6 +12,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
12
12
 
13
13
  import BaseLayer from "../../core/BaseLayer";
14
14
  import RasterModel from "../../raster/models/rasterTile";
15
+ import RasterRgbModel from "../../raster/models/rasterRgb";
15
16
 
16
17
  var RasterTiffLayer = /*#__PURE__*/function (_BaseLayer) {
17
18
  _inherits(RasterTiffLayer, _BaseLayer);
@@ -57,7 +58,11 @@ var RasterTiffLayer = /*#__PURE__*/function (_BaseLayer) {
57
58
  }, {
58
59
  key: "getModelType",
59
60
  value: function getModelType() {
60
- return RasterModel;
61
+ if (this.layerSource.parser.type === 'rasterRgb') {
62
+ return RasterRgbModel;
63
+ } else {
64
+ return RasterModel;
65
+ }
61
66
  }
62
67
  }, {
63
68
  key: "getConfigSchema",
@@ -1,11 +1,13 @@
1
1
  import BaseLayer from '../../core/BaseLayer';
2
- import { ILineLayerStyleOptions, IPointLayerStyleOptions, IPolygonLayerStyleOptions } from '../../core/interface';
2
+ import { ILineLayerStyleOptions, IPointLayerStyleOptions, IPolygonLayerStyleOptions, IMaskLayerStyleOptions } from '../../core/interface';
3
3
  import lineFillModel from '../../line/models/tile';
4
4
  import lineSimpleModel from '../../line/models/simpleTileLine';
5
5
  import pointTextModel from '../../point/models/tileText';
6
6
  import pointFillModel from '../../point/models/tile';
7
7
  import polygonFillModel from '../../polygon/models/tile';
8
- export default class VectorLayer extends BaseLayer<Partial<IPolygonLayerStyleOptions & ILineLayerStyleOptions & IPointLayerStyleOptions & {
8
+ import maskModel from '../../mask/models/fill';
9
+ declare type ILayerStyleOptions = IPolygonLayerStyleOptions & ILineLayerStyleOptions & IPointLayerStyleOptions & IMaskLayerStyleOptions;
10
+ export default class VectorLayer extends BaseLayer<Partial<ILayerStyleOptions & {
9
11
  needListen: boolean;
10
12
  }>> {
11
13
  needListen: boolean;
@@ -19,7 +21,7 @@ export default class VectorLayer extends BaseLayer<Partial<IPolygonLayerStyleOpt
19
21
  setPickID(): number | null;
20
22
  buildModels(): void;
21
23
  rebuildModels(): void;
22
- protected getModelType(): typeof lineFillModel | typeof lineSimpleModel | typeof pointTextModel | typeof pointFillModel | typeof polygonFillModel;
24
+ protected getModelType(): typeof lineFillModel | typeof lineSimpleModel | typeof pointTextModel | typeof pointFillModel | typeof polygonFillModel | typeof maskModel;
23
25
  protected getLineModel(): typeof lineFillModel | typeof lineSimpleModel;
24
26
  protected getPointModel(): typeof pointTextModel | typeof pointFillModel;
25
27
  protected getConfigSchema(): {
@@ -33,3 +35,4 @@ export default class VectorLayer extends BaseLayer<Partial<IPolygonLayerStyleOpt
33
35
  };
34
36
  protected getDefaultConfig(): {};
35
37
  }
38
+ export {};
@@ -24,6 +24,7 @@ import lineSimpleModel from "../../line/models/simpleTileLine";
24
24
  import pointTextModel from "../../point/models/tileText";
25
25
  import pointFillModel from "../../point/models/tile";
26
26
  import polygonFillModel from "../../polygon/models/tile";
27
+ import maskModel from "../../mask/models/fill";
27
28
 
28
29
  var VectorLayer = /*#__PURE__*/function (_BaseLayer) {
29
30
  _inherits(VectorLayer, _BaseLayer);
@@ -186,6 +187,9 @@ var VectorLayer = /*#__PURE__*/function (_BaseLayer) {
186
187
  case 'PointLayer':
187
188
  return this.getPointModel();
188
189
 
190
+ case 'MaskLayer':
191
+ return maskModel;
192
+
189
193
  default:
190
194
  return pointFillModel;
191
195
  }