directory to deploy when depending on features which use CSS, and make it clear how to override the CSS in OpenLayers, include <link rel> ags in all examples. (Closes #884) git-svn-id: http://svn.openlayers.org/trunk/openlayers@6145 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
60 lines
1.8 KiB
HTML
60 lines
1.8 KiB
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>MultiMap</title>
|
|
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
|
<style type="text/css">
|
|
#map {
|
|
width: 100%;
|
|
height: 512px;
|
|
border: 1px solid black;
|
|
}
|
|
</style>
|
|
|
|
|
|
<script type="text/javascript" src="http://clients.multimap.com/API/maps/1.1/metacarta_04"></script>
|
|
|
|
|
|
<script src="../lib/OpenLayers.js"></script>
|
|
<script type="text/javascript">
|
|
var lon = 5;
|
|
var lat = 40;
|
|
var zoom = 5;
|
|
var map, mmlayer, layer;
|
|
|
|
function init(){
|
|
map = new OpenLayers.Map( 'map' ,
|
|
{controls:[new OpenLayers.Control.MouseDefaults()]});
|
|
|
|
mmlayer = new OpenLayers.Layer.MultiMap( "MultiMap");
|
|
map.addLayer(mmlayer);
|
|
|
|
markers = new OpenLayers.Layer.Markers("markers");
|
|
map.addLayer(markers);
|
|
|
|
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
|
|
map.addControl( new OpenLayers.Control.LayerSwitcher() );
|
|
map.addControl( new OpenLayers.Control.PanZoomBar() );
|
|
}
|
|
|
|
function add() {
|
|
|
|
marker = new OpenLayers.Marker(new OpenLayers.LonLat(2, 41));
|
|
markers.addMarker(marker);
|
|
}
|
|
|
|
function remove() {
|
|
markers.removeMarker(marker);
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload="init()">
|
|
<h1 id="title">MultiMap Example</h1>
|
|
<p id="shortdesc">
|
|
An example of using the Layer.MultiMap class.
|
|
</p>
|
|
<div id="map"></div>
|
|
<div style="background-color:green" onclick="add()"> click to add the marker to the map</div>
|
|
<div style="background-color:red" onclick="remove()"> click to remove the marker from the map</div>
|
|
</body>
|
|
</html>
|