@antv/l7-layers 2.10.11 → 2.11.0

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 (37) hide show
  1. package/es/Geometry/models/index.d.ts +1 -1
  2. package/es/canvas/models/index.d.ts +1 -1
  3. package/es/core/BaseLayer.js +0 -1
  4. package/es/core/BaseModel.d.ts +3 -3
  5. package/es/core/shape/Path.d.ts +2 -2
  6. package/es/earth/index.d.ts +1 -1
  7. package/es/heatmap/models/index.d.ts +1 -1
  8. package/es/image/models/index.d.ts +1 -1
  9. package/es/line/models/index.d.ts +1 -1
  10. package/es/line/models/line.js +9 -12
  11. package/es/mask/models/index.d.ts +1 -1
  12. package/es/point/models/index.d.ts +1 -1
  13. package/es/polygon/models/index.d.ts +1 -1
  14. package/es/raster/models/index.d.ts +1 -1
  15. package/es/tile/interface.d.ts +2 -2
  16. package/es/tile/tileFactory/ImageTile.js +1 -1
  17. package/es/tile/tileFactory/MaskTile.js +1 -1
  18. package/es/tile/tileFactory/RasterRGBTile.js +1 -1
  19. package/es/tile/tileFactory/RasterTerrainRGBTile.js +1 -1
  20. package/es/tile/tileFactory/RasterTile.js +1 -1
  21. package/es/tile/tileFactory/Tile.d.ts +67 -0
  22. package/es/tile/tileFactory/Tile.js +11 -0
  23. package/es/tile/tileFactory/VectorTile.js +10 -11
  24. package/es/tile/tileFactory/index.d.ts +1 -1
  25. package/es/utils/grid-index.d.ts +1 -1
  26. package/es/utils/symbol-layout.d.ts +1 -1
  27. package/es/wind/models/index.d.ts +1 -1
  28. package/lib/core/BaseLayer.js +0 -1
  29. package/lib/line/models/line.js +9 -12
  30. package/lib/tile/tileFactory/ImageTile.js +1 -1
  31. package/lib/tile/tileFactory/MaskTile.js +1 -1
  32. package/lib/tile/tileFactory/RasterRGBTile.js +1 -1
  33. package/lib/tile/tileFactory/RasterTerrainRGBTile.js +1 -1
  34. package/lib/tile/tileFactory/RasterTile.js +1 -1
  35. package/lib/tile/tileFactory/Tile.js +13 -0
  36. package/lib/tile/tileFactory/VectorTile.js +9 -10
  37. package/package.json +6 -6
@@ -1,4 +1,4 @@
1
- export declare type GeometryModelType = 'plane' | 'sprite' | 'billboard';
1
+ export type GeometryModelType = 'plane' | 'sprite' | 'billboard';
2
2
  declare const GeometryModels: {
3
3
  [key in GeometryModelType]: any;
4
4
  };
@@ -1,4 +1,4 @@
1
- export declare type CanvasModelType = 'canvas';
1
+ export type CanvasModelType = 'canvas';
2
2
  declare const CanvasModels: {
3
3
  [key in CanvasModelType]: any;
4
4
  };
@@ -1010,7 +1010,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1010
1010
  (_this$layerModel2 = this.layerModel) === null || _this$layerModel2 === void 0 ? void 0 : _this$layerModel2.clearModels(refresh);
1011
1011
  (_this$tileLayer = this.tileLayer) === null || _this$tileLayer === void 0 ? void 0 : _this$tileLayer.destroy();
1012
1012
  this.models = [];
1013
- this.layerService.cleanRemove(this, refresh);
1014
1013
  this.emit('remove', {
1015
1014
  target: this,
1016
1015
  type: 'remove'
@@ -1,7 +1,7 @@
1
1
  import { IAnimateOption, IAttribute, IBlendOptions, ICameraService, IElements, IEncodeFeature, IFontService, IGlobalConfigService, IIconService, ILayer, ILayerModel, ILayerService, IMapService, IModel, IModelUniform, IPickingService, IRendererService, IShaderModuleService, IStyleAttributeService, ITexture2D, ITexture2DInitializationOptions, Triangulation } from '@antv/l7-core';
2
- export declare type styleSingle = number | string | [string, (single: any) => number] | [string, [number, number]];
3
- export declare type styleOffset = string | [number, number] | [string, (single: any) => number];
4
- export declare type styleColor = string | [string, (single: any) => string] | [string, [string, string]];
2
+ export type styleSingle = number | string | [string, (single: any) => number] | [string, [number, number]];
3
+ export type styleOffset = string | [number, number] | [string, (single: any) => number];
4
+ export type styleColor = string | [string, (single: any) => string] | [string, [string, string]];
5
5
  export interface IDataTextureFrame {
6
6
  data: number[];
7
7
  width: number;
@@ -1,5 +1,5 @@
1
- export declare type IPosition = [number, number, number] | [number, number];
2
- export declare type IPath = IPosition[];
1
+ export type IPosition = [number, number, number] | [number, number];
2
+ export type IPath = IPosition[];
3
3
  export declare enum ShapeType3D {
4
4
  CYLINDER = "cylinder",
5
5
  SQUARECOLUMN = "squareColumn",
@@ -4,7 +4,7 @@ interface IEarthLayerStyleOptions {
4
4
  opacity: number;
5
5
  setEarthTime(time: number): void;
6
6
  }
7
- export declare type EarthModelType = 'base' | 'atomSphere' | 'bloomSphere';
7
+ export type EarthModelType = 'base' | 'atomSphere' | 'bloomSphere';
8
8
  export default class EarthLayer extends BaseLayer<IEarthLayerStyleOptions> {
9
9
  type: string;
10
10
  defaultSourceConfig: {
@@ -1,4 +1,4 @@
1
- export declare type HeatMapModelType = 'heatmap' | 'heatmap3d' | 'hexagon' | 'grid' | 'grid3d';
1
+ export type HeatMapModelType = 'heatmap' | 'heatmap3d' | 'hexagon' | 'grid' | 'grid3d';
2
2
  declare const HeatMapModels: {
3
3
  [key in HeatMapModelType]: any;
4
4
  };
@@ -1,4 +1,4 @@
1
- export declare type ImageModelType = 'image';
1
+ export type ImageModelType = 'image';
2
2
  declare const ImageModels: {
3
3
  [key in ImageModelType]: any;
4
4
  };
@@ -1,4 +1,4 @@
1
- export declare type LineModelType = 'arc' | 'arc3d' | 'greatcircle' | 'wall' | 'simple' | 'line' | 'halfLine' | 'linearline' | 'tileLine' | 'earthArc3d';
1
+ export type LineModelType = 'arc' | 'arc3d' | 'greatcircle' | 'wall' | 'simple' | 'line' | 'halfLine' | 'linearline' | 'tileLine' | 'earthArc3d';
2
2
  declare const LineModels: {
3
3
  [key in LineModelType]: any;
4
4
  };
@@ -73,20 +73,18 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
73
73
  }));
74
74
 
75
75
  _defineProperty(_assertThisInitialized(_this), "updateTexture", function () {
76
+ var createTexture2D = _this.rendererService.createTexture2D;
77
+
76
78
  if (_this.texture) {
79
+ _this.texture.update({
80
+ data: _this.iconService.getCanvas()
81
+ });
82
+
83
+ _this.layer.render();
84
+
77
85
  return;
78
86
  }
79
87
 
80
- console.log(_this.texture);
81
- var createTexture2D = _this.rendererService.createTexture2D; // if (this.texture) {
82
- // this.texture.update({
83
- // data: this.iconService.getCanvas(),
84
- // });
85
- // this.layer.render();
86
- // return;
87
- // }
88
-
89
- console.log('update texture');
90
88
  _this.texture = createTexture2D({
91
89
  data: _this.iconService.getCanvas(),
92
90
  mag: gl.NEAREST,
@@ -160,7 +158,7 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
160
158
  useLinearColor = 1;
161
159
  }
162
160
 
163
- if (!this.dataTextureTest && this.dataTextureNeedUpdate({
161
+ if (this.dataTextureTest && this.dataTextureNeedUpdate({
164
162
  opacity: opacity
165
163
  })) {
166
164
  this.judgeStyleAttributes({
@@ -190,7 +188,6 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
190
188
  width: 1,
191
189
  height: 1
192
190
  });
193
- console.timeEnd('encodeData');
194
191
  }
195
192
 
196
193
  return {
@@ -1,4 +1,4 @@
1
- export declare type MaskModelType = 'fill';
1
+ export type MaskModelType = 'fill';
2
2
  declare const MaskModels: {
3
3
  [key in MaskModelType]: any;
4
4
  };
@@ -1,4 +1,4 @@
1
- export declare type PointType = 'fillImage' | 'fill' | 'radar' | 'image' | 'normal' | 'simplePoint' | 'extrude' | 'text' | 'tile' | 'tileText' | 'earthFill' | 'earthExtrude';
1
+ export type PointType = 'fillImage' | 'fill' | 'radar' | 'image' | 'normal' | 'simplePoint' | 'extrude' | 'text' | 'tile' | 'tileText' | 'earthFill' | 'earthExtrude';
2
2
  declare const PointModels: {
3
3
  [key in PointType]: any;
4
4
  };
@@ -1,4 +1,4 @@
1
- export declare type PolygonModelType = 'fill' | 'extrude' | 'line' | 'point_fill' | 'point_image' | 'point_normal' | 'point_extrude' | 'text' | 'water' | 'ocean' | 'tile';
1
+ export type PolygonModelType = 'fill' | 'extrude' | 'line' | 'point_fill' | 'point_image' | 'point_normal' | 'point_extrude' | 'text' | 'water' | 'ocean' | 'tile';
2
2
  declare const PolygonModels: {
3
3
  [key in PolygonModelType]: any;
4
4
  };
@@ -1,4 +1,4 @@
1
- export declare type RasterModelType = 'raster' | 'raster3d' | 'rasterRgb' | 'rasterTerrainRgb';
1
+ export type RasterModelType = 'raster' | 'raster3d' | 'rasterRgb' | 'rasterTerrainRgb';
2
2
  declare const RasterModels: {
3
3
  [key in RasterModelType]: any;
4
4
  };
@@ -1,7 +1,7 @@
1
1
  import { ILayer, IMapService, IRendererService, ISource, ISubLayerInitOptions } from '@antv/l7-core';
2
2
  import { SourceTile } from '@antv/l7-utils';
3
- export declare type Timeout = any;
4
- export declare type CacheEvent = 'click' | 'mousemove' | 'mouseup' | 'mousedown' | 'contextmenu';
3
+ export type Timeout = any;
4
+ export type CacheEvent = 'click' | 'mousemove' | 'mouseup' | 'mousedown' | 'contextmenu';
5
5
  export interface ITileFactoryOptions {
6
6
  parent: ILayer;
7
7
  mapService: IMapService;
@@ -35,7 +35,7 @@ var ImageTile = /*#__PURE__*/function (_Tile) {
35
35
  switch (_context.prev = _context.next) {
36
36
  case 0:
37
37
  attributes = this.parent.getLayerAttributeConfig();
38
- layerOptions = this.parent.getLayerConfig();
38
+ layerOptions = this.getLayerOptions();
39
39
  sourceOptions = this.getSourceOption();
40
40
  layer = new ImageLayer(_objectSpread({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
41
41
 
@@ -35,7 +35,7 @@ var MaskTile = /*#__PURE__*/function (_Tile) {
35
35
  switch (_context.prev = _context.next) {
36
36
  case 0:
37
37
  attributes = this.parent.getLayerAttributeConfig();
38
- layerOptions = this.parent.getLayerConfig();
38
+ layerOptions = this.getLayerOptions();
39
39
  sourceOptions = this.getSourceOption();
40
40
  layer = new MaskLayer(_objectSpread({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
41
41
 
@@ -38,7 +38,7 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
38
38
  switch (_context.prev = _context.next) {
39
39
  case 0:
40
40
  attributes = this.parent.getLayerAttributeConfig();
41
- layerOptions = this.parent.getLayerConfig();
41
+ layerOptions = this.getLayerOptions();
42
42
  sourceOptions = this.getSourceOption();
43
43
  layer = new RasterLayer(_objectSpread({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
44
44
 
@@ -35,7 +35,7 @@ var RasterTerrainRGBTile = /*#__PURE__*/function (_Tile) {
35
35
  switch (_context.prev = _context.next) {
36
36
  case 0:
37
37
  attributes = this.parent.getLayerAttributeConfig();
38
- layerOptions = this.parent.getLayerConfig();
38
+ layerOptions = this.getLayerOptions();
39
39
  sourceOptions = this.getSourceOption();
40
40
  layer = new RasterLayer(_objectSpread({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
41
41
 
@@ -41,7 +41,7 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
41
41
  switch (_context.prev = _context.next) {
42
42
  case 0:
43
43
  attributes = this.parent.getLayerAttributeConfig();
44
- layerOptions = this.parent.getLayerConfig();
44
+ layerOptions = this.getLayerOptions();
45
45
  sourceOptions = this.getSourceOption();
46
46
  this.colorTexture = this.parent.textureService.getColorTexture(layerOptions.rampColors);
47
47
  layer = new RasterLayer(_objectSpread(_objectSpread({}, layerOptions), {}, {
@@ -15,6 +15,73 @@ export default abstract class Tile implements ITile {
15
15
  styleUpdate(...arg: any): void;
16
16
  abstract initTileLayer(): Promise<void>;
17
17
  lnglatInBounds(lnglat: ILngLat): boolean;
18
+ protected getLayerOptions(): {
19
+ autoFit: boolean;
20
+ mask: boolean | undefined;
21
+ maskInside?: boolean | undefined;
22
+ maskfence?: any;
23
+ maskColor?: string | undefined;
24
+ maskOpacity?: number | undefined;
25
+ sourceLayer?: string | undefined;
26
+ colors?: string[] | undefined;
27
+ size?: number | undefined;
28
+ shape?: string | undefined;
29
+ shape2d?: string[] | undefined;
30
+ shape3d?: string[] | undefined;
31
+ scales?: {
32
+ [key: string]: import("@antv/l7-core").IScale;
33
+ } | undefined;
34
+ minZoom?: number | undefined;
35
+ maxZoom?: number | undefined;
36
+ visible?: boolean | undefined;
37
+ zIndex?: number | undefined;
38
+ pickingBuffer?: number | undefined;
39
+ enablePropagation?: boolean | undefined;
40
+ fitBoundsOptions?: unknown;
41
+ name?: string | undefined;
42
+ blend?: "max" | "normal" | "none" | "min" | "additive" | "subtractive" | undefined;
43
+ depth?: boolean | undefined;
44
+ pickedFeatureID?: number | undefined;
45
+ enableMultiPassRenderer?: boolean | undefined;
46
+ passes?: ((string | [string, {
47
+ [key: string]: unknown;
48
+ }])[] & import("@antv/l7-core").IPass<unknown>[]) | undefined;
49
+ layerType?: string | undefined;
50
+ cursorEnabled?: boolean | undefined;
51
+ cursor?: string | undefined;
52
+ forward?: boolean | undefined;
53
+ usage?: string | undefined;
54
+ enablePicking?: boolean | undefined;
55
+ enableHighlight?: boolean | undefined;
56
+ enableSelect?: boolean | undefined;
57
+ highlightColor?: string | number[] | undefined;
58
+ selectColor?: string | number[] | undefined;
59
+ active?: boolean | undefined;
60
+ activeColor?: string | number[] | undefined;
61
+ activeMix?: number | undefined;
62
+ selectMix?: number | undefined;
63
+ enableTAA?: boolean | undefined;
64
+ jitterScale?: number | undefined;
65
+ enableLighting?: boolean | undefined;
66
+ animateOption?: Partial<import("@antv/l7-core").IAnimateOption> | undefined;
67
+ globalOptions?: any;
68
+ iconfont?: boolean | undefined;
69
+ workerEnabled?: boolean | undefined;
70
+ onHover?: ((pickedFeature: import("@antv/l7-core").IPickedFeature) => void) | undefined;
71
+ onClick?: ((pickedFeature: import("@antv/l7-core").IPickedFeature) => void) | undefined;
72
+ id?: string | HTMLDivElement | undefined;
73
+ canvas?: HTMLCanvasElement | undefined;
74
+ gl?: any;
75
+ hasBaseMap?: boolean | undefined;
76
+ map?: import("@antv/l7-core").IMapWrapper | undefined;
77
+ logoPosition?: import("@antv/l7-core").PositionName | undefined;
78
+ logoVisible?: boolean | undefined;
79
+ animate?: boolean | undefined;
80
+ pickBufferScale?: number | undefined;
81
+ stencil?: boolean | undefined;
82
+ antialias?: boolean | undefined;
83
+ preserveDrawingBuffer?: boolean | undefined;
84
+ };
18
85
  protected addMask(layer: ILayer, mask: ILayer): Promise<void>;
19
86
  protected addLayer(layer: ILayer): Promise<void>;
20
87
  updateVisible(value: boolean): void;
@@ -1,10 +1,12 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
3
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
4
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
5
  import _createClass from "@babel/runtime/helpers/esm/createClass";
5
6
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
6
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
7
8
  import { createLayerContainer } from '@antv/l7-core';
9
+ import { isNeedMask } from "./util";
8
10
 
9
11
  var Tile = /*#__PURE__*/function () {
10
12
  function Tile(sourceTile, parent) {
@@ -46,6 +48,15 @@ var Tile = /*#__PURE__*/function () {
46
48
  lat = lnglat.lat;
47
49
  return lng >= minLng && lng <= maxLng && lat >= minLat && lat <= maxLat;
48
50
  }
51
+ }, {
52
+ key: "getLayerOptions",
53
+ value: function getLayerOptions() {
54
+ var options = this.parent.getLayerConfig();
55
+ return _objectSpread(_objectSpread({}, options), {}, {
56
+ autoFit: false,
57
+ mask: isNeedMask(this.parent.type) || options.mask
58
+ });
59
+ }
49
60
  }, {
50
61
  key: "addMask",
51
62
  value: function () {
@@ -12,7 +12,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
12
12
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
13
 
14
14
  import Tile from "./Tile";
15
- import { getTileLayer, isNeedMask } from "./util";
15
+ import { getTileLayer } from "./util";
16
16
  import MaskLayer from "../../mask";
17
17
 
18
18
  var VectorTile = /*#__PURE__*/function (_Tile) {
@@ -36,20 +36,19 @@ var VectorTile = /*#__PURE__*/function (_Tile) {
36
36
  switch (_context.prev = _context.next) {
37
37
  case 0:
38
38
  attributes = this.parent.getLayerAttributeConfig();
39
- layerOptions = this.parent.getLayerConfig();
40
- layerOptions.mask = isNeedMask(this.parent.type) || layerOptions.mask;
39
+ layerOptions = this.getLayerOptions();
41
40
  vectorLayer = getTileLayer(this.parent.type);
42
41
  sourceOptions = this.getSourceOption();
43
42
 
44
43
  if (sourceOptions) {
45
- _context.next = 8;
44
+ _context.next = 7;
46
45
  break;
47
46
  }
48
47
 
49
48
  this.isLoaded = true;
50
49
  return _context.abrupt("return");
51
50
 
52
- case 8:
51
+ case 7:
53
52
  layer = new vectorLayer(_objectSpread({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
54
53
 
55
54
  Object.keys(attributes).forEach(function (type) {
@@ -61,22 +60,22 @@ var VectorTile = /*#__PURE__*/function (_Tile) {
61
60
  });
62
61
 
63
62
  if (!layerOptions.mask) {
64
- _context.next = 13;
63
+ _context.next = 12;
65
64
  break;
66
65
  }
67
66
 
68
- _context.next = 13;
67
+ _context.next = 12;
69
68
  return this.addTileMask(layer);
70
69
 
71
- case 13:
72
- _context.next = 15;
70
+ case 12:
71
+ _context.next = 14;
73
72
  return this.addLayer(layer);
74
73
 
75
- case 15:
74
+ case 14:
76
75
  this.setLayerMinMaxZoom(layer);
77
76
  this.isLoaded = true;
78
77
 
79
- case 17:
78
+ case 16:
80
79
  case "end":
81
80
  return _context.stop();
82
81
  }
@@ -6,7 +6,7 @@ import RasterTile from './RasterTile';
6
6
  import RasterRGBTile from './RasterRGBTile';
7
7
  import RasterTerrainRGBTile from './RasterTerrainRGBTile';
8
8
  import MaskLayer from './MaskTile';
9
- export declare type TileType = 'VectorTile' | 'DebugTile' | 'PolygonLayer' | 'PointLayer' | 'LineLayer' | 'RasterLayer' | 'image' | 'MaskLayer' | 'TileDebugLayer';
9
+ export type TileType = 'VectorTile' | 'DebugTile' | 'PolygonLayer' | 'PointLayer' | 'LineLayer' | 'RasterLayer' | 'image' | 'MaskLayer' | 'TileDebugLayer';
10
10
  export declare function getTileFactory(layer: ILayer): typeof VectorTile | typeof DebugTile | typeof ImageTile | typeof RasterTile | typeof RasterRGBTile | typeof RasterTerrainRGBTile | typeof MaskLayer;
11
11
  export * from '../interface';
12
12
  export * from './Tile';
@@ -1,4 +1,4 @@
1
- declare type CallBack = (...args: any[]) => any;
1
+ type CallBack = (...args: any[]) => any;
2
2
  /**
3
3
  * 网格索引,相比 @mapbox/grid-index,在简单计算碰撞检测结果时效率更高
4
4
  * @see https://zhuanlan.zhihu.com/p/74373214
@@ -2,7 +2,7 @@ interface IPoint {
2
2
  x: number;
3
3
  y: number;
4
4
  }
5
- export declare type anchorType = 'right' | 'top-right' | 'left' | 'bottom-right' | 'left' | 'top-left' | 'bottom-left' | 'bottom' | 'bottom-right' | 'bottom-left' | 'top' | 'top-right' | 'top-left' | 'center';
5
+ export type anchorType = 'right' | 'top-right' | 'left' | 'bottom-right' | 'left' | 'top-left' | 'bottom-left' | 'bottom' | 'bottom-right' | 'bottom-left' | 'top' | 'top-right' | 'top-left' | 'center';
6
6
  export interface IGlyphQuad {
7
7
  tr: IPoint;
8
8
  tl: IPoint;
@@ -1,4 +1,4 @@
1
- export declare type WindModelType = 'wind';
1
+ export type WindModelType = 'wind';
2
2
  declare const WindModels: {
3
3
  [key in WindModelType]: any;
4
4
  };
@@ -1012,7 +1012,6 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1012
1012
  (_this$layerModel2 = this.layerModel) === null || _this$layerModel2 === void 0 ? void 0 : _this$layerModel2.clearModels(refresh);
1013
1013
  (_this$tileLayer = this.tileLayer) === null || _this$tileLayer === void 0 ? void 0 : _this$tileLayer.destroy();
1014
1014
  this.models = [];
1015
- this.layerService.cleanRemove(this, refresh);
1016
1015
  this.emit('remove', {
1017
1016
  target: this,
1018
1017
  type: 'remove'
@@ -92,20 +92,18 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
92
92
  height: 1
93
93
  }));
94
94
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateTexture", function () {
95
+ var createTexture2D = _this.rendererService.createTexture2D;
96
+
95
97
  if (_this.texture) {
98
+ _this.texture.update({
99
+ data: _this.iconService.getCanvas()
100
+ });
101
+
102
+ _this.layer.render();
103
+
96
104
  return;
97
105
  }
98
106
 
99
- console.log(_this.texture);
100
- var createTexture2D = _this.rendererService.createTexture2D; // if (this.texture) {
101
- // this.texture.update({
102
- // data: this.iconService.getCanvas(),
103
- // });
104
- // this.layer.render();
105
- // return;
106
- // }
107
-
108
- console.log('update texture');
109
107
  _this.texture = createTexture2D({
110
108
  data: _this.iconService.getCanvas(),
111
109
  mag: _l7Core.gl.NEAREST,
@@ -178,7 +176,7 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
178
176
  useLinearColor = 1;
179
177
  }
180
178
 
181
- if (!this.dataTextureTest && this.dataTextureNeedUpdate({
179
+ if (this.dataTextureTest && this.dataTextureNeedUpdate({
182
180
  opacity: opacity
183
181
  })) {
184
182
  this.judgeStyleAttributes({
@@ -208,7 +206,6 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
208
206
  width: 1,
209
207
  height: 1
210
208
  });
211
- console.timeEnd('encodeData');
212
209
  }
213
210
 
214
211
  return {
@@ -51,7 +51,7 @@ var ImageTile = /*#__PURE__*/function (_Tile) {
51
51
  switch (_context.prev = _context.next) {
52
52
  case 0:
53
53
  attributes = this.parent.getLayerAttributeConfig();
54
- layerOptions = this.parent.getLayerConfig();
54
+ layerOptions = this.getLayerOptions();
55
55
  sourceOptions = this.getSourceOption();
56
56
  layer = new _image.default((0, _objectSpread2.default)({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
57
57
 
@@ -51,7 +51,7 @@ var MaskTile = /*#__PURE__*/function (_Tile) {
51
51
  switch (_context.prev = _context.next) {
52
52
  case 0:
53
53
  attributes = this.parent.getLayerAttributeConfig();
54
- layerOptions = this.parent.getLayerConfig();
54
+ layerOptions = this.getLayerOptions();
55
55
  sourceOptions = this.getSourceOption();
56
56
  layer = new _mask.default((0, _objectSpread2.default)({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
57
57
 
@@ -55,7 +55,7 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
55
55
  switch (_context.prev = _context.next) {
56
56
  case 0:
57
57
  attributes = this.parent.getLayerAttributeConfig();
58
- layerOptions = this.parent.getLayerConfig();
58
+ layerOptions = this.getLayerOptions();
59
59
  sourceOptions = this.getSourceOption();
60
60
  layer = new _raster.default((0, _objectSpread2.default)({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
61
61
 
@@ -51,7 +51,7 @@ var RasterTerrainRGBTile = /*#__PURE__*/function (_Tile) {
51
51
  switch (_context.prev = _context.next) {
52
52
  case 0:
53
53
  attributes = this.parent.getLayerAttributeConfig();
54
- layerOptions = this.parent.getLayerConfig();
54
+ layerOptions = this.getLayerOptions();
55
55
  sourceOptions = this.getSourceOption();
56
56
  layer = new _raster.default((0, _objectSpread2.default)({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
57
57
 
@@ -60,7 +60,7 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
60
60
  switch (_context.prev = _context.next) {
61
61
  case 0:
62
62
  attributes = this.parent.getLayerAttributeConfig();
63
- layerOptions = this.parent.getLayerConfig();
63
+ layerOptions = this.getLayerOptions();
64
64
  sourceOptions = this.getSourceOption();
65
65
  this.colorTexture = this.parent.textureService.getColorTexture(layerOptions.rampColors);
66
66
  layer = new _raster.default((0, _objectSpread2.default)((0, _objectSpread2.default)({}, layerOptions), {}, {
@@ -11,6 +11,8 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
11
11
 
12
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
13
 
14
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
15
+
14
16
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
17
 
16
18
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
@@ -21,6 +23,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
21
23
 
22
24
  var _l7Core = require("@antv/l7-core");
23
25
 
26
+ var _util = require("./util");
27
+
24
28
  var Tile = /*#__PURE__*/function () {
25
29
  function Tile(sourceTile, parent) {
26
30
  (0, _classCallCheck2.default)(this, Tile);
@@ -57,6 +61,15 @@ var Tile = /*#__PURE__*/function () {
57
61
  lat = lnglat.lat;
58
62
  return lng >= minLng && lng <= maxLng && lat >= minLat && lat <= maxLat;
59
63
  }
64
+ }, {
65
+ key: "getLayerOptions",
66
+ value: function getLayerOptions() {
67
+ var options = this.parent.getLayerConfig();
68
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, options), {}, {
69
+ autoFit: false,
70
+ mask: (0, _util.isNeedMask)(this.parent.type) || options.mask
71
+ });
72
+ }
60
73
  }, {
61
74
  key: "addMask",
62
75
  value: function () {
@@ -53,20 +53,19 @@ var VectorTile = /*#__PURE__*/function (_Tile) {
53
53
  switch (_context.prev = _context.next) {
54
54
  case 0:
55
55
  attributes = this.parent.getLayerAttributeConfig();
56
- layerOptions = this.parent.getLayerConfig();
57
- layerOptions.mask = (0, _util.isNeedMask)(this.parent.type) || layerOptions.mask;
56
+ layerOptions = this.getLayerOptions();
58
57
  vectorLayer = (0, _util.getTileLayer)(this.parent.type);
59
58
  sourceOptions = this.getSourceOption();
60
59
 
61
60
  if (sourceOptions) {
62
- _context.next = 8;
61
+ _context.next = 7;
63
62
  break;
64
63
  }
65
64
 
66
65
  this.isLoaded = true;
67
66
  return _context.abrupt("return");
68
67
 
69
- case 8:
68
+ case 7:
70
69
  layer = new vectorLayer((0, _objectSpread2.default)({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
71
70
 
72
71
  Object.keys(attributes).forEach(function (type) {
@@ -78,22 +77,22 @@ var VectorTile = /*#__PURE__*/function (_Tile) {
78
77
  });
79
78
 
80
79
  if (!layerOptions.mask) {
81
- _context.next = 13;
80
+ _context.next = 12;
82
81
  break;
83
82
  }
84
83
 
85
- _context.next = 13;
84
+ _context.next = 12;
86
85
  return this.addTileMask(layer);
87
86
 
88
- case 13:
89
- _context.next = 15;
87
+ case 12:
88
+ _context.next = 14;
90
89
  return this.addLayer(layer);
91
90
 
92
- case 15:
91
+ case 14:
93
92
  this.setLayerMinMaxZoom(layer);
94
93
  this.isLoaded = true;
95
94
 
96
- case 17:
95
+ case 16:
97
96
  case "end":
98
97
  return _context.stop();
99
98
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-layers",
3
- "version": "2.10.11",
3
+ "version": "2.11.0",
4
4
  "description": "L7's collection of built-in layers",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -27,10 +27,10 @@
27
27
  "license": "ISC",
28
28
  "dependencies": {
29
29
  "@antv/async-hook": "^2.2.9",
30
- "@antv/l7-core": "2.10.11",
31
- "@antv/l7-maps": "2.10.11",
32
- "@antv/l7-source": "2.10.11",
33
- "@antv/l7-utils": "2.10.11",
30
+ "@antv/l7-core": "2.11.0",
31
+ "@antv/l7-maps": "2.11.0",
32
+ "@antv/l7-source": "2.11.0",
33
+ "@antv/l7-utils": "2.11.0",
34
34
  "@babel/runtime": "^7.7.7",
35
35
  "@mapbox/martini": "^0.2.0",
36
36
  "@turf/clone": "^6.5.0",
@@ -61,7 +61,7 @@
61
61
  "@types/gl-matrix": "^2.4.5",
62
62
  "@types/lodash": "^4.14.138"
63
63
  },
64
- "gitHead": "a49e148b5fcb89f302e6bd53c1a628c07e006f43",
64
+ "gitHead": "ef67b8e74cb940ab6e150782d70b81678de4609d",
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  }