From 30cacef7e1cf12286579ecc52d7800332cecef66 Mon Sep 17 00:00:00 2001 From: Oliver Heilig Date: Sun, 21 Apr 2024 18:36:36 +0200 Subject: [PATCH 1/4] Update token.js --- SharpMap.Web/token.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharpMap.Web/token.js b/SharpMap.Web/token.js index 939ca79..870df9d 100644 --- a/SharpMap.Web/token.js +++ b/SharpMap.Web/token.js @@ -1,3 +1,3 @@ // this is a time-limited demo token. // You need your own xServer-internet token for your application! -var token = 'CD71BDAA-681B-4438-B8A8-6DE9DE7F11C2'; \ No newline at end of file +var token = 'D00DA08-6381-4E1E-8913-0243D445D6E0'; From 2904c37ac8b04ca387896136b45b6e2ec8893c8d Mon Sep 17 00:00:00 2001 From: Oliver Heilig Date: Sun, 21 Apr 2024 19:00:53 +0200 Subject: [PATCH 2/4] Update token.js --- SharpMap.Web/token.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharpMap.Web/token.js b/SharpMap.Web/token.js index 870df9d..b50357f 100644 --- a/SharpMap.Web/token.js +++ b/SharpMap.Web/token.js @@ -1,3 +1,3 @@ // this is a time-limited demo token. // You need your own xServer-internet token for your application! -var token = 'D00DA08-6381-4E1E-8913-0243D445D6E0'; +var token = '1D00DA08-6381-4E1E-8913-0243D445D6E0'; From a34e4a48cb8ec1036e5bdc96614984806fb26b2d Mon Sep 17 00:00:00 2001 From: PersonalAccessToken Date: Sun, 21 Apr 2024 21:07:04 +0200 Subject: [PATCH 3/4] Fix VirtualLayer --- SharpMap.Web/VirtualLayer.js | 13 ++++--------- SharpMap.Web/index.html | 7 +++---- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/SharpMap.Web/VirtualLayer.js b/SharpMap.Web/VirtualLayer.js index 102db12..254e3d7 100644 --- a/SharpMap.Web/VirtualLayer.js +++ b/SharpMap.Web/VirtualLayer.js @@ -2,7 +2,6 @@ * L.VirtualLayer */ L.VirtualLayer = L.Layer.extend({ - includes: L.Mixin.Events, options: { attribution: '', minZoom: 0, @@ -24,11 +23,6 @@ L.VirtualLayer = L.Layer.extend({ L.setOptions(this, options); }, - addTo: function (map) { - map.addLayer(this); - return this; - }, - onAdd: function (map) { this._map = map; this.hostLayer.virtualLayers[this.name] = true; @@ -59,12 +53,13 @@ L.VirtualLayer = L.Layer.extend({ if (this.hostLayer.wmsParams) this.hostLayer.wmsParams.layers = visibileLayers.join(','); else { - this.hostLayer._url = this.hostLayer._url.substring(0, this.hostLayer._url.indexOf("&layers=")); - this.hostLayer._url = this.hostLayer._url + '&layers=' + visibileLayers.join(','); + var url = this.hostLayer._url = this.hostLayer._url.substring(0, this.hostLayer._url.indexOf("&layers=")); + url = this.hostLayer._url + '&layers=' + visibileLayers.join(','); + this.hostLayer.setUrl(url); } if (visibileLayers.length == 0) - map.removeLayer(this.hostLayer); + map.removeLayer(this.hostLayer, false); else { map.addLayer(this.hostLayer); this.hostLayer.redraw(); diff --git a/SharpMap.Web/index.html b/SharpMap.Web/index.html index 2321cd9..d93291c 100644 --- a/SharpMap.Web/index.html +++ b/SharpMap.Web/index.html @@ -23,7 +23,6 @@
- @@ -68,12 +67,12 @@ // add dymamic tile layer var myTileLayerUrl = 'SharpMapTilesHandler.ashx?x={x}&y={y}&z={z}&layers=', - sharpMapTileLayer = new L.TileLayer(myTileLayerUrl, { + sharpMapTileLayer = L.tileLayer(myTileLayerUrl, { maxZoom: 19, minZoom: 0, zIndex: 100 }); // add dynamic overlay layer - var sharpMapOverlayLayer = new L.NonTiledLayer.WMS('SharpMapOverlayHandler.ashx', { + var sharpMapOverlayLayer = L.nonTiledLayer.wms('SharpMapOverlayHandler.ashx', { zIndex: 1, minZoom: 0, maxZoom: 19, opacity: 1.0, @@ -186,7 +185,7 @@ subdomains: '1234' }); - var foreground = new L.NonTiledLayer.WMS(url + '?xtok=' + token, { + var foreground = L.nonTiledLayer.wms(url + '?xtok=' + token, { zIndex: 0, minZoom: 0, maxZoom:19, opacity: 1.0, From 4cd58d73cee930fc4fabf133f67234b7034f6949 Mon Sep 17 00:00:00 2001 From: PersonalAccessToken Date: Sun, 21 Apr 2024 21:31:30 +0200 Subject: [PATCH 4/4] Fix VirtualLayer --- SharpMap.Web/VirtualLayer.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/SharpMap.Web/VirtualLayer.js b/SharpMap.Web/VirtualLayer.js index 254e3d7..b4f2830 100644 --- a/SharpMap.Web/VirtualLayer.js +++ b/SharpMap.Web/VirtualLayer.js @@ -50,6 +50,8 @@ L.VirtualLayer = L.Layer.extend({ if (this.hostLayer.virtualLayers[key]) visibileLayers.push(key); + map.removeLayer(this.hostLayer); + if (this.hostLayer.wmsParams) this.hostLayer.wmsParams.layers = visibileLayers.join(','); else { @@ -58,12 +60,8 @@ L.VirtualLayer = L.Layer.extend({ this.hostLayer.setUrl(url); } - if (visibileLayers.length == 0) - map.removeLayer(this.hostLayer, false); - else { + if (visibileLayers.length > 0) map.addLayer(this.hostLayer); - this.hostLayer.redraw(); - } return this; }