Files
openlayers/tests/manual/draw-feature.html

74 lines
2.3 KiB
HTML

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Draw Feature Acceptance Test</title>
<style type="text/css">
body {
font-size: 0.8em;
}
p {
padding-top: 1em;
}
.map {
margin: 1em;
float: left;
width: 256px;
height: 256px;
}
</style>
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript">
var map1, map2;
function init(){
var wms, vector, ctrl;
var goodMaxRes = OpenLayers.Map.prototype.maxResolution;
var badMaxRes = 0.00000001;
map1 = new OpenLayers.Map('map1');
wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'});
vector = new OpenLayers.Layer.Vector("vector1");
map1.addLayers([wms, vector]);
ctrl = new OpenLayers.Control.DrawFeature(vector,
OpenLayers.Handler.Path);
map1.addControl(ctrl);
ctrl.activate();
map2 = new OpenLayers.Map('map2',
{maxResolution: badMaxRes});
wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'},
{maxResolution: goodMaxRes});
vector = new OpenLayers.Layer.Vector("vector2",
{maxResolution: goodMaxRes});
map2.addLayers([wms, vector]);
ctrl = new OpenLayers.Control.DrawFeature(vector,
OpenLayers.Handler.Path);
map2.addControl(ctrl);
ctrl.activate();
map1.setCenter(new OpenLayers.LonLat(0, 0), 3);
map2.setCenter(new OpenLayers.LonLat(0, 0), 3);
}
</script>
</head>
<body onload="init()">
<div id="map1" class="map"></div>
<p><b>Resolution properties set at the map level.</b></p>
<p>Points should draw as you draw lines. Click to start
drawing and double-click to draw the last point.</p>
<br style="clear: both;" />
<div id="map2" class="map"></div>
<p><b>Resolution properties set at the layer level.</b></p>
<p>Points should draw as you draw lines. Click to start
drawing and double-click to draw the last point.</p>
</body>
</html>