@antv/l7-layers 2.15.2 → 2.15.3
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
|
@@ -1,86 +1,63 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
12
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
-
|
|
20
13
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
-
|
|
22
14
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
-
|
|
24
15
|
var _l7Core = require("@antv/l7-core");
|
|
25
|
-
|
|
26
16
|
var _l7Utils = require("@antv/l7-utils");
|
|
27
|
-
|
|
28
17
|
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
29
|
-
|
|
30
18
|
var _triangulation = require("../../core/triangulation");
|
|
31
|
-
|
|
32
19
|
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); }; }
|
|
33
|
-
|
|
34
20
|
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; } }
|
|
35
|
-
|
|
36
21
|
/* babel-plugin-inline-import '../shaders/raster_terrain_rgb_frag.glsl' */
|
|
37
22
|
var Raster_terrainFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\n\nuniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\n\nvarying vec2 v_texCoord;\n\nuniform vec2 u_domain;\nuniform float u_noDataValue;\nuniform bool u_clampLow: true;\nuniform bool u_clampHigh: true;\nuniform vec4 u_unpack;\n\nfloat getElevation(vec2 coord, float bias) {\n // Convert encoded elevation value to meters\n vec4 data = texture2D(u_texture, coord,bias) * 255.0;\n data.a = -1.0;\n return dot(data, u_unpack);\n}\n\nvec4 getColor(float value) {\n float normalisedValue =(value- u_domain[0]) / (u_domain[1] - u_domain[0]);\n vec2 coord = vec2(normalisedValue, 0);\n return texture2D(u_colorTexture, coord);\n}\n\nvoid main() {\n float value = getElevation(v_texCoord,0.0);\n if (value == u_noDataValue) {\n gl_FragColor = vec4(0.0, 0, 0, 0.0);\n } else if ((!u_clampLow && value < u_domain[0]) || (!u_clampHigh && value > u_domain[1])) {\n gl_FragColor = vec4(0.0, 0, 0, 0.0);\n } else {\n \n gl_FragColor = getColor(value);\n gl_FragColor.a = gl_FragColor.a * u_opacity ;\n if(gl_FragColor.a < 0.01)\n discard;\n }\n}\n";
|
|
38
|
-
|
|
39
23
|
/* babel-plugin-inline-import '../shaders/rater_terrain_rgb_vert.glsl' */
|
|
40
24
|
var Raster_terrainVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy,0., 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n }\n}\n";
|
|
41
|
-
|
|
42
25
|
var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
43
26
|
(0, _inherits2.default)(RasterTerrainRGB, _BaseModel);
|
|
44
|
-
|
|
45
27
|
var _super = _createSuper(RasterTerrainRGB);
|
|
46
|
-
|
|
47
28
|
function RasterTerrainRGB() {
|
|
48
29
|
(0, _classCallCheck2.default)(this, RasterTerrainRGB);
|
|
49
30
|
return _super.apply(this, arguments);
|
|
50
31
|
}
|
|
51
|
-
|
|
52
32
|
(0, _createClass2.default)(RasterTerrainRGB, [{
|
|
53
33
|
key: "getUninforms",
|
|
54
34
|
value: function getUninforms() {
|
|
55
35
|
var _ref = this.layer.getLayerConfig(),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
36
|
+
opacity = _ref.opacity,
|
|
37
|
+
_ref$clampLow = _ref.clampLow,
|
|
38
|
+
clampLow = _ref$clampLow === void 0 ? true : _ref$clampLow,
|
|
39
|
+
_ref$clampHigh = _ref.clampHigh,
|
|
40
|
+
clampHigh = _ref$clampHigh === void 0 ? true : _ref$clampHigh,
|
|
41
|
+
_ref$noDataValue = _ref.noDataValue,
|
|
42
|
+
noDataValue = _ref$noDataValue === void 0 ? -9999999 : _ref$noDataValue,
|
|
43
|
+
domain = _ref.domain,
|
|
44
|
+
rampColors = _ref.rampColors,
|
|
45
|
+
colorTexture = _ref.colorTexture,
|
|
46
|
+
_ref$rScaler = _ref.rScaler,
|
|
47
|
+
rScaler = _ref$rScaler === void 0 ? 6553.6 : _ref$rScaler,
|
|
48
|
+
_ref$gScaler = _ref.gScaler,
|
|
49
|
+
gScaler = _ref$gScaler === void 0 ? 25.6 : _ref$gScaler,
|
|
50
|
+
_ref$bScaler = _ref.bScaler,
|
|
51
|
+
bScaler = _ref$bScaler === void 0 ? 0.1 : _ref$bScaler,
|
|
52
|
+
_ref$offset = _ref.offset,
|
|
53
|
+
offset = _ref$offset === void 0 ? 10000 : _ref$offset;
|
|
75
54
|
var newdomain = domain || (0, _l7Utils.getDefaultDomain)(rampColors);
|
|
76
55
|
var texture = colorTexture;
|
|
77
|
-
|
|
78
56
|
if (!colorTexture) {
|
|
79
57
|
texture = this.layer.textureService.getColorTexture(rampColors, newdomain);
|
|
80
58
|
} else {
|
|
81
59
|
this.layer.textureService.setColorTexture(colorTexture, rampColors, newdomain);
|
|
82
60
|
}
|
|
83
|
-
|
|
84
61
|
return {
|
|
85
62
|
u_opacity: opacity || 1,
|
|
86
63
|
u_texture: this.texture,
|
|
@@ -98,58 +75,50 @@ var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
|
98
75
|
var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
99
76
|
var source, createTexture2D, imageData, model;
|
|
100
77
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
101
|
-
while (1) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
imageData
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
case 10:
|
|
135
|
-
case "end":
|
|
136
|
-
return _context.stop();
|
|
137
|
-
}
|
|
78
|
+
while (1) switch (_context.prev = _context.next) {
|
|
79
|
+
case 0:
|
|
80
|
+
source = this.layer.getSource();
|
|
81
|
+
createTexture2D = this.rendererService.createTexture2D;
|
|
82
|
+
_context.next = 4;
|
|
83
|
+
return source.data.images;
|
|
84
|
+
case 4:
|
|
85
|
+
imageData = _context.sent;
|
|
86
|
+
this.texture = createTexture2D({
|
|
87
|
+
data: imageData[0],
|
|
88
|
+
width: imageData[0].width,
|
|
89
|
+
height: imageData[0].height,
|
|
90
|
+
min: _l7Core.gl.LINEAR,
|
|
91
|
+
mag: _l7Core.gl.LINEAR
|
|
92
|
+
});
|
|
93
|
+
_context.next = 8;
|
|
94
|
+
return this.layer.buildLayerModel({
|
|
95
|
+
moduleName: 'RasterTileDataImage',
|
|
96
|
+
vertexShader: Raster_terrainVert,
|
|
97
|
+
fragmentShader: Raster_terrainFrag,
|
|
98
|
+
triangulation: _triangulation.RasterImageTriangulation,
|
|
99
|
+
primitive: _l7Core.gl.TRIANGLES,
|
|
100
|
+
depth: {
|
|
101
|
+
enable: false
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
case 8:
|
|
105
|
+
model = _context.sent;
|
|
106
|
+
return _context.abrupt("return", [model]);
|
|
107
|
+
case 10:
|
|
108
|
+
case "end":
|
|
109
|
+
return _context.stop();
|
|
138
110
|
}
|
|
139
111
|
}, _callee, this);
|
|
140
112
|
}));
|
|
141
|
-
|
|
142
113
|
function initModels() {
|
|
143
114
|
return _initModels.apply(this, arguments);
|
|
144
115
|
}
|
|
145
|
-
|
|
146
116
|
return initModels;
|
|
147
117
|
}()
|
|
148
118
|
}, {
|
|
149
119
|
key: "clearModels",
|
|
150
120
|
value: function clearModels() {
|
|
151
121
|
var _this$texture;
|
|
152
|
-
|
|
153
122
|
(_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
|
|
154
123
|
}
|
|
155
124
|
}, {
|
|
@@ -157,23 +126,18 @@ var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
|
157
126
|
value: function () {
|
|
158
127
|
var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
159
128
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
160
|
-
while (1) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
case "end":
|
|
167
|
-
return _context2.stop();
|
|
168
|
-
}
|
|
129
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
130
|
+
case 0:
|
|
131
|
+
return _context2.abrupt("return", this.initModels());
|
|
132
|
+
case 1:
|
|
133
|
+
case "end":
|
|
134
|
+
return _context2.stop();
|
|
169
135
|
}
|
|
170
136
|
}, _callee2, this);
|
|
171
137
|
}));
|
|
172
|
-
|
|
173
138
|
function buildModels() {
|
|
174
139
|
return _buildModels.apply(this, arguments);
|
|
175
140
|
}
|
|
176
|
-
|
|
177
141
|
return buildModels;
|
|
178
142
|
}()
|
|
179
143
|
}, {
|
|
@@ -199,5 +163,4 @@ var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
|
199
163
|
}]);
|
|
200
164
|
return RasterTerrainRGB;
|
|
201
165
|
}(_BaseModel2.default);
|
|
202
|
-
|
|
203
166
|
exports.default = RasterTerrainRGB;
|
|
@@ -1,39 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.readPixel = readPixel;
|
|
9
8
|
exports.readRasterValue = readRasterValue;
|
|
10
|
-
|
|
11
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
|
-
|
|
13
10
|
var _l7Utils = require("@antv/l7-utils");
|
|
14
|
-
|
|
15
11
|
function readRasterValue(tile, mapService, x, y) {
|
|
16
12
|
var _tile$bboxPolygon, _tile$data, _tile$data2, _tile$data3;
|
|
17
|
-
|
|
18
13
|
var bbox = (tile === null || tile === void 0 ? void 0 : (_tile$bboxPolygon = tile.bboxPolygon) === null || _tile$bboxPolygon === void 0 ? void 0 : _tile$bboxPolygon.bbox) || [0, 0, 10, -10];
|
|
19
|
-
|
|
20
14
|
var _bbox = (0, _slicedToArray2.default)(bbox, 4),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
_bbox$ = _bbox[0],
|
|
16
|
+
minLng = _bbox$ === void 0 ? 0 : _bbox$,
|
|
17
|
+
_bbox$2 = _bbox[1],
|
|
18
|
+
minLat = _bbox$2 === void 0 ? 0 : _bbox$2,
|
|
19
|
+
_bbox$3 = _bbox[2],
|
|
20
|
+
maxLng = _bbox$3 === void 0 ? 10 : _bbox$3,
|
|
21
|
+
_bbox$4 = _bbox[3],
|
|
22
|
+
maxLat = _bbox$4 === void 0 ? -10 : _bbox$4;
|
|
30
23
|
var tileXY = mapService.lngLatToContainer([minLng, minLat]);
|
|
31
24
|
var tileMaxXY = mapService.lngLatToContainer([maxLng, maxLat]);
|
|
32
25
|
var tilePixelWidth = tileMaxXY.x - tileXY.x;
|
|
33
26
|
var tilePixelHeight = tileXY.y - tileMaxXY.y;
|
|
34
|
-
var pos = [(x - tileXY.x) / tilePixelWidth,
|
|
27
|
+
var pos = [(x - tileXY.x) / tilePixelWidth,
|
|
28
|
+
// x
|
|
35
29
|
(y - tileMaxXY.y) / tilePixelHeight // y
|
|
36
30
|
];
|
|
31
|
+
|
|
37
32
|
var tileWidth = (tile === null || tile === void 0 ? void 0 : (_tile$data = tile.data) === null || _tile$data === void 0 ? void 0 : _tile$data.width) || 1;
|
|
38
33
|
var tileHeight = (tile === null || tile === void 0 ? void 0 : (_tile$data2 = tile.data) === null || _tile$data2 === void 0 ? void 0 : _tile$data2.height) || 1;
|
|
39
34
|
var indexX = Math.floor(pos[0] * tileWidth);
|
|
@@ -42,24 +37,19 @@ function readRasterValue(tile, mapService, x, y) {
|
|
|
42
37
|
var data = tile === null || tile === void 0 ? void 0 : (_tile$data3 = tile.data) === null || _tile$data3 === void 0 ? void 0 : _tile$data3.data[index];
|
|
43
38
|
return data;
|
|
44
39
|
}
|
|
45
|
-
|
|
46
40
|
function readPixel(x, y, rendererService) {
|
|
47
41
|
var readPixels = rendererService.readPixels,
|
|
48
|
-
|
|
42
|
+
getContainer = rendererService.getContainer;
|
|
49
43
|
var xInDevicePixel = x * _l7Utils.DOM.DPR;
|
|
50
44
|
var yInDevicePixel = y * _l7Utils.DOM.DPR;
|
|
51
|
-
|
|
52
45
|
var _getContainerSize = getContainerSize(getContainer()),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
width = _getContainerSize.width,
|
|
47
|
+
height = _getContainerSize.height;
|
|
56
48
|
width *= _l7Utils.DOM.DPR;
|
|
57
49
|
height *= _l7Utils.DOM.DPR;
|
|
58
|
-
|
|
59
50
|
if (xInDevicePixel > width - 1 * _l7Utils.DOM.DPR || xInDevicePixel < 0 || yInDevicePixel > height - 1 * _l7Utils.DOM.DPR || yInDevicePixel < 0) {
|
|
60
51
|
return false;
|
|
61
52
|
}
|
|
62
|
-
|
|
63
53
|
var pickedColors = readPixels({
|
|
64
54
|
x: Math.floor(xInDevicePixel),
|
|
65
55
|
// 视口坐标系原点在左上,而 WebGL 在左下,需要翻转 Y 轴
|
|
@@ -70,7 +60,6 @@ function readPixel(x, y, rendererService) {
|
|
|
70
60
|
});
|
|
71
61
|
return pickedColors;
|
|
72
62
|
}
|
|
73
|
-
|
|
74
63
|
function getContainerSize(container) {
|
|
75
64
|
if (container.getContext) {
|
|
76
65
|
return {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -12,11 +11,8 @@ exports.setFeatureSelect = setFeatureSelect;
|
|
|
12
11
|
exports.setHighlight = setHighlight;
|
|
13
12
|
exports.setPickState = setPickState;
|
|
14
13
|
exports.setSelect = setSelect;
|
|
15
|
-
|
|
16
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
-
|
|
18
15
|
var _l7Utils = require("@antv/l7-utils");
|
|
19
|
-
|
|
20
16
|
function clearPickState(layers) {
|
|
21
17
|
layers.filter(function (layer) {
|
|
22
18
|
return layer.inited && layer.isVisible();
|
|
@@ -27,7 +23,6 @@ function clearPickState(layers) {
|
|
|
27
23
|
layer.setCurrentSelectedId(null);
|
|
28
24
|
});
|
|
29
25
|
}
|
|
30
|
-
|
|
31
26
|
function setSelect(layers, pickedColors, renderList) {
|
|
32
27
|
var selectedId = (0, _l7Utils.decodePickingColor)(pickedColors);
|
|
33
28
|
var pickColor;
|
|
@@ -38,12 +33,11 @@ function setSelect(layers, pickedColors, renderList) {
|
|
|
38
33
|
pickColor = pickedColors;
|
|
39
34
|
} else {
|
|
40
35
|
selectFeature(layer, new Uint8Array([0, 0, 0, 0])); // toggle select
|
|
41
|
-
|
|
42
36
|
layer.setCurrentSelectedId(null);
|
|
43
37
|
pickColor = null;
|
|
44
38
|
}
|
|
45
|
-
});
|
|
46
|
-
|
|
39
|
+
});
|
|
40
|
+
// unselect normal layer
|
|
47
41
|
renderList.filter(function (layer) {
|
|
48
42
|
return layer.inited && layer.isVisible() && layer.needPick('click');
|
|
49
43
|
}).filter(function (layer) {
|
|
@@ -54,12 +48,12 @@ function setSelect(layers, pickedColors, renderList) {
|
|
|
54
48
|
});
|
|
55
49
|
return pickColor;
|
|
56
50
|
}
|
|
57
|
-
|
|
58
51
|
function setHighlight(layers, pickedColors) {
|
|
59
52
|
var pickId = (0, _l7Utils.decodePickingColor)(pickedColors);
|
|
60
53
|
layers.filter(function (layer) {
|
|
61
54
|
return layer.inited && layer.isVisible();
|
|
62
|
-
})
|
|
55
|
+
})
|
|
56
|
+
// @ts-ignore
|
|
63
57
|
.filter(function (layer) {
|
|
64
58
|
return layer.getPickID() !== pickId;
|
|
65
59
|
}).map(function (layer) {
|
|
@@ -68,14 +62,12 @@ function setHighlight(layers, pickedColors) {
|
|
|
68
62
|
layer.hooks.beforeHighlight.call(pickedColors);
|
|
69
63
|
});
|
|
70
64
|
}
|
|
71
|
-
|
|
72
65
|
function setPickState(layers, pickColors) {
|
|
73
66
|
if (pickColors.select) {
|
|
74
67
|
layers.map(function (layer) {
|
|
75
68
|
selectFeature(layer, pickColors.select);
|
|
76
69
|
});
|
|
77
70
|
}
|
|
78
|
-
|
|
79
71
|
if (pickColors.active) {
|
|
80
72
|
layers.filter(function (layer) {
|
|
81
73
|
return layer.inited && layer.isVisible();
|
|
@@ -84,17 +76,14 @@ function setPickState(layers, pickColors) {
|
|
|
84
76
|
});
|
|
85
77
|
}
|
|
86
78
|
}
|
|
87
|
-
|
|
88
79
|
function selectFeature(layer, pickedColors) {
|
|
89
80
|
// @ts-ignore
|
|
90
81
|
var _pickedColors = (0, _slicedToArray2.default)(pickedColors, 3),
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
82
|
+
r = _pickedColors[0],
|
|
83
|
+
g = _pickedColors[1],
|
|
84
|
+
b = _pickedColors[2];
|
|
95
85
|
layer.hooks.beforeSelect.call([r, g, b]);
|
|
96
86
|
}
|
|
97
|
-
|
|
98
87
|
function setFeatureSelect(color, layers) {
|
|
99
88
|
var id = (0, _l7Utils.decodePickingColor)(color);
|
|
100
89
|
layers.map(function (layer) {
|
|
@@ -102,7 +91,6 @@ function setFeatureSelect(color, layers) {
|
|
|
102
91
|
layer.setCurrentSelectedId(id);
|
|
103
92
|
});
|
|
104
93
|
}
|
|
105
|
-
|
|
106
94
|
function setFeatureActive(color, layers) {
|
|
107
95
|
var id = (0, _l7Utils.decodePickingColor)(color);
|
|
108
96
|
layers.map(function (layer) {
|