@antv/l7-layers 2.20.9 → 2.20.11
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/raster/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import BaseModel from "../../core/BaseModel";
|
|
|
14
14
|
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
15
15
|
import { RasterImageTriangulation } from "../../core/triangulation";
|
|
16
16
|
/* babel-plugin-inline-import '../shaders/raster/raster_2d_frag.glsl' */
|
|
17
|
-
var rasterFrag = "layout(std140) uniform commonUniforms {\n vec2 u_domain;\n float u_opacity;\n float u_noDataValue;\n bool u_clampLow;\n bool u_clampHigh;\n};\n\nuniform sampler2D u_rasterTexture;\nuniform sampler2D u_colorTexture;\n\nin vec2 v_texCoord;\n\nbool isnan_emu(float x) { return (x > 0.0 || x < 0.0) ? x != x : x != 0.0; }\n\nout vec4 outputColor;\n\nvoid main() {\n // Can use any component here since u_rasterTexture is under luminance format.\n float value = texture(SAMPLER_2D(u_rasterTexture), vec2(v_texCoord.x, v_texCoord.y)).r
|
|
17
|
+
var rasterFrag = "layout(std140) uniform commonUniforms {\n vec2 u_domain;\n float u_opacity;\n float u_noDataValue;\n bool u_clampLow;\n bool u_clampHigh;\n};\n\nuniform sampler2D u_rasterTexture;\nuniform sampler2D u_colorTexture;\n\nin vec2 v_texCoord;\n\nbool isnan_emu(float x) { return (x > 0.0 || x < 0.0) ? x != x : x != 0.0; }\n\nout vec4 outputColor;\n\nvoid main() {\n // Can use any component here since u_rasterTexture is under luminance format.\n float value = texture(SAMPLER_2D(u_rasterTexture), vec2(v_texCoord.x, v_texCoord.y)).r;\n if (value == u_noDataValue || isnan_emu(value)) {\n discard;\n } else if ((!u_clampLow && value < u_domain[0]) || (!u_clampHigh && value > u_domain[1])) {\n discard;\n } else {\n float normalisedValue =(value - u_domain[0]) / (u_domain[1] - u_domain[0]);\n vec4 color = texture(SAMPLER_2D(u_colorTexture), vec2(normalisedValue, 0));\n \n outputColor = color;\n outputColor.a = outputColor.a * u_opacity ;\n if (outputColor.a < 0.01)\n discard;\n }\n}\n";
|
|
18
18
|
/* babel-plugin-inline-import '../shaders/raster/raster_2d_vert.glsl' */
|
|
19
19
|
var rasterVert = "\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 14) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_domain;\n float u_opacity;\n float u_noDataValue;\n bool u_clampLow;\n bool u_clampHigh;\n};\n\nout vec2 v_texCoord;\n\n#pragma include \"projection\"\n\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_v2(vec4(project_pos.xy,0., 1.0));\n}\n";
|
|
20
20
|
var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
@@ -125,13 +125,13 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
125
125
|
key: "buildModels",
|
|
126
126
|
value: function () {
|
|
127
127
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
128
|
-
var source, createTexture2D, parserDataItem, _yield$this$getRaster, data, width, height, model;
|
|
128
|
+
var source, _this$rendererService, createTexture2D, queryVerdorInfo, parserDataItem, _yield$this$getRaster, data, width, height, model;
|
|
129
129
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
130
130
|
while (1) switch (_context3.prev = _context3.next) {
|
|
131
131
|
case 0:
|
|
132
132
|
this.initUniformsBuffer();
|
|
133
133
|
source = this.layer.getSource();
|
|
134
|
-
|
|
134
|
+
_this$rendererService = this.rendererService, createTexture2D = _this$rendererService.createTexture2D, queryVerdorInfo = _this$rendererService.queryVerdorInfo;
|
|
135
135
|
parserDataItem = source.data.dataArray[0];
|
|
136
136
|
_context3.next = 6;
|
|
137
137
|
return this.getRasterData(parserDataItem);
|
|
@@ -141,13 +141,16 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
141
141
|
width = _yield$this$getRaster.width;
|
|
142
142
|
height = _yield$this$getRaster.height;
|
|
143
143
|
this.texture = createTexture2D({
|
|
144
|
-
|
|
144
|
+
// @ts-ignore
|
|
145
|
+
data: new Float32Array(data),
|
|
145
146
|
width: width,
|
|
146
147
|
height: height,
|
|
147
|
-
|
|
148
|
-
|
|
148
|
+
/**
|
|
149
|
+
* WebGL1 allow the combination of gl.LUMINANCE & gl.FLOAT with OES_texture_float
|
|
150
|
+
*/
|
|
151
|
+
format: queryVerdorInfo() === 'WebGL1' ? gl.LUMINANCE : gl.RED,
|
|
152
|
+
type: gl.FLOAT,
|
|
149
153
|
alignment: 1
|
|
150
|
-
// aniso: 4,
|
|
151
154
|
});
|
|
152
155
|
_context3.next = 13;
|
|
153
156
|
return this.layer.buildLayerModel({
|
|
@@ -17,7 +17,7 @@ out vec4 outputColor;
|
|
|
17
17
|
|
|
18
18
|
void main() {
|
|
19
19
|
// Can use any component here since u_rasterTexture is under luminance format.
|
|
20
|
-
float value = texture(SAMPLER_2D(u_rasterTexture), vec2(v_texCoord.x, v_texCoord.y)).r
|
|
20
|
+
float value = texture(SAMPLER_2D(u_rasterTexture), vec2(v_texCoord.x, v_texCoord.y)).r;
|
|
21
21
|
if (value == u_noDataValue || isnan_emu(value)) {
|
|
22
22
|
discard;
|
|
23
23
|
} else if ((!u_clampLow && value < u_domain[0]) || (!u_clampHigh && value > u_domain[1])) {
|
package/lib/raster/index.js
CHANGED
|
@@ -21,7 +21,7 @@ var _triangulation = require("../../core/triangulation");
|
|
|
21
21
|
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); }; }
|
|
22
22
|
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; } }
|
|
23
23
|
/* babel-plugin-inline-import '../shaders/raster/raster_2d_frag.glsl' */
|
|
24
|
-
var rasterFrag = "layout(std140) uniform commonUniforms {\n vec2 u_domain;\n float u_opacity;\n float u_noDataValue;\n bool u_clampLow;\n bool u_clampHigh;\n};\n\nuniform sampler2D u_rasterTexture;\nuniform sampler2D u_colorTexture;\n\nin vec2 v_texCoord;\n\nbool isnan_emu(float x) { return (x > 0.0 || x < 0.0) ? x != x : x != 0.0; }\n\nout vec4 outputColor;\n\nvoid main() {\n // Can use any component here since u_rasterTexture is under luminance format.\n float value = texture(SAMPLER_2D(u_rasterTexture), vec2(v_texCoord.x, v_texCoord.y)).r
|
|
24
|
+
var rasterFrag = "layout(std140) uniform commonUniforms {\n vec2 u_domain;\n float u_opacity;\n float u_noDataValue;\n bool u_clampLow;\n bool u_clampHigh;\n};\n\nuniform sampler2D u_rasterTexture;\nuniform sampler2D u_colorTexture;\n\nin vec2 v_texCoord;\n\nbool isnan_emu(float x) { return (x > 0.0 || x < 0.0) ? x != x : x != 0.0; }\n\nout vec4 outputColor;\n\nvoid main() {\n // Can use any component here since u_rasterTexture is under luminance format.\n float value = texture(SAMPLER_2D(u_rasterTexture), vec2(v_texCoord.x, v_texCoord.y)).r;\n if (value == u_noDataValue || isnan_emu(value)) {\n discard;\n } else if ((!u_clampLow && value < u_domain[0]) || (!u_clampHigh && value > u_domain[1])) {\n discard;\n } else {\n float normalisedValue =(value - u_domain[0]) / (u_domain[1] - u_domain[0]);\n vec4 color = texture(SAMPLER_2D(u_colorTexture), vec2(normalisedValue, 0));\n \n outputColor = color;\n outputColor.a = outputColor.a * u_opacity ;\n if (outputColor.a < 0.01)\n discard;\n }\n}\n";
|
|
25
25
|
/* babel-plugin-inline-import '../shaders/raster/raster_2d_vert.glsl' */
|
|
26
26
|
var rasterVert = "\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 14) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_domain;\n float u_opacity;\n float u_noDataValue;\n bool u_clampLow;\n bool u_clampHigh;\n};\n\nout vec2 v_texCoord;\n\n#pragma include \"projection\"\n\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_v2(vec4(project_pos.xy,0., 1.0));\n}\n";
|
|
27
27
|
var RasterModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
@@ -132,13 +132,13 @@ var RasterModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
132
132
|
key: "buildModels",
|
|
133
133
|
value: function () {
|
|
134
134
|
var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
135
|
-
var source, createTexture2D, parserDataItem, _yield$this$getRaster, data, width, height, model;
|
|
135
|
+
var source, _this$rendererService, createTexture2D, queryVerdorInfo, parserDataItem, _yield$this$getRaster, data, width, height, model;
|
|
136
136
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
137
137
|
while (1) switch (_context3.prev = _context3.next) {
|
|
138
138
|
case 0:
|
|
139
139
|
this.initUniformsBuffer();
|
|
140
140
|
source = this.layer.getSource();
|
|
141
|
-
|
|
141
|
+
_this$rendererService = this.rendererService, createTexture2D = _this$rendererService.createTexture2D, queryVerdorInfo = _this$rendererService.queryVerdorInfo;
|
|
142
142
|
parserDataItem = source.data.dataArray[0];
|
|
143
143
|
_context3.next = 6;
|
|
144
144
|
return this.getRasterData(parserDataItem);
|
|
@@ -148,13 +148,16 @@ var RasterModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
148
148
|
width = _yield$this$getRaster.width;
|
|
149
149
|
height = _yield$this$getRaster.height;
|
|
150
150
|
this.texture = createTexture2D({
|
|
151
|
-
|
|
151
|
+
// @ts-ignore
|
|
152
|
+
data: new Float32Array(data),
|
|
152
153
|
width: width,
|
|
153
154
|
height: height,
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
/**
|
|
156
|
+
* WebGL1 allow the combination of gl.LUMINANCE & gl.FLOAT with OES_texture_float
|
|
157
|
+
*/
|
|
158
|
+
format: queryVerdorInfo() === 'WebGL1' ? _l7Core.gl.LUMINANCE : _l7Core.gl.RED,
|
|
159
|
+
type: _l7Core.gl.FLOAT,
|
|
156
160
|
alignment: 1
|
|
157
|
-
// aniso: 4,
|
|
158
161
|
});
|
|
159
162
|
_context3.next = 13;
|
|
160
163
|
return this.layer.buildLayerModel({
|
|
@@ -17,7 +17,7 @@ out vec4 outputColor;
|
|
|
17
17
|
|
|
18
18
|
void main() {
|
|
19
19
|
// Can use any component here since u_rasterTexture is under luminance format.
|
|
20
|
-
float value = texture(SAMPLER_2D(u_rasterTexture), vec2(v_texCoord.x, v_texCoord.y)).r
|
|
20
|
+
float value = texture(SAMPLER_2D(u_rasterTexture), vec2(v_texCoord.x, v_texCoord.y)).r;
|
|
21
21
|
if (value == u_noDataValue || isnan_emu(value)) {
|
|
22
22
|
discard;
|
|
23
23
|
} else if ((!u_clampLow && value < u_domain[0]) || (!u_clampHigh && value > u_domain[1])) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-layers",
|
|
3
|
-
"version": "2.20.
|
|
3
|
+
"version": "2.20.11",
|
|
4
4
|
"description": "L7's collection of built-in layers",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"license": "ISC",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@antv/async-hook": "^2.2.9",
|
|
30
|
-
"@antv/l7-core": "2.20.
|
|
31
|
-
"@antv/l7-maps": "2.20.
|
|
32
|
-
"@antv/l7-source": "2.20.
|
|
33
|
-
"@antv/l7-utils": "2.20.
|
|
30
|
+
"@antv/l7-core": "2.20.11",
|
|
31
|
+
"@antv/l7-maps": "2.20.11",
|
|
32
|
+
"@antv/l7-source": "2.20.11",
|
|
33
|
+
"@antv/l7-utils": "2.20.11",
|
|
34
34
|
"@babel/runtime": "^7.7.7",
|
|
35
35
|
"@mapbox/martini": "^0.2.0",
|
|
36
36
|
"@turf/clone": "^6.5.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"reflect-metadata": "^0.1.13"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@antv/l7-test-utils": "2.20.
|
|
55
|
+
"@antv/l7-test-utils": "2.20.11",
|
|
56
56
|
"@types/d3-array": "^2.0.0",
|
|
57
57
|
"@types/d3-color": "^1.2.2",
|
|
58
58
|
"@types/d3-interpolate": "1.1.6",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@types/gl-matrix": "^2.4.5",
|
|
62
62
|
"@types/lodash": "^4.14.138"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "40b9c778934bbcef548f1060bddf6de988b75c00",
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
67
67
|
}
|