refs #22 support transparent and opacity fields for all tile server types in tileservers.php
parent
17effd1d77
commit
8fbb3c9fc7
|
@ -7,7 +7,9 @@ $baseTileServers = [
|
||||||
// 'url' => '',
|
// 'url' => '',
|
||||||
// 'attribution' => '',
|
// 'attribution' => '',
|
||||||
// 'minzoom' => '',
|
// 'minzoom' => '',
|
||||||
// 'maxzoom' => ''
|
// 'maxzoom' => '',
|
||||||
|
// 'opacity' => '0-1',
|
||||||
|
// 'transparent' => 'true|false'
|
||||||
//),
|
//),
|
||||||
//Array(
|
//Array(
|
||||||
// 'name' => 'tilewms',
|
// 'name' => 'tilewms',
|
||||||
|
@ -135,7 +137,9 @@ $baseTileServers = [
|
||||||
'url' => 'http://{s}.tile.openstreetmap.fr/route500/{z}/{x}/{y}.png',
|
'url' => 'http://{s}.tile.openstreetmap.fr/route500/{z}/{x}/{y}.png',
|
||||||
'attribution' => '©, Tiles © <a href="http://www.openstreetmap.fr">OpenStreetMap France</a>',
|
'attribution' => '©, Tiles © <a href="http://www.openstreetmap.fr">OpenStreetMap France</a>',
|
||||||
'minzoom' => '1',
|
'minzoom' => '1',
|
||||||
'maxzoom' => '20'
|
'maxzoom' => '20',
|
||||||
|
'transparent' => 'true',
|
||||||
|
'opacity' => '0.5'
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -207,7 +207,15 @@
|
||||||
var minz = parseInt($(this).attr('minzoom'));
|
var minz = parseInt($(this).attr('minzoom'));
|
||||||
var maxz = parseInt($(this).attr('maxzoom'));
|
var maxz = parseInt($(this).attr('maxzoom'));
|
||||||
var sattrib = $(this).attr('attribution');
|
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() {
|
$('#basetileservers li[type=tilewms]').each(function() {
|
||||||
var sname = $(this).attr('name');
|
var sname = $(this).attr('name');
|
||||||
|
@ -216,7 +224,13 @@
|
||||||
var sversion = $(this).attr('version') || '1.1.1';
|
var sversion = $(this).attr('version') || '1.1.1';
|
||||||
var stransparent = ($(this).attr('transparent') === 'true');
|
var stransparent = ($(this).attr('transparent') === 'true');
|
||||||
var sformat = $(this).attr('format') || 'image/png';
|
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') || '';
|
var sattrib = $(this).attr('attribution') || '';
|
||||||
baseLayers[sname] = new L.tileLayer.wms(surl, {layers: slayers, version: sversion, transparent: stransparent, opacity: sopacity, format: sformat, attribution: sattrib});
|
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 minz = parseInt($(this).attr('minzoom'));
|
||||||
var maxz = parseInt($(this).attr('maxzoom'));
|
var maxz = parseInt($(this).attr('maxzoom'));
|
||||||
var sattrib = $(this).attr('attribution');
|
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() {
|
$('#basetileservers li[type=overlaywms]').each(function() {
|
||||||
var sname = $(this).attr('name');
|
var sname = $(this).attr('name');
|
||||||
|
@ -247,7 +269,13 @@
|
||||||
var sversion = $(this).attr('version') || '1.1.1';
|
var sversion = $(this).attr('version') || '1.1.1';
|
||||||
var stransparent = ($(this).attr('transparent') === 'true');
|
var stransparent = ($(this).attr('transparent') === 'true');
|
||||||
var sformat = $(this).attr('format') || 'image/png';
|
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') || '';
|
var sattrib = $(this).attr('attribution') || '';
|
||||||
baseOverlays[sname] = new L.tileLayer.wms(surl, {layers: slayers, version: sversion, transparent: stransparent, opacity: sopacity, format: sformat, attribution: sattrib});
|
baseOverlays[sname] = new L.tileLayer.wms(surl, {layers: slayers, version: sversion, transparent: stransparent, opacity: sopacity, format: sformat, attribution: sattrib});
|
||||||
});
|
});
|
||||||
|
|
|
@ -81,29 +81,15 @@ foreach($_['extrasymbols'] as $symbol){
|
||||||
echo '</ul>'."\n";
|
echo '</ul>'."\n";
|
||||||
echo '<ul id="basetileservers" style="display:none">';
|
echo '<ul id="basetileservers" style="display:none">';
|
||||||
foreach($_['basetileservers'] as $ts){
|
foreach($_['basetileservers'] as $ts){
|
||||||
echo '<li name="';
|
echo '<li';
|
||||||
p($ts['name']);
|
foreach (Array('name', 'type', 'url', 'layers', 'version', 'format', 'opacity', 'transparent', 'minzoom', 'maxzoom', 'attribution') as $field) {
|
||||||
echo '" type="';
|
if (array_key_exists($field, $ts)) {
|
||||||
p($ts['type']);
|
echo ' '.$field.'="';
|
||||||
echo '" url="';
|
p($ts[$field]);
|
||||||
p($ts['url']);
|
echo '"';
|
||||||
echo '" layers="';
|
}
|
||||||
p($ts['layers']);
|
}
|
||||||
echo '" version="';
|
echo '></li>';
|
||||||
p($ts['version']);
|
|
||||||
echo '" format="';
|
|
||||||
p($ts['format']);
|
|
||||||
echo '" opacity="';
|
|
||||||
p($ts['opacity']);
|
|
||||||
echo '" transparent="';
|
|
||||||
p($ts['transparent']);
|
|
||||||
echo '" minzoom="';
|
|
||||||
p($ts['minzoom']);
|
|
||||||
echo '" maxzoom="';
|
|
||||||
p($ts['maxzoom']);
|
|
||||||
echo '" attribution="';
|
|
||||||
p($ts['attribution']);
|
|
||||||
echo '"></li>';
|
|
||||||
}
|
}
|
||||||
echo '</ul>'."\n";
|
echo '</ul>'."\n";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue