@antv/l7-layers 2.15.2 → 2.15.4
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/es/Geometry/index.js +9 -31
- package/es/Geometry/models/billboard.js +51 -89
- package/es/Geometry/models/plane.js +81 -143
- package/es/Geometry/models/sprite.js +60 -118
- package/es/canvas/index.js +10 -33
- package/es/canvas/models/canvas.js +41 -97
- package/es/citybuliding/building.js +8 -27
- package/es/citybuliding/models/build.js +57 -82
- package/es/core/BaseLayer.js +320 -484
- package/es/core/BaseModel.js +97 -126
- package/es/core/LayerPickService.js +21 -32
- package/es/core/TextureService.js +0 -13
- package/es/core/interface.js +17 -24
- package/es/core/shape/Path.js +13 -20
- package/es/core/shape/extrude.js +10 -31
- package/es/core/triangulation.js +54 -114
- package/es/earth/index.js +9 -33
- package/es/earth/models/atmosphere.js +30 -54
- package/es/earth/models/base.js +47 -85
- package/es/earth/models/bloomsphere.js +30 -54
- package/es/earth/utils.js +9 -13
- package/es/heatmap/index.js +10 -40
- package/es/heatmap/models/grid.js +28 -52
- package/es/heatmap/models/grid3d.js +28 -52
- package/es/heatmap/models/heatmap.js +91 -146
- package/es/heatmap/models/hexagon.js +28 -52
- package/es/heatmap/triangulation.js +0 -4
- package/es/image/index.js +9 -28
- package/es/image/models/image.js +66 -100
- package/es/index.js +9 -17
- package/es/line/index.js +9 -34
- package/es/line/models/arc.js +66 -118
- package/es/line/models/arc_3d.js +60 -108
- package/es/line/models/earthArc_3d.js +63 -111
- package/es/line/models/great_circle.js +56 -100
- package/es/line/models/half.js +46 -77
- package/es/line/models/line.js +94 -148
- package/es/line/models/linearline.js +45 -80
- package/es/line/models/simpleLine.js +41 -74
- package/es/line/models/wall.js +52 -92
- package/es/mask/index.js +9 -28
- package/es/mask/models/fill.js +29 -54
- package/es/plugins/DataMappingPlugin.js +80 -117
- package/es/plugins/DataSourcePlugin.js +45 -68
- package/es/plugins/FeatureScalePlugin.js +67 -122
- package/es/plugins/LayerAnimateStylePlugin.js +0 -5
- package/es/plugins/LayerMaskPlugin.js +3 -11
- package/es/plugins/LayerModelPlugin.js +67 -104
- package/es/plugins/LayerStylePlugin.js +3 -9
- package/es/plugins/LightingPlugin.js +12 -18
- package/es/plugins/MultiPassRendererPlugin.js +11 -16
- package/es/plugins/PixelPickingPlugin.js +12 -21
- package/es/plugins/RegisterStyleAttributePlugin.js +5 -12
- package/es/plugins/ShaderUniformPlugin.js +13 -27
- package/es/plugins/UpdateModelPlugin.js +0 -5
- package/es/plugins/UpdateStyleAttributePlugin.js +5 -11
- package/es/point/index.js +26 -77
- package/es/point/models/earthExtrude.js +61 -102
- package/es/point/models/earthFill.js +57 -87
- package/es/point/models/extrude.js +60 -101
- package/es/point/models/fill.js +70 -100
- package/es/point/models/fillmage.js +63 -107
- package/es/point/models/image.js +48 -88
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +30 -54
- package/es/point/models/radar.js +40 -64
- package/es/point/models/simplePoint.js +41 -69
- package/es/point/models/text.js +197 -299
- package/es/point/shape/extrude.js +4 -13
- package/es/polygon/index.js +11 -40
- package/es/polygon/models/extrude.js +48 -92
- package/es/polygon/models/fill.js +54 -88
- package/es/polygon/models/index.js +3 -2
- package/es/polygon/models/ocean.js +42 -76
- package/es/polygon/models/water.js +37 -71
- package/es/raster/buffers/triangulation.js +2 -4
- package/es/raster/index.js +9 -32
- package/es/raster/models/raster.js +80 -116
- package/es/raster/models/rasterRgb.js +84 -127
- package/es/raster/models/rasterTerrainRgb.js +56 -84
- package/es/tile/interaction/getRasterData.js +14 -20
- package/es/tile/interaction/utils.js +7 -9
- package/es/tile/manager/base.js +63 -96
- package/es/tile/service/TileLayerService.js +30 -52
- package/es/tile/service/TilePickService.js +26 -40
- package/es/tile/service/TileSourceService.js +3 -7
- package/es/tile/tileFactory/DebugTile.js +28 -45
- package/es/tile/tileFactory/ImageTile.js +20 -38
- package/es/tile/tileFactory/MaskTile.js +22 -43
- package/es/tile/tileFactory/RasterRGBTile.js +22 -42
- package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
- package/es/tile/tileFactory/RasterTile.js +30 -53
- package/es/tile/tileFactory/Tile.js +63 -97
- package/es/tile/tileFactory/VectorTile.js +41 -68
- package/es/tile/tileFactory/index.js +0 -11
- package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
- package/es/tile/tileFactory/util.js +0 -3
- package/es/tile/tileLayer/BaseLayer.js +105 -146
- package/es/tile/utils.js +1 -1
- package/es/utils/blend.js +0 -2
- package/es/utils/collision-index.js +9 -16
- package/es/utils/dataMappingStyle.js +8 -18
- package/es/utils/extrude_polyline.js +101 -149
- package/es/utils/grid-index.js +2 -27
- package/es/utils/identityScale.js +0 -8
- package/es/utils/layerData.js +30 -44
- package/es/utils/multiPassRender.js +11 -13
- package/es/utils/polylineNormal.js +31 -37
- package/es/utils/simpleLine.js +2 -16
- package/es/utils/stencil.js +2 -3
- package/es/utils/symbol-layout.js +27 -53
- package/es/wind/index.js +9 -29
- package/es/wind/models/utils.js +26 -51
- package/es/wind/models/wind.js +101 -147
- package/es/wind/models/windRender.js +53 -66
- package/lib/Geometry/index.js +9 -38
- package/lib/Geometry/models/billboard.js +51 -97
- package/lib/Geometry/models/index.js +0 -5
- package/lib/Geometry/models/plane.js +79 -151
- package/lib/Geometry/models/sprite.js +60 -127
- package/lib/canvas/index.js +10 -40
- package/lib/canvas/models/canvas.js +41 -101
- package/lib/canvas/models/index.js +0 -3
- package/lib/citybuliding/building.js +8 -35
- package/lib/citybuliding/models/build.js +57 -92
- package/lib/core/BaseLayer.js +320 -478
- package/lib/core/BaseModel.js +97 -139
- package/lib/core/LayerPickService.js +21 -37
- package/lib/core/TextureService.js +0 -16
- package/lib/core/interface.js +21 -31
- package/lib/core/schema.js +0 -1
- package/lib/core/shape/Path.js +14 -31
- package/lib/core/shape/extrude.js +10 -54
- package/lib/core/triangulation.js +53 -153
- package/lib/earth/index.js +9 -43
- package/lib/earth/models/atmosphere.js +30 -63
- package/lib/earth/models/base.js +47 -90
- package/lib/earth/models/bloomsphere.js +30 -63
- package/lib/earth/utils.js +7 -31
- package/lib/heatmap/index.js +10 -48
- package/lib/heatmap/models/grid.js +28 -60
- package/lib/heatmap/models/grid3d.js +28 -60
- package/lib/heatmap/models/heatmap.js +91 -162
- package/lib/heatmap/models/hexagon.js +28 -60
- package/lib/heatmap/models/index.js +0 -6
- package/lib/heatmap/triangulation.js +0 -5
- package/lib/image/index.js +9 -36
- package/lib/image/models/image.js +66 -109
- package/lib/image/models/index.js +0 -3
- package/lib/index.js +7 -61
- package/lib/line/index.js +9 -40
- package/lib/line/models/arc.js +64 -128
- package/lib/line/models/arc_3d.js +58 -119
- package/lib/line/models/earthArc_3d.js +61 -122
- package/lib/line/models/great_circle.js +56 -111
- package/lib/line/models/half.js +46 -87
- package/lib/line/models/index.js +0 -11
- package/lib/line/models/line.js +92 -156
- package/lib/line/models/linearline.js +45 -92
- package/lib/line/models/simpleLine.js +41 -84
- package/lib/line/models/wall.js +52 -103
- package/lib/mask/index.js +9 -36
- package/lib/mask/models/fill.js +29 -63
- package/lib/mask/models/index.js +0 -3
- package/lib/plugins/DataMappingPlugin.js +80 -128
- package/lib/plugins/DataSourcePlugin.js +45 -76
- package/lib/plugins/FeatureScalePlugin.js +67 -138
- package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
- package/lib/plugins/LayerMaskPlugin.js +4 -17
- package/lib/plugins/LayerModelPlugin.js +68 -113
- package/lib/plugins/LayerStylePlugin.js +4 -14
- package/lib/plugins/LightingPlugin.js +12 -25
- package/lib/plugins/MultiPassRendererPlugin.js +11 -22
- package/lib/plugins/PixelPickingPlugin.js +12 -27
- package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
- package/lib/plugins/ShaderUniformPlugin.js +13 -34
- package/lib/plugins/UpdateModelPlugin.js +1 -10
- package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
- package/lib/point/index.js +26 -83
- package/lib/point/models/earthExtrude.js +61 -113
- package/lib/point/models/earthFill.js +57 -117
- package/lib/point/models/extrude.js +60 -111
- package/lib/point/models/fill.js +68 -109
- package/lib/point/models/fillmage.js +61 -115
- package/lib/point/models/image.js +48 -98
- package/lib/point/models/index.js +1 -12
- package/lib/point/models/normal.js +30 -64
- package/lib/point/models/radar.js +40 -74
- package/lib/point/models/simplePoint.js +41 -79
- package/lib/point/models/text.js +197 -307
- package/lib/point/shape/extrude.js +4 -20
- package/lib/polygon/index.js +11 -48
- package/lib/polygon/models/extrude.js +48 -103
- package/lib/polygon/models/fill.js +54 -98
- package/lib/polygon/models/index.js +2 -14
- package/lib/polygon/models/ocean.js +42 -88
- package/lib/polygon/models/water.js +37 -82
- package/lib/raster/buffers/triangulation.js +3 -7
- package/lib/raster/index.js +9 -40
- package/lib/raster/models/index.js +0 -5
- package/lib/raster/models/raster.js +80 -125
- package/lib/raster/models/rasterRgb.js +84 -139
- package/lib/raster/models/rasterTerrainRgb.js +56 -93
- package/lib/tile/interaction/getRasterData.js +14 -25
- package/lib/tile/interaction/utils.js +7 -19
- package/lib/tile/manager/base.js +63 -104
- package/lib/tile/service/TileLayerService.js +30 -57
- package/lib/tile/service/TilePickService.js +26 -48
- package/lib/tile/service/TileSourceService.js +2 -16
- package/lib/tile/style/utils.js +0 -3
- package/lib/tile/tileFactory/DebugTile.js +28 -53
- package/lib/tile/tileFactory/ImageTile.js +20 -46
- package/lib/tile/tileFactory/MaskTile.js +22 -51
- package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
- package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
- package/lib/tile/tileFactory/RasterTile.js +30 -63
- package/lib/tile/tileFactory/Tile.js +63 -102
- package/lib/tile/tileFactory/VectorTile.js +41 -76
- package/lib/tile/tileFactory/index.js +0 -25
- package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
- package/lib/tile/tileFactory/util.js +0 -9
- package/lib/tile/tileLayer/BaseLayer.js +105 -153
- package/lib/tile/utils.js +1 -5
- package/lib/utils/blend.js +0 -5
- package/lib/utils/collision-index.js +9 -25
- package/lib/utils/dataMappingStyle.js +8 -19
- package/lib/utils/extrude_polyline.js +101 -181
- package/lib/utils/grid-index.js +2 -28
- package/lib/utils/identityScale.js +0 -9
- package/lib/utils/layerData.js +30 -49
- package/lib/utils/multiPassRender.js +11 -16
- package/lib/utils/polylineNormal.js +31 -66
- package/lib/utils/simpleLine.js +2 -21
- package/lib/utils/stencil.js +0 -4
- package/lib/utils/symbol-layout.js +27 -55
- package/lib/wind/index.js +9 -37
- package/lib/wind/models/index.js +0 -3
- package/lib/wind/models/utils.js +26 -62
- package/lib/wind/models/wind.js +101 -157
- package/lib/wind/models/windRender.js +53 -71
- package/lib/wind/models/windShader.js +0 -1
- package/package.json +7 -7
package/es/core/BaseModel.js
CHANGED
|
@@ -7,17 +7,11 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
8
|
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
|
|
9
9
|
import _initializerWarningHelper from "@babel/runtime/helpers/esm/initializerWarningHelper";
|
|
10
|
-
|
|
11
10
|
var _dec, _class, _descriptor;
|
|
12
|
-
|
|
13
11
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
14
|
-
|
|
15
12
|
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; } } }; }
|
|
16
|
-
|
|
17
13
|
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); }
|
|
18
|
-
|
|
19
|
-
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; }
|
|
20
|
-
|
|
14
|
+
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; }
|
|
21
15
|
import { BlendType, gl, lazyInject, MaskOperation, StencilType, TYPES } from '@antv/l7-core';
|
|
22
16
|
import { rgb2arr } from '@antv/l7-utils';
|
|
23
17
|
import { color } from 'd3-color';
|
|
@@ -27,17 +21,19 @@ import { getStencil as _getStencil, getStencilMask } from "../utils/stencil";
|
|
|
27
21
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
28
22
|
var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function () {
|
|
29
23
|
// style texture data mapping
|
|
24
|
+
|
|
30
25
|
// 用于数据传递的数据纹理
|
|
31
26
|
// 默认有多少列(宽度)
|
|
32
27
|
// 计算得到的当前数据纹理有多少行(高度)
|
|
28
|
+
|
|
33
29
|
// 单个 cell 的长度
|
|
34
30
|
// 需要进行数据映射的属性集合
|
|
31
|
+
|
|
35
32
|
// style texture data mapping
|
|
33
|
+
|
|
36
34
|
function BaseModel(layer) {
|
|
37
35
|
_classCallCheck(this, BaseModel);
|
|
38
|
-
|
|
39
36
|
_initializerDefineProperty(this, "configService", _descriptor, this);
|
|
40
|
-
|
|
41
37
|
this.layer = layer;
|
|
42
38
|
this.rendererService = layer.getContainer().get(TYPES.IRendererService);
|
|
43
39
|
this.pickingService = layer.getContainer().get(TYPES.IPickingService);
|
|
@@ -47,15 +43,15 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
47
43
|
this.iconService = layer.getContainer().get(TYPES.IIconService);
|
|
48
44
|
this.fontService = layer.getContainer().get(TYPES.IFontService);
|
|
49
45
|
this.cameraService = layer.getContainer().get(TYPES.ICameraService);
|
|
50
|
-
this.layerService = layer.getContainer().get(TYPES.ILayerService);
|
|
51
|
-
|
|
52
|
-
this.registerBuiltinAttributes(); // 开启动画
|
|
46
|
+
this.layerService = layer.getContainer().get(TYPES.ILayerService);
|
|
53
47
|
|
|
48
|
+
// 注册 Attribute
|
|
49
|
+
this.registerBuiltinAttributes();
|
|
50
|
+
// 开启动画
|
|
54
51
|
this.startModelAnimate();
|
|
55
52
|
var createTexture2D = this.rendererService.createTexture2D;
|
|
56
53
|
this.createTexture2D = createTexture2D;
|
|
57
54
|
this.DATA_TEXTURE_WIDTH = 1024; // 数据纹理固定宽度
|
|
58
|
-
|
|
59
55
|
this.rowCount = 1;
|
|
60
56
|
this.cellLength = 0;
|
|
61
57
|
this.cellProperties = [];
|
|
@@ -75,8 +71,8 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
75
71
|
hasStroke: 0,
|
|
76
72
|
hasOffsets: 0
|
|
77
73
|
};
|
|
78
|
-
this.dataTextureTest = this.layerService.getOESTextureFloat();
|
|
79
|
-
|
|
74
|
+
this.dataTextureTest = this.layerService.getOESTextureFloat();
|
|
75
|
+
// 只有在不支持数据纹理的情况下进行赋值
|
|
80
76
|
if (!this.dataTextureTest) {
|
|
81
77
|
this.dataTexture = this.createTexture2D({
|
|
82
78
|
// data: new Uint8ClampedArray(4),
|
|
@@ -89,20 +85,18 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
89
85
|
height: 1
|
|
90
86
|
});
|
|
91
87
|
}
|
|
92
|
-
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// style datatexture mapping
|
|
93
91
|
|
|
94
92
|
/**
|
|
95
93
|
* 清除上一次的计算结果 - 全量清除
|
|
96
94
|
*/
|
|
97
|
-
|
|
98
|
-
|
|
99
95
|
_createClass(BaseModel, [{
|
|
100
96
|
key: "clearLastCalRes",
|
|
101
97
|
value: function clearLastCalRes() {
|
|
102
98
|
this.cellProperties = []; // 清空上一次计算的需要进行数据映射的属性集合
|
|
103
|
-
|
|
104
99
|
this.cellLength = 0; // 清空上一次计算的 cell 的长度
|
|
105
|
-
|
|
106
100
|
this.stylePropertiesExist = {
|
|
107
101
|
// 全量清空上一次是否需要对 style 属性进行数据映射的判断
|
|
108
102
|
hasThetaOffset: 0,
|
|
@@ -117,82 +111,91 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
117
111
|
key: "getCellTypeLayout",
|
|
118
112
|
value: function getCellTypeLayout() {
|
|
119
113
|
if (this.dataTextureTest) {
|
|
120
|
-
return [
|
|
121
|
-
|
|
122
|
-
this.
|
|
123
|
-
|
|
124
|
-
this.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
114
|
+
return [
|
|
115
|
+
// 0
|
|
116
|
+
this.rowCount,
|
|
117
|
+
// 数据纹理有几行
|
|
118
|
+
this.DATA_TEXTURE_WIDTH,
|
|
119
|
+
// 数据纹理有几列
|
|
120
|
+
0.0, 0.0,
|
|
121
|
+
// 1
|
|
122
|
+
this.stylePropertiesExist.hasOpacity,
|
|
123
|
+
// cell 中是否存在 opacity
|
|
124
|
+
this.stylePropertiesExist.hasStrokeOpacity,
|
|
125
|
+
// cell 中是否存在 strokeOpacity
|
|
126
|
+
this.stylePropertiesExist.hasStrokeWidth,
|
|
127
|
+
// cell 中是否存在 strokeWidth
|
|
128
|
+
this.stylePropertiesExist.hasStroke,
|
|
129
|
+
// cell 中是否存在 stroke
|
|
128
130
|
// 2
|
|
129
|
-
this.stylePropertiesExist.hasOffsets,
|
|
130
|
-
|
|
131
|
-
|
|
131
|
+
this.stylePropertiesExist.hasOffsets,
|
|
132
|
+
// cell 中是否存在 offsets
|
|
133
|
+
this.stylePropertiesExist.hasThetaOffset,
|
|
134
|
+
// cell 中是否存在 thetaOffset
|
|
135
|
+
0.0, 0.0,
|
|
136
|
+
// 3
|
|
132
137
|
0.0, 0.0, 0.0, 1.0];
|
|
133
138
|
} else {
|
|
134
|
-
return [1.0,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
0.0,
|
|
139
|
-
|
|
140
|
-
0.0,
|
|
139
|
+
return [1.0,
|
|
140
|
+
// 数据纹理有几行
|
|
141
|
+
1.0,
|
|
142
|
+
// 数据纹理有几列
|
|
143
|
+
0.0, 0.0, 0.0,
|
|
144
|
+
// cell 中是否存在 opacity
|
|
145
|
+
0.0,
|
|
146
|
+
// cell 中是否存在 strokeOpacity
|
|
147
|
+
0.0,
|
|
148
|
+
// cell 中是否存在 strokeWidth
|
|
149
|
+
0.0,
|
|
150
|
+
// cell 中是否存在 stroke
|
|
151
|
+
0.0,
|
|
152
|
+
// cell 中是否存在 offsets
|
|
141
153
|
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0];
|
|
142
154
|
}
|
|
143
155
|
}
|
|
156
|
+
|
|
144
157
|
/**
|
|
145
158
|
* 判断数据纹理是否需要重新计算 - 根据传入的值进行判断
|
|
146
159
|
* @param options
|
|
147
160
|
* @returns
|
|
148
161
|
*/
|
|
149
|
-
|
|
150
162
|
}, {
|
|
151
163
|
key: "dataTextureNeedUpdate",
|
|
152
164
|
value: function dataTextureNeedUpdate(options) {
|
|
153
165
|
var isUpdate = false;
|
|
154
|
-
|
|
155
166
|
if (!isEqual(options.thetaOffset, this.cacheStyleProperties.thetaOffset)) {
|
|
156
167
|
isUpdate = true;
|
|
157
168
|
this.cacheStyleProperties.thetaOffset = options.thetaOffset;
|
|
158
169
|
}
|
|
159
|
-
|
|
160
170
|
if (!isEqual(options.opacity, this.cacheStyleProperties.opacity)) {
|
|
161
171
|
isUpdate = true;
|
|
162
172
|
this.cacheStyleProperties.opacity = options.opacity;
|
|
163
173
|
}
|
|
164
|
-
|
|
165
174
|
if (!isEqual(options.strokeOpacity, this.cacheStyleProperties.strokeOpacity)) {
|
|
166
175
|
isUpdate = true;
|
|
167
176
|
this.cacheStyleProperties.strokeOpacity = options.strokeOpacity;
|
|
168
177
|
}
|
|
169
|
-
|
|
170
178
|
if (!isEqual(options.strokeWidth, this.cacheStyleProperties.strokeWidth)) {
|
|
171
179
|
isUpdate = true;
|
|
172
180
|
this.cacheStyleProperties.strokeWidth = options.strokeWidth;
|
|
173
181
|
}
|
|
174
|
-
|
|
175
182
|
if (!isEqual(options.stroke, this.cacheStyleProperties.stroke)) {
|
|
176
183
|
isUpdate = true;
|
|
177
184
|
this.cacheStyleProperties.stroke = options.stroke;
|
|
178
185
|
}
|
|
179
|
-
|
|
180
186
|
if (!isEqual(options.offsets, this.cacheStyleProperties.offsets)) {
|
|
181
187
|
isUpdate = true;
|
|
182
188
|
this.cacheStyleProperties.offsets = options.offsets;
|
|
183
189
|
}
|
|
184
|
-
|
|
185
190
|
if (this.dataTexture === undefined) {
|
|
186
191
|
isUpdate = true;
|
|
187
192
|
}
|
|
188
|
-
|
|
189
193
|
return isUpdate;
|
|
190
194
|
}
|
|
191
195
|
/**
|
|
192
196
|
* 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量
|
|
193
197
|
* @param options
|
|
194
198
|
*/
|
|
195
|
-
|
|
196
199
|
}, {
|
|
197
200
|
key: "judgeStyleAttributes",
|
|
198
201
|
value: function judgeStyleAttributes(options) {
|
|
@@ -207,7 +210,6 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
207
210
|
this.stylePropertiesExist.hasOpacity = 1;
|
|
208
211
|
this.cellLength += 1;
|
|
209
212
|
}
|
|
210
|
-
|
|
211
213
|
if (options.strokeOpacity !== undefined && !isNumber(options.strokeOpacity)) {
|
|
212
214
|
// 数据映射
|
|
213
215
|
this.cellProperties.push({
|
|
@@ -217,7 +219,6 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
217
219
|
this.stylePropertiesExist.hasStrokeOpacity = 1;
|
|
218
220
|
this.cellLength += 1;
|
|
219
221
|
}
|
|
220
|
-
|
|
221
222
|
if (options.strokeWidth !== undefined && !isNumber(options.strokeWidth)) {
|
|
222
223
|
// 数据映射
|
|
223
224
|
this.cellProperties.push({
|
|
@@ -227,7 +228,6 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
227
228
|
this.stylePropertiesExist.hasStrokeWidth = 1;
|
|
228
229
|
this.cellLength += 1;
|
|
229
230
|
}
|
|
230
|
-
|
|
231
231
|
if (options.stroke !== undefined && !this.isStaticColor(options.stroke)) {
|
|
232
232
|
// 数据映射
|
|
233
233
|
this.cellProperties.push({
|
|
@@ -237,7 +237,6 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
237
237
|
this.stylePropertiesExist.hasStroke = 1;
|
|
238
238
|
this.cellLength += 4;
|
|
239
239
|
}
|
|
240
|
-
|
|
241
240
|
if (options.offsets !== undefined && !this.isOffsetStatic(options.offsets)) {
|
|
242
241
|
// 数据映射
|
|
243
242
|
this.cellProperties.push({
|
|
@@ -247,7 +246,6 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
247
246
|
this.stylePropertiesExist.hasOffsets = 1;
|
|
248
247
|
this.cellLength += 2;
|
|
249
248
|
}
|
|
250
|
-
|
|
251
249
|
if (options.thetaOffset !== undefined && !isNumber(options.thetaOffset)) {
|
|
252
250
|
// 数据映射
|
|
253
251
|
this.cellProperties.push({
|
|
@@ -258,12 +256,12 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
258
256
|
this.cellLength += 1;
|
|
259
257
|
}
|
|
260
258
|
}
|
|
259
|
+
|
|
261
260
|
/**
|
|
262
261
|
* 判断变量 stroke 是否是常量值
|
|
263
262
|
* @param stroke
|
|
264
263
|
* @returns
|
|
265
264
|
*/
|
|
266
|
-
|
|
267
265
|
}, {
|
|
268
266
|
key: "isStaticColor",
|
|
269
267
|
value: function isStaticColor(stroke) {
|
|
@@ -274,7 +272,6 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
274
272
|
return false;
|
|
275
273
|
}
|
|
276
274
|
}
|
|
277
|
-
|
|
278
275
|
return false;
|
|
279
276
|
}
|
|
280
277
|
/**
|
|
@@ -282,7 +279,6 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
282
279
|
* @param stroke
|
|
283
280
|
* @returns
|
|
284
281
|
*/
|
|
285
|
-
|
|
286
282
|
}, {
|
|
287
283
|
key: "getStrokeColor",
|
|
288
284
|
value: function getStrokeColor(stroke) {
|
|
@@ -297,12 +293,12 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
297
293
|
return [0, 0, 0, 0];
|
|
298
294
|
}
|
|
299
295
|
}
|
|
296
|
+
|
|
300
297
|
/**
|
|
301
298
|
* 判断 offsets 是否是常量
|
|
302
299
|
* @param offsets
|
|
303
300
|
* @returns
|
|
304
301
|
*/
|
|
305
|
-
|
|
306
302
|
}, {
|
|
307
303
|
key: "isOffsetStatic",
|
|
308
304
|
value: function isOffsetStatic(offsets) {
|
|
@@ -312,12 +308,12 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
312
308
|
return false;
|
|
313
309
|
}
|
|
314
310
|
}
|
|
311
|
+
|
|
315
312
|
/**
|
|
316
313
|
* 补空位
|
|
317
314
|
* @param d
|
|
318
315
|
* @param count
|
|
319
316
|
*/
|
|
320
|
-
|
|
321
317
|
}, {
|
|
322
318
|
key: "patchMod",
|
|
323
319
|
value: function patchMod(d, count) {
|
|
@@ -325,26 +321,24 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
325
321
|
d.push(-1);
|
|
326
322
|
}
|
|
327
323
|
}
|
|
324
|
+
|
|
328
325
|
/**
|
|
329
326
|
* 根据映射的数据字段往推入数据
|
|
330
327
|
* @param d
|
|
331
328
|
* @param cellData
|
|
332
329
|
* @param cellPropertiesLayouts
|
|
333
330
|
*/
|
|
334
|
-
|
|
335
331
|
}, {
|
|
336
332
|
key: "patchData",
|
|
337
333
|
value: function patchData(d, cellData, cellPropertiesLayouts) {
|
|
338
334
|
var _iterator = _createForOfIteratorHelper(cellPropertiesLayouts),
|
|
339
|
-
|
|
340
|
-
|
|
335
|
+
_step;
|
|
341
336
|
try {
|
|
342
337
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
343
338
|
var layout = _step.value;
|
|
344
339
|
var attr = layout.attr,
|
|
345
|
-
|
|
340
|
+
count = layout.count;
|
|
346
341
|
var value = cellData[attr];
|
|
347
|
-
|
|
348
342
|
if (value !== undefined) {
|
|
349
343
|
// 数据中存在该属性
|
|
350
344
|
if (attr === 'stroke') {
|
|
@@ -369,6 +363,7 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
369
363
|
_iterator.f();
|
|
370
364
|
}
|
|
371
365
|
}
|
|
366
|
+
|
|
372
367
|
/**
|
|
373
368
|
* 计算推入数据纹理的数据
|
|
374
369
|
* @param cellLength
|
|
@@ -376,7 +371,6 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
376
371
|
* @param cellPropertiesLayouts
|
|
377
372
|
* @returns
|
|
378
373
|
*/
|
|
379
|
-
|
|
380
374
|
}, {
|
|
381
375
|
key: "calDataFrame",
|
|
382
376
|
value: function calDataFrame(cellLength, encodeData, cellPropertiesLayouts) {
|
|
@@ -385,48 +379,44 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
385
379
|
|
|
386
380
|
var totalLength = rowCount * this.DATA_TEXTURE_WIDTH;
|
|
387
381
|
var d = [];
|
|
388
|
-
|
|
389
382
|
for (var i = 0; i < encodeDatalength; i++) {
|
|
390
383
|
// 根据 encodeData 数据推入数据
|
|
391
384
|
var cellData = encodeData[i];
|
|
392
385
|
this.patchData(d, cellData, cellPropertiesLayouts);
|
|
393
386
|
}
|
|
394
|
-
|
|
395
387
|
for (var _i = d.length; _i < totalLength; _i++) {
|
|
396
388
|
// 每行不足的部分用 -1 补足(数据纹理时 width * height 的矩形数据集合)
|
|
397
389
|
d.push(-1);
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
|
|
390
|
+
}
|
|
391
|
+
// console.log('data', d)
|
|
401
392
|
return {
|
|
402
393
|
data: d,
|
|
403
394
|
width: this.DATA_TEXTURE_WIDTH,
|
|
404
395
|
height: rowCount
|
|
405
396
|
};
|
|
406
|
-
}
|
|
397
|
+
}
|
|
407
398
|
|
|
399
|
+
// style datatexture mapping
|
|
408
400
|
}, {
|
|
409
401
|
key: "getBlend",
|
|
410
402
|
value: function getBlend() {
|
|
411
403
|
var _this$layer$getLayerC = this.layer.getLayerConfig(),
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
404
|
+
_this$layer$getLayerC2 = _this$layer$getLayerC.blend,
|
|
405
|
+
blend = _this$layer$getLayerC2 === void 0 ? 'normal' : _this$layer$getLayerC2;
|
|
415
406
|
return BlendTypes[BlendType[blend]];
|
|
416
407
|
}
|
|
417
408
|
}, {
|
|
418
409
|
key: "getStencil",
|
|
419
410
|
value: function getStencil(option) {
|
|
420
411
|
var _this$layer$getLayerC3 = this.layer.getLayerConfig(),
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
412
|
+
_this$layer$getLayerC4 = _this$layer$getLayerC3.mask,
|
|
413
|
+
mask = _this$layer$getLayerC4 === void 0 ? false : _this$layer$getLayerC4,
|
|
414
|
+
_this$layer$getLayerC5 = _this$layer$getLayerC3.maskInside,
|
|
415
|
+
maskInside = _this$layer$getLayerC5 === void 0 ? true : _this$layer$getLayerC5,
|
|
416
|
+
enableMask = _this$layer$getLayerC3.enableMask,
|
|
417
|
+
_this$layer$getLayerC6 = _this$layer$getLayerC3.maskOperation,
|
|
418
|
+
maskOperation = _this$layer$getLayerC6 === void 0 ? MaskOperation.AND : _this$layer$getLayerC6;
|
|
419
|
+
// TODO 临时处理,后期移除MaskLayer
|
|
430
420
|
if (this.layer.type === 'MaskLayer') {
|
|
431
421
|
return getStencilMask({
|
|
432
422
|
isStencil: true,
|
|
@@ -440,11 +430,12 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
440
430
|
})); // 用于遮罩的stencil 参数
|
|
441
431
|
}
|
|
442
432
|
|
|
443
|
-
var maskflag = mask ||
|
|
444
|
-
|
|
433
|
+
var maskflag = mask ||
|
|
434
|
+
// mask 兼容历史写法
|
|
435
|
+
enableMask && this.layer.masks.length !== 0 ||
|
|
436
|
+
// 外部图层的mask
|
|
445
437
|
this.layer.tileMask !== undefined; // 瓦片图层
|
|
446
438
|
// !!(mask || enableMask || this.layer.tileMask);
|
|
447
|
-
|
|
448
439
|
return _getStencil(maskflag, maskInside);
|
|
449
440
|
}
|
|
450
441
|
}, {
|
|
@@ -467,76 +458,58 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
467
458
|
value: function () {
|
|
468
459
|
var _needUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
469
460
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
470
|
-
while (1) {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
case "end":
|
|
477
|
-
return _context.stop();
|
|
478
|
-
}
|
|
461
|
+
while (1) switch (_context.prev = _context.next) {
|
|
462
|
+
case 0:
|
|
463
|
+
return _context.abrupt("return", false);
|
|
464
|
+
case 1:
|
|
465
|
+
case "end":
|
|
466
|
+
return _context.stop();
|
|
479
467
|
}
|
|
480
468
|
}, _callee);
|
|
481
469
|
}));
|
|
482
|
-
|
|
483
470
|
function needUpdate() {
|
|
484
471
|
return _needUpdate.apply(this, arguments);
|
|
485
472
|
}
|
|
486
|
-
|
|
487
473
|
return needUpdate;
|
|
488
474
|
}() // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
489
|
-
|
|
490
475
|
}, {
|
|
491
476
|
key: "buildModels",
|
|
492
477
|
value: function () {
|
|
493
478
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
494
479
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
495
|
-
while (1) {
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
case "end":
|
|
502
|
-
return _context2.stop();
|
|
503
|
-
}
|
|
480
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
481
|
+
case 0:
|
|
482
|
+
throw new Error('Method not implemented.');
|
|
483
|
+
case 1:
|
|
484
|
+
case "end":
|
|
485
|
+
return _context2.stop();
|
|
504
486
|
}
|
|
505
487
|
}, _callee2);
|
|
506
488
|
}));
|
|
507
|
-
|
|
508
489
|
function buildModels() {
|
|
509
490
|
return _buildModels.apply(this, arguments);
|
|
510
491
|
}
|
|
511
|
-
|
|
512
492
|
return buildModels;
|
|
513
493
|
}() // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
514
|
-
|
|
515
494
|
}, {
|
|
516
495
|
key: "initModels",
|
|
517
496
|
value: function () {
|
|
518
497
|
var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
519
498
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
520
|
-
while (1) {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
case "end":
|
|
527
|
-
return _context3.stop();
|
|
528
|
-
}
|
|
499
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
500
|
+
case 0:
|
|
501
|
+
throw new Error('Method not implemented.');
|
|
502
|
+
case 1:
|
|
503
|
+
case "end":
|
|
504
|
+
return _context3.stop();
|
|
529
505
|
}
|
|
530
506
|
}, _callee3);
|
|
531
507
|
}));
|
|
532
|
-
|
|
533
508
|
function initModels() {
|
|
534
509
|
return _initModels.apply(this, arguments);
|
|
535
510
|
}
|
|
536
|
-
|
|
537
511
|
return initModels;
|
|
538
512
|
}() // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
539
|
-
|
|
540
513
|
}, {
|
|
541
514
|
key: "clearModels",
|
|
542
515
|
value: function clearModels() {
|
|
@@ -547,8 +520,8 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
547
520
|
key: "getAttribute",
|
|
548
521
|
value: function getAttribute() {
|
|
549
522
|
throw new Error('Method not implemented.');
|
|
550
|
-
}
|
|
551
|
-
|
|
523
|
+
}
|
|
524
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
552
525
|
}, {
|
|
553
526
|
key: "render",
|
|
554
527
|
value: function render(renderOptions) {
|
|
@@ -568,14 +541,12 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
568
541
|
key: "startModelAnimate",
|
|
569
542
|
value: function startModelAnimate() {
|
|
570
543
|
var _ref = this.layer.getLayerConfig(),
|
|
571
|
-
|
|
572
|
-
|
|
544
|
+
animateOption = _ref.animateOption;
|
|
573
545
|
if (animateOption.enable) {
|
|
574
546
|
this.layer.setAnimateStartTime();
|
|
575
547
|
}
|
|
576
548
|
}
|
|
577
549
|
}]);
|
|
578
|
-
|
|
579
550
|
return BaseModel;
|
|
580
551
|
}(), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "configService", [_dec], {
|
|
581
552
|
configurable: true,
|
|
@@ -4,25 +4,21 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
5
|
import { TYPES } from '@antv/l7-core';
|
|
6
6
|
import { lngLatInExtent } from '@antv/l7-utils';
|
|
7
|
-
|
|
8
7
|
var BaseLayerPickService = /*#__PURE__*/function () {
|
|
9
8
|
function BaseLayerPickService(layer) {
|
|
10
9
|
_classCallCheck(this, BaseLayerPickService);
|
|
11
|
-
|
|
12
10
|
this.layer = layer;
|
|
13
11
|
}
|
|
14
|
-
|
|
15
12
|
_createClass(BaseLayerPickService, [{
|
|
16
13
|
key: "pickRender",
|
|
17
14
|
value: function pickRender(target) {
|
|
18
15
|
var container = this.layer.getContainer();
|
|
19
16
|
var layerService = container.get(TYPES.ILayerService);
|
|
20
|
-
var layer = this.layer;
|
|
21
|
-
|
|
17
|
+
var layer = this.layer;
|
|
18
|
+
// 瓦片图层的拾取绘制
|
|
22
19
|
if (layer.tileLayer) {
|
|
23
20
|
return layer.tileLayer.pickRender(target);
|
|
24
21
|
}
|
|
25
|
-
|
|
26
22
|
layer.hooks.beforePickingEncode.call();
|
|
27
23
|
layerService.renderTileLayerMask(layer);
|
|
28
24
|
layer.renderModels({
|
|
@@ -35,11 +31,9 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
35
31
|
value: function pick(layer, target) {
|
|
36
32
|
var container = this.layer.getContainer();
|
|
37
33
|
var pickingService = container.get(TYPES.IPickingService);
|
|
38
|
-
|
|
39
34
|
if (layer.type === 'RasterLayer') {
|
|
40
35
|
return this.pickRasterLayer(layer, target);
|
|
41
36
|
}
|
|
42
|
-
|
|
43
37
|
this.pickRender(target);
|
|
44
38
|
return pickingService.pickFromPickingFBO(layer, target);
|
|
45
39
|
}
|
|
@@ -60,7 +54,6 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
60
54
|
rasterValue: null
|
|
61
55
|
};
|
|
62
56
|
var adviceTarget = parent ? parent : layer;
|
|
63
|
-
|
|
64
57
|
if (isPick) {
|
|
65
58
|
var rasterValue = this.readRasterValue(layer, extent, mapService, target.x, target.y);
|
|
66
59
|
layerTarget.rasterValue = rasterValue;
|
|
@@ -79,24 +72,24 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
79
72
|
key: "readRasterValue",
|
|
80
73
|
value: function readRasterValue(layer, bbox, mapService, x, y) {
|
|
81
74
|
var rasterData = layer.getSource().data.dataArray[0];
|
|
82
|
-
|
|
83
75
|
var _bbox = _slicedToArray(bbox, 4),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
76
|
+
_bbox$ = _bbox[0],
|
|
77
|
+
minLng = _bbox$ === void 0 ? 0 : _bbox$,
|
|
78
|
+
_bbox$2 = _bbox[1],
|
|
79
|
+
minLat = _bbox$2 === void 0 ? 0 : _bbox$2,
|
|
80
|
+
_bbox$3 = _bbox[2],
|
|
81
|
+
maxLng = _bbox$3 === void 0 ? 10 : _bbox$3,
|
|
82
|
+
_bbox$4 = _bbox[3],
|
|
83
|
+
maxLat = _bbox$4 === void 0 ? -10 : _bbox$4;
|
|
93
84
|
var tileXY = mapService.lngLatToContainer([minLng, minLat]);
|
|
94
85
|
var tileMaxXY = mapService.lngLatToContainer([maxLng, maxLat]);
|
|
95
86
|
var tilePixelWidth = tileMaxXY.x - tileXY.x;
|
|
96
87
|
var tilePixelHeight = tileXY.y - tileMaxXY.y;
|
|
97
|
-
var pos = [(x - tileXY.x) / tilePixelWidth,
|
|
88
|
+
var pos = [(x - tileXY.x) / tilePixelWidth,
|
|
89
|
+
// x
|
|
98
90
|
(y - tileMaxXY.y) / tilePixelHeight // y
|
|
99
91
|
];
|
|
92
|
+
|
|
100
93
|
var tileWidth = rasterData.width || 1;
|
|
101
94
|
var tileHeight = rasterData.height || 1;
|
|
102
95
|
var indexX = Math.floor(pos[0] * tileWidth);
|
|
@@ -108,13 +101,12 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
108
101
|
}, {
|
|
109
102
|
key: "selectFeature",
|
|
110
103
|
value: function selectFeature(pickedColors) {
|
|
111
|
-
var layer = this.layer;
|
|
112
|
-
|
|
104
|
+
var layer = this.layer;
|
|
105
|
+
// @ts-ignore
|
|
113
106
|
var _pickedColors = _slicedToArray(pickedColors, 3),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
107
|
+
r = _pickedColors[0],
|
|
108
|
+
g = _pickedColors[1],
|
|
109
|
+
b = _pickedColors[2];
|
|
118
110
|
layer.hooks.beforeSelect.call([r, g, b]);
|
|
119
111
|
}
|
|
120
112
|
}, {
|
|
@@ -122,10 +114,9 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
122
114
|
value: function highlightPickedFeature(pickedColors) {
|
|
123
115
|
// @ts-ignore
|
|
124
116
|
var _pickedColors2 = _slicedToArray(pickedColors, 3),
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
117
|
+
r = _pickedColors2[0],
|
|
118
|
+
g = _pickedColors2[1],
|
|
119
|
+
b = _pickedColors2[2];
|
|
129
120
|
this.layer.hooks.beforeHighlight.call([r, g, b]);
|
|
130
121
|
}
|
|
131
122
|
}, {
|
|
@@ -134,8 +125,6 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
134
125
|
return this.layer.getSource().getFeatureById(pickedFeatureIdx);
|
|
135
126
|
}
|
|
136
127
|
}]);
|
|
137
|
-
|
|
138
128
|
return BaseLayerPickService;
|
|
139
129
|
}();
|
|
140
|
-
|
|
141
130
|
export { BaseLayerPickService as default };
|