@antv/l7-layers 2.16.0 → 2.16.1
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 +485 -321
- package/es/core/BaseModel.js +126 -97
- 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 +31 -10
- package/es/core/triangulation.js +114 -54
- 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 +146 -91
- 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 +34 -9
- package/es/line/models/arc.js +118 -66
- package/es/line/models/arc_3d.js +108 -60
- package/es/line/models/earthArc_3d.js +111 -63
- package/es/line/models/great_circle.js +100 -56
- package/es/line/models/half.js +77 -46
- package/es/line/models/line.js +148 -94
- package/es/line/models/linearline.js +80 -45
- package/es/line/models/simpleLine.js +74 -41
- 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 +117 -80
- 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 +104 -67
- 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 +77 -26
- package/es/point/models/earthExtrude.js +102 -61
- package/es/point/models/earthFill.js +87 -57
- package/es/point/models/extrude.js +101 -60
- package/es/point/models/fill.js +100 -70
- package/es/point/models/fillmage.js +107 -63
- package/es/point/models/image.js +88 -48
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +54 -30
- package/es/point/models/radar.js +64 -40
- package/es/point/models/simplePoint.js +69 -41
- package/es/point/models/text.js +301 -198
- package/es/point/shape/extrude.js +13 -4
- package/es/polygon/index.js +40 -11
- package/es/polygon/models/extrude.js +92 -48
- package/es/polygon/models/fill.js +88 -54
- 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/dataMappingStyle.js +18 -8
- 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 +479 -321
- package/lib/core/BaseModel.js +139 -97
- 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 +54 -10
- package/lib/core/triangulation.js +153 -53
- 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 +162 -91
- 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 +128 -64
- package/lib/line/models/arc_3d.js +119 -58
- package/lib/line/models/earthArc_3d.js +122 -61
- package/lib/line/models/great_circle.js +111 -56
- package/lib/line/models/half.js +87 -46
- package/lib/line/models/index.js +11 -0
- package/lib/line/models/line.js +156 -92
- package/lib/line/models/linearline.js +92 -45
- package/lib/line/models/simpleLine.js +84 -41
- 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 +128 -80
- 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 +113 -68
- 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 +113 -61
- package/lib/point/models/earthFill.js +117 -57
- package/lib/point/models/extrude.js +111 -60
- package/lib/point/models/fill.js +109 -68
- package/lib/point/models/fillmage.js +115 -61
- package/lib/point/models/image.js +98 -48
- package/lib/point/models/index.js +12 -1
- package/lib/point/models/normal.js +64 -30
- package/lib/point/models/radar.js +74 -40
- package/lib/point/models/simplePoint.js +79 -41
- package/lib/point/models/text.js +309 -198
- package/lib/point/shape/extrude.js +20 -4
- package/lib/polygon/index.js +48 -11
- package/lib/polygon/models/extrude.js +103 -48
- package/lib/polygon/models/fill.js +98 -54
- 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/dataMappingStyle.js +19 -8
- 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
|
@@ -9,42 +9,57 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
|
|
|
9
9
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
10
10
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
11
11
|
var _excluded = ["data"],
|
|
12
|
-
|
|
12
|
+
_excluded2 = ["rasterData"];
|
|
13
13
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
14
|
+
|
|
14
15
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
16
|
+
|
|
15
17
|
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; } }
|
|
18
|
+
|
|
16
19
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
17
20
|
import BaseModel from "../../core/BaseModel";
|
|
18
21
|
import { RasterImageTriangulation } from "../../core/triangulation";
|
|
22
|
+
|
|
19
23
|
/* babel-plugin-inline-import '../shaders/raster_2d_vert.glsl' */
|
|
20
24
|
var rasterVert = "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\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";
|
|
25
|
+
|
|
21
26
|
/* babel-plugin-inline-import '../shaders/raster_rgb_frag.glsl' */
|
|
22
27
|
var rasterFrag = "precision mediump float;\nuniform vec2 u_rminmax: vec2(0,255); \nuniform vec2 u_gminmax: vec2(0,255);\nuniform vec2 u_bminmax: vec2(0,255);\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nuniform float u_noDataValue : 0.0;\nvarying vec2 v_texCoord;\n\nvoid main() {\n vec3 rgb = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y)).rgb;\n if(rgb == vec3(u_noDataValue)) {\n gl_FragColor = vec4(0.0, 0, 0, 0.0);\n } else {\n gl_FragColor = vec4(rgb.r / (u_rminmax.y -u_rminmax.x), rgb.g /(u_gminmax.y -u_gminmax.x), rgb.b/ (u_bminmax.y - u_bminmax.x), u_opacity);\n }\n if(gl_FragColor.a < 0.01)\n discard;\n \n}";
|
|
28
|
+
|
|
23
29
|
var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
24
30
|
_inherits(RasterModel, _BaseModel);
|
|
31
|
+
|
|
25
32
|
var _super = _createSuper(RasterModel);
|
|
33
|
+
|
|
26
34
|
function RasterModel() {
|
|
27
35
|
var _this;
|
|
36
|
+
|
|
28
37
|
_classCallCheck(this, RasterModel);
|
|
38
|
+
|
|
29
39
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
30
40
|
args[_key] = arguments[_key];
|
|
31
41
|
}
|
|
42
|
+
|
|
32
43
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
44
|
+
|
|
33
45
|
_defineProperty(_assertThisInitialized(_this), "dataOption", {});
|
|
46
|
+
|
|
34
47
|
return _this;
|
|
35
48
|
}
|
|
49
|
+
|
|
36
50
|
_createClass(RasterModel, [{
|
|
37
51
|
key: "getUninforms",
|
|
38
52
|
value: function getUninforms() {
|
|
39
53
|
var _ref = this.layer.getLayerConfig(),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
54
|
+
_ref$opacity = _ref.opacity,
|
|
55
|
+
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
56
|
+
_ref$noDataValue = _ref.noDataValue,
|
|
57
|
+
noDataValue = _ref$noDataValue === void 0 ? 0 : _ref$noDataValue;
|
|
58
|
+
|
|
44
59
|
var _this$dataOption = this.dataOption,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
60
|
+
rMinMax = _this$dataOption.rMinMax,
|
|
61
|
+
gMinMax = _this$dataOption.gMinMax,
|
|
62
|
+
bMinMax = _this$dataOption.bMinMax;
|
|
48
63
|
return {
|
|
49
64
|
u_opacity: opacity || 1,
|
|
50
65
|
u_texture: this.texture,
|
|
@@ -59,46 +74,58 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
59
74
|
value: function () {
|
|
60
75
|
var _getRasterData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(parserDataItem) {
|
|
61
76
|
var data, rescfg, _yield$parserDataItem, rasterData, rest;
|
|
77
|
+
|
|
62
78
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
63
|
-
while (1)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
79
|
+
while (1) {
|
|
80
|
+
switch (_context.prev = _context.next) {
|
|
81
|
+
case 0:
|
|
82
|
+
if (!Array.isArray(parserDataItem.data)) {
|
|
83
|
+
_context.next = 4;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
data = parserDataItem.data, rescfg = _objectWithoutProperties(parserDataItem, _excluded);
|
|
88
|
+
this.dataOption = rescfg;
|
|
89
|
+
return _context.abrupt("return", _objectSpread({
|
|
90
|
+
data: data
|
|
91
|
+
}, rescfg));
|
|
92
|
+
|
|
93
|
+
case 4:
|
|
94
|
+
_context.next = 6;
|
|
95
|
+
return parserDataItem.data;
|
|
96
|
+
|
|
97
|
+
case 6:
|
|
98
|
+
_yield$parserDataItem = _context.sent;
|
|
99
|
+
rasterData = _yield$parserDataItem.rasterData;
|
|
100
|
+
rest = _objectWithoutProperties(_yield$parserDataItem, _excluded2);
|
|
101
|
+
this.dataOption = rest;
|
|
102
|
+
|
|
103
|
+
if (!Array.isArray(rasterData)) {
|
|
104
|
+
_context.next = 14;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return _context.abrupt("return", _objectSpread({
|
|
109
|
+
data: rasterData
|
|
110
|
+
}, rest));
|
|
111
|
+
|
|
112
|
+
case 14:
|
|
113
|
+
return _context.abrupt("return", _objectSpread({
|
|
114
|
+
data: Array.from(rasterData)
|
|
115
|
+
}, rest));
|
|
116
|
+
|
|
117
|
+
case 15:
|
|
118
|
+
case "end":
|
|
119
|
+
return _context.stop();
|
|
120
|
+
}
|
|
96
121
|
}
|
|
97
122
|
}, _callee, this);
|
|
98
123
|
}));
|
|
124
|
+
|
|
99
125
|
function getRasterData(_x) {
|
|
100
126
|
return _getRasterData.apply(this, arguments);
|
|
101
127
|
}
|
|
128
|
+
|
|
102
129
|
return getRasterData;
|
|
103
130
|
}()
|
|
104
131
|
}, {
|
|
@@ -106,50 +133,58 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
106
133
|
value: function () {
|
|
107
134
|
var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
108
135
|
var source, createTexture2D, parserDataItem, _yield$this$getRaster, data, width, height, model;
|
|
136
|
+
|
|
109
137
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
110
|
-
while (1)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
138
|
+
while (1) {
|
|
139
|
+
switch (_context2.prev = _context2.next) {
|
|
140
|
+
case 0:
|
|
141
|
+
source = this.layer.getSource();
|
|
142
|
+
createTexture2D = this.rendererService.createTexture2D;
|
|
143
|
+
parserDataItem = source.data.dataArray[0];
|
|
144
|
+
_context2.next = 5;
|
|
145
|
+
return this.getRasterData(parserDataItem);
|
|
146
|
+
|
|
147
|
+
case 5:
|
|
148
|
+
_yield$this$getRaster = _context2.sent;
|
|
149
|
+
data = _yield$this$getRaster.data;
|
|
150
|
+
width = _yield$this$getRaster.width;
|
|
151
|
+
height = _yield$this$getRaster.height;
|
|
152
|
+
this.texture = createTexture2D({
|
|
153
|
+
// @ts-ignore
|
|
154
|
+
data: data,
|
|
155
|
+
width: width,
|
|
156
|
+
height: height,
|
|
157
|
+
format: gl.RGB,
|
|
158
|
+
type: gl.FLOAT
|
|
159
|
+
});
|
|
160
|
+
_context2.next = 12;
|
|
161
|
+
return this.layer.buildLayerModel({
|
|
162
|
+
moduleName: 'rasterImageDataRGBA',
|
|
163
|
+
vertexShader: rasterVert,
|
|
164
|
+
fragmentShader: rasterFrag,
|
|
165
|
+
triangulation: RasterImageTriangulation,
|
|
166
|
+
primitive: gl.TRIANGLES,
|
|
167
|
+
depth: {
|
|
168
|
+
enable: false
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
case 12:
|
|
173
|
+
model = _context2.sent;
|
|
174
|
+
return _context2.abrupt("return", [model]);
|
|
175
|
+
|
|
176
|
+
case 14:
|
|
177
|
+
case "end":
|
|
178
|
+
return _context2.stop();
|
|
179
|
+
}
|
|
147
180
|
}
|
|
148
181
|
}, _callee2, this);
|
|
149
182
|
}));
|
|
183
|
+
|
|
150
184
|
function initModels() {
|
|
151
185
|
return _initModels.apply(this, arguments);
|
|
152
186
|
}
|
|
187
|
+
|
|
153
188
|
return initModels;
|
|
154
189
|
}()
|
|
155
190
|
}, {
|
|
@@ -157,24 +192,30 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
157
192
|
value: function () {
|
|
158
193
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
159
194
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
160
|
-
while (1)
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
195
|
+
while (1) {
|
|
196
|
+
switch (_context3.prev = _context3.next) {
|
|
197
|
+
case 0:
|
|
198
|
+
return _context3.abrupt("return", this.initModels());
|
|
199
|
+
|
|
200
|
+
case 1:
|
|
201
|
+
case "end":
|
|
202
|
+
return _context3.stop();
|
|
203
|
+
}
|
|
166
204
|
}
|
|
167
205
|
}, _callee3, this);
|
|
168
206
|
}));
|
|
207
|
+
|
|
169
208
|
function buildModels() {
|
|
170
209
|
return _buildModels.apply(this, arguments);
|
|
171
210
|
}
|
|
211
|
+
|
|
172
212
|
return buildModels;
|
|
173
213
|
}()
|
|
174
214
|
}, {
|
|
175
215
|
key: "clearModels",
|
|
176
216
|
value: function clearModels() {
|
|
177
217
|
var _this$texture;
|
|
218
|
+
|
|
178
219
|
(_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
|
|
179
220
|
}
|
|
180
221
|
}, {
|
|
@@ -200,6 +241,8 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
200
241
|
});
|
|
201
242
|
}
|
|
202
243
|
}]);
|
|
244
|
+
|
|
203
245
|
return RasterModel;
|
|
204
246
|
}(BaseModel);
|
|
247
|
+
|
|
205
248
|
export { RasterModel as default };
|
|
@@ -5,52 +5,65 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
|
+
|
|
8
9
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
+
|
|
9
11
|
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; } }
|
|
12
|
+
|
|
10
13
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
11
14
|
import { getDefaultDomain } from '@antv/l7-utils';
|
|
12
15
|
import BaseModel from "../../core/BaseModel";
|
|
13
16
|
import { RasterImageTriangulation } from "../../core/triangulation";
|
|
17
|
+
|
|
14
18
|
/* babel-plugin-inline-import '../shaders/raster_terrain_rgb_frag.glsl' */
|
|
15
19
|
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";
|
|
20
|
+
|
|
16
21
|
/* babel-plugin-inline-import '../shaders/rater_terrain_rgb_vert.glsl' */
|
|
17
22
|
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";
|
|
23
|
+
|
|
18
24
|
var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
19
25
|
_inherits(RasterTerrainRGB, _BaseModel);
|
|
26
|
+
|
|
20
27
|
var _super = _createSuper(RasterTerrainRGB);
|
|
28
|
+
|
|
21
29
|
function RasterTerrainRGB() {
|
|
22
30
|
_classCallCheck(this, RasterTerrainRGB);
|
|
31
|
+
|
|
23
32
|
return _super.apply(this, arguments);
|
|
24
33
|
}
|
|
34
|
+
|
|
25
35
|
_createClass(RasterTerrainRGB, [{
|
|
26
36
|
key: "getUninforms",
|
|
27
37
|
value: function getUninforms() {
|
|
28
38
|
var _ref = this.layer.getLayerConfig(),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
opacity = _ref.opacity,
|
|
40
|
+
_ref$clampLow = _ref.clampLow,
|
|
41
|
+
clampLow = _ref$clampLow === void 0 ? true : _ref$clampLow,
|
|
42
|
+
_ref$clampHigh = _ref.clampHigh,
|
|
43
|
+
clampHigh = _ref$clampHigh === void 0 ? true : _ref$clampHigh,
|
|
44
|
+
_ref$noDataValue = _ref.noDataValue,
|
|
45
|
+
noDataValue = _ref$noDataValue === void 0 ? -9999999 : _ref$noDataValue,
|
|
46
|
+
domain = _ref.domain,
|
|
47
|
+
rampColors = _ref.rampColors,
|
|
48
|
+
colorTexture = _ref.colorTexture,
|
|
49
|
+
_ref$rScaler = _ref.rScaler,
|
|
50
|
+
rScaler = _ref$rScaler === void 0 ? 6553.6 : _ref$rScaler,
|
|
51
|
+
_ref$gScaler = _ref.gScaler,
|
|
52
|
+
gScaler = _ref$gScaler === void 0 ? 25.6 : _ref$gScaler,
|
|
53
|
+
_ref$bScaler = _ref.bScaler,
|
|
54
|
+
bScaler = _ref$bScaler === void 0 ? 0.1 : _ref$bScaler,
|
|
55
|
+
_ref$offset = _ref.offset,
|
|
56
|
+
offset = _ref$offset === void 0 ? 10000 : _ref$offset;
|
|
57
|
+
|
|
47
58
|
var newdomain = domain || getDefaultDomain(rampColors);
|
|
48
59
|
var texture = colorTexture;
|
|
60
|
+
|
|
49
61
|
if (!colorTexture) {
|
|
50
62
|
texture = this.layer.textureService.getColorTexture(rampColors, newdomain);
|
|
51
63
|
} else {
|
|
52
64
|
this.layer.textureService.setColorTexture(colorTexture, rampColors, newdomain);
|
|
53
65
|
}
|
|
66
|
+
|
|
54
67
|
return {
|
|
55
68
|
u_opacity: opacity || 1,
|
|
56
69
|
u_texture: this.texture,
|
|
@@ -68,50 +81,58 @@ var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
|
68
81
|
var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
69
82
|
var source, createTexture2D, imageData, model;
|
|
70
83
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
71
|
-
while (1)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
84
|
+
while (1) {
|
|
85
|
+
switch (_context.prev = _context.next) {
|
|
86
|
+
case 0:
|
|
87
|
+
source = this.layer.getSource();
|
|
88
|
+
createTexture2D = this.rendererService.createTexture2D;
|
|
89
|
+
_context.next = 4;
|
|
90
|
+
return source.data.images;
|
|
91
|
+
|
|
92
|
+
case 4:
|
|
93
|
+
imageData = _context.sent;
|
|
94
|
+
this.texture = createTexture2D({
|
|
95
|
+
data: imageData[0],
|
|
96
|
+
width: imageData[0].width,
|
|
97
|
+
height: imageData[0].height,
|
|
98
|
+
min: gl.LINEAR,
|
|
99
|
+
mag: gl.LINEAR
|
|
100
|
+
});
|
|
101
|
+
_context.next = 8;
|
|
102
|
+
return this.layer.buildLayerModel({
|
|
103
|
+
moduleName: 'RasterTileDataImage',
|
|
104
|
+
vertexShader: Raster_terrainVert,
|
|
105
|
+
fragmentShader: Raster_terrainFrag,
|
|
106
|
+
triangulation: RasterImageTriangulation,
|
|
107
|
+
primitive: gl.TRIANGLES,
|
|
108
|
+
depth: {
|
|
109
|
+
enable: false
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
case 8:
|
|
114
|
+
model = _context.sent;
|
|
115
|
+
return _context.abrupt("return", [model]);
|
|
116
|
+
|
|
117
|
+
case 10:
|
|
118
|
+
case "end":
|
|
119
|
+
return _context.stop();
|
|
120
|
+
}
|
|
103
121
|
}
|
|
104
122
|
}, _callee, this);
|
|
105
123
|
}));
|
|
124
|
+
|
|
106
125
|
function initModels() {
|
|
107
126
|
return _initModels.apply(this, arguments);
|
|
108
127
|
}
|
|
128
|
+
|
|
109
129
|
return initModels;
|
|
110
130
|
}()
|
|
111
131
|
}, {
|
|
112
132
|
key: "clearModels",
|
|
113
133
|
value: function clearModels() {
|
|
114
134
|
var _this$texture;
|
|
135
|
+
|
|
115
136
|
(_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
|
|
116
137
|
}
|
|
117
138
|
}, {
|
|
@@ -119,18 +140,23 @@ var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
|
119
140
|
value: function () {
|
|
120
141
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
121
142
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
122
|
-
while (1)
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
143
|
+
while (1) {
|
|
144
|
+
switch (_context2.prev = _context2.next) {
|
|
145
|
+
case 0:
|
|
146
|
+
return _context2.abrupt("return", this.initModels());
|
|
147
|
+
|
|
148
|
+
case 1:
|
|
149
|
+
case "end":
|
|
150
|
+
return _context2.stop();
|
|
151
|
+
}
|
|
128
152
|
}
|
|
129
153
|
}, _callee2, this);
|
|
130
154
|
}));
|
|
155
|
+
|
|
131
156
|
function buildModels() {
|
|
132
157
|
return _buildModels.apply(this, arguments);
|
|
133
158
|
}
|
|
159
|
+
|
|
134
160
|
return buildModels;
|
|
135
161
|
}()
|
|
136
162
|
}, {
|
|
@@ -154,6 +180,8 @@ var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
|
154
180
|
});
|
|
155
181
|
}
|
|
156
182
|
}]);
|
|
183
|
+
|
|
157
184
|
return RasterTerrainRGB;
|
|
158
185
|
}(BaseModel);
|
|
186
|
+
|
|
159
187
|
export { RasterTerrainRGB as default };
|
|
@@ -2,25 +2,26 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
2
2
|
import { DOM } from '@antv/l7-utils';
|
|
3
3
|
export function readRasterValue(tile, mapService, x, y) {
|
|
4
4
|
var _tile$bboxPolygon, _tile$data, _tile$data2, _tile$data3;
|
|
5
|
+
|
|
5
6
|
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];
|
|
7
|
+
|
|
6
8
|
var _bbox = _slicedToArray(bbox, 4),
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
_bbox$ = _bbox[0],
|
|
10
|
+
minLng = _bbox$ === void 0 ? 0 : _bbox$,
|
|
11
|
+
_bbox$2 = _bbox[1],
|
|
12
|
+
minLat = _bbox$2 === void 0 ? 0 : _bbox$2,
|
|
13
|
+
_bbox$3 = _bbox[2],
|
|
14
|
+
maxLng = _bbox$3 === void 0 ? 10 : _bbox$3,
|
|
15
|
+
_bbox$4 = _bbox[3],
|
|
16
|
+
maxLat = _bbox$4 === void 0 ? -10 : _bbox$4;
|
|
17
|
+
|
|
15
18
|
var tileXY = mapService.lngLatToContainer([minLng, minLat]);
|
|
16
19
|
var tileMaxXY = mapService.lngLatToContainer([maxLng, maxLat]);
|
|
17
20
|
var tilePixelWidth = tileMaxXY.x - tileXY.x;
|
|
18
21
|
var tilePixelHeight = tileXY.y - tileMaxXY.y;
|
|
19
|
-
var pos = [(x - tileXY.x) / tilePixelWidth,
|
|
20
|
-
// x
|
|
22
|
+
var pos = [(x - tileXY.x) / tilePixelWidth, // x
|
|
21
23
|
(y - tileMaxXY.y) / tilePixelHeight // y
|
|
22
24
|
];
|
|
23
|
-
|
|
24
25
|
var tileWidth = (tile === null || tile === void 0 ? void 0 : (_tile$data = tile.data) === null || _tile$data === void 0 ? void 0 : _tile$data.width) || 1;
|
|
25
26
|
var tileHeight = (tile === null || tile === void 0 ? void 0 : (_tile$data2 = tile.data) === null || _tile$data2 === void 0 ? void 0 : _tile$data2.height) || 1;
|
|
26
27
|
var indexX = Math.floor(pos[0] * tileWidth);
|
|
@@ -31,17 +32,21 @@ export function readRasterValue(tile, mapService, x, y) {
|
|
|
31
32
|
}
|
|
32
33
|
export function readPixel(x, y, rendererService) {
|
|
33
34
|
var readPixels = rendererService.readPixels,
|
|
34
|
-
|
|
35
|
+
getContainer = rendererService.getContainer;
|
|
35
36
|
var xInDevicePixel = x * DOM.DPR;
|
|
36
37
|
var yInDevicePixel = y * DOM.DPR;
|
|
38
|
+
|
|
37
39
|
var _getContainerSize = getContainerSize(getContainer()),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
width = _getContainerSize.width,
|
|
41
|
+
height = _getContainerSize.height;
|
|
42
|
+
|
|
40
43
|
width *= DOM.DPR;
|
|
41
44
|
height *= DOM.DPR;
|
|
45
|
+
|
|
42
46
|
if (xInDevicePixel > width - 1 * DOM.DPR || xInDevicePixel < 0 || yInDevicePixel > height - 1 * DOM.DPR || yInDevicePixel < 0) {
|
|
43
47
|
return false;
|
|
44
48
|
}
|
|
49
|
+
|
|
45
50
|
var pickedColors = readPixels({
|
|
46
51
|
x: Math.floor(xInDevicePixel),
|
|
47
52
|
// 视口坐标系原点在左上,而 WebGL 在左下,需要翻转 Y 轴
|
|
@@ -52,6 +57,7 @@ export function readPixel(x, y, rendererService) {
|
|
|
52
57
|
});
|
|
53
58
|
return pickedColors;
|
|
54
59
|
}
|
|
60
|
+
|
|
55
61
|
function getContainerSize(container) {
|
|
56
62
|
if (container.getContext) {
|
|
57
63
|
return {
|
|
@@ -20,11 +20,12 @@ export function setSelect(layers, pickedColors, renderList) {
|
|
|
20
20
|
pickColor = pickedColors;
|
|
21
21
|
} else {
|
|
22
22
|
selectFeature(layer, new Uint8Array([0, 0, 0, 0])); // toggle select
|
|
23
|
+
|
|
23
24
|
layer.setCurrentSelectedId(null);
|
|
24
25
|
pickColor = null;
|
|
25
26
|
}
|
|
26
|
-
});
|
|
27
|
-
|
|
27
|
+
}); // unselect normal layer
|
|
28
|
+
|
|
28
29
|
renderList.filter(function (layer) {
|
|
29
30
|
return layer.inited && layer.isVisible() && layer.needPick('click');
|
|
30
31
|
}).filter(function (layer) {
|
|
@@ -39,8 +40,7 @@ export function setHighlight(layers, pickedColors) {
|
|
|
39
40
|
var pickId = decodePickingColor(pickedColors);
|
|
40
41
|
layers.filter(function (layer) {
|
|
41
42
|
return layer.inited && layer.isVisible();
|
|
42
|
-
})
|
|
43
|
-
// @ts-ignore
|
|
43
|
+
}) // @ts-ignore
|
|
44
44
|
.filter(function (layer) {
|
|
45
45
|
return layer.getPickID() !== pickId;
|
|
46
46
|
}).map(function (layer) {
|
|
@@ -55,6 +55,7 @@ export function setPickState(layers, pickColors) {
|
|
|
55
55
|
selectFeature(layer, pickColors.select);
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
+
|
|
58
59
|
if (pickColors.active) {
|
|
59
60
|
layers.filter(function (layer) {
|
|
60
61
|
return layer.inited && layer.isVisible();
|
|
@@ -66,9 +67,10 @@ export function setPickState(layers, pickColors) {
|
|
|
66
67
|
export function selectFeature(layer, pickedColors) {
|
|
67
68
|
// @ts-ignore
|
|
68
69
|
var _pickedColors = _slicedToArray(pickedColors, 3),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
r = _pickedColors[0],
|
|
71
|
+
g = _pickedColors[1],
|
|
72
|
+
b = _pickedColors[2];
|
|
73
|
+
|
|
72
74
|
layer.hooks.beforeSelect.call([r, g, b]);
|
|
73
75
|
}
|
|
74
76
|
export function setFeatureSelect(color, layers) {
|