summaryrefslogtreecommitdiff
path: root/misc/openlayers/tests/manual/draw-feature.html
blob: 8872b631edeeb42b79eb8bec17237833cb002d46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<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>