@antv/l7-layers 2.5.36 → 2.5.37-mini4
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.
- package/lib/core/BaseLayer.js +4 -1
- package/lib/core/BaseLayer.js.map +1 -1
- package/lib/core/BaseModel.js +1 -1
- package/lib/core/BaseModel.js.map +1 -1
- package/lib/heatmap/models/heatmap.js +12 -17
- package/lib/heatmap/models/heatmap.js.map +1 -1
- package/lib/image/models/image.js +28 -7
- package/lib/image/models/image.js.map +1 -1
- package/lib/imagetile/index.js +95 -0
- package/lib/imagetile/index.js.map +1 -0
- package/lib/imagetile/models/imagetile.js +177 -0
- package/lib/imagetile/models/imagetile.js.map +1 -0
- package/lib/imagetile/models/index.js +17 -0
- package/lib/imagetile/models/index.js.map +1 -0
- package/lib/imagetile/utils/ImageTile.js +99 -0
- package/lib/imagetile/utils/ImageTile.js.map +1 -0
- package/lib/imagetile/utils/Tile.js +324 -0
- package/lib/imagetile/utils/Tile.js.map +1 -0
- package/lib/imagetile/utils/lruCache.js +109 -0
- package/lib/imagetile/utils/lruCache.js.map +1 -0
- package/lib/imagetile/utils/tileCache.js +58 -0
- package/lib/imagetile/utils/tileCache.js.map +1 -0
- package/lib/index.js +8 -0
- package/lib/index.js.map +1 -1
- package/lib/line/index.js +3 -0
- package/lib/line/index.js.map +1 -1
- package/lib/line/models/arc.js +2 -2
- package/lib/line/models/arc_3d.js +2 -2
- package/lib/line/models/arcmini.js +160 -0
- package/lib/line/models/arcmini.js.map +1 -0
- package/lib/line/models/great_circle.js +2 -2
- package/lib/line/models/index.js +3 -0
- package/lib/line/models/index.js.map +1 -1
- package/lib/line/models/line.js +2 -2
- package/lib/plugins/LayerStylePlugin.js.map +1 -1
- package/lib/plugins/ShaderUniformPlugin.js +3 -1
- package/lib/plugins/ShaderUniformPlugin.js.map +1 -1
- package/lib/point/models/image.js.map +1 -1
- package/package.json +6 -5
- package/CHANGELOG.md +0 -492
- package/LICENSE.md +0 -21
- package/es/citybuliding/building.d.ts +0 -17
- package/es/citybuliding/building.js +0 -79
- package/es/citybuliding/building.js.map +0 -1
- package/es/citybuliding/models/build.d.ts +0 -13
- package/es/citybuliding/models/build.js +0 -124
- package/es/citybuliding/models/build.js.map +0 -1
- package/es/core/BaseLayer.d.ts +0 -174
- package/es/core/BaseLayer.js +0 -974
- package/es/core/BaseLayer.js.map +0 -1
- package/es/core/BaseModel.d.ts +0 -135
- package/es/core/BaseModel.js +0 -412
- package/es/core/BaseModel.js.map +0 -1
- package/es/core/interface.d.ts +0 -19
- package/es/core/interface.js +0 -7
- package/es/core/interface.js.map +0 -1
- package/es/core/schema.d.ts +0 -27
- package/es/core/schema.js +0 -23
- package/es/core/schema.js.map +0 -1
- package/es/core/shape/Path.d.ts +0 -39
- package/es/core/shape/Path.js +0 -57
- package/es/core/shape/Path.js.map +0 -1
- package/es/core/shape/extrude.d.ts +0 -17
- package/es/core/shape/extrude.js +0 -143
- package/es/core/shape/extrude.js.map +0 -1
- package/es/core/triangulation.d.ts +0 -109
- package/es/core/triangulation.js +0 -328
- package/es/core/triangulation.js.map +0 -1
- package/es/earth/index.d.ts +0 -17
- package/es/earth/index.js +0 -81
- package/es/earth/index.js.map +0 -1
- package/es/earth/models/atmosphere.d.ts +0 -9
- package/es/earth/models/atmosphere.js +0 -125
- package/es/earth/models/atmosphere.js.map +0 -1
- package/es/earth/models/base.d.ts +0 -16
- package/es/earth/models/base.js +0 -193
- package/es/earth/models/base.js.map +0 -1
- package/es/earth/models/bloomsphere.d.ts +0 -9
- package/es/earth/models/bloomsphere.js +0 -125
- package/es/earth/models/bloomsphere.js.map +0 -1
- package/es/earth/utils.d.ts +0 -26
- package/es/earth/utils.js +0 -81
- package/es/earth/utils.js.map +0 -1
- package/es/glsl.d.js +0 -2
- package/es/glsl.d.js.map +0 -1
- package/es/heatmap/index.d.ts +0 -22
- package/es/heatmap/index.js +0 -123
- package/es/heatmap/index.js.map +0 -1
- package/es/heatmap/models/grid.d.ts +0 -8
- package/es/heatmap/models/grid.js +0 -90
- package/es/heatmap/models/grid.js.map +0 -1
- package/es/heatmap/models/grid3d.d.ts +0 -8
- package/es/heatmap/models/grid3d.js +0 -122
- package/es/heatmap/models/grid3d.js.map +0 -1
- package/es/heatmap/models/heatmap.d.ts +0 -24
- package/es/heatmap/models/heatmap.js +0 -399
- package/es/heatmap/models/heatmap.js.map +0 -1
- package/es/heatmap/models/hexagon.d.ts +0 -8
- package/es/heatmap/models/hexagon.js +0 -90
- package/es/heatmap/models/hexagon.js.map +0 -1
- package/es/heatmap/models/index.d.ts +0 -5
- package/es/heatmap/models/index.js +0 -13
- package/es/heatmap/models/index.js.map +0 -1
- package/es/heatmap/triangulation.d.ts +0 -5
- package/es/heatmap/triangulation.js +0 -38
- package/es/heatmap/triangulation.js.map +0 -1
- package/es/image/index.d.ts +0 -22
- package/es/image/index.js +0 -82
- package/es/image/index.js.map +0 -1
- package/es/image/models/image.d.ts +0 -18
- package/es/image/models/image.js +0 -127
- package/es/image/models/image.js.map +0 -1
- package/es/image/models/index.d.ts +0 -5
- package/es/image/models/index.js +0 -6
- package/es/image/models/index.js.map +0 -1
- package/es/index.d.ts +0 -11
- package/es/index.js +0 -39
- package/es/index.js.map +0 -1
- package/es/line/index.d.ts +0 -25
- package/es/line/index.js +0 -95
- package/es/line/index.js.map +0 -1
- package/es/line/models/arc.d.ts +0 -12
- package/es/line/models/arc.js +0 -281
- package/es/line/models/arc.js.map +0 -1
- package/es/line/models/arc_3d.d.ts +0 -12
- package/es/line/models/arc_3d.js +0 -277
- package/es/line/models/arc_3d.js.map +0 -1
- package/es/line/models/great_circle.d.ts +0 -12
- package/es/line/models/great_circle.js +0 -269
- package/es/line/models/great_circle.js.map +0 -1
- package/es/line/models/index.d.ts +0 -5
- package/es/line/models/index.js +0 -12
- package/es/line/models/index.js.map +0 -1
- package/es/line/models/line.d.ts +0 -13
- package/es/line/models/line.js +0 -342
- package/es/line/models/line.js.map +0 -1
- package/es/plugins/DataMappingPlugin.d.ts +0 -13
- package/es/plugins/DataMappingPlugin.js +0 -199
- package/es/plugins/DataMappingPlugin.js.map +0 -1
- package/es/plugins/DataSourcePlugin.d.ts +0 -7
- package/es/plugins/DataSourcePlugin.js +0 -73
- package/es/plugins/DataSourcePlugin.js.map +0 -1
- package/es/plugins/FeatureScalePlugin.d.ts +0 -26
- package/es/plugins/FeatureScalePlugin.js +0 -270
- package/es/plugins/FeatureScalePlugin.js.map +0 -1
- package/es/plugins/LayerAnimateStylePlugin.d.ts +0 -7
- package/es/plugins/LayerAnimateStylePlugin.js +0 -50
- package/es/plugins/LayerAnimateStylePlugin.js.map +0 -1
- package/es/plugins/LayerModelPlugin.d.ts +0 -8
- package/es/plugins/LayerModelPlugin.js +0 -34
- package/es/plugins/LayerModelPlugin.js.map +0 -1
- package/es/plugins/LayerStylePlugin.d.ts +0 -8
- package/es/plugins/LayerStylePlugin.js +0 -35
- package/es/plugins/LayerStylePlugin.js.map +0 -1
- package/es/plugins/LightingPlugin.d.ts +0 -36
- package/es/plugins/LightingPlugin.js +0 -100
- package/es/plugins/LightingPlugin.js.map +0 -1
- package/es/plugins/MultiPassRendererPlugin.d.ts +0 -37
- package/es/plugins/MultiPassRendererPlugin.js +0 -79
- package/es/plugins/MultiPassRendererPlugin.js.map +0 -1
- package/es/plugins/PixelPickingPlugin.d.ts +0 -8
- package/es/plugins/PixelPickingPlugin.js +0 -112
- package/es/plugins/PixelPickingPlugin.js.map +0 -1
- package/es/plugins/RegisterStyleAttributePlugin.d.ts +0 -11
- package/es/plugins/RegisterStyleAttributePlugin.js +0 -98
- package/es/plugins/RegisterStyleAttributePlugin.js.map +0 -1
- package/es/plugins/ShaderUniformPlugin.d.ts +0 -16
- package/es/plugins/ShaderUniformPlugin.js +0 -78
- package/es/plugins/ShaderUniformPlugin.js.map +0 -1
- package/es/plugins/UpdateModelPlugin.d.ts +0 -8
- package/es/plugins/UpdateModelPlugin.js +0 -27
- package/es/plugins/UpdateModelPlugin.js.map +0 -1
- package/es/plugins/UpdateStyleAttributePlugin.d.ts +0 -12
- package/es/plugins/UpdateStyleAttributePlugin.js +0 -74
- package/es/plugins/UpdateStyleAttributePlugin.js.map +0 -1
- package/es/point/index.d.ts +0 -30
- package/es/point/index.js +0 -130
- package/es/point/index.js.map +0 -1
- package/es/point/models/extrude.d.ts +0 -14
- package/es/point/models/extrude.js +0 -180
- package/es/point/models/extrude.js.map +0 -1
- package/es/point/models/fill.d.ts +0 -17
- package/es/point/models/fill.js +0 -247
- package/es/point/models/fill.js.map +0 -1
- package/es/point/models/icon-font.d.ts +0 -11
- package/es/point/models/icon-font.js +0 -181
- package/es/point/models/icon-font.js.map +0 -1
- package/es/point/models/image.d.ts +0 -11
- package/es/point/models/image.js +0 -207
- package/es/point/models/image.js.map +0 -1
- package/es/point/models/index.d.ts +0 -5
- package/es/point/models/index.js +0 -16
- package/es/point/models/index.js.map +0 -1
- package/es/point/models/normal.d.ts +0 -21
- package/es/point/models/normal.js +0 -155
- package/es/point/models/normal.js.map +0 -1
- package/es/point/models/text.d.ts +0 -56
- package/es/point/models/text.js +0 -522
- package/es/point/models/text.js.map +0 -1
- package/es/point/shape/Path.d.ts +0 -40
- package/es/point/shape/Path.js +0 -57
- package/es/point/shape/Path.js.map +0 -1
- package/es/point/shape/extrude.d.ts +0 -15
- package/es/point/shape/extrude.js +0 -58
- package/es/point/shape/extrude.js.map +0 -1
- package/es/polygon/index.d.ts +0 -22
- package/es/polygon/index.js +0 -124
- package/es/polygon/index.js.map +0 -1
- package/es/polygon/models/extrude.d.ts +0 -13
- package/es/polygon/models/extrude.js +0 -139
- package/es/polygon/models/extrude.js.map +0 -1
- package/es/polygon/models/fill.d.ts +0 -13
- package/es/polygon/models/fill.js +0 -108
- package/es/polygon/models/fill.js.map +0 -1
- package/es/polygon/models/index.d.ts +0 -5
- package/es/polygon/models/index.js +0 -20
- package/es/polygon/models/index.js.map +0 -1
- package/es/raster/buffers/triangulation.d.ts +0 -6
- package/es/raster/buffers/triangulation.js +0 -28
- package/es/raster/buffers/triangulation.js.map +0 -1
- package/es/raster/image.d.ts +0 -0
- package/es/raster/image.js +0 -2
- package/es/raster/image.js.map +0 -1
- package/es/raster/index.d.ts +0 -28
- package/es/raster/index.js +0 -83
- package/es/raster/index.js.map +0 -1
- package/es/raster/models/index.d.ts +0 -5
- package/es/raster/models/index.js +0 -7
- package/es/raster/models/index.js.map +0 -1
- package/es/raster/models/raster.d.ts +0 -19
- package/es/raster/models/raster.js +0 -152
- package/es/raster/models/raster.js.map +0 -1
- package/es/raster/raster.d.ts +0 -30
- package/es/raster/raster.js +0 -178
- package/es/raster/raster.js.map +0 -1
- package/es/raster/raster2d.d.ts +0 -27
- package/es/raster/raster2d.js +0 -158
- package/es/raster/raster2d.js.map +0 -1
- package/es/utils/blend.d.ts +0 -2
- package/es/utils/blend.js +0 -55
- package/es/utils/blend.js.map +0 -1
- package/es/utils/collision-index.d.ts +0 -47
- package/es/utils/collision-index.js +0 -87
- package/es/utils/collision-index.js.map +0 -1
- package/es/utils/dataMappingStyle.d.ts +0 -30
- package/es/utils/dataMappingStyle.js +0 -88
- package/es/utils/dataMappingStyle.js.map +0 -1
- package/es/utils/extrude_polyline.d.ts +0 -48
- package/es/utils/extrude_polyline.js +0 -405
- package/es/utils/extrude_polyline.js.map +0 -1
- package/es/utils/geo.d.ts +0 -3
- package/es/utils/geo.js +0 -24
- package/es/utils/geo.js.map +0 -1
- package/es/utils/grid-index.d.ts +0 -28
- package/es/utils/grid-index.js +0 -193
- package/es/utils/grid-index.js.map +0 -1
- package/es/utils/polylineNormal.d.ts +0 -9
- package/es/utils/polylineNormal.js +0 -171
- package/es/utils/polylineNormal.js.map +0 -1
- package/es/utils/symbol-layout.d.ts +0 -43
- package/es/utils/symbol-layout.js +0 -260
- package/es/utils/symbol-layout.js.map +0 -1
package/es/core/BaseLayer.js
DELETED
|
@@ -1,974 +0,0 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
-
import _initializerDefineProperty from "@babel/runtime/helpers/initializerDefineProperty";
|
|
3
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
-
import _applyDecoratedDescriptor from "@babel/runtime/helpers/applyDecoratedDescriptor";
|
|
11
|
-
import _initializerWarningHelper from "@babel/runtime/helpers/initializerWarningHelper";
|
|
12
|
-
import _isObject from "lodash/isObject";
|
|
13
|
-
import _isFunction from "lodash/isFunction";
|
|
14
|
-
|
|
15
|
-
var _dec, _dec2, _class, _descriptor, _descriptor2;
|
|
16
|
-
|
|
17
|
-
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; } } }; }
|
|
18
|
-
|
|
19
|
-
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); }
|
|
20
|
-
|
|
21
|
-
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; }
|
|
22
|
-
|
|
23
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
24
|
-
|
|
25
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
26
|
-
|
|
27
|
-
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); }; }
|
|
28
|
-
|
|
29
|
-
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; } }
|
|
30
|
-
|
|
31
|
-
import { SyncBailHook, SyncHook, SyncWaterfallHook } from '@antv/async-hook';
|
|
32
|
-
import { BlendType, lazyInject, TYPES } from '@antv/l7-core';
|
|
33
|
-
import { encodePickingColor } from '@antv/l7-utils';
|
|
34
|
-
import { EventEmitter } from 'eventemitter3';
|
|
35
|
-
import { normalizePasses } from '../plugins/MultiPassRendererPlugin';
|
|
36
|
-
import { BlendTypes } from '../utils/blend';
|
|
37
|
-
import { handleStyleDataMapping } from '../utils/dataMappingStyle';
|
|
38
|
-
var layerIdCounter = 0;
|
|
39
|
-
var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), _dec2 = lazyInject(TYPES.IShaderModuleService), (_class = function (_EventEmitter) {
|
|
40
|
-
_inherits(BaseLayer, _EventEmitter);
|
|
41
|
-
|
|
42
|
-
var _super = _createSuper(BaseLayer);
|
|
43
|
-
|
|
44
|
-
function BaseLayer() {
|
|
45
|
-
var _this;
|
|
46
|
-
|
|
47
|
-
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
48
|
-
|
|
49
|
-
_classCallCheck(this, BaseLayer);
|
|
50
|
-
|
|
51
|
-
_this = _super.call(this);
|
|
52
|
-
|
|
53
|
-
_defineProperty(_assertThisInitialized(_this), "id", "".concat(layerIdCounter++));
|
|
54
|
-
|
|
55
|
-
_defineProperty(_assertThisInitialized(_this), "name", "".concat(layerIdCounter));
|
|
56
|
-
|
|
57
|
-
_defineProperty(_assertThisInitialized(_this), "type", void 0);
|
|
58
|
-
|
|
59
|
-
_defineProperty(_assertThisInitialized(_this), "visible", true);
|
|
60
|
-
|
|
61
|
-
_defineProperty(_assertThisInitialized(_this), "zIndex", 0);
|
|
62
|
-
|
|
63
|
-
_defineProperty(_assertThisInitialized(_this), "minZoom", void 0);
|
|
64
|
-
|
|
65
|
-
_defineProperty(_assertThisInitialized(_this), "maxZoom", void 0);
|
|
66
|
-
|
|
67
|
-
_defineProperty(_assertThisInitialized(_this), "inited", false);
|
|
68
|
-
|
|
69
|
-
_defineProperty(_assertThisInitialized(_this), "layerModelNeedUpdate", false);
|
|
70
|
-
|
|
71
|
-
_defineProperty(_assertThisInitialized(_this), "pickedFeatureID", null);
|
|
72
|
-
|
|
73
|
-
_defineProperty(_assertThisInitialized(_this), "selectedFeatureID", null);
|
|
74
|
-
|
|
75
|
-
_defineProperty(_assertThisInitialized(_this), "styleNeedUpdate", false);
|
|
76
|
-
|
|
77
|
-
_defineProperty(_assertThisInitialized(_this), "rendering", void 0);
|
|
78
|
-
|
|
79
|
-
_defineProperty(_assertThisInitialized(_this), "dataState", {
|
|
80
|
-
dataSourceNeedUpdate: false,
|
|
81
|
-
dataMappingNeedUpdate: false,
|
|
82
|
-
filterNeedUpdate: false,
|
|
83
|
-
featureScaleNeedUpdate: false,
|
|
84
|
-
StyleAttrNeedUpdate: false
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
_defineProperty(_assertThisInitialized(_this), "hooks", {
|
|
88
|
-
init: new SyncBailHook(),
|
|
89
|
-
afterInit: new SyncBailHook(),
|
|
90
|
-
beforeRender: new SyncBailHook(),
|
|
91
|
-
beforeRenderData: new SyncWaterfallHook(),
|
|
92
|
-
afterRender: new SyncHook(),
|
|
93
|
-
beforePickingEncode: new SyncHook(),
|
|
94
|
-
afterPickingEncode: new SyncHook(),
|
|
95
|
-
beforeHighlight: new SyncHook(['pickedColor']),
|
|
96
|
-
afterHighlight: new SyncHook(),
|
|
97
|
-
beforeSelect: new SyncHook(['pickedColor']),
|
|
98
|
-
afterSelect: new SyncHook(),
|
|
99
|
-
beforeDestroy: new SyncHook(),
|
|
100
|
-
afterDestroy: new SyncHook()
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
_defineProperty(_assertThisInitialized(_this), "models", []);
|
|
104
|
-
|
|
105
|
-
_defineProperty(_assertThisInitialized(_this), "multiPassRenderer", void 0);
|
|
106
|
-
|
|
107
|
-
_defineProperty(_assertThisInitialized(_this), "plugins", void 0);
|
|
108
|
-
|
|
109
|
-
_defineProperty(_assertThisInitialized(_this), "sourceOption", void 0);
|
|
110
|
-
|
|
111
|
-
_defineProperty(_assertThisInitialized(_this), "layerModel", void 0);
|
|
112
|
-
|
|
113
|
-
_initializerDefineProperty(_assertThisInitialized(_this), "configService", _descriptor, _assertThisInitialized(_this));
|
|
114
|
-
|
|
115
|
-
_initializerDefineProperty(_assertThisInitialized(_this), "shaderModuleService", _descriptor2, _assertThisInitialized(_this));
|
|
116
|
-
|
|
117
|
-
_defineProperty(_assertThisInitialized(_this), "cameraService", void 0);
|
|
118
|
-
|
|
119
|
-
_defineProperty(_assertThisInitialized(_this), "coordinateService", void 0);
|
|
120
|
-
|
|
121
|
-
_defineProperty(_assertThisInitialized(_this), "iconService", void 0);
|
|
122
|
-
|
|
123
|
-
_defineProperty(_assertThisInitialized(_this), "fontService", void 0);
|
|
124
|
-
|
|
125
|
-
_defineProperty(_assertThisInitialized(_this), "pickingService", void 0);
|
|
126
|
-
|
|
127
|
-
_defineProperty(_assertThisInitialized(_this), "rendererService", void 0);
|
|
128
|
-
|
|
129
|
-
_defineProperty(_assertThisInitialized(_this), "layerService", void 0);
|
|
130
|
-
|
|
131
|
-
_defineProperty(_assertThisInitialized(_this), "interactionService", void 0);
|
|
132
|
-
|
|
133
|
-
_defineProperty(_assertThisInitialized(_this), "mapService", void 0);
|
|
134
|
-
|
|
135
|
-
_defineProperty(_assertThisInitialized(_this), "styleAttributeService", void 0);
|
|
136
|
-
|
|
137
|
-
_defineProperty(_assertThisInitialized(_this), "layerSource", void 0);
|
|
138
|
-
|
|
139
|
-
_defineProperty(_assertThisInitialized(_this), "postProcessingPassFactory", void 0);
|
|
140
|
-
|
|
141
|
-
_defineProperty(_assertThisInitialized(_this), "normalPassFactory", void 0);
|
|
142
|
-
|
|
143
|
-
_defineProperty(_assertThisInitialized(_this), "animateOptions", {
|
|
144
|
-
enable: false
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
_defineProperty(_assertThisInitialized(_this), "container", void 0);
|
|
148
|
-
|
|
149
|
-
_defineProperty(_assertThisInitialized(_this), "encodedData", void 0);
|
|
150
|
-
|
|
151
|
-
_defineProperty(_assertThisInitialized(_this), "configSchema", void 0);
|
|
152
|
-
|
|
153
|
-
_defineProperty(_assertThisInitialized(_this), "currentPickId", null);
|
|
154
|
-
|
|
155
|
-
_defineProperty(_assertThisInitialized(_this), "rawConfig", void 0);
|
|
156
|
-
|
|
157
|
-
_defineProperty(_assertThisInitialized(_this), "needUpdateConfig", void 0);
|
|
158
|
-
|
|
159
|
-
_defineProperty(_assertThisInitialized(_this), "pendingStyleAttributes", []);
|
|
160
|
-
|
|
161
|
-
_defineProperty(_assertThisInitialized(_this), "scaleOptions", {});
|
|
162
|
-
|
|
163
|
-
_defineProperty(_assertThisInitialized(_this), "animateStartTime", void 0);
|
|
164
|
-
|
|
165
|
-
_defineProperty(_assertThisInitialized(_this), "aniamateStatus", false);
|
|
166
|
-
|
|
167
|
-
_defineProperty(_assertThisInitialized(_this), "sourceEvent", function () {
|
|
168
|
-
_this.dataState.dataSourceNeedUpdate = true;
|
|
169
|
-
|
|
170
|
-
var _this$getLayerConfig = _this.getLayerConfig(),
|
|
171
|
-
autoFit = _this$getLayerConfig.autoFit,
|
|
172
|
-
fitBoundsOptions = _this$getLayerConfig.fitBoundsOptions;
|
|
173
|
-
|
|
174
|
-
if (autoFit) {
|
|
175
|
-
_this.fitBounds(fitBoundsOptions);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
_this.emit('dataUpdate');
|
|
179
|
-
|
|
180
|
-
_this.reRender();
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
_this.name = config.name || _this.id;
|
|
184
|
-
_this.zIndex = config.zIndex || 0;
|
|
185
|
-
_this.rawConfig = config;
|
|
186
|
-
return _this;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
_createClass(BaseLayer, [{
|
|
190
|
-
key: "getLayerConfig",
|
|
191
|
-
value: function getLayerConfig() {
|
|
192
|
-
return this.configService.getLayerConfig(this.id);
|
|
193
|
-
}
|
|
194
|
-
}, {
|
|
195
|
-
key: "updateLayerConfig",
|
|
196
|
-
value: function updateLayerConfig(configToUpdate) {
|
|
197
|
-
if (!this.inited) {
|
|
198
|
-
this.needUpdateConfig = _objectSpread(_objectSpread({}, this.needUpdateConfig), configToUpdate);
|
|
199
|
-
} else {
|
|
200
|
-
var sceneId = this.container.get(TYPES.SceneID);
|
|
201
|
-
handleStyleDataMapping(configToUpdate, this);
|
|
202
|
-
this.configService.setLayerConfig(sceneId, this.id, _objectSpread(_objectSpread(_objectSpread({}, this.configService.getLayerConfig(this.id)), this.needUpdateConfig), configToUpdate));
|
|
203
|
-
this.needUpdateConfig = {};
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}, {
|
|
207
|
-
key: "setContainer",
|
|
208
|
-
value: function setContainer(container) {
|
|
209
|
-
this.container = container;
|
|
210
|
-
}
|
|
211
|
-
}, {
|
|
212
|
-
key: "getContainer",
|
|
213
|
-
value: function getContainer() {
|
|
214
|
-
return this.container;
|
|
215
|
-
}
|
|
216
|
-
}, {
|
|
217
|
-
key: "addPlugin",
|
|
218
|
-
value: function addPlugin(plugin) {
|
|
219
|
-
this.plugins.push(plugin);
|
|
220
|
-
return this;
|
|
221
|
-
}
|
|
222
|
-
}, {
|
|
223
|
-
key: "init",
|
|
224
|
-
value: function init() {
|
|
225
|
-
var _this2 = this;
|
|
226
|
-
|
|
227
|
-
var sceneId = this.container.get(TYPES.SceneID);
|
|
228
|
-
var _this$rawConfig$enabl = this.rawConfig.enableMultiPassRenderer,
|
|
229
|
-
enableMultiPassRenderer = _this$rawConfig$enabl === void 0 ? false : _this$rawConfig$enabl;
|
|
230
|
-
this.configService.setLayerConfig(sceneId, this.id, {
|
|
231
|
-
enableMultiPassRenderer: enableMultiPassRenderer
|
|
232
|
-
});
|
|
233
|
-
this.iconService = this.container.get(TYPES.IIconService);
|
|
234
|
-
this.fontService = this.container.get(TYPES.IFontService);
|
|
235
|
-
this.rendererService = this.container.get(TYPES.IRendererService);
|
|
236
|
-
this.layerService = this.container.get(TYPES.ILayerService);
|
|
237
|
-
this.interactionService = this.container.get(TYPES.IInteractionService);
|
|
238
|
-
this.pickingService = this.container.get(TYPES.IPickingService);
|
|
239
|
-
this.mapService = this.container.get(TYPES.IMapService);
|
|
240
|
-
this.cameraService = this.container.get(TYPES.ICameraService);
|
|
241
|
-
this.coordinateService = this.container.get(TYPES.ICoordinateSystemService);
|
|
242
|
-
this.postProcessingPassFactory = this.container.get(TYPES.IFactoryPostProcessingPass);
|
|
243
|
-
this.normalPassFactory = this.container.get(TYPES.IFactoryNormalPass);
|
|
244
|
-
this.styleAttributeService = this.container.get(TYPES.IStyleAttributeService);
|
|
245
|
-
this.multiPassRenderer = this.container.get(TYPES.IMultiPassRenderer);
|
|
246
|
-
this.multiPassRenderer.setLayer(this);
|
|
247
|
-
this.pendingStyleAttributes.forEach(function (_ref) {
|
|
248
|
-
var attributeName = _ref.attributeName,
|
|
249
|
-
attributeField = _ref.attributeField,
|
|
250
|
-
attributeValues = _ref.attributeValues,
|
|
251
|
-
updateOptions = _ref.updateOptions;
|
|
252
|
-
|
|
253
|
-
_this2.styleAttributeService.updateStyleAttribute(attributeName, {
|
|
254
|
-
scale: _objectSpread({
|
|
255
|
-
field: attributeField
|
|
256
|
-
}, _this2.splitValuesAndCallbackInAttribute(attributeValues, _this2.getLayerConfig()[attributeName]))
|
|
257
|
-
}, updateOptions);
|
|
258
|
-
});
|
|
259
|
-
this.pendingStyleAttributes = [];
|
|
260
|
-
this.plugins = this.container.getAll(TYPES.ILayerPlugin);
|
|
261
|
-
|
|
262
|
-
var _iterator = _createForOfIteratorHelper(this.plugins),
|
|
263
|
-
_step;
|
|
264
|
-
|
|
265
|
-
try {
|
|
266
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
267
|
-
var plugin = _step.value;
|
|
268
|
-
plugin.apply(this, {
|
|
269
|
-
rendererService: this.rendererService,
|
|
270
|
-
mapService: this.mapService,
|
|
271
|
-
styleAttributeService: this.styleAttributeService,
|
|
272
|
-
normalPassFactory: this.normalPassFactory,
|
|
273
|
-
postProcessingPassFactory: this.postProcessingPassFactory
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
} catch (err) {
|
|
277
|
-
_iterator.e(err);
|
|
278
|
-
} finally {
|
|
279
|
-
_iterator.f();
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
this.hooks.init.call();
|
|
283
|
-
this.hooks.afterInit.call();
|
|
284
|
-
this.emit('inited', {
|
|
285
|
-
target: this,
|
|
286
|
-
type: 'inited'
|
|
287
|
-
});
|
|
288
|
-
this.emit('add', {
|
|
289
|
-
target: this,
|
|
290
|
-
type: 'add'
|
|
291
|
-
});
|
|
292
|
-
return this;
|
|
293
|
-
}
|
|
294
|
-
}, {
|
|
295
|
-
key: "prepareBuildModel",
|
|
296
|
-
value: function prepareBuildModel() {
|
|
297
|
-
this.inited = true;
|
|
298
|
-
this.updateLayerConfig(_objectSpread(_objectSpread({}, this.getDefaultConfig()), this.rawConfig));
|
|
299
|
-
|
|
300
|
-
var _this$getLayerConfig2 = this.getLayerConfig(),
|
|
301
|
-
animateOption = _this$getLayerConfig2.animateOption;
|
|
302
|
-
|
|
303
|
-
if (animateOption !== null && animateOption !== void 0 && animateOption.enable) {
|
|
304
|
-
this.layerService.startAnimate();
|
|
305
|
-
this.aniamateStatus = true;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
}, {
|
|
309
|
-
key: "color",
|
|
310
|
-
value: function color(field, values, updateOptions) {
|
|
311
|
-
this.updateStyleAttribute('color', field, values, updateOptions);
|
|
312
|
-
return this;
|
|
313
|
-
}
|
|
314
|
-
}, {
|
|
315
|
-
key: "texture",
|
|
316
|
-
value: function texture(field, values, updateOptions) {
|
|
317
|
-
this.updateStyleAttribute('texture', field, values, updateOptions);
|
|
318
|
-
return this;
|
|
319
|
-
}
|
|
320
|
-
}, {
|
|
321
|
-
key: "rotate",
|
|
322
|
-
value: function rotate(field, values, updateOptions) {
|
|
323
|
-
this.updateStyleAttribute('rotate', field, values, updateOptions);
|
|
324
|
-
return this;
|
|
325
|
-
}
|
|
326
|
-
}, {
|
|
327
|
-
key: "size",
|
|
328
|
-
value: function size(field, values, updateOptions) {
|
|
329
|
-
this.updateStyleAttribute('size', field, values, updateOptions);
|
|
330
|
-
return this;
|
|
331
|
-
}
|
|
332
|
-
}, {
|
|
333
|
-
key: "filter",
|
|
334
|
-
value: function filter(field, values, updateOptions) {
|
|
335
|
-
this.updateStyleAttribute('filter', field, values, updateOptions);
|
|
336
|
-
return this;
|
|
337
|
-
}
|
|
338
|
-
}, {
|
|
339
|
-
key: "shape",
|
|
340
|
-
value: function shape(field, values, updateOptions) {
|
|
341
|
-
this.updateStyleAttribute('shape', field, values, updateOptions);
|
|
342
|
-
return this;
|
|
343
|
-
}
|
|
344
|
-
}, {
|
|
345
|
-
key: "label",
|
|
346
|
-
value: function label(field, values, updateOptions) {
|
|
347
|
-
this.pendingStyleAttributes.push({
|
|
348
|
-
attributeName: 'label',
|
|
349
|
-
attributeField: field,
|
|
350
|
-
attributeValues: values,
|
|
351
|
-
updateOptions: updateOptions
|
|
352
|
-
});
|
|
353
|
-
return this;
|
|
354
|
-
}
|
|
355
|
-
}, {
|
|
356
|
-
key: "animate",
|
|
357
|
-
value: function animate(options) {
|
|
358
|
-
var rawAnimate = {};
|
|
359
|
-
|
|
360
|
-
if (_isObject(options)) {
|
|
361
|
-
rawAnimate.enable = true;
|
|
362
|
-
rawAnimate = _objectSpread(_objectSpread({}, rawAnimate), options);
|
|
363
|
-
} else {
|
|
364
|
-
rawAnimate.enable = options;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
this.updateLayerConfig({
|
|
368
|
-
animateOption: rawAnimate
|
|
369
|
-
});
|
|
370
|
-
return this;
|
|
371
|
-
}
|
|
372
|
-
}, {
|
|
373
|
-
key: "source",
|
|
374
|
-
value: function source(data, options) {
|
|
375
|
-
if (data !== null && data !== void 0 && data.data) {
|
|
376
|
-
this.setSource(data);
|
|
377
|
-
return this;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
this.sourceOption = {
|
|
381
|
-
data: data,
|
|
382
|
-
options: options
|
|
383
|
-
};
|
|
384
|
-
return this;
|
|
385
|
-
}
|
|
386
|
-
}, {
|
|
387
|
-
key: "setData",
|
|
388
|
-
value: function setData(data, options) {
|
|
389
|
-
var _this3 = this;
|
|
390
|
-
|
|
391
|
-
if (this.inited) {
|
|
392
|
-
this.layerSource.setData(data, options);
|
|
393
|
-
} else {
|
|
394
|
-
this.on('inited', function () {
|
|
395
|
-
_this3.layerSource.setData(data, options);
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
return this;
|
|
400
|
-
}
|
|
401
|
-
}, {
|
|
402
|
-
key: "style",
|
|
403
|
-
value: function style(options) {
|
|
404
|
-
var _this4 = this;
|
|
405
|
-
|
|
406
|
-
var passes = options.passes,
|
|
407
|
-
rest = _objectWithoutProperties(options, ["passes"]);
|
|
408
|
-
|
|
409
|
-
if (passes) {
|
|
410
|
-
normalizePasses(passes).forEach(function (pass) {
|
|
411
|
-
var postProcessingPass = _this4.multiPassRenderer.getPostProcessor().getPostProcessingPassByName(pass[0]);
|
|
412
|
-
|
|
413
|
-
if (postProcessingPass) {
|
|
414
|
-
postProcessingPass.updateOptions(pass[1]);
|
|
415
|
-
}
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
this.rawConfig = _objectSpread(_objectSpread({}, this.rawConfig), rest);
|
|
420
|
-
|
|
421
|
-
if (this.container) {
|
|
422
|
-
this.updateLayerConfig(this.rawConfig);
|
|
423
|
-
this.styleNeedUpdate = true;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
return this;
|
|
427
|
-
}
|
|
428
|
-
}, {
|
|
429
|
-
key: "scale",
|
|
430
|
-
value: function scale(field, cfg) {
|
|
431
|
-
if (_isObject(field)) {
|
|
432
|
-
this.scaleOptions = _objectSpread(_objectSpread({}, this.scaleOptions), field);
|
|
433
|
-
} else {
|
|
434
|
-
this.scaleOptions[field] = cfg;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
return this;
|
|
438
|
-
}
|
|
439
|
-
}, {
|
|
440
|
-
key: "renderLayers",
|
|
441
|
-
value: function renderLayers() {
|
|
442
|
-
this.rendering = true;
|
|
443
|
-
this.layerService.renderLayers();
|
|
444
|
-
this.rendering = false;
|
|
445
|
-
}
|
|
446
|
-
}, {
|
|
447
|
-
key: "render",
|
|
448
|
-
value: function render() {
|
|
449
|
-
if (this.getEncodedData().length !== 0) {
|
|
450
|
-
this.renderModels();
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
return this;
|
|
454
|
-
}
|
|
455
|
-
}, {
|
|
456
|
-
key: "active",
|
|
457
|
-
value: function active(options) {
|
|
458
|
-
var activeOption = {};
|
|
459
|
-
activeOption.enableHighlight = _isObject(options) ? true : options;
|
|
460
|
-
|
|
461
|
-
if (_isObject(options)) {
|
|
462
|
-
activeOption.enableHighlight = true;
|
|
463
|
-
|
|
464
|
-
if (options.color) {
|
|
465
|
-
activeOption.highlightColor = options.color;
|
|
466
|
-
}
|
|
467
|
-
} else {
|
|
468
|
-
activeOption.enableHighlight = !!options;
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
this.updateLayerConfig(activeOption);
|
|
472
|
-
return this;
|
|
473
|
-
}
|
|
474
|
-
}, {
|
|
475
|
-
key: "setActive",
|
|
476
|
-
value: function setActive(id, options) {
|
|
477
|
-
var _this5 = this;
|
|
478
|
-
|
|
479
|
-
if (_isObject(id)) {
|
|
480
|
-
var _id$x = id.x,
|
|
481
|
-
x = _id$x === void 0 ? 0 : _id$x,
|
|
482
|
-
_id$y = id.y,
|
|
483
|
-
y = _id$y === void 0 ? 0 : _id$y;
|
|
484
|
-
this.updateLayerConfig({
|
|
485
|
-
highlightColor: _isObject(options) ? options.color : this.getLayerConfig().highlightColor
|
|
486
|
-
});
|
|
487
|
-
this.pick({
|
|
488
|
-
x: x,
|
|
489
|
-
y: y
|
|
490
|
-
});
|
|
491
|
-
} else {
|
|
492
|
-
this.updateLayerConfig({
|
|
493
|
-
pickedFeatureID: id,
|
|
494
|
-
highlightColor: _isObject(options) ? options.color : this.getLayerConfig().highlightColor
|
|
495
|
-
});
|
|
496
|
-
this.hooks.beforeSelect.call(encodePickingColor(id)).then(function () {
|
|
497
|
-
setTimeout(function () {
|
|
498
|
-
_this5.reRender();
|
|
499
|
-
}, 1);
|
|
500
|
-
});
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
}, {
|
|
504
|
-
key: "select",
|
|
505
|
-
value: function select(option) {
|
|
506
|
-
var activeOption = {};
|
|
507
|
-
activeOption.enableSelect = _isObject(option) ? true : option;
|
|
508
|
-
|
|
509
|
-
if (_isObject(option)) {
|
|
510
|
-
activeOption.enableSelect = true;
|
|
511
|
-
|
|
512
|
-
if (option.color) {
|
|
513
|
-
activeOption.selectColor = option.color;
|
|
514
|
-
}
|
|
515
|
-
} else {
|
|
516
|
-
activeOption.enableSelect = !!option;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
this.updateLayerConfig(activeOption);
|
|
520
|
-
return this;
|
|
521
|
-
}
|
|
522
|
-
}, {
|
|
523
|
-
key: "setSelect",
|
|
524
|
-
value: function setSelect(id, options) {
|
|
525
|
-
var _this6 = this;
|
|
526
|
-
|
|
527
|
-
if (_isObject(id)) {
|
|
528
|
-
var _id$x2 = id.x,
|
|
529
|
-
x = _id$x2 === void 0 ? 0 : _id$x2,
|
|
530
|
-
_id$y2 = id.y,
|
|
531
|
-
y = _id$y2 === void 0 ? 0 : _id$y2;
|
|
532
|
-
this.updateLayerConfig({
|
|
533
|
-
selectColor: _isObject(options) ? options.color : this.getLayerConfig().selectColor
|
|
534
|
-
});
|
|
535
|
-
this.pick({
|
|
536
|
-
x: x,
|
|
537
|
-
y: y
|
|
538
|
-
});
|
|
539
|
-
} else {
|
|
540
|
-
this.updateLayerConfig({
|
|
541
|
-
pickedFeatureID: id,
|
|
542
|
-
selectColor: _isObject(options) ? options.color : this.getLayerConfig().selectColor
|
|
543
|
-
});
|
|
544
|
-
this.hooks.beforeSelect.call(encodePickingColor(id)).then(function () {
|
|
545
|
-
setTimeout(function () {
|
|
546
|
-
_this6.reRender();
|
|
547
|
-
}, 1);
|
|
548
|
-
});
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
}, {
|
|
552
|
-
key: "setBlend",
|
|
553
|
-
value: function setBlend(type) {
|
|
554
|
-
this.updateLayerConfig({
|
|
555
|
-
blend: type
|
|
556
|
-
});
|
|
557
|
-
this.layerModelNeedUpdate = true;
|
|
558
|
-
this.reRender();
|
|
559
|
-
}
|
|
560
|
-
}, {
|
|
561
|
-
key: "show",
|
|
562
|
-
value: function show() {
|
|
563
|
-
this.updateLayerConfig({
|
|
564
|
-
visible: true
|
|
565
|
-
});
|
|
566
|
-
this.reRender();
|
|
567
|
-
return this;
|
|
568
|
-
}
|
|
569
|
-
}, {
|
|
570
|
-
key: "hide",
|
|
571
|
-
value: function hide() {
|
|
572
|
-
this.updateLayerConfig({
|
|
573
|
-
visible: false
|
|
574
|
-
});
|
|
575
|
-
this.reRender();
|
|
576
|
-
return this;
|
|
577
|
-
}
|
|
578
|
-
}, {
|
|
579
|
-
key: "setIndex",
|
|
580
|
-
value: function setIndex(index) {
|
|
581
|
-
this.zIndex = index;
|
|
582
|
-
this.layerService.updateRenderOrder();
|
|
583
|
-
return this;
|
|
584
|
-
}
|
|
585
|
-
}, {
|
|
586
|
-
key: "setCurrentPickId",
|
|
587
|
-
value: function setCurrentPickId(id) {
|
|
588
|
-
this.currentPickId = id;
|
|
589
|
-
}
|
|
590
|
-
}, {
|
|
591
|
-
key: "getCurrentPickId",
|
|
592
|
-
value: function getCurrentPickId() {
|
|
593
|
-
return this.currentPickId;
|
|
594
|
-
}
|
|
595
|
-
}, {
|
|
596
|
-
key: "setCurrentSelectedId",
|
|
597
|
-
value: function setCurrentSelectedId(id) {
|
|
598
|
-
this.selectedFeatureID = id;
|
|
599
|
-
}
|
|
600
|
-
}, {
|
|
601
|
-
key: "getCurrentSelectedId",
|
|
602
|
-
value: function getCurrentSelectedId() {
|
|
603
|
-
return this.selectedFeatureID;
|
|
604
|
-
}
|
|
605
|
-
}, {
|
|
606
|
-
key: "isVisible",
|
|
607
|
-
value: function isVisible() {
|
|
608
|
-
var zoom = this.mapService.getZoom();
|
|
609
|
-
|
|
610
|
-
var _this$getLayerConfig3 = this.getLayerConfig(),
|
|
611
|
-
visible = _this$getLayerConfig3.visible,
|
|
612
|
-
_this$getLayerConfig4 = _this$getLayerConfig3.minZoom,
|
|
613
|
-
minZoom = _this$getLayerConfig4 === void 0 ? -Infinity : _this$getLayerConfig4,
|
|
614
|
-
_this$getLayerConfig5 = _this$getLayerConfig3.maxZoom,
|
|
615
|
-
maxZoom = _this$getLayerConfig5 === void 0 ? Infinity : _this$getLayerConfig5;
|
|
616
|
-
|
|
617
|
-
return !!visible && zoom >= minZoom && zoom <= maxZoom;
|
|
618
|
-
}
|
|
619
|
-
}, {
|
|
620
|
-
key: "setMinZoom",
|
|
621
|
-
value: function setMinZoom(minZoom) {
|
|
622
|
-
this.updateLayerConfig({
|
|
623
|
-
minZoom: minZoom
|
|
624
|
-
});
|
|
625
|
-
return this;
|
|
626
|
-
}
|
|
627
|
-
}, {
|
|
628
|
-
key: "getMinZoom",
|
|
629
|
-
value: function getMinZoom() {
|
|
630
|
-
var _this$getLayerConfig6 = this.getLayerConfig(),
|
|
631
|
-
minZoom = _this$getLayerConfig6.minZoom;
|
|
632
|
-
|
|
633
|
-
return minZoom;
|
|
634
|
-
}
|
|
635
|
-
}, {
|
|
636
|
-
key: "getMaxZoom",
|
|
637
|
-
value: function getMaxZoom() {
|
|
638
|
-
var _this$getLayerConfig7 = this.getLayerConfig(),
|
|
639
|
-
maxZoom = _this$getLayerConfig7.maxZoom;
|
|
640
|
-
|
|
641
|
-
return maxZoom;
|
|
642
|
-
}
|
|
643
|
-
}, {
|
|
644
|
-
key: "get",
|
|
645
|
-
value: function get(name) {
|
|
646
|
-
var cfg = this.getLayerConfig();
|
|
647
|
-
return cfg[name];
|
|
648
|
-
}
|
|
649
|
-
}, {
|
|
650
|
-
key: "setMaxZoom",
|
|
651
|
-
value: function setMaxZoom(maxZoom) {
|
|
652
|
-
this.updateLayerConfig({
|
|
653
|
-
maxZoom: maxZoom
|
|
654
|
-
});
|
|
655
|
-
return this;
|
|
656
|
-
}
|
|
657
|
-
}, {
|
|
658
|
-
key: "fitBounds",
|
|
659
|
-
value: function fitBounds(fitBoundsOptions) {
|
|
660
|
-
if (!this.inited) {
|
|
661
|
-
this.updateLayerConfig({
|
|
662
|
-
autoFit: true
|
|
663
|
-
});
|
|
664
|
-
return this;
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
var source = this.getSource();
|
|
668
|
-
var extent = source.extent;
|
|
669
|
-
var isValid = extent.some(function (v) {
|
|
670
|
-
return Math.abs(v) === Infinity;
|
|
671
|
-
});
|
|
672
|
-
|
|
673
|
-
if (isValid) {
|
|
674
|
-
return this;
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
this.mapService.fitBounds([[extent[0], extent[1]], [extent[2], extent[3]]], fitBoundsOptions);
|
|
678
|
-
return this;
|
|
679
|
-
}
|
|
680
|
-
}, {
|
|
681
|
-
key: "destroy",
|
|
682
|
-
value: function destroy() {
|
|
683
|
-
this.hooks.beforeDestroy.call();
|
|
684
|
-
this.layerSource.off('update', this.sourceEvent);
|
|
685
|
-
this.multiPassRenderer.destroy();
|
|
686
|
-
this.styleAttributeService.clearAllAttributes();
|
|
687
|
-
this.hooks.afterDestroy.call();
|
|
688
|
-
this.emit('remove', {
|
|
689
|
-
target: this,
|
|
690
|
-
type: 'remove'
|
|
691
|
-
});
|
|
692
|
-
this.removeAllListeners();
|
|
693
|
-
}
|
|
694
|
-
}, {
|
|
695
|
-
key: "clear",
|
|
696
|
-
value: function clear() {
|
|
697
|
-
this.styleAttributeService.clearAllAttributes();
|
|
698
|
-
}
|
|
699
|
-
}, {
|
|
700
|
-
key: "clearModels",
|
|
701
|
-
value: function clearModels() {
|
|
702
|
-
this.models.forEach(function (model) {
|
|
703
|
-
return model.destroy();
|
|
704
|
-
});
|
|
705
|
-
this.layerModel.clearModels();
|
|
706
|
-
}
|
|
707
|
-
}, {
|
|
708
|
-
key: "isDirty",
|
|
709
|
-
value: function isDirty() {
|
|
710
|
-
return !!(this.styleAttributeService.getLayerStyleAttributes() || []).filter(function (attribute) {
|
|
711
|
-
return attribute.needRescale || attribute.needRemapping || attribute.needRegenerateVertices;
|
|
712
|
-
}).length;
|
|
713
|
-
}
|
|
714
|
-
}, {
|
|
715
|
-
key: "setSource",
|
|
716
|
-
value: function setSource(source) {
|
|
717
|
-
if (this.layerSource) {
|
|
718
|
-
this.layerSource.off('update', this.sourceEvent);
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
this.layerSource = source;
|
|
722
|
-
|
|
723
|
-
if (this.inited && this.layerSource.cluster) {
|
|
724
|
-
var zoom = this.mapService.getZoom();
|
|
725
|
-
this.layerSource.updateClusterData(zoom);
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
this.layerSource.on('update', this.sourceEvent);
|
|
729
|
-
}
|
|
730
|
-
}, {
|
|
731
|
-
key: "getSource",
|
|
732
|
-
value: function getSource() {
|
|
733
|
-
return this.layerSource;
|
|
734
|
-
}
|
|
735
|
-
}, {
|
|
736
|
-
key: "getScaleOptions",
|
|
737
|
-
value: function getScaleOptions() {
|
|
738
|
-
return this.scaleOptions;
|
|
739
|
-
}
|
|
740
|
-
}, {
|
|
741
|
-
key: "setEncodedData",
|
|
742
|
-
value: function setEncodedData(encodedData) {
|
|
743
|
-
this.encodedData = encodedData;
|
|
744
|
-
}
|
|
745
|
-
}, {
|
|
746
|
-
key: "getEncodedData",
|
|
747
|
-
value: function getEncodedData() {
|
|
748
|
-
return this.encodedData;
|
|
749
|
-
}
|
|
750
|
-
}, {
|
|
751
|
-
key: "getLegendItems",
|
|
752
|
-
value: function getLegendItems(name) {
|
|
753
|
-
var scale = this.styleAttributeService.getLayerAttributeScale(name);
|
|
754
|
-
|
|
755
|
-
if (scale) {
|
|
756
|
-
if (scale.ticks) {
|
|
757
|
-
var items = scale.ticks().map(function (item) {
|
|
758
|
-
return _defineProperty({
|
|
759
|
-
value: item
|
|
760
|
-
}, name, scale(item));
|
|
761
|
-
});
|
|
762
|
-
return items;
|
|
763
|
-
} else if (scale.invertExtent) {
|
|
764
|
-
var _items = scale.range().map(function (item) {
|
|
765
|
-
return _defineProperty({
|
|
766
|
-
value: scale.invertExtent(item)
|
|
767
|
-
}, name, item);
|
|
768
|
-
});
|
|
769
|
-
|
|
770
|
-
return _items;
|
|
771
|
-
}
|
|
772
|
-
} else {
|
|
773
|
-
return [];
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
}, {
|
|
777
|
-
key: "pick",
|
|
778
|
-
value: function pick(_ref4) {
|
|
779
|
-
var x = _ref4.x,
|
|
780
|
-
y = _ref4.y;
|
|
781
|
-
this.interactionService.triggerHover({
|
|
782
|
-
x: x,
|
|
783
|
-
y: y
|
|
784
|
-
});
|
|
785
|
-
}
|
|
786
|
-
}, {
|
|
787
|
-
key: "boxSelect",
|
|
788
|
-
value: function boxSelect(box, cb) {
|
|
789
|
-
this.pickingService.boxPickLayer(this, box, cb);
|
|
790
|
-
}
|
|
791
|
-
}, {
|
|
792
|
-
key: "buildLayerModel",
|
|
793
|
-
value: function buildLayerModel(options) {
|
|
794
|
-
var moduleName = options.moduleName,
|
|
795
|
-
vertexShader = options.vertexShader,
|
|
796
|
-
fragmentShader = options.fragmentShader,
|
|
797
|
-
triangulation = options.triangulation,
|
|
798
|
-
segmentNumber = options.segmentNumber,
|
|
799
|
-
rest = _objectWithoutProperties(options, ["moduleName", "vertexShader", "fragmentShader", "triangulation", "segmentNumber"]);
|
|
800
|
-
|
|
801
|
-
this.shaderModuleService.registerModule(moduleName, {
|
|
802
|
-
vs: vertexShader,
|
|
803
|
-
fs: fragmentShader
|
|
804
|
-
});
|
|
805
|
-
|
|
806
|
-
var _this$shaderModuleSer = this.shaderModuleService.getModule(moduleName),
|
|
807
|
-
vs = _this$shaderModuleSer.vs,
|
|
808
|
-
fs = _this$shaderModuleSer.fs,
|
|
809
|
-
uniforms = _this$shaderModuleSer.uniforms;
|
|
810
|
-
|
|
811
|
-
var createModel = this.rendererService.createModel;
|
|
812
|
-
|
|
813
|
-
var _this$styleAttributeS = this.styleAttributeService.createAttributesAndIndices(this.encodedData, triangulation, segmentNumber),
|
|
814
|
-
attributes = _this$styleAttributeS.attributes,
|
|
815
|
-
elements = _this$styleAttributeS.elements;
|
|
816
|
-
|
|
817
|
-
return createModel(_objectSpread({
|
|
818
|
-
attributes: attributes,
|
|
819
|
-
uniforms: uniforms,
|
|
820
|
-
fs: fs,
|
|
821
|
-
vs: vs,
|
|
822
|
-
elements: elements,
|
|
823
|
-
blend: BlendTypes[BlendType.normal]
|
|
824
|
-
}, rest));
|
|
825
|
-
}
|
|
826
|
-
}, {
|
|
827
|
-
key: "getTime",
|
|
828
|
-
value: function getTime() {
|
|
829
|
-
return this.layerService.clock.getDelta();
|
|
830
|
-
}
|
|
831
|
-
}, {
|
|
832
|
-
key: "setAnimateStartTime",
|
|
833
|
-
value: function setAnimateStartTime() {
|
|
834
|
-
this.animateStartTime = this.layerService.clock.getElapsedTime();
|
|
835
|
-
}
|
|
836
|
-
}, {
|
|
837
|
-
key: "stopAnimate",
|
|
838
|
-
value: function stopAnimate() {
|
|
839
|
-
if (this.aniamateStatus) {
|
|
840
|
-
this.layerService.stopAnimate();
|
|
841
|
-
this.aniamateStatus = false;
|
|
842
|
-
this.updateLayerConfig({
|
|
843
|
-
animateOption: {
|
|
844
|
-
enable: false
|
|
845
|
-
}
|
|
846
|
-
});
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
}, {
|
|
850
|
-
key: "getLayerAnimateTime",
|
|
851
|
-
value: function getLayerAnimateTime() {
|
|
852
|
-
return this.layerService.clock.getElapsedTime() - this.animateStartTime;
|
|
853
|
-
}
|
|
854
|
-
}, {
|
|
855
|
-
key: "needPick",
|
|
856
|
-
value: function needPick(type) {
|
|
857
|
-
var _this$getLayerConfig8 = this.getLayerConfig(),
|
|
858
|
-
_this$getLayerConfig9 = _this$getLayerConfig8.enableHighlight,
|
|
859
|
-
enableHighlight = _this$getLayerConfig9 === void 0 ? true : _this$getLayerConfig9,
|
|
860
|
-
_this$getLayerConfig10 = _this$getLayerConfig8.enableSelect,
|
|
861
|
-
enableSelect = _this$getLayerConfig10 === void 0 ? true : _this$getLayerConfig10;
|
|
862
|
-
|
|
863
|
-
var isPick = this.eventNames().indexOf(type) !== -1 || this.eventNames().indexOf('un' + type) !== -1;
|
|
864
|
-
|
|
865
|
-
if ((type === 'click' || type === 'dblclick') && enableSelect) {
|
|
866
|
-
isPick = true;
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
if (type === 'mousemove' && (enableHighlight || this.eventNames().indexOf('mouseenter') !== -1 || this.eventNames().indexOf('unmousemove') !== -1 || this.eventNames().indexOf('mouseout') !== -1)) {
|
|
870
|
-
isPick = true;
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
return this.isVisible() && isPick;
|
|
874
|
-
}
|
|
875
|
-
}, {
|
|
876
|
-
key: "buildModels",
|
|
877
|
-
value: function buildModels() {
|
|
878
|
-
throw new Error('Method not implemented.');
|
|
879
|
-
}
|
|
880
|
-
}, {
|
|
881
|
-
key: "rebuildModels",
|
|
882
|
-
value: function rebuildModels() {
|
|
883
|
-
throw new Error('Method not implemented.');
|
|
884
|
-
}
|
|
885
|
-
}, {
|
|
886
|
-
key: "renderModels",
|
|
887
|
-
value: function renderModels() {
|
|
888
|
-
var _this7 = this;
|
|
889
|
-
|
|
890
|
-
if (this.getEncodedData().length > 0) {
|
|
891
|
-
if (this.layerModelNeedUpdate && this.layerModel) {
|
|
892
|
-
this.models = this.layerModel.buildModels();
|
|
893
|
-
this.hooks.beforeRender.call();
|
|
894
|
-
this.layerModelNeedUpdate = false;
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
this.models.forEach(function (model) {
|
|
898
|
-
model.draw({
|
|
899
|
-
uniforms: _this7.layerModel.getUninforms()
|
|
900
|
-
});
|
|
901
|
-
});
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
return this;
|
|
905
|
-
}
|
|
906
|
-
}, {
|
|
907
|
-
key: "updateStyleAttribute",
|
|
908
|
-
value: function updateStyleAttribute(type, field, values, updateOptions) {
|
|
909
|
-
if (!this.inited) {
|
|
910
|
-
this.pendingStyleAttributes.push({
|
|
911
|
-
attributeName: type,
|
|
912
|
-
attributeField: field,
|
|
913
|
-
attributeValues: values,
|
|
914
|
-
updateOptions: updateOptions
|
|
915
|
-
});
|
|
916
|
-
} else {
|
|
917
|
-
this.styleAttributeService.updateStyleAttribute(type, {
|
|
918
|
-
scale: _objectSpread({
|
|
919
|
-
field: field
|
|
920
|
-
}, this.splitValuesAndCallbackInAttribute(values, this.getLayerConfig()[field]))
|
|
921
|
-
}, updateOptions);
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
}, {
|
|
925
|
-
key: "setEarthTime",
|
|
926
|
-
value: function setEarthTime(time) {
|
|
927
|
-
console.warn('empty fn');
|
|
928
|
-
}
|
|
929
|
-
}, {
|
|
930
|
-
key: "getConfigSchema",
|
|
931
|
-
value: function getConfigSchema() {
|
|
932
|
-
throw new Error('Method not implemented.');
|
|
933
|
-
}
|
|
934
|
-
}, {
|
|
935
|
-
key: "getModelType",
|
|
936
|
-
value: function getModelType() {
|
|
937
|
-
throw new Error('Method not implemented.');
|
|
938
|
-
}
|
|
939
|
-
}, {
|
|
940
|
-
key: "getDefaultConfig",
|
|
941
|
-
value: function getDefaultConfig() {
|
|
942
|
-
return {};
|
|
943
|
-
}
|
|
944
|
-
}, {
|
|
945
|
-
key: "reRender",
|
|
946
|
-
value: function reRender() {
|
|
947
|
-
if (this.inited) {
|
|
948
|
-
this.layerService.renderLayers();
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
}, {
|
|
952
|
-
key: "splitValuesAndCallbackInAttribute",
|
|
953
|
-
value: function splitValuesAndCallbackInAttribute(valuesOrCallback, defaultValues) {
|
|
954
|
-
return {
|
|
955
|
-
values: _isFunction(valuesOrCallback) ? undefined : valuesOrCallback || defaultValues,
|
|
956
|
-
callback: _isFunction(valuesOrCallback) ? valuesOrCallback : undefined
|
|
957
|
-
};
|
|
958
|
-
}
|
|
959
|
-
}]);
|
|
960
|
-
|
|
961
|
-
return BaseLayer;
|
|
962
|
-
}(EventEmitter), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "configService", [_dec], {
|
|
963
|
-
configurable: true,
|
|
964
|
-
enumerable: true,
|
|
965
|
-
writable: true,
|
|
966
|
-
initializer: null
|
|
967
|
-
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "shaderModuleService", [_dec2], {
|
|
968
|
-
configurable: true,
|
|
969
|
-
enumerable: true,
|
|
970
|
-
writable: true,
|
|
971
|
-
initializer: null
|
|
972
|
-
})), _class));
|
|
973
|
-
export { BaseLayer as default };
|
|
974
|
-
//# sourceMappingURL=BaseLayer.js.map
|