@antv/l7-layers 2.9.28 → 2.9.30

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.
@@ -1379,6 +1379,10 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1379
1379
  }, {
1380
1380
  key: "dispatchModelLoad",
1381
1381
  value: function dispatchModelLoad(models) {
1382
+ this.models.forEach(function (model) {
1383
+ return model.destroy();
1384
+ });
1385
+ this.models = [];
1382
1386
  this.models = models;
1383
1387
  this.emit('modelLoaded', null);
1384
1388
  this.modelLoaded = true;
@@ -26,9 +26,12 @@ var LayerModelPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
26
26
  }, {
27
27
  key: "prepareLayerModel",
28
28
  value: function prepareLayerModel(layer) {
29
+ var _layer$layerModel;
30
+
29
31
  // 更新Model 配置项
30
- layer.prepareBuildModel();
31
- layer.clearModels(); // 初始化 Model
32
+ layer.prepareBuildModel(); // clear layerModel resource
33
+
34
+ (_layer$layerModel = layer.layerModel) === null || _layer$layerModel === void 0 ? void 0 : _layer$layerModel.clearModels(); // 初始化 Model
32
35
 
33
36
  layer.buildModels();
34
37
  layer.layerModelNeedUpdate = false;
@@ -15,7 +15,7 @@ import BaseModel from "../../core/BaseModel";
15
15
  import { RasterImageTriangulation } from "../../core/triangulation";
16
16
 
17
17
  /* babel-plugin-inline-import '../shaders/raster_2d_frag.glsl' */
18
- 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;\n\nvoid main() {\n\n float value = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y)).r;\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);\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";
18
+ 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;\n\n\n\n// float getBlurIndusty() {\n// vec2 u_ViewportSize = vec2(1024);\n\n// float vW = 2.0/u_ViewportSize.x;\n// float vH = 2.0/u_ViewportSize.y;\n// vec2 vUv = v_texCoord;\n// float i11 = texture2D( u_texture, vec2( vUv.x - 1.0 * vW, vUv.y + 1.0 * vH) ).r;\n// float i12 = texture2D( u_texture, vec2( vUv.x - 0.0 * vW, vUv.y + 1.0 * vH) ).r;\n// float i13 = texture2D( u_texture, vec2( vUv.x + 1.0 * vW, vUv.y + 1.0 * vH) ).r;\n\n// float i21 = texture2D( u_texture, vec2( vUv.x - 1.0 * vW, vUv.y) ).r;\n// float i22 = texture2D( u_texture, vec2( vUv.x , vUv.y) ).r;\n// float i23 = texture2D( u_texture, vec2( vUv.x + 1.0 * vW, vUv.y) ).r;\n\n// float i31 = texture2D( u_texture, vec2( vUv.x - 1.0 * vW, vUv.y-1.0*vH) ).r;\n// float i32 = texture2D( u_texture, vec2( vUv.x - 0.0 * vW, vUv.y-1.0*vH) ).r;\n// float i33 = texture2D( u_texture, vec2( vUv.x + 1.0 * vW, vUv.y-1.0*vH) ).r;\n\n// return(\n// i11 + \n// i12 + \n// i13 + \n// i21 + \n// i21 + \n// i22 + \n// i23 + \n// i31 + \n// i32 + \n// i33\n// )/9.0;\n// }\n\nvoid main() {\n\n float value = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y)).r;\n\n // float value = getBlurIndusty();\n\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);\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
19
 
20
20
  /* babel-plugin-inline-import '../shaders/raster_2d_vert.glsl' */
21
21
  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";
@@ -1375,6 +1375,10 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1375
1375
  }, {
1376
1376
  key: "dispatchModelLoad",
1377
1377
  value: function dispatchModelLoad(models) {
1378
+ this.models.forEach(function (model) {
1379
+ return model.destroy();
1380
+ });
1381
+ this.models = [];
1378
1382
  this.models = models;
1379
1383
  this.emit('modelLoaded', null);
1380
1384
  this.modelLoaded = true;
@@ -38,9 +38,12 @@ _dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
38
38
  }, {
39
39
  key: "prepareLayerModel",
40
40
  value: function prepareLayerModel(layer) {
41
+ var _layer$layerModel;
42
+
41
43
  // 更新Model 配置项
42
- layer.prepareBuildModel();
43
- layer.clearModels(); // 初始化 Model
44
+ layer.prepareBuildModel(); // clear layerModel resource
45
+
46
+ (_layer$layerModel = layer.layerModel) === null || _layer$layerModel === void 0 ? void 0 : _layer$layerModel.clearModels(); // 初始化 Model
44
47
 
45
48
  layer.buildModels();
46
49
  layer.layerModelNeedUpdate = false;
@@ -32,7 +32,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
32
32
  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; } }
33
33
 
34
34
  /* babel-plugin-inline-import '../shaders/raster_2d_frag.glsl' */
35
- 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;\n\nvoid main() {\n\n float value = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y)).r;\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);\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";
35
+ 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;\n\n\n\n// float getBlurIndusty() {\n// vec2 u_ViewportSize = vec2(1024);\n\n// float vW = 2.0/u_ViewportSize.x;\n// float vH = 2.0/u_ViewportSize.y;\n// vec2 vUv = v_texCoord;\n// float i11 = texture2D( u_texture, vec2( vUv.x - 1.0 * vW, vUv.y + 1.0 * vH) ).r;\n// float i12 = texture2D( u_texture, vec2( vUv.x - 0.0 * vW, vUv.y + 1.0 * vH) ).r;\n// float i13 = texture2D( u_texture, vec2( vUv.x + 1.0 * vW, vUv.y + 1.0 * vH) ).r;\n\n// float i21 = texture2D( u_texture, vec2( vUv.x - 1.0 * vW, vUv.y) ).r;\n// float i22 = texture2D( u_texture, vec2( vUv.x , vUv.y) ).r;\n// float i23 = texture2D( u_texture, vec2( vUv.x + 1.0 * vW, vUv.y) ).r;\n\n// float i31 = texture2D( u_texture, vec2( vUv.x - 1.0 * vW, vUv.y-1.0*vH) ).r;\n// float i32 = texture2D( u_texture, vec2( vUv.x - 0.0 * vW, vUv.y-1.0*vH) ).r;\n// float i33 = texture2D( u_texture, vec2( vUv.x + 1.0 * vW, vUv.y-1.0*vH) ).r;\n\n// return(\n// i11 + \n// i12 + \n// i13 + \n// i21 + \n// i21 + \n// i22 + \n// i23 + \n// i31 + \n// i32 + \n// i33\n// )/9.0;\n// }\n\nvoid main() {\n\n float value = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y)).r;\n\n // float value = getBlurIndusty();\n\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);\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";
36
36
 
37
37
  /* babel-plugin-inline-import '../shaders/raster_2d_vert.glsl' */
38
38
  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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-layers",
3
- "version": "2.9.28",
3
+ "version": "2.9.30",
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.2",
30
- "@antv/l7-core": "2.9.28",
31
- "@antv/l7-maps": "2.9.28",
32
- "@antv/l7-source": "2.9.28",
33
- "@antv/l7-utils": "2.9.28",
30
+ "@antv/l7-core": "2.9.30",
31
+ "@antv/l7-maps": "2.9.30",
32
+ "@antv/l7-source": "2.9.30",
33
+ "@antv/l7-utils": "2.9.30",
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": "bdf2c35d3b632882bf5a8fdd4bd58acfb14b2a97",
64
+ "gitHead": "cdef18f8d243d40c10eedc456a36f89bef0b3a4e",
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  }