@antv/l7-layers 2.14.1 → 2.14.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/models/billboard.js +3 -6
- package/es/Geometry/models/plane.js +3 -6
- package/es/core/BaseLayer.d.ts +7 -3
- package/es/core/BaseLayer.js +64 -20
- package/es/core/BaseModel.d.ts +3 -2
- package/es/core/BaseModel.js +39 -3
- package/es/core/LayerPickService.js +6 -30
- package/es/heatmap/index.d.ts +2 -2
- package/es/heatmap/index.js +5 -2
- package/es/heatmap/models/grid.js +5 -9
- package/es/heatmap/models/grid3d.js +5 -10
- package/es/heatmap/models/heatmap.d.ts +2 -2
- package/es/heatmap/models/heatmap.js +54 -46
- package/es/heatmap/models/hexagon.js +5 -10
- package/es/image/models/image.js +13 -16
- package/es/image/shaders/image_frag.glsl +2 -0
- package/es/index.js +6 -0
- package/es/line/models/arc.js +4 -6
- package/es/line/models/arc_3d.js +4 -6
- package/es/line/models/earthArc_3d.js +4 -6
- package/es/line/models/great_circle.js +9 -13
- package/es/line/models/half.js +4 -6
- package/es/line/models/line.js +3 -5
- package/es/line/models/linearline.js +4 -6
- package/es/line/models/simpleLine.js +5 -8
- package/es/mask/models/fill.js +1 -17
- package/es/plugins/LayerMaskPlugin.d.ts +8 -0
- package/es/plugins/LayerMaskPlugin.js +42 -0
- package/es/plugins/LayerStylePlugin.js +2 -1
- package/es/point/models/extrude.js +0 -1
- package/es/point/models/fill.js +4 -6
- package/es/point/models/fillmage.js +8 -12
- package/es/point/models/image.js +9 -14
- package/es/point/models/normal.js +4 -9
- package/es/point/models/radar.js +5 -10
- package/es/point/models/simplePoint.js +5 -10
- package/es/point/models/text.js +10 -16
- package/es/point/shaders/fill_frag.glsl +4 -0
- package/es/point/shaders/image_frag.glsl +4 -0
- package/es/point/shaders/text_frag.glsl +4 -0
- package/es/polygon/index.js +1 -1
- package/es/polygon/models/extrude.js +11 -13
- package/es/polygon/models/fill.js +3 -5
- package/es/polygon/models/ocean.js +6 -9
- package/es/polygon/models/water.js +7 -11
- package/es/raster/models/raster.js +9 -11
- package/es/raster/models/rasterRgb.js +8 -11
- package/es/raster/models/rasterTerrainRgb.js +9 -13
- package/es/raster/shaders/raster_2d_frag.glsl +6 -3
- package/es/raster/shaders/raster_frag.glsl +2 -0
- package/es/raster/shaders/raster_rgb_frag.glsl +2 -0
- package/es/raster/shaders/raster_terrain_rgb_frag.glsl +2 -0
- package/es/tile/service/TileLayerService.js +5 -4
- package/es/tile/style/constants.js +1 -1
- package/es/tile/tileFactory/Tile.d.ts +8 -0
- package/es/tile/tileFactory/Tile.js +102 -14
- package/es/tile/tileFactory/VectorTile.d.ts +0 -1
- package/es/tile/tileFactory/VectorTile.js +6 -46
- package/es/tile/tileLayer/BaseLayer.d.ts +2 -1
- package/es/tile/tileLayer/BaseLayer.js +68 -62
- package/es/utils/stencil.d.ts +7 -0
- package/es/utils/stencil.js +50 -0
- package/es/wind/index.d.ts +2 -1
- package/es/wind/index.js +3 -1
- package/es/wind/models/wind.d.ts +2 -2
- package/es/wind/models/wind.js +12 -10
- package/lib/Geometry/models/billboard.js +3 -7
- package/lib/Geometry/models/plane.js +2 -6
- package/lib/core/BaseLayer.js +64 -20
- package/lib/core/BaseModel.js +40 -2
- package/lib/core/LayerPickService.js +6 -32
- package/lib/heatmap/index.js +5 -2
- package/lib/heatmap/models/grid.js +5 -10
- package/lib/heatmap/models/grid3d.js +5 -11
- package/lib/heatmap/models/heatmap.js +53 -45
- package/lib/heatmap/models/hexagon.js +5 -11
- package/lib/image/models/image.js +12 -15
- package/lib/image/shaders/image_frag.glsl +2 -0
- package/lib/index.js +8 -0
- package/lib/line/models/arc.js +3 -5
- package/lib/line/models/arc_3d.js +3 -5
- package/lib/line/models/earthArc_3d.js +3 -5
- package/lib/line/models/great_circle.js +8 -12
- package/lib/line/models/half.js +3 -5
- package/lib/line/models/line.js +2 -4
- package/lib/line/models/linearline.js +3 -5
- package/lib/line/models/simpleLine.js +4 -7
- package/lib/mask/models/fill.js +1 -18
- package/lib/plugins/LayerMaskPlugin.js +54 -0
- package/lib/plugins/LayerStylePlugin.js +2 -1
- package/lib/point/models/extrude.js +0 -1
- package/lib/point/models/fill.js +3 -5
- package/lib/point/models/fillmage.js +7 -11
- package/lib/point/models/image.js +9 -15
- package/lib/point/models/normal.js +4 -10
- package/lib/point/models/radar.js +5 -11
- package/lib/point/models/simplePoint.js +5 -11
- package/lib/point/models/text.js +9 -15
- package/lib/point/shaders/fill_frag.glsl +4 -0
- package/lib/point/shaders/image_frag.glsl +4 -0
- package/lib/point/shaders/text_frag.glsl +4 -0
- package/lib/polygon/index.js +1 -1
- package/lib/polygon/models/extrude.js +10 -12
- package/lib/polygon/models/fill.js +2 -4
- package/lib/polygon/models/ocean.js +5 -8
- package/lib/polygon/models/water.js +7 -12
- package/lib/raster/models/raster.js +8 -10
- package/lib/raster/models/rasterRgb.js +8 -12
- package/lib/raster/models/rasterTerrainRgb.js +8 -12
- package/lib/raster/shaders/raster_2d_frag.glsl +6 -3
- package/lib/raster/shaders/raster_frag.glsl +2 -0
- package/lib/raster/shaders/raster_rgb_frag.glsl +2 -0
- package/lib/raster/shaders/raster_terrain_rgb_frag.glsl +2 -0
- package/lib/tile/service/TileLayerService.js +5 -4
- package/lib/tile/style/constants.js +1 -1
- package/lib/tile/tileFactory/Tile.js +102 -14
- package/lib/tile/tileFactory/VectorTile.js +6 -47
- package/lib/tile/tileLayer/BaseLayer.js +67 -62
- package/lib/utils/stencil.js +60 -0
- package/lib/wind/index.js +3 -1
- package/lib/wind/models/wind.js +11 -9
- package/package.json +7 -7
|
@@ -44,5 +44,9 @@ void main() {
|
|
|
44
44
|
// gl_FragColor = mix(vec4(v_color.rgb, v_color.a * u_opacity), vec4(u_stroke_color.rgb, u_stroke_color.a * u_opacity), smoothstep(0., 0.5, 1. - dist));
|
|
45
45
|
gl_FragColor = mix(vec4(v_color.rgb, v_color.a * opacity), vec4(textrueStroke.rgb, textrueStroke.a * opacity), smoothstep(0., 0.5, 1. - dist));
|
|
46
46
|
gl_FragColor.a= gl_FragColor.a * alpha;
|
|
47
|
+
// 作为 mask 模板时需要丢弃透明的像素
|
|
48
|
+
if (gl_FragColor.a < 0.01) {
|
|
49
|
+
discard;
|
|
50
|
+
}
|
|
47
51
|
gl_FragColor = filterColor(gl_FragColor);
|
|
48
52
|
}
|
package/es/polygon/index.js
CHANGED
|
@@ -72,7 +72,7 @@ var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
72
72
|
var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
|
|
73
73
|
var shape = shapeAttribute === null || shapeAttribute === void 0 ? void 0 : (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
|
|
74
74
|
|
|
75
|
-
if (shape === 'fill') {
|
|
75
|
+
if (shape === 'fill' || !shape) {
|
|
76
76
|
return 'fill';
|
|
77
77
|
} else if (shape === 'extrude') {
|
|
78
78
|
return 'extrude';
|
|
@@ -12,7 +12,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
12
12
|
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; } }
|
|
13
13
|
|
|
14
14
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
15
|
-
import {
|
|
15
|
+
import { rgb2arr } from '@antv/l7-utils';
|
|
16
16
|
import { isNumber } from 'lodash';
|
|
17
17
|
import BaseModel from "../../core/BaseModel";
|
|
18
18
|
import { PolygonExtrudeTriangulation } from "../../core/triangulation";
|
|
@@ -153,28 +153,26 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
153
153
|
key: "buildModels",
|
|
154
154
|
value: function () {
|
|
155
155
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
156
|
-
var
|
|
156
|
+
var _this$getShaders, frag, vert, type, model;
|
|
157
157
|
|
|
158
158
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
159
159
|
while (1) {
|
|
160
160
|
switch (_context2.prev = _context2.next) {
|
|
161
161
|
case 0:
|
|
162
|
-
_ref2 = this.layer.getLayerConfig(), _ref2$mask = _ref2.mask, mask = _ref2$mask === void 0 ? false : _ref2$mask, _ref2$maskInside = _ref2.maskInside, maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside;
|
|
163
162
|
_this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
|
|
164
|
-
_context2.next =
|
|
163
|
+
_context2.next = 3;
|
|
165
164
|
return this.layer.buildLayerModel({
|
|
166
165
|
moduleName: type,
|
|
167
166
|
vertexShader: vert,
|
|
168
167
|
fragmentShader: frag,
|
|
169
|
-
triangulation: PolygonExtrudeTriangulation
|
|
170
|
-
stencil: getMask(mask, maskInside)
|
|
168
|
+
triangulation: PolygonExtrudeTriangulation
|
|
171
169
|
});
|
|
172
170
|
|
|
173
|
-
case
|
|
171
|
+
case 3:
|
|
174
172
|
model = _context2.sent;
|
|
175
173
|
return _context2.abrupt("return", [model]);
|
|
176
174
|
|
|
177
|
-
case
|
|
175
|
+
case 5:
|
|
178
176
|
case "end":
|
|
179
177
|
return _context2.stop();
|
|
180
178
|
}
|
|
@@ -191,9 +189,9 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
191
189
|
}, {
|
|
192
190
|
key: "getShaders",
|
|
193
191
|
value: function getShaders() {
|
|
194
|
-
var
|
|
195
|
-
pickLight =
|
|
196
|
-
mapTexture =
|
|
192
|
+
var _ref2 = this.layer.getLayerConfig(),
|
|
193
|
+
pickLight = _ref2.pickLight,
|
|
194
|
+
mapTexture = _ref2.mapTexture;
|
|
197
195
|
|
|
198
196
|
if (mapTexture) {
|
|
199
197
|
return {
|
|
@@ -298,8 +296,8 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
298
296
|
value: function loadTexture() {
|
|
299
297
|
var _this = this;
|
|
300
298
|
|
|
301
|
-
var
|
|
302
|
-
mapTexture =
|
|
299
|
+
var _ref3 = this.layer.getLayerConfig(),
|
|
300
|
+
mapTexture = _ref3.mapTexture;
|
|
303
301
|
|
|
304
302
|
var createTexture2D = this.rendererService.createTexture2D;
|
|
305
303
|
this.texture = createTexture2D({
|
|
@@ -11,7 +11,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
11
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
12
|
|
|
13
13
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
14
|
-
import {
|
|
14
|
+
import { polygonFillTriangulation } from '@antv/l7-utils';
|
|
15
15
|
import { isNumber } from 'lodash';
|
|
16
16
|
import BaseModel from "../../core/BaseModel";
|
|
17
17
|
import { polygonTriangulationWithCenter } from "../../core/triangulation";
|
|
@@ -123,14 +123,14 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
123
123
|
key: "buildModels",
|
|
124
124
|
value: function () {
|
|
125
125
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
126
|
-
var _this$getModelParams, frag, vert, triangulation, type, _ref2, _ref2$
|
|
126
|
+
var _this$getModelParams, frag, vert, triangulation, type, _ref2, _ref2$workerEnabled, workerEnabled, enablePicking, model;
|
|
127
127
|
|
|
128
128
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
129
129
|
while (1) {
|
|
130
130
|
switch (_context2.prev = _context2.next) {
|
|
131
131
|
case 0:
|
|
132
132
|
_this$getModelParams = this.getModelParams(), frag = _this$getModelParams.frag, vert = _this$getModelParams.vert, triangulation = _this$getModelParams.triangulation, type = _this$getModelParams.type;
|
|
133
|
-
_ref2 = this.layer.getLayerConfig(), _ref2$
|
|
133
|
+
_ref2 = this.layer.getLayerConfig(), _ref2$workerEnabled = _ref2.workerEnabled, workerEnabled = _ref2$workerEnabled === void 0 ? false : _ref2$workerEnabled, enablePicking = _ref2.enablePicking;
|
|
134
134
|
this.layer.triangulation = triangulation;
|
|
135
135
|
_context2.next = 5;
|
|
136
136
|
return this.layer.buildLayerModel({
|
|
@@ -142,8 +142,6 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
142
142
|
depth: {
|
|
143
143
|
enable: false
|
|
144
144
|
},
|
|
145
|
-
blend: this.getBlend(),
|
|
146
|
-
stencil: getMask(mask, maskInside),
|
|
147
145
|
workerEnabled: workerEnabled,
|
|
148
146
|
workerOptions: {
|
|
149
147
|
modelType: type,
|
|
@@ -13,7 +13,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
13
13
|
|
|
14
14
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
15
15
|
import { Version } from '@antv/l7-maps';
|
|
16
|
-
import {
|
|
16
|
+
import { rgb2arr } from '@antv/l7-utils';
|
|
17
17
|
import { isNumber } from 'lodash';
|
|
18
18
|
import BaseModel from "../../core/BaseModel";
|
|
19
19
|
import { polygonTriangulation } from "../../core/triangulation";
|
|
@@ -91,14 +91,12 @@ var OceanModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
91
91
|
key: "buildModels",
|
|
92
92
|
value: function () {
|
|
93
93
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
94
|
-
var
|
|
95
|
-
|
|
94
|
+
var model;
|
|
96
95
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
97
96
|
while (1) {
|
|
98
97
|
switch (_context2.prev = _context2.next) {
|
|
99
98
|
case 0:
|
|
100
|
-
|
|
101
|
-
_context2.next = 3;
|
|
99
|
+
_context2.next = 2;
|
|
102
100
|
return this.layer.buildLayerModel({
|
|
103
101
|
moduleName: 'polygonOcean',
|
|
104
102
|
vertexShader: ocean_vert,
|
|
@@ -107,15 +105,14 @@ var OceanModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
107
105
|
primitive: gl.TRIANGLES,
|
|
108
106
|
depth: {
|
|
109
107
|
enable: false
|
|
110
|
-
}
|
|
111
|
-
stencil: getMask(mask, maskInside)
|
|
108
|
+
}
|
|
112
109
|
});
|
|
113
110
|
|
|
114
|
-
case
|
|
111
|
+
case 2:
|
|
115
112
|
model = _context2.sent;
|
|
116
113
|
return _context2.abrupt("return", [model]);
|
|
117
114
|
|
|
118
|
-
case
|
|
115
|
+
case 4:
|
|
119
116
|
case "end":
|
|
120
117
|
return _context2.stop();
|
|
121
118
|
}
|
|
@@ -13,7 +13,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
13
13
|
|
|
14
14
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
15
15
|
import { Version } from '@antv/l7-maps';
|
|
16
|
-
import { getMask } from '@antv/l7-utils';
|
|
17
16
|
import { isNumber } from 'lodash';
|
|
18
17
|
import BaseModel from "../../core/BaseModel";
|
|
19
18
|
import { polygonTriangulation } from "../../core/triangulation";
|
|
@@ -86,14 +85,12 @@ var WaterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
86
85
|
key: "buildModels",
|
|
87
86
|
value: function () {
|
|
88
87
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
89
|
-
var
|
|
90
|
-
|
|
88
|
+
var model;
|
|
91
89
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
92
90
|
while (1) {
|
|
93
91
|
switch (_context2.prev = _context2.next) {
|
|
94
92
|
case 0:
|
|
95
|
-
|
|
96
|
-
_context2.next = 3;
|
|
93
|
+
_context2.next = 2;
|
|
97
94
|
return this.layer.buildLayerModel({
|
|
98
95
|
moduleName: 'polygonWater',
|
|
99
96
|
vertexShader: water_vert,
|
|
@@ -102,15 +99,14 @@ var WaterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
102
99
|
primitive: gl.TRIANGLES,
|
|
103
100
|
depth: {
|
|
104
101
|
enable: false
|
|
105
|
-
}
|
|
106
|
-
stencil: getMask(mask, maskInside)
|
|
102
|
+
}
|
|
107
103
|
});
|
|
108
104
|
|
|
109
|
-
case
|
|
105
|
+
case 2:
|
|
110
106
|
model = _context2.sent;
|
|
111
107
|
return _context2.abrupt("return", [model]);
|
|
112
108
|
|
|
113
|
-
case
|
|
109
|
+
case 4:
|
|
114
110
|
case "end":
|
|
115
111
|
return _context2.stop();
|
|
116
112
|
}
|
|
@@ -173,8 +169,8 @@ var WaterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
173
169
|
value: function loadTexture() {
|
|
174
170
|
var _this = this;
|
|
175
171
|
|
|
176
|
-
var
|
|
177
|
-
waterTexture =
|
|
172
|
+
var _ref2 = this.layer.getLayerConfig(),
|
|
173
|
+
waterTexture = _ref2.waterTexture;
|
|
178
174
|
|
|
179
175
|
var createTexture2D = this.rendererService.createTexture2D;
|
|
180
176
|
this.texture = createTexture2D({
|
|
@@ -11,12 +11,12 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
11
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
12
|
|
|
13
13
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
14
|
-
import { getDefaultDomain
|
|
14
|
+
import { getDefaultDomain } from '@antv/l7-utils';
|
|
15
15
|
import BaseModel from "../../core/BaseModel";
|
|
16
16
|
import { RasterImageTriangulation } from "../../core/triangulation";
|
|
17
17
|
|
|
18
18
|
/* babel-plugin-inline-import '../shaders/raster_2d_frag.glsl' */
|
|
19
|
-
var rasterFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\nuniform float u_min;\nuniform float u_max;\nuniform vec2 u_domain;\nuniform float u_noDataValue;\nuniform bool u_clampLow: true;\nuniform bool u_clampHigh: true;\nvarying vec2 v_texCoord;\nbool isnan_emu(float x) { return (x > 0.0 || x < 0.0) ? x != x : x != 0.0; }\n\n\nvoid main() {\n\n float value = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y)).r;\n if (value == u_noDataValue || isnan_emu(value))\n
|
|
19
|
+
var rasterFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\nuniform float u_min;\nuniform float u_max;\nuniform vec2 u_domain;\nuniform float u_noDataValue;\nuniform bool u_clampLow: true;\nuniform bool u_clampHigh: true;\nvarying vec2 v_texCoord;\nbool isnan_emu(float x) { return (x > 0.0 || x < 0.0) ? x != x : x != 0.0; }\n\n\nvoid main() {\n\n float value = texture2D(u_texture,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 = texture2D(u_colorTexture,vec2(normalisedValue, 0));\n \n gl_FragColor = color;\n gl_FragColor.a = gl_FragColor.a * u_opacity ;\n if(gl_FragColor.a < 0.01)\n discard;\n \n }\n}\n";
|
|
20
20
|
|
|
21
21
|
/* babel-plugin-inline-import '../shaders/raster_2d_vert.glsl' */
|
|
22
22
|
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";
|
|
@@ -113,20 +113,19 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
113
113
|
key: "initModels",
|
|
114
114
|
value: function () {
|
|
115
115
|
var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
116
|
-
var
|
|
116
|
+
var source, createTexture2D, parserDataItem, _yield$this$getRaster, data, width, height, model;
|
|
117
117
|
|
|
118
118
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
119
119
|
while (1) {
|
|
120
120
|
switch (_context2.prev = _context2.next) {
|
|
121
121
|
case 0:
|
|
122
|
-
_ref2 = this.layer.getLayerConfig(), _ref2$mask = _ref2.mask, mask = _ref2$mask === void 0 ? false : _ref2$mask, _ref2$maskInside = _ref2.maskInside, maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside;
|
|
123
122
|
source = this.layer.getSource();
|
|
124
123
|
createTexture2D = this.rendererService.createTexture2D;
|
|
125
124
|
parserDataItem = source.data.dataArray[0];
|
|
126
|
-
_context2.next =
|
|
125
|
+
_context2.next = 5;
|
|
127
126
|
return this.getRasterData(parserDataItem);
|
|
128
127
|
|
|
129
|
-
case
|
|
128
|
+
case 5:
|
|
130
129
|
_yield$this$getRaster = _context2.sent;
|
|
131
130
|
data = _yield$this$getRaster.data;
|
|
132
131
|
width = _yield$this$getRaster.width;
|
|
@@ -139,7 +138,7 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
139
138
|
type: gl.FLOAT // aniso: 4,
|
|
140
139
|
|
|
141
140
|
});
|
|
142
|
-
_context2.next =
|
|
141
|
+
_context2.next = 12;
|
|
143
142
|
return this.layer.buildLayerModel({
|
|
144
143
|
moduleName: 'rasterImageData',
|
|
145
144
|
vertexShader: rasterVert,
|
|
@@ -148,15 +147,14 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
148
147
|
primitive: gl.TRIANGLES,
|
|
149
148
|
depth: {
|
|
150
149
|
enable: false
|
|
151
|
-
}
|
|
152
|
-
stencil: getMask(mask, maskInside)
|
|
150
|
+
}
|
|
153
151
|
});
|
|
154
152
|
|
|
155
|
-
case
|
|
153
|
+
case 12:
|
|
156
154
|
model = _context2.sent;
|
|
157
155
|
return _context2.abrupt("return", [model]);
|
|
158
156
|
|
|
159
|
-
case
|
|
157
|
+
case 14:
|
|
160
158
|
case "end":
|
|
161
159
|
return _context2.stop();
|
|
162
160
|
}
|
|
@@ -17,7 +17,6 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
17
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
18
|
|
|
19
19
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
20
|
-
import { getMask } from '@antv/l7-utils';
|
|
21
20
|
import BaseModel from "../../core/BaseModel";
|
|
22
21
|
import { RasterImageTriangulation } from "../../core/triangulation";
|
|
23
22
|
|
|
@@ -25,7 +24,7 @@ import { RasterImageTriangulation } from "../../core/triangulation";
|
|
|
25
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";
|
|
26
25
|
|
|
27
26
|
/* babel-plugin-inline-import '../shaders/raster_rgb_frag.glsl' */
|
|
28
|
-
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 \n}";
|
|
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}";
|
|
29
28
|
|
|
30
29
|
var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
31
30
|
_inherits(RasterModel, _BaseModel);
|
|
@@ -133,20 +132,19 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
133
132
|
key: "initModels",
|
|
134
133
|
value: function () {
|
|
135
134
|
var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
136
|
-
var
|
|
135
|
+
var source, createTexture2D, parserDataItem, _yield$this$getRaster, data, width, height, model;
|
|
137
136
|
|
|
138
137
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
139
138
|
while (1) {
|
|
140
139
|
switch (_context2.prev = _context2.next) {
|
|
141
140
|
case 0:
|
|
142
|
-
_ref2 = this.layer.getLayerConfig(), _ref2$mask = _ref2.mask, mask = _ref2$mask === void 0 ? false : _ref2$mask, _ref2$maskInside = _ref2.maskInside, maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside;
|
|
143
141
|
source = this.layer.getSource();
|
|
144
142
|
createTexture2D = this.rendererService.createTexture2D;
|
|
145
143
|
parserDataItem = source.data.dataArray[0];
|
|
146
|
-
_context2.next =
|
|
144
|
+
_context2.next = 5;
|
|
147
145
|
return this.getRasterData(parserDataItem);
|
|
148
146
|
|
|
149
|
-
case
|
|
147
|
+
case 5:
|
|
150
148
|
_yield$this$getRaster = _context2.sent;
|
|
151
149
|
data = _yield$this$getRaster.data;
|
|
152
150
|
width = _yield$this$getRaster.width;
|
|
@@ -159,7 +157,7 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
159
157
|
format: gl.RGB,
|
|
160
158
|
type: gl.FLOAT
|
|
161
159
|
});
|
|
162
|
-
_context2.next =
|
|
160
|
+
_context2.next = 12;
|
|
163
161
|
return this.layer.buildLayerModel({
|
|
164
162
|
moduleName: 'rasterImageDataRGBA',
|
|
165
163
|
vertexShader: rasterVert,
|
|
@@ -168,15 +166,14 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
168
166
|
primitive: gl.TRIANGLES,
|
|
169
167
|
depth: {
|
|
170
168
|
enable: false
|
|
171
|
-
}
|
|
172
|
-
stencil: getMask(mask, maskInside)
|
|
169
|
+
}
|
|
173
170
|
});
|
|
174
171
|
|
|
175
|
-
case
|
|
172
|
+
case 12:
|
|
176
173
|
model = _context2.sent;
|
|
177
174
|
return _context2.abrupt("return", [model]);
|
|
178
175
|
|
|
179
|
-
case
|
|
176
|
+
case 14:
|
|
180
177
|
case "end":
|
|
181
178
|
return _context2.stop();
|
|
182
179
|
}
|
|
@@ -11,12 +11,12 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
11
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
12
|
|
|
13
13
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
14
|
-
import { getDefaultDomain
|
|
14
|
+
import { getDefaultDomain } from '@antv/l7-utils';
|
|
15
15
|
import BaseModel from "../../core/BaseModel";
|
|
16
16
|
import { RasterImageTriangulation } from "../../core/triangulation";
|
|
17
17
|
|
|
18
18
|
/* babel-plugin-inline-import '../shaders/raster_terrain_rgb_frag.glsl' */
|
|
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;\n\nvoid main() {\n vec4 baseColor = texture2D(u_texture, vec2(v_texCoord.x, v_texCoord.y)) * 256.0;\n float r = baseColor.r * 256.0 * 256.0;\n float g = baseColor.g * 256.0;\n float b = baseColor.b;\n float value = (r + g + b) * 0.1 - 10000.0;\n \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 float normalisedValue =(value - u_domain[0]) / (u_domain[1] - u_domain[0]);\n vec4 color = texture2D(u_colorTexture, vec2(normalisedValue, 0));\n gl_FragColor = color;\n gl_FragColor.a = gl_FragColor.a * u_opacity ;\n }\n}\n";
|
|
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;\n\nvoid main() {\n vec4 baseColor = texture2D(u_texture, vec2(v_texCoord.x, v_texCoord.y)) * 256.0;\n float r = baseColor.r * 256.0 * 256.0;\n float g = baseColor.g * 256.0;\n float b = baseColor.b;\n float value = (r + g + b) * 0.1 - 10000.0;\n \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 float normalisedValue =(value - u_domain[0]) / (u_domain[1] - u_domain[0]);\n vec4 color = texture2D(u_colorTexture, vec2(normalisedValue, 0));\n gl_FragColor = color;\n gl_FragColor.a = gl_FragColor.a * u_opacity ;\n if(gl_FragColor.a < 0.01)\n discard;\n }\n}\n";
|
|
20
20
|
|
|
21
21
|
/* babel-plugin-inline-import '../shaders/rater_terrain_rgb_vert.glsl' */
|
|
22
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";
|
|
@@ -70,26 +70,24 @@ var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
|
70
70
|
key: "initModels",
|
|
71
71
|
value: function () {
|
|
72
72
|
var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
73
|
-
var
|
|
74
|
-
|
|
73
|
+
var source, createTexture2D, imageData, model;
|
|
75
74
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
76
75
|
while (1) {
|
|
77
76
|
switch (_context.prev = _context.next) {
|
|
78
77
|
case 0:
|
|
79
|
-
_ref2 = this.layer.getLayerConfig(), _ref2$mask = _ref2.mask, mask = _ref2$mask === void 0 ? false : _ref2$mask, _ref2$maskInside = _ref2.maskInside, maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside;
|
|
80
78
|
source = this.layer.getSource();
|
|
81
79
|
createTexture2D = this.rendererService.createTexture2D;
|
|
82
|
-
_context.next =
|
|
80
|
+
_context.next = 4;
|
|
83
81
|
return source.data.images;
|
|
84
82
|
|
|
85
|
-
case
|
|
83
|
+
case 4:
|
|
86
84
|
imageData = _context.sent;
|
|
87
85
|
this.texture = createTexture2D({
|
|
88
86
|
data: imageData[0],
|
|
89
87
|
width: imageData[0].width,
|
|
90
88
|
height: imageData[0].height
|
|
91
89
|
});
|
|
92
|
-
_context.next =
|
|
90
|
+
_context.next = 8;
|
|
93
91
|
return this.layer.buildLayerModel({
|
|
94
92
|
moduleName: 'RasterTileDataImage',
|
|
95
93
|
vertexShader: Raster_terrainVert,
|
|
@@ -98,16 +96,14 @@ var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
|
98
96
|
primitive: gl.TRIANGLES,
|
|
99
97
|
depth: {
|
|
100
98
|
enable: false
|
|
101
|
-
}
|
|
102
|
-
blend: this.getBlend(),
|
|
103
|
-
stencil: getMask(mask, maskInside)
|
|
99
|
+
}
|
|
104
100
|
});
|
|
105
101
|
|
|
106
|
-
case
|
|
102
|
+
case 8:
|
|
107
103
|
model = _context.sent;
|
|
108
104
|
return _context.abrupt("return", [model]);
|
|
109
105
|
|
|
110
|
-
case
|
|
106
|
+
case 10:
|
|
111
107
|
case "end":
|
|
112
108
|
return _context.stop();
|
|
113
109
|
}
|
|
@@ -16,14 +16,17 @@ void main() {
|
|
|
16
16
|
|
|
17
17
|
float value = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y)).r;
|
|
18
18
|
if (value == u_noDataValue || isnan_emu(value))
|
|
19
|
-
|
|
19
|
+
discard;
|
|
20
20
|
else if ((!u_clampLow && value < u_domain[0]) || (!u_clampHigh && value > u_domain[1]))
|
|
21
|
-
|
|
21
|
+
discard;
|
|
22
22
|
else {
|
|
23
|
-
|
|
24
23
|
float normalisedValue =(value - u_domain[0]) / (u_domain[1] -u_domain[0]);
|
|
25
24
|
vec4 color = texture2D(u_colorTexture,vec2(normalisedValue, 0));
|
|
25
|
+
|
|
26
26
|
gl_FragColor = color;
|
|
27
27
|
gl_FragColor.a = gl_FragColor.a * u_opacity ;
|
|
28
|
+
if(gl_FragColor.a < 0.01)
|
|
29
|
+
discard;
|
|
30
|
+
|
|
28
31
|
}
|
|
29
32
|
}
|
|
@@ -133,20 +133,20 @@ export var TileLayerService = /*#__PURE__*/function () {
|
|
|
133
133
|
var _render = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
134
134
|
var _this2 = this;
|
|
135
135
|
|
|
136
|
-
var layers;
|
|
136
|
+
var layers, renders;
|
|
137
137
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
138
138
|
while (1) {
|
|
139
139
|
switch (_context2.prev = _context2.next) {
|
|
140
140
|
case 0:
|
|
141
141
|
layers = this.getRenderLayers();
|
|
142
|
-
layers.map( /*#__PURE__*/function () {
|
|
142
|
+
renders = layers.map( /*#__PURE__*/function () {
|
|
143
143
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(layer) {
|
|
144
144
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
145
145
|
while (1) {
|
|
146
146
|
switch (_context.prev = _context.next) {
|
|
147
147
|
case 0:
|
|
148
148
|
_context.next = 2;
|
|
149
|
-
return _this2.layerService.
|
|
149
|
+
return _this2.layerService.renderTileLayer(layer);
|
|
150
150
|
|
|
151
151
|
case 2:
|
|
152
152
|
case "end":
|
|
@@ -160,8 +160,9 @@ export var TileLayerService = /*#__PURE__*/function () {
|
|
|
160
160
|
return _ref2.apply(this, arguments);
|
|
161
161
|
};
|
|
162
162
|
}());
|
|
163
|
+
Promise.all(renders);
|
|
163
164
|
|
|
164
|
-
case
|
|
165
|
+
case 3:
|
|
165
166
|
case "end":
|
|
166
167
|
return _context2.stop();
|
|
167
168
|
}
|
|
@@ -5,4 +5,4 @@ export var ProxyFuncs = [
|
|
|
5
5
|
* 1. 需要作用到所属子图层才会生效的方法
|
|
6
6
|
* 2. 不需要主动重新创建 model 的方法
|
|
7
7
|
*/
|
|
8
|
-
'shape', 'color', 'size', 'style', 'animate', 'filter', 'rotate', 'scale', 'setBlend', 'setSelect', 'setActive'];
|
|
8
|
+
'shape', 'color', 'size', 'style', 'animate', 'filter', 'rotate', 'scale', 'setBlend', 'setSelect', 'setActive', 'disableMask', 'enableMask'];
|
|
@@ -10,6 +10,8 @@ export default abstract class Tile implements ITile {
|
|
|
10
10
|
visible: boolean;
|
|
11
11
|
protected layers: ILayer[];
|
|
12
12
|
isLoaded: boolean;
|
|
13
|
+
protected tileMaskLayers: ILayer[];
|
|
14
|
+
protected tileMask: ILayer | undefined;
|
|
13
15
|
constructor(sourceTile: SourceTile, parent: ILayer);
|
|
14
16
|
getLayers(): ILayer[];
|
|
15
17
|
styleUpdate(...arg: any): void;
|
|
@@ -17,11 +19,14 @@ export default abstract class Tile implements ITile {
|
|
|
17
19
|
lnglatInBounds(lnglat: ILngLat): boolean;
|
|
18
20
|
protected getLayerOptions(): {
|
|
19
21
|
autoFit: boolean;
|
|
22
|
+
maskLayers: ILayer[];
|
|
23
|
+
tileMask: boolean;
|
|
20
24
|
mask: boolean | undefined;
|
|
21
25
|
maskInside?: boolean | undefined;
|
|
22
26
|
maskfence?: any;
|
|
23
27
|
maskColor?: string | undefined;
|
|
24
28
|
maskOpacity?: number | undefined;
|
|
29
|
+
maskOperation?: import("@antv/l7-core").MaskOperationType | undefined;
|
|
25
30
|
sourceLayer?: string | undefined;
|
|
26
31
|
colors?: string[] | undefined;
|
|
27
32
|
size?: number | undefined;
|
|
@@ -51,6 +56,7 @@ export default abstract class Tile implements ITile {
|
|
|
51
56
|
cursor?: string | undefined;
|
|
52
57
|
forward?: boolean | undefined;
|
|
53
58
|
usage?: string | undefined;
|
|
59
|
+
enableMask?: boolean | undefined;
|
|
54
60
|
enablePicking?: boolean | undefined;
|
|
55
61
|
enableHighlight?: boolean | undefined;
|
|
56
62
|
enableSelect?: boolean | undefined;
|
|
@@ -84,6 +90,8 @@ export default abstract class Tile implements ITile {
|
|
|
84
90
|
antialias?: boolean | undefined;
|
|
85
91
|
preserveDrawingBuffer?: boolean | undefined;
|
|
86
92
|
};
|
|
93
|
+
protected getMaskLayer(): ILayer[];
|
|
94
|
+
protected addTileMask(): Promise<ILayer>;
|
|
87
95
|
protected addMask(layer: ILayer, mask: ILayer): Promise<void>;
|
|
88
96
|
protected addLayer(layer: ILayer): Promise<void>;
|
|
89
97
|
updateVisible(value: boolean): void;
|