@antv/l7-layers 2.17.7 → 2.17.10

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.
@@ -27,6 +27,7 @@ var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
27
27
  }
28
28
  _this = _super.call.apply(_super, [this].concat(args));
29
29
  _defineProperty(_assertThisInitialized(_this), "radian", 0);
30
+ // 旋转的弧度
30
31
  _defineProperty(_assertThisInitialized(_this), "planeGeometryTriangulation", function () {
31
32
  var _ref = _this.layer.getLayerConfig(),
32
33
  _ref$center = _ref.center,
@@ -40,20 +40,6 @@ var layerIdCounter = 0;
40
40
  var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function (_ref) {
41
41
  _inherits(BaseLayer, _ref);
42
42
  var _super = _createSuper(BaseLayer);
43
- // 生命周期钩子
44
-
45
- // 待渲染 model 列表
46
-
47
- // 用于保存子图层对象
48
-
49
- // Shader 的数据映射
50
-
51
- // 数据层数据映射
52
-
53
- /**
54
- * 待更新样式属性,在初始化阶段完成注册
55
- */
56
-
57
43
  // private pickingPassRender: IPass<'pixelPicking'>;
58
44
 
59
45
  function BaseLayer() {
@@ -87,6 +73,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
87
73
  featureScaleNeedUpdate: false,
88
74
  StyleAttrNeedUpdate: false
89
75
  });
76
+ // 生命周期钩子
90
77
  _defineProperty(_assertThisInitialized(_this), "hooks", {
91
78
  init: new AsyncSeriesBailHook(),
92
79
  afterInit: new SyncBailHook(),
@@ -102,8 +89,10 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
102
89
  beforeDestroy: new SyncHook(),
103
90
  afterDestroy: new SyncHook()
104
91
  });
92
+ // 待渲染 model 列表
105
93
  _defineProperty(_assertThisInitialized(_this), "models", []);
106
94
  _defineProperty(_assertThisInitialized(_this), "startInit", false);
95
+ // 用于保存子图层对象
107
96
  _defineProperty(_assertThisInitialized(_this), "layerChildren", []);
108
97
  _defineProperty(_assertThisInitialized(_this), "masks", []);
109
98
  _initializerDefineProperty(_assertThisInitialized(_this), "configService", _descriptor, _assertThisInitialized(_this));
@@ -112,9 +101,14 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
112
101
  });
113
102
  _defineProperty(_assertThisInitialized(_this), "currentPickId", null);
114
103
  _defineProperty(_assertThisInitialized(_this), "encodeStyleAttribute", {});
104
+ // Shader 的数据映射
115
105
  _defineProperty(_assertThisInitialized(_this), "enableShaderEncodeStyles", []);
106
+ // 数据层数据映射
116
107
  _defineProperty(_assertThisInitialized(_this), "enableDataEncodeStyles", []);
117
108
  _defineProperty(_assertThisInitialized(_this), "enablg", []);
109
+ /**
110
+ * 待更新样式属性,在初始化阶段完成注册
111
+ */
118
112
  _defineProperty(_assertThisInitialized(_this), "pendingStyleAttributes", []);
119
113
  _defineProperty(_assertThisInitialized(_this), "scaleOptions", {});
120
114
  _defineProperty(_assertThisInitialized(_this), "animateStatus", false);
@@ -594,7 +588,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
594
588
  Object.keys(options).forEach(function (key) {
595
589
  if (
596
590
  // 需要数据映射
597
- [_this6.enableShaderEncodeStyles].concat(_toConsumableArray(_this6.enableDataEncodeStyles)).includes(key) && isPlainObject(options[key]) && (options[key].field || options[key].value) && !isEqual(_this6.encodeStyleAttribute[key], options[key]) // 防止计算属性重复计算
591
+ [].concat(_toConsumableArray(_this6.enableShaderEncodeStyles), _toConsumableArray(_this6.enableDataEncodeStyles)).includes(key) && isPlainObject(options[key]) && (options[key].field || options[key].value) && !isEqual(_this6.encodeStyleAttribute[key], options[key]) // 防止计算属性重复计算
598
592
  ) {
599
593
  _this6.encodeStyleAttribute[key] = options[key];
600
594
  _this6.updateStyleAttribute(key, options[key].field, options[key].value);
@@ -15,12 +15,19 @@ import { getStencil as _getStencil, getStencilMask } from "../utils/stencil";
15
15
  import { getCommonStyleAttributeOptions } from "./CommonStyleAttribute";
16
16
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
17
17
  var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function () {
18
- // style texture data mapping
18
+ // @lazyInject(TYPES.IIconService)
19
+ // protected readonly iconService: IIconService;
20
+
21
+ // @lazyInject(TYPES.IFontService)
22
+ // protected readonly fontService: IFontService;
23
+
24
+ // @lazyInject(TYPES.IShaderModuleService)
19
25
 
20
26
  // style texture data mapping
21
27
 
22
28
  function BaseModel(layer) {
23
29
  _classCallCheck(this, BaseModel);
30
+ // style texture data mapping
24
31
  _defineProperty(this, "preStyleAttribute", {});
25
32
  _defineProperty(this, "encodeStyleAttribute", {});
26
33
  _initializerDefineProperty(this, "configService", _descriptor, this);
@@ -237,6 +244,7 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
237
244
  };
238
245
  this.layer.enableShaderEncodeStyles.forEach(function (key) {
239
246
  if (!_this.layer.encodeStyleAttribute[key]) {
247
+ // 没有设置样式映射
240
248
  // @ts-ignore
241
249
  var keyValue = _this.layer.getLayerConfig()[key];
242
250
  var value = typeof keyValue === 'undefined' ? defualtValue[key] : keyValue;
@@ -23,6 +23,9 @@ export var SizeUnitType = /*#__PURE__*/function (SizeUnitType) {
23
23
  SizeUnitType[SizeUnitType["meter"] = 1] = "meter";
24
24
  return SizeUnitType;
25
25
  }({});
26
+
27
+ // 栅格瓦片图层
28
+
26
29
  export var CanvasUpdateType = /*#__PURE__*/function (CanvasUpdateType) {
27
30
  CanvasUpdateType["ALWAYS"] = "always";
28
31
  CanvasUpdateType["DRAGEND"] = "dragend";
@@ -26,6 +26,7 @@ var BaseEarthModel = /*#__PURE__*/function (_BaseModel) {
26
26
  args[_key] = arguments[_key];
27
27
  }
28
28
  _this = _super.call.apply(_super, [this].concat(args));
29
+ // T: 当前的地球时间 - 控制太阳的方位
29
30
  _defineProperty(_assertThisInitialized(_this), "earthTime", 3.4);
30
31
  _defineProperty(_assertThisInitialized(_this), "sunX", 1000);
31
32
  _defineProperty(_assertThisInitialized(_this), "sunY", 1000);
@@ -6,15 +6,14 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
6
6
  import _regeneratorRuntime from "@babel/runtime/regenerator";
7
7
  import 'reflect-metadata';
8
8
  export var TileLayerService = /*#__PURE__*/function () {
9
- /**
10
- * tileResource 用于存储瓦片的全局资源
11
- */
12
-
13
9
  function TileLayerService(_ref) {
14
10
  var rendererService = _ref.rendererService,
15
11
  layerService = _ref.layerService,
16
12
  parent = _ref.parent;
17
13
  _classCallCheck(this, TileLayerService);
14
+ /**
15
+ * tileResource 用于存储瓦片的全局资源
16
+ */
18
17
  _defineProperty(this, "tileResource", new Map());
19
18
  _defineProperty(this, "layerTiles", []);
20
19
  this.rendererService = rendererService;
@@ -10,14 +10,19 @@ import { TilePickService } from "../service/TilePickService";
10
10
  import { ProxyFuncs } from "../style/constants";
11
11
  import { getTileFactory } from "../tileFactory";
12
12
  var BaseTileLayer = /*#__PURE__*/function () {
13
- // 瓦片数据管理器
13
+ // 瓦片是否加载成功
14
14
 
15
15
  function BaseTileLayer(parent) {
16
16
  var _this = this;
17
17
  _classCallCheck(this, BaseTileLayer);
18
+ // 瓦片数据管理器
18
19
  _defineProperty(this, "initedTileset", false);
19
20
  _defineProperty(this, "mapchange", function () {
20
21
  var _this$tilesetManager;
22
+ // 图层不可见时,不触发加载瓦片
23
+ if (_this.parent.isVisible() === false) {
24
+ return;
25
+ }
21
26
  var _this$getCurrentView = _this.getCurrentView(),
22
27
  latLonBounds = _this$getCurrentView.latLonBounds,
23
28
  zoom = _this$getCurrentView.zoom;
@@ -45,6 +50,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
45
50
  };
46
51
  (_this$tilesetManager = _this.tilesetManager) === null || _this$tilesetManager === void 0 ? void 0 : _this$tilesetManager.throttleUpdate(zoom, latLonBounds);
47
52
  });
53
+ // 防抖操作
48
54
  _defineProperty(this, "viewchange", debounce(this.mapchange, 24));
49
55
  this.parent = parent;
50
56
  var container = this.parent.getContainer();
@@ -81,6 +87,11 @@ var BaseTileLayer = /*#__PURE__*/function () {
81
87
  this.bindTilesetEvent();
82
88
  this.initedTileset = true;
83
89
  }
90
+
91
+ // 图层不可见时,不触发加载瓦片
92
+ if (this.parent.isVisible() === false) {
93
+ return;
94
+ }
84
95
  var _this$getCurrentView2 = this.getCurrentView(),
85
96
  latLonBounds = _this$getCurrentView2.latLonBounds,
86
97
  zoom = _this$getCurrentView2.zoom;
@@ -149,8 +160,6 @@ var BaseTileLayer = /*#__PURE__*/function () {
149
160
  value: function getTile(key) {
150
161
  return this.tileLayerService.getTile(key);
151
162
  }
152
-
153
- // 防抖操作
154
163
  }, {
155
164
  key: "tileLoaded",
156
165
  value:
@@ -39,6 +39,8 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
39
39
  }
40
40
  _this = _super.call.apply(_super, [this].concat(args));
41
41
  _defineProperty(_assertThisInitialized(_this), "sizeScale", 0.5);
42
+ // https://mapbox.github.io/webgl-wind/demo/
43
+ // source: 'http://nomads.ncep.noaa.gov',
42
44
  _defineProperty(_assertThisInitialized(_this), "frequency", new FrequencyController(7.2));
43
45
  return _this;
44
46
  }
@@ -34,6 +34,7 @@ var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
34
34
  }
35
35
  _this = _super.call.apply(_super, [this].concat(args));
36
36
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "radian", 0);
37
+ // 旋转的弧度
37
38
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "planeGeometryTriangulation", function () {
38
39
  var _ref = _this.layer.getLayerConfig(),
39
40
  _ref$center = _ref.center,
@@ -20,7 +20,7 @@ var _l7Core = require("@antv/l7-core");
20
20
  var _l7Maps = require("@antv/l7-maps");
21
21
  var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
22
22
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
23
- 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; } }
23
+ 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; } } // import { mat4, vec3 } from 'gl-matrix';
24
24
  /* babel-plugin-inline-import '../shaders/plane_frag.glsl' */
25
25
  var planeFrag = "\nuniform sampler2D u_texture;\nuniform float u_mapFlag;\nuniform float u_opacity;\n\nvarying vec3 v_Color;\nvarying vec2 v_uv;\nvarying float v_clip;\n\n#pragma include \"picking\"\nvoid main() {\n // gl_FragColor = vec4(v_Color, u_opacity);\n if(u_mapFlag > 0.0) {\n gl_FragColor = texture2D(u_texture, vec2(v_uv.x, 1.0 - v_uv.y));\n gl_FragColor.a *= u_opacity;\n } else {\n // gl_FragColor = vec4(v_uv, 0.0, u_opacity);\n gl_FragColor = vec4(v_Color, u_opacity);\n }\n gl_FragColor.a *= v_clip;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
26
26
  /* babel-plugin-inline-import '../shaders/plane_vert.glsl' */
@@ -33,7 +33,7 @@ var _LayerPickService = _interopRequireDefault(require("./LayerPickService"));
33
33
  var _TextureService = _interopRequireDefault(require("./TextureService"));
34
34
  var _excluded = ["passes"],
35
35
  _excluded2 = ["moduleName", "vertexShader", "fragmentShader", "inject", "triangulation", "segmentNumber"];
36
- var _dec, _class, _descriptor;
36
+ var _dec, _class, _descriptor; // @ts-ignore
37
37
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
38
38
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
39
39
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
@@ -46,20 +46,6 @@ var layerIdCounter = 0;
46
46
  var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function (_ref) {
47
47
  (0, _inherits2.default)(BaseLayer, _ref);
48
48
  var _super = _createSuper(BaseLayer);
49
- // 生命周期钩子
50
-
51
- // 待渲染 model 列表
52
-
53
- // 用于保存子图层对象
54
-
55
- // Shader 的数据映射
56
-
57
- // 数据层数据映射
58
-
59
- /**
60
- * 待更新样式属性,在初始化阶段完成注册
61
- */
62
-
63
49
  // private pickingPassRender: IPass<'pixelPicking'>;
64
50
 
65
51
  function BaseLayer() {
@@ -93,6 +79,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
93
79
  featureScaleNeedUpdate: false,
94
80
  StyleAttrNeedUpdate: false
95
81
  });
82
+ // 生命周期钩子
96
83
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hooks", {
97
84
  init: new _asyncHook.AsyncSeriesBailHook(),
98
85
  afterInit: new _asyncHook.SyncBailHook(),
@@ -108,8 +95,10 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
108
95
  beforeDestroy: new _asyncHook.SyncHook(),
109
96
  afterDestroy: new _asyncHook.SyncHook()
110
97
  });
98
+ // 待渲染 model 列表
111
99
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "models", []);
112
100
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "startInit", false);
101
+ // 用于保存子图层对象
113
102
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "layerChildren", []);
114
103
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "masks", []);
115
104
  (0, _initializerDefineProperty2.default)((0, _assertThisInitialized2.default)(_this), "configService", _descriptor, (0, _assertThisInitialized2.default)(_this));
@@ -118,9 +107,14 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
118
107
  });
119
108
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "currentPickId", null);
120
109
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "encodeStyleAttribute", {});
110
+ // Shader 的数据映射
121
111
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "enableShaderEncodeStyles", []);
112
+ // 数据层数据映射
122
113
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "enableDataEncodeStyles", []);
123
114
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "enablg", []);
115
+ /**
116
+ * 待更新样式属性,在初始化阶段完成注册
117
+ */
124
118
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "pendingStyleAttributes", []);
125
119
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "scaleOptions", {});
126
120
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "animateStatus", false);
@@ -600,7 +594,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
600
594
  Object.keys(options).forEach(function (key) {
601
595
  if (
602
596
  // 需要数据映射
603
- [_this6.enableShaderEncodeStyles].concat((0, _toConsumableArray2.default)(_this6.enableDataEncodeStyles)).includes(key) && (0, _lodash.isPlainObject)(options[key]) && (options[key].field || options[key].value) && !(0, _lodash.isEqual)(_this6.encodeStyleAttribute[key], options[key]) // 防止计算属性重复计算
597
+ [].concat((0, _toConsumableArray2.default)(_this6.enableShaderEncodeStyles), (0, _toConsumableArray2.default)(_this6.enableDataEncodeStyles)).includes(key) && (0, _lodash.isPlainObject)(options[key]) && (options[key].field || options[key].value) && !(0, _lodash.isEqual)(_this6.encodeStyleAttribute[key], options[key]) // 防止计算属性重复计算
604
598
  ) {
605
599
  _this6.encodeStyleAttribute[key] = options[key];
606
600
  _this6.updateStyleAttribute(key, options[key].field, options[key].value);
@@ -22,12 +22,19 @@ var _CommonStyleAttribute = require("./CommonStyleAttribute");
22
22
  var _dec, _class, _descriptor;
23
23
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
24
24
  var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function () {
25
- // style texture data mapping
25
+ // @lazyInject(TYPES.IIconService)
26
+ // protected readonly iconService: IIconService;
27
+
28
+ // @lazyInject(TYPES.IFontService)
29
+ // protected readonly fontService: IFontService;
30
+
31
+ // @lazyInject(TYPES.IShaderModuleService)
26
32
 
27
33
  // style texture data mapping
28
34
 
29
35
  function BaseModel(layer) {
30
36
  (0, _classCallCheck2.default)(this, BaseModel);
37
+ // style texture data mapping
31
38
  (0, _defineProperty2.default)(this, "preStyleAttribute", {});
32
39
  (0, _defineProperty2.default)(this, "encodeStyleAttribute", {});
33
40
  (0, _initializerDefineProperty2.default)(this, "configService", _descriptor, this);
@@ -244,6 +251,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
244
251
  };
245
252
  this.layer.enableShaderEncodeStyles.forEach(function (key) {
246
253
  if (!_this.layer.encodeStyleAttribute[key]) {
254
+ // 没有设置样式映射
247
255
  // @ts-ignore
248
256
  var keyValue = _this.layer.getLayerConfig()[key];
249
257
  var value = typeof keyValue === 'undefined' ? defualtValue[key] : keyValue;
@@ -29,7 +29,7 @@ var SizeUnitType = /*#__PURE__*/function (SizeUnitType) {
29
29
  SizeUnitType[SizeUnitType["pixel"] = 0] = "pixel";
30
30
  SizeUnitType[SizeUnitType["meter"] = 1] = "meter";
31
31
  return SizeUnitType;
32
- }({});
32
+ }({}); // 栅格瓦片图层
33
33
  exports.SizeUnitType = SizeUnitType;
34
34
  var CanvasUpdateType = /*#__PURE__*/function (CanvasUpdateType) {
35
35
  CanvasUpdateType["ALWAYS"] = "always";
@@ -33,6 +33,7 @@ var BaseEarthModel = /*#__PURE__*/function (_BaseModel) {
33
33
  args[_key] = arguments[_key];
34
34
  }
35
35
  _this = _super.call.apply(_super, [this].concat(args));
36
+ // T: 当前的地球时间 - 控制太阳的方位
36
37
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "earthTime", 3.4);
37
38
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sunX", 1000);
38
39
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sunY", 1000);
@@ -21,8 +21,8 @@ var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
21
21
  var _interface = require("../../core/interface");
22
22
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
23
23
  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; } }
24
- /* babel-plugin-inline-import '../shaders/dash/line_dash_frag.glsl' */
25
24
  // import { LineTriangulation } from '../../core/triangulation';
25
+ /* babel-plugin-inline-import '../shaders/dash/line_dash_frag.glsl' */
26
26
  // dash line shader
27
27
  var line_dash_frag = "#define LineTypeSolid 0.0\nvarying vec4 v_color;\n\n// dash\nvarying vec4 v_dash_array;\nvarying float v_d_distance_ratio;\n\n#pragma include \"picking\"\n\nuniform float u_time;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ]; // \u63A7\u5236\u8FD0\u52A8\n\n// [animate, duration, interval, trailLength],\nvoid main() {\n\n gl_FragColor = v_color;\n\n \n float dashLength = mod(v_d_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) {\n // \u5B9E\u7EBF\u90E8\u5206\n } else {\n // \u865A\u7EBF\u90E8\u5206\n discard;\n };\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
28
28
  /* babel-plugin-inline-import '../shaders/dash/line_dash_vert.glsl' */
@@ -13,15 +13,14 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
14
  require("reflect-metadata");
15
15
  var TileLayerService = /*#__PURE__*/function () {
16
- /**
17
- * tileResource 用于存储瓦片的全局资源
18
- */
19
-
20
16
  function TileLayerService(_ref) {
21
17
  var rendererService = _ref.rendererService,
22
18
  layerService = _ref.layerService,
23
19
  parent = _ref.parent;
24
20
  (0, _classCallCheck2.default)(this, TileLayerService);
21
+ /**
22
+ * tileResource 用于存储瓦片的全局资源
23
+ */
25
24
  (0, _defineProperty2.default)(this, "tileResource", new Map());
26
25
  (0, _defineProperty2.default)(this, "layerTiles", []);
27
26
  this.rendererService = rendererService;
@@ -17,14 +17,19 @@ var _TilePickService = require("../service/TilePickService");
17
17
  var _constants = require("../style/constants");
18
18
  var _tileFactory = require("../tileFactory");
19
19
  var BaseTileLayer = /*#__PURE__*/function () {
20
- // 瓦片数据管理器
20
+ // 瓦片是否加载成功
21
21
 
22
22
  function BaseTileLayer(parent) {
23
23
  var _this = this;
24
24
  (0, _classCallCheck2.default)(this, BaseTileLayer);
25
+ // 瓦片数据管理器
25
26
  (0, _defineProperty2.default)(this, "initedTileset", false);
26
27
  (0, _defineProperty2.default)(this, "mapchange", function () {
27
28
  var _this$tilesetManager;
29
+ // 图层不可见时,不触发加载瓦片
30
+ if (_this.parent.isVisible() === false) {
31
+ return;
32
+ }
28
33
  var _this$getCurrentView = _this.getCurrentView(),
29
34
  latLonBounds = _this$getCurrentView.latLonBounds,
30
35
  zoom = _this$getCurrentView.zoom;
@@ -52,6 +57,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
52
57
  };
53
58
  (_this$tilesetManager = _this.tilesetManager) === null || _this$tilesetManager === void 0 ? void 0 : _this$tilesetManager.throttleUpdate(zoom, latLonBounds);
54
59
  });
60
+ // 防抖操作
55
61
  (0, _defineProperty2.default)(this, "viewchange", (0, _lodash.debounce)(this.mapchange, 24));
56
62
  this.parent = parent;
57
63
  var container = this.parent.getContainer();
@@ -88,6 +94,11 @@ var BaseTileLayer = /*#__PURE__*/function () {
88
94
  this.bindTilesetEvent();
89
95
  this.initedTileset = true;
90
96
  }
97
+
98
+ // 图层不可见时,不触发加载瓦片
99
+ if (this.parent.isVisible() === false) {
100
+ return;
101
+ }
91
102
  var _this$getCurrentView2 = this.getCurrentView(),
92
103
  latLonBounds = _this$getCurrentView2.latLonBounds,
93
104
  zoom = _this$getCurrentView2.zoom;
@@ -156,8 +167,6 @@ var BaseTileLayer = /*#__PURE__*/function () {
156
167
  value: function getTile(key) {
157
168
  return this.tileLayerService.getTile(key);
158
169
  }
159
-
160
- // 防抖操作
161
170
  }, {
162
171
  key: "tileLoaded",
163
172
  value:
@@ -46,6 +46,8 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
46
46
  }
47
47
  _this = _super.call.apply(_super, [this].concat(args));
48
48
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sizeScale", 0.5);
49
+ // https://mapbox.github.io/webgl-wind/demo/
50
+ // source: 'http://nomads.ncep.noaa.gov',
49
51
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "frequency", new _l7Utils.FrequencyController(7.2));
50
52
  return _this;
51
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-layers",
3
- "version": "2.17.7",
3
+ "version": "2.17.10",
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.17.7",
31
- "@antv/l7-maps": "2.17.7",
32
- "@antv/l7-source": "2.17.7",
33
- "@antv/l7-utils": "2.17.7",
30
+ "@antv/l7-core": "2.17.10",
31
+ "@antv/l7-maps": "2.17.10",
32
+ "@antv/l7-source": "2.17.10",
33
+ "@antv/l7-utils": "2.17.10",
34
34
  "@babel/runtime": "^7.7.7",
35
35
  "@mapbox/martini": "^0.2.0",
36
36
  "@turf/clone": "^6.5.0",
@@ -53,7 +53,7 @@
53
53
  "reflect-metadata": "^0.1.13"
54
54
  },
55
55
  "devDependencies": {
56
- "@antv/l7-test-utils": "2.17.7",
56
+ "@antv/l7-test-utils": "2.17.10",
57
57
  "@types/d3-array": "^2.0.0",
58
58
  "@types/d3-color": "^1.2.2",
59
59
  "@types/d3-interpolate": "1.1.6",
@@ -62,7 +62,7 @@
62
62
  "@types/gl-matrix": "^2.4.5",
63
63
  "@types/lodash": "^4.14.138"
64
64
  },
65
- "gitHead": "dc2526087e7c2a42fb335c3faa257ede61734e44",
65
+ "gitHead": "58ed9272beb1b324082485e424d712d2890f23c7",
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  }