examples for #1901
git-svn-id: http://svn.openlayers.org/trunk/openlayers@9069 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -0,0 +1,42 @@
|
|||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<title>OpenLayers Late Rendering Example</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, layer;
|
||||||
|
function init(){
|
||||||
|
map = new OpenLayers.Map();
|
||||||
|
layer = new OpenLayers.Layer.WMS(
|
||||||
|
"OpenLayers WMS",
|
||||||
|
"http://labs.metacarta.com/wms/vmap0",
|
||||||
|
{layers: 'basic'}
|
||||||
|
);
|
||||||
|
map.addLayer(layer);
|
||||||
|
map.render("container_id");
|
||||||
|
map.zoomTo(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body onload="init()">
|
||||||
|
<h1 id="title">Late Rendering</h1>
|
||||||
|
|
||||||
|
<div id="tags"></div>
|
||||||
|
|
||||||
|
<p id="shortdesc">
|
||||||
|
Demonstrates how a map can be rendered to an empty container after
|
||||||
|
construction by calling the render method.
|
||||||
|
</p>
|
||||||
|
<div id="container_id" class="smallmap"></div>
|
||||||
|
<div id="docs">
|
||||||
|
In cases where you need to create a map first and render it to some
|
||||||
|
container later, call the map constructor without a "div" argument.
|
||||||
|
In this case, you can provide the options object as the first argument.
|
||||||
|
To render your map to some container after construction, call the map's
|
||||||
|
render method with the container id.
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<title>OpenLayers Teleporter Example</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>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
#wrapper {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.spot1 {
|
||||||
|
width: 250px;
|
||||||
|
}
|
||||||
|
.spot2 {
|
||||||
|
width: 300px;
|
||||||
|
position: absolute;
|
||||||
|
left: 300px;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
var map, layer, spot=1;
|
||||||
|
function init(){
|
||||||
|
map = new OpenLayers.Map({
|
||||||
|
div: "spot1"
|
||||||
|
});
|
||||||
|
map.addControl(new OpenLayers.Control.OverviewMap());
|
||||||
|
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||||
|
"http://labs.metacarta.com/wms/vmap0",
|
||||||
|
{layers: 'basic'} );
|
||||||
|
map.addLayer(layer);
|
||||||
|
map.zoomTo(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
function teleport() {
|
||||||
|
if (spot == 1) {
|
||||||
|
spot = 2;
|
||||||
|
} else {
|
||||||
|
spot = 1;
|
||||||
|
}
|
||||||
|
map.render("spot" + spot);
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body onload="init()">
|
||||||
|
<h1 id="title">Map "Teleportation" and Rendering</h1>
|
||||||
|
|
||||||
|
<div id="tags"></div>
|
||||||
|
|
||||||
|
<p id="shortdesc">Call the map's render method to change its container.</p>
|
||||||
|
|
||||||
|
<div id="wrapper">
|
||||||
|
<div id="spot1" class="smallmap spot1"></div>
|
||||||
|
<div id="spot2" class="smallmap spot2"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="button" onclick="teleport()" value="Teleport!"></input>
|
||||||
|
|
||||||
|
<div id="docs">
|
||||||
|
This example demonstrates how a map can be rendered initially in one
|
||||||
|
container and then moved to a new container. At any point after map
|
||||||
|
construction, the map's render method can be called with the id of
|
||||||
|
an empty container, moving the map to the new container.
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user