100 lines
3.5 KiB
HTML
100 lines
3.5 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
<title>OpenLayers: Control Panel</title>
|
|
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
|
|
<link rel="stylesheet" href="style.css" type="text/css">
|
|
<style type="text/css">
|
|
.olControlPanel div {
|
|
display:block;
|
|
width: 24px;
|
|
height: 24px;
|
|
margin: 5px;
|
|
background-color:white;
|
|
}
|
|
|
|
.olControlPanel .olControlDrawFeatureItemActive {
|
|
width: 22px;
|
|
height: 22px;
|
|
background-image: url("../theme/default/img/draw_line_on.png");
|
|
}
|
|
.olControlPanel .olControlDrawFeatureItemInactive {
|
|
width: 22px;
|
|
height: 22px;
|
|
background-image: url("../theme/default/img/draw_line_off.png");
|
|
}
|
|
.olControlPanel .olControlZoomBoxItemInactive {
|
|
width: 22px;
|
|
height: 22px;
|
|
background-color: orange;
|
|
background-image: url("../img/drag-rectangle-off.png");
|
|
}
|
|
.olControlPanel .olControlZoomBoxItemActive {
|
|
width: 22px;
|
|
height: 22px;
|
|
background-color: blue;
|
|
background-image: url("../img/drag-rectangle-on.png");
|
|
}
|
|
.olControlPanel .olControlZoomToMaxExtentItemInactive {
|
|
width: 18px;
|
|
height: 18px;
|
|
background-image: url("../img/zoom-world-mini.png");
|
|
}
|
|
|
|
</style>
|
|
<script src="../lib/Firebug/firebug.js"></script>
|
|
<script src="../lib/OpenLayers.js"></script>
|
|
<script type="text/javascript">
|
|
var lon = 5;
|
|
var lat = 40;
|
|
var zoom = 5;
|
|
var map, layer;
|
|
|
|
function init(){
|
|
map = new OpenLayers.Map( 'map', { controls: [] } );
|
|
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
|
"http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'} );
|
|
map.addLayer(layer);
|
|
|
|
vlayer = new OpenLayers.Layer.Vector( "Editable" );
|
|
map.addLayer(vlayer);
|
|
|
|
|
|
zb = new OpenLayers.Control.ZoomBox(
|
|
{title:"Zoom box: Selecting it you can zoom on an area by clicking and dragging."});
|
|
var panel = new OpenLayers.Control.Panel({defaultControl: zb});
|
|
panel.addControls([
|
|
zb,
|
|
new OpenLayers.Control.DrawFeature(vlayer, OpenLayers.Handler.Path,
|
|
{title:'Draw a feature'}),
|
|
new OpenLayers.Control.ZoomToMaxExtent({title:"Zoom to the max extent"})
|
|
]);
|
|
|
|
nav = new OpenLayers.Control.NavigationHistory();
|
|
// parent control must be added to the map
|
|
map.addControl(nav);
|
|
panel.addControls([nav.next, nav.previous]);
|
|
|
|
map.addControl(panel);
|
|
|
|
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload="init()">
|
|
<h1 id="title">Custom Control.Panel</h1>
|
|
<div id="tags">
|
|
panels, CSS, style, basic
|
|
</div>
|
|
<p id="shortdesc">
|
|
Create a custom control.panel, styled entirely with
|
|
CSS, and add your own controls to it.
|
|
</p>
|
|
<div id="panel"></div>
|
|
<div id="map" class="smallmap"></div>
|
|
</body>
|
|
</html>
|