@antv/l7-layers 2.17.3 → 2.17.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 +31 -9
- package/es/Geometry/models/billboard.js +89 -51
- package/es/Geometry/models/plane.js +143 -81
- package/es/Geometry/models/sprite.js +118 -60
- package/es/canvas/index.js +33 -10
- package/es/canvas/models/canvas.js +97 -41
- package/es/citybuliding/building.js +27 -8
- package/es/citybuliding/models/build.js +82 -57
- package/es/core/BaseLayer.js +478 -313
- package/es/core/BaseModel.js +80 -51
- package/es/core/CommonStyleAttribute.js +5 -2
- package/es/core/LayerPickService.js +32 -21
- package/es/core/TextureService.js +13 -0
- package/es/core/interface.js +24 -17
- package/es/core/shape/Path.js +20 -13
- package/es/core/shape/extrude.js +39 -27
- package/es/core/triangulation.js +136 -99
- package/es/earth/index.js +33 -9
- package/es/earth/models/atmosphere.js +54 -30
- package/es/earth/models/base.js +85 -47
- package/es/earth/models/bloomsphere.js +54 -30
- package/es/earth/utils.js +13 -9
- package/es/heatmap/index.js +40 -10
- package/es/heatmap/models/grid.js +52 -28
- package/es/heatmap/models/grid3d.js +52 -28
- package/es/heatmap/models/heatmap.js +149 -92
- package/es/heatmap/models/hexagon.js +52 -28
- package/es/heatmap/triangulation.js +4 -0
- package/es/image/index.js +28 -9
- package/es/image/models/image.js +100 -66
- package/es/index.js +17 -9
- package/es/line/index.js +35 -9
- package/es/line/models/arc.js +112 -63
- package/es/line/models/arc_3d.js +102 -58
- package/es/line/models/earthArc_3d.js +105 -60
- package/es/line/models/flow.js +60 -36
- package/es/line/models/great_circle.js +94 -53
- package/es/line/models/line.js +136 -85
- package/es/line/models/linearline.js +74 -42
- package/es/line/models/simpleLine.js +67 -38
- package/es/line/models/wall.js +92 -52
- package/es/mask/index.js +28 -9
- package/es/mask/models/fill.js +54 -29
- package/es/plugins/DataMappingPlugin.js +114 -78
- package/es/plugins/DataSourcePlugin.js +68 -45
- package/es/plugins/FeatureScalePlugin.js +122 -67
- package/es/plugins/LayerAnimateStylePlugin.js +5 -0
- package/es/plugins/LayerMaskPlugin.js +11 -3
- package/es/plugins/LayerModelPlugin.js +108 -69
- package/es/plugins/LayerStylePlugin.js +9 -3
- package/es/plugins/LightingPlugin.js +18 -12
- package/es/plugins/MultiPassRendererPlugin.js +16 -11
- package/es/plugins/PixelPickingPlugin.js +21 -12
- package/es/plugins/RegisterStyleAttributePlugin.js +12 -5
- package/es/plugins/ShaderUniformPlugin.js +27 -13
- package/es/plugins/UpdateModelPlugin.js +5 -0
- package/es/plugins/UpdateStyleAttributePlugin.js +11 -5
- package/es/point/index.js +78 -26
- package/es/point/models/earthExtrude.js +95 -58
- package/es/point/models/earthFill.js +80 -52
- package/es/point/models/extrude.js +94 -57
- package/es/point/models/fill.js +81 -56
- package/es/point/models/fillmage.js +100 -60
- package/es/point/models/image.js +83 -47
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +54 -30
- package/es/point/models/radar.js +63 -38
- package/es/point/models/simplePoint.js +62 -38
- package/es/point/models/text.js +296 -199
- package/es/point/shape/extrude.js +13 -4
- package/es/polygon/index.js +41 -11
- package/es/polygon/models/extrude.js +135 -87
- package/es/polygon/models/fill.js +79 -50
- package/es/polygon/models/index.js +2 -3
- package/es/polygon/models/ocean.js +76 -42
- package/es/polygon/models/water.js +71 -37
- package/es/raster/buffers/triangulation.js +4 -2
- package/es/raster/index.js +32 -9
- package/es/raster/models/raster.js +116 -80
- package/es/raster/models/rasterRgb.js +127 -84
- package/es/raster/models/rasterTerrainRgb.js +84 -56
- package/es/tile/interaction/getRasterData.js +20 -14
- package/es/tile/interaction/utils.js +9 -7
- package/es/tile/manager/base.js +96 -63
- package/es/tile/service/TileLayerService.js +55 -33
- package/es/tile/service/TilePickService.js +40 -26
- package/es/tile/service/TileSourceService.js +7 -3
- package/es/tile/tileFactory/DebugTile.js +46 -29
- package/es/tile/tileFactory/ImageTile.js +38 -20
- package/es/tile/tileFactory/MaskTile.js +43 -22
- package/es/tile/tileFactory/RasterRGBTile.js +42 -22
- package/es/tile/tileFactory/RasterTerrainRGBTile.js +38 -20
- package/es/tile/tileFactory/RasterTile.js +53 -30
- package/es/tile/tileFactory/Tile.js +97 -63
- package/es/tile/tileFactory/VectorTile.js +68 -41
- package/es/tile/tileFactory/index.js +11 -0
- package/es/tile/tileFactory/layers/TileDebugLayer.js +27 -6
- package/es/tile/tileFactory/util.js +3 -0
- package/es/tile/tileLayer/BaseLayer.js +146 -105
- package/es/tile/utils.js +1 -1
- package/es/utils/blend.js +2 -0
- package/es/utils/collision-index.js +16 -9
- package/es/utils/extrude_polyline.js +149 -101
- package/es/utils/grid-index.js +27 -2
- package/es/utils/identityScale.js +8 -0
- package/es/utils/layerData.js +44 -30
- package/es/utils/multiPassRender.js +13 -11
- package/es/utils/polylineNormal.js +37 -31
- package/es/utils/simpleLine.js +16 -2
- package/es/utils/stencil.js +3 -2
- package/es/utils/symbol-layout.js +53 -27
- package/es/wind/index.js +29 -9
- package/es/wind/models/utils.js +51 -26
- package/es/wind/models/wind.js +147 -101
- package/es/wind/models/windRender.js +66 -53
- package/lib/Geometry/index.js +38 -9
- package/lib/Geometry/models/billboard.js +97 -51
- package/lib/Geometry/models/index.js +5 -0
- package/lib/Geometry/models/plane.js +151 -79
- package/lib/Geometry/models/sprite.js +127 -60
- package/lib/canvas/index.js +40 -10
- package/lib/canvas/models/canvas.js +101 -41
- package/lib/canvas/models/index.js +3 -0
- package/lib/citybuliding/building.js +35 -8
- package/lib/citybuliding/models/build.js +92 -57
- package/lib/core/BaseLayer.js +469 -313
- package/lib/core/BaseModel.js +90 -51
- package/lib/core/CommonStyleAttribute.js +7 -2
- package/lib/core/LayerPickService.js +37 -21
- package/lib/core/TextureService.js +16 -0
- package/lib/core/interface.js +31 -21
- package/lib/core/schema.js +1 -0
- package/lib/core/shape/Path.js +31 -14
- package/lib/core/shape/extrude.js +62 -27
- package/lib/core/triangulation.js +177 -98
- package/lib/earth/index.js +43 -9
- package/lib/earth/models/atmosphere.js +63 -30
- package/lib/earth/models/base.js +90 -47
- package/lib/earth/models/bloomsphere.js +63 -30
- package/lib/earth/utils.js +31 -7
- package/lib/heatmap/index.js +48 -10
- package/lib/heatmap/models/grid.js +60 -28
- package/lib/heatmap/models/grid3d.js +60 -28
- package/lib/heatmap/models/heatmap.js +166 -92
- package/lib/heatmap/models/hexagon.js +60 -28
- package/lib/heatmap/models/index.js +6 -0
- package/lib/heatmap/triangulation.js +5 -0
- package/lib/image/index.js +36 -9
- package/lib/image/models/image.js +109 -66
- package/lib/image/models/index.js +3 -0
- package/lib/index.js +61 -7
- package/lib/line/index.js +40 -9
- package/lib/line/models/arc.js +122 -61
- package/lib/line/models/arc_3d.js +113 -56
- package/lib/line/models/earthArc_3d.js +115 -58
- package/lib/line/models/flow.js +70 -36
- package/lib/line/models/great_circle.js +104 -53
- package/lib/line/models/index.js +11 -0
- package/lib/line/models/line.js +144 -83
- package/lib/line/models/linearline.js +86 -42
- package/lib/line/models/simpleLine.js +77 -38
- package/lib/line/models/wall.js +103 -52
- package/lib/mask/index.js +36 -9
- package/lib/mask/models/fill.js +63 -29
- package/lib/mask/models/index.js +3 -0
- package/lib/plugins/DataMappingPlugin.js +125 -78
- package/lib/plugins/DataSourcePlugin.js +76 -45
- package/lib/plugins/FeatureScalePlugin.js +138 -67
- package/lib/plugins/LayerAnimateStylePlugin.js +10 -0
- package/lib/plugins/LayerMaskPlugin.js +17 -4
- package/lib/plugins/LayerModelPlugin.js +117 -70
- package/lib/plugins/LayerStylePlugin.js +14 -4
- package/lib/plugins/LightingPlugin.js +25 -12
- package/lib/plugins/MultiPassRendererPlugin.js +22 -11
- package/lib/plugins/PixelPickingPlugin.js +27 -12
- package/lib/plugins/RegisterStyleAttributePlugin.js +19 -5
- package/lib/plugins/ShaderUniformPlugin.js +34 -13
- package/lib/plugins/UpdateModelPlugin.js +10 -1
- package/lib/plugins/UpdateStyleAttributePlugin.js +16 -5
- package/lib/point/index.js +83 -26
- package/lib/point/models/earthExtrude.js +106 -58
- package/lib/point/models/earthFill.js +110 -52
- package/lib/point/models/extrude.js +103 -57
- package/lib/point/models/fill.js +90 -54
- package/lib/point/models/fillmage.js +107 -58
- package/lib/point/models/image.js +92 -47
- package/lib/point/models/index.js +12 -1
- package/lib/point/models/normal.js +64 -30
- package/lib/point/models/radar.js +72 -38
- package/lib/point/models/simplePoint.js +72 -38
- package/lib/point/models/text.js +305 -199
- package/lib/point/shape/extrude.js +20 -4
- package/lib/polygon/index.js +48 -11
- package/lib/polygon/models/extrude.js +146 -87
- package/lib/polygon/models/fill.js +89 -50
- package/lib/polygon/models/index.js +14 -2
- package/lib/polygon/models/ocean.js +88 -42
- package/lib/polygon/models/water.js +82 -37
- package/lib/raster/buffers/triangulation.js +7 -3
- package/lib/raster/index.js +40 -9
- package/lib/raster/models/index.js +5 -0
- package/lib/raster/models/raster.js +125 -80
- package/lib/raster/models/rasterRgb.js +139 -84
- package/lib/raster/models/rasterTerrainRgb.js +93 -56
- package/lib/tile/interaction/getRasterData.js +25 -14
- package/lib/tile/interaction/utils.js +19 -7
- package/lib/tile/manager/base.js +104 -63
- package/lib/tile/service/TileLayerService.js +60 -33
- package/lib/tile/service/TilePickService.js +48 -26
- package/lib/tile/service/TileSourceService.js +16 -2
- package/lib/tile/style/utils.js +3 -0
- package/lib/tile/tileFactory/DebugTile.js +54 -29
- package/lib/tile/tileFactory/ImageTile.js +46 -20
- package/lib/tile/tileFactory/MaskTile.js +51 -22
- package/lib/tile/tileFactory/RasterRGBTile.js +50 -22
- package/lib/tile/tileFactory/RasterTerrainRGBTile.js +46 -20
- package/lib/tile/tileFactory/RasterTile.js +63 -30
- package/lib/tile/tileFactory/Tile.js +102 -63
- package/lib/tile/tileFactory/VectorTile.js +76 -41
- package/lib/tile/tileFactory/index.js +25 -0
- package/lib/tile/tileFactory/layers/TileDebugLayer.js +32 -6
- package/lib/tile/tileFactory/util.js +9 -0
- package/lib/tile/tileLayer/BaseLayer.js +153 -105
- package/lib/tile/utils.js +5 -1
- package/lib/utils/blend.js +5 -0
- package/lib/utils/collision-index.js +25 -9
- package/lib/utils/extrude_polyline.js +181 -101
- package/lib/utils/grid-index.js +28 -2
- package/lib/utils/identityScale.js +9 -0
- package/lib/utils/layerData.js +49 -30
- package/lib/utils/multiPassRender.js +16 -11
- package/lib/utils/polylineNormal.js +66 -31
- package/lib/utils/simpleLine.js +21 -2
- package/lib/utils/stencil.js +4 -0
- package/lib/utils/symbol-layout.js +55 -27
- package/lib/wind/index.js +37 -9
- package/lib/wind/models/index.js +3 -0
- package/lib/wind/models/utils.js +62 -26
- package/lib/wind/models/wind.js +157 -101
- package/lib/wind/models/windRender.js +71 -53
- package/lib/wind/models/windShader.js +1 -0
- package/package.json +7 -7
|
@@ -1,63 +1,86 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
9
|
+
|
|
8
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
9
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
10
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
+
|
|
11
16
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
+
|
|
12
18
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
+
|
|
13
20
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
+
|
|
14
22
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
+
|
|
15
24
|
var _l7Core = require("@antv/l7-core");
|
|
25
|
+
|
|
16
26
|
var _l7Utils = require("@antv/l7-utils");
|
|
27
|
+
|
|
17
28
|
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
29
|
+
|
|
18
30
|
var _triangulation = require("../../core/triangulation");
|
|
31
|
+
|
|
19
32
|
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
|
+
|
|
20
34
|
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
|
+
|
|
21
36
|
/* babel-plugin-inline-import '../shaders/raster_terrain_rgb_frag.glsl' */
|
|
22
37
|
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
|
+
|
|
23
39
|
/* babel-plugin-inline-import '../shaders/rater_terrain_rgb_vert.glsl' */
|
|
24
40
|
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
|
+
|
|
25
42
|
var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
26
43
|
(0, _inherits2.default)(RasterTerrainRGB, _BaseModel);
|
|
44
|
+
|
|
27
45
|
var _super = _createSuper(RasterTerrainRGB);
|
|
46
|
+
|
|
28
47
|
function RasterTerrainRGB() {
|
|
29
48
|
(0, _classCallCheck2.default)(this, RasterTerrainRGB);
|
|
30
49
|
return _super.apply(this, arguments);
|
|
31
50
|
}
|
|
51
|
+
|
|
32
52
|
(0, _createClass2.default)(RasterTerrainRGB, [{
|
|
33
53
|
key: "getUninforms",
|
|
34
54
|
value: function getUninforms() {
|
|
35
55
|
var _ref = this.layer.getLayerConfig(),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
opacity = _ref.opacity,
|
|
57
|
+
_ref$clampLow = _ref.clampLow,
|
|
58
|
+
clampLow = _ref$clampLow === void 0 ? true : _ref$clampLow,
|
|
59
|
+
_ref$clampHigh = _ref.clampHigh,
|
|
60
|
+
clampHigh = _ref$clampHigh === void 0 ? true : _ref$clampHigh,
|
|
61
|
+
_ref$noDataValue = _ref.noDataValue,
|
|
62
|
+
noDataValue = _ref$noDataValue === void 0 ? -9999999 : _ref$noDataValue,
|
|
63
|
+
domain = _ref.domain,
|
|
64
|
+
rampColors = _ref.rampColors,
|
|
65
|
+
colorTexture = _ref.colorTexture,
|
|
66
|
+
_ref$rScaler = _ref.rScaler,
|
|
67
|
+
rScaler = _ref$rScaler === void 0 ? 6553.6 : _ref$rScaler,
|
|
68
|
+
_ref$gScaler = _ref.gScaler,
|
|
69
|
+
gScaler = _ref$gScaler === void 0 ? 25.6 : _ref$gScaler,
|
|
70
|
+
_ref$bScaler = _ref.bScaler,
|
|
71
|
+
bScaler = _ref$bScaler === void 0 ? 0.1 : _ref$bScaler,
|
|
72
|
+
_ref$offset = _ref.offset,
|
|
73
|
+
offset = _ref$offset === void 0 ? 10000 : _ref$offset;
|
|
74
|
+
|
|
54
75
|
var newdomain = domain || (0, _l7Utils.getDefaultDomain)(rampColors);
|
|
55
76
|
var texture = colorTexture;
|
|
77
|
+
|
|
56
78
|
if (!colorTexture) {
|
|
57
79
|
texture = this.layer.textureService.getColorTexture(rampColors, newdomain);
|
|
58
80
|
} else {
|
|
59
81
|
this.layer.textureService.setColorTexture(colorTexture, rampColors, newdomain);
|
|
60
82
|
}
|
|
83
|
+
|
|
61
84
|
return {
|
|
62
85
|
u_opacity: opacity || 1,
|
|
63
86
|
u_texture: this.texture,
|
|
@@ -75,50 +98,58 @@ var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
|
75
98
|
var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
76
99
|
var source, createTexture2D, imageData, model;
|
|
77
100
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
78
|
-
while (1)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
while (1) {
|
|
102
|
+
switch (_context.prev = _context.next) {
|
|
103
|
+
case 0:
|
|
104
|
+
source = this.layer.getSource();
|
|
105
|
+
createTexture2D = this.rendererService.createTexture2D;
|
|
106
|
+
_context.next = 4;
|
|
107
|
+
return source.data.images;
|
|
108
|
+
|
|
109
|
+
case 4:
|
|
110
|
+
imageData = _context.sent;
|
|
111
|
+
this.texture = createTexture2D({
|
|
112
|
+
data: imageData[0],
|
|
113
|
+
width: imageData[0].width,
|
|
114
|
+
height: imageData[0].height,
|
|
115
|
+
min: _l7Core.gl.LINEAR,
|
|
116
|
+
mag: _l7Core.gl.LINEAR
|
|
117
|
+
});
|
|
118
|
+
_context.next = 8;
|
|
119
|
+
return this.layer.buildLayerModel({
|
|
120
|
+
moduleName: 'RasterTileDataImage',
|
|
121
|
+
vertexShader: Raster_terrainVert,
|
|
122
|
+
fragmentShader: Raster_terrainFrag,
|
|
123
|
+
triangulation: _triangulation.RasterImageTriangulation,
|
|
124
|
+
primitive: _l7Core.gl.TRIANGLES,
|
|
125
|
+
depth: {
|
|
126
|
+
enable: false
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
case 8:
|
|
131
|
+
model = _context.sent;
|
|
132
|
+
return _context.abrupt("return", [model]);
|
|
133
|
+
|
|
134
|
+
case 10:
|
|
135
|
+
case "end":
|
|
136
|
+
return _context.stop();
|
|
137
|
+
}
|
|
110
138
|
}
|
|
111
139
|
}, _callee, this);
|
|
112
140
|
}));
|
|
141
|
+
|
|
113
142
|
function initModels() {
|
|
114
143
|
return _initModels.apply(this, arguments);
|
|
115
144
|
}
|
|
145
|
+
|
|
116
146
|
return initModels;
|
|
117
147
|
}()
|
|
118
148
|
}, {
|
|
119
149
|
key: "clearModels",
|
|
120
150
|
value: function clearModels() {
|
|
121
151
|
var _this$texture;
|
|
152
|
+
|
|
122
153
|
(_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
|
|
123
154
|
}
|
|
124
155
|
}, {
|
|
@@ -126,18 +157,23 @@ var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
|
126
157
|
value: function () {
|
|
127
158
|
var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
128
159
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
129
|
-
while (1)
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
160
|
+
while (1) {
|
|
161
|
+
switch (_context2.prev = _context2.next) {
|
|
162
|
+
case 0:
|
|
163
|
+
return _context2.abrupt("return", this.initModels());
|
|
164
|
+
|
|
165
|
+
case 1:
|
|
166
|
+
case "end":
|
|
167
|
+
return _context2.stop();
|
|
168
|
+
}
|
|
135
169
|
}
|
|
136
170
|
}, _callee2, this);
|
|
137
171
|
}));
|
|
172
|
+
|
|
138
173
|
function buildModels() {
|
|
139
174
|
return _buildModels.apply(this, arguments);
|
|
140
175
|
}
|
|
176
|
+
|
|
141
177
|
return buildModels;
|
|
142
178
|
}()
|
|
143
179
|
}, {
|
|
@@ -163,4 +199,5 @@ var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
|
163
199
|
}]);
|
|
164
200
|
return RasterTerrainRGB;
|
|
165
201
|
}(_BaseModel2.default);
|
|
202
|
+
|
|
166
203
|
exports.default = RasterTerrainRGB;
|
|
@@ -1,34 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.readPixel = readPixel;
|
|
8
9
|
exports.readRasterValue = readRasterValue;
|
|
10
|
+
|
|
9
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
|
+
|
|
10
13
|
var _l7Utils = require("@antv/l7-utils");
|
|
14
|
+
|
|
11
15
|
function readRasterValue(tile, mapService, x, y) {
|
|
12
16
|
var _tile$bboxPolygon, _tile$data, _tile$data2, _tile$data3;
|
|
17
|
+
|
|
13
18
|
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
|
+
|
|
14
20
|
var _bbox = (0, _slicedToArray2.default)(bbox, 4),
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
_bbox$ = _bbox[0],
|
|
22
|
+
minLng = _bbox$ === void 0 ? 0 : _bbox$,
|
|
23
|
+
_bbox$2 = _bbox[1],
|
|
24
|
+
minLat = _bbox$2 === void 0 ? 0 : _bbox$2,
|
|
25
|
+
_bbox$3 = _bbox[2],
|
|
26
|
+
maxLng = _bbox$3 === void 0 ? 10 : _bbox$3,
|
|
27
|
+
_bbox$4 = _bbox[3],
|
|
28
|
+
maxLat = _bbox$4 === void 0 ? -10 : _bbox$4;
|
|
29
|
+
|
|
23
30
|
var tileXY = mapService.lngLatToContainer([minLng, minLat]);
|
|
24
31
|
var tileMaxXY = mapService.lngLatToContainer([maxLng, maxLat]);
|
|
25
32
|
var tilePixelWidth = tileMaxXY.x - tileXY.x;
|
|
26
33
|
var tilePixelHeight = tileXY.y - tileMaxXY.y;
|
|
27
|
-
var pos = [(x - tileXY.x) / tilePixelWidth,
|
|
28
|
-
// x
|
|
34
|
+
var pos = [(x - tileXY.x) / tilePixelWidth, // x
|
|
29
35
|
(y - tileMaxXY.y) / tilePixelHeight // y
|
|
30
36
|
];
|
|
31
|
-
|
|
32
37
|
var tileWidth = (tile === null || tile === void 0 ? void 0 : (_tile$data = tile.data) === null || _tile$data === void 0 ? void 0 : _tile$data.width) || 1;
|
|
33
38
|
var tileHeight = (tile === null || tile === void 0 ? void 0 : (_tile$data2 = tile.data) === null || _tile$data2 === void 0 ? void 0 : _tile$data2.height) || 1;
|
|
34
39
|
var indexX = Math.floor(pos[0] * tileWidth);
|
|
@@ -37,19 +42,24 @@ function readRasterValue(tile, mapService, x, y) {
|
|
|
37
42
|
var data = tile === null || tile === void 0 ? void 0 : (_tile$data3 = tile.data) === null || _tile$data3 === void 0 ? void 0 : _tile$data3.data[index];
|
|
38
43
|
return data;
|
|
39
44
|
}
|
|
45
|
+
|
|
40
46
|
function readPixel(x, y, rendererService) {
|
|
41
47
|
var readPixels = rendererService.readPixels,
|
|
42
|
-
|
|
48
|
+
getContainer = rendererService.getContainer;
|
|
43
49
|
var xInDevicePixel = x * _l7Utils.DOM.DPR;
|
|
44
50
|
var yInDevicePixel = y * _l7Utils.DOM.DPR;
|
|
51
|
+
|
|
45
52
|
var _getContainerSize = getContainerSize(getContainer()),
|
|
46
|
-
|
|
47
|
-
|
|
53
|
+
width = _getContainerSize.width,
|
|
54
|
+
height = _getContainerSize.height;
|
|
55
|
+
|
|
48
56
|
width *= _l7Utils.DOM.DPR;
|
|
49
57
|
height *= _l7Utils.DOM.DPR;
|
|
58
|
+
|
|
50
59
|
if (xInDevicePixel > width - 1 * _l7Utils.DOM.DPR || xInDevicePixel < 0 || yInDevicePixel > height - 1 * _l7Utils.DOM.DPR || yInDevicePixel < 0) {
|
|
51
60
|
return false;
|
|
52
61
|
}
|
|
62
|
+
|
|
53
63
|
var pickedColors = readPixels({
|
|
54
64
|
x: Math.floor(xInDevicePixel),
|
|
55
65
|
// 视口坐标系原点在左上,而 WebGL 在左下,需要翻转 Y 轴
|
|
@@ -60,6 +70,7 @@ function readPixel(x, y, rendererService) {
|
|
|
60
70
|
});
|
|
61
71
|
return pickedColors;
|
|
62
72
|
}
|
|
73
|
+
|
|
63
74
|
function getContainerSize(container) {
|
|
64
75
|
if (container.getContext) {
|
|
65
76
|
return {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
@@ -11,8 +12,11 @@ exports.setFeatureSelect = setFeatureSelect;
|
|
|
11
12
|
exports.setHighlight = setHighlight;
|
|
12
13
|
exports.setPickState = setPickState;
|
|
13
14
|
exports.setSelect = setSelect;
|
|
15
|
+
|
|
14
16
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
+
|
|
15
18
|
var _l7Utils = require("@antv/l7-utils");
|
|
19
|
+
|
|
16
20
|
function clearPickState(layers) {
|
|
17
21
|
layers.filter(function (layer) {
|
|
18
22
|
return layer.inited && layer.isVisible();
|
|
@@ -23,6 +27,7 @@ function clearPickState(layers) {
|
|
|
23
27
|
layer.setCurrentSelectedId(null);
|
|
24
28
|
});
|
|
25
29
|
}
|
|
30
|
+
|
|
26
31
|
function setSelect(layers, pickedColors, renderList) {
|
|
27
32
|
var selectedId = (0, _l7Utils.decodePickingColor)(pickedColors);
|
|
28
33
|
var pickColor;
|
|
@@ -33,11 +38,12 @@ function setSelect(layers, pickedColors, renderList) {
|
|
|
33
38
|
pickColor = pickedColors;
|
|
34
39
|
} else {
|
|
35
40
|
selectFeature(layer, new Uint8Array([0, 0, 0, 0])); // toggle select
|
|
41
|
+
|
|
36
42
|
layer.setCurrentSelectedId(null);
|
|
37
43
|
pickColor = null;
|
|
38
44
|
}
|
|
39
|
-
});
|
|
40
|
-
|
|
45
|
+
}); // unselect normal layer
|
|
46
|
+
|
|
41
47
|
renderList.filter(function (layer) {
|
|
42
48
|
return layer.inited && layer.isVisible() && layer.needPick('click');
|
|
43
49
|
}).filter(function (layer) {
|
|
@@ -48,12 +54,12 @@ function setSelect(layers, pickedColors, renderList) {
|
|
|
48
54
|
});
|
|
49
55
|
return pickColor;
|
|
50
56
|
}
|
|
57
|
+
|
|
51
58
|
function setHighlight(layers, pickedColors) {
|
|
52
59
|
var pickId = (0, _l7Utils.decodePickingColor)(pickedColors);
|
|
53
60
|
layers.filter(function (layer) {
|
|
54
61
|
return layer.inited && layer.isVisible();
|
|
55
|
-
})
|
|
56
|
-
// @ts-ignore
|
|
62
|
+
}) // @ts-ignore
|
|
57
63
|
.filter(function (layer) {
|
|
58
64
|
return layer.getPickID() !== pickId;
|
|
59
65
|
}).map(function (layer) {
|
|
@@ -62,12 +68,14 @@ function setHighlight(layers, pickedColors) {
|
|
|
62
68
|
layer.hooks.beforeHighlight.call(pickedColors);
|
|
63
69
|
});
|
|
64
70
|
}
|
|
71
|
+
|
|
65
72
|
function setPickState(layers, pickColors) {
|
|
66
73
|
if (pickColors.select) {
|
|
67
74
|
layers.map(function (layer) {
|
|
68
75
|
selectFeature(layer, pickColors.select);
|
|
69
76
|
});
|
|
70
77
|
}
|
|
78
|
+
|
|
71
79
|
if (pickColors.active) {
|
|
72
80
|
layers.filter(function (layer) {
|
|
73
81
|
return layer.inited && layer.isVisible();
|
|
@@ -76,14 +84,17 @@ function setPickState(layers, pickColors) {
|
|
|
76
84
|
});
|
|
77
85
|
}
|
|
78
86
|
}
|
|
87
|
+
|
|
79
88
|
function selectFeature(layer, pickedColors) {
|
|
80
89
|
// @ts-ignore
|
|
81
90
|
var _pickedColors = (0, _slicedToArray2.default)(pickedColors, 3),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
91
|
+
r = _pickedColors[0],
|
|
92
|
+
g = _pickedColors[1],
|
|
93
|
+
b = _pickedColors[2];
|
|
94
|
+
|
|
85
95
|
layer.hooks.beforeSelect.call([r, g, b]);
|
|
86
96
|
}
|
|
97
|
+
|
|
87
98
|
function setFeatureSelect(color, layers) {
|
|
88
99
|
var id = (0, _l7Utils.decodePickingColor)(color);
|
|
89
100
|
layers.map(function (layer) {
|
|
@@ -91,6 +102,7 @@ function setFeatureSelect(color, layers) {
|
|
|
91
102
|
layer.setCurrentSelectedId(id);
|
|
92
103
|
});
|
|
93
104
|
}
|
|
105
|
+
|
|
94
106
|
function setFeatureActive(color, layers) {
|
|
95
107
|
var id = (0, _l7Utils.decodePickingColor)(color);
|
|
96
108
|
layers.map(function (layer) {
|