diff --git a/controller/tileservers.php b/controller/tileservers.php index 9b31997..5247f70 100644 --- a/controller/tileservers.php +++ b/controller/tileservers.php @@ -7,7 +7,9 @@ $baseTileServers = [ // 'url' => '', // 'attribution' => '', // 'minzoom' => '', - // 'maxzoom' => '' + // 'maxzoom' => '', + // 'opacity' => '0-1', + // 'transparent' => 'true|false' //), //Array( // 'name' => 'tilewms', @@ -135,7 +137,9 @@ $baseTileServers = [ 'url' => 'http://{s}.tile.openstreetmap.fr/route500/{z}/{x}/{y}.png', 'attribution' => '©, Tiles © OpenStreetMap France', 'minzoom' => '1', - 'maxzoom' => '20' + 'maxzoom' => '20', + 'transparent' => 'true', + 'opacity' => '0.5' ), ]; ?> diff --git a/js/gpxedit.js b/js/gpxedit.js index 79b8b04..b161e90 100644 --- a/js/gpxedit.js +++ b/js/gpxedit.js @@ -207,7 +207,15 @@ var minz = parseInt($(this).attr('minzoom')); var maxz = parseInt($(this).attr('maxzoom')); var sattrib = $(this).attr('attribution'); - baseLayers[sname] = new L.TileLayer(surl, {minZoom: minz, maxZoom: maxz, attribution: sattrib}); + var stransparent = ($(this).attr('transparent') === 'true'); + var sopacity = $(this).attr('opacity'); + if (sopacity !== '') { + sopacity = parseFloat(sopacity); + } + else { + sopacity = 1; + } + baseLayers[sname] = new L.TileLayer(surl, {minZoom: minz, maxZoom: maxz, attribution: sattrib, opacity: sopacity, transparent: stransparent}); }); $('#basetileservers li[type=tilewms]').each(function() { var sname = $(this).attr('name'); @@ -216,7 +224,13 @@ var sversion = $(this).attr('version') || '1.1.1'; var stransparent = ($(this).attr('transparent') === 'true'); var sformat = $(this).attr('format') || 'image/png'; - var sopacity = $(this).attr('opacity') || 1; + var sopacity = $(this).attr('opacity'); + if (sopacity !== '') { + sopacity = parseFloat(sopacity); + } + else { + sopacity = 1; + } var sattrib = $(this).attr('attribution') || ''; baseLayers[sname] = new L.tileLayer.wms(surl, {layers: slayers, version: sversion, transparent: stransparent, opacity: sopacity, format: sformat, attribution: sattrib}); }); @@ -238,7 +252,15 @@ var minz = parseInt($(this).attr('minzoom')); var maxz = parseInt($(this).attr('maxzoom')); var sattrib = $(this).attr('attribution'); - baseOverlays[sname] = new L.TileLayer(surl, {minZoom: minz, maxZoom: maxz, attribution: sattrib}); + var stransparent = ($(this).attr('transparent') === 'true'); + var sopacity = $(this).attr('opacity'); + if (sopacity !== '') { + sopacity = parseFloat(sopacity); + } + else { + sopacity = 1; + } + baseOverlays[sname] = new L.TileLayer(surl, {minZoom: minz, maxZoom: maxz, attribution: sattrib, opacity: sopacity, transparent: stransparent}); }); $('#basetileservers li[type=overlaywms]').each(function() { var sname = $(this).attr('name'); @@ -247,7 +269,13 @@ var sversion = $(this).attr('version') || '1.1.1'; var stransparent = ($(this).attr('transparent') === 'true'); var sformat = $(this).attr('format') || 'image/png'; - var sopacity = $(this).attr('opacity') || 1; + var sopacity = $(this).attr('opacity'); + if (sopacity !== '') { + sopacity = parseFloat(sopacity); + } + else { + sopacity = 1; + } var sattrib = $(this).attr('attribution') || ''; baseOverlays[sname] = new L.tileLayer.wms(surl, {layers: slayers, version: sversion, transparent: stransparent, opacity: sopacity, format: sformat, attribution: sattrib}); }); diff --git a/templates/gpxcontent.php b/templates/gpxcontent.php index 575f9b7..73fb43d 100644 --- a/templates/gpxcontent.php +++ b/templates/gpxcontent.php @@ -81,29 +81,15 @@ foreach($_['extrasymbols'] as $symbol){ echo ''."\n"; echo ''."\n";