Updated single tile example.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10883 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2010-11-10 18:23:58 +00:00
parent 851681cca1
commit 8e9087344d
3 changed files with 50 additions and 42 deletions

View File

@@ -1,42 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OpenLayers: Single Tile</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
<link rel="stylesheet" href="style.css" type="text/css" />
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
var map;
function init(){
map = new OpenLayers.Map('mapDiv', {maxResolution: 'auto'});
var old_ol_wms = new OpenLayers.Layer.WMS.Untiled( "WMS.Untiled",
"http://vmap0.tiles.osgeo.org/wms/vmap0?", {layers: 'basic'} );
old_ol_wms.addOptions({isBaseLayer: true});
var new_ol_wms = new OpenLayers.Layer.WMS( "WMS w/singleTile",
"http://vmap0.tiles.osgeo.org/wms/vmap0?", {layers: 'basic'},
{ singleTile: true, ratio: 1 } );
new_ol_wms.addOptions({isBaseLayer: true});
map.addLayers([old_ol_wms, new_ol_wms]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.setCenter(new OpenLayers.LonLat(6.5, 40.5), 4);
}
</script>
</head>
<body onload="init()">
<h1 id="title">Untiled Example</h1>
<div id="tags">
tile, ratio, singleTile, performance
</div>
<p id="shortdesc">
Create an untiled WMS layer using the singleTile: true, option or the deprecated
WMS.Untiled layer.
</p>
<div id="mapDiv" class="smallmap"></div>
<p> The first layer is an old OpenLayers.Layer.WMS.Untiled layer, using
a default ratio value of 1.5.
<p> The second layer is an OpenLayers.Layer.WMS layer with singleTile set
to true, and with a ratio of 1.
</body>
</html>

30
examples/single-tile.html Normal file
View File

@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<title>OpenLayers: Single Tile</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<h1 id="title">Single Tile Example</h1>
<div id="tags">tile, ratio, singleTile, performance</div>
<p id="shortdesc">
Use the singleTile option on gridded layers to request a single tile.
</p>
<div id="mapDiv" class="smallmap"></div>
<div id="docs">
<p>
This map demonstrates the use of the singleTile property as an
alternative to the default tiled behavior of layers. The first
layer in the map is a WMS layer with the singleTile option set
true. The second layer is a WMS layer with the default options.
</p>
<p>
View the <a href="single-tile.js" target="_blank">single-tile.js</a>
source to see how this is done.
</p>
</div>
<script src="../lib/OpenLayers.js"></script>
<script src="single-tile.js"></script>
</body>
</html>

20
examples/single-tile.js Normal file
View File

@@ -0,0 +1,20 @@
var map = new OpenLayers.Map({
div: "mapDiv",
layers: [
new OpenLayers.Layer.WMS(
"Single Tile",
"http://vmap0.tiles.osgeo.org/wms/vmap0",
{layers: "basic"},
{singleTile: true, ratio: 1}
),
new OpenLayers.Layer.WMS(
"Multiple Tiles",
"http://vmap0.tiles.osgeo.org/wms/vmap0",
{layers: "basic"}
)
],
center: new OpenLayers.LonLat(6.5, 40.5),
zoom: 4
});
map.addControl(new OpenLayers.Control.LayerSwitcher());