@antv/l7-layers 2.12.2 → 2.13.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/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/line/models/line.d.ts +0 -1
- package/es/line/models/line.js +0 -9
- 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/line/models/line.js +0 -8
- 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
|
@@ -7,7 +7,6 @@ import TextModel from "../../point/models/text";
|
|
|
7
7
|
import ExtrudeModel from "./extrude";
|
|
8
8
|
import FillModel from "./fill";
|
|
9
9
|
import Ocean from "./ocean";
|
|
10
|
-
import TilePolygonModel from "./tile";
|
|
11
10
|
import Water from "./water";
|
|
12
11
|
var PolygonModels = {
|
|
13
12
|
fill: FillModel,
|
|
@@ -19,8 +18,7 @@ var PolygonModels = {
|
|
|
19
18
|
point_normal: NormalModel,
|
|
20
19
|
point_extrude: PointExtrudeModel,
|
|
21
20
|
water: Water,
|
|
22
|
-
ocean: Ocean,
|
|
23
|
-
|
|
24
|
-
tile: TilePolygonModel
|
|
21
|
+
ocean: Ocean // point_fill: PointModels.fill,
|
|
22
|
+
|
|
25
23
|
};
|
|
26
24
|
export default PolygonModels;
|
|
@@ -3,7 +3,6 @@ import BaseModel from '../../core/BaseModel';
|
|
|
3
3
|
export default class RasterModel extends BaseModel {
|
|
4
4
|
protected texture: ITexture2D;
|
|
5
5
|
protected colorTexture: ITexture2D;
|
|
6
|
-
private rampColors;
|
|
7
6
|
getUninforms(): {
|
|
8
7
|
u_opacity: number;
|
|
9
8
|
u_texture: ITexture2D;
|
|
@@ -18,5 +17,4 @@ export default class RasterModel extends BaseModel {
|
|
|
18
17
|
buildModels(): Promise<IModel[]>;
|
|
19
18
|
clearModels(): void;
|
|
20
19
|
protected registerBuiltinAttributes(): void;
|
|
21
|
-
private updateColorTexture;
|
|
22
20
|
}
|
|
@@ -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 {
|
|
14
|
+
import { getMask, 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 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";
|
|
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 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";
|
|
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";
|
|
@@ -44,15 +44,15 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
44
44
|
clampHigh = _ref$clampHigh === void 0 ? true : _ref$clampHigh,
|
|
45
45
|
_ref$noDataValue = _ref.noDataValue,
|
|
46
46
|
noDataValue = _ref$noDataValue === void 0 ? -9999999 : _ref$noDataValue,
|
|
47
|
-
|
|
48
|
-
domain = _ref$domain === void 0 ? [0, 1] : _ref$domain,
|
|
47
|
+
domain = _ref.domain,
|
|
49
48
|
rampColors = _ref.rampColors;
|
|
50
49
|
|
|
51
|
-
|
|
50
|
+
var newdomain = domain || getDefaultDomain(rampColors);
|
|
51
|
+
this.colorTexture = this.layer.textureService.getColorTexture(rampColors, newdomain);
|
|
52
52
|
return {
|
|
53
53
|
u_opacity: opacity || 1,
|
|
54
54
|
u_texture: this.texture,
|
|
55
|
-
u_domain:
|
|
55
|
+
u_domain: newdomain,
|
|
56
56
|
u_clampLow: clampLow,
|
|
57
57
|
u_clampHigh: typeof clampHigh !== 'undefined' ? clampHigh : clampLow,
|
|
58
58
|
u_noDataValue: noDataValue,
|
|
@@ -228,22 +228,6 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
228
228
|
}
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
|
-
}, {
|
|
232
|
-
key: "updateColorTexture",
|
|
233
|
-
value: function updateColorTexture() {
|
|
234
|
-
var createTexture2D = this.rendererService.createTexture2D;
|
|
235
|
-
|
|
236
|
-
var _ref3 = this.layer.getLayerConfig(),
|
|
237
|
-
rampColors = _ref3.rampColors;
|
|
238
|
-
|
|
239
|
-
var imageData = generateColorRamp(rampColors);
|
|
240
|
-
this.colorTexture = createTexture2D({
|
|
241
|
-
data: imageData.data,
|
|
242
|
-
width: imageData.width,
|
|
243
|
-
height: imageData.height,
|
|
244
|
-
flipY: false
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
231
|
}]);
|
|
248
232
|
|
|
249
233
|
return RasterModel;
|
|
@@ -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 { getMask } from '@antv/l7-utils';
|
|
14
|
+
import { getMask, getDefaultDomain } from '@antv/l7-utils';
|
|
15
15
|
import BaseModel from "../../core/BaseModel";
|
|
16
16
|
import { RasterImageTriangulation } from "../../core/triangulation";
|
|
17
17
|
|
|
@@ -43,23 +43,23 @@ var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
|
43
43
|
clampHigh = _ref$clampHigh === void 0 ? true : _ref$clampHigh,
|
|
44
44
|
_ref$noDataValue = _ref.noDataValue,
|
|
45
45
|
noDataValue = _ref$noDataValue === void 0 ? -9999999 : _ref$noDataValue,
|
|
46
|
-
|
|
47
|
-
domain = _ref$domain === void 0 ? [0, 1] : _ref$domain,
|
|
46
|
+
domain = _ref.domain,
|
|
48
47
|
rampColors = _ref.rampColors,
|
|
49
48
|
colorTexture = _ref.colorTexture;
|
|
50
49
|
|
|
50
|
+
var newdomain = domain || getDefaultDomain(rampColors);
|
|
51
51
|
var texture = colorTexture;
|
|
52
52
|
|
|
53
53
|
if (!colorTexture) {
|
|
54
|
-
texture = this.layer.textureService.getColorTexture(rampColors);
|
|
54
|
+
texture = this.layer.textureService.getColorTexture(rampColors, newdomain);
|
|
55
55
|
} else {
|
|
56
|
-
this.layer.textureService.setColorTexture(colorTexture, rampColors);
|
|
56
|
+
this.layer.textureService.setColorTexture(colorTexture, rampColors, newdomain);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
return {
|
|
60
60
|
u_opacity: opacity || 1,
|
|
61
61
|
u_texture: this.texture,
|
|
62
|
-
u_domain:
|
|
62
|
+
u_domain: newdomain,
|
|
63
63
|
u_clampLow: clampLow,
|
|
64
64
|
u_clampHigh: typeof clampHigh !== 'undefined' ? clampHigh : clampLow,
|
|
65
65
|
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;
|
|
@@ -13,7 +13,6 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
13
13
|
|
|
14
14
|
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; } }
|
|
15
15
|
|
|
16
|
-
// import RasterLayer from './layers/RasterDataLayer';
|
|
17
16
|
import RasterLayer from "../../raster";
|
|
18
17
|
import Tile from "./Tile";
|
|
19
18
|
|
|
@@ -15,6 +15,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
15
15
|
|
|
16
16
|
import RasterLayer from "../../raster";
|
|
17
17
|
import Tile from "./Tile";
|
|
18
|
+
import { getDefaultDomain } from '@antv/l7-utils';
|
|
18
19
|
var DEFAULT_COLOR_TEXTURE_OPTION = {
|
|
19
20
|
positions: [0, 1],
|
|
20
21
|
colors: ['#000', '#fff']
|
|
@@ -35,7 +36,8 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
|
|
|
35
36
|
key: "initTileLayer",
|
|
36
37
|
value: function () {
|
|
37
38
|
var _initTileLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
38
|
-
var attributes, layerOptions, sourceOptions, layer;
|
|
39
|
+
var attributes, layerOptions, sourceOptions, _ref, rampColors, domain, layer;
|
|
40
|
+
|
|
39
41
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
40
42
|
while (1) {
|
|
41
43
|
switch (_context.prev = _context.next) {
|
|
@@ -43,7 +45,8 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
|
|
|
43
45
|
attributes = this.parent.getLayerAttributeConfig();
|
|
44
46
|
layerOptions = this.getLayerOptions();
|
|
45
47
|
sourceOptions = this.getSourceOption();
|
|
46
|
-
|
|
48
|
+
_ref = this.getLayerOptions(), rampColors = _ref.rampColors, domain = _ref.domain;
|
|
49
|
+
this.colorTexture = this.parent.textureService.getColorTexture(rampColors, domain);
|
|
47
50
|
layer = new RasterLayer(_objectSpread(_objectSpread({}, layerOptions), {}, {
|
|
48
51
|
colorTexture: this.colorTexture
|
|
49
52
|
})).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
|
|
@@ -55,13 +58,13 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
|
|
|
55
58
|
|
|
56
59
|
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);
|
|
57
60
|
});
|
|
58
|
-
_context.next =
|
|
61
|
+
_context.next = 9;
|
|
59
62
|
return this.addLayer(layer);
|
|
60
63
|
|
|
61
|
-
case
|
|
64
|
+
case 9:
|
|
62
65
|
this.isLoaded = true;
|
|
63
66
|
|
|
64
|
-
case
|
|
67
|
+
case 10:
|
|
65
68
|
case "end":
|
|
66
69
|
return _context.stop();
|
|
67
70
|
}
|
|
@@ -109,9 +112,11 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
|
|
|
109
112
|
arg[_key] = arguments[_key];
|
|
110
113
|
}
|
|
111
114
|
|
|
112
|
-
var
|
|
113
|
-
rampColors =
|
|
114
|
-
|
|
115
|
+
var _ref2 = arg,
|
|
116
|
+
_ref2$rampColors = _ref2.rampColors,
|
|
117
|
+
rampColors = _ref2$rampColors === void 0 ? DEFAULT_COLOR_TEXTURE_OPTION : _ref2$rampColors,
|
|
118
|
+
domain = _ref2.domain;
|
|
119
|
+
this.colorTexture = this.parent.textureService.getColorTexture(rampColors, domain || getDefaultDomain(rampColors));
|
|
115
120
|
this.layers.forEach(function (layer) {
|
|
116
121
|
return layer.style({
|
|
117
122
|
colorTexture: _this.colorTexture
|
package/lib/core/BaseLayer.js
CHANGED
|
@@ -471,8 +471,8 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
471
471
|
}, {
|
|
472
472
|
key: "filter",
|
|
473
473
|
value: function filter(field, values, updateOptions) {
|
|
474
|
-
this.updateStyleAttribute('filter', field, values, updateOptions);
|
|
475
|
-
this.dataState.dataSourceNeedUpdate =
|
|
474
|
+
var flag = this.updateStyleAttribute('filter', field, values, updateOptions);
|
|
475
|
+
this.dataState.dataSourceNeedUpdate = flag;
|
|
476
476
|
return this;
|
|
477
477
|
}
|
|
478
478
|
}, {
|
|
@@ -482,9 +482,8 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
482
482
|
field: field,
|
|
483
483
|
values: values
|
|
484
484
|
};
|
|
485
|
-
this.updateStyleAttribute('shape', field, values, updateOptions);
|
|
486
|
-
this.dataState.dataSourceNeedUpdate =
|
|
487
|
-
|
|
485
|
+
var flag = this.updateStyleAttribute('shape', field, values, updateOptions);
|
|
486
|
+
this.dataState.dataSourceNeedUpdate = flag;
|
|
488
487
|
return this;
|
|
489
488
|
}
|
|
490
489
|
}, {
|
|
@@ -1439,7 +1438,17 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1439
1438
|
}, {
|
|
1440
1439
|
key: "updateStyleAttribute",
|
|
1441
1440
|
value: function updateStyleAttribute(type, field, values, updateOptions) {
|
|
1442
|
-
//
|
|
1441
|
+
// encode diff
|
|
1442
|
+
var preAttribute = this.configService.getAttributeConfig(this.id) || {}; // @ts-ignore
|
|
1443
|
+
|
|
1444
|
+
if ((0, _lodash.isEqual)(preAttribute[type], {
|
|
1445
|
+
field: field,
|
|
1446
|
+
values: values
|
|
1447
|
+
})) {
|
|
1448
|
+
return false;
|
|
1449
|
+
} // 存储 Attribute
|
|
1450
|
+
|
|
1451
|
+
|
|
1443
1452
|
if (['color', 'size', 'texture', 'rotate', 'filter', 'label', 'shape'].indexOf(type) !== -1) {
|
|
1444
1453
|
this.configService.setAttributeConfig(this.id, (0, _defineProperty2.default)({}, type, {
|
|
1445
1454
|
field: field,
|
|
@@ -1466,6 +1475,8 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1466
1475
|
}, // @ts-ignore
|
|
1467
1476
|
updateOptions);
|
|
1468
1477
|
}
|
|
1478
|
+
|
|
1479
|
+
return true;
|
|
1469
1480
|
}
|
|
1470
1481
|
}, {
|
|
1471
1482
|
key: "getLayerAttributeConfig",
|
|
@@ -25,14 +25,14 @@ var TextureService = /*#__PURE__*/function () {
|
|
|
25
25
|
|
|
26
26
|
(0, _createClass2.default)(TextureService, [{
|
|
27
27
|
key: "getColorTexture",
|
|
28
|
-
value: function getColorTexture(colorRamp) {
|
|
28
|
+
value: function getColorTexture(colorRamp, domain) {
|
|
29
29
|
// TODO 支持传入图片
|
|
30
|
-
var currentkey = this.getTextureKey(colorRamp);
|
|
30
|
+
var currentkey = this.getTextureKey(colorRamp, domain);
|
|
31
31
|
|
|
32
32
|
if (this.key === currentkey) {
|
|
33
33
|
return this.colorTexture;
|
|
34
34
|
} else {
|
|
35
|
-
this.createColorTexture(colorRamp);
|
|
35
|
+
this.createColorTexture(colorRamp, domain);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
this.key = currentkey;
|
|
@@ -40,9 +40,9 @@ var TextureService = /*#__PURE__*/function () {
|
|
|
40
40
|
}
|
|
41
41
|
}, {
|
|
42
42
|
key: "createColorTexture",
|
|
43
|
-
value: function createColorTexture(colorRamp) {
|
|
43
|
+
value: function createColorTexture(colorRamp, domain) {
|
|
44
44
|
var createTexture2D = this.rendererService.createTexture2D;
|
|
45
|
-
var imageData = (
|
|
45
|
+
var imageData = this.getColorRampBar(colorRamp, domain);
|
|
46
46
|
var texture = createTexture2D({
|
|
47
47
|
data: imageData.data,
|
|
48
48
|
width: imageData.width,
|
|
@@ -54,8 +54,8 @@ var TextureService = /*#__PURE__*/function () {
|
|
|
54
54
|
}
|
|
55
55
|
}, {
|
|
56
56
|
key: "setColorTexture",
|
|
57
|
-
value: function setColorTexture(texture, colorRamp) {
|
|
58
|
-
this.key = this.getTextureKey(colorRamp);
|
|
57
|
+
value: function setColorTexture(texture, colorRamp, domain) {
|
|
58
|
+
this.key = this.getTextureKey(colorRamp, domain);
|
|
59
59
|
this.colorTexture = texture;
|
|
60
60
|
}
|
|
61
61
|
}, {
|
|
@@ -65,10 +65,32 @@ var TextureService = /*#__PURE__*/function () {
|
|
|
65
65
|
|
|
66
66
|
(_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0 ? void 0 : _this$colorTexture.destroy();
|
|
67
67
|
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "getColorRampBar",
|
|
70
|
+
value: function getColorRampBar(colorRamp, domain) {
|
|
71
|
+
switch (colorRamp.type) {
|
|
72
|
+
case 'cat':
|
|
73
|
+
return (0, _l7Utils.generateCatRamp)(colorRamp);
|
|
74
|
+
|
|
75
|
+
case 'quantize':
|
|
76
|
+
return (0, _l7Utils.generateQuantizeRamp)(colorRamp);
|
|
77
|
+
|
|
78
|
+
case 'custom':
|
|
79
|
+
return (0, _l7Utils.generateCustomRamp)(colorRamp, domain);
|
|
80
|
+
|
|
81
|
+
case 'linear':
|
|
82
|
+
return (0, _l7Utils.generateLinearRamp)(colorRamp, domain);
|
|
83
|
+
|
|
84
|
+
default:
|
|
85
|
+
return (0, _l7Utils.generateColorRamp)(colorRamp);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
68
88
|
}, {
|
|
69
89
|
key: "getTextureKey",
|
|
70
|
-
value: function getTextureKey(colorRamp) {
|
|
71
|
-
|
|
90
|
+
value: function getTextureKey(colorRamp, domain) {
|
|
91
|
+
var _colorRamp$positions;
|
|
92
|
+
|
|
93
|
+
return "".concat(colorRamp.colors.join('_'), "_").concat(colorRamp === null || colorRamp === void 0 ? void 0 : (_colorRamp$positions = colorRamp.positions) === null || _colorRamp$positions === void 0 ? void 0 : _colorRamp$positions.join('_'), "_").concat(colorRamp.type, "_").concat(domain === null || domain === void 0 ? void 0 : domain.join('_'));
|
|
72
94
|
}
|
|
73
95
|
}]);
|
|
74
96
|
return TextureService;
|
package/lib/core/interface.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.lineStyleType = exports.TextureBlend = exports.LinearDir = exports.CanvasUpdateType = void 0;
|
|
6
|
+
exports.lineStyleType = exports.TextureBlend = exports.SizeUnitType = exports.LinearDir = exports.CanvasUpdateType = void 0;
|
|
7
7
|
var lineStyleType;
|
|
8
8
|
exports.lineStyleType = lineStyleType;
|
|
9
9
|
|
|
@@ -32,6 +32,14 @@ exports.TextureBlend = TextureBlend;
|
|
|
32
32
|
TextureBlend["REPLACE"] = "replace";
|
|
33
33
|
})(TextureBlend || (exports.TextureBlend = TextureBlend = {}));
|
|
34
34
|
|
|
35
|
+
var SizeUnitType;
|
|
36
|
+
exports.SizeUnitType = SizeUnitType;
|
|
37
|
+
|
|
38
|
+
(function (SizeUnitType) {
|
|
39
|
+
SizeUnitType[SizeUnitType["pixel"] = 0] = "pixel";
|
|
40
|
+
SizeUnitType[SizeUnitType["meter"] = 1] = "meter";
|
|
41
|
+
})(SizeUnitType || (exports.SizeUnitType = SizeUnitType = {}));
|
|
42
|
+
|
|
35
43
|
var CanvasUpdateType;
|
|
36
44
|
exports.CanvasUpdateType = CanvasUpdateType;
|
|
37
45
|
|
package/lib/line/models/index.js
CHANGED
|
@@ -23,8 +23,6 @@ var _linearline = _interopRequireDefault(require("./linearline"));
|
|
|
23
23
|
|
|
24
24
|
var _simpleLine = _interopRequireDefault(require("./simpleLine"));
|
|
25
25
|
|
|
26
|
-
var _tile = _interopRequireDefault(require("./tile"));
|
|
27
|
-
|
|
28
26
|
var _wall = _interopRequireDefault(require("./wall"));
|
|
29
27
|
|
|
30
28
|
var LineModels = {
|
|
@@ -36,7 +34,6 @@ var LineModels = {
|
|
|
36
34
|
halfLine: _half.default,
|
|
37
35
|
simple: _simpleLine.default,
|
|
38
36
|
linearline: _linearline.default,
|
|
39
|
-
tileLine: _tile.default,
|
|
40
37
|
earthArc3d: _earthArc_3d.default
|
|
41
38
|
};
|
|
42
39
|
var _default = LineModels;
|
package/lib/line/models/line.js
CHANGED
|
@@ -83,14 +83,6 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
83
83
|
width: 1,
|
|
84
84
|
height: 1
|
|
85
85
|
}));
|
|
86
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "dataTexture", _this.createTexture2D({
|
|
87
|
-
flipY: true,
|
|
88
|
-
data: [1],
|
|
89
|
-
format: _l7Core.gl.LUMINANCE,
|
|
90
|
-
type: _l7Core.gl.FLOAT,
|
|
91
|
-
width: 1,
|
|
92
|
-
height: 1
|
|
93
|
-
}));
|
|
94
86
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateTexture", function () {
|
|
95
87
|
var createTexture2D = _this.rendererService.createTexture2D;
|
|
96
88
|
|
|
@@ -84,14 +84,11 @@ var DataMappingPlugin = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inver
|
|
|
84
84
|
|
|
85
85
|
case 2:
|
|
86
86
|
layer.dataState.dataMappingNeedUpdate = false;
|
|
87
|
-
|
|
88
|
-
_this.generateMaping(layer, {
|
|
87
|
+
return _context2.abrupt("return", _this.generateMaping(layer, {
|
|
89
88
|
styleAttributeService: styleAttributeService
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
return _context2.abrupt("return", true);
|
|
89
|
+
}));
|
|
93
90
|
|
|
94
|
-
case
|
|
91
|
+
case 4:
|
|
95
92
|
case "end":
|
|
96
93
|
return _context2.stop();
|
|
97
94
|
}
|
|
@@ -163,9 +160,15 @@ var DataMappingPlugin = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inver
|
|
|
163
160
|
|
|
164
161
|
filterData = layer.processData(filterData);
|
|
165
162
|
var encodeData = this.mapping(layer, attributes, filterData, undefined);
|
|
166
|
-
layer.setEncodedData(encodeData);
|
|
163
|
+
layer.setEncodedData(encodeData);
|
|
164
|
+
|
|
165
|
+
if (dataArray.length === 0 && layer.encodeDataLength === 0) {
|
|
166
|
+
return false;
|
|
167
|
+
} // 对外暴露事件
|
|
168
|
+
|
|
167
169
|
|
|
168
170
|
layer.emit('dataUpdate', null);
|
|
171
|
+
return true;
|
|
169
172
|
}
|
|
170
173
|
}, {
|
|
171
174
|
key: "mapping",
|