~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to gis/dhis-gis-geostat/mfbase/openlayers/examples/custom-control-point.html

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html xmlns="http://www.w3.org/1999/xhtml">
 
2
  <head>
 
3
    <title>OpenLayers Custom Control Point Examle</title>
 
4
    <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
 
5
    <link rel="stylesheet" href="style.css" type="text/css" />
 
6
    <script src="../lib/OpenLayers.js"></script>
 
7
    <script type="text/javascript">
 
8
        var lon = 5;
 
9
        var lat = 40;
 
10
        var zoom = 5;
 
11
        var map, layer;
 
12
 
 
13
        function init(){
 
14
            map = new OpenLayers.Map( $('map') );
 
15
 
 
16
            layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
 
17
                    "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
 
18
 
 
19
            var control = new OpenLayers.Control();
 
20
            OpenLayers.Util.extend(control, {
 
21
                draw: function () {
 
22
                    // this Handler.Point will intercept the shift-mousedown
 
23
                    // before Control.MouseDefault gets to see it
 
24
                    this.point = new OpenLayers.Handler.Point( control,
 
25
                        {"done": this.notice},
 
26
                        {keyMask: OpenLayers.Handler.MOD_SHIFT});
 
27
                    this.point.activate();
 
28
                },
 
29
 
 
30
                notice: function (bounds) {
 
31
                    document.getElementById('bounds').innerHTML = bounds;
 
32
                }
 
33
            });
 
34
 
 
35
            map.addLayer(layer);
 
36
            map.addControl(control);
 
37
            map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
 
38
        }
 
39
    </script>
 
40
  </head>
 
41
  <body onload="init()">
 
42
      <h1 id="title">Custom Control Point Example</h1>
 
43
 
 
44
      <div id="tags">
 
45
      </div>
 
46
 
 
47
      <p id="shortdesc">
 
48
          Demonstrate the addition of a point reporting control to the OpenLayers window.
 
49
      </p>
 
50
 
 
51
    <div id="map" class="smallmap"></div>
 
52
    <div id="bounds"></div>
 
53
 
 
54
    <div id="docs"></div>
 
55
  </body>
 
56
</html>