@antv/l7-layers 2.12.1 → 2.13.0
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/core/BaseLayer.d.ts +1 -1
- package/es/core/BaseLayer.js +18 -7
- package/es/core/TextureService.d.ts +4 -3
- package/es/core/TextureService.js +32 -10
- package/es/core/interface.d.ts +5 -6
- package/es/core/interface.js +7 -0
- package/es/line/index.d.ts +1 -1
- package/es/line/models/index.d.ts +1 -1
- package/es/line/models/index.js +0 -2
- package/es/plugins/DataMappingPlugin.js +10 -7
- package/es/point/index.d.ts +1 -1
- package/es/point/models/fill.d.ts +0 -14
- package/es/point/models/fill.js +9 -100
- package/es/point/models/fillmage.d.ts +0 -5
- package/es/point/models/fillmage.js +15 -65
- package/es/point/models/index.d.ts +1 -1
- package/es/point/models/index.js +0 -4
- package/es/point/models/radar.d.ts +0 -7
- package/es/point/models/radar.js +13 -79
- package/es/point/models/text.js +1 -1
- package/es/point/shaders/fill_vert.glsl +9 -26
- package/es/point/shaders/image/fillImage_vert.glsl +8 -14
- package/es/point/shaders/radar/radar_vert.glsl +12 -19
- package/es/point/shaders/text_vert.glsl +1 -1
- package/es/polygon/index.js +0 -2
- package/es/polygon/models/index.d.ts +1 -1
- package/es/polygon/models/index.js +2 -4
- package/es/raster/models/raster.d.ts +0 -2
- package/es/raster/models/raster.js +6 -22
- package/es/raster/models/rasterTerrainRgb.js +6 -6
- package/es/raster/shaders/raster_2d_frag.glsl +1 -0
- package/es/tile/tileFactory/RasterRGBTile.js +0 -1
- package/es/tile/tileFactory/RasterTile.js +13 -8
- package/lib/core/BaseLayer.js +17 -6
- package/lib/core/TextureService.js +31 -9
- package/lib/core/interface.js +9 -1
- package/lib/line/models/index.js +0 -3
- package/lib/plugins/DataMappingPlugin.js +10 -7
- package/lib/point/models/fill.js +8 -98
- package/lib/point/models/fillmage.js +16 -67
- package/lib/point/models/index.js +0 -6
- package/lib/point/models/radar.js +13 -80
- package/lib/point/models/text.js +1 -1
- package/lib/point/shaders/fill_vert.glsl +9 -26
- package/lib/point/shaders/image/fillImage_vert.glsl +8 -14
- package/lib/point/shaders/radar/radar_vert.glsl +12 -19
- package/lib/point/shaders/text_vert.glsl +1 -1
- package/lib/polygon/index.js +0 -2
- package/lib/polygon/models/index.js +2 -5
- package/lib/raster/models/raster.js +5 -21
- package/lib/raster/models/rasterTerrainRgb.js +5 -5
- package/lib/raster/shaders/raster_2d_frag.glsl +1 -0
- package/lib/tile/tileFactory/RasterTile.js +14 -8
- package/package.json +6 -6
- package/es/line/models/tile.d.ts +0 -8
- package/es/line/models/tile.js +0 -201
- package/es/line/shaders/tile/line_tile_map_vert.glsl +0 -25
- package/es/line/shaders/tile/line_tile_vert.glsl +0 -52
- package/es/line/shaders/tile/simpleline_map_vert.glsl +0 -15
- package/es/line/shaders/tile/simpleline_vert.glsl +0 -21
- package/es/point/models/tile.d.ts +0 -15
- package/es/point/models/tile.js +0 -217
- package/es/point/models/tileText.d.ts +0 -52
- package/es/point/models/tileText.js +0 -544
- package/es/point/shaders/tile/fill_tile_frag.glsl +0 -76
- package/es/point/shaders/tile/fill_tile_vert.glsl +0 -78
- package/es/point/shaders/tile/text_frag.glsl +0 -33
- package/es/point/shaders/tile/text_map_frag.glsl +0 -31
- package/es/point/shaders/tile/text_map_vert.glsl +0 -38
- package/es/point/shaders/tile/text_vert.glsl +0 -48
- package/es/polygon/models/tile.d.ts +0 -12
- package/es/polygon/models/tile.js +0 -141
- package/es/polygon/shaders/tile/polygon_tile_map_vert.glsl +0 -16
- package/es/polygon/shaders/tile/polygon_tile_vert.glsl +0 -42
- package/es/raster/models/rasterTile.d.ts +0 -18
- package/es/raster/models/rasterTile.js +0 -180
- package/es/tile/tileFactory/layers/RasterDataLayer.d.ts +0 -11
- package/es/tile/tileFactory/layers/RasterDataLayer.js +0 -89
- package/lib/line/models/tile.js +0 -217
- package/lib/line/shaders/tile/line_tile_map_vert.glsl +0 -25
- package/lib/line/shaders/tile/line_tile_vert.glsl +0 -52
- package/lib/line/shaders/tile/simpleline_map_vert.glsl +0 -15
- package/lib/line/shaders/tile/simpleline_vert.glsl +0 -21
- package/lib/point/models/tile.js +0 -233
- package/lib/point/models/tileText.js +0 -560
- package/lib/point/shaders/tile/fill_tile_frag.glsl +0 -76
- package/lib/point/shaders/tile/fill_tile_vert.glsl +0 -78
- package/lib/point/shaders/tile/text_frag.glsl +0 -33
- package/lib/point/shaders/tile/text_map_frag.glsl +0 -31
- package/lib/point/shaders/tile/text_map_vert.glsl +0 -38
- package/lib/point/shaders/tile/text_vert.glsl +0 -48
- package/lib/polygon/models/tile.js +0 -156
- package/lib/polygon/shaders/tile/polygon_tile_map_vert.glsl +0 -16
- package/lib/polygon/shaders/tile/polygon_tile_vert.glsl +0 -42
- package/lib/raster/models/rasterTile.js +0 -196
- package/lib/tile/tileFactory/layers/RasterDataLayer.js +0 -105
|
@@ -25,8 +25,6 @@ var _fill2 = _interopRequireDefault(require("./fill"));
|
|
|
25
25
|
|
|
26
26
|
var _ocean = _interopRequireDefault(require("./ocean"));
|
|
27
27
|
|
|
28
|
-
var _tile = _interopRequireDefault(require("./tile"));
|
|
29
|
-
|
|
30
28
|
var _water = _interopRequireDefault(require("./water"));
|
|
31
29
|
|
|
32
30
|
var PolygonModels = {
|
|
@@ -39,9 +37,8 @@ var PolygonModels = {
|
|
|
39
37
|
point_normal: _normal.default,
|
|
40
38
|
point_extrude: _extrude.default,
|
|
41
39
|
water: _water.default,
|
|
42
|
-
ocean: _ocean.default,
|
|
43
|
-
|
|
44
|
-
tile: _tile.default
|
|
40
|
+
ocean: _ocean.default // point_fill: PointModels.fill,
|
|
41
|
+
|
|
45
42
|
};
|
|
46
43
|
var _default = PolygonModels;
|
|
47
44
|
exports.default = _default;
|
|
@@ -34,7 +34,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
34
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
35
|
|
|
36
36
|
/* babel-plugin-inline-import '../shaders/raster_2d_frag.glsl' */
|
|
37
|
-
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 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);\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";
|
|
37
|
+
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 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);\n else {\n \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";
|
|
38
38
|
|
|
39
39
|
/* babel-plugin-inline-import '../shaders/raster_2d_vert.glsl' */
|
|
40
40
|
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";
|
|
@@ -61,15 +61,15 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
61
61
|
clampHigh = _ref$clampHigh === void 0 ? true : _ref$clampHigh,
|
|
62
62
|
_ref$noDataValue = _ref.noDataValue,
|
|
63
63
|
noDataValue = _ref$noDataValue === void 0 ? -9999999 : _ref$noDataValue,
|
|
64
|
-
|
|
65
|
-
domain = _ref$domain === void 0 ? [0, 1] : _ref$domain,
|
|
64
|
+
domain = _ref.domain,
|
|
66
65
|
rampColors = _ref.rampColors;
|
|
67
66
|
|
|
68
|
-
|
|
67
|
+
var newdomain = domain || (0, _l7Utils.getDefaultDomain)(rampColors);
|
|
68
|
+
this.colorTexture = this.layer.textureService.getColorTexture(rampColors, newdomain);
|
|
69
69
|
return {
|
|
70
70
|
u_opacity: opacity || 1,
|
|
71
71
|
u_texture: this.texture,
|
|
72
|
-
u_domain:
|
|
72
|
+
u_domain: newdomain,
|
|
73
73
|
u_clampLow: clampLow,
|
|
74
74
|
u_clampHigh: typeof clampHigh !== 'undefined' ? clampHigh : clampLow,
|
|
75
75
|
u_noDataValue: noDataValue,
|
|
@@ -245,22 +245,6 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
245
245
|
}
|
|
246
246
|
});
|
|
247
247
|
}
|
|
248
|
-
}, {
|
|
249
|
-
key: "updateColorTexture",
|
|
250
|
-
value: function updateColorTexture() {
|
|
251
|
-
var createTexture2D = this.rendererService.createTexture2D;
|
|
252
|
-
|
|
253
|
-
var _ref3 = this.layer.getLayerConfig(),
|
|
254
|
-
rampColors = _ref3.rampColors;
|
|
255
|
-
|
|
256
|
-
var imageData = (0, _l7Utils.generateColorRamp)(rampColors);
|
|
257
|
-
this.colorTexture = createTexture2D({
|
|
258
|
-
data: imageData.data,
|
|
259
|
-
width: imageData.width,
|
|
260
|
-
height: imageData.height,
|
|
261
|
-
flipY: false
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
248
|
}]);
|
|
265
249
|
return RasterModel;
|
|
266
250
|
}(_BaseModel2.default);
|
|
@@ -60,23 +60,23 @@ var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
|
60
60
|
clampHigh = _ref$clampHigh === void 0 ? true : _ref$clampHigh,
|
|
61
61
|
_ref$noDataValue = _ref.noDataValue,
|
|
62
62
|
noDataValue = _ref$noDataValue === void 0 ? -9999999 : _ref$noDataValue,
|
|
63
|
-
|
|
64
|
-
domain = _ref$domain === void 0 ? [0, 1] : _ref$domain,
|
|
63
|
+
domain = _ref.domain,
|
|
65
64
|
rampColors = _ref.rampColors,
|
|
66
65
|
colorTexture = _ref.colorTexture;
|
|
67
66
|
|
|
67
|
+
var newdomain = domain || (0, _l7Utils.getDefaultDomain)(rampColors);
|
|
68
68
|
var texture = colorTexture;
|
|
69
69
|
|
|
70
70
|
if (!colorTexture) {
|
|
71
|
-
texture = this.layer.textureService.getColorTexture(rampColors);
|
|
71
|
+
texture = this.layer.textureService.getColorTexture(rampColors, newdomain);
|
|
72
72
|
} else {
|
|
73
|
-
this.layer.textureService.setColorTexture(colorTexture, rampColors);
|
|
73
|
+
this.layer.textureService.setColorTexture(colorTexture, rampColors, newdomain);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
return {
|
|
77
77
|
u_opacity: opacity || 1,
|
|
78
78
|
u_texture: this.texture,
|
|
79
|
-
u_domain:
|
|
79
|
+
u_domain: newdomain,
|
|
80
80
|
u_clampLow: clampLow,
|
|
81
81
|
u_clampHigh: typeof clampHigh !== 'undefined' ? clampHigh : clampLow,
|
|
82
82
|
u_noDataValue: noDataValue,
|
|
@@ -20,6 +20,7 @@ void main() {
|
|
|
20
20
|
else if ((!u_clampLow && value < u_domain[0]) || (!u_clampHigh && value > u_domain[1]))
|
|
21
21
|
gl_FragColor = vec4(0, 0, 0, 0);
|
|
22
22
|
else {
|
|
23
|
+
|
|
23
24
|
float normalisedValue =(value - u_domain[0]) / (u_domain[1] -u_domain[0]);
|
|
24
25
|
vec4 color = texture2D(u_colorTexture,vec2(normalisedValue, 0));
|
|
25
26
|
gl_FragColor = color;
|
|
@@ -29,6 +29,8 @@ var _raster = _interopRequireDefault(require("../../raster"));
|
|
|
29
29
|
|
|
30
30
|
var _Tile2 = _interopRequireDefault(require("./Tile"));
|
|
31
31
|
|
|
32
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
33
|
+
|
|
32
34
|
var _excluded = ["rasterData"];
|
|
33
35
|
|
|
34
36
|
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); }; }
|
|
@@ -54,7 +56,8 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
|
|
|
54
56
|
key: "initTileLayer",
|
|
55
57
|
value: function () {
|
|
56
58
|
var _initTileLayer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
57
|
-
var attributes, layerOptions, sourceOptions, layer;
|
|
59
|
+
var attributes, layerOptions, sourceOptions, _ref, rampColors, domain, layer;
|
|
60
|
+
|
|
58
61
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
59
62
|
while (1) {
|
|
60
63
|
switch (_context.prev = _context.next) {
|
|
@@ -62,7 +65,8 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
|
|
|
62
65
|
attributes = this.parent.getLayerAttributeConfig();
|
|
63
66
|
layerOptions = this.getLayerOptions();
|
|
64
67
|
sourceOptions = this.getSourceOption();
|
|
65
|
-
|
|
68
|
+
_ref = this.getLayerOptions(), rampColors = _ref.rampColors, domain = _ref.domain;
|
|
69
|
+
this.colorTexture = this.parent.textureService.getColorTexture(rampColors, domain);
|
|
66
70
|
layer = new _raster.default((0, _objectSpread2.default)((0, _objectSpread2.default)({}, layerOptions), {}, {
|
|
67
71
|
colorTexture: this.colorTexture
|
|
68
72
|
})).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
|
|
@@ -74,13 +78,13 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
|
|
|
74
78
|
|
|
75
79
|
layer[attr]((_attributes$attr = attributes[attr]) === null || _attributes$attr === void 0 ? void 0 : _attributes$attr.field, (_attributes$attr2 = attributes[attr]) === null || _attributes$attr2 === void 0 ? void 0 : _attributes$attr2.values);
|
|
76
80
|
});
|
|
77
|
-
_context.next =
|
|
81
|
+
_context.next = 9;
|
|
78
82
|
return this.addLayer(layer);
|
|
79
83
|
|
|
80
|
-
case
|
|
84
|
+
case 9:
|
|
81
85
|
this.isLoaded = true;
|
|
82
86
|
|
|
83
|
-
case
|
|
87
|
+
case 10:
|
|
84
88
|
case "end":
|
|
85
89
|
return _context.stop();
|
|
86
90
|
}
|
|
@@ -126,9 +130,11 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
|
|
|
126
130
|
arg[_key] = arguments[_key];
|
|
127
131
|
}
|
|
128
132
|
|
|
129
|
-
var
|
|
130
|
-
rampColors =
|
|
131
|
-
|
|
133
|
+
var _ref2 = arg,
|
|
134
|
+
_ref2$rampColors = _ref2.rampColors,
|
|
135
|
+
rampColors = _ref2$rampColors === void 0 ? DEFAULT_COLOR_TEXTURE_OPTION : _ref2$rampColors,
|
|
136
|
+
domain = _ref2.domain;
|
|
137
|
+
this.colorTexture = this.parent.textureService.getColorTexture(rampColors, domain || (0, _l7Utils.getDefaultDomain)(rampColors));
|
|
132
138
|
this.layers.forEach(function (layer) {
|
|
133
139
|
return layer.style({
|
|
134
140
|
colorTexture: _this.colorTexture
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-layers",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
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.
|
|
31
|
-
"@antv/l7-maps": "2.
|
|
32
|
-
"@antv/l7-source": "2.
|
|
33
|
-
"@antv/l7-utils": "2.
|
|
30
|
+
"@antv/l7-core": "2.13.0",
|
|
31
|
+
"@antv/l7-maps": "2.13.0",
|
|
32
|
+
"@antv/l7-source": "2.13.0",
|
|
33
|
+
"@antv/l7-utils": "2.13.0",
|
|
34
34
|
"@babel/runtime": "^7.7.7",
|
|
35
35
|
"@mapbox/martini": "^0.2.0",
|
|
36
36
|
"@turf/clone": "^6.5.0",
|
|
@@ -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": "a87b58ebc6de89f13db8954f94fb603ef4bf72cd",
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
67
67
|
}
|
package/es/line/models/tile.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { IModel, IModelUniform } from '@antv/l7-core';
|
|
2
|
-
import BaseModel from '../../core/BaseModel';
|
|
3
|
-
export default class LineModel extends BaseModel {
|
|
4
|
-
getUninforms(): IModelUniform;
|
|
5
|
-
initModels(): Promise<IModel[]>;
|
|
6
|
-
buildModels(): Promise<IModel[]>;
|
|
7
|
-
protected registerBuiltinAttributes(): void;
|
|
8
|
-
}
|
package/es/line/models/tile.js
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
7
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
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
|
-
|
|
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
|
-
|
|
13
|
-
import { AttributeType, gl } from '@antv/l7-core';
|
|
14
|
-
import { getMask, rgb2arr } from '@antv/l7-utils';
|
|
15
|
-
import BaseModel from "../../core/BaseModel";
|
|
16
|
-
import { LineTriangulation } from "../../core/triangulation";
|
|
17
|
-
|
|
18
|
-
/* babel-plugin-inline-import '../../shader/minify_picking_frag.glsl' */
|
|
19
|
-
var line_tile_frag = "uniform float u_opacity : 1.0;\nvarying vec4 v_color;\n\n#pragma include \"picking\"\n\nvoid main() {\n gl_FragColor = v_color;\n gl_FragColor.a *= u_opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
20
|
-
|
|
21
|
-
/* babel-plugin-inline-import '../shaders/tile/line_tile_vert.glsl' */
|
|
22
|
-
var line_tile_vert = "attribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\n// uniform vec2 u_tileOrigin;\n// uniform float u_coord;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\n\nvoid main() {\n v_color = a_Color;\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // if(u_coord > 0.0) { // \u4F7F\u7528\u7ECF\u7EAC\u5EA6\u5750\u6807\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, 0.0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n }\n // } else { // \u4F7F\u7528\u504F\u79FB\u5750\u6807\n // vec2 pointPos = a_Position.xy;\n // vec4 tileWorld = vec4(project_mvt_offset_position(vec4(u_tileOrigin, 0.0, 1.0)).xyz, 1.0); // \u74E6\u7247\u8D77\u59CB\u70B9\u7684\u4E16\u754C\u5750\u6807\n\n // vec2 pointOffset = pointPos * pow(2.0, u_Zoom); // \u74E6\u7247\u5185\u7684\u70B9\u7684\u504F\u79FB\u5750\u6807\n \n // tileWorld.xy += pointOffset;\n\n // tileWorld.xy += offset;\n\n // if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // // Needs to be divided with project_uCommonUnitsPerMeter\n // tileWorld.w *= u_PixelsPerMeter.z;\n // }\n // gl_Position = u_ViewProjectionMatrix * tileWorld + u_ViewportCenterProjection;\n // }\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
23
|
-
|
|
24
|
-
/* babel-plugin-inline-import '../../shader/minify_frag.glsl' */
|
|
25
|
-
var line_tile_map_frag = "uniform float u_opacity : 1.0;\nuniform vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n gl_FragColor.a *= u_opacity;\n}\n";
|
|
26
|
-
|
|
27
|
-
/* babel-plugin-inline-import '../shaders/tile/line_tile_map_vert.glsl' */
|
|
28
|
-
var line_tile_map_vert = "attribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_size;\n\n#pragma include \"projection\"\n\nvoid main() {\n\n vec3 size = a_Miter * u_size * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, 0.0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n }\n}\n";
|
|
29
|
-
|
|
30
|
-
var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
31
|
-
_inherits(LineModel, _BaseModel);
|
|
32
|
-
|
|
33
|
-
var _super = _createSuper(LineModel);
|
|
34
|
-
|
|
35
|
-
function LineModel() {
|
|
36
|
-
_classCallCheck(this, LineModel);
|
|
37
|
-
|
|
38
|
-
return _super.apply(this, arguments);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
_createClass(LineModel, [{
|
|
42
|
-
key: "getUninforms",
|
|
43
|
-
value: function getUninforms() {
|
|
44
|
-
var _ref = this.layer.getLayerConfig(),
|
|
45
|
-
_ref$opacity = _ref.opacity,
|
|
46
|
-
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
47
|
-
usage = _ref.usage,
|
|
48
|
-
_ref$color = _ref.color,
|
|
49
|
-
color = _ref$color === void 0 ? '#fff' : _ref$color,
|
|
50
|
-
_ref$size = _ref.size,
|
|
51
|
-
size = _ref$size === void 0 ? 1 : _ref$size;
|
|
52
|
-
|
|
53
|
-
return {
|
|
54
|
-
// u_tileOrigin: tileOrigin || [0, 0],
|
|
55
|
-
// u_coord: coord === 'lnglat' ? 1.0 : 0.0,
|
|
56
|
-
u_opacity: Number(opacity),
|
|
57
|
-
u_color: usage === 'basemap' ? rgb2arr(color) : [0, 0, 0, 0],
|
|
58
|
-
u_size: usage === 'basemap' ? size : 1
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}, {
|
|
62
|
-
key: "initModels",
|
|
63
|
-
value: function () {
|
|
64
|
-
var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
65
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
66
|
-
while (1) {
|
|
67
|
-
switch (_context.prev = _context.next) {
|
|
68
|
-
case 0:
|
|
69
|
-
_context.next = 2;
|
|
70
|
-
return this.buildModels();
|
|
71
|
-
|
|
72
|
-
case 2:
|
|
73
|
-
return _context.abrupt("return", _context.sent);
|
|
74
|
-
|
|
75
|
-
case 3:
|
|
76
|
-
case "end":
|
|
77
|
-
return _context.stop();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}, _callee, this);
|
|
81
|
-
}));
|
|
82
|
-
|
|
83
|
-
function initModels() {
|
|
84
|
-
return _initModels.apply(this, arguments);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return initModels;
|
|
88
|
-
}()
|
|
89
|
-
}, {
|
|
90
|
-
key: "buildModels",
|
|
91
|
-
value: function () {
|
|
92
|
-
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
93
|
-
var _ref2, _ref2$mask, mask, _ref2$maskInside, maskInside, _ref2$depth, depth, usage, model;
|
|
94
|
-
|
|
95
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
96
|
-
while (1) {
|
|
97
|
-
switch (_context2.prev = _context2.next) {
|
|
98
|
-
case 0:
|
|
99
|
-
_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, _ref2$depth = _ref2.depth, depth = _ref2$depth === void 0 ? false : _ref2$depth, usage = _ref2.usage;
|
|
100
|
-
this.layer.triangulation = LineTriangulation;
|
|
101
|
-
_context2.next = 4;
|
|
102
|
-
return this.layer.buildLayerModel({
|
|
103
|
-
moduleName: 'lineTile_' + usage,
|
|
104
|
-
vertexShader: usage === 'basemap' ? line_tile_map_vert : line_tile_vert,
|
|
105
|
-
fragmentShader: usage === 'basemap' ? line_tile_map_frag : line_tile_frag,
|
|
106
|
-
triangulation: LineTriangulation,
|
|
107
|
-
blend: this.getBlend(),
|
|
108
|
-
depth: {
|
|
109
|
-
enable: depth
|
|
110
|
-
},
|
|
111
|
-
stencil: getMask(mask, maskInside),
|
|
112
|
-
pick: usage !== 'basemap'
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
case 4:
|
|
116
|
-
model = _context2.sent;
|
|
117
|
-
return _context2.abrupt("return", [model]);
|
|
118
|
-
|
|
119
|
-
case 6:
|
|
120
|
-
case "end":
|
|
121
|
-
return _context2.stop();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}, _callee2, this);
|
|
125
|
-
}));
|
|
126
|
-
|
|
127
|
-
function buildModels() {
|
|
128
|
-
return _buildModels.apply(this, arguments);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return buildModels;
|
|
132
|
-
}()
|
|
133
|
-
}, {
|
|
134
|
-
key: "registerBuiltinAttributes",
|
|
135
|
-
value: function registerBuiltinAttributes() {
|
|
136
|
-
var _this$layer$getLayerC = this.layer.getLayerConfig(),
|
|
137
|
-
usage = _this$layer$getLayerC.usage;
|
|
138
|
-
|
|
139
|
-
if (usage !== 'basemap') {
|
|
140
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
141
|
-
name: 'size',
|
|
142
|
-
type: AttributeType.Attribute,
|
|
143
|
-
descriptor: {
|
|
144
|
-
name: 'a_Size',
|
|
145
|
-
buffer: {
|
|
146
|
-
// give the WebGL driver a hint that this buffer may change
|
|
147
|
-
usage: gl.DYNAMIC_DRAW,
|
|
148
|
-
data: [],
|
|
149
|
-
type: gl.FLOAT
|
|
150
|
-
},
|
|
151
|
-
size: 2,
|
|
152
|
-
update: function update(feature) {
|
|
153
|
-
var _feature$size = feature.size,
|
|
154
|
-
size = _feature$size === void 0 ? 1 : _feature$size;
|
|
155
|
-
return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
162
|
-
name: 'normal',
|
|
163
|
-
type: AttributeType.Attribute,
|
|
164
|
-
descriptor: {
|
|
165
|
-
name: 'a_Normal',
|
|
166
|
-
buffer: {
|
|
167
|
-
// give the WebGL driver a hint that this buffer may change
|
|
168
|
-
usage: gl.STATIC_DRAW,
|
|
169
|
-
data: [],
|
|
170
|
-
type: gl.FLOAT
|
|
171
|
-
},
|
|
172
|
-
size: 3,
|
|
173
|
-
update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
|
|
174
|
-
return normal;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
179
|
-
name: 'miter',
|
|
180
|
-
type: AttributeType.Attribute,
|
|
181
|
-
descriptor: {
|
|
182
|
-
name: 'a_Miter',
|
|
183
|
-
buffer: {
|
|
184
|
-
// give the WebGL driver a hint that this buffer may change
|
|
185
|
-
usage: gl.STATIC_DRAW,
|
|
186
|
-
data: [],
|
|
187
|
-
type: gl.FLOAT
|
|
188
|
-
},
|
|
189
|
-
size: 1,
|
|
190
|
-
update: function update(feature, featureIdx, vertex) {
|
|
191
|
-
return [vertex[4]];
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
}]);
|
|
197
|
-
|
|
198
|
-
return LineModel;
|
|
199
|
-
}(BaseModel);
|
|
200
|
-
|
|
201
|
-
export { LineModel as default };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
attribute float a_Miter;
|
|
2
|
-
attribute vec4 a_Color;
|
|
3
|
-
attribute vec3 a_Normal;
|
|
4
|
-
attribute vec3 a_Position;
|
|
5
|
-
|
|
6
|
-
uniform mat4 u_ModelMatrix;
|
|
7
|
-
uniform mat4 u_Mvp;
|
|
8
|
-
uniform float u_size;
|
|
9
|
-
|
|
10
|
-
#pragma include "projection"
|
|
11
|
-
|
|
12
|
-
void main() {
|
|
13
|
-
|
|
14
|
-
vec3 size = a_Miter * u_size * reverse_offset_normal(a_Normal);
|
|
15
|
-
|
|
16
|
-
vec2 offset = project_pixel(size.xy);
|
|
17
|
-
|
|
18
|
-
vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
|
|
19
|
-
|
|
20
|
-
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
21
|
-
gl_Position = u_Mvp * (vec4(project_pos.xy + offset, 0.0, 1.0));
|
|
22
|
-
} else {
|
|
23
|
-
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
attribute float a_Miter;
|
|
2
|
-
attribute vec4 a_Color;
|
|
3
|
-
attribute vec2 a_Size;
|
|
4
|
-
attribute vec3 a_Normal;
|
|
5
|
-
attribute vec3 a_Position;
|
|
6
|
-
|
|
7
|
-
// uniform vec2 u_tileOrigin;
|
|
8
|
-
// uniform float u_coord;
|
|
9
|
-
|
|
10
|
-
uniform mat4 u_ModelMatrix;
|
|
11
|
-
uniform mat4 u_Mvp;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
#pragma include "projection"
|
|
15
|
-
#pragma include "picking"
|
|
16
|
-
|
|
17
|
-
varying vec4 v_color;
|
|
18
|
-
|
|
19
|
-
void main() {
|
|
20
|
-
v_color = a_Color;
|
|
21
|
-
|
|
22
|
-
vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);
|
|
23
|
-
|
|
24
|
-
vec2 offset = project_pixel(size.xy);
|
|
25
|
-
|
|
26
|
-
vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
|
|
27
|
-
|
|
28
|
-
// if(u_coord > 0.0) { // 使用经纬度坐标
|
|
29
|
-
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
30
|
-
gl_Position = u_Mvp * (vec4(project_pos.xy + offset, 0.0, 1.0));
|
|
31
|
-
} else {
|
|
32
|
-
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));
|
|
33
|
-
}
|
|
34
|
-
// } else { // 使用偏移坐标
|
|
35
|
-
// vec2 pointPos = a_Position.xy;
|
|
36
|
-
// vec4 tileWorld = vec4(project_mvt_offset_position(vec4(u_tileOrigin, 0.0, 1.0)).xyz, 1.0); // 瓦片起始点的世界坐标
|
|
37
|
-
|
|
38
|
-
// vec2 pointOffset = pointPos * pow(2.0, u_Zoom); // 瓦片内的点的偏移坐标
|
|
39
|
-
|
|
40
|
-
// tileWorld.xy += pointOffset;
|
|
41
|
-
|
|
42
|
-
// tileWorld.xy += offset;
|
|
43
|
-
|
|
44
|
-
// if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
|
|
45
|
-
// // Needs to be divided with project_uCommonUnitsPerMeter
|
|
46
|
-
// tileWorld.w *= u_PixelsPerMeter.z;
|
|
47
|
-
// }
|
|
48
|
-
// gl_Position = u_ViewProjectionMatrix * tileWorld + u_ViewportCenterProjection;
|
|
49
|
-
// }
|
|
50
|
-
|
|
51
|
-
setPickingColor(a_PickingColor);
|
|
52
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
attribute vec3 a_Position;
|
|
2
|
-
uniform mat4 u_ModelMatrix;
|
|
3
|
-
uniform mat4 u_Mvp;
|
|
4
|
-
|
|
5
|
-
#pragma include "projection"
|
|
6
|
-
|
|
7
|
-
void main() {
|
|
8
|
-
vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
|
|
9
|
-
|
|
10
|
-
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
11
|
-
gl_Position = u_Mvp * (vec4(project_pos.xy, 0.0, 1.0));
|
|
12
|
-
} else {
|
|
13
|
-
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
attribute vec4 a_Color;
|
|
2
|
-
attribute vec3 a_Position;
|
|
3
|
-
|
|
4
|
-
uniform mat4 u_ModelMatrix;
|
|
5
|
-
uniform mat4 u_Mvp;
|
|
6
|
-
|
|
7
|
-
#pragma include "projection"
|
|
8
|
-
|
|
9
|
-
varying vec4 v_color;
|
|
10
|
-
|
|
11
|
-
void main() {
|
|
12
|
-
v_color = a_Color;
|
|
13
|
-
|
|
14
|
-
vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
|
|
15
|
-
|
|
16
|
-
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
17
|
-
gl_Position = u_Mvp * (vec4(project_pos.xy, 0.0, 1.0));
|
|
18
|
-
} else {
|
|
19
|
-
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { IAttribute, IElements, IModel, IModelUniform } from '@antv/l7-core';
|
|
2
|
-
import BaseModel from '../../core/BaseModel';
|
|
3
|
-
export default class FillModel extends BaseModel {
|
|
4
|
-
getUninforms(): IModelUniform;
|
|
5
|
-
getAttribute(): {
|
|
6
|
-
attributes: {
|
|
7
|
-
[attributeName: string]: IAttribute;
|
|
8
|
-
};
|
|
9
|
-
elements: IElements;
|
|
10
|
-
};
|
|
11
|
-
initModels(): Promise<IModel[]>;
|
|
12
|
-
buildModels(): Promise<IModel[]>;
|
|
13
|
-
clearModels(): void;
|
|
14
|
-
protected registerBuiltinAttributes(): void;
|
|
15
|
-
}
|